Skip to Content | Skip to Navigation | Skip to Search
Very True Things
“He talks to himself sometimes because he’s the only one who understands what he’s saying.”

Archive for the 'My Life' category


I’ve been meaning to learn how to use a JavaScript library for some time. I first learnt JavaScript when it originally appeared in Netscape 2 and wasn’t working with it much in the years when it was knocked into shape by some proper programmers, so a library seemed to be the best short cut to more modern coding styles.

Looking at the various libraries I ranked them in order of attractiveness as jQuery > YUI > Prototype > Dojo. This was based on a first glance at file size, amount of documentation and supported features. That was over a year ago.

With jQuery in the lead it would be surprising of John Resig’s talk at @media would do much to change it my mind. But I decided to put his advice into practice and download a library and try it out. Twenty minutes after downloading jQuery I was starting to update a copy of the code used on VisitLondon.com

From this (not the greatest piece of JavaScript in the world - it was written by multiple authors in a bit of a rush - but not the worst either):

function topmenuClear() {
 var navRoot = document.getElementById("topmenu");
 for (var i=0; i<navRoot.childNodes.length; i++) {
  var node = navRoot.childNodes[i];
   if (node.nodeName=="LI") {
    node.className=node.className.replace("over", "");
    node.childNodes[0].className="";
   }
 }
}
function topmenuHover() {
 if(document.getElementById("topmenu")) {
  var navRoot = document.getElementById("topmenu");
  for (var i=0; i<navRoot.childNodes.length; i++) {
   var node = navRoot.childNodes[i];
   if (node.nodeName=="LI") {
    node.onmouseover=function() {
     clearTimeout(navTimer); topmenuClear();
     this.className+=" over";
     this.childNodes[0].className="over";
    };
    node.onmouseout=function() {
     navTimer = setTimeout(topmenuClear,2000);
    };
   }
  }
 }
}
function showlang() {
 if(document.getElementById('lang-list').style.display == "none") {
  document.getElementById('lang-list').style.display = "block";
 } else if (document.getElementById('lang-list').style.display == "block") {
  document.getElementById('lang-list').style.display = "none";
 }
}

To this:

function topmenuClear() {
 $("#topmenu > li").removeClass("over");
 $("#topmenu > li > *").removeClass("over");
}
function topmenuHover() {
 $("#topmenu > li").mouseover(function(){
  clearTimeout(navTimer); topmenuClear();
  $(this).addClass("over");
  $(this).find(":first").addClass("over");
 });
 $("#topmenu > li").mouseout(function(){
  navTimer = setTimeout(topmenuClear,2000);
 });
}
function showlang() {
 $("#lang-list").toggle();
}

Okay, so that’s probably the easiest part of our code to modify as it’s doing a very basic task - toggling visibility and adding event handlers - but it makes a dramatic difference to the complexity of the code. I’ve still got a lot of work and testing to do but I’d like to reach the point where the only JavaScript coding I have to do is implementing our functionality rather than reimplementing common functions.

Very True Mood:(chipper) chipper

@media 2008

Better late than never, what did I make of @media last week?

  • Number of talks that included LOL Cats: 1½
  • Number of talks that included Rick Rolling: 2
  • Number of talks that included comedy graphs: 2
  • Number of talks that included mention of Twitter being down all the time: I lost count, but at least 4

There are a few technical subjects (HTML 5, WAI ARIA, jQuery) that I hope to post more about later so here are a few impressions of each session:

Jeffrey Veen included some of my favourite charts in his talk (I have favourite charts/graphs/maps - what do you mean that you don’t?). Indi Young made me think that every single project I’d ever worked on had been poorly planned. Drew McLellan says “everyone hates their CMS” and he’s right. According to Stuart Langridge the fact that we use 410 responses on VisitLondon.com puts us in a very elite group. Nate Koechley explained why what I do is really very important. Richard Ishida baffled the audience with Unicode.

Good fun all round, roll on 2009.


1 Star Wars collectible miniature from eBay, @ £3.65

10 28mm WotC Star Wars metal miniatures, plus 13 25mm WEG Stars Wars metal miniatures from eBay, @ £21.40

1 issue of Miniature Wargames, @ £3.70

1 booster of Star Wars Legacy of the Force collectible miniatures, @ £8.99

Total: £37.74.

Oh, and there was Salute as well but that comes out of a different fund.


The Campanile in the Piazza San Marco

Venice was simply amazing. Lovely weather, great food (especially the seafood), amazing sights.

We stayed at the Hotel Rivamare on the Lido, which meant we took a boat across the lagoon into Venice proper everyday. In the city itself we saw all the big names: the Palazzo Ducale or Doge’s Palace, the Basilica di San Marco, the Piazza, the Bridge of Sighs, Rialto Bridge, the Grand Canal.

Things that appealed more directly to me included the Museum of Natural History was only partially open but we did get to see the excellent Ouranosaurus and Sarchosuchus; The Museo Storico Navale or Naval History Museum which only costs €1.55 and is packed full of relics from Venice’s and Italy’s seafaring history; The Rome and the Barbarians exhibition in the Palazzo Grassi was a ten times more expensive (and I really wanted the exhibition book but at €48 it was too much) but much more extensive than I’d expect for a temporary exhibit.

We also visited some of the other lagoon islands: Murano for the glassmaking; Burano for the lace making and painted houses; and Torcello for the eleventh century cathedral.

For one day we got the train to Verona, passing castles and vineyards on the way. There we visited the Arena and the Castle and had another fantastic lunch. One day wasn’t enough and we plan to go back sometime.

Venice photos and Verona photos.

Very True Mood:(cheerful) cheerful

You can probably guess where we went.

Knackered now.

Very True Mood:(tired) tired

1 pack of Doctor Who micro-universe figures from Woolies, @ £9.99.

1 pack of Doctor Who micro-universe figures and 1 starship pack from the Doctor Who Exhibition, £18.98 total.

1 pack of Copplestone Castings Cavemen and 1 Walrus, @ £10.00

2 issues of Miniature Wargames, 1 @ £3.50 and 1 @ £3.70

Total: £46.17

Total for the quarter: £31.02 + £22.25 + £46.17 = £99.44 (Bang on budget - £100)


2 Star Wars collectible miniature from eBay, @ £9.35.

2 OOP Phoenix Command supplements from eBay, @ £8.90.

1 Copy of Wargames Illustrated, @ £4.00

Total: £22.25.


Today [info]pink_weasel has been visiting her brother in his new flat. As said flat is in Bracknell, I declined. ;-)

Though mostly I was just too knackered from a frustrating week at work and a lack of sleep. So I stayed at home and cleared out a cupboard, played some computer games (the final cut scene in Unreal Tournament 3 reminds me of the end of Blake’s 7) and chilled out.

The farmers’ market in West Norwood seems to be struggling. Only six stalls this week - two meat, one veg, one bread, two pointless.

My computer runs a lot better with the case open. This probably isn’t a good sign. Still, soon I’ll have a Wii to play with so the damn PC will be relegated to email checking only.

A puzzle: I got a £50 cheque from YouGov. I thought I only had half that amount on my account there and as I haven’t been able to log in for a few months (I’ve requested password resets but the email never arrives) I really don’t know what’s going on.

Hmph.

Very True Mood:(melancholy) melancholy
Very True Music:Let's Talk About Girls - The Undertones

Visit London employs just under 100 people. So what are the odds that it employs someone who overlapped with me at Balliol and is just about to employ someone who was in the year above me at Reigate Grammar (and also employs someone who happens to be my wife)?

Very True Mood:(confused) confused

Lettice and I went down to Brighton yesterday to enjoy a bit of sunshine and sea air. That all went according to plan - some photos are on Flickr. Also, a fabulous lunch at AlFresco and a very good haul from the second hand bookshops and comic shops (including the The League of Extraordinary Gentlemen: The Black Dossier). Can all weekends be like this, please?

Very True Mood:(content) content