Coding and Dismantling Stuff

Don't thank me, it's what I do.

About the author

Russell is a .Net developer based in Lancashire in the UK.  His day job is as a C# developer for the UK's largest online white-goods retailer, DRL Limited.

His weekend job entails alternately demolishing and constructing various bits of his home, much to the distress of his fiance Kelly, 3-year-old daughter Amelie, and menagerie of pets.


  1. Fix dodgy keywords Google is scraping from my blog
  2. Complete migration of NHaml from Google Code to GitHub
  3. ReTelnet Mock Telnet Server à la Jetty
  4. Learn to use Git
  5. Complete beta release FHEMDotNet
  6. Publish FHEMDotNet on Google Code
  7. Learn NancyFX library
  8. Pull RussPAll/NHaml into NHaml/NHaml
  9. Open Source Blackberry Twitter app
  10. Other stuff

Google Analytics and the Bogus Account Number

I've recently fallen hit a snag with the Google Analytics API, that's really put a dint in my day. The suggested script comes with a caveat, that it should be included in the header of the page. But this goes against current performance guidelines, that you want all of your scripts to go at the bottom of the page, particularly if they're loading in third-party scripts.

So why does that script need to go at the top of the page? Is it anything to do with page load timings? Nope, the APIs used to time pages are built into the browser, or on some versions of IE they're built into the Google toolbar where it's present. So it ain't that. Could it be because if you put anything into the global "_gaq" array before the account number, those instructions go in with a bogus made-up account number?

We don't get a nice clear JS error telling us something's wrong. the analytics JS file doesn't look for the account number first before sending the rest of the traffic, it doesn't refuse to send the commands (so the bug might be more obvious if you're monitoing HTTP traffic using Fiddler or Firebug, etc), it sends the commands with a bogus account number. Ouch.

I propose a minor tweak to the Analytics code block that fixes this problem, but first some background.


Categories: Hacking
Permalink | Comments (0)

Four Years with Continuous Integration

This post was sparked by some work I've been doing recently, I've been fortunate enough to have time to really get under the skin of continuous integration around a large UK-based e-commerce website. I'm busily working on some hands-on blog posts applying what I've learned to one of my open-source projects, but first a little bit of history.

Since my first encounter with continuous integration (CI) in April 2009, I've been through a bit of a journey with it, along which it's intruded on and controlled a bigger and bigger chunk of the whole software process. I've gone from CruiseControl giving me a simple version number, to unit tests and Selenium tests under Hudson (followed by Jenkins), with recent forays into NuGet feeds, automated deployments and code metrics under TeamCity and PSake.

This whole thing's taken me almost four years to get to where I am today, but looking back it really should have taken me as many months – seriously, if you're just getting started with CI, don't waste time playing with the basics. This post will explain the benefits of the most basic CI setup, and take you step-by-step through my journey towards the ultimate CI that automates every hum-drum, error-prone step of your software build and deploy process.


Permalink | Comments (0)

Idiot's Guide to Creating and Publishing a NuGet package

Hi all,

At work we're starting to use NuGet in a big way to componentise and manage dependencies between our different libraries. I remember the first time I needed to setup a package finding the process a little less than straightforward, I've just come to create the NHaml NuGet package and this time round things seem a little simpler, so here's how I've just done it, step by step.

To be clear - this is going to be a 101, beginner's level tutorial. First up, we're going to install the NuGet Package Explorer and create a basic .nuspec file from the an existing .csproj file (the .nuspec file is an XML file the tells the NuGet package command all about your package you want to make). Next we'll take a look at the generated .nuspec XML markup, tailor that .nuspec file to suit our needs, then finally generate and publish a .nupkg package file.


Permalink | Comments (0)

NHaml v4 Released - Finally!

Hi all,

After more than a year, with plenty of long pauses along the way, I've finally gotten round to replacing the old non-supported NHaml codebase with the shiny new TDD'd fully supported NHaml codebase. It's been a tough decision, for reasons I'll go into in a moment, but the new code is now up over at GitHub (

Alongside this release, I'm continuing work on Nancy integration (see, resuming the NHaml TeamCity configuration over at and using NHaml+Nancy-self-hosting to resurrect the FhemDotNet project.


Categories: NHaml
Permalink | Comments (0)

Enterprise Logging Part 2 - Logging From .Net to RabbitMq via Log4Net

Hi all,

I'm back with Part 2 of my plan to log, search, graph and alert on milllions of log messages with Log4Net, RabbitMq, GrayLog2 and NEsper. I must confess, I've been pretty astonished at the reaction to part 1 (a week later I was still seeing 4 times my normal blog traffic), so I guess I've gotta follow through and see the plan to fruition!

I'm going to start at the application end today, I'm going to install RabbitMq on a Windows box, and demonstrate a .Net application sending messages to it via a custom Log4Net appender (Gelf4Net over at


Categories: Architecture | Hacking
Permalink | Comments (2)

Log4Net Custom Appenders and the ActivateOptions Event

I've been working with Log4Net on and off now for several years. I've used most of the existing appenders, tweaked an appender here or there, but I'd not done any heavy lifting. That was until I started checking out the Gelf4Net appender.

Gelf4Net supports multiple transport mechanisms (currently UDP and AMQP), in the constructor the appender creates up an instance of each transport class and assigns these to two private fields, so that when it comes to appending log events, either can be used.  This isn't ideal, and I believe it's been done because Log4Net doesn't configure the appender (which transport to use) until after the class is constructed. So I've been scratching my head and Googling around to work out a solution, and I've uncovered the ActivateOptions method, which appears to exist exactly for this purpose. Let's see how this works out.


Categories: Hacking
Permalink | Comments (0)

Enterprise Logging and Alerting with Graylog2, RabbitMq and NEsper

Do you work with lots of software and need to know what it's all getting up to, when you need to know it? I work for a .Net house with over 10 years' worth of software under our belts, we totally have this problem.

Our full estate includes many small and large systems - Web services, Windows services, .Net web apps, MVC web apps... if it's Microsoft badged, we'll have one somewhere. Each of these systems currently logs to a mixture of database tables, flat text files, e-mail alerts - the whole thing is becoming increasingly difficult to manage.

This blog post will be the first in a series looking at an open source solution, involving Log4Net, RabbitMq, Graylog2, ElasticSearch and NEsper, with the following capabilities:

  • Aggregating logs from various distributed systems into a flexible and searchable persistent storage mechanism
  • A web front-end for querying and graphing the log data
  • A system capable of detecting abnormal or critical log patterns and alerting support staff


Categories: Architecture | Linux
Permalink | Comments (3)

Adventures With NancyFx - NHaml ViewEngine Integration Part I

It's been a long time coming, but at last NHaml4 (the downright awesome .Net port of the equally awesome Haml view engine) is getting mature enough to start putting to use. Before I officially release NHaml4 onto the world, I want to make sure that the new engine's flexible enough for general use, so I'm looking at integration with both MVC.Net and (my favorite of the open source web platforms) NancyFx as "must haves" before the release.

NancyFx was actually the platform that initially sparked my interest in NHaml, I never seem to stop hearing praise for its codebase, so let's see how easy this integration's going to be.


Permalink | Comments (1)

Liverpool Sea Odyssey - Low Tech Win

A first for me, a non-techie blog post! But boy-oh-boy, if anything warranted a mention on my blog post over the last couple months this has got to be it.

After a few months stuck in work, problems with home renovations, health problems in the family, and a fair bit of all round stress, I've just had the most awe inspiring and thought provoking weekend I can remember, spending a weekend in Liverpool in the company of Royal De Luxe's Giant Sea Odyssey.

For those of you unfamiliar with Royal De Luxe (I'm pretty sure that's actually a burger from Pulp Fiction?), they're a street theatre group based in Nantes, France, who count amongst their cast a 9ft tall dog, a 30ft tall girl and a 50ft tall deep sea diver. These three characters are basically giant marionette-style puppets, controlled by cranes, a pretty coplicated looking system of weights and pulleys, and the remaining 100-or-so members of the group.


Categories: Family
Permalink | Comments (0)

Migrating a Blogger Blog to Wordpress - A Gotcha for UK users!

Hi all,

I've just spent an evening delving into the wonders of and Wordpress, helping someone migrate their blog from the former to the latter. The process should be straightforward enough, sadly it most definitely was not! In summary, there are two parts to this -  first getting the Blogger data into Wordpress, then getting each page on the old Blogger site to automatically redirect to the correct corresponding page on the new Wordpress site.

In this post, I've already got Wordpress version 3.3.1 installed and ready to go.


Permalink | Comments (0)