Archive for October, 2004

Words

Monday, October 18th, 2004

Douglas Adams once said:

Writing is easy – all you have to do is stare at a blank piece of paper until your forehead bleeds.

Or, if you’re a blogger, you just steal ideas from other people and pretend that they’re your own. (there’s actually only one blogger in the whole world who produces original content, and he’s currently preparing for what will undoubtably be the biggest copyright infringement lawsuit the world has ever known) Unfortunately, tonight, even that old standby has produced no useful results, so I’m reduced to the Douglas Adams technique, although obviously slightly adapted to take into account advances in technology.

(Does anyone know how to get blood off an LCD screen? It’s kind of gone all smeary and yucky, and everything is an unpleasant sort of shade of rusty red)

The problem with real life is that it’s actually hugely, monstrously dull. Everyone’s life is actually, save for the odd detail here and there, exactly the same; we get up, we go to work, we come home, we eat, we sleep. The pattern repeats itself up and down the country, in millions of homes, offices, bars, supermarkets and cars, every day of every week. Therefore, short of actually being a celebrity or one of those few people who actually has a sufficiently unusual life as to be interesting, there are only three ways of writing a blog that will engage people’s attention on a more or less long-term basis.

Firstly, you can work out what the tiny differences are between your life and everyone elses, and somehow magnify them into something that will hold people’s attention. For example, it’s unlikely that any of my readers at the moment are currently also reading a theological book entitled “Postmodern Christianity”, which takes as its focus the creation of a so called “Inclusive Liberal Theology” by placing the development of Christianity into the context of the development of philosophical thought over time – and, if it weren’t for the fact that it’s late on a Sunday evening and therefore the thoughtful, philosophical part of my brain has shut down for the day, I’m sure it could form the basis of a fascinating, controversial and engaging post. Unfortunately, though, the only philosophical thoughts running through my brain at the moment are along the lines of “if I don’t get in my bed soon, will it cease to exist?”, and so deep thought isn’t about to happen here at the moment.

Secondly, you can use your incredible comedic talents and gifts of eloquence and insight to write about the day to day humdrum in a way which brings it to life, engages people and makes them laugh. On Friday, I waited half an hour for a bus which apparently runs every ten minutes. Lyle could probably have turned that into a four-page expletive filled rant on the state of Manchester’s public transport; I, however, am currently feeling relatively placid and unruffled by this, especially as it happened two days ago and, in the end, I wasn’t that late getting to the pub. Plus, I kind of get embarassed when I swear here; it’s just not the done thing for an Englishman, is it?

So, the third thing you can do is to whinge and moan at great length about how you’ve got nothing to write about, in the vain hope that people actually read most of the way through the post before they realise they’ve been duped. It’s a cheap trick – like authors who write “Little did he know that in 12 hours time, this knowledge would save his life” in order to artificially generate tension out of an otherwise tedious and humdrum scene – and of course, I’d never use it here. Well, not unless it was gone midnight on a Sunday and I was really, really desperate for ideas, that is.

Quantum Cheese

Wednesday, October 13th, 2004

From: Chris Whitworth

To: Sainsbury’s
Subject: The Greg Rusedski of Cheese

To whom it may concern;

I am confused. Yesterday, I purchased a block of Sainsbury’s Taste The Difference Canadian Vintage Cheddar from your store in Sale, Cheshire – and a very fine cheese it is, too, I must say. However, upon turning the pack over to check the nutrition information, I noticed that the packaging had a note indicating that the product was “Produced in the UK for Sainsbury’s stores”. Very strange. Normally, I would not allow myself to be vexed by such things, but I cannot help but find myself intruiged as to how a cheese which clearly claims to be Canadian could be actually be produced in the UK – is it from Canada? Is it British? Does it exist in some sort of bizarre quantum superposition of states with respect to its place of origin? Perhaps you could shed some light on the matter of this strange, dual-nationality cheese for me.

Yours, etc;
Chris Whitworth

I’ll let you know if I get a response.

Java idiocy of the day

Tuesday, October 12th, 2004

Every now and again, just as I think I’m getting sick of C++ and all it’s foibles, I learn something about Java that makes me consider how lucky I truly am. Today, I present two idiocies in Java that will make you blink a lot and go “What?”

First up, Generics. In C++, there is a hugely powerful mechanism for parameterising types – templating. You can define a generic class, and can then specialise it on particular types – for example, a generic list class, which can be specialised into a list of ints, or of floats, or of ThisArbitraryClassIHaveJustInvented. When in the hands of someone like Andrei Alexandrescu they become almost other-worldly in power and flexibility. So, generics are largely considered to be A Good Thing.

Sun decided Java should get generics. Fair enough. However, Sun also have a huge hardon for preserving backwards compatibility, which meant that they had to do it in such a way as to preserve bytecode compatibility between versions. Generics, in C++, require the compiler to generate code for every specialised instance of a class – in Java, where header files don’t exist, this obviously can’t be done. Also, in order to preserve backwards compatibility, they couldn’t change the bytecode format – they were stuck with what they had. So, what did they do? They cheated.

Java implements Generics by a process known as Type Erasure; stick with me here, because this is where things get crazy. Under type erasure, a generic class is compiled such that all instances of the parameterised type are replaced with Object (or an interface of some sort) in the compiled bytecode. When things use a specialisation of the generic class, the compiler does type checks on call boundaries to ensure the right types are being used – but otherwise, basically, the parameterised type disappears.

The net upshot of this is that you can’t actually use the parameterised type in methods of the generic class for anything other than casting (which generates a unchecked compiler warning). You can’t create new instances of that type; you can’t use is-a operations with it; basically, you can’t do a whole lot other than use it to do static (compile time) type checking on collections. Which is kind of useless, really.

Bruce Eckels has a good article about the whole thing.

Secondly, Integers. You wouldn’t have thought that there was a lot you could get wrong with Integers, but Sun have gone to some effort to make sure that, in combination with the equality operator, they are as confusing as possible. Consider the following code:


Integer i1 = 127;
Integer i2 = 127;
Integer j1 = 128;
Integer j2 = 128;
System.out.println(i1 == i2);
System.out.println(j1 == j2);

What would you expect that to print? Naively, coming from a C++ background, one would say “Well, it’d print true for each comparison – assuming operator== did what you expected it do.” Well, in Java, the == operator doesn’t quite do what you expect it to – although its revised definition isn’t totally unreasonable. It checks equality by reference, not value – so, references to two different objects will always return false on ==, but a two references to the same object will return true.

“Okay, that’s fair enough then”, says our C++ coder, “it’s like comparing pointers to objects – so that example above would actually print false twice, then?” Well, you’d think so, wouldn’t you. Unfortunately, this is Java, and things are never quite that simple.

The line Integer i1 = 127; actually gets compiled as Integer i1 = Integer.valueOf(127);. The valueOf() method returns an Integer object with the appropriate value; however, its behaviour isn’t as simple as that. For most values, it creates a new object and returns a reference to it, as you’d expect; however, for values between -128 and 127, it maintains an internal cache of statically created objects, and returns a reference to one of those instead. So, for any integers between -128 and 127, you’ll always get a particular, prebuilt object, but for any other integers, you’ll always get a new object.

So, in that example above, the counter-intuitive and utterly bizarre result is that it prints true for the first test and false for the second.

I’m so glad I’m not a Java programmer.

Edit: If you’re a Java programmer, you’re probably quite upset and annoyed with me now. Yes, I know you should use equals() and not == to test quality between objects; that’s not my point here. My point is that the specialised behaviour for 8-bit integers is inconsistent, utterly counter-intuitive and breaks the principle of least surprise quite horribly. And if you don’t agree with that, then I’m afraid Sun have finally got to you; report to your local cult de-programming centre and start your journey into a wider, freer world.

Search

Monday, October 11th, 2004

At Nayf‘s request, I have added a search feature. Type a word or two into the little box at the top right, click on ‘go’ and you can find out if I’ve written about it. Hurrah.

The Megastonking Awesome JoJo Forum

Thursday, October 7th, 2004

I’ve had a large number of links this month from ”
The Megastonking Awesome JoJo Forum”. Who are you and why are you all coming here?

Sci-fi Cliches

Thursday, October 7th, 2004

Need to write a plot line for your next pulp-scifi novel or low-budget Star Trek knockoff? Save all that tiresome thinking and originality and just use one of these tried and tested tedious cliches instead.

(via [Flubber@UA2])

Word play

Thursday, October 7th, 2004

I thought for National Poetry Day,
I should write this post in rhyme;
Through contrived sentence and clever word play,
My linguistic skills may shine.

With subtle nuance and clever word,
And startling metaphor,
My prose could fly as if a bird,
And through the language soar.

I could entertain with charm and wit
And delight with eloquence;
The world would be bettered through what I’d writ:
And be changed from this point hence.

People would gather around this site,
And gasp in admiration and awe;
“Never have we seen such linguistic might!”
They’d exclaim at what they saw.

Sadly, inspiration strikes me not –
Though this is hardly rare –
So I’ll give this up as a bad lot;
Not that you’ll really care.

Chris and Helen’s wedding

Wednesday, October 6th, 2004

I’ve uploaded the first batches of the photos I took at Chris and Helen’s wedding. They’re just here.


Edit: The second batch are now online, starting from here.

Meh

Monday, October 4th, 2004

Am feeling uninspired currently, having been all artsied out putting up my LomoWall for the LomoManchester exhibition in Font.

(am also feeling slightly tired having been woken up by Hurricane Nigel battering on my windows at 6am; loft conversions are great, but having windows in the roof has certain downsides)

In lieu of a proper entry, have some links:

Safety Nazis vs. The Evil Vacuum

Don’t click this link

Sticky

We didn’t win

Starship Troopers 2

Friday, October 1st, 2004

At work today we have been mainly watching films; the two Starship Troopers movies to be precise. You’ve probably seen the first one, Paul Verhoeven’s enjoyable satire on fascism and war propaganda; you probably haven’t seen the second, though: it went straight to video, got virtually no publicity and pretty well everyone ignored it. Well, I’ve seen it, and to save you the bother of seeing it yourself, I’ll summarise it in the form of a simple equation:

(Pitch Black + The Matrix + Alien + Species + The Thing) * 70s Zombie B-movie * 70s B-movie budget = Starship Troopers 2

It’s a terrible film. Awful. Really astonishingly bad. But (and here is where the views of myself and my co-workers start to differ) it’s so bad that it’s actually really enjoyable. Not in the same way as, say, The Usual Suspects or Amelie are enjoyable, of course, but in a 70s zero-budget horror-B-movie kind of way. The acting is comically bad – the dialogue is worse; the plot is wafer thin, and has almost zero connection with the original film; the characters are flimsy and the editing and direction are heavy handed and clumsy. The special effects, however, are actually rather good in places (the film was directed by the creature effects supervisor of the original movie) and there’s plenty of splatter-film style gore thrown around.

Indeed, this is far more of a zombie horror movie than it is science fiction – and once you realise this, it becomes infinitely more enjoyable as you see all the cliches of bad zombie films played out before you. This isn’t a film to sit down and critique on a scene by scene basis – this is a film to put on when you get back from the pub with your mates and you want something you can laugh at and cheer along with.

And hell, I enjoyed it, even if no-one else did.