Subscribe to
Posts
Comments

Recently I was asked to investigate a site which wasn’t performing as well as expected. The initial reaction was to look at the code – perhaps our NHibernate mappings were eagerly fetching too much data, perhaps we’re not caching enough, etc.

Then I stopped and remembered the database. I found that the table structure and indexes were sub-optimal and after a quick restructure the performance was boosted 400%. This got me wondering why my initial reaction was to dive into the code rather than consider any other options.

One of the Agile principles is Inspect and Adapt. To provide a regular team cadence this usually takes the form of a retrospective every couple of weeks. These sessions discuss the actions which came out from the previous retrospective and the previous couple of weeks work. The team establishes a few important areas of concern and these are discussed in more detail to establish a course of resolution.

Extending this line of thought I ended up wondering why do we do what we do each day? Is it the path of least resistance? Force of habit? Loyalty?

What might a Life Retrospective uncover?

  • Would we discover a new route to work which we’d previously discounted for being too long? A new carriage on the train which doesn’t get as busy?
  • A new variety of pasta sauce even tastier than our regular? A supermarket own brand for half the price but the same taste?
  • Might we find that every day we live with the coffee table getting in the way when we walk into the lounge, but we never try a new layout?
  • How much extra happiness could we gleen from running life retrospectives? Who would run it? How frequently would be useful?

Lots of questions and not many answers I’m afraid. Maybe I need a retrospective of this post.

public static class FileSizeExtensions
	{
		[DllImport("Shlwapi.dll", CharSet = CharSet.Auto)]
		public static extern long StrFormatByteSize(long fileSize,
		                                            [MarshalAs(UnmanagedType.LPTStr)] StringBuilder buffer, int bufferSize);

		public static string DisplayAsByteSize(this long filesize)
		{
			StringBuilder sbBuffer = new StringBuilder(20);
			StrFormatByteSize(filesize, sbBuffer, 20);
			return sbBuffer.ToString();
		}
	}

In 2008 I started running with the BBC Running Club after the squash club at work closed. Late 2009 I found I had a place in the London Marathon, and the training started. Up until that point i’d been measuring my distance in kilometres, my maximum weekly distance was 12km and my longest single run was 10km. I changed my watch to track in miles and started increasing my weekly mileage.

From January through to marathon day I put in 165 miles of training runs, which is a lot less than i’d been recommended (i’d been advised that the 5 longest runs in your training plan should total 100 miles). My lack of training was due to terrible pain in my right calf muscle which I later discovered was due to the wrong pair of trainers. My gait was wrongly analysed in the shop and annoyingly it took me 2 months to associate the pain and the new trainers. Cue me spending over £300 on physiotherapy and then another £100 on new trainers when it was resolved.

Armed with the new trainers in late March I started training in earnest and put in an average of around 20 miles a week including the Silverstone Half marathon. I couldn’t ramp up too much too quickly with marathon day looming so my biggest run was a 15 miler.

The obligatory carb loading started on the Friday and with every huge bowl of pasta I felt increasingly like a goose being fattened for a foie gras fate. On the Saturday I went to a friends house who lived nearer Blackheath. That night when I closed my eyes all my preparation came back to me – the muddy cross country; the street runs in the snow and ice; the canal runs to Little Venice; the pain of my unnecessary transevatherapy; the fantastic words of advice from previous marathon runners; the added variety of NikeTownRunners nights; the Tuesday Trot organised by the BBC running club.

On Sunday morning my friend graciously drove me to within 500m of the start line and with surprisingly few people approaching from the Lewisham side and I got to the red start enclosure around 9am.

The organisation was fantastic and despite the short downpour spirits were high. My iPod was charged, my kit bag was in the truck to be taken to the finish line and I was in starting pen 6 ready to race.

At 9:50:24 I crossed the start line which really surprised me – i’d expected it to take 20-30 minutes following my experience back at the British 10k in July. At that point I was desperate to go for it, the crowd were cheering and I was full of adrenalin.

Within 0.5 mile I needed a Paula Radcliffe break but I was quickly back in the thick of it, and despite being constantly overtaken I was able to stick to my pace target of 10:18/mile (4h30 marathon). Around 15 minutes later I switched the iPod off and let the crowd support carry me instead. I was wary of this as almost all of my previous runs had been with a soundtrack, but my caution was unnecessary as I started hearing my name shouted out spurring me on. (The people with pints and bacon butties in hand at 10am did little to inspire me however!)

45 minutes into the race I took my first gel pack. I had tried and enjoyed SIS energy gels during my training and took 6 carried on my gel belt. (Top tip: at the marathon expo 2010, they were selling the marathon belt including 4 gels and an energy bar for £10). My next gel was at 90 minutes, and the remainder were every 35 minutes. I heartily recommend using these. Also, these specific gels don’t need to be taken with water making them more versatile, some others do so ask!

After 6.5 miles and just over an hour, I reached the Cutty Sark. Since the fire in 2007 she’s covered in scaffolding so the first highlight of the route was unfortunately not to be enjoyed. Another 6.5 miles, and around 2hrs 20 into the race I turned onto Tower Bridge. I’d been warned not to speed up with the huge crowds that line the road. With the volume of people and the fact i’d just run 13 miles, this wasn’t difficult advice to take.

Over the bridge the course turns right and the road splits down the middle, with mile 23 of the course coming in the opposite direction. This served to reinforce in me two things – 1) i’m not a ‘runner’ i’m a jogger, and 2) i’m only half way.

The route then wound around the Isle Of Dogs for several miles and I lost track of how many miles I’d completed after mile 17. I was pretty sure i’d passed the mile 18 marker and so was setting a faster-than-required pace when I saw in the distance the ‘mile 19′ marker. This marker turned out to be for mile 18 which was desperately disappointing to see.

At mile 18 the route goes underground for a few hundred metres and whilst out of sight of the spectators an increasing number of people opted to walk. Rather annoyingly people weren’t walking on the sides of the road so whilst I was attempting to run around them, I did end up bouncing into others like the ball in a pinball machine. Sorry about that.

I had completely lost my bearings whilst around Canary Wharf but when I came out at mile 20 I knew what I had left in store – 3 miles of the course i’d run in the opposite direction already, and the remaining 3 i’d done on the British 10k.

They say that a Marathon doesn’t follow the conventional rules of mathematics. That is, the first half of the 26.2 mile course is 21 miles. Perhaps it was the gels i’d been taking, or perhaps it was my water schedule – 2 or 3 sips at every water station, then ditch the bottle – but I didn’t find this to be the case. Judging by the increasing numbers of people walking i’m sure it’s more luck than training.

All along the route strangers were offering of jelly babies, orange slices, and towards the end one of the pubs was giving out small glasses of beer and rapturous applause for those willing to partake. I hadn’t trained with sweets and orange so I didn’t accept any, but those who did seemed grateful.

At mile 23 was the official cheer point for The Banana Army (the fundraising group for Leukaemia and Lymphoma Research) and with my name emblazoned on my t-shirt, the support was uplifting. This surged my pace and it dropped from an average of 10:30 down to 9:45 for about 10 minutes.

From Westminster I knew there was very little left to go and tried to keep the head up, feet moving and resist the urge to slow. At the 800m sign I had very little left in the tank, and from my training runs remembered that 800m is not as short as it sounds. As I turned off Birdcage Walk I saw the banner saying 365yds to go and I started to push. Every single person you overtake in those last few yards is one more person you’ve beaten and with the clock ticking in front of you the adrenalin pumps hard.

Arms held high I crossed the line 4 hours 46 minutes and 37 seconds after leaving Blackheath. A quick smile for the camera, the adrenalin vanished and the pain started. To remove the timing chip from your laces you have to walk up a small ramp (to bring your feet up to a reasonable level with the volunteers). This ’small ramp’ at the end of 26.2 miles felt like Everest and I had to use the hand rails to drag myself up.

From there I was ushered in front of the photographers for an official photo. Whilst in the queue the women behind me eloquently described the pain we were all feeling, but I shan’t repeat the language here.

Realising a childhood ambition and being able to do it whilst raising money for a great cause made me quite emotional so I sat down to collect my thoughts for a few minutes before trying to stretch and realising just how immobile I was. After shuffling to the lorry to collect my bag and change my trainers for looser fitting ones I subdued the pain from my blisters and muscles with a pint of lager surrounded by family and friends.

A great day, and a fantastic 4 months training. I never gave up the alcohol during the training but I did pretty much reduce my maximum intake to the governmental binge drinking definition [shockingly low by the way, binge indeed!], and I’ve never felt better. It’s quite a buzz to wake up at 7am sober on a Sunday morning and go for a run and i’d recommend it to anyone – but get professional advice on trainers!

Will I do it again? Never say never.

Location based behaviour

Like a lot of people i’ve pondered the ‘killer app’ over a pint, but these days i’m coming to the conclusion that everything has been invented, duplicated, and cloned to death. So rather than inventing new apps, i’ve been pondering the idea of making the apps become location – or familiarity – sensitive. Combine this with the molecular age of information and I think we could get some really great functionality.

Some examples.

  • You connect to a WiFi and your apps fetch their latest data – Twitterific fetches the latest tweets, NetNewsWire fetches your latest RSS subscriptions, your email syncs – all automatically, no clicking into every app to hit refresh.
  • You check Google Maps for your route and it automatically looks up who lives nearby from your contact list, checks their Facebook, Twitter or Buzz and tells you that “Hey, Sarah has just got back from Turkey and only lives 5 miles from your route, why not stop by”
  • You identify your home WiFi SSID as trusted and your phone disables the keylock, logs you into Skype, and looks up a selection of recipes you might want to cook (if we got the Internet Fridge, this could be really cool!)
  • If you are out of network coverage, but within a WiFi – e.g. underground – then your phone automatically logs you into Skype and redirects your mobile number.

After a reboot yesterday, I got the following error message from Visual Studio.

“Cannot find one or more components. Please reinstall the application.”

I did the control panel fix/repair this app, nothing. Today i’ve found the solution on a messageboard so I thought I’d post it to save others hours of frustrated re-installation.

To resolve…

Look in C:\WINDOWS\WinSxS\x86_Microsoft.VC90.ATL_1fc8b3b9a1e18e3b_9.0.30729.4148_x-ww_353599c2
Is it empty? Mine was. Copy atl90.dll from an adjacent x86 folder into that folder.
Start Visual Studio.

This worked for me on Windows 2003 Server, with Visual Studio 2008.

Or, how to convert a jagged result set into a CSV from within MS SQL server (2005+):

CREATE FUNCTION
        dbo.GetKeywordList(@VideoModuleID uniqueidentifier)
        RETURNS VARCHAR(Max)
AS
BEGIN
        DECLARE @csv VARCHAR(MAX)

        SELECT @csv = COALESCE(@csv + ', ', '') + Term
        FROM   keyword k
               INNER JOIN VideoModuleKeyword vmk
               ON k.id = vmk.keywordid
        W HERE vmk.videomoduleid=@VideoModuleID

	RETURN @csv
END

NB. Ignore the space in the W word. Wordpress doesn’t seem to like me saving the whole word… Here is a stackoverflow article on with the same solution.

Coming back from a few days off work to a bloated inbox got me thinking, why isn’t my client helping me to get through the backlog? So here’s a few features i’d like to see..

  • If my out of office was on, rather than group my emails by date, group them by ‘received whilst away’
  • Watch what I do – if I repeatedly delete an email called “Spam Summary” then create a rule for me to remove them.
  • A lot of messages get sent to a group email and processed by a colleague in my absence in a conversation in which i’m not included, why can’t my email client/server interrogate the conversation ID and the message content, determine a completed task, and then suggest that the email is no longer necessary? (although the privacy issue may need resolving)
  • Remove meeting requests and invites for things which have occurred whilst I was away.
  • Remove duplicate emails, or group them into a single row in my client (GMail has this feature, and Outlook 2010 will have a similar feature too)
  • Identify emails like ‘Donuts for the team’, or ‘Team drinks tonight’, or ‘Leaving speech for Fred Bloggs today at 3pm’ etc

At a click of a button i’d like to see a summary of the emails identified for deletion, have been grouped, etc and then let me confirm the action to remove. I estimate this would reduce my inbox volume by around 40%, and let me concentrate on the important emails.

I know I could create rules for most of this stuff, but I have less spare CPU cycles than my computer.

IETester

A colleague mentioned IETester today at work. In a nutshell it lets you test your website in multiple version of Internet Explorer on the same machine, no need for seperate VMs. It lets you arrange browsers side-by-side by dragging (ala Windows 7 and Chrome 2).

My notes from XP Day 2008

I was at XP day last week in London. I thought i’d log my notes here in no particular order.

From two sessions about Lean and Kanban – Flow and Cadence, and Using Lean to Evolve Out of Scrum

  • Think about Flow rather than batching to reduce risk and deliver value more quickly, if doing this highlights transactionally expensive procedures (e.g. release) then look to reduce that cost by eliminating waste or automating
  • Have checklist/ritual detailed about swimlanes describing entry criteria
  • Pull board items through the swimlanes rather than pushing them and have limits on the number of items in each swimlane. This highlights bottlenecks early and makes the team swarm around bottlenecks rather than generating more backlog
  • Karl Scotland showed this concrete example of how multi-tasking causes project delays due to context switching

One of the systems I work on contains several distributed processes communicating via Active MQ. Integration testing these components has proved unreliable and complex so I attended Testing asynchronous behaviour and got the following inspiration.

  • Testing asynchronous apps makes your unit test code messy and complex waiting for callbacks, state changes, etc. Instead wrap the asynchronous sections in an API to simplify your unit tests.
  • Abstract the messaging interface, implemented a threaded messaging solution and then test the distributed components in separate threads but in the same process space.

An interesting open space titled Why aren’t they typing more. This introduced the Japanese word Mu roughly translated as ‘To un-ask a question’. e.g. The question ‘Why aren’t they typing more’ (often asked when managers see developers pairing) is such a ridiculous question that the person asking needs to un-ask that question.

Portia Tung and Pascal Van Cauwenberghe hosted the Real Options Space Game. I’d not heard of Real Options before the game, but i’d played a previous game with them so I went along to discover more.

Portia writes

Real Options is a decision-making process for managing uncertainty and risk. It’s a simple and powerful approach that helps us make better informed decisions, as individuals and in groups, by understanding and responding to the psychological effects uncertainty has on our behaviour.

On the day I didn’t realise just how much we do this in everyday life. I’ve written more on this in a separate post.

I participated in a coding DoJo called ‘Dirty Jobs’ in which 15 of us paired to add a simple new feature to a (deliberately) complex, messy and untested piece of Java. This was interesting to see how many problems we could identify in the code, and how different people felt we should address the problem, ranging from ‘refactor to make testing possible’ to the diametrically opposed ‘test what we have then refactor’.

An enjoyable and worthwhile two days.

Real Options

After hearing about Real Options at XP day, a little example I thought through of how I unknowingly used the technique recently. From Portia,

Real Options is a decision-making process for managing uncertainty and risk. It’s a simple and powerful approach that helps us make better informed decisions, as individuals and in groups, by understanding and responding to the psychological effects uncertainty has on our behaviour.

Travelling to my parents at Christmas I’d decided the dates but needed to choose the method of travel.

  1. Book train ticket now with reservation.
  2. Defer booking train ticket until nearer the time, possibly no reservation
  3. Hire a car for the trip
  4. Book plane ticket
  5. Book coach ticket

These options present themselves as soon as i’ve decided my time off work but until I know the relative costs and availabaility of them I cannot make a decision. So I look online, find the costs, and I can add the relevant information.

  1. Book train ticket now with reservation – no reservations possible. Buying cost: £60, Exercise cost: £0, Expiry date: imminent
  2. Defer booking train ticket until nearer the time, possibly no reservation. Buying cost: £60, Exercise cost: £0, Expiry date: day before travel
  3. Hire a car for the trip. Buying cost: £150, Exercise cost: £80 (petrol), Expiry date: day before travel
  4. Book plane ticket. Buying cost: £150, Exercise cost: £0, Expiry date: imminent.
  5. Book coach ticket. Buying cost: £30, Exercise cost: £0, Expiry date: 3 weeks before travel

This information lets me rule out Option 1. Why book ticket now for the same cost and availability as Option 2? Option 4 has an imminent expiry date and with it’s increased cost it’s also ruled out. I also have a dislike of coach travel so I ruled Option 5 out despite it’s attractive price.

A week later I checked out the costs and availability of the remaining options. I also introduced travel time to the equation.

  1. Book train ticket now with reservation – no reservations possible. Buying cost: £60, Exercise cost: £0, Expiry date: imminent
  2. Defer booking train ticket until nearer the time, possibly no reservation. Travel time: 2 hours. Buying cost: £60, Exercise cost: £0, Expiry date: day before travel
  3. Hire a car for the trip. Travel time: 4 hours. Buying cost: £150, Exercise cost: £80 (petrol), Expiry date: day before travel
  4. Book plane ticket. Buying cost: £150, Exercise cost £0, Expiry date: imminent.
  5. Book coach ticket. Buying cost: £30, Exercise cost: £0, Expiry date: 3 weeks before travel

As these two options have the same expiry date I waited a little longer. A week later I checked prices and availability again.

  1. Book train ticket now with reservation – no reservations possible. Buying cost: £60, Exercise cost: £0, Expiry date: imminent
  2. Defer booking train ticket until nearer the time, possibly no reservation. Travel time: 2 hours. Some routes are beginning to have no availability. Buying cost: £60, Exercise cost: £0, Expiry date: day before travel
  3. Hire a car for the trip. Travel time: 4 hours. Buying cost: £220, Exercise cost: £70 (petrol got cheaper!), Expiry date: day before travel
  4. Book plane ticket. Buying cost: £150, Exercise cost £0, Expiry date: imminent.
  5. Book coach ticket. Buying cost: £30, Exercise cost: £0, Expiry date: 3 weeks before travel

Given this latest set of information made it easy for me to decide on Option 2 and I bought my ticket. Most of this happened automatically for me, and it probably does for you to. For example,

  • When buying clothes, you see an item you want but it’s the last on the rail. Maybe you hide it, or ask the assistant to reserve it for you. This pushes back the expiration date of the option allowing you to check other shops before making your choice. (Thanks to Portia for this example)
  • Deciding about eating that pizza at 1pm. Defrosting a frozen pizza will take 3 hours, so its buying cost is £3, exercise cost is £0, and the option has an expiration time of 10am. Ordering a take away will have a buying cost of £10, exercise cost of £0 and an expiration time of 12.30pm. The night before you know that waking up at 9am gives you both options, but waking up late reduces your options.

Interesting stuff.

Next »