instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I have read this post about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do you test private methods? Should I always test them?
stackexchange/codereview
Is it possible to customize the syntax highlighting in Visual Studio 2005? Up to now, I found no way to do this. In eclipse for example, it's possible to setup custom highlighting.
stackexchange/codereview
How do you update your SQL sever database when installing your product's update? Are there any tools that will integrate with windows installer? My typical schema changes are: Adding/removing columns Adding/removing tables. Adding views. Adding/alter indexs.
stackexchange/codereview
Simple question, but one that I've been curious about...is there a functional difference between the following two commands? String::class String.class They both do what I expect -- that is to say they return Class -- but what is the difference between using the :: and the .? I notice that on those classes that have c...
stackexchange/codereview
I'm looking for a way to change the hostname and IP address of a Windows XP system that is mounted via a loop-back image on a Linux system. So basically I have access to the Windows XP system on a file level, but I cannot execute any programs on it. A way similar to editing the /etc/hostname and whatever network config...
stackexchange/codereview
How do I end a Tkinter program? Let's say I have this code: from Tkinter import * def quit(): # code to exit root = Tk() Button(root, text="Quit", command=quit).pack() root.mainloop() How should I define the quit function to exit my application?
stackexchange/codereview
I want to create basic low-poly 3D models to use in XNA Game Studio games. What cheap/free tools do people recommend? And does anyone have any links or snippets of code that show how to load 3D models of some sort into XNA and then draw them on the screen?
stackexchange/codereview
If I was to create a ipfw divert rule to forward all FTP traffic to a specific socket, is it possible to use Java to connect to the socekt and read the packet information? If so, how would i go about reading/writing to the scoket?
stackexchange/codereview
Seriously. On a 22" monitor, it only covers maybe a quarter of the screen. I need some ammo to axe down this rule. I'm not saying that there shouldn't be a limit; I'm just saying, 80 characters is very small.
stackexchange/codereview
I need to cache a single page. I've used ActionController's caches_page for this. But now, I'd like to expire AND regenerate it once in every 10 minutes. What are my options? later: I'd like to not use any external tools for this, like cron. The important point is interval-based expiry of the cache.
stackexchange/codereview
In order to know how many times a pattern exists in current buffer, I do: :%s/pattern-here/pattern-here/g It gives the number of occurrences of the pattern, but is obviously cumbersome and also has the side-effect of setting the 'changed' status. Is there a more elegant way to count?
stackexchange/codereview
What is a good challenge to improve your skills in object oriented programming? The idea behind this poll is to provide an idea of which exercises are useful for learning OOP. The challenge should be as language agnostic as possible, requiring either little or no use of specific libraries, or only the most common of li...
stackexchange/codereview
Is there a way to access Visual Studio's built-in ASP.NET Development Server over HTTPS?
stackexchange/codereview
When developing an application that sends out notification email messages, what are the best practices for not getting flagged as a spammer by your hosting company. (Cover any of:) best technique for not flooding a mail server best mail server products, if you were to set up your own sending messages as if from a ...
stackexchange/codereview
I come from the Microsoft world (and I come in peace). I want to rapidly prototype a web app and if it works out, take it live - and I don't want to use ASP.Net. I am not sure which web application toolkit to use though. Should I use GWT, DOJO...other recommendations? I am open to any server-side language but am looki...
stackexchange/codereview
I'm new to BIRT and I'm trying to make the Report Engine running. I'm using the code snippets provided in http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php But I have a strange exception: java.lang.AssertionError at org.eclipse.birt.core.framework.Platform.startup(Platform.java:86) and nothing in t...
stackexchange/codereview
How do I create a self signed SSL certificate for an Apache Server to use while testing a web app?
stackexchange/codereview
On these questions: Which Vista edition is best for a developer machine? Vista or XP for Dev Machine People are recommending 64 bit, can you explain why? Is it just so you can have more then 3GB of addressable RAM that 32 bit gives you? And how does Visual Studio benefit from all this extra RAM? I went from 64 bit XP...
stackexchange/codereview
As someone who has spent around 10 years programming web applications with Adobe's ColdFusion, I have decided to add ASP.NET as a string to my bow. For someone who has spent so long with CF and the underlying Java, ASP.NET seems a little alien to me. How should I go about getting up to speed with ASP.NET so that I can...
stackexchange/codereview
Is it ready for that? I've been playing with it for a short amount of time and it seems quite reasonable. Is anyone using it for live sites? any issues to be aware of?
stackexchange/codereview
I am completely on board with the ideas behind TDD, Refactoring and Patterns however it does seem like there is a huge gaping whole in these ideas, mainly that they are great for dev teams of 1, but when you start refactoring code that 10 people are working on you start getting merge conflicts all over the place and mo...
stackexchange/codereview
When refactoring away some #defines I came across declarations similar to the following in a C++ header file: static const unsigned int VAL = 42; const unsigned int ANOTHER_VAL = 37; The question is, what difference, if any, will the static make? Note that multiple inclusion of the headers isn't possible due to the c...
stackexchange/codereview
I have inherited a VB6/Access application that we have developed and sold for many years. We're going to SQL Server 2005 Express Edition and .Net. The application can be multi-user. Currently the setup is simple for the customer -- Navigate to the folder to create the database on first launch; second user browses t...
stackexchange/codereview
My credit card processor requires I send a two-digit year from the credit card expiration date. Here is how I am currently processing: I put a DropDownList of the 4-digit year on the page. I validate the expiration date in a DateTime field to be sure that the expiration date being passed to the CC processor isn't expi...
stackexchange/codereview
I am developing an application using vb.net. For performing some tasks the application needs administrator privileges in the machine. How to ask for the privileges during the execution of the program? What is the general method of switching user accounts for executing an application? In other words, is there some way f...
stackexchange/codereview
I was surprised to find today that I couldn't track down any simple way to write the contents of an InputStream to an OutputStream in Java. Obviously, the byte buffer code isn't difficult to write, but I suspect I'm just missing something which would make my life easier (and the code clearer). So, given an InputStream ...
stackexchange/codereview
How can you programmatically set the parameters for a subreport? For the top-level report, you can do the following: reportViewer.LocalReport.SetParameters ( new Microsoft.Reporting.WebForms.ReportParameter[] { new Microsoft.Reporting.WebForms.ReportParameter("ParameterA", "Test"), new Microso...
stackexchange/codereview
What is the point of type definition on method parameters on Caché Object (from Intersystems) since after it's pre-compiled to the .int format, it removes any typing information, thus making no difference at all?
stackexchange/codereview
Does anyone know is there a way to open a project in Eclipse in read-only mode? If there is a lot of similar projects open it is easy to make changes to a wrong one.
stackexchange/codereview
I am the maintainer of a site that has allegedly 'lost' the source code to a flash swf file. How do I decompile this source? Are there any programs online or offline that I could use?
stackexchange/codereview
I'm working on a document "wizard" for the company that I work for. It's a .dot file with a header consisting of some text and some form fields, and a lot of VBA code. The body of the document is pulled in as an OLE object from a separate .doc file. Currently, this is being done as a Shape, rather than an InlineShape. ...
stackexchange/codereview
I need to implement an in-memory tuple-of-strings matching feature in C. There will be large list of tuples associated with different actions and a high volume of events to be matched against the list. List of tuples: ("one", "four") ("one") ("three") ("four", "five") ("six") event ("one", "two", "three", "four")...
stackexchange/codereview
I was going to ask what the best way to do this is, but then decided I should ask whether or not it is even necessary. I have never seen it done in JSP development, but it appears to be common practice in PHP. What is the reasoning behind this, and if I do not protect against this, what else should I be taking into con...
stackexchange/codereview
I'm trying to figure out what a Java applet's class file is doing under the hood. Opening it up with Notepad or Textpad just shows a bunch of gobbledy-gook. Is there any way to wrangle it back into a somewhat-readable format so I can try to figure out what it's doing? Environment == Windows w/ VS 2008 installed.
stackexchange/codereview
I'm new to .Net and I'm trying to understand the basics first. What is the difference between MSIL and Java bytecode?
stackexchange/codereview
The default 64 MB max heap memory can be small for a large Java application. Are there any applet parameter to increment this for a signed applet? For a Java program this is a simple command line parameter but how this work for an applet in the browser.
stackexchange/codereview
I'm creating a form using the Content Construction Kit (CCK) in Drupal5. I've added several singe on/off checkboxes but their associated labels are not being displayed. Help text is displayed underneath the checkboxes but this is not the desired behavior. To me the expected behavior is that the label would appear b...
stackexchange/codereview
In C++, when is it best to use the stack? When is it best to use the heap?
stackexchange/codereview
I have a list box that displays items based on an XPath query. This XPath query changes depending on the user's selection elsewhere in the GUI. The XPath always refers to the same document. At the moment, I use some C# code behind to change the binding of the control to a new XPath expression. I'd like instead to bind ...
stackexchange/codereview
A while ago, I came across some code that marked a data member of a class with the mutable keyword. As far as I can see it simply allows you to modify a member in a const-qualified member method: class Foo { private: mutable bool done_; public: void doSomething() const { ...; done_ = true; } }; Is...
stackexchange/codereview
I'm wanting to get the full value of a char[] variable in the VC6 watch window, but it only shows a truncated version. I can copy the value from a debug memory window, but that contains mixed lines of hex and string values. Surely there is a better way??
stackexchange/codereview
Assuming a map where you want to preserve existing entries. 20% of the time, the entry you are inserting is new data. Is there an advantage to doing std::map::find then std::map::insert using that returned iterator? Or is it quicker to attempt the insert and then act based on whether or not the iterator indicates the...
stackexchange/codereview
I have this method on a webpart: private IFilterData _filterData = null; [ConnectionConsumer("Filter Data Consumer")] public void GetConnectionInterface(IFilterData filterData) { _filterData = filterData; } Now, before I can call upon _filterData, I need to know when i can expect it to not be null. When is this?...
stackexchange/codereview
Our build server is taking too long to build one of our C++ projects. It uses Visual Studio 2008, running devenv.com MyApp.sln /Build -- see devenv command-line switches (although that's for a newer version of VS). Is there a way to get devenv.com to log the time taken to build each project in the solution, so that I k...
stackexchange/codereview
I'm currently using .resx files to manage my server side resources for .NET. the application that I am dealing with also allows developers to plugin JavaScript into various event handlers for client side validation, etc.. What is the best way for me to localize my JavaScript messages and strings? Ideally, I would lik...
stackexchange/codereview
How to get an instance's member's values? With propertyInfos there is a propertyInfo.GetValue(instance, index), but no such thing exists in memberInfo. I searched the net, but it seems to stop at getting the member's name and type.
stackexchange/codereview
When trying to run the Flex Builder 3 profiler on any I don't get the profiler dialog window and then after a few seconds I get "Socket timeout" in the console window. Any ideas why it can't connect? I've got the latest debug version of Flash player and have tried shutting off my firewall. I'm running it on XP from th...
stackexchange/codereview
Aside from trying perldoc <module name> individually for any CPAN module that takes my fancy or going through the file system and looking at the directories, I have no idea what modules we have installed. What's the easiest way to just get a big list of every CPAN module installed? From the command line or otherwise.
stackexchange/codereview
I'm looking for an algorithm to detect if two rectangles intersect (one at an arbitrary angle, the other with only vertical/horizontal lines). Testing if a corner of one is in the other ALMOST works. It fails if the rectangles form a cross-like shape. It seems like a good idea to avoid using slopes of the lines, which...
stackexchange/codereview
I really want to get the google Calendar Api up an running. I found a great article about how to get started. I downloaded the Zend GData classes. I have php 5 running on my dev box and all the exetensions should be loading. I cant get openssl running and recieve the following error when I try to run any of the examp...
stackexchange/codereview
I would like to use the Logger tool that ships with the Microsoft Debugging Tools for Windows. However, on Vista it crashes even with built-in Vista applications: > logger calc or > logger notepad The issue occurs if I run the tool from a command prompt with or without administrator rights. I'm using version 3.01 ...
stackexchange/codereview
I'm looking for a way to add multiple properties to the SecureCustomProperties value in my .msi installer's property table. I've tried comma delimiting, semi-colon delimiting, and even space delimiters. None of the above seem to work. Hints?
stackexchange/codereview
I know how to use rpm to list the contents of a package (rpm -qpil package.rpm). However, this requires knowing the location of the .rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to achieve this?
stackexchange/codereview
Recently, I've started having a problem with my SQL Server 2005 client running on Windows XP where right-clicking on any job and selecting Properties instead brings me to the New Job window. Also, if I select "View History", I get the history for all jobs, instead of the one I right-clicked on. This happened to me o...
stackexchange/codereview
I am looking to convert a MySQL timestamp to a epoch time in seconds using PHP, and vice versa. What's the cleanest way to do this?
stackexchange/codereview
Suppose I have some XAML like this: <Window.Resources> <v:MyClass x:Key="whatever" Text="foo\nbar" /> </Window.Resources> Obviously I want a newline character in the MyClass.Text property, but the XAML parser constructs the object with the literal string "foo\nbar". Is there (a) a way to convince the parser to trans...
stackexchange/codereview
Silverlight v2.0 is getting closer and closer to RTM but I have yet to hear any stats as to how many browsers are running Silverlight. If I ask Adobe (by googling "Flash install base") they're only too happy to tell me that 97.7% of browsers are running Flash player 9 or better. Not that I believe everything I read, bu...
stackexchange/codereview
We have project PrjDb.dll in vb 6.0 that has a reference to ado 2.5. The project is built on Machine A. Now when we generate an interop for PrjDb.dll on another machine B, we end up with a new ADODB.dll with ver 2.5 in version field instead of linking it with the Primary Interop Assembly adodb.dll ( found under 'Progra...
stackexchange/codereview
Is it possible to get a thread dump of a Java Web Start application? And if so, how? It would be nice if there were a simple solution, which would enable a non-developer (customer) to create a thread dump. Alternatively, is it possible to create a thread dump programmatically? In the Java Web Start Console I can get a ...
stackexchange/codereview
I noticed in another post, someone had done something like: double d = 3.1415; int i = Convert.ToInt32(Math.Floor(d)); Why did they use the convert function, rather than: double d = 3.1415; int i = (int)d; which has an implicit floor and convert. Also, more concerning, I noticed in some production code I was reading:...
stackexchange/codereview
I have two insert statements, almost exactly the same, which run in two different schemas on the same Oracle instance. What the insert statement looks like doesn't matter - I'm looking for a troubleshooting strategy here. Both schemas have 99% the same structure. A few columns have slightly different names, other than ...
stackexchange/codereview
How do I move an active directory group to another organizational unit using Powershell? ie. I would like to move the group "IT Department" from: (CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca) to: (CN=IT Department, OU=Temporarily Moved Groups, DC=Company,DC=ca)
stackexchange/codereview
I'm writing a Java application that runs on Linux (using Sun's JDK). It keeps creating /tmp/hsperfdata_username directories, which I would like to prevent. Is there any way to stop java from creating these files?
stackexchange/codereview
PHP5 has a "magic method" __call()that can be defined on any class that is invoked when an undefined method is called -- it is roughly equivalent to Ruby's method_missing or Perl's AUTOLOAD. Is it possible to do something like this in older versions of PHP?
stackexchange/codereview
I've been a Unix-based web programmer for years (Perl and PHP). I'm also competent with C and C++ (and bash and that sort of sysadmin sort of stuff) in terms of the language itself. I've never had a problem learning a new language (I mucked around with Java a few years ago and whilst I could write it I just didn't li...
stackexchange/codereview
I need a function like this: // return true if 'n' is a power of 2, e.g. // is_power_of_2(16) => true // is_power_of_2(3) => false bool is_power_of_2(int n); Can anyone suggest how I could write this?
stackexchange/codereview
What is the purpose of the code behind view file in ASP.NET MVC besides setting of the generic parameter of ViewPage ?
stackexchange/codereview
Let's say we have the following method declaration: Public Function MyMethod(ByVal param1 As Integer, _ Optional ByVal param2 As Integer = 0, _ Optional ByVal param3 As Integer = 1) As Integer Return param1 + param2 + param3 End Function How does VB.NET make the optional parameters work within the confine...
stackexchange/codereview
As the title says on a website is it possible to tell if a user has viewed a portion of the page?
stackexchange/codereview
I am developing an application, and have URLs in the format www.example.com/some_url/some_parameter/some_keyword. I know by design that there is a maximum length that these URLs will have (and still be valid). Should I validate the URL length with every request in order to protect against buffer overflow/injection atta...
stackexchange/codereview
I am writing an editor using Scintilla. I am already using a lexer to do automatic syntax highlighting but now I would like to mark search results. If I want to mark only one hit I can set the selection there, however, I would like to mark (e.g. with yellow background) all the hits. I writing this in Perl but if you ha...
stackexchange/codereview
I am interested to learn: what are the most common technical causes (from the perspective of operating system programming) of an operating system crash (not limited to Windows crashes)? I'm looking for an answer not like "too many apps open", but what specifically happens when too many apps are open that causes the cr...
stackexchange/codereview
I have lots of unrelated named things that I'd like to do quick searches against. An "aardvark" is always an "aardvark" everywhere, so hashing the string and reusing the integer would work well to speed up comparisons. The entire set of names is unknown (and changes over time). What is a fast string hashing algorithm t...
stackexchange/codereview
I wish to know all the pros and cons about using these two methods. In particular the implications on web security. Thanks.
stackexchange/codereview
I have a function inside a loop inside a function. The inner function acquires and stores a large vector of data in memory (as a global variable... I'm using "R" which is like "S-Plus"). The loop loops through a long list of data to be acquired. The outer function starts the process and passes in the list of datasets t...
stackexchange/codereview
What Fortran compilers are there in this day and age, and which would you recommend? Please list the version of Fortran it supports, the platform it works on (e.g. *nix / Windows), and whether it cost money. (Standard OS one per answer etc.)
stackexchange/codereview
For a project I'm working on, the store has two types of products - a real product and a group of products. For this discussion, let's call them "1 T shirt" and "a box of T shirts". For one t-shirt, I need to store the normal attributes - price, sku, size, color, description, etc. For the box of t-shirts I need to ...
stackexchange/codereview
I have written a simple HTTP Proxy server in C# that I would like to integration/functional test. Is there a product already created that I could use to do this? If not, what is the best way to write my own tests for this (I already have unit tests)?
stackexchange/codereview
Some things are easier to implement just by hand (code), but some are easier through WF. It looks like WF can be used to create (almost) any kind of algorithm. So (theoretically) I can do all my logic in WF, but it's probably a bad idea to do it for all projects. In what situations is it a good idea to use WF and when ...
stackexchange/codereview
For a while, I thought I'd host stuff at home because I can do whatever I want. However, hurricane Ike knocked out my power for a week, and I've finally realized this situation won't work. I have extremely low traffice websites (20 visitors/day), so I don't need tons of CPU or bandwidth. What cheap options are there ...
stackexchange/codereview
I`d like to be able to read the content of office documents (for a custom crawler). The office version that need to be readable are from 2000 to 2007. I mainly want to be crawling words, excel and powerpoint documents. I don`t want to retrieve the formatting, only the text in it. The crawler is based on lucene.NET if...
stackexchange/codereview
In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac. Please keep ...
stackexchange/codereview
In Sitecore 6, one of my templates contains a "Droplink" field bound to the results of a particular sitecore query. This query currently returns approximately 200 items. When I look at an item that implements this template in the content editor, I can only see the first 50 items in the field's dropdown list. How do I d...
stackexchange/codereview
I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the Gdikdx.dll extension to look at Gdi information but this extension is not supported on XP or Vista. Does anyone have any pointers for ...
stackexchange/codereview
Say I have a list as follows: item1 item2 item3 Is there a CSS selector that will allow me to directly select the last item of a list? In this case item 3. Cheers!
stackexchange/codereview
In Jetty, if there is no deployment at '/' then the DefaultHandler displays a list of known contexts. This is very useful during development. Is it possible to configure BEA Weblogic to provide a similar convenience?
stackexchange/codereview
Is it possible to use both JScript and VBScript in the same HTA? Can I call VBScript functions from JScript and vice-versa? Are there any "gotchas," like the JScript running first and the VBScript running second (classic ASP pages have this issue).
stackexchange/codereview
Do I risk losing sales by disabling SSL 2.0 and PCT 1.0 in IIS5? Clarification: Sales would be lost by client not being able to connect via SSL to complete ecommerce transaction because SSL 2.0 or PCT 1.0 is disabled on the web server. Microsoft kbase article: http://support.microsoft.com/kb/187498
stackexchange/codereview
I'm using the System.Windows.Forms.WebBrowser, to make a view a-la Visual Studio Start Page. However, it seems the control is catching and handling all exceptions by silently sinking them! No need to tell this is a very unfortunate behaviour. void webBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) { ...
stackexchange/codereview
By default, emacs 22.1.1 only shows the top of the compilation buffer when you first issue the compile command. I would like it to scroll to the bottom automatically when I use the compile command in order to save keystrokes. This way I can easily get a status of the current compilation by just looking at the compile...
stackexchange/codereview
I need to quickly (and forcibly) kill off all external sessions connecting to my oracle database without the supervision of and administrator. I don't want to just lock the database and let the users quit gracefully. How would I script this?
stackexchange/codereview
I'm trying to create a Palm OS app to check a web site every X minutes or hours, and provide a notification when a piece of data is available. I know that this kind of thing can be done on the new Palm's - for example, my Centro can have email or web sites download when the application isn't on top - but I don't know ...
stackexchange/codereview
I have a free standing set of files not affiliated with any C# project at all that reside in a complicated nested directory structure. I want to add them in that format to a different directory in an ASP.NET web application I am working on; while retaining the same structure. So, I copied the folder into the target loc...
stackexchange/codereview
From what I can gather, there are three categories: Never use GET and use POST Never use POST and use GET It doesn't matter which one you use. Am I correct in assuming those three cases? If so, what are some examples from each case?
stackexchange/codereview
Everyone is aware of Dijkstra's Letters to the editor: go to statement considered harmful (also here .html transcript and here .pdf) and there has been a formidable push since that time to eschew the goto statement whenever possible. While it's possible to use goto to produce unmaintainable, sprawling code, it neverthe...
stackexchange/codereview
I need to combine a VB web project and a C# web project and have them run alongside each other in the same web root. For instance, I need to be able to navigate to localhost:1234/vbProjPage.aspx and then redirect to localhost:1234/cSharpProjPage.aspx. Is this possible from within Visual Studio 2008? I know you have t...
stackexchange/codereview
I'm looking for an online tool that will let me create a gif or png like this one: Some kind of LaTex online service, with friendly examples?
stackexchange/codereview
I'm having a little bit of a problem scaling my images to a properly predefined size. I was wondering - since it is purely mathematics, if there's some sort of common logical algorithm that works in every language (PHP, ActionScript, Javascript etc.) to scale images proportionally. I'm using this at the moment: var ma...
stackexchange/codereview
Does anyone know a mechanism to calculate at compile-time the LCM (Least Common Multiple) and/or GCD (Greatest Common Denominator) of at least two number in C (not C++, I know that template magic is available there)? I generally use GCC and recall that it can calculate certain values at compile-time when all inputs are...
stackexchange/codereview
How do I represent an aggregation relation between two classes in UML, such that each class has a link to the other class's interface, not the implementing class? E.g. I have a class Foo that implements iFoo, and Bar that implements iBar. Foo should have a member variable of type iBar, and Bar should have a member vari...
stackexchange/codereview