Monthly Archive for: ‘May, 2007’
Hebrides Bound – But Can I Still Rough It?!
This weekend I’m taking a couple of much-deserved days off work and heading to Mull with the intention of plodding up Ben More with my good friend Paulo and several of his other mates. This is, you see, Paulo’s Last Munro – despite having been technically domiciled in Algeria for the past few tax years, he has somehow managed to find the time and inclination to add his name to the list of three-thousand-odd deranged individuals who have clambered up every one of these infamous summits.
Assuming I make it, this will be the first Munro that I’ve bagged for over three years, the last being a rather damp ascension of Maol Chean Dearg on 4th April 2004. As I’ve lamented in the past, my bagging trips were not always so intermittent – in the years immediately following university, flush with cash and yet still free of responsibility, most holidays would be spent ensconced in some rented cottage in Scotland with a large group of friends. By day we would drag ourselves up Munros, and by night we would play boardgames (such as the ever-popular Risk), or frequent local hostelries. Good times indeed. Steadily though, my friends and I have settled down, started families, taken on more demanding jobs and large mortgages, and drifted ever further apart, geographically.
This is actually going to be the second Munro Compleation that I’ve had the pleasure of attending – eight years ago our mutual friend Bruce finished them off in Glencoe, and you can see some scanned photographs of that most debaucherous of weekends here.
So, it’s been too long, and I’m greatly looking forward to heading into the hills, but a few things are niggling me, most notably:
Can I Still Make It Up? I was never the fastest of munro-baggers – even back in 1998, at a sprightly 22 years of age, my friend Rich commented that “Nel has invented a pace between stop and walk“. Nine years on, filled with lots of fine cooking from my American wife, and the prospect of dragging myself up to the dizzy heights of 966m above sea level seems increasingly remote. Memo to self – take pain killers. And oxygen…
Can I Still Rough It? I used to think nothing of spending several days on end living in tents, bothies, bunkhouses, or indeed just bivvying if necessary. But now I think I’ve spent one too many nights in top hotels in the likes of London and Vegas, and grown a little too fond of my home comforts. Perhaps this is another reason why trips north of the border have become infrequent in recent years?
Can I Still Drink Heavily? A long day on the hill was invariably followed by a long night in the pub (I have happy memories of a large group of us trying to drink the Aultguish Inn dry of An Teallach ale – we failed, but gave it a damn good shot!). Admittedly I’m quite looking forward to determining whether I’ve still got what it takes in this respect!
But apart from these few niggles, I’m really looking forward to my weekend. Armed with my Canon EOS400D (something I certainly never had back in those post-uni years) I’m hoping to capture some suitable images of the events on Mull to share with you when I get back…
Immigration Fees – the Home Office Respond
Earlier this month I grumbled about the recent 134% increase in the cost of applying for a UK settlement visa. Well, I’m pleased to report that my MP has now forwarded a response from Joan Ryan MP, an Under-Secretary of State at the Home Office, which reads as follows:
"I understand Mr Nelson’s concerns about the impact of changes to our fees. Clearly, it is not in the interests of the country to make changes that will undo the many positive benefits that migration brings to the UK. But we are building confidence in our immigration system, and a key part of delivering this – as set out in the recently published enforcement strategy – is new resources to fund improvements in both the controls and the services we offer.
The Government made every effort to give the public as much time as possible to know what the proposed fees would be from 2 April and 7 March was the earliest time that we could publish the proposed charges. We have ensured that this information has been made available as widely as possible.
The Government’s response to the public consultation on the charging proposals that ran at the end of last year was published on 7 March. In this we set out options for introducing a flexible charging model to allow us to set fees at levels that are both fair and deliver the additional resource that is crucial to step change in enforcement that we have promised. Over 3000 documents were sent out; over 400 people participated in 13 stakeholder events; and we received 340 formal responses. 87% agreed we should set fees flexibly to take into account wider policy objectives and 79% agreed new fees should reflect a range of factors, not only those of value to the migrant.
From April we increased the fee for settlement from £335 to £750 for postal applications. We did this to bring us more into line with similar fees charged in other countries (we are considerably less costly than many) and in order to reflect the administrative costs of determining settlement and ensuring compliance with our immigration laws. Settlement brings with it the right to access the labour market and the majority of the benefit system for the applicant and their dependents. We also hope and expect it is an act that cements the relationship between the individual and this country, both of whom benefit by managed migration.
The Government has already committed to keep the fees we charge under regular review and continue to appraise performance in all areas of the business in detail. The new fees will enable the Border and Immigration Agency to continue improving service as well as paying for robust immigration control.
I hope this information has been helpful."
Whilst I still think that the recent hike in fees was extortionate, and too little notice was given of these increases, I am obviously biased as it is my credit card which has been bruised, and I must admit that the letter above makes some reasonable points.
Mostly, I’m just pleased to have been able to make my voice heard in some small way, and received a well-written personal response from those responsible for the decision – to that end, the process seems to work. In these modern times, it’s very easy to sign electronic e-Petitions, phone radio talk shows, email the newspapers or, yes, write an angry blog post on a subject, but for all their ease and speed, those methods of spleen-venting can be ultimately unfulfilling. Sometimes the most effective course of action remains to simply put your grievances down as ink on paper and drop them in a postbox.
Now, fingers crossed that the visa application (mailed earlier this week) goes through without a hitch…
Microsoft Surface
Wooah, every day we get a little closer to the world of Star Trek
http://www.microsoft.com/surface/
Needless to say, I want one… ![]()
A C# Postcode Struct with Parser
As discussed recently, I’ve been trying to knock together a class struct to represent a UK postcode, provide a means of parsing a string as potentially being a valid postcode (or optionally just an outer code), and split that postcode into “outer” and “inner” code. The result of my efforts is shown below
I say potentially because, as you’ll know if you’ve looked into this topic at all, it’s impossible to validate whether a string truly does represent a postcode without querying the (copyrighted and expensive-to-license) Postcode Address File. As a result, my solution is not very stringent – it is possible to persuade it to successfully parse an invalid postcode, but hopefully there should be no occasions when a valid postcode is rejected.
The code validates strings by checking for compliance with the standards defined in BS7666, followed by checking for BFPO postcodes, and finally for a handful of notable exceptions (e.g. Girobank). If you know of any valid postcodes that are rejected by this routine, do let me know.
Oh, and incidentally, this was the first time I’ve used Visual Studio Orcas in anger to develop anything meatier than a Hello World. Although I wasn’t exactly pushing the technological envelope, I found the IDE to be pretty fast and stable, considering it’s a beta 1.
Source available on GitHub at https://github.com/ianfnelson/Postcode
using System;
using System.Text.RegularExpressions;
namespace IanFNelson.Utilities
{
/// <summary>
/// Represents a United Kingdom postcode.
/// </summary>
///
/// For more details, see http://ianfnelson.com/archives/2007/05/29/postcodestruct
///
[Serializable]
public struct Postcode
{
private static string regexBS7666Outer =
"(?[A-PR-UWYZ]" +
"([0-9]{1,2}|([A-HK-Y]
[0-9]|[A-HK-Y]
[0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9]
[A-HJKS-UW]))";
private static string regexBS7666Inner = "(?[0-9]
[ABD-HJLNP-UW-Z]{2})";
private static readonly string regexBS7666Full = regexBS7666Outer + regexBS7666Inner;
private static readonly string regexBS7666OuterStandAlone = string.Concat(regexBS7666Outer + "\\s*$");
private static string regexBfpoOuter = "(?BFPO)";
private static string regexBfpoInner = "(?[0-9]{1,3})";
private static readonly string regexBfpoFull = regexBfpoOuter + regexBfpoInner;
private static readonly string regexBfpoOuterStandalone = string.Concat(regexBfpoOuter + "\\s*$");
private static readonly string[,] exceptionsToTheRule =
{
{"GIR", "0AA"}, // Girobank
{"SAN", "TA1"}, // Santa Claus
{"ASCN", "1ZZ"}, // Ascension Island
{"BIQQ", "1ZZ"}, // British Antarctic Territory
{"BBND", "1ZZ"}, // British Indian Ocean Territory
{"FIQQ", "1ZZ"}, // Falkland Islands
{"PCRN", "1ZZ"}, // Pitcairn Islands
{"STHL", "1ZZ"}, // Saint Helena
{"SIQQ", "1ZZ"}, // South Georgia and the Sandwich Islands
{"TDCU", "1ZZ"}, // Tristan da Cunha
{"TKCA", "1ZZ"} // Turks and Caicos Islands
};
private string _inCode;
private string _outCode;
/// <summary>
/// Outer portion of the Postcode
/// </summary>
public string OutCode
{
get { return _outCode; }
private set { _outCode = value; }
}
/// <summary>
/// Inner portion of the Postcode
/// </summary>
public string InCode
{
get { return _inCode; }
private set { _inCode = value; }
}
/// <summary>
/// Parses a string as a Postcode.
/// </summary>
///String to be parsed
/// Postcode object
///
/// If the passed string cannot be parsed as a UK postcode
///
/// Using this overload, the inner code is not mandatory.
public static Postcode Parse(string s)
{
return Parse(s, false);
}
/// <summary>
/// Parses a string as a Postcode.
/// </summary>
///String to be parsed
///
/// Indicates that the string passed must include a valid inner code.
///
/// Postcode object
///
/// If the passed string cannot be parsed as a UK postcode
///
public static Postcode Parse(string s, bool incodeMandatory)
{
var p = new Postcode();
if (TryParse(s, out p, incodeMandatory))
return p;
throw new FormatException();
}
/// <summary>
/// Attempts to parse a string as a Postcode.
/// </summary>
///String to be parsed
///Postcode object
///
/// Boolean indicating whether the string was successfully parsed as a UK Postcode
///
/// Using this overload, the inner code is not mandatory.
public static bool TryParse(string s, out Postcode result)
{
return TryParse(s, out result, false);
}
/// <summary>
/// Attempts to parse a string as a Postcode.
/// </summary>
///String to be parsed
///Postcode object
///
/// Indicates that the string passed must include a valid inner code.
///
///
/// Boolean indicating whether the string was successfully parsed as a UK Postcode
///
public static bool TryParse(string s, out Postcode result, bool incodeMandatory)
{
// Set output to new Postcode
result = new Postcode();
// Copy the input before messing with it
var input = s;
// Guard clause - check for null or empty string
if (string.IsNullOrEmpty(input)) return false;
// uppercase input and strip undesirable characters
input = Regex.Replace(input.ToUpperInvariant(), "[^A-Z0-9]", string.Empty);
// guard clause - input is more than seven characters
if (input.Length > 7) return false;
#region BS7666 Matching
// Try to match full standard postcode
var fullMatch = Regex.Match(input, regexBS7666Full);
if (fullMatch.Success)
{
result.OutCode = fullMatch.Groups["outCode"].Value;
result.InCode = fullMatch.Groups["inCode"].Value;
return true;
}
// Try to match outer standard postcode only
var outerMatch = Regex.Match(input, regexBS7666OuterStandAlone);
if (outerMatch.Success)
{
if (incodeMandatory) return false;
result.OutCode = outerMatch.Groups["outCode"].Value;
return true;
}
#endregion
#region BFPO Matching
// Try to match full BFPO postcode
var bfpoFullMatch = Regex.Match(input, regexBfpoFull);
if (bfpoFullMatch.Success)
{
result.OutCode = bfpoFullMatch.Groups["outCode"].Value;
result.InCode = bfpoFullMatch.Groups["inCode"].Value;
return true;
}
// Try to match outer BFPO postcode
var bfpoOuterMatch = Regex.Match(input, regexBfpoOuterStandalone);
if (bfpoOuterMatch.Success)
{
if (incodeMandatory) return false;
result.OutCode = bfpoOuterMatch.Groups["outCode"].Value;
return true;
}
#endregion
#region Exceptions to the rule matching
// Loop through exceptions to the rule
for (var i = 0; i < exceptionsToTheRule.GetLength(0); i++)
{
// Check for a full match
if (input == string.Concat(exceptionsToTheRule[i, 0], exceptionsToTheRule[i, 1]))
{
result.OutCode = exceptionsToTheRule[i, 0];
result.InCode = exceptionsToTheRule[i, 1];
return true;
}
// Check for partial match only
if (input == exceptionsToTheRule[i, 0])
{
if (incodeMandatory) return false;
result.OutCode = exceptionsToTheRule[i, 0];
return true;
}
}
#endregion
return false;
}
/// <summary>
/// Returns a string representation of this postcode
/// </summary>
///
public override string ToString()
{
if (string.IsNullOrEmpty(InCode))
{
return OutCode;
}
else
{
return string.Concat(OutCode, " ", InCode);
}
}
}
}
Postcode Validation
Wikipedia cracks me up sometimes. I’m sat here at my desk, trying to knock together some C# code to quickly validate an entered string as being a UK postcode. Naturally I turned to this Wikipedia article for assistance, where I find this quip:
"Automatic validation of postcodes on the basis of pattern feasibility is therefore almost impossible to design, and the system contains no self-validating feature such as a check digit. Completely accurate validation is only possible by attempting to deliver mail to the address, and verifying with the recipient."
I think that’s what is known as a long-running transaction!!
Update – the C# code that I wrote to handle this issue is available here.
Pargetter
From today’s Times:
“The family comes and go, the boys attend school,
though Gary, a self-employed pargetter, is not working.”
What on earth is a pargetter? I’m struggling to find a definition on the web. Is this a typo, and if so, for what?!
http://www.timesonline.co.uk/tol/life_and_style/health/features/article1812669.ece
Updated 2007-10-07 – We have an answer!
SQL 2005 Unleashed
Many moons (and about four jobs) ago, a wise DBA by the name of David Hanson once recommended to me a book called Microsoft SQL Server 2000 Unleashed. I took his advice, bought a copy, and it rapidly became one of the most dog-eared and oft-thumbed computing books I have ever owned. It is comprehensive, deep, broad, well-written and covers everything one might ever wish to know about SQL Server 2000. With its help and guidance I came to love and respect Microsoft’s premier database product, passing the 70-229 exam by a comfortable margin.
So, following the release of SQL Server 2005, I was hoping that SAMS would publish a similar tome about that new platform. Once said book was announced, I pre-ordered* a copy, and I’m delighted to report that after many months of patient waiting, the sequel (sorry) landed on my desk last week – and for a computing book, it’s simply awesome.
Microsoft SQL Server 2005 Unleashed is even bigger than it’s predecessor. In fact, it’s so large that eight chapters have been left out of the physical book, and are included only in a PDF version supplied on CD-ROM. These aren’t just padding or filler, either – they’re solid chapters on interesting topics as Notification Services, Service Broker, Recovery Planning, and T-SQL Tips n Tricks. Including the bonus chapters, the whole package weighs in at over 2,000 pages – no wonder I had to wait a while for its publication!
I think you would be hard-pressed to find any other single SQL 2005 book which covers quite so much material to such depth. While perhaps not being suitable for beginners, for those with some experience of SQL Server or other relational database products, this book works on many levels – reference, tutorial, guidance, or just as an interesting read. If you work with, or anticipate working with, SQL 2005, then you owe it to yourself to get a copy now!
* I hate this term, but that’s what Amazon call it – “pre-order”. Whilst I understand the implication, I don’t think there’s any real linguistic difference between “ordering” and “pre-ordering”. Even less so the distinction between to “book” and to “pre-book”, a service offered by some cinemas…
The Perfect iTunes Playlist?
Since Barney, my beloved iPod, came into my life twenty months ago, I’ve been trying to concoct the perfect iTunes “smart playlist” to match my default listening preferences, and after much tinkering and experimentation, I think I finally have it.
See, whilst my friend John is happy to listen to the entire contents of his iPod on shuffle mode, that’s just a little bit too random for my liking. Besides, there are now a whopping 12,660 tracks on Barney, so some kind of filtering is necessary in order to avoid listening to the rubbish and focus on the good stuff whilst still raising my awareness of new or long-forgotten tracks. It’s proven to be a difficult balancing act. I also wanted to automate the process as much as possible – previous attempts have relied too much on me keeping a standard playlist of “current faves” or “new stuff” up to date, which was too time-consuming.
So, what I’ve done is identified the “categories” of track I generally want to listen to (of which there are four), created a smart playlist for each, and concatenated these into one über-playlist. Think of it as four SQL queries combined with a UNION!
Category 1 – New Music (to me)
First and foremost, I like listening to the new music that I’ve acquired most recently, so I set up a playlist to filter out all the tracks that have been added to our iTunes library within the last four months, with a few caveats:
- The tracks have to be in my master sync list (this determines which of the 15,023 tracks in our iTunes library are copied onto my iPod, and prevents me from having to listen to any of Jocelyn’s purchases!
) - No tracks which I’ve rated as a mere
or 
. For more information about my track-rating criteria, see this blog post! - No Christmas music. It’s May!
- No Classical or Post Rock – when I’m in the mood for these genres I’ll listen to them, but it just doesn’t work for me to hear a lengthy Beethoven or Godspeed! You Black Emperor track sandwiched between pop songs of a more standard length.
- Nothing that I’ve listened to within the last couple of days. Variety is the spice of life.

Category 2 – Other Recent Music
This playlist is designed to find more music released in recent years which doesn’t get picked up by the first playlist. So, I have set up a playlist to identify those tracks released in 2005, 2006 or 2007. This playlist then pulls out a random sampling (currently 200) of these, as long as they aren’t already in the first playlist, and haven’t been heard within a week:
Category 3 – Stuff I Like
Listening to new music all day long can be exhausting – occasionally I need to hear something familiar, so this playlist draws out a random sample (again, currently 200) of my collection which I’ve rated ![]()
![]()
or higher, and which haven’t already fallen into either of the first two playlists. Again, I apply the usual genre restrictions, and avoid choosing anything which I’ve heard within the last week:
Category 4 – “Never” Heard
Finally, the fourth playlist is designed to expose me to a random sample of 200 tracks which I’ve “never” heard before (as far as iTunes is aware – in reality this might be more likely to contain tracks from old CDs which I’ve not listened to since importing them into iTunes):

That’s it! Once combined together into yet another smart playlist, this is, from my point of view, as close to a perfect playlist as I’ve been able to devise so far. It was this playlist that generated (with the exception of the initial Hanselminutes Podcast) my lengthy listening experiences of 16th April. In fact for the past month I’ve been listening to this more or less exclusively.
Whaddya think John – beats a simple shuffle, surely? ![]()
Mozy.com
It’s seven years since my last major data loss, when my sole hard drive (all 3.2Gb of it) bit the dust, taking almost all my worldly data with it, barring a few vital files that I’d diligently backed up regularly onto 1.44Mb floppy. I know this date for sure as my email archive starts abruptly on 25th February 2000 – all my premillenial ramblings are lost to humanity forever!

Now, these days of course, all our photographs and music collections are stored in digital form, so it’s far more important to keep regular backups (but at around 8Mb per RAW photo and 3Mb per AAC file, the humble floppy has long since become useless for this purpose!). So, I’ve been reviewing my backup strategy recently…
A couple of years ago I made the effort to back up all my files to a dozen or so DVD-Rs for storage “off-site” (i.e. at work). This was a laborious and boring task, and not one I’ve felt like repeating since.
Last year I bought a 320Gb Western Digital MyBook, which is a really nice piece of kit – I’m using the Firewire interface, and particularly appreciate the way it powers down when the PC is turned off. I used SyncToy on a daily basis to back up all my files to this external drive, and this worked pretty well for a while.
Recently, though, this solution started to break down, for three reasons:
- I’ve been buying ever more music, taking ever more photos, and installing ever more MS software (such as the gargantuan Orcas beta 1), causing my primary hard disk to become almost full.
- To improve the performance of my system, I wanted to start using the MyBook to hold all my data files, leaving the primary disk for the OS and programs.
- Although the files were backed up, the backups were in the same physical location as the originals, so offering no protection from thieves or natural disasters.
So, I’ve been searching for a way of automating backup of my files to a remote location, and I’m pleased to report that I found it in the form of Mozy.com – for a meagre $4.95 (£2.50) per month, I can automatically and continuously upload an unlimited amount of files to their servers. It really is pretty slick, the incremental backups are even clever enough to only upload the portion of an Outlook .PST file that has changed.
Thus far I’ve uploaded around 5Gb of data (important files and a chunk of our photos). It’ll take a few days longer for all the photos to complete uploading, then I might set it the not-inconsiderable task of backing up my entire music collection. Well, what are unlimited broadband connections for? ![]()
Restores also appear to be simple – there’s a web interface allowing you to find previous versions of any file, alternatively for an additional fee you can arrange for DVDs of backed-up files to be mailed to you. But the easiest way of restoring a file is through the tight integration with Windows Explorer, where Mozy Remote Backup is shown as just another device on your computer.
I hope that my seven-year run of no data loss continues for many years longer, and I never find myself in need of the backups that I’m now continuously trickling up to Mozy’s servers, but it’s a reassuring safety net to have.
PS – Hey, doesn’t the Mozy logo look uncannily like the Orange logo? Hmmm…
Eurovision 2007
As the excitement mounts, we’ve just voted:
- I voted for Hungary
- Jocelyn voted for Georgia
and we placed some bets with Ladbrokes:
- for the Ukraine to come in the top 5 (decimal odds 1.45)
- for the UK to come 21st-24th (decimal odds 2.00)
- for the UK to get nul points (decimal odds 6.00)
Let the scoring commence!
[23:21] – well, I made a nice profit on two of my bets, and if it wasn’t for our chums in Ireland and Malta voting for the UK, the third one would have come in too! Is it just me, or is the block voting from the Balkans and the Baltics really beginning to make a mockery of the whole thing? It must say something when the two countries with the biggest music industries come bottom of the pack, and the four countries who bankroll the EBU fall within the bottom six. *sigh*








