The Last Landfill Christmas

Reading Time: 4 minutes

It’s just common sense; December is a cold, wet, dark and miserable time of year in Northern Europe. That’s why just about every religion that’s taken hold here has put a big party some time around the Winter Solstice.

Christmas is supposed to be fun. It’s supposed to brighten up an otherwise miserable time of year. How then did we end up with this version of Christmas? The one where it’s a significant cause of stress? Where it’s become a big list of expectations and obligations? You must do this, do that, buy this, invite these people, visit those people, decorate your house so, buy presents, presents and more presents, send cards to the entire world and not go postal on the Salvation Army band when they turn Gaudete into a funeral dirge.

In 2009 I got so hacked off with the entire affair that I decided to celebrate by going on holiday – to a Muslim country. It was worth it, I came back with an entirely different attitude.

I took step back and began to ignore the billboards and the adverts and all the noise and listen to the language of Christmas: the stories; the songs and carols; the messages people send. It’s not about presents, it’s not about wrestling 9 other people by the games counter in Hamleys to try to get your hands on the last UK stock of this year’s must-have toy. There are literally no mentions of buying a new sofa to try to impress your relatives. For Christians it has specific religious significance. For the rest of us the messages of Christmas are of peace, of goodwill, of hope.

These are universal, whether you’re a Christian or not.

That’s what I learnt in Egypt a decade ago, where our hosts apologised constantly for not really understanding Christmas, but in fact embodied its true meaning far better than we do the UK.

This wasn’t the reason I wanted to write this article however: it was consumerism.
It was a suggested on a business programme I was watched not so long back that the average life of a Christmas present is two weeks. After that they get no significant use and ultimately end up as landfill waste. At first that seems ridiculous, I still have plenty of presents from years back that I still use and indeed treasure. However when I think about the amount of relatively low value presents I’ve received as tokens of people’s affection then the two week figure starts looking frighteningly plausible.

I didn’t know that in 2010, but I did know that my friends and I were getting an awful lot of crap we neither needed nor wanted. It was all given with the best of intentions of course, but most of it was disappearing shortly after Christmas to never be seen again. Consequently I came up with a plan: if I didn’t know a present that someone really wanted then I’d try to buy them something consumable. Wine, beer, theatre tickets, restaurant vouchers, hampers, etc. Things that they would definitely use and that would leave a very small footprint behind, if any at all. I’ve done that every year since.

Aside from not wasting money on crap that will get thrown away there’s another reason. In Europe we’ve made big efforts to reduce the amount of energy we waste and the amount of greenhouse gasses we produce.
In counting this however what we’ve failed to do is to account for the carbon footprint of the goods we import. Almost all cheap Christmas good are imported from other countries, countries where in many cases the energy and manufacturing systems have a much larger carbon footprint than ours in Europe.

Even if you put the environmental argument aside, if you’re buying cheap presents from a global online marketplace or a major chain store then the money is just disappearing out of your local economy and even out of the country.

You’re basically just giving Jeff Bezos your hard-earned cash.

What can we take away from this?

Buy from local small businesses. Not only does this improve your carbon footprint, it helps people in your community – and not just the business owners. You give the shop-keeper a £10 note, that gets paid to staff who use it in a restaurant that then uses it to pay a local farmer who then buys feed – the money stays local, benefiting people in your community. Buy something from Amazon and it’s gone.

Buy consumables for presents. Things people like to eat, drink; supplies for their hobbies; experiences you know they’ll enjoy.

OK, if you have kids I know this is difficult, but try not to be a Dursley. You know your kids, try to buy small numbers of high quality goods that you know they’ll really enjoy for a long time. Ignore the hubbub about this year’s must have toy. Most of that noise is created by the industry itself and most of those toys are rubbish. Remember that magazines, newspapers and web sites rely on advertising money. If the toy’s manufacturer is promoting it the media is going to be right behind it, even if they all know it’s rubbish. They’ll tell you that it’s the best thing ever, that everyone wants it and that you’re a bad parent if you don’t buy it. In the words of a band I rather like, Ignore the Machine.

Remember also that the experience of seeing your children thrilled and happy doesn’t always have to be met by a physical thing. If you have a special trip, holiday or experience planned, you can announce it at Christmas. With many items you can either make a kind of fake ticket or put the actual tickets in a fancy envelope and use that as a present.

Peace, Hope and Goodwill. You don’t have to be a Christian to understand the true meaning of Christmas. By far the greatest gift you can give is happiness. A big part of that is freedom; freedom from conflict, be that personal, regional or international. Freedom from the fear of conflict and war. Freedom from oppression and the fear of oppression.
Goodwill is the key to all of that.
You can give people peace by being kind and considerate towards them, showing them that they don’t have to worry about conflict and oppression.
You can give people hope by showing that you care about them, that you care about their future and the future of the planet.

…and, as Bill and Ted so wisely put it, Party On Dudes and Be Excellent to each other.



The Y2K Bug: Was It a Hoax?

Reading Time: 5 minutes

I’ve run into a few people recently who’ve told me that the Y2K problem, aka The Millennium Bug was a hoax. In some ways the issue was, but let’s get one thing straight, the bug was very real and if we hadn’t done a hell of a lot of work to fix it, things would have gone catastrophically wrong.

What was the problem then? In the 1950s every tiny piece of computer storage was critical. Programmers were always looking for ways to store and process information more efficiently. They didn’t think for one moment that their code would ever have to deal with the year 2000, so they decided to lop the “19” off the front of the year and just store the last 2 digits. 1958 was actually stored as “58”. If the user needed to see the full year then many systems simply printed “19” before the 2 digit year.

This wouldn’t have been much of a problem if it hadn’t made it out of the 1950s. Unfortunately every new generation of the tech industry builds on previous generations. Not only did the 2 digit year become a kind of industry standard, it also got baked very deeply into the code that actually ran the computers themselves.

OK, it’s a stock image. It’s really here to break up the text.

By the time the 1990s rolled around there was an awful lot of computer code about and people started to realise that a lot of it was going to have to deal with the year 2000.

Suddenly You Find You’re Not Insured…

Let’s look at an example. Let’s say you renew your car insurance. The new policy starts on January 2nd, 1999. Now, you’ve been lucky, this computer program uses 4 digit years so you correctly see your expiry date as January 1st, 2000.

Unfortunately the database that all the records are stored in only uses 2 digit years, so the system writes a start date of 02/01/99 and an expiry date of 01/01/00 into the database.

The problem is obvious: when that record is read back the system will correctly convert 02/01/99 to January 2nd, 1999, but it will wrongly convert 01/01/00 to January 1st, 1900. Congratulations, as far as that computer system is concerned you’re not insured.

In that simple example you’d hope that, at some point, a human would see it and realise something had gone deeply wrong. The problem is that, even in 1999, there was an awful lot of processing going on, in financial systems even in safety critical systems, before the results ever got anywhere near a human.

The Ariane 5 rocket explosion was caused by a similar problem. The guidance system was capable of producing a much higher number than the main computer could deal with. This hadn’t been a problem on Ariane 4 because it couldn’t do anything to cause such a number to be generated. Ariane 5 however could and 37 seconds after main engine ignition on June 4, 1996, it did, ultimately causing the rocket to self-destruct.

That’s why we had to fix the Y2K bug, because pretty much everywhere there was a date in computer code there was potential for things to go badly wrong.

It Wasn’t Just Dates…

What’s more, it wasn’t just the obvious cases we had to worry about. There were more subtle implications of the bug. Consider the following output from a little example program I wrote. It gives you the expected arrival time of a plane and its current altitude both in feet and metres.

 SIGN    DATE            TIME    ALT(m)  ALT(ft)
Y2K00 1990/11/01 00:00 5000 16384
Y2K01 1991/11/01 00:35 4900 15872
Y2K02 1992/11/01 01:10 4800 15616
Y2K03 1993/11/01 01:45 4700 15360
Y2K04 1994/11/01 02:20 4600 14848
Y2K05 1995/11/01 02:55 4500 14592
Y2K06 1996/11/01 03:30 4400 14336
Y2K07 1997/11/01 04:05 4300 14080
Y2K08 1998/11/01 04:40 4200 13568
Y2K09 1999/11/01 05:15 4100 13312
Y2K10 19100/11/01 05:50 4000 49
Y2K11 19101/11/01 06:25 3900 49
Y2K12 19102/11/01 07:00 3800 49
Y2K13 19103/11/01 07:35 3700 49
Y2K14 19104/11/01 08:10 3600 49

There’s one thing you might expect, that when it got to the year 2000 it printed out 19100. The program stores the date as 2 digits and simply prints “19” in front of them. That was a pretty typical Y2K bug: the 2 digit year ticks over from 99 to 100 and it gets printed as “19100”.

What might be surprising is that after the year 2000 it completely screws up the calculation of how high the plane is in feet. The calculation before the year 2000 is (approximately) right. Afterwards it just prints “49” however high the plane is.

This is because, when I wrote the program, I only allocated enough storage for 2 figures in the year. When it came to after the year 2000 however, the program wrote 3 figures regardless. What it did was to write the extra “1” to some storage that was being used for something else – in this case to store the height in feet. 49 is the value a computer would send to the screen if it wanted to print the number 1.

Again, in my little program this gets printed to the screen and you’d hope that someone would notice. What it highlights however is that the problem caused can be somewhere else in the code and affect something other than just the date. This corrupted value could be the radiation dose of a chemotherapy patient and it might never get seen by a human before its delivered…

I hope that makes it abundantly clear that the Y2K bug was very much real and that the consequences could very definitely have been catastrophic. The idea that the bug could have caused planes to fall out of the sky is not and was not scaremongering. It was entirely possible. Indeed if we had somehow sleep-walked through to the closing minutes of 1999 without realising there was a problem it was a relatively likely consequence. We did however realise and we did a hell of a lot of work to fix the problems.

Now of course it’s true that the press over-hyped the situation. The headline “Renowned industry expert says that thanks to years’ worth of effort it’s now exceedingly unlikely that there will be any critical incident in the aviation sector” doesn’t make much of a headline. “Boffin says planes could fall from sky” is going to sell many more newspapers.

On the back of that hype there was also the predictable bunch of spivs and con-merchants offering to Y2K-proof your toaster. I’m sure you get my point; some people capitalised on the ignorance and panic by spreading more misinformation and making a pretty penny out of fixing things that didn’t need fixing.

That doesn’t lessen however the seriousness of the real underlying problem. It was, as they say, “a biggie”.

So It Definitely Wasn’t a Hoax… Or Was It?

There is however a certain thread of logic that says, even considering everything I’ve written, it was still a hoax. It’s a line of argument I actually quite like. For the tech industry it certainly wasn’t a hoax, it was very real indeed. For the government too – the government needed to make sure that adequate provisions were being made to fix it, to mitigate any remaining risk and deal with any problems arising.

As far as the general public were concerned however, they were never actually exposed to any significant level of risk. It was inevitable that we – the tech industry – would fix all of the serious issues well before they came into play. There was nothing that the people on the Clapham omnibus needed to worry about. In fact, being perfectly brutal about it, there wasn’t really any need for them to ever know about the problem at all.

Much as I like it, I don’t entirely subscribe to that school of reasoning. Even as midnight ticked over we couldn’t be sure that we’d fixed every critical bug. There was still a risk of things going badly wrong and the general public needed to be aware of that.
There’s also an argument that it was public awareness that actually made a lot of the tech industry sit up and take notice :- that’s when the senior management of these businesses finally realised that what the technical people were saying was right.

Did we need people predicting that planes would fall from the sky and toasters would stop working though? No, we definitely didn’t. What we needed was common sense. What we got was the British Press.

Perl: The Lazy Way to Write WPF

Reading Time: 2 minutes

I hate writing boilerplate. Recently I was writing a test tool where I needed to be able to build messages from a WCF interface. That’s a lot of ViewModels and a lot of views and a lot of tedious typing.

That is, of course, unless it’s Friday lunchtime and you happen to have spent the first half of your career working on *nix systems. Enter Cygwin and some now rather sketchy memories of how to write Perl.

$ perl -ne \
'if($next) \
{ \
$_=~/^\s+void\s+(\w+)\s*(([^\)]+)\)/; \
$cType=$1; \
print "public class ${cType}Model:DependencyObject\n{\n"; \
@props=split /,\s+/,$2; \
foreach $p (@props) \
{ \
($type,$name)=split /\s+/,$p; \
$name=~s/^([a-z])/\U$1/; \
print "public static DependencyProperty ${name}Property = DependencyProperty.Register(\"${name}\",typeof($type),typeof(${cType}Model));\npublic $type $name\n{\nget => ($type)GetValue(${name}Property);\nset => SetValue(${name}Property, value);\n}\n"; \
} \
print "}\n"; } ; \
$next = /\[OperationContract\]/ ;' \
< IClient.cs >../../../../../Models.cs

I then just used ReSharper to move the classes into their own separate files.

Yes, I realise that the little snippet of Perl is very poorly written, both from the point of view of its fragility in processing C# and also because these days I really only use Perl for one time lash-ups like this. It’s be 15 years since I could say that I wrote Perl in any professional sense and I’ve forgotten a lot in that time.

My point however isn’t to provide a shining example of Perl for you to cut and paste. It’s to point out that a few lines of text processing script in whatever language, written in a few minutes, can save you from a whole load of tedious typing.

I use Cygwin a lot in programming, because utilities like find, xargs, grep, sed, awk, cut, uniq and bash scripting itself can save a heck of a lot of time.

If you’re not an old *nix wonk like me however all is not lost. Perl can do pretty much everything anyway and there are plenty of Perl implementations for Windows.

Of course there is the world of Powershell too and that’s where I have a confession to make. Aside from learning the basics; just enough to do what I need to do, I haven’t really delved into Powershell. I’m sure Microsoft have put a lot of research into it, but to me it feels really awkward, like you’re always having to jump through hoops to get even the simplest thing done.
I realise the potential hypocrisy of this, Despite being notoriously counter-intuitive, vi has become second nature to me. It’s only when I try to explain to others that I remember that if you’re not thinking about trying to operate an editor over a 300 baud serial link then none of it makes any sense at all.

Anyway, I digress, the simple conclusion is that if you’ve got a mountain of boiler-plate to write, have a think about using some sort of script. There’s a lot of power in your fingertips.

Racism Is Hard-Baked Into White People

Reading Time: 2 minutes

In fact all the institutions I dealt with were [or claimed to be] against racism. They were however white. Books were white, TV was white, culture was white, science was white, the law was white, power and influence were white. That gets baked into you whether you like it or not.

Why was there a brouhaha when black actress (Noma Dumezweni) was cast as Hermione Granger in The Cursed Child? Because people, many of whom would say they were against racism, just assumed Hermione was white.

Rowling‘s description of her doesn’t specify or even imply: it is distinctly indistinct. Instead it concentrates more on her character and how clever she is. We – me included – just assumed she was white. Why?

Because she’s privileged, because she’s bookish, because she’s clever, because she’s powerful, because she’s a heroine. All these cues refer back to the environment most Westerners grew up in and they all tell us that she’s white. We don’t think about it, we just assume it.

We might not think this matters because we think we make all important decisions consciously where we can weigh up the evidence objectively. That however is far from the whole picture. We make thousands of decisions every day without them ever fully surfacing into our consciousness. Similarly we send out thousands of signals that we’re not consciously aware of.

Those biases that have been baked into us by our upbringing do still have an effect, a very subtle effect, but it’s there nonetheless. If it’s just one person then it’s insignificant, the problem is that we’re not just one person, those of us who grew up in an almost exclusively white environment are a majority. On top of this almost everyone in the UK grew up – and continue to grow up – in an environment where the vast majority of significant institutions are predominantly white.

What can we do about it? We can’t undo decades of programming simply by wishing it away. There is no silver bullet. We have to acknowledge that it’s there, to be aware of it. We have to be aware that no matter how much we believe in equality, we can occasionally be guilty of accidental racism. We have to accept that, for people with my kind of upbringing, just being ideologically opposed to racism is not enough. If we are not actively fighting against racism then we are subconsciously contributing to it.

We have come a long way to eliminate conscious racism from the majority of the Western World. We still have a battle to fight, especially at the moment, but we are making steadily making progress and in the end we will win.

Not That Kind of Router

Reading Time: 2 minutes

I have to admit I’m struggling with this one. Usually I can find some kind of spin, some kind of humour, some way of making a very boring subject a little easier to read.

I think with this one I’m just going to have to put on my anorak and face facts: there’s nothing really interesting in this story. It is what it is, but it does have a mildly uplifting conclusion. At least I can tease you with that.

Many years ago I bought a cheap router; the kind that you use for machining grooves in wood, not the kind that hurls packets down the right network pipe. I was fitting out a room with a load of custom built cabinets and I figured if it lasted for just that job I’d not be too bothered.

It lasted a bit longer than just that job, about a decade longer.

A few days ago however it had a problem. I was cutting a chamfer on a roof panel when the motor suddenly slowed and there was a fireworks display in the top.

“It’s done well” I thought to myself and started looking at the price of half decent routers. Ouch!

I’d just assumed that there’d be no way to fix a cheap router like that. There’d be no way to get the parts! Nevertheless I popped the top off and had a look and to my surprise I found that the brush assemblies just slid out and that the brushes themselves were easily replaceable.

A quick visit to Ebay later…

Then it was just a case of slotting them into the housings. In the picture beneath the right one’s done, the left is the old, worn out one.

Then popping them back where they should be.

The exciting moral of the story is not to assume that you’re going to have to throw something away just because it’s developed a fault. The Internet – and in particular ebay – has given us access to millions of parts for all sorts of things. It’s always worth looking.

Primordial Radio Data Usage

Reading Time: 3 minutes

The question of how much data allowance Primordial Radio uses has been asked a few times.

The simple answer is about 30 megabytes per hour, which means 1Gb of data will last you about 33 hours.

If you’re interested, the not so simple answer goes as follows.

Primordial are cunning, they use a 63KBit AAC stream. The bit rate is, quite literally, how much data per second the stream uses. The higher the bit rate, the higher the quality of audio that can be squeezed in. It’s a trade-off between data and quality. But there’s another factor – the technique used to encode the audio.

If Primordial used a 63Kbit MP3 stream it would sound dismal, because MP3 is actually a pretty old and inefficient audio encoding technique. Because they use AAC, they can get away with a much lower bit rate, which keeps the amount of data you need to use to listen to Primordial low and the quality acceptable.

BBC Radio 3, in comparison, have a 320Kbit AAC stream (amongst others). You can get your Classical Music fix in super-high quality, but it will munch 150 megabytes per hour.

Now, the relationship between the bit rate and the amount of data it uses isn’t entirely straightforward. In data transmission we tend to talk about bits per second and when we talk about data allowances they’re in bytes, or more likely Gigabytes.

Your broadband connection, for instance, is almost certainly specified in Megabits per second. Long story short, the reason is that the bit is the smallest thing that can be sent, so it’s most accurate to talk about the speed of a connection as bits per second.

A byte is almost always 8 bits, but some types of communication use extra bits to regulate the transmission, so it’s not always a straight 8 from bits per second to bytes. It’s close enough for a ready-reckoner though:

63 / 8 = 8 (roughly)

We need 8 kilobytes of data for one second of audio. We can then easily multiply that up.

8 *60 = 480Kbytes per minute

480 * 60 = 28800Kbytes per hour

A megabyte is 1024 kilobytes, so:

28800 / 1024 = 28Mbytes (per hour)

This, however, is always going to be optimistically low. Firstly there is the problem of the envelope. Data over The Internet is sent in billions of packets. You can think of each packet like a… um… packet. You can’t just lob a bottle of Hendricks in the postbox and expect it to get anything other than drunk by the postie. You need to wrap it up in something, put an address on it and pay postage if you want someone to actually receive it. There are similar overheads on the The Internet.

There are various different systems in use, often there are several layers of content and packets. This means that there is a lot more traffic on The Internet than just the useful data.

There is also the problem of packet loss. A small amount of data on The Internet just disappears. This is actually expected, it was designed that way because it’s easier and more resilient. What it does mean however is that a small amount of data has to be sent twice.

You can pretty much account for all this by simply adding a fudge factor. 20% is usually considered a safe margin. If we take our theoretical figure from earlier:

28 * 1.2 = 33.6MBytes per hour.

This, of course, is an estimate based on a bit of theory and some practical experience. If you don’t trust these kinds of calculations, you could just look at the speed on your router’s data rate table.

If you wanted a bit more accuracy though, you could listen to Primordial for, say, 1/4 hour, record the amount of data every packet contained and the overall length of the packet, then add them all up.

You’d have to be a right geek to do that though.

The total data received was 8150537 bytes, of which 7247617 was useful content. Those can pretty easily be multiplied up to an hour:

Total audio and related data: 27.65 megabytes per hour.

Total data exchanged: 31.1 megabytes per hour.

Naturally I can’t guarantee these figures absolutely. They’re over Wi-Fi rather than a mobile network and there will be differences. There will also be differences between different networks and even different times of day as The Internet itself changes and adapts to the traffic.

What I can say is that they should be somewhere near, within a few percent.

The Healthy Business Traveller’s Survival Guide

Reading Time: 6 minutes
Disappointing hotel room

Tonight’s bed is in a characterless chain hotel just off the M1. Like every business hotel, the bar is stuffed full of regretful corporate peons in cheap suits. It’s a club that’s far too easy to join. At first you’re only away for the odd night, so it doesn’t matter if you have a burger and a couple of pints.

It creeps up on you though, a few nights here and a few nights there and suddenly you buy and Audi A4, can’t see your feet when you’re standing up and find yourself discussing house prices with a Regional Business Development Manager from Nuneaton.

“It’s really hard to keep up the diet when you’re on the road” I hear time and time again from the person loading their plate with fried sausages and hash browns. They look down at the bowl of muesli and fruit I’m holding then briefly catch my eye again before they awkwardly shuffle off to join a table of 3 others, all with plates piled high, all wearing the same expression.

It’s not about the diet though, it’s about the choice of lifestyle: they’ve subscribed to the road warrior lifestyle; “You’ve got to play the game, Tom, you’ve got to play the game” one of them once told me. He never could tell me why.

You can join that world if you want to. It’s kind of cool for a while, but it starts getting old very, very quickly. You don’t have to join that world. You don’t have to play that game.

Here then are my tips for not getting sucked into that cycle of drudgery.

Eliminate Unnecessary Travel


Rule 1: if you don’t need to travel, don’t travel.

The face-to-face meeting is still the default for an awful lot of people. If there’s any doubt about anything then they want to get all the people in a room and talk about it. It’s a reflex, often no more than arse-covering, but it often results in a lot of people wasting a lot of time.

Of course there are occasions when it’s the right thing to do and it’s right that you should be there. Otherwise however it’s better for both you and the business if they conference you in only for the bit where you’re actually needed.

The key point is that travel is often not the most efficient use of business resources, it’s just an assumption that you – or someone – should go. Question that: if it’s not the best use of resources put the case for why.

Choose The Right Hotel

There are many employers that give you some flexibility about the hotel you book. In which case always book a hotel with a free gym and free breakfast.

Being away on business is a good opportunity to visit the gym. Not only that but being away from home is stressful and exercise is proven to combat stress and anxiety. Remember to pack your gym kit though eh? And a water bottle is useful too.

In the morning, always choose the healthy breakfast option. Start how you mean to go on. This is where the free breakfast comes in: many hotel chains lower their room rate but don’t include breakfast, You book them thinking you’re getting a bargain and then find they’re charging £18 for breakfast. Even though you’re not paying, the idea of shelling out 18 notes for a bowl of muesli and banana irks, so if you’re not careful you head for the buffet and have a Full English.

Don’t do it. Book the more expensive hotel and have the muesli and banana.

Whilst we’re on the subject of hotels, pay attention to the distance the hotel is from the place you’re visiting. The cost to the business of having you stuck in traffic for an hour is £50 as an absolute minimum. It could be many times that. Saving £10 to spend and extra 1/2 hour in traffic isn’t worth it. I’ve justified trampling on various hotel booking policies many times this way.

Supermarkets Are Your Friends

Get control of your food. Buffet lunches these days are better than they used to be, but be careful. Work out how much you usually eat for lunch and don’t got over that. If it feels socially awkward not to have food, grab a glass of water.

Similarly if there’s a canteen, don’t get sucked into having 2 main meals that day.

If lunch isn’t laid on, make sure you bring some. Otherwise it’ll end up with someone doing a run to Joe’s cafe at 2pm for a large sausage and meatball butty.

There are some pretty good petrol stations these days with mini supermarkets in. They often have good healthy meal options. Either make your own lunch or buy your lunch in advance.

Keep some travel cutlery into your day bag. That vastly increases the amount of food you can eat.

When it comes to dinner, some hotels have good options and if you’re staying in an urban centre there can be good options there, too.

Otherwise buy some cold food from – you’ve guessed it – a supermarket. Then you can make sure that you have a balanced intake with the right amount of calories.
If you’re really inventive there are actually quite a few cooking options in a hotel room, you can do a lot more than Pot Noodle.

Don’t forget drink. I don’t usually drink as much liquid when I’m away, so I’ll buy at least a litre of flavoured water per night.

Whilst we’re here, stay away from the extra-large chai latte, from fizzy drinks and especially from energy drinks. This isn’t just a travel tip, it’s a life tip. They put you on a roller-coaster that you really don’t need to be on.

Plan Your Evenings

You’re in a disappointing room near a disappointing town in a disappointing hotel commanding disappointing views of a disappointing motorway. This is a really good time to sort out your car insurance and catch up on a couple of episodes of that TV series that you love but which your partner hates.

This requires forethought however. You need (copies of) the documents or access to them online.

Never rely on hotel WiFi. Sometimes it works brilliantly, other times you can barely get to Google. Make sure you have anything you want to watch or any substantial document on a device you have with you.

Pack a HDMI cable if you carry a laptop. Most hotel TVs have a HDMI input that you can use, whether they advertise it or not.

If you rely on a mobile device then pack a Chromecast or similar, you can put it into guest mode and stream to the room’s TV.

Plan Driving Breaks

Live traffic Sat-Navs and automated reminder services are pretty good at estimating how long it will take you to get somewhere. That time doesn’t include breaks. Driving requires concentration and that means you need breaks. It’s is, quite literally, for your health and safety.

Don’t mess with your meal times too much and, especially, never miss a meal. If you usually eat at 12:30 then try to make a break fit in around that time and have a bite. Again, stay away from burger chains and greasy spoons. There are plenty of healthy, tasty food options in service stations these days.

Keep a Travel Bag

One of the really annoying things about travelling is the continual packing. It helps if you have a spare set of toiletries in a bag that you can just throw in and know that you don’t have to worry about deodorant, toothbrush, etc.

It’s not just toiletries either, there are a few other things:

Buy a warm high-vis jacket and keep it in the boot. Your car is lovely and warm when it’s working, but the engine management unit has a problem with its lifestyle it can get very cold very quickly. A warm hi-vis jacket kills 2 birds with 1 stone. I got mine – and in fact most of my safety equipment – from Arco (and no, they’re not a sponsor).

Include a USB extension cable. These are surprisingly useful, not in the least because hotels have a funny habit of putting the electrical sockets as far away from the bed as possible. Your phone however you generally want to both charge and use as an alarm.

A mobile phone power bank is another good investment. You might think you’ll be near a socket all day and all night, but if you get stuck in meetings then get a particularly unfortunate room, it can get dicey.

Finally, Look After Yourself

Above all remember that you and your health are the most important things. Don’t compromise that. You don’t have to get sucked into the business travel lifestyle.

It is a profoundly unhealthy lifestyle and this is worth remembering not just for your own sake but for that of your employer. There’s a reason many employers offer private health schemes, gym memberships and other health related benefits. It’s an investment on their part, because healthy people work more effectively and more efficiently.

It’s good business sense for your employer to let – even encourage – you to keep yourself healthy.

Moreover it’s an investment by you. You only have one life and if you compromise your health now you will pay for it later, financially, physically and emotionally. When it comes down to it, it’s as simple as that.

Emergency Calls, Locations and 55: The Truth

Reading Time: 3 minutes

You may well have seen this meme going around Facebook and other places. As a general rule, unless you can trace information like this back to an actual emergency service or other reputable outlet, you should assume that it’s fake.

In this case it’s inaccurate, but it does contain some information that’s true.

The Full Fact article does a reasonably good job of explaining, but I can add little more detail from a different perspective.

When you make a 999 (emergency) call in the UK, the emergency services have access to some extra information about that call that they don’t get for other calls. This happens automatically whether you dial 55 or not.

If you call from a land-line or telephone box, the emergency service has access to the subscriber details for that line. This includes the name of the person that the line is registered to and the address.

If you call from a mobile, the situation is a little more complex. The emergency service can request the location of the mobile phone – and usually does so automatically. That request gets passed to the mobile phone company. Before the days of GPS, the mobile company would return, if it could, an estimate of the location based upon the signal strength and the location of the cell masts nearest to the phone. It can sometimes provide quite accurate results, but other times it’s not so good.

The mast information is still sent to the emergency services. Now however almost every mobile phone has GPS so new methods have been developed so that the phone can also send its location data all the way through to the emergency service control room. Not every phone can do this, so you can’t rely on it, but the more time that passes, the more phones are coming on-board.

It’s worth noting that a mobile phone’s own location data isn’t always accurate. It’s usually pretty good, within a few metres, but there are a number of factors that can throw it off, sometimes by just a few metres, but I’ve seen examples of phones thinking they’re on a different continent.

Again, to be clear, you do not need to dial 55 or perform any secret handshake to make your location available. If your phone can do it, the mobile network can do it and the emergency service can do it, then your phone’s location data gets sent to the control room. It’s all automatic. This is what I think the meme is talking about as “new technology”. Otherwise, the mast data is almost always available.

Where dialling 55 comes in is if you’re in a situation where you can’t talk. If you’re hiding from an attacker for instance you might not want to talk as it may alert the attacker to your location. The mobile operator may well ask you to dial 55 if you’re there and are in danger. That’s the point of dialling 55 – it lets the operator know that, although nobody is speaking, you have not dialled 999 by mistake.

I should point out here that the emergency services do not always respond to silent 999 calls. They have to assess each call individually and decide whether to respond, whether the person talks or not.

Ultimately then there is some truth to the meme and I suspect somewhere, underneath it all, someone knew what they were talking about. It looks however as if it’s been through a few people and by the time the meme was made some of the messages have got a bit mixed up.

To conclude:

  • The emergency services can always get your location and usually do automatically. You do not have to dial 55 to make that happen.
  • The “new” bit is that the emergency services can now get the location data direct from many smartphones, instead of having to rely on mast data.
  • Only dial 55 if you are unable to speak for some reason. The operator may ask you to do this anyway if you don’t speak. If you can speak however, do.

Finally, don’t assume when you call that the emergency services do have your location. Things can go wrong, the more information you can give them over the phone, the better.


Tom Fosdick is a software engineer who is responsible for the system that several UK emergency services use to get 999 call locations.

I’m Pulling the Social Media Plug

Reading Time: 4 minutes

In the words of a certain radio station, “Social media can be a force for good, but it can also be a giant pain in the arse.”

When I wrote that First Class Post was the most rapid form of communication of which I approved I was only half joking. I recently spent two weeks in India. Rather than deal with the expense of roaming or hassle of a local SIM I just turned mobile data off. It was a surprisingly liberating experience.

It’s not like I dropped off The Internet completely: there’s free WiFi in most hotels and a few restaurants. What I found though was that having Internet access time-boxed had a far greater effect on the way I lived my life than I could ever have imagined.

I’ve spent pretty much my entire career in communications, most of it trying to improve the connectivity and communication technology used by the emergency services. I’d always kind of assumed that more connectivity and more flexible communications were a good thing.

It’s true – the increased ability to communicate can benefit us very greatly. For instance, we’re now talking about the ability for members of the public to stream video directly into an emergency service control room. That information could be hugely useful to the call-taker, in informing the member of the public, in informing the crews being sent to the scene and also providing an evidence trail for any followup action.

On the flip side however, as I’m sure you can imagine, the ability to stream video from a remote location to another, particularly via an end-to-end encrypted channel, facilitates some of the most appalling people in existence.

To a lesser extent the same is true of social media. It enables us to keep in contact with people that we would otherwise naturally lose touch with, but it also throws up conflicts that we would never otherwise have. On top of this the social media companies themselves aren’t making money unless you’re using them. They make every effort to ensure that their platform invades your life as much as possible.

Over the past year or so I’ve become utterly frustrated with this: I’ve disabled all notifications from every social media app on my phone. What India taught me however is that this isn’t enough. If I really want to take back control from social media, I have to remove myself from the social media environment and only step back into it on my terms.

Social Media is not a new thing, it existed back in the dial-up days. The difference was that to be online you had to make a phone call, and the costs could mount up if you weren’t careful. You had to set limits, for purely financial reasons (especially if you were on a trainee’s wage).

So I’m setting usage limits again.

Just before we left for India, my partner and I were in a restaurant and the couple next to us spent the entire meal on their phones. They barely talked to each other. The first rule therefore is:

No phones at the dinner table, wherever that dinner table is: in the house; in a restaurant; a picnic table in a field; etc.

If I’m out and about doing jobs or visiting people, the chances of me needing to call someone are fairly high, but the chances of me needing a smartphone are fairly low. The second rule:

Unless there is a clear reason to take the smart phone out, take the dumb phone [see above photo].

The penultimate rule I call the “Soap Opera Rule”. In many ways Social Media is like a Soap Opera, the two differences are that it deals with real people and that it’s constant, it doesn’t come in half hour chunks 3 times a week. The former is somewhat the point of Social Media. The latter is something that you have to manage and it helps if you think of it more like a Soap Opera:

Set clear daily usage limits and don’t exceed them.

Of course there are exceptions to every rule. When we’re talking about usage limits we have to consider what the purpose of usage is. If you’re organising a family meal via WhatsApp that’s not the same as reading your Twitter timeline.

The key here is be sensible and maintain perspective.

The last rule is the simplest of them all:

Talk to people.

Social media is no way to conduct a friendship. Sure, it’s a great way to allow you to find people with common interests and to keep touch with people who you would otherwise lose touch with. Those people aren’t your friends (although they may have been or may become so). Ultimately, friends are not people you broadcast status updates to. Friends are the people you have a conversation with when you have news.

So call them, invite them round for tea, go to lunch with them, go watch a film with them but interact with them directly and personally, not via timelines and group chats.

From now on I’m going to be following these rules. In reality you probably won’t notice any difference, but I think it’s going to make a big difference to me and I hope these words make a difference to other people.

Remember that it’s in the interests of the Social Media companies to create a society where it’s socially unacceptable not to be glued to your phone. Don’t sign your life over to them: take back control and always, always be true to yourself.

C# Best Practice: Why a Separate “lock” Object?

Reading Time: 4 minutesSome time about 1995 I noticed that I was writing a lot more concurrent code than the other programmers. It was almost as if someone was deliberately pushing it in my direction… That theme never really changed.

I was rather surprised then when a developer made a comment on something I’d written a few years back, because I was pretty confident I’d covered all the bases.

public class SomeServer
{
    private readonly Dictionary<KeyType, ValueType> queries = new Dictionary<KeyType, ValueType>();

    //stuff

    public void PerformLookup(string someQueryTerm)
    {
        //some logic...
        lock(queries)
        {
            //some more logic
        }
    }
}

The comment was:

Please use a separate lock object. e.g. private readonly object _queriesLock = new Object();

Eh? What?

OK, hands up I missed this. I learnt to use basic concurrency tools way before C# existed. For me C#’s ‘lock’ construct was great because it allowed me a very clear and concise way to use a monitor. As far as I was concerned there was no downside. Why on earth would I want to use a separate lock object?

There are 2 things you need to be really careful about when using a lock in this way.

You must carefully manage the lifetime of the locked object.

Imagine above if ‘queries’ were not a readonly object created at instance initialisation. Imagine if someone did…

lock(queries)
{
    //stuff
    queries = new Dictionary<KeyType, ValueType>();
}

You have to make sure that the locked object is instantiated before the fist lock is taken out and you must make sure that it is not reassigned in any way until after the last lock has been exited.
If you don’t it leads to all different flavours of bad.

If you instantiate a separate lock object at object initialisation, an object that has no purpose other than as a lock, then you know it’s there at the start and the chances of someone messing with it before the end of the last lock are very significantly reduced.

You must be careful not to expose the locked object externally

C# allows an implicit monitor to be created on any object. You can use that monitor by wrapping the object in a ‘lock’ statement.

If you wrote the class to use, say a mutex explicitly rather than the implicit monitor there’s no way you consider making the mutex externally accessible…

public class SomeServer
{
    private readonly Dictionary<KeyType, ValueType> queries = new Dictionary<KeyType, ValueType>();
    public Mutex _queryLock = new Mutex();

    //stuff

    public void PerformLookup(string someQueryTerm)
    {
        //some logic...
        _queryLock.WaitOne();
        try
        {
            //some more logic
        }
        finally
        {
            _queryLock.ReleaseMutex();
        }
    }
}

That’s complete madness – any other class can mess directly with the lock and cause all sorts of unwanted behaviour. Deadlocks are a particular hazard here and compound deadlocks can be really tough to debug.

If you’re using the implicit monitor via the ‘lock’ construct however and you expose the locked object beyond the scope of the class, you are effectively also sharing the monitor.

public class SomeServer
{
    public Dictionary<KeyType, ValueType> queries {get; private set;} = new Dictionary<KeyType, ValueType>();

    //stuff

    public void PerformLookup(string someQueryTerm)
    {
        //some logic...
        lock(queries)
        {
            //some more logic
        }
    }
}

public class SomeOtherClass
{
    private SomeServer myServer=new SomeServer();

    public void SomeMethod()
    {
        lock(myServer.Queries)
        {
            //some logic
        }

        //or worse...
        Monitor.Enter(myServer.Queries)
        //and the Monitor.Exit is in another method that might not get called
    }
}

If you use a separate lock object that you know is private and will always be private then you don’t have to worry about this.

Having written this pattern many, many times in many different languages I’m not likely to fall into either trap. That’s not all that being a good developer is about though.

HwacheonCentreLathe 460x1000

Now, this might seem like a strange tangent but bear with me. I learnt to use an industrial [machine] lathe when I was a kid. They teacher drummed 2 things into us.

  1. Do not wear any loose clothing (e.g. a tie)
  2. Do not leave the chuck key in when starting the lathe

The reason these 2 things in particular were so important was because the lathe I learnt to use had no guard. Either of those 2 mistakes could be fatal.

I’m glad I learnt that, but given the choice would I use the lathe with a guard or the one without? It’s a no-brainer.

We have the same situation here. Unless we’re writing something very specific where memory is absolutely critical, there’s no harm in creating an extra lock object. It provides a useful safeguard against a couple of gotchas that could cause real headaches in production.

Software development purists will be wringing their hands, but they’re not what commercial software development is about. It’s about writing code that does the job in a simple, safe and maintainable way. That’s why using a separate lock object is C# best practice and that’s why I fully support it.