Writing
IoC smell: Having IContainerAccessor as a dependency.
Looking back, it should have been an obvious thing to not do, but it wasn’t. I wanted to get access to the container and so I made IContainerAccessor a dependency for my class. The I added that to the container. The Main problem was that...
Prefer Equals over operator== because generic types will not behave how you expect
I stumbled across this unit testing some Immutable model objects. I’m overriding equals on these object and as so thought, how about I create a generic method to test equality? Sounded like a good idea, got rid of some duplicate code, ma...
Getting Finance::Quote installed and working on windows for GnuCash
A little off the coding topic. I use the windows version of GnuCash as such I wanted it to be able to get stock and fund updates automatically. This took a bit more work then I expected so I hope this helps someone else. Install active ...
ThreadPool + Async methods + ManualResetEvent = Bad
Okay, today it was re enforced that the ThreadPool is not good for long running tasks, specifically those that might use the ThreadPool or use async methods or ResetEvents. I didn’t really track down the root cause, but generally it lock...
Deleting multiple objects with NHibernate using a query
I needed to delete a bunch of objects based on some parameters of those objects. It fairly obvious that one of the Delete overloads on ISession would work, but a couple of things throw me. First you need a full select query, not too hard...
Update on the AIM bot, new Amazon web services S3 Library
I’m still working on the AIM Bot, converting from boo to c#. I really liked working in boo, but just don’t feel like I have enough comfort in it to continue working in it. Anyway, I’ve decided to use the Amazon web service S3 for my dat...
Race between the If statement and the Delegate Swapping/Substitution Pattern
Which is faster delegate swapping or simple if statements? I wanted to know too and it turns out it’s a tie, as far as I can see. The idea is that you might have some code you want to execute until some condition occurs then execute som...
Giving up on boo for the AIM bot due to incomplete Generics support.
Well after getting an internal compiler error and trying to find out what the problems was, I decided to see if I could recreate the issue. In doing that, I wanted to know how to set constraints on generic types, and as it turns out this...
Building an AIM Bot in .Net using boo
photo by somewhatfrank I’ve been working on a AIM Bot using the aimcc sdk. After signing up and downloading the sdk from developer.aim.com I found the documentation for .net lacking and found just getting up and running to be a long...
Implied generic parameter types
I'm not sure of the exact name of this feature, but I stumbled across it today. If a generic method uses the type for a parameter, the complier assumes the generic type, which makes for cleaner code. using System;class Program{ static...
Instant wiki with rBuilder MediaWiki Appliance
The MediaWiki Appliance is An appliance that bundles up PHP, MySQL, Apache and MediaWiki to provide a self-contained, turn-key Wiki appliance. http://www.rpath.org/rbuilder/project/vehera-base/ Setup was easy and quick and it runs in V...
Overriding component parameters when using Castle.MicroKernel
Overriding component parameters when using the Castle.MicorKernel turned out to be kinda weird. Anyway, here’s one way to do it. IoC.Container.Kernel.RemoveComponent("ComponentA");IoC.Container.Kernel.AddComponentInstance( "Component...
Unit Test Live Templates for ReSharper
Attached are Live templates that can be imported into ReSharper to help with writing unit tests. There are templates for Test, Setup, TearDown, TestFixtureSetUp and TestFixtureTearDown methods. I find that failing test cases are really g...
Setting up VS 2005 for nant build files
To setup nant intellisense in VS 2005 you can copy the schema from the install to the Visual Studio Install\xml\schema directory, however this won’t get all available tasks. As such, I prefer to create a nant file which calls the nantsch...
Sum a column in a tab-delimited file using Powershell
Assuming you have a bunch of tab delimited files w/out headers and the second column as a number, you could use the following powershell command to sum the values and output the result. PS > $sum=0; ls | cat | %{ $.split(“`t&rdq...
Reflection.Emit.DeclareLocal and Reflection.Emit.DefineLabel
Working with Reflection.Emit today I ran into two thing that I couldn’t quickly find answers to. First, was regarding the br.s (OpCodes.Br_S) code. Secondly, was regarding an error ‘Common Language Runtime detected an invalid program’ wh...
Deleting files recursively with PowerShell
This is not the hardest script to come up with, but I can think of a few times I could have used something like this. ls -rec -inc .svn -fo | foreach {del $_ -rec -fo} It will delete any file or folder named .svn in the current direct...
NHibernate access strategy names
Here are the naming strategies for the NHibernate access attribute. property field field.camelcase field.camelcase-underscore field.pascalcase-m-underscore" field.lowercase-underscore nosetter.camelcase nosetter.camelcase-underscor...
Switch statement and the goto command.
The goto command can be used to within a switch statement to transfer control to other case statements or the default case statement. Using goto case will transfer control to that case statement. Using goto default will transfer execute...
Fully qualified type names for generic types
Syntax for generic types names: MyAssembly.MyClass`[[MyAssembly.MyOtherClass, MyAssembly]], MyAssembly Should be able to use this format anywhere a type name is required, including the Inherits attribute on ASPX Page declarations.
Using AppDomains to run a process outside of the ASP.NET Context
There a few reasons why you might want to run a process in an AppDomain. For example, if you need to be able to unload and update the loaded assemblies. Or in my case, use an assembly which actively blocks execution in your currentAppDom...
Initializing excel for use from a service account
Sometimes you need to use excel automation and you’d like to have your service or web application running under an service account identity. In some cases excel wants to run some setup on first use by an account. One way is to log into t...
Embedded Databases
I needed an embeddable database to handle some processing before inserting the data into the final database. I worked with three different embeddable databases, each had some pros and cons. SQL Server Everywhere/Mobile edition SQL Server...
Castle monorail logging with windsor
Using Castle monorail with windsor, I setup the logging facility and followed the IoC of concept parameters for optional components. I noticed the base Controller had Logger property and assumed that windsor would handle it from there. H...
SharpDevelop project templates
I wanted to create castle project template for SharpDevelop, I ran into a few issues, some I found a way to fix, some I didn’t. One thing that I needed to do was add a project reference to a dll that was not in the GAC, to do this the Hi...