instruction
stringlengths
0
30k
If you're using VB.NET, you can tap into the very convenient ApplicationEvents.vb. This file comes for free with a VB.NET WinForms project and contains a method for handling [unhandled exceptions][1]. To get to this nifty file, it's "Project Properties >> Application >> Application Events" If you're not using VB.NET, then yeah, it's handling [Application.ThreadException][2]. [1]: http://msdn.microsoft.com/en-us/library/3a02k5s0(VS.80).aspx [2]: http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx
Some object suppose the .dispose() method which forces the resource to be removed from memory.
Clipboard manager. http://www.csharper.net/blog/web_deployer_2005_version_1_0_0_2_available.aspx#new_clipboard_manager_upgrade_1_0_0_4.aspx Maintains your clipboard data through removal of lines, a few other nice items but that one alone makes me happy. Regionerate http://www.rauchy.net/regionerate/ While some have problems with regions I think if you use them, this tool is for you. Automatically region'izes your code into appropriate region blocks. Fully configurable for custom items etc.
[Clipboard Manager][1] Maintains your clipboard data through removal of lines, a few other nice items but that one alone makes me happy. [Regionerate][2] While some have problems with regions I think if you use them, this tool is for you. Automatically region'izes your code into appropriate region blocks. Fully configurable for custom items etc. [1]: http://www.csharper.net/blog/web_deployer_2005_version_1_0_0_2_available.aspx#new_clipboard_manager_upgrade_1_0_0_4.aspx [2]: http://www.rauchy.net/regionerate/
[PowerCommands][1] is a Microsoft-created plugin that offers a variety of new features that one would think probably should have been in Visual Studio in the first place. These include * Copying/Pasting project references! * "Open Containing Folder" to jump straight to the hard-drive location of a file or project * Automatic reorganizig and sorting of using statements * "Open Command Prompt Here" to open a command prompt in any of your project folders. * Collapse Projects [1]: http://www.visualstudiogallery.com/ExtensionDetails.aspx?ExtensionId=df3f0c30-3d37-4e06-9ef8-3bff3508be31
I'd go for: 1. Closures 2. Duck typing 3. Builders (XML builder and slurper) 4. GStrings 5. Grails
How is the best way to setup an integration testing server?
|integration-testing|continuous-integration|
Setting up an integration server, I’m in doubts about the best approach regarding multiple tasks to complete the build. Is the best way set all in just one big-job or make small dependents ones?
What is the best way to setup an integration testing server?
|continuous-integration|integration-testing|
Setting up an integration server, I’m in doubt about the best approach regarding using multiple tasks to complete the build. Is the best way to set all in just one big-job or make small dependent ones?
Is there a wxWidgets framework for C?
|c|user-interface|
My understanding is that [wxWidgets][1] is for a number of programming languages (C++, Python, Perl, and C#/.NET) but that does not include C. Is there a similar framework for the C programming language, or is this not something that C is used for? [1]: http://www.wxwidgets.org
|c|user-interface|
GUI toolkit for rapid development?
|user-interface|
I want to write the front end to the application written in c/c++. I use solaris 10 and plan to port app to other architectures also(Windows first).
|user-interface|unix|solaris|
I want to write a front-end to an application written in C/C++. I use Solaris 10 and plan to port the application to some other architectures (Windows first).
|user-interface|unix|solaris|
IMO, this is the cleanest answer: <html> <head><title>title</title></head> <body> <form action="" method="get"> Name: <input type="text" name="name"/><br/> Pwd: <input type="password" name="password"/><br/> <div class="yourCustomDiv"/> <input type="submit" style="display:none"/> </form> </body> </html> Better yet, if you are using javascript to submit the form using the custom div, you should also use javascript to create it, and to set the display:none style on the button. This way users with javascript disabled will still see the submit button and can click on it.
How do I download a file over HTTP using Python?
|python|podcast|podcasting|
I have a small utility that I use to download an MP3 from a website on a schedule and then builds/updates a podcast XML file which I've obviously added to iTunes. The text processing that creates/updates the XML file is written in Python. I use wget inside a Windows .bat file to download the actual MP3 however. I would prefer to have the entire utility written in Python though. (It was the project I used to begin learning Python.) I struggled though to find a way to actually down load the file in Python, thus why I resorted to wget. So, how do I download the file using Python?
Finding the storage card path on WM6.
|windows-mobile|
Is there an easy way to find the storage card's path on a Windows Mobile device when there is a storage card and a bluetooth ftp connection?
Check out this blog post on [kirupa][1]. ![alt text][2] [1]: http://www.kirupa.com/blend_wpf/custom_wpf_windows.htm [2]: http://www.kirupa.com/blend_wpf/images/cwImage.png
What's the best way to use SOAP with Ruby?
|ruby|ruby-on-rails|soap|
A client of mine has asked me to integrate a 3rd party API into their Rails app. The only problem is that the API uses SOAP. Ruby has basically dropped SOAP in favor of REST. They provide a Java adapter that apparently works with the Java-Ruby bridge, but we'd like to keep it all in Ruby, if possible. I looked into soap4r, but it seems to have a slightly bad reputation. So what's the best way to integrate SOAP calls into a Rails app?
In my experience, the "elegance" of an app typically has more to do with the database design than anything. If you have a _great_ database design, including a well-defined stored procedure interface, good application code tends to follow no matter what platform you use. If you have _poor_ database design, no matter what platform you use you'll have a very difficult time building elegant application code, as you'll be constantly compensating for the database. Of course, there's plenty of room between _great_ and _poor_, but my point is that if you want good application code, start by making sure your database is up to snuff.
The backend will be SQL Server 2005 Frontend / Application Logic will be .Net Besides GUIDs, can you think of other ways to resolve the "merge" that happens when the offline computer syncs the new data back into the central database? I mean, if the keys are INTs, i'll have to renumber everything when importing basically. GUIDs will spare me of that.
Unless it's more than 1 argument, I always use arrays or objects as constructor parameters and rely on error checking to make sure the required parameters are there.
Two approaches have worked well for me. One is the "working prototype" which you sort of described in your question. In my experience, the company contracted a user interface expert to create fully functional HTML mocks. The data on the page was static, but it allowed for developers and management to see and play with a "functional" version of the site. All that was left to do was replace the static data on the pages with dynamic content - this prototype was our spec for the initial version of our product. The designer even included detailed explanation of some subtle behavior in popup dialogs that would appear when hovering over mock links. It worked well for our team. On a subsequent project, we didn't have the luxury of the UI expert, but we used similar approach. We used a wiki to mock a version of the site. We created links between the functional aspects of the system and documented each piece of functionality in detail. Each piece of functionality could, in turn, link to detailed design and architecture decisions. We also used to wiki to hold our to list feature list for each release (which became our release notes). These documents linked back to the detailed feature page. The wiki became a living document - describing our releases and evolution of our system in great detail. It was an invaluable resource. I prefer the wiki to the working prototype because it's more easily extensible - growing and becoming more valuable as your system evolves.
When shifting left, there is no difference between arithmetic and logical shift. When shifting right, the type of shift depends on the type of the value being shifted. (As background for those readers unfamiliar with the difference, a "logical" right shift by 1 bit shifts all the bits to the right and fills in the leftmost bit with a 0. An "arithmetic" shift leaves the original value in the leftmost bit. The difference becomes important when dealing with negative numbers.) When shifting an unsigned value, the >> operator in C is a logical shift. When shifting a signed value, the >> operator is an arithmetic shift. For example, assuming a 32 bit machine: signed int x1 = 5; assert((x1 >> 1) == 2); signed int x2 = -5; assert((x2 >> 1) == -3); unsigned int x3 = (unsigned int)-5; assert((x3 >> 1) == 0x7FFFFFFD);
Exactly what [Biri][1] said. Here is how I would reindex an entire database: EXEC [sp_MSforeachtable] @command1="RAISERROR('DBCC DBREINDEX(''?'') ...',10,1) WITH NOWAIT DBCC DBREINDEX('?')" [1]: http://stackoverflow.com/questions/7579/reorganise-index-vs-rebuild-index-in-sql-server-maintenance-plan?sort=Votes#7595
According to [K&R Second edition (the bible)][1] the results are implementation-defined for right-shifts of signed values. [Wikipedia][2] says that C/C++ 'usually' implements an arithmetic shift on signed values. Basically you need to either test your compiler or not rely on it. My VS2008 help for the current MS C++ compiler says they do an arithmetic shift. [1]: http://www.amazon.com/Programming-Language-Prentice-Hall-Software/dp/0131103628/ref=pd_bbs_1?ie=UTF8&s=books&qid=1218445920&sr=8-1 [2]: http://en.wikipedia.org/wiki/Arithmetic_shift
Well, I looked [it up on wikipedia][1], and they have this to say: > C, however, has only one right shift > operator, >>. Many C compilers choose > which right shift to perform depending > on what type of integer is being > shifted; often signed integers are > shifted using the arithmetic shift, > and unsigned integers are shifted > using the logical shift. So it sounds like it depends on your compiler. Also in that article, note that left shift is the same for arithmetic and logical. I would recommend doing a simple test with some signed and unsigned numbers on the border case (high bit set of course) and see what the result is on your compiler. I would also recommend avoiding depending on it being one or the other since it seems C has no standard, at least if it is reasonable and possible to avoid such dependence. [1]: http://en.wikipedia.org/wiki/Logical_shift
You more or less only have two alternatives when sending mail via the browser..<br /><br /> Nr 1 is to make a page that takes user input, and allows them to send the mail via your web-server. You need some kind of server-side scripting for this. <br /> Nr 2 is to use a mailto: link to trigger opening of the users registered mail client. This has the obvious pitfalls you mentioned, and is less flexible. It needs less work though. <br />
You more or less only have two alternatives when sending mail via the browser.. 1. make a page that takes user input, and allows them to send the mail via your web-server. You need some kind of server-side scripting for this. 2. use a mailto: link to trigger opening of the users registered mail client. This has the obvious pitfalls you mentioned, and is less flexible. It needs less work though.
The easiest way is to look through the logs, but if that doesn't include the referrer than you may also want to monitor what is going out from your web to the app server. You can use tools like Wireshark or Microsoft Network Monitor to see this traffic. The other "solution" and I use this loosely is to bind a specific web server to app server and then run through a bundle and see what it is hitting on the app server. You could probably do this in a test environment to lesson the effects on the users of the site.
There are enough problems with exceptions that can be thrown on threads by other mechanisms, like aborting threads and the likes, that you should find another way of doing it. An exception is a mechanism used to signal that a process has experienced something exceptional that it cannot deal with. You should try to avoid writing the code so that an exception is used to signal that *something else* has experienced something exceptional. That other thread will most likely not know how to handle the exception *in all cases where it could be thrown by your code*. In short, you should find some other mechanism for aborting your threads than using exceptions. Use event objects or similar to tell a thread to abort its processing, that's the best way.
I think it may be the version control we user, VSS in combination with a lack of time to learn the branching. I really like the idea of nightly check ins to help with development and avoid 'Going Dark'. I can see him being resistant to the trunks but perhaps building a development SS and when the code is production ready move it to production SS.
Use the Regex COM component built into Windows. You can find a step by step on referencing and using it in your project at: http://www.regular-expressions.info/vb.html
From the practices I have seen the term production quality is used as a 'frightener' to ensure that people are scared of breaking top of tree, not a bad thing to be honest because top of tree should always work if possible. I would say that best practice is that you should only be merging distinct (i.e. seperate) functional components on the top of tree. If you have a significant overlap on deltas to the same source files I think this 'might' indicate that somewhere along the line the project management has broken down, and that those developers should have merged their changes to seperate integration branch before going in to the main line sources. An individual developer saying that they unit tested their stuff is irrelevant, because the thing they tested has changed! Trying to solve integration problems on your main line codeline will inevitably stall other unrelated submissions.
Assuming that you are working in a centralized version control system (such as Subversion), and assuming that you have a concept of "the trunk" (where the latest well-working code lives): If you work on new features in "features branches"/"experimental branches", then it's OK to commit code which is far from finished. (When the feature is done, you commit the well-behaving result into the "trunk".) But you will not win a popularity contest if committing non-compiling/obviously non-working code into the "trunk" or a "release branch". *The Pragmatic Programmers* have a book called [*Pragmatic Version Control using Subversion*][1] which includes a section with advice about branches. [1]: http://www.pragprog.com/titles/svn2/pragmatic-version-control-using-subversion
Yes, it's possible. Just set up an empty project and specify the desired <code>.exe</code> file as debug target. I don't remember exactly how, but I know it's doable, because I used to set <code>winamp.exe</code> as debug target when I developed plug-ins for Winamp. Since you don't have the source file it will only show the assembly code, but that might still be useful as you can also inspect memory, registers, etc. <strong>Update</strong> If you are debugging an assertion in your own program you should be able to see the source just fine, since the path to the source file is stored in the executable when you compile it with debug information.
ASP.NET - How do you Unit Test WebControls?
|asp.net|unit-testing|
Alright. So I figure it's about time I get into unit testing, since everyone's been banging on about it for long enough. I've installed NUnit and gone through a few "intro to unit testing" type tutorials. I'm currently putting together a small framework to help with the rebuild of one of our web apps, so I've created a VS2008 project for my framework and I want to unit test it as I go. How on earth do I go about unit testing the WebControls? The methods are all protected or private, and since it's a framework, there isn't much else but WebControls. Any pointers? Burns
Yeah, my previous answer does not work because I didn't pay any attention to your code. :) The problem is that the anonymous function is a callback function - i.e. getJSON is an async operation that will return at some indeterminate point in time, so even if the scope of the variable were outside of that anonymous function (i.e. a closure), it would not have the value you would think it should: var studentId = null; j.getJSON(url, data, function(result) { studentId = result.Something; }); // studentId is still null right here, because this line // executes before the line that sets its value to result.Something Any code that you want to execute with the value of studentId set by the getJSON call needs to happen either **within** that callback function or **after** the callback executes.
If you're worried about forgetting to override the function, then make it abstract.
Resources of techniques use for collision detection in 2D?
|collision-detection|algorithms|techniques|
What are in your opinion the best resources (books or web pages) describing algorithms or techniques use for collision detection in a 2D environment? I'm just eager to learn different techniques to make more sophisticated and efficient games. Thanks. :D
|algorithm|
Ues the [assembly:InternalsVisibleTo][1] attribute and you'll be able to access those private members Put it in your webcontrol project's AssemblyInfo.cs (under Properties node) [assembly:InternalsVisibleTo("YourTestProjectName")] [1]: http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx
Whole Tomato's [Visual Assist X][1]. I absolutely swear by it. I would like to see a better plug in for [Lint][2] than [Visual Lint][3] by Riverblade, but since that will eventually be moved onto the build server I don't mind running it every couple of days manually. [1]: http://www.wholetomato.com/ [2]: http://www.gimpel.com/ [3]: http://www.riverblade.co.uk/products/visual_lint/index.html
I'm currently using **dhtmlxGrid** and we have the Excel copy/paste functionality working. dhtmlXGrid is the most full featured javascript grid package that I've found. On their website, dhtmlXGrid claims to support [Clipboard functionality][1] in the Professional version. (However, I noticed the Sample on their site isn't working on my Firefox. EDIT: It's probably the permissions issue that Nathan mentioned.) In any case, we had to do some extra work to get the exact Excel copy and paste functionality we wanted. We essentially had to override some of their functionality to get the desired behavior. Their support was pretty good in helping us come up with a solution. So to answer your question, you should be able to get them to support copy and paste if you purchase the Professional version. I'm just warning you that it may take some additional work to fine tune that behavior. Overall, I'm happy with dhtmlXGrid. We use a lot of their features. Their support is pretty good. They usually take one day to respond since they are in Europe (I think). And Javascript is by its very nature open source so I can always dive in when I need to. [1]: http://dhtmlx.com/docs/products/docsExplorer/index.shtml?node=dhtmlxgrid&type=smpl
Take a look at the [open street map project][1] to see how this sort of thing is being tackled in a truely free software project using only user supplied and licensed data and have a [wiki containing stuff you might find interesting][2]. A few years back the guys involved where pretty easy going and answered lots of questions I had so I see no reason why they still aren't a nice bunch. [1]: http://www.openstreetmap.org/ [2]: http://wiki.openstreetmap.org/index.php/Main_Page
No. You can check out <http://codebetter.com/blogs/karlseguin/archive/2008/04/27/foundations-of-programming-pt-7-back-to-basics-memory.aspx> for more information, but setting things to null won't do anything, except dirty your code.
No don't null objects. You can check out <http://codebetter.com/blogs/karlseguin/archive/2008/04/27/foundations-of-programming-pt-7-back-to-basics-memory.aspx> for more information, but setting things to null won't do anything, except dirty your code.
- [Resharper][1] - [Resharper MbUnit Test Runner Add-On][2] - [SQL Prompt][3] for Database Projects (works inside your SQL Management Studio as well) - [Ankh SVN 2.0][4]+ for free SVN support (v1.x pales in comparison) - [TeamCity plug-in][5] to monitor your builds, personal builds, and bug tracking [1]: http://www.jetbrains.com/resharper/index.html [2]: http://code.google.com/p/mbunit-resharper/ [3]: http://www.red-gate.com/Products/SQL_Prompt/index.htm [4]: http://ankhsvn.open.collab.net/servlets/ProjectProcess?pageID=3794 [5]: http://www.jetbrains.com/teamcity/features/supported_platforms.html#Microsoft_Visual_Studio_2005_and_2008_Integration
If you are doing this in .NET, there is an ExpectedException attribute that you can add to your test: [Test, ExpectedException(typeof(SpecificException), "Exception's specific message")] public void TestWhichHasException() { CallMethodThatThrowsSpecificException(); } Test will pass if the exception of that type and with the specified message is thrown. The attribute has other overloads including having InnerExceptions, etc.
Look into DB Unit. It is a Java library, but there must be a C# equivalent. It lets you prepare the database with a set of data so that you know what is in the database, then you can interface with DB Unit to see what is in the database. It can run against many database systems, so you can use your actual database setup, or use something else, like HSQL in Java (a Java database implementation with an in memory option). If you want to test that your code is using the database properly (which you most likely should be doing), then this is the way to go to isolate each test and ensure the database has expected data prepared.
Naming convention for VB.NET private fields
|vb.net|convention|
Is there an official convention for naming private fields in VB.NET? For example, if I have a property called 'Foo', I normally call the private field '_Foo'. This seems to be frowned upon in the [Offical Guidelines](http://msdn.microsoft.com/en-us/library/ms229012.aspx): "Do not use a prefix for field names. For example, do not use g_ or s_ to distinguish static versus non-static fields." In C#, you could call the private field 'foo', the property 'Foo', and refer to the private field as 'this.foo' in the constructor. As VB.NET is case insensitive you can't do this - any suggestions?
What we used in a projet is a popup window that opens a mailto: link, it is the only way we found to compose a mail within the default mail client that works with all mail clients (at least all our clients used). var addresses = [...]; var href = "mailto:" + addresses.splice(0, 1) + "?" + "cc=" + addresses.join(",") + "&" + "subject=" + subject + "&" + "body=" + body; var wndMail = window.open(href, "_blank", "scrollbars=yes,resizable=yes,width=10,height=10"); if( wndMail ) { wndMail.close(); }
I still use the _ prefix in VB for private fields, so I'll have _foo as the private field and Foo as the property. I do this for c# as well and pretty much any code I write. Generally I wouldn't get too caught up in "what is the right way to do it" because there isn't really a "right" way (altho there are some very bad ways) but rather be concerned with doing it consistently. At the end of the day, being consistent will make your code much more readable and maintainable than using any set of "right" conventions.
Official guidelines are just that -- guidelines. You can always go around them. That being said we usually prefix fields with an underscore in *both* C# and VB.NET. This convention is quite common (and obviously, the Official Guidelines ignored). Private fields can then be referenced without the "me" keyword (the "this" keyword is for C# :)
[Regex Buddy has a VB6 library][1] I use this in Delphi and it's very good - and Jeff has raved about RegexBuddy on several occasions. I can't speak for the VB implementation, but it's certainly worth a look. [1]: http://www.regexbuddy.com/vb.html
I'm interested to know why you would want to do this. There's not an easy way to do it, because it's not a good practice. You should probably go back to your design and figure out a cleaner way to accomplish the end goal.
I don't think that's a good idea.. Take another crack at this problem - Try using some other mechanism like shared data to signal between threads.
You mentioned WebSphere, BizTalk, Mule. Each of which has very different characteristics with its good and bad points. If just integration you are after, I will recommend Mule. I had very good experience with it and more important the architect is non invasive, so you could always migrate to a different ESB or other Buzz word complaint solution. One the the sweet spots of Mule is that it can be embedded within your application and your final artifact can be deployed on Webshpere, WLS, Glassfish etc... without even showing you embeded an ESB. Then this ESB can perform all the integration plumbing (managing connection types and protocols). Whereas some of the end points could be other integration solution you mentioned.
If you use the standard openssh console client (cygwin or from linux), host keys are stored, one-per-line, in ~/.ssh/known_hosts. From there, it's a simple matter of figuring out which bit of that host key is needed for your library. Putty also stores host keys, but it appears to encode them in hex. Those can be found at HKCUR\Software\SimonTatham\PuTTY\SshHostKeys
As you probably know, VB6 didn't ship with a built-in regular expression library. You can, however, use one provided by an ActiveX or COM library. [See this article][1] for details. [1]: http://www.regular-expressions.info/vb.html
Check in early and check in often for two main reasons - 1 - it might make it easier to integrate code 2 - in case your computer explodes your weeks of work isn't gone
The controls generally show controls for: P1, Pn, Pc (current page), Pc+1, Pc-1. The only time this changes is at either ends of the paging range {Pc < P3 or Pc > (Pn-3)} - The first step is to obviously work out the number of pages: `numPages = ceiling(totalRecords / numPerPage)` - If you've got 4 or less, the drop out at this point, because, by the above rules, the paging is always going to be fixed (P1, P2, Pn-1, Pn), where one will acutally be Pc - else, you have three "states" a. (Pc < P3) - so show P1, P2, P3, Pn, Next If Pc >1, show a 'prev' link before P1. b. (Pc > Pn - 1), so show Prev, P1, Pn - 2, Pn -1, Pn, show a Next link if Pc < Pn c. Show Prev, P1, Pc -1, Pc, Pc +1, Pn, Next Easy as Pie in pseudo code. The loops can get a bit nasty when implemented as you've got to do some iterating in order to generate the links. *Edit: Of course Prev and Next are identical to Pc +/- 1*
The controls generally show controls for: P1, Pn, Pc (current page), Pc+1, Pc-1. The only time this changes is at either ends of the paging range {Pc < P3 or Pc > (Pn-3)} - The first step is to obviously work out the number of pages: `numPages = ceiling(totalRecords / numPerPage)` - If you've got 4 or less, the drop out at this point, because, by the above rules, the paging is always going to be fixed (P1, P2, Pn-1, Pn), where one will acutally be Pc - else, you have three "states" a. (Pc < P3) - so show P1, P2, P3, Pn, Next If Pc >1, show a 'prev' link before P1. b. (Pc > Pn - 2), so show Prev, P1, Pn - 2, Pn -1, Pn, show a Next link if Pc < Pn c. Show Prev, P1, Pc -1, Pc, Pc +1, Pn, Next Easy as Pie in pseudo code. The loops can get a bit nasty when implemented as you've got to do some iterating in order to generate the links. *Edit: Of course Prev and Next are identical to Pc +/- 1*
If you have unpalatably many arguments, then just package them together into structs / POD classes, preferably declared as inner classes of the class you are constructing. That way you can still require the fields while making the code that calls the constructor reasonably readable.
Using GUIDs saved us a lot of work when we had to merge two databases into one.
This is harder to do in applications that are only in maintenance mode because it is hard to convince management that rewriting something that is already 'working' is worth doing. I would start by applying the principles of MVC to any new code that you are able to work on (ie. move business logic to something akin to a model, put all your layout/view code in one place) As you gain experience with new code in MVC you can start seeing opportunities to change the existing code subtly so that it also falls in line. It can be a very slow process, but if you can show the benefits of this way of doing it then you will be able to convince others and get the entire team on board.
You might want to take a look at OpenVXI, I believe that a number of company's that sell very expensive IVR platforms (such as Avaya) have based their voice browser on it. http://en.wikipedia.org/wiki/OpenVXI
Mutex: exclusive-member access to a resource Semaphore: n-member access to a resource That is, a mutex can be used to syncronize access to a counter, file, database, etc. A sempahore can do the same thing but supports a fixed number of simultaneous callers. For example, I can wrap my database calls in a semaphore(3) so that my multithreaded app will hit the database with at most 3 simultaneous connections. All attempts will block until one of the three slots opens up. They make things like doing naive throttling really, really easy.
Just use default arguments. In a language that supports default method arguments (PHP, for example), you could do this in the method signature: `public function doSomethingWith($this = val1, $this = val2, $this = val3)` There are other ways to create default values, such as in languages that support method overloading. Of course, you could also set default values when you declare the fields, if you deem it appropriate to do so. It really just comes down to whether or not it is appropriate for you to set these default values, or if your objects should be specced out at construction all the time. That's really a decision that only you can make.
I use following approach to finding memory leaks in Java. I've used jProfiler with great success, but I believe that any specialized tool with graphing capabilities (diffs are easier to analyze in graphical form) will work. 1. Start the application and wait until it get to "stable" state, when all the initialization is complete and the application is idle. 1. Run the operation suspected of producing a memory leak several times to allow any cache, DB-related initialization to take place. 1. Run GC and take memory snapshot. 1. Run the operation again. Depending on the complexity of operation and sizes of data that is processed operation may need to be run several to many times. 1. Run GC and take memory snapshot. 1. Run a diff for 2 snapshots and analyze it. Basically analysis should start from greatest positive diff by, say, object types and find what causes those extra objects to stick in memory. For web applications that process requests in several threads analysis gets more complicated, but nevertheless general approach still applies. I did quite a number of projects specifically aimed at reducing memory footprint of the applications and this general approach with some application specific tweaks and trick always worked well.
The only time you should set a variable to null is when the variable does not go out of scope and you no longer need the data associated with it. Otherwise there is no need.
Depending on the scaling, the relative image pixel could be anywhere in a number of pixels. For example, if the image is scaled down significantly, pixel 2, 10 could represent 2, 10 all the way up to 20, 100), so you'll have to do the math yourself and take full responsibility for any inaccuracies! :-)
You can add a timestamp field to that table and update that timestamp value with an update trigger.
Also: using(SomeObject object = new SomeObject()) { // do stuff with the object } // the object will be disposed of
Currently in my winforms app I have handlers for `Application.ThreadException`, as above, but also `AppDomain.CurrentDomain.UnhandledException` Most exceptions arrive via the `ThreadException` handler, but the AppDomain one has also caught a few in my experience
Nice idea :) I presume you've used wget's --load-cookies (filename) might help a little but it might be easier to use something like Mechanize (in Perl or python) to mimic a browser more fully to get a good spider.
Your status page is available now without logging in (click [logout][1] and try it). When the beta-cookie is disabled, there will be nothing between you and your status page. [1]: http://stackoverflow.com/users/logout?returnurl=%2fquestions%2f2815%2fhow-to-curl-or-wget-a-stackoverflow-page
There are some cases where it makes sense to null references. For instance, when you're writing a collection--like a priority queue--and by your contract, you shouldn't be keeping those objects alive for the client after the client has removed them from the queue. But this sort of thing only matters in long lived collections. If the queue's not going to survive the end of the function it was created in, then it matters a whole lot less. On a whole, you really shouldn't bother. Let the compiler and GC do their jobs so you can do yours.
I couldn't figure out how to get the cookies to work either, but I was able to get to my status page in my browser while I was logged out, so I assume this will work once stackoverflow goes public. This is an interesting idea, but won't you also pick up diffs of the underlying html code? Do you have a strategy to avoid ending up with a diff of the html and not the actual content?
Thanks for those xUnit.net looks like it provides a slightly different approach to N/MB/MS/Unit, which is interesting. In my search for an rspec-like solution (because I LOVE the rspec), I also came across [NSpec](http://nspec.tigris.org/), which looks a bit wordy, but combined with the [NSpec Extensions](http://code.google.com/p/nspec-extensions/) addon to use C#3 extension methods, it looks pretty nice.