Archive for the 'Geek' Category

Frustration is…

…spending about an hour trying to figure out a Javascript error that came out of nowhere, only to discover that it was my own debugging code that was causing the issue.

GAAARRGGHH!!

The mess they left behind

Tag Soup

I had a bit of geek pleasure this week. I took an in-house web-application and tidied it’s output up. What was once a pile of tag-soup junk is now clean, accessible, sentatically correct, valid HTML. This was relatively easy, once I’d got my head around the way the app works. It’s quite nice now – but it sits on our intranet, so you’ll never get to see it unless you happen to work in the same place I do.

Then I got cocky. I thought If I can do that for that app, why can’t I do it for this ever so slightly more complex one?

So I started looking at the source files. Holy crap! It looks like the code was written by a gibbon jumping up and down on the keyboard! As soon as I started trying to tidy it up, things got squelchy. Undo, undo undo! Put it back exactly how it was! Phew. Making that one look nice is going to be an interesting experience.

Still, I think it’s worth doing, even if it’s “just” an in-house intranet application. Your in-house customers are just as important as the outside ones. If you don’t keep them happy, the products and services that they produce for outside customers won’t be as good. Keeping the interface and the code clean and accessible means that it’ll be nicer for user’s to interact with. What’s more, it’ll be easier for the next set of programmers and designers to work with next time around.

The IE Factor Strikes Back

Logo blatantly stolen from Dean Edwards

I’m currently working my way through a sample chapter Sitepoint‘s DHTML Utopia book – partly to see if I want to buy the book, and partly because I’m trying to get my head around event listeners. I got some way through the chapter, testing my work in Firefox as I went, and it was all going swimmingly.

What happens in Internet Explorer then?, thinks I. Precisely nowt. It was at this point that my colleagues looked around to see what the swearing was all about. From the book:

Naturally, making events work cross-browser is not as easy as just following the DOM standard. Internet Explorer doesn’t implement the DOM Events model very well. Instead, it offers a proprietary and different way to hook up event listeners and gain access to event data.

What’s the point in having a standard if the most popular sodding browser is going to completely ignore it!?

Luckily, the book explains ways around Internet Explorer’s Javascript deficiencies in a calm and friendly manner (e.g. This is inconvenient but not catastrophic; it just means that you have to take different actions for different browsers.). It’s entirely possible that I’ll buy the book, simply because it’ll help dig me out of some big holes.

WARNING IE USERS! STROBE EFFECTS LIKELY!

So, I decided to try applying the lessons learned to one of my own projects. It was all going fine, up until I went to test it in IE. This time, the scripts were working perfectly. No, IE had to find some other way of buggering it up. Now, every time an event was fired, IE decided to re-load all of the background images in the elements effected. Flickerytastic dude! Does this mean I have to put an epilepsy warning up on the page? I navigate away, click ‘back’ and all is fine again.

A bit of googling, asking around on mailing lists, and tearing out of my fast-greying hair reveals that are two ways of fixing the problem:

  1. Get every single one of your visitors using Internet Explorer, AOL, or indeed anything else that uses the IE engine, to alter their Internet Options: Go to Temporary Internet Files, then Settings, then choose Automatic. Realistically, that’s not going to happen is it?
  2. Get your server to add the Cache-control header to the images on your server. Doing this works differently for different servers: ASP.net Resources has the fix for IIS, Dean Edwards has the fix for Apache. If you’re using something else you’ll have to rely on google.

It’s really frustrating that every time I try to do almost anything on the web, Internet Explorer jumps in front of me and holds up an enourmous stop sign. It’s good in a way, in that it forces me to find an acceptable way around the problem. I just wish finding that answer didn’t usually double the time it takes to complete a project. If IE7 really has improved as much as Microsoft say it has, I can’t wait for it to arrive. It’s just a pity that IE5, 5.5 and 6 will continue to linger for as long as they inevitably will.

There is this theory of the Mobius…

A couple of years back, when working for a small design firm, I put together a little website for a new restaurant in Leicester, called Mobius.

I was quite proud of it at the time, except for the glaring bug. It makes use of the Suckerfish menu system. Due to a (still unfixed) bug in Gecko-based browsers (including Firefox), if the menu intersects with an element which has a style of overflow:auto;, it’ll disappear as soon as you mouse-over that element.

At the time this really annoyed me. I posted on various web-forums asking if anybody had come across the same problem and if so, how they went about fixing it. It soon became clear that it was a bug in the browser, and there wasn’t a lot I could do about it. In the end, I gave up and left it. At the time, Firefox was very much a niche browser, not one who had been downloaded by 80 million users and was coasting comfortably past the 10% market share point. Alas, the site still suffers from the problem, just as it always did.

Out of the blue

Now, I was quite surprised when out of the blue, two years later, someone calling themselves “Event Horizon” emailed me out of the blue with a potential fix for the problem. “Perhaps you could apply this fix on the Mobius site you worked on.” they said. “Not likely” I replied, “I don’t work there anymore, but thanks nonetheless”.

The very next day, I was ever so slightly taken aback once more, when I took a phonecall from Mark Sanders at Chorlton Web & Design. “Two years ago” he said, “you had some problems with overflow in Firefox”. “Indeed I did” said I, “and in a very odd turn of events, I got an email about the fix last night”. “Bloody Hell!” exclaimed he. Very bizarre.

Anyway, I figured that if two people were going to contact me about the problem in the same week, there’s quite a demand for this knowledge. So I thought I’d share the story and the link to the solution. I hope it’s useful to someone.

The iTunes Visualiser

I really like iTunes‘ built in Visualiser. I could watch it all day.

No, seriously, I could. I find it absolutely mesmerising. Back in the days of Winamp I’d seek out loads of different visualisers but this one makes all the pretty patterns that they ever did at the click of a button.

This is a bit sad really isn’t it?

Music on your mobile? Pah!

I was reading Jeff Croft‘s latest post about just how much he thinks mobile companies are going to rip people off to download music over their networks. In the comments, Jared Christiensen asks a perfectly valid question:

Why on earth would anyone want to buy music and listen to it on a cellphone?

Well as of right now, I don’t think you would. But lets look forward a little bit.

There are current generation mobiles that are able to play mp3 (etc) music files, and have 32mb or so of memory on board. Some of these can even extend that with flash memory cards. What’s more, you can get 4gb flash cards these days. It won’t be all that long before they become relatively cheap.

Add those two together and you’ve got a mobile phone with 4gb of storage that’s perfectly capable of playing music. Do you see what we’ve made? That’s absolutely right: Its an iPod mini phone.

No doubt its got a colour screen, a camera, a basic organiser and some games on it too, not to mention the bluetooth capability. Its a wireless iPod photo mini phone. And lets be clear on this: It won’t be too long before these things sprout hard drives, giving them proper amounts of storage.

The iPod will be well and truly out of a job. After all, why would you carry an iPod (or whatever) and a phone about in your pocket when you can have one device that does the job of both? That is why Apple have hopped into bed with Motorola and created the iTunes phone. They can see exactly where the smartphone market is going. Its going to trample all over their biggest market.

Of course that doesn’t necessarily answer the question Jared posed. That one’s obvious: Because you can!

Well isn’t that just typical?

Unless you’ve been living on Mars (or indeed anywhere else outside of the UK) for the past three weeks, you’ll no doubt be aware that there’s a new series of Doctor Who airing on BBC One. Unfortunately I missed the first two episodes, but luckily Bit Torrent came to the rescue and I spent a couple of hours catching up with them this afternoon. I happened to look at the clock about two thirds of the way through the second episode and realised that i’d just missed the third one on real telly. Arse biscuits. Not to worry, I’m sure the internet will come to the rescue once more…

To be honest I didn’t think they’d be up to much, but I really enjoyed them. They were just as silly as Doctor Who always has been, had the odd creepy moment (aye, I mean the bit in the basement with the manequins) and were generally good fun to watch. I’m looking forward to the next one.

Mmmm, cleanliness!

In other news, I absolutely stink of bleach. I had a ludicrously long lie-in this morning, couldn’t be arsed to go out on my bike when I did drag myself out of bed and in the end I cleaned the bathroom, hence the subtle odour around my person. I did finally get around to sorting out the Big Red Stiffee though, so it should be rideable if I can be arsed with it tomorrow.

And then I booted a Hedgehog…

In a fit of complete geekery, I also downloaded the live CD of the new release of Ubuntu Linux, nicknames “Hoary Hedgehog”. For those of you that don’t know, Linux is an alternative operating system (like Windows or MacOS) and a live CD lets you try it out without actually installing it on your hard drive.

Ubuntu Linux Logo

Its dubbed “the Linux for human beings”, and it seemed to work well enough. It was a lot like Windows really – its got a nice browser (Firefox), email (Evolution), office suite (OpenOffice), graphics package (Gimp) and even a decent set of games (including the lovely Gnometris). Unfortunately it lacks a few key applications (iTunes, Photoshop and TopStyle for a start) and I can’t be bothered to learn a whole new OS right now. Oh, and Ubuntu seem to like brown a bit too much for my liking. Maybe next time eh?

Learning another language

I was writing something funky[1] with JavaScript at work today. It meant taking my skills up a notch.

Its like my knowledge of French. I remember some of the basics from school, so I can ask for a beer and a pizza, or fumble my way through a leaflet. There’s no way I could hold a proper conversation or write extensively myself though. I use it so rarely that I have next to no idea how to do anything meaningful with it.

Yet here I was today having to write something new. I couldn’t just copy and paste this time – it required real thought. Trying to work with a foreign language when you know so little about it is a frustrating exercise to say the least. I spent quite a lot of the afternoon swearing under my breath, sighing loudly and frantically googling for answers. Then all of a sudden it began to click. It all started to make sense.

Its a good feeling when that happens. That stupid little thing you’ve been trying so hard to do all afternoon works perfectly. Its only a simple bit of code in the grand scheme of things, but the page would be useless without it, and what’s more, I made it do that all on my own. I feel better about having it on my CV now.

I should probably go through and give the variables proper names though. if (heffalump = document.forms[0].monkey.options.length) doesn’t look too professional does it?

[1] That’s funky in the loosest possible sense of the word.