The yield statement is one of those C# statements that is really powerful but is either not understood or is unknown to most developers. Raymond Chen just posted a very good write up on how the compiler deals with the yield statement. The Old New Thing : The implementation of iterators in C# and its consequences (part 1) The great feature that the yield statement brings is delayed execution in iterations. If building a collection of items to iterate through is an expensive operation on either... [More]
A few months ago I did some research into dependency injection frameworks. One of the interesting features provided by many of the DI frameworks was the support for AOP. This is really interesting stuff and great for injecting logging and caching implementations without having to modify existing code. There are several AOP implementations around (Oren Eini identified seven in this post) and I have always wondered how some of them worked. Unfortunately I never got the time to research it. Using... [More]
I have upgraded the blog to CS2008 tonight. It mostly went well, but I did waste an hour trying to get my media files to be served. Turned out that the issue was that the AppPool in IIS now needs to be run under Integrated rather than Classic. See here.
My dad bought a laptop that came with the typical factory image full of junk. It crashed constantly, didn't detect the anti-virus that was installed and wouldn't allow me to activate Windows Defender. It also only had the system partition for data. All good reasons for a rebuild. HP kindly don't offer media for recovery though. Not being familiar with this, I wiped the system drive for a rebuild without first burning the recovery partition to a DVD. After lots of attempts at recovery and install... [More]
There are cases when you need to transmit username/password credentials to WCF without transport security. The times that you should do this are rare because of the obvious security implications of sending credentials over the wire without encryption. One case where this is required is where hardware acceleration is used in a load balancer. The traffic between the load balancer and the client is encrypted, but the traffic between the load balancer and the service host is not. The issue here is t... [More]
I was playing with a new profile on my laptop last night as I was wanting to work with Outlook data syncing to my phone without changing the data on my normal profile. After I logged in, I found that Outlook wasn't responsive. I could use the mouse to do actions, but not the keyboard. I also couldn't close it. When I tried to add a SharePoint list Outlook would give me a message saying "A dialog is open. Close it and try again." The great thing was that there was no dialog open. This frustrated ... [More]
I've just realised a usability problem with website log in forms. The "remember my password" checkbox is almost always below the log in button. For keyboard support, the sequence goes like this: Give focus to the username field (any good app would do this for you) Type in username Tab to focus on password field Type in password Tab to focus on the log in button (with perhaps another tab to get over a cancel button) Tab to focus on the checkbox Space to check the checkbox Shift-Tab to give focu... [More]
I have installed Vista x64 on my server which has a USB printer attached to it. I have shared this printer so that other machines on the network can use it as a network printer. I found that I could see the printer from my Vista x86 laptop, but it just wouldn't print. The printer properties on the printer server have some advanced properties where you can specify x86 drivers for the printer for when clients add the network printer. The problem is that the printer drivers come with Vista natively... [More]
This is one to remember. Paul Litwin has posted about forcing SSL gracefully on a site using a post from Paul Wilson as a reference. I'll implement this when I set up some ssl sites that are publicly available.
Jason Kresowaty has posted an incredible amount of information about creating FxCop rules. I'll get to these one day. One rule I want to write is a rule that checks for properties on a DataContract that are not assigned the DataMember attribute.