Archive for the ‘Programming’ Category

XML Document Creation in Javascript – Cross Platform

May 28, 2007

This is an absolutely super guide which basically gives you some neat code in order to work with XML documents across multiple platforms in the sadistic language of the web – Javascript.

It’s a 4 page tutorial which overviews a static JS class that the author has put together which provides helper methods for creating a new XML document on the client browser by loading from disk, URL’s or strings.  I found it especially useful for squeezing a javascript string into a nice XML representation. Check it out on WebReference.com

Javascript Tip Of The Day: “When Is A Width Not A Width?”

May 5, 2007

This is a bit of a gotcha for young players in the Javascript game. You have a web page with a DIV which you fill dynamically with, let’s say, 5 IMG elements. How do you get the width of the DIV? You can try “document.getElementById(‘divId’).width” but it will do you no good. The answer: use “document.getElementById(‘divId’).offsetWidth”. Here’s a handy guide when it comes to DHTML element position and locations.

The Frogface Project Website Launched

April 30, 2007

We’ve tried to start this before and never quite finished it. You can check out the site at www.frogface.org. This time things went smoothly, however I had to struggle through my hangover on Saturday while I polished off the final details. A big kudos to Veedles who did a smashing job creating the images and logo for the site – and now that she is the queen of web design is gonna spruce the site up even more over the coming weeks!

Frogface logo

The Frogface project is an effort to create a user friendly scuba dive logging application which runs on any computer. It’s still not ready for everyday use so us developers will have to keep beavering away for a while. Things are going well recently as I escaped my horribly busy work schedule in order to get phase 1 of the project done. Ganesh is working on getting the menu’s together over the coming weeks and I’m gonna try and get my head around beautifying the user interface and making it look real pretty. As they say, “There’s more than one way to skin an app!”

Object Orientation and Javascript

April 26, 2007

Javascript is muck; don’t let anyone tell you otherwise. But it’s also unavoidable. My latest effort to write better JS code is to use inheritance when creating classes and objects. So before I forget, I’m posting these links – as they’re pretty handy. Sounds like a lot of hassle for a bit of inheritance though!

Very hardcore OO – but efficient

Again hardcore OO

Blair Government Throws UK Programmer to the Dogs of US Justice

April 3, 2007

Gary McKinnon is a computer programmer who likes UFOs and rainy Sundays. Curiousity got the better of him so he went searching online for UFO conspiracy theorys and photos believing that the evidence to date suggests that US was hiding something Roswell style et al. Not exactly a profile of a notorious threat to national US security yet. His curiosity brought him to various US military networks which he then found were remarkably easy to access given that apparently the username and password were the same in several cases and security was incredibly lax. He managed to find some folders containing pictures of nice shiny UFO-like things and got excited as his dream of seeing became a reality. Heart pumping he clicking on one of the files. As them image began to slowly come up on his screen his dream was cut short – one of the administrators had noticed him in the system and promptly cut him out…

Needless to say, the US authorities were pretty pissed about the whole episode. The UFO equivalent of a trainspotter had managed to waltz around their systems like a kid in a candy store because aledgedly their administrators couldn’t do their job properly. You would think that given the background to the case Gary would have been handed down a punishment apportionate to the crime – after all no one got hurt, no one was killed or maimed in the incident. It is alledged that some damage was done but Gary maintains that such allegations are false and in an article on .NET magazine outlines how the figures don’t add up. Given the facts of the case to date and what Gary’s motivations, it is unlikely that someone who wants to keep a low profile in a system to look around for information is going to go deleting files for the sake of damaging a system.

So instead being given a big slap on the wrists, some UK jail time or 400 hours community service cleaning viruses of peoples computers Gary is being threatened with – get this – extradition to the US, a 45 year prison sentence to be served on US soil only and, worst of all, a possible handover to the US military trails. This latter point wouldn’t be good, not only against the backdrop of Guantanamo bay and big orange jump suits, but because of ‘alledged threats by the US authorities in New Jersey to see Gary “fry”, which could be a reference to the electric chair’. ‘Currently, the US civil legal authorities are not calling for the death penalty (which would stop the extradition to the USA under United Kingdom and European Union law), but such a penalty is possible if the case gets hijacked by a US Military Tribunal, once Gary is physically in the power of the US authorities.’ [http://freegary.org.uk/]

So our UFO trainspotter is in a bit of bother. It’s sad then to hear yesterday that John Reid, UK home secretary, has given the green light to ship Gary McKinnon off to the US. He’s already lost his job, girlfriend and has been in poor health in recent hearings as the stress of the case takes it’s toll. He has never denied his actions and has taken responsibility for what he has done. He has already suffered enough. Will it really do any more good for the US to show how big and mighty it is by beating the soul out of this guy in order to show who’s boss. It might be better to spend that energy on employing a few new system administrators who know how to put passwords on a system instead.

This opinion piece was based in part on the following BBC News item.

AJAX – More than just a Toilet Cleaner – Not!

March 29, 2007

Just to warn non-geeks, this is actually an article about programmin stuff so don’t get too excited about replacing Toilet Duck just yet! This is just a rant…

In short, my head is wrecked. After watching .NET mature into .NET 2.0 and now .NET 3.0, there’s been loads of nice improvements. It’s a pleasure to write code on the server with the latest C# additions, especially generics and partial classes. So with all thing clean tidy technology available on the server, it is thoroughly depressing that most (90%) of the time is spent writing code in bloody Javascript – possibly the worst language ever! Painstakingly, writing reams of rubbish which you must translate into different types of rubbish for different browsers. The best approach seems to be a James Joyce style ‘Stream of Consciousness’ technique where you deprive yourself of sleep for a week, then grab your keyboard and type blindly away for 4 hours and then see what works at the end – preferably with a large vodka in one hand and a larger vodka in the other hand. Who on earth invented this spawn of satan language – which should just be turned off on every computer. We need a revolution! Somebody please write a client side C# implementation.

Otherwise the vodka wins…