Using the Prototype Javascript Library to Fix my CSS Layout

I made some tweaks to my blog layout specifically the columns and added a footer. The footer is where the problem started. With CSS using float for the side columns works great and the footer will fall below the main content as long as the main content column is taller then the floating columns. If not, the floating column will float over the footer. To fix this I used the prototype{#hm8i} javascript library to adjust the height of the main column if the floating column is taller. I added a MadKast{#e12e} size constant because the MadKast script will usually load after the height adjustment leaving the main content column short about 25 pixels. Anyway, here’s the code:

<script language="javascript">
_madKastSize = 25;

Event.observe(window, "load", function() {
if ($('left') && $('left').offsetHeight > $('right').offsetHeight)
$('right').setStyle({height:($('right').offsetTop + $('left').offsetHeight + _madKastSize) + "px"});
// --> </script>

Building an AIM Bot in .Net using boo

I’ve been working on a AIM Bot using the aimcc sdk. After signing up and downloading the sdk from I found the documentation for .net lacking and found just getting up and running to be a long process. Below are some of the issues I ran into.


</b>To start with I needed to create a class which extends Control. Then add a method to start the application, at the beginning of the method call CreateControl() at the end of the method you need to call Application.Run() to setup the message loop. I’m working in boo but this should work fine in c#.

class Bot(Control):
def Start():
#AccSession setup to go here


Next pinvoke is required to creat the AccSession instance. This is in some of the SDK samples, but it wasn’t obvious looking at the java and c++ sample bots. It only calls acccore.dll, but other dll’s in the accsdk/dist/release/ are needed I’m just using the full path, but should copy the required dll’s to my project file.

    [DllImport(“C:\accsdk\dist\release\acccore.dll”, EntryPoint:“#111”, PreserveSig:false, SetLastError:true)] 
    private static def AccCreateSession(
    [MarshalAs(UnmanagedType.LPStruct)] riid as Guid,
    [MarshalAs(UnmanagedType.IDispatch)] ref session as object) as IntPtr:

Calling the method is pretty strait forward, just pass in an object and then cast the object to a AccSession.

o as object
AccCreateSession(typeof(IAccSession).GUID, o)
session = o as AccSession



The next step was to wire up the events I wanted to get catch, I choose to wire up all the events for logging. You need to provide your API key and then login.

handler = AccSessionEventHandler(BoxesImResponder())
session.ClientInfo.Property[AccClientInfoProp.AccClientInfoProp_Description] = key
session.Identity = username

That’s finally all I needed to get the bot running. I fought with setting preferences for a long while like the java example shows, but I ended up following the c++ example to filter which messages get accepted. More to follow in later posts. In addition, I plan on posting the full source code when the application is working.


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 void Main()
MyClass obj = new MyClass();

public class MyClass
public static void WriteInputStatic<T>(T input) { Console.WriteLine(input); }
public void WriteInput<T>(T input) { Console.WriteLine(input); }

I can’t think of many use cases, but kind of a cool feature anyway. I was using it to serialize and deserialize a type for testing the correct serialization/deserialization.

internal static T Serialize<T>(T worker) where T : class
    MemoryStream serializationStream = new MemoryStream();
new BinaryFormatter().Serialize(serializationStream, worker);
byte[] bytes = serializationStream.ToArray();

MemoryStream deserializationStream = new MemoryStream(bytes);
object obj = new BinaryFormatter().Deserialize(deserializationStream);
return obj as T;

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.</p>

Setup was easy and quick and it runs in Virtual Server and Virtual PC 2007.

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.

typeof (ComponentA),
new ComponentA("Customer parameter for testing."));

I needed to override the parameter value of ComponentA for some unit tests. The parameter is normally set in the configuration file. After trying a few different approaches, I ended up with the code above. It’s more of an end to end unit test, and as such ComponentA will be resolved as a result of another Component being resolved.

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 good reminders of things that need to get done, so often I will add test methods with Assert.Fail(); as the body, usually the method name is enough detail for me to remember what needs to be done.

Lastly, I’ve started using the ConditionalAttribute on my test class methods so they won’t be compiled in release mode. If this is not your style you may want to modify the templates.

ReSharperUnitTestLiveTemplates.xml (2.63 KB)

** I’ve decided against using the ConditionalAttribute in favor of adding compiler directives to the test files. I quickly found that not using the attribute became a source for failing tests that shouldn’t have been run and/or simple code leaks. I know that many people prefer a different class library for tests, but I think that only makes sense for non unit tests. Anyway, here’s the updated file.

ReSharperUnitTestLiveTemplates1.xml (2.48 KB)

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 nantschema task ( This task requires an output attribute be set, which I just set to my Visual Studio Install\xml\schema directory. Below is the build script I use:

<?xml version="1.0" encoding="utf-8"?>
<project name="Build nant schema to VS 2005" default="build" basedir=".">
    <target name="build">
output="C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\NAnt.xsd"
target-ns="" /> </target> </project>

You can run this after updating Nant or adding contrib projects to your installation and get the latest tasks.

Finally, in your other build files add the xmlns attribute to the project element pointing to the name space you used as the target-ns, in the above example. You may also need to tell VS to open .build files with the xml editor, you can do this by right clicking on the .build file and choosing ‘open with’.

Brutalist Framework