Aunty Beeb & odd dates
Thursday 19th February 2009 at 17:23
Almost exactly 51 weeks ago I was listening to BBC Radio 2 while going about my day. Nothing out of the ordinary there but apparently all manner of chaos was happening at BBC Radio's interactive department.
For those not familiar with daytime Radio 2, much is made of crowd-sourced content. That is the presenters actively encourage the listening public to call, text and email on a variety of topics. Of particular note here is traffic reports where UK road-users are asked to let them know of any problems so they can be relayed to the listening audience.
On that fateful day however only email and the phones were working. Why was this? Had the SMS relaying systems failed? Had the cellphone companies screwed something up? Were there unavoidable repairs or upgrades happening? Did someone forget to pay a bill? No. It was simply the fact that the days date was the 29th of February.
The software systems handling the text-messages, presumably responsible for routing them to the right studios just couldn't handle the unusual date.
I don't want to pick on The Beeb but this is a primary example of where proper system design would have prevented such problems.
Date and time arithmetic is tricky stuff primarily because it's all in such disparate bases. 60 minutes to the hour, 24 hours to the day, 7 days to the week. And even though we can be sure of 12 months, the number of days in those months is different for each month and in the case of February changes depending on the year!
When designing a system to handle dates it's an understandable decision to store the dates in some human-readable form such as 'Tuesday 17th February 2009'. While this is easy for us to read and understand, writing a program to understand it is a real nightmare.
Some clever folks strictly stick to numbers so it's easy for a system to make comparisons. The same date above could be expressed as 17022009, with tomorrow as 18022009. This appears to work fine as the second number is greater than the first, therefore it must be a later date. But what happens if have 21022008? This is a date from nearly a year ago, yet our simple comparison system would deem it to be in the future as it's the bigger number.
Even cleverer folks flip things around a bit and concatenate the numbers according to specificity. For example the same date above could be expressed as 20090217. Last years date would be 20080221. Perfect! Or is it? When we try any form of arithmetic on this date the system falls back on it's own native binary and transforms things in to decimal for us mere humans to understand. As people we understand that a month from today is 17th of March. But add 28 days (the total number of days in February) to 20090217 and we get 20090245, or the 45th of February.
So how do we, and how could the BBC, solve this situation? We give the system a set of rules to describe dates. We define how many months there are in a year, what they are called, how many days in each month. We describe the phenomena of a leap year being every four years. But how could the system know whether this year is a leap year? Whether tomorrow is a Monday or a Wednesday? What time of the day it is?
We do it by falling back on the simplest building block of our time and date system, the second. By thinking of an hour as 3600 we can easily perform arithmetic. We can count weeks between two dates by subtracting the earliest date (expressed in seconds) from the latest date (again expressed in seconds) and dividing the result by 604800.
This solves our arithmetic problems. The system can now apply the rules we have given it by doing all the calculations in decimal seconds then working with rules to tell us the date in a way we understand. The final problem is that this only gives us abstract time blocks. 'Thursday' means nothing without a year, a month, and a day.
For this we turn to the epoch. We set a date and work from there. In Unix for example this epoch started on January 1st 1970. So 1 second past midnight on that date is simply 1. 1am is simply 3600. By using this we can convert any date to arithmetic-friendly seconds by simply dividing the time that has elapsed since the start of our epoch by years, months, days and so on. Adding an extra 86400 seconds (one day) for each leap year that has occurred since.
I know I've made this all sound so simple and the reality of writing a program to do all this converting would be far more complicated but almost all modern languages include functions to do this stuff for us. PHP for example has mktime() and date(). Python has 'time' included in its standard library.
The point is that in order to future proof our software we as developers must think in terms of simplifying data thus making it more adaptable and not just throwing plain text in a database. If only the BBC had been thinking in terms of useful data and the simple logic when building their systems they would have had no trouble.
Shame on you Facebook
Tuesday 17th February 2009 at 12:26
It would seem the almighty Facebook has decided to change its terms of service to give themselves full, perpetual rights to anything uploaded by its users. That means that Facebook has the right to use any photo I upload in any way they like forever. They could even sell my photography and wouldn't have to pay me anything, or even credit me.
They change their TOS on Feb 4th without notice. The TOS also states that by continuing to use Facebook the user is agreeing to the change. So simply by logging in after Feb 4th the new terms are invoked.
An absolute disgrace.
See more at The Cosumerist
But first, some reminiscing
Thursday 12th February 2009 at 20:53
I was first exposed to the internet in 1993 when an uncle sent me a 2,400bps (that's Bps, no K) modem. I connected using Compuserve software on a 386SX machine with Windows For Workgroups 3.11. The browser was Mosaic (this is pre-Netscape and IE). Every web page was made up of black writing on a grey background.
It took fifteen minutes to display a large photo so I would set the browser to ignore all pictures, I would then have to try and figure out which pictures I wanted to see, right-click them and ask the browser to download the image. I would then sit back and watch as the picture came in line by line. I used SMTP, NNTP, Gopher and of course was paying by the minute for the phone call.
But my word it was exciting! I would get through those 'First 20 hours free' CDs from AOL/Compuserve in a weekend. Signing up Friday night and cancelling after 20 hours use on the Sunday. I worked the system, and in those days nobody noticed. I'd fire up the AOL/Compuserve software, minimise after checking my empty email box and sticking with the buggy, early browsers. I didn't even jump ship to IE until version 3.
This access to the rest of the world was an incredible experience. I dabbled with IRC, used the earliest versions of Yahoo, listened to radio stations using RealMedia. This was all long before Google, before Flash, before MP3s. I even remember using Google before it had it's own domain name and piggybacked off Stanford's domain.
By the early 2000s broadband was slowly rolling out across the UK and I was still lumbered with a 56.6k connection. Tweaking my TTL and MTU to try and squeeze more out of my connection. In just seven years I'd seen the internet improve so much both in terms of what it could do and the content it provided. Yet I had reached a point where something I was happy to wait fifteen minutes for when time was a premium had become a frustrating experience waiting thirty seconds for in a time when I paid a flat rate for 24/7 access.
These days I have an 8 MBit, wireless connection that I can use anywhere in my home whenever I like for as long as I like. I can even access it on my cellphone. But I've become complacent. I take the internet for granted. I get frustrated when servers go down, or email isn't answered in a prompt manner. Each day I log on to the same few sites and rely on places like digg and reddit to let me know about good stuff on the internet. There's just too much junk to make 'surfing' from site to site an enjoyable experience.
In short, the joy and surprised to be found in stumbling across great content has been replaced by the frustration of not finding the content I now assume to be there.
Given the choice I would go back to 1993 without a second thought. I relied on one site linking to another to find new things. I would make notes, write down URIs in full in a small notebook. The fact is the internet just isn't as fun any more. Back then there were no adverts, no domain-squatters and very little spam. Most websites were run by amateurs and enthusiasts who maintained content by editing HTML by hand. There was no RSS to pull in content for elsewhere. No blogs, so we didn't have wade through opinion to get to the information we were after.
I miss the old, slow, black-on-grey, amateurish internet of searching libraries on Gopher and using public FTP servers to download shareware.
But all is not lost. In an effort to relive those days I'm going to stay up late, very late. Be as quiet as possible, as in those days I was petrified of waking my parents. This means no music, no tv, nothing. I will fire up an old browser and disappear in to The Internet Archive.
Obligatory first post
Wednesday 11th February 2009 at 18:16
Hardly a first post ever though. I've had blogs before. Even tumblogs, before the likes of tumblr even existed. Over the last eighteen months I've been making note of subjects for blog posts and articles whenever they strike me. The list has grown and on recent review found that some of the topics were already out of date.
So I stopped promising myself that I would launch a website and went ahead and did it. The result is what you see before you.
Rather than attempt to cover everything in my life, as some people I know try to do online, I will tend only to cover the two subjects that affect my day-to-day life - technology (mainly software) and photography. I plan to produce one solid post at least once a week on a given subject (pulled from my already extensive 'to-blog' list).
Between these longer posts I will post as the muse strikes, though I expect these will usually take the form of a link to a video or picture.

