By David, on June 3rd, 2009
I’ve been writing some unit tests recently that test some multi-threaded functionality.
Typically this involves hooking up some event handlers then waiting for some asynchronous code to fire the event before proceeding with the unit test and assertions.
The ManualResetEvent class (MSDN) seems a good choice for this, and this post has a small example of using it . . . → Read More: Unit testing multi-threaded, asynchronous code and/or events
By David, on May 28th, 2009
This details how you can debug an application running on a remote machine from Visual Studio on your local machine, as if the remote application was running on your local machine.
The keys are:
There must be a user account with the same username and password on the remote machine and the local machine (MACHINE account, not domain . . . → Read More: Remote debugging from Visual Studio 2008 on a domain machine to a machine not on the domain
By David, on May 27th, 2009
The IPFilter Updater application now has its own page: http://www.davidmoore.info/ipfilter-updater/
uTorrent is one of the most popular BitTorrent clients out there. In my opinion it’s the best.
You can set up IP filtering in uTorrent to block bad seeds and peers from a list maintained by the community.
How to set up IP filtering in uTorrent
Open up uTorrent and . . . → Read More: Set up IP filtering in uTorrent and keep your ipfilter.dat up to date easily
By David, on May 26th, 2009
In some of the work I’m doing right now, I’m manipulating an assembly after compile time – having it disassembled into IL, tweaked, then re-compiled back into an assembly.
The assembly is signed and what is being done to the assembly is breaking the strong name. This is quite comforting to know; the strong name wouldn’t be . . . → Read More: Could not load file or assembly ‘x’ or one of its dependencies. Strong name validation failed.
By David, on May 22nd, 2009
If you have several applications that are using NLog, it can be a good idea to install NLog into the GAC and reference that.
A gotcha you must watch out for is caused by this piece of configuration from the NLog site:
<configuration>
<configSections>
<section name=”nlog” type=”NLog.Config.ConfigSectionHandler, NLog”/>
</configSections>
<nlog>
</nlog>
</configuration>
Because you are not using the strong name for the Assembly-qualified name of . . . → Read More: Configuring NLog for your application when NLog is in the Global Assembly Cache (GAC)
By David, on February 7th, 2009
Most thumbnail-generation solutions will shrink the original down while maintaining aspect ratio.
Usually you specify the maximum height and width of the thumbnail, e.g. 150 x 200.
However, if your original image’s aspect ratio is different to the maximum thumbnail dimensions, you will end up with dead space vertically or horizontally (shown in green in the illustration). This can be quite an eyesore when displaying thumbnails in a grid.

I’ve got an algorithm that will automatically crop the image either horizontally or vertically to then match the thumbnail aspect ratio, so you end up with the thumbnails all being the same size even though they may be coming from originals of wildly different aspect ratio.
In the illustration, you can see that the image is scaled down and fills all the available thumbnail space, showing the parts in grey from the original that were cropped out.

The algorithm does the cropping before the resizing. It takes the width and height of the original image, and the width and height of the desired thumbnail. It will return the width and height that the original must be cropped to, to match the aspect ratio of the thumbnail. Continue reading Creating thumbnail images with automatic cropping and maintaining aspect ratio
By David, on January 8th, 2009
Hamilton has applied a bunch of patches and fixes to the Castle Project for the Components and Windsor sub-projects. Including 2 minor and insignificant patches that I submitted +D. It’s good to feel part of a major Open Source project, even for a small contribution.
http://hammett.castleproject.org/?p=336
While I’m currently focusing my efforts on ASP.NET MVC and moved away . . . → Read More: Castle Project update
By David, on December 9th, 2008
I’m running Visual Studio 2008 on a old, single-core laptop with 1GB RAM.
VS is a resource hog, so it’s not long before my laptop is struggling having a reasonable size solution in addition to the usual open applications.
There are a few things you can do to try and squeeze a bit more performance out of Visual . . . → Read More: Visual Studio Performance
By David, on October 14th, 2008
I’m currently build the new Overclockers New Zealand website in .NET
I have a nice continuous integration server going smoothly, but my most recent check-in threw up a strange error when running the Unit Tests:
System.BadImageFormatException : Could not load file or assembly ‘Overclockers.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The module was expected to contain . . . → Read More: System.BadImageFormatException
By David, on July 10th, 2008