All posts by Alistair Lattimore

About Alistair Lattimore

My name is Alistair Lattimore, I'm in my very early 30's and live on the sunny Gold Coast in Australia. I married my high school sweet heart & we've been together for longer than I can remember. Claire and I started our family in September 2008 when Hugo was born and added a gorgeous little girl named Evie in May 2010. You can find me online in the typical hangouts, Google+, Twitter & facebook. .

Slashdot CSS Makeover

Slashdot, one of the most widely known technology sites around the world has finally had a CSS makeover. The idea of retooling Slashdot was bantered around back in 2003, however the likelihood of anything happening seemed slim. At the time, there didn’t seem to be any serious enthusiasm to rebuild the backend, slashcode – with the general sentiment being “if you feel like hacking up slashcode, then we’d consider using it”. Slashdot has been running on a similar HTML 3.2 base for some eight years, simply because “it worked” and that was really good enough at the time.

It wasn’t long after the idea was mentioned before someone took it upon themselves to start the ball rolling. One of the first largely publicised steps was done by Daniel M. Frommelt, whose two articles published on A List Apart, Retooling Slashdot with Web Standards and Retooling Slashdot with Web Standards Part II garnered a lot of support. These two articles demonstrated how a huge site like Slashdot can be broken down and reworked into valid, semantic HTML.

The end product for Slashdot is a mostly validate HTML 4.01 document – which is a huge step forward. It would have been awesome if the xHTML utopia was realistic, however as with many sites, the advertisements and user contributed content prohibit it. The single largest point of interest about the retooling is the paradigm shift in authoring the HTML. The existing site was built using tables for structure and inline font tags for styling. This has now been replaced with divs for layout/structure, semantic markup and CSS for the presentation.

Since there has now been serious work done on Slashcode, we might see more frequent updates and features added to it.

Deja Vu

Amy & Andrew Horneman, The Ironbar, Port DouglasClaire and I have just returned after heading into Port Douglas for dinner. On the way back, we decided to stop by a cocktail bar, have a drink and listen to a guy on the piano. Not long after we got there, another young couple walked in and took a seat. When I looked at the woman, I thought I knew her, I just couldn’t work out where. It was her hair that twigged my memory, it was slightly curly and a little bit whispy.

I went to get another drink and noticed that a guy had left his camera at the bar, so I handed it in. Someone checked one of the photos on the camera and returned it to the young couple, at which point I made a joke about keeping it – but didn’t because I already had one. These few words were all it took and the female (Amy), asked what our names were and we were off and running. Claire had gone to uni and done German with her four or five years ago, what a small world.

After getting talking, Amy is now living in Canberra. We then find out that they (Amy and Andrew) are staying at the Radisson as well, what was the chance. We then find out that they are on their honeymoon too. What else could fall in line, they were married on the same day as Claire and I, the 24th September. Ohh, did I mention that they were engaged on the 11th, I proposed to Claire the very following day.

It was all fantastic chance that we ran into one another, I love it when that happens. We chatted for a few hours and have just called it a night. We’ve organised to go out for dinner tomorrow night and Port Douglas again.

Darlington Park Go Karts

Darlington Park Go Karting Race Track, Gold CoastOn the weekend of the 17th September, we upheld the long standing tradition of a Bucks Party for the Groom. We decided to break the day into four main parts:

  1. Go Karting
  2. Lunch
  3. Race Simulation
  4. Drinking

We turned up to Darlington Park Raceway at about 8.30 in the morning for a package event. It included a warm up, qualifying, three races and a final. The circuit was fantastic, sitting just down from the crest of the hill. It was fast, without being too straight and very interesting to drive with all of the up and down sections; one of the most entertaining and fun circuits I’ve ever raced on in a go-kart.

I didn’t place at all, though I had a blast. The standout driver across the races was without a doubt, Danny. He was consistently faster than everyone else on the circuit, at times up to 2 seconds per lap – with times in the 62 second area.

There were plenty of thrills, I know I went in too deep into a corner and broadslided into my older brother Andrew. Meanwhile, Brendan had some sort of a break failure (which we all thought was worth a good laugh afterwards), in the fastest section of the track. Fortunately, or unfortunate, depending on how you look at it – there were no spills.

All and all, it was an excellent morning of racing and I think everyone had a great time.

Pure Blonde

Pure Blonde Beer, a product by Cartlon Development Group - a division of Carlton & United Beverages.After dining on a fine Thai Massaman Beef with Wayne for dinner tonight, he picked up a new beer, the Pure Blonde by Cartlon United. Carlton describe it as a lighter, crisper, aromatic lager that delivers superior taste; which has been specially brewed longer to produce a beer that is lower in carbohydrates.

I thought it was quite funny that they are advertising it as a low carbohydrate beer. That in itself, is really quite a good thing since beer is associated to beer bellies, which aren’t a pretty sight with a shirt off. What really made me chuckle was when Wayne referred to them as “a geek beer”. I instantly had mental images of a huge, overweight man, sitting on an office chair with his gut hanging out sucking back the cold ones.

JavaScript ParseInt Cast Error

It would appear there is some sort of an auto-casting problem in JavaScript. I have an external JavaScript file included into a page which defines a set of arrays, a line from the file looks like this:

  1. var resortPAArray = new Array('("1 Bed","1 Bedroom","2","3")','("2 Bed","2 Bedroom","3","5")','("Penthouse","Penthouse","4","10")');

The two numbers in each inner array represent the minimum and maximum people allowed to stay in that room type, for instance a 2 Bed bedroom can sleep a minimum of three and a maximum of five. There is a line in the JavaScript file for each building and they are used to auto-populate a booking form (to save posting back to the server on every change). The scripts were executing without error, until we added a room type which allowed ten (10) or more people in it.

When you select the building, it uses the inner arrays to populate a dropdown box with the room types (1 Bedroom, 2 Bedroom, ..). Once you select the room type, it then populates the next dropdown with the corresponding min/max people for that room type. Out of interest, the min/max values are assigned as follows where tmpArray represents an inner array:

  1. minpax=tmpArray[2];
  2. maxpax=tmpArray[3];

From here, those values are used in a for loop as follows:

  1. for (var i=minpax; i<=maxpax; i++) {
  2. // code here
  3. }

Remember, at this point the script is executing without any problems. When the values are assigned to the minpax and maxpax variables, they are technically strings – since they are defined in the inner arrays with quotes around them. Conveniently, JavaScript auto-casts values for you – as such the strings are cast to a numeric internally and the mathematic comparison is done.

Unfortunately, when a string value of 10 was assigned to maxpax, the for loop never executed and the as such, you couldn’t select how many people you wanted in that room. Initially, it made no sense at all. The JavaScript file for this building was structurally sound, no missing quotes, brackets or commas. All the values were in place, no strange characters at all – it was, for all intensive purposes, just like all the others.

The solution was quite simple, explicitly cast the values for minpax/maxpax when they are initially assigned or during the for loop.

  1. for (var i=parseInt(minpax); i<=parseInt(maxpax); i++) {
  2. // code here
  3. }