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.

TextBox

  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.

More...


Categories: Hacking
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 http://github.com/RussPAll/gelf4net).

More...


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.

More...


Categories: Hacking
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 Blogger.com 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.

More...


Permalink | Comments (0)

Unit Testing Good Patterns #4 - Know When Not to Test

This week's been aaaallll about automated testing for me. On Monday, I attended Preston Codejo, looking at unit testing in Ruby. I was there as a Ruby novice, there were a couple of TDD novices, so some great discussion around the merits of TDD. My working week has been spent sneaking SpecFlow and acceptance testing into a new project at work, and yesterday I spent a few hours watching one of Uncle Bob's Clean Coders videos with some colleagues. As usual, my DRL posse had some really interesting thoughts around it - more discussion around the merits of testing followed.

And then there's a bit of discussion on Twitter about TDD not being the silver bullet some would tout it, I speak very highly of TDD as a practice. Some would describe me as a bit of a zealot, so in the interest of balance, I want to make a confession.

More...


Permalink | Comments (0)

NHaml - Lessons From Adopting an OSS Project

Hi all,

Some weeks ago now, I blogged that I've adopted the open source NHaml project over at GitHub, I'm now an administrator. I also mentioned that I was looking to get an initial release out sometime in December. Since then I've been beavering away at the thing, we're now most of the way through December, it feels like it's time for a status update.

In this post, I'll be talking a little about the project as I picked it up, lessons learned in my first baby steps adopting an established OSS proect, the decision to go with a (almost) rewrite, TDD and why I feel this is important stuff, and a few other odds and ends.

Incidentally, I in no way whatsoever mean to sound like I'm having a dig at previous contributors to the project, the stuff I'm putting into the project now owes massively to these earlier contributors, I'm trying to evolve as many of their existing ideas as I can. 

More...


Permalink | Comments (0)

Editing JPEG Photos Without Recompressing - Part 1

Hi all,

A bit of a departure from the norm today, I've just spent the afternoon having a whale of a time with a good mate of mine, talking guitars, web programming, a bit of home automation, and at some point the subject of time lapse photography came up. But wait, isn't this a coding blog? What the heck's this got to do with code!?

Okay, some background first. My friend is fortunate enough to have a view from his window over the beautiful countryside surrounding Preston, out towards the coast. For a year now, he's had a digital camera trained on said countryside, taking a photo every minute. 12 months and half a million photos later, he's discovered a problem. Some of his photos need touching up, and by some I mean a LOT. Here's where the coding comes in.

More...


Categories: Hacking
Permalink | Comments (0)

Wall Mounting a HP Compaq TC1100 Tablet Computer

Hi all,

A Compaq TC1100 Tablet PCA bit of a departure from the norm with this post, in that there's no coding involved!  Some background story to start.  A couple of years back I acquired a second hand HP Compaq TC1100 tablet PC. First off, this tablet is a proper thing of beauty - okay it's a bit chunky, but it's certainly aged well.  My plans were to fit it in my kitchen so that I could stream video recipes, TV (via the excellent DVBViewer), online radio, etc.  The only problem I had - where to fit it?  I don't want it just lying around on the worktop, it'll get covered in oil, crumbs, all sorts. And how exactly do you stick a computer to a wall!?

More...


Categories: Hacking
Permalink | Comments (0)