while (true) { 
    progress++; 
    progress -= 2; 
}

Git: Rescuing changes that have been merged over

So we ran into a little bit of bother with some pull requests to GiveCRM: I had submitted a feature that had been merged in, but it was subsequently lost (in part) when a later pull request was merged in. It seems the submitter of the later pull request hadn't updated from the central repository before submitting his pull request, so when his pull request was merged my feature was overwritten.

My experience with Git is almost entirely as an individual developer, so I'm learning how to use it in a distributed team as we go with GiveCRM. I turned to my friend, colleague and resident Git expert Adam Wood for some advice.

#GiveCampUK 2011 - Oh My

I am going to open this blog post with a bold statement: GiveCamp UK was one of the greatest experiences of my life. Here's my story.

Why I'm nervous about attending #GiveCampUK, and why I think that's ok

So earlier today, I posted on Twitter that Meanwhile, I'm quietly shitting myself about #givecampuk which is in just two days' time!

This prompted a slew of replies, not least from Paul Stack, one of the GiveCamp UK organisers, who said

"I wish there was no nerves over #givecampuk - we are all in the same boat - noone is better than anyone else :)"

Initialising a collection from another collection

Here's a handy trick I discovered whilst fixing a bug. You can initialise a collection from another collection and add new items to it as follows:

Note that the collection initialiser on AllFoo runs before the constructor, so the Foo created with constructor parameter 4 will appear first in AllFoo, followed by everything in BaseCollectionOfFoo in the expected order.

PowerShell function Get-ScriptDirectory

Very often when I'm writing a script in PowerShell, I will need to obtain the directory in which that same script resides. This is sadly not completely trivial in PowerShell, but the following function achieves the desired result:

Hopefully, having created a gist for this and blogged about it, I won't have to keep resorting to Google in future to remind me how to do this. This particular version was posted to the PowerShell Code Repository by Andy Arismendi.

Implicit Interface Implementation in .NET

I've just been reading Brad Wilson's latest blog post, Interface Attributes != Class Attributes, and hit upon this interesting nugget regarding the implicit implementation of interfaces in .NET:

Implicit implementation (as seen above) is when a class implements the method/property in question as a public method or property on the class. It's important to note that this method/property is NOT the same thing as the interface method/property; it merely has the same signature, and thus can be used to implicitly create the implementation of the interface. In reflection terms, the two are distinct and different.

Hum. I did not know that.

Public Service Announcement: Io and Prolog on Mac OS X

I encountered a couple of issues moving on from the Ruby chapter of Bruce Tate's book Seven Languages in Seven Weeks:

  1. Io does not currently compile,
  2. Prolog installs to an odd location.

Pretty-printing JSON with Json.NET

I was struggling to find a way to pretty-print a JSON string in .NET. I already have the excellent Json.NET package available and after a bit of hunting, I came up with this:

It wasn't obvious how to do this, for some reason - I spent a while investigating the JsonReader and JsonWriter classes to no avail.

Hope this helps you too!

Test-Driving a Leap Year Calculator

In preparation for CAMDUG's first ever Dojo yesterday, I worked through the Leap Year kata, which I had intended to run in the first session, "Introduction to TDD". I ended up swapping it out for the Roman Numerals kata, because I got through two iterations of the exercise in about 20 minutes. However, I thought it would be useful to share the problem and my approaches to it with my readers.

CAMDUG's first ever Dojo

Yesterday, CAMDUG, the Cambridge Developer's Group, ran its first coding dojo generously hosted by my employer Granta Design (we're hiring!). Rooted in the principles of Software Craftsmanship, dojos bring developers together to sharpen their Test-Driven Development and Design (TDD) saws.

Pages

Subscribe to Front page feed