Monthly Archives: March 2014

My new (as good as) Burley D’lite #cycling

An as good as new Burley D’lite came up on eBay (used once), this thing is in mint condition, so I paid the buy it now price and got family to collect it and deliver it to me.
“But you already have a Burley?”
Yes, a Solo, but now I have two kids (note to self, can’t have any more because they don’t make a triple seater).
My family didn’t understand why I paid so much and didn’t bid, I overpaid, until they saw one go for more money a week later.
Plus I like the blue an yellow, Halfords only have an orange ugly version and £235 more than I paid.

It’s got big 20″ wheels:

A big boot:


My favourite improvement over the old Solo is the clip buckle rather than poppers for accessing the boot

The Thorn Raven Sport Tour / Rohloff friendly (standard forged) mount

The tissue paper still in the rain cover, I told you it was as new

Until I took it out…

Most importantly it has two seats, though moving the straps and position it can sit a single child

Half a day of clearing out the shed and…. Ta da! (The two flags are just out of shot.)

In more or less perfect alignment for hitching up to Bluebell when I need it

Have I used it yet? No, I’ve had a bad cold and have barely managed any miles since I got it 😦

Detouring a constructor with Microsoft Fakes #dev #coding #tdd

I wanted to ensure every SmtpClient instance that was created by a library was also disposed of, to do this I first needed to Shim SmtpClient using Microsoft Fakes:

  1. Add Fakes Assembly for System.
  2. Edit Fakes/System.fakes

      <Add TypeName="SmtpClient"/>
  3. Save the file and close
  4. Rebuild, open the System. reference and under System.Net.Mail.Fakes you should see ShimSmtpClient.

My idea was to count up every time the constructor was called and to count down every time one was disposed, to do this I created a counter:

int instancesNotDispose = 0;

Incremented it in the Constructor Shim, that is wrap the constructor and do some more things rather than completely detouring the constructor:

ShimSmtpClient.Constructor =
    x =>
        // Execute outside of Shims otherwise you'll be in StackOverflowException territory
        () =>
            // Use reflection to get the default constructor and invoke it, the magic here is the instance is stashed into x!
            var constructor = typeof(SmtpClient).GetConstructor(new Type[0]);
            constructor.Invoke(x, new Object[0]);


Then decremented it in the Dispose Shim:

ShimSmtpClient.AllInstances.Dispose =
    x =>
        // Execute outside of Shims otherwise you'll be in StackOverflowException territory


Then I can call my library a bunch of times to do whatever it does and sends some e-mails, then I can assert they have all be disposed:

Assert.AreEqual<int>(0, instancesNotDispose, String.Format("Doh! {0} were not disposed", instancesNotDispose));

Assuming there aren’t other SmtpClient constructors that do not call the default constructor then this code should work fine, if there are other constructors called that do not call the default constructor then this Assert will also help find those. There are other ways, for example, stashing each instance in a List and ensuring each is in both the Constructor List and the Dispose List, but this counting approach was enough for my needs for now.

A new chainring and pedal reflectors, yes, you heard me. #cycling

Lastly, firstly, pedal reflectors are a legal requirement in the UK, other than that, I think they are worthwhile, they can’t do any harm. Don’t be fooled though, reflectors give people false hope, get decent lights, spend a lot of money on them and be safe. Pedal reflectors won’t help when the vehicle’s windows are misted up or it’s a rainy day. Only bright lights will penetrate that.

But anyway… I was down to my last one, they keep breaking, falling off etc. So I bought some new bolt on ones, let’s see how long they last.

Now, the highlight, a brand spanking new Thorn chainring, 48T and reversible (eat that derailleur lovers):


Notice how clean Bluebell is compared with normal? I treated her to a clean not so long ago 🙂

Also, note the black oil marks are on alternate teeth, bonus points if you can guess why this is? Wow, cycling trivia, almost.

And for comparison old against new:


Extra trivia, is the original (on top) a reversible chainring and explain why 🙂