links for 2007-02-28

Your honour, this evidence contradicts the witnesses last statement.

In which I try to overcome my native abhorrence of the buzzword du jour and end up jumping on the bandwagon in my own particular way

Forgive the title, I’ve been playing Phoenix Wright.

I hung out with some of the Web2.0 crowd recently, and although there was predictable talk of broken business models, the vibe was positive, the environment was nice, the people happy, and the future was bright. It seemed like a bit of a contrast with Rob Pikes polemic that I read recently. He is specifically talking about Systems Software Research, but actually I’ve heard similar views about almost all aspects of computer science. When you consider it like that, I can believe that at least with the theory of computer science (including operating systems, databases, programming langauges), humanity made some enormous steps a few decades ago but has been making baby steps ever since.

One of the reasons people (including me) give for complaining that Web2.0 is overhyped is that it is not a “new paradigm”. People have been sharing video over networks since the clubs that sent out flipbooks in the post. They’ve been sharing public diaries over computer networks since the days of unix and .plan. The web was invented to be read/write, yet it’s only now that that is filtering down to the public. I remember the days when a blog was called a “web page”. For conversations and debate, little has improved on the flexibility and power of usenet and irc. However, the revolution is not in what is possible, it’s in who is using it. If we can truly put the Joe in Web2.Schmoe, then that is something to get excited about. The reason “social” type applications have really taken off is at least partly because these kinds of applications need a broad level of adoption to be feasible. And as more people and more things are networked, new tiers of applications will become useful, and be written.

Most applications of the internet were invented to be subversive, moving control to the (necessarily skilled, back then but less so now) user, and away from authority figures and institutions. When the public first started to get involved and interested, it was too late, the anarchic applications and protocols had already been sidelined, legislation was steamrolling forwards, slowly but surely, and people didn’t even know the values that guided the original creations. That’s why practically nobody ever used http put (wiki was built in to HTTP 1.1). But there is a fight back. It may look like we’re building a whole new layer on top of old technology that was always designed to do what we want, but the reason for that is that we have to be where the people are. Now the people are here, we have to bring the original internet back, in all it’s anarchic, social and postmodern glory. That is what Web2.0 is.

And it’s working.

links for 2007-02-17

I am (%AMOUNT_OF_SORRYNESS%) sorry for the delay

There was an interesting article in the New Scientist recently on computer voices and how annoying they can be. The recent snow has given me occasion to be irritated by one voice in particular.

“The oh-seven four-teen train to… Milton Central is… 50 minutes late. I… am very sorry… for the delay”

Who is this I? If it was a real person apologising, even if I doubted their sincerity, I’d feel a bit happier about it. If it said ‘we’, I’d know that somewhere the company realised that annoying customers is bad, and they feel sorry that they have, but I? It even adjusts how sorry it is for the delay – for 5 minute delays, it’s only “sorry”, but for longer delays it’s “very sorry”. It’s ridiculous. It’s also insulting that someone somewhere thought we would be mollified by a synthesised sorry. The day a computer can apologise using the word I for a train being late, is the day it goes home to it’s robot wife saying

“I had a terrible day at work today. So many trains were late, those poor commuters must have been so frustrated. I love those days when everything runs smoothly, I feel like I’m really contributing. Perhaps we should move to Germany, I’ve heard there’s better job satisfaction for transport announcement computers there….”

Until that day, computers may express sorrow on behalf of others, but not for themselves. In fact it would be better if they avoided the use of the word “I” altogether.

For an apology to be meaningful, there must be an awareness of wrongdoing.

TomTom Go 710 – a review

Update: for a comparison with the Garmin Nuvi, check this review

I’ve been using the TomTom Go for about 3 months now. On the whole, I’m happy with it, it’s very useful with a minimum of fuss. However, considering this is regarded as being a good example of the breed, I’m a bit disappointed with some very obvious shortcomings.

First the gratuitous: It beeps with the loudest and most disturbing beep everytime I go near a speed camera. You can turn the function off completely, by removing the speed camera database from the device. Given that it also knows my speed (to the extent that it warns me if I ever exceed the limit), isn’t it a bit stupid that it feels the need to alert me to the fact that there is a speed camera set to go off at 40 mph as if it were a world ending catastrophy, even when it’s perfectly aware that I’m crawling along in a queue of traffic at 10mph. A much better solution would be to only alert me to the presence of a speed camera if I’m near or over the speed limit.

It’s nice that you can set that the distances be measured in yards/miles or metres/kilometers, however, I’m from that unhappy few generations in the UK that are happiest with meters for short distances and miles for long distances. Why can’t I set that? Better yet, why can’t I set the short distances in meters and say that the long distances should be in whatever the road signs are in, km in europe and miles in the UK/USA.

When it comes to trip management, I’ve seen bike computers that are more advanced. I’d like to be able to plan multiple journeys over multiple days. Relying on the “recent destinations” is ok, but it’s not good enough for a grown up system. And why the restriction to only one ‘avoid’ or ‘via’ per trip? That’s silly and can really get in the way. Sometimes it’ll tell you that it’s impossible to plan a route with the avoid or via, that it’s clearly not – it’ll do it as two separate journeys happily enough. It’s good that it gives you the options to avoid toll roads, but I’d like to know what the trade off is – I’d like it to tell me the time difference between using all roads, or only non toll ones – what I’d pay in toll, and what I’d pay otherwise in miles and fuel. Speaking of which, although there doesn’t seem to be a bluetooth standard profile for ‘car’ that would let it get at the mileage and fuel usage, there’s no reason why it couldn’t allow me to enter the fuel amounts and cost when I fill up so it could record and manage that as well.

It’d be nice to have a bunch of stats at the end of the trip. Distance travelled, average speed, rest stops, fuel stops, time, comparisons to other times you’ve made the same journey. Maybe even some graphing and mapping. The time estimates for different parts of the journey could be taken from history rather than simplistic statistics – that would even inform nicely different route options.

The thing has bluetooth for mobile data and handsfree calling (nice touch), but why doesn’t it let me download the gps locations of my entire last monthsworth of trips, and then let me geotag my photos with it, or show me pretty maps with my driving marked on? With mobile data, it could even mark on recent trips taken by friends, optionally with their photos, when you’re out there driving or walking. That might get a little busy I suppose, but it’s an option for adding interesting social data. Why can’t I use it with my own mapping software and my laptop should I want to? I haven’t really used it’s mobile data functionality, because I’m concerned about the cost of phone network data, but it would have been nice if it had a wifi connection, and could automatically connect over any available wifi to receive updates.

Then we come to accuracy. Generally it’s fine, but you start to notice things that are pretty jarring. There are about 15 miles of the A1 that according to it are in a field, some way to the west. It will sometimes say “keep left” when it means “turn left”, or “keep right” when actually, there’s no keeping involved, and your next action is to turn the opposite way. It’s all very well knowing which bit of the road you’re on and what you need to do next, but it’d be a massive help if it actually knew which lane(s) you needed to be in for your next manoever and warned you about that. It also has a nasty habit of warning you about the next turn just as you have another option to choose. It’s got a map there, it could easily check to make sure that you aren’t just coming up to a turning, and give you the next instruction a few seconds later so it’s not confusing. In fact, it’s better to receive any instruction when there isn’t an immediate road decision to be made. Generally the accuracy of the roads is good (barring one or two mistakes), but you’ll still need to look at the map every now and then rather than blindly trusting the voice and it’s disembodied instructions.

The map by the way does tend to be clear and well presented, and less likely to confuse than the voice. It’d be nice to have an overview map or something that gave a greater appreciation for what was coming up, but considering the screen size, that probably wouldn’t work. It has 2d and 3d views, although I generally find the top down 2d view the most useful. The touch screen interface is really nice to use.

When it comes to things other than the roads and houses on them, it’s accuracy is much much worse. They’re called Points Of Interest on the tomtom, and although it’s massively useful to have them, you should count on driving around the rough area of the symbol to find them. It took me straight to the nearest hospital in a strange place when I needed it, which was nice, but a few days ago, I was trying to get to the nearest post office depot. It took me down a tiny deadend of a side road with no turning space before proudly announcing “you have reached your destination”. Looking around, sure enough, I saw the Post Office depot, very close, just on the other side of a railway line. It took me half an hour to get to it from there, with no help from the the tomtom which was convinced that I had reached my destination and should probably turn around when possible to get back to it. I’ve had similar problems with petrol stations which are often on the opposite side of the road and a block or two away from where they’re supposed to be. Directing us to the nearest cinema we nearly ended up in the river, although it did have the rough area right, another 5 minutes of driving around nailed it. Although once you discover this problem, you can set a favourite to a specific location, it’d be nice to be able to correct the POIs on the device (assuming it is impossible to get them all right the first time). The way that if you go off what it thinks of as the road, it just draws a straight line to the nearest road, is ok most of the time, but it would be nicer if it remembered how you got there, and so took you back by the same route (and would it be too much to ask for it to update its internal map too?), instead of giving you nonsense instructions.

That same journey showed up another problem. It tried to join me onto a main road from a side road that had traffic lights set on timings to let only 2 cars through each time. The fact that I was in a huge queue meant I sat on that stretch of road for 20 minutes. It should know the timings on the traffic lights, and if it’s finding that I’m crawling, I’d like it to offer other alternatives. In fact, there are a number of decisions I can get better information for than it. If I can see that the traffic is terrible ahead, I might like to know alternative possibilities as I’m driving towards them so I can adjust the plan – perhaps alternative routes could be marked, with some indicator to show how much worse they are than the primary route.

My conclusion is that I’m really pleased to have a GPS in my car when I’m travelling, but it still feels like it’s early days. There are so many obvious improvements to the software, and data accuracy needed that it’s hard to imagine that 2006 was supposedly the year of the GPS, it’s still very immature, completely unable to learn from or store history, it’s a device that does it’s job the way it thinks it should, and although that’ll work well most of the time, it’ll be very frustrating the rest.

Inheritance and Javascript

Time for a technical post.

Javascript is a ‘prototype’ based language, and it means that inheritance is a different animal in Javascript than it is to more normal object oriented languages. You’ll see a million different ways of doing what seems a very standard thing. There are quite a few inheritance patterns that I’ve found on the web, often even using large and complex libraries.

The commonly seen inheritance pattern (even in impressive reference tomes) is this:


function Parent( args ) {
// set up stuff
}
Parent.prototype.someMethod = function() { /* Do some work */ }
function Child( args ) {
// call the parents constructor with args
// then set up your own stuff.
}
Child.prototype = new Parent();
Child.prototype.someMethod = function() { /* Do some work */ }

This works, in that the prototype chain is set up and attributes and methods are inherited. Where it doesn’t work is that you had to construct a new Parent at the time of the Childs definition rather than instantiation. Often the parents constructor simply doesn’t make sense taken in isolation like this, besides the frustration of having to call it again when the child is instantiated.

One suggestion was to set the prototype of the Child to the prototype of the parent.


function Parent( args ) {
// set up stuff
}
Parent.prototype.someMethod = function() { /* Do some work */ }
function Child( args ) {
// call the parents constructor with args
// then set up your own stuff.
}
Child.prototype = Parent.prototype;
Child.prototype.someMethod = function() { /* Do some work */ }

But this doesn’t work because the prototypes are shared and the parents someMethod is corrupted by the client overriding it. But playing around the other day, we worked out a sneaky way around this, you can create an empty object which inherits from your parents prototype, and then inherit from that.

function Parent() { }
Parent.classconstructor = function() { /* An object to represent the class */ }
Parent.prototype = new Parent.classconstructor();
Parent.prototype.someMethod = function() { /* Do some work */ }
function Child() { }
Child.classconstructor = function() { /* An object to represent the class */ }
Child.classconstructor.prototype = Parent.prototype;
Child.prototype = new Child.classconstructor();
Child.prototype.someMethod = function() { /* Do some work */ }

A bit confusing maybe, but the inheritance chain is perfect, you don’t corrupt your parents prototypes when you assign methods to the Childs prototype.

You can wrap all this up into a utility method quite easily, which then doesn’t pollute your namespace.


function extend(clazz, superclass) {
	var intermediate = function() {};
	intermediate.prototype = superclass.prototype;
	clazz.prototype = new intermediate();
	// you can do other stuff here to set up
	// for example easy ways to call your super constructor,
	// or super methods, or convenient ways of finding
	// your own constructor.
}

and then you can use it very easily.


function Child() { }
extend ( Child, Parent );
Child.prototype.someMethod = function() { /* Do some work */ }

So, all you javascript geniuses out there on the internet, let me know – is this a good pattern, or are there hidden dangers?

Permanent Serendipity

And we know that all things work together for good to those who love God
Romans 8:28

The Church of Logitech was an enormous building, built of huge stone blocks with buttresses plunging great depths into the water on all sides. Antony stood in his dirty suit at the end of the bridge, with his hand on the door. The huge dark oak doors were closed, but there was a smaller entrance cut out of the right hand door that was open. Even knowing that it’d been built with some of his money, it was hard not to be intimidated. He breathed deeply, summoned up his outrage, and pushed on the door.

Inside, huge marble pillars soared up to the gold inlaid dome. Specks of dust and smoke from the incense sticks danced in the few shafts of light. Antony was halfway down the marble aisle towards the sanctuary before he was met by an hooded and cloaked figure.

“Hi, I’m Steve, and I’m your pastor for this evening”

Antony sighed. “I’d like to speak to the abbot of customer services.”

Steve looked Antony up and down, taking in the dishelved hair, the stubble, the scent of alcohol, and the thorougly disheveled suit. He’d only been working here three weeks, but he was getting quite good at evaluating peoples need and potential for being blessed. Working here had been the cheapest way for him to acheive his own blessing.

“I’m afraid he’s busy, you could make an appointment for two months time.”

“Pastor eh? New though. I bet you aren’t even given 5 minutes of grace processing to pass to the worshipers. I’m not here for blessing, I am the owner of the Most High Prioirty.”

The claim seemed unlikely, but Steve gazed up at the row of icons depicting the blessed along the ceiling. The man before him was there, unmistakable even in mosaic. Flustered, he bowed and said “Of course, please follow me sir”.

The abbot of customer services was dining with the abbot of the exchequer, discussing money and clerical matters over fine food, but when he saw Antony, he excused himself immediately.

They sat together in a confessionary where poorer folks could swap information about their doings out of the eye of society for a brief blessing. He knew that everything would be recorded by the serengents, but it was in strictest confidence – nobody could talk to a serengent.

“Why are you even here? You have already received the greatest blessing we can give you, you have no need for worship – there is no point entering you in the worshipers lottery for greater priority, you already have the Most High Priority, you are more blessed (he pronounced the ‘ed’) than the Bishop of Logitech himself”.

“I want to talk to my serengent.”

The abbot spluttered as if he was still eating the fine duck he’d left behind. “Impossible. I don’t care if you are the richest man in the world and the owner of the Most High, no one may speak to their serengent”.

“Was the richest man in the world. In the time since I was ‘blessed’, my wife has left me, my businesses have gone under, my new house collapsed, and the nicest members of my family have died, the rest have fallen on hard times.”

“Strange, strange, indeed, but we never promised you that life would be easy afterwards, just easier than it would otherwise have been. Whatever may have gone wrong, you must trust that you are living the best possible life.”

Antony snorted “I no longer believe. My life is harder than ever before, and I see no changes to the benefit, just an invisible malevolent hand conspiring against me.”,

“Blasphemy! Your serengent is calculating all the possibilities, and making tiny, subtle changes in thousands of situations across the world. It can change information systems, weather systems, traffic systems all across the world. It is supernetral. It can make sure information comes out, or is buried. It knows so much about every individual that it can direct the course of their actions by simply changing the art on the wall, or by altering the scent in the air conditioning. It is a perfectly benign, all powerful software agent, dedicated to your benefit and that alone. You must know that whatever is happening is part of a plan, being woven together as a tapestry by the most sophisticated intelligence known to man. It understands far more than you, it knows every person, place and thing on this planet intimately. Unlike everyone else on the planet, you have an unconstrained serengent. It makes changes for your benefit without concern for the plans of others. Whatever has happened in your life since you were blessed is for the best.”

“I have heard stories”, Antony said, “stories of serengents created to inconveience people, to make their life harder. A curse. On the streets, I met a woman who swore that she had been cursed by one of your exinitiates.”

The abbot became a little more red faced. “It has happened,” he said hesitantly, “our deifiers must create curses to test the blessings against, but they are kept locked up in the crypt, only one has ever become supernetral, and we hunted it down and punished the initiate who released it.

“Perhaps you cursed me instead of blessing me.”

“There is no way that that could happen. We are very careful, and besides, a curse with Most High priority would certainly have found a way to kill you by now.”

“This is wrong you know. You are controlling peoples lives. You are destroying their free will. You have created a false God”

It was the abbots turn to snort contemptuously. “You had no trouble with it when you believed that peoples lives would be controlled for your benefit”. He paused for Antonys rebuttal, but Antony could say nothing. He knew the abbot was right. “As for ‘false God’, it has always been mankinds aim to create God, first in the imagination, then in craftsmanship. Now finally, with the benefit of modern technology, we have succeeded. Replacing supernetral for supernatural, we have finally created the all loving, all powerful, all knowing intelligence, and we make it available at a very reasonable cost. Primitive beliefs in primitive Gods have faded quickly as the whole world has seen the immediate benefits of worshiping here. We are the most successful religion that has ever been. False God? Hah, we have the only true God.”

“I read the leaflets, all that ‘guiding hand steering the hugest of boats with the slightest of touches’ nonsense. It was lies – I cannot explain what has happened to me any other way. You promised me a life of permanent serendipity, forever bumping into forgotten friends and meeting fascinating strangers. Everything I turned my hand to should have succeeded. What is happening? I must ask the serengent.” Antony was near tears.

“We cannot let you ask that question yourself – it cannot work if you learn anything about its plans and what it is doing for you – it creates feedback in the logic. However, I can see that you are in a very unusual position”. His attitude became fatherly, “you should go and rest, I will get some of our deifiers to examine your case. We can’t second guess a serengent, but there are a few things that we can do to investigate. Come back tomorrow, perhaps we will be able to help you then.”, he put his arm round Antonys shoulders and started to walk him towards the door, while at the same time making a series of hand signals to Steve to start the investigation he’d just promised.

Steve hurried up the spiral staircase to the top of the tower, leaving the vague sound of Antonys half hearted protestations behind him. There were only two deifiers on duty in the enormous supernet visualisation room. He bowed deeply as he entered the sacred space. Around him light danced and flowed, the global optimisation problem of happiness was being computed by millions of serengents with complicated priorities, all squabbling for computation rights, as he entered, a warning light flashed, and any visualisation involving his serengent was blanked out.

“What are you doing here?” asked one of the deifiers, “you are one of the blessed, we can’t work properly with you here.”

Steve explained his mission, and then went and sat outside on the cold wooden bench. When the abbot checked on him later that night, he was still there, waiting.

The next morning the abbot found Steve and a deifier sitting quietly in conference outside the visualisation room.

“So”, he said, what did you find?”.

Steve stammered, “The serengent prioritises important long term gains over short term, doesn’t it?”

“Yes”

“Even really long term?

“Certainly, if it’s sure enough of them and they’re important. Why?”

“We believe that Antonys serengent has been making changes to improve his character.”

“Improve his character?” The abbot was incredulous, “but it’s programmed to increase his overall happiness, not make him a better person.”

Steve shifted uncomfortably.

“We’re uncertain exactly what it is doing, but our best guess is that it has found a proof of the existence of an afterlife.”