Saturday, June 30, 2007

Pinball machines

Yesterday evening I went with my brother to pick up a pinball machine he had bought. He already has one in his home: a worn down 1975 Bally Kick Off machine.

It's still fun to play at times, but it could use some restoration. So... my brother decided to buy a second machine. After some searching on the second hand sales sites he finally bought a 1990 Williams Funhouse.
It's a pretty well known machine, since it's very colorful and has a moving head in it.

While talking to the seller I once again realized that pinball is really dying. Twenty years ago we'd have at least four or five arcades nearby where we lived. And each arcade would have at least somewhere between 10 and 15 pinball machines.
The biggest arcade had at least 50 of them. That was so much fun. More fun than all the other video games they had, even though those drew the bigger crowds.

But with video games moving into the living room, the arcades were not making enough money anymore. So these days most of them have closed down. And the ones that are still there, have switched to only having slot machines.

Which isn't exactly the same thing as a pinball. Especially not when you try to nudge them a bit, which is really frowned upon by the arcade owners.

So with no arcades to host the machines, vendors shut down one after the other. Today there is only one big vendor left: Stern. They're a relatively new company, so not a survivor from the old days. But still, Stern makes pretty well designed pinball machines based around things like movies. They lack some of the character and originality of the older machines, but they're real pinballs and as long as Stern is the only company still making pinball machines I won't be complaining too much.

But there are also a lot of pinball aficionados our there, keeping the hobby alive. They buy old machines, restore them with a lot of skill, time and dedication and then send or sell them off to someone else - hoping they too will pick up the love for pinball. In this case the receiver was my brother, who doesn't need to pick up the love. He likes pinballs almost as much as I do. But he does have to little kids (ages 5 and 7) that still need to learn to appreciate it.

One thing I didn't really realize until yesterday was how heavy pinball machines are. They actually need to be quite heavy to withstand all the kicking, shoving and nudging that used to go on at arcades. But nudging a 140 kilo machine isn't exactly the same as trying to lift it into a car. My arms are still hurting....

Tuesday, June 26, 2007

It's all about the data, not about the code

As I've probably told before, I administer (and contribute to) a few photo blogs. Since I wrote the software for the blogs a few years ago, actually most of the time I spend on it is small tweaks to the code. Adding a feature here and there. Nothing big, but enough to keep the editors happy and myself busy.

But recently I noticed that I've been putting of adding one of the requested features. And I wondered why. The feature in itself isn't very spectacular. The blogs work with a scheduled system, where all editors can see everyone else's posts. Since this is the holiday season, editors are sometimes planning their posts weeks ahead of time. And this can get confusing to the editors because it sometimes isn't very clear anymore where we are today. And something that also slightly bothered me is that some of our editors like to read posts from the administrative interface before they appear on the site. We even get answers to some of our "guess what" photo's before they're available on the public site.

It is time to do something about this. Like I said, it is pretty simple: don't allow the editors to see each others future posts in the administrative interface. So they should still see each others "old" posts, which is a great way to quickly find something you want to link to. But into the future, they should only be able to see their own posts.

The heart of the administrative interface is a table with a row for each post. It's very basic and the code is like:

    for each post
write post to grid
Any half-decent programmer will know how to add the feature:
    for each post
if (postdate <= now || currentUser == author)
write post to grid
But this is where it becomes problematic. The editors can sometimes also post on behalf of other (guest) authors. And of course, they should be able to see the posts that they created on behalf of guest authors. So the condition should be more like:
    for each post
if (postdate <= now || currentUser == editor)
write post to grid
In here we added the concept of an editor: the person who created the post in the system. And this is not necessarily the same as the author: the person who created the content of the post.

This would indeed very easily implement the feature. One additional if statement and I'm done.

There is only one problem with it: I don't keep track of the editor of the post!

The information was never needed, so it has never been recorded. That means that I have about a year and a half of posts for which I don't know who the editor is. Which means that I have to figure out a way to either manually gather that data now (something I don't look forward to), add an exception for the cases where the data isn't available (resulting in uglier code) or somehow programmatically extract the information from the data that we already have. That last option sounds like the least manual work (both now and in later maintenance). But it means that I'll have to write code that touches all 500+ posts we have in the system.

When I realized this, I finally knew why I'd been putting off adding this feature. I don't have any problem modifying the code, even when I hardly use version control and backups of it. Why? Well, simply because I know that if I break it I can just as easily fix it again. That's the benefit of a one man software project. I wrote the code, so I know how everything works. But I am reluctant to touch the data. Why? Well I didn't write most of the data, so I have no idea how to restore it if I "break" something in that area.

This realization reminds me of something I always say to fellow developers: "it's all about the data, not about the code". The code can be re-written without any problem. All it takes is time and a developer. It doesn't even need to be the original developer, because a good set of data allows for lots of reverse engineering. But the data is often gathered from many sources. And if it's lost, it's lost. It will take much more work to find all those sources of data again, if it's possible at all.

Now that I've talked about it this much, I'll probably bite the bullet and add the feature anyway. I'll even do it the right way: by modifying/augmenting the existing data to include information about the editor in addition to the author field we already have. But I'll be sure to first do this in a development environment. And even when I know it works, I'll make some extra backups before applying it to the live environment. It might be a lot of work that is most likely not needed. But I'd rather do the extra work than run the risk of corrupting some of our precious data.

Saturday, June 23, 2007

The Mac startup sound

I switched on my Mac this morning. While it booted I walked to the kitchen to grab some coffee and I heard myself singing:

  • It's been seven hours and fifteen days
In case you don't recognize it, that is the opening line of "Nothing compares to you" by Sinead O'Connor.

Now it's not unusual for me to sing small fragments of songs. But I always wonder what triggers a certain song. Especially one that is as old as this one.

It didn't take long to figure it out in this case. The song was triggered by the sound that the Mac makes when you switch it on. It sounds remarkably similar to the start of the song.
Has anyone else noticed this? All I could find in a quick scan, was a comment in this post.

And is it a coincidence? Or is this part of the tribute that the Mac engineers pay to their creation? It sounds like the thing any Mac-head would say to his/her machine: "nothing compares to you".

Flashback to regex'es

Sorry for the lack of updates in the past week. Normally I'd blame work, but in this case it wasn't unusually busy there. Actually my lack of updates has been caused by the amount of feedback I've gotten on one of my earlier posts.

The post is about optimizing regular expressions, one of the last black arts of programming. And this black art is mostly lost on me. Luckily one of our readers seems very fluent with regex'es and has been extremely helpful. Unfortunately I haven't yet gotten all the kinks out yet while integrating it into the project, but his suggestions seem to improve performance immensely.

If you want to know more, follow the link above and see how it plays out. If you don't care about regular expressions; I am busy writing a next regular post. It should be up later today or early tomorrow.

Sunday, June 17, 2007

Help! My mediacenter is dying!

Yesterday I told you about the positive impact our mediacenter has had on the way we watch TV. Unfortunately it hasn't all been positive.

From day one our mediacenter has been having hardware problems.

  • Motherboard replacement.
    Within two months of buying the mediacenter, its motherboard had to be replaced. And this is an A brand, mind you. Apparently that doesn't say anything about quality anymore. The service center was pretty close by, though.
  • Single tuner or twin tuner.
    We went for the mediacenter with two tuners in it. But unfortunately about half of the time, only one of the tuners seems to work. It's annoying, but apparently not annoying enough to send the machine back to the repair shop.
  • Hibernate or always awake.
    One the things that is really important is that your mediacenter should "go to sleep" when it's not doing something and then "wake up" when it needs to record a show. And at times that actually worked reliable for us.
    But most of the time, our mediacenter is much like a 15 year old kid: it wakes up when it feels like, stays awake as long as it likes and refuses to go to sleep when you tell it to.
  • What's that noise?
    We went for the more expensive VCR form factor mediacenter, because it was supposedly less noisy. And I guess a standard desktop PC would indeed make more noise that our mediacenter. But I still find the amount of noise it makes too much. It could really do with some less power-hungry parts, so at least some of the fans can be removed.
  • Wireless keyboard range
    The range that I can use the wireless keyboard at is ridiculous. I basically have to sit on the floor right in front of the mediacenter to get it to work. And even then it is intermittent. I would much rather have a reliable wired keyboard, but apparently am to lazy to get one that looks nice enough in my living room.
Ok, so much for the hardware problems. There also plenty of software problems. Our mediacenter came with Windows XP Mediacenter Edition. That is a whole Windows version dedicated to supporting mediacenter functionality. So it can't be bad, can it? Wel....
  • Installation assumes you have a monitor attached
    I bought a mediacenter to hook it up to my TV. Then why does the installation assume that I'm on a high-resolution monitor? Entering that 20 digit license code really is no fun when you can't read half of what's on the screen.
  • Windows Mediacenter is an application, not a special version of Windows
    When I saw Window Mediacenter Edition, I expected the whole Windows OS to center around the mediacenter functionality. Well, I was wrong. Mediacenter is nothing more than an application on top of regular Windows. And unfortunately that's how it feels. When I start (or wake up) my mediacenter, I firsts see the PCs POST screen, then I see Windows booting and finally I see the Mediacenter application starting. Imagine your TIVO doing something like that.
  • PDC? What's that?
    In Europe we have something called program delivery control, which sends some extra signals with the program when they start and end. The result is that you never miss the end of a program that is running late. Admittedly this is available for a limited number of channels, but for those that have it this is a great feature. Unfortunately Windows Mediacenter doesn't support this feature whatsoever.
  • Teletext support is laughable
    Again in Europe many TV channels carry teletext pages with useful information. Windows Mediacenter can display these fine, but why -on a PC with plenty of memory- do I still have to wait for it to cycle through the pages? Have the developers never heard of caching the pages? More and more TVs do this, but Windows Mediacenter... doesn't.
  • Why isn't there a web interface to the EPG?
    Programming recordings through the EPG on your TV screen is a real improvement to old-style, time-based VCR programming. But this is one are where a higher resolution screen helps a lot. So why isn't there a standard web-interface to the EPG data on my mediacenter. There's a great third-party program to do this, but why doesn't this work out of the box? Microsoft's own (add-on) solution is worse then the third party one and doesn't even work outside of the US.
  • Why isn't the EPG data up to date?
    The quality of the data in the EPG used to be really bad. For some channels we used to miss about 50% of the programs, because the data wasn't in the EPG. This has improved considerably since last year, but it still happens sometimes.
  • Failing recordings
    The mediacenter either doesn't start recording a show that it is scheduled to record. Or it records a few minutes, then stops, then starts again, then stops... you get the picture. The result is shows that I really can't watch.
    So I lied yesterday: I have missed quite some episodes of CSI lately. This is the biggest issue for us at the moment. All the other software issues are annoyances, but this one is making me think of unplugging my mediacenter. Or at least of re-installing it completely. I'd happily sacrifice the 40+ hours of recordings that are still on the hard disk to get it to function properly again.
I guess a lot of our problems have to do with the fact that we are early adopters. Mediacenter adoption has even now not taken off in full, so we should expect to find some "children's diseases" (that's a Dutch expression) in there. But on the other hand... if I buy something that looks like a VCR, I expect it to work somewhat like a VCR. I wasn't buying a beta version of some new application, at least that's not what it looks like. If something looks like a consumer electronics device, I expect it to work like one.

So that's the current story. As you can see it is really two-sided. On the one hand, having a mediacenter has really changed the way I watch TV. On the other hand our mediacenter has been a pretty constant source of frustration too. Let's just hope Microsoft cleans up its act in a next version of the Mediacenter software (the Vista version only seems to be somewhat better). Or let's hope that Apple adds a receiver to its Apple TV or the Mac Mini. I really hope for the latter, because a few more Macs would add some more technological styling to my living room. :-)

Saturday, June 16, 2007

Fifteen months of mediacenter and counting

We bought a dedicated VCR form-factor mediacenter 15 months ago.

It was definitely a lot more expensive than a normal desktop PC, but we decided to bite the bullet and see whether having a mediacenter was the complete paradigm shift that friends told us about. So far the experience has been like a two-headed beast. Or maybe I should say, our mediacenter PC has been behaving like a two-headed beast.

Our friends were right about it being a paradigm shift. As Americans have known since the introduction of the TIVO, once you get a PVR your whole TV watching experience changes. Since there's so much that changes, I'll make a list of it:

  • I never surf channels anymore.
    I do surf the electronic program guide (EPG) a lot in return though, searching for programs that I'd like to record. But somehow that feels like less of a waste of time. :-)
  • I record entire series, instead of just watching an episode.
    Can you imagine never missing an episode of CSI again? I can.
  • I hardly ever watch live TV anymore.
    When I feel like watching something, I just browse through the list of recordings. With on average about 30+ hours of recorded TV on the mediacenter, there's always something that I'd like to see. So the only things I watch live now are news and sports events.
  • Commercials? What are those?
    As soon as a commercial block starts, it's next-next-next-next.... then back a few seconds and I'm done. I can actually tell whether the show aired at prime time by the number of times I have to press next. And I seriously haven't watched more than 5% of the commercials I used to watch. Admitted, I might miss some very funny commercials. But then I'll see those on YouTube, instead of them interrupting my shows.
  • The quality of TV programs doesn't suck.
    I found out that there's actually a lot of good and fun programs on TV. Just not when I want to watch them. Or actually... they're now always there when I want to watch them.
  • It's the content that matters, not the channel.
    I really watch a lot of shows now on channels that I never used to watch. Then again, I watch shows now without having any idea of the channel I'm watching. Remember: I'm not surfing channels, I'm selecting a show by name from the list of recordings.
As you can probably tell, I like the mediacenter experience a lot. In fact, within months of buying it I was really certain that I would never go without having a mediacenter again. So what's up with the two-headed monster then, you're wondering? Well, that'll have to wait until tomorrow.

Wednesday, June 13, 2007

Leopards finder looks like a zoomable interface

Jef Raskin was a man with a vision. Many of the things he thought up, are still being implemented today two years after he died. That in itself doesn't make him a visionary. But the fact that these implementations are still considered revolutionary does.

Today I watched parts of Steve Jobs keynote at WWDC. What surprised me is how close the new finder interface is getting to the concept of the zooming user interface. The list of items in a can now be shown as a cover flow, which is really the same as the album cover flow in iTunes. And surprisingly (to me at least) it seems to work equally well when browsing documents and applications as it does when browsing album covers.

At first glance this looks functionally similar to the thumbnails mode of Windows explorer, with just a nicer rendering. But that superficial similarity goes away when you see that all the "covers" are live. This means that video files have a small HUD that allows you to play them. And while they're playing you can still scroll through the documents. And video is not the only thing, you can also flick through PDFs, browse through Excel pages, etc. All without ever leaving finder - without ever switching "modes".

Once you've found the document you like, a single press of the space bar zooms in on the document opening it in the Preview applet. And another key press closes it again and takes you back to finder. From preview it is just one more action to open the document it in its native application.

So everything is just a single key press away. And it all works seamlessly and -as I said at the start- reminded me of Raskin's zoomin interface.

Sunday, June 10, 2007

Incremental search using JavaScript

Aside from this blog, I am also the webmaster (and one of the contributors) on two photo blogs(one in English, the other in Dutch). I wrote the software for maintaining these photo blogs myself, because nothing at the time seemed to do exactly what I wanted. The upside of writing your own software is that it does exactly what I want. The downside is that if I want any new feature, I have to write it myself.

This weekend I added a simple incremental search feature to the administrative interface of the photo blogs. Nothing fancy, but just an easy way for the contributors to check for example when the last post on diaper cakes was or when we had the theme week on chocolate.

My solution is completely client-side using this JavaScript:

  • var TEXT_NODE = 3;
    var TIMER;
    var SKIP_ROW_COUNT = 2;

    function instrument(input, skipRows) {
    SEARCH_INPUT = input;

    if (skipRows) {
    SKIP_ROW_COUNT = skipRows;

    // listen to changes to the input
    input.onkeyup = input.onchange = startTimer;

    function startTimer() {
    // start (or re-start) the timer, only once it expires will we start the search
    if (TIMER) {
    TIMER = setTimeout("search()", 500);

    function search() {
    var term = SEARCH_INPUT.value.toLowerCase();
    var rows = document.getElementsByTagName("tr");
    // skip first few rows (optional author book, commands and header)
    var i;
    for (i = SKIP_ROW_COUNT; i < rows.length; i++) {
    var tr = rows[i];
    // hide row if it doesn't contain the search term = (term == "" || doesNodeContain(tr, term)) ? "" : "none";

    function doesNodeContain(node, term) {
    if (node.nodeType == TEXT_NODE && node.nodeValue.toLowerCase().indexOf(term) >= 0) return true;
    return true;
    var child = node.firstChild;
    while (child) {
    if (doesNodeContain(child, term)) {
    return true;
    child = child.nextSibling;
    return false;
As you can see it is pretty basic stuff. Set up some event handlers on the input, start a timer whenever the user enters some text and then do the search once the timeout expires. The search itself is done using some recursive DOM scanning. There's probably a cheaper way to do this and once I find that I'll update the script. But until then, this simple script will do just fine.

You hook this up in the HTML using:
  • <input onfocus="instrument(this, 2)" type="text">
The second argument to the instrument function is the number of rows from the top that the search should ignore. I tend to have some extra rows at the top that unfortunately don't all use th's, so this is the easiest way to exclude those from the search.

I know that putting inline JavaScript in the HTML is not very Web 2.0 and makes the site inaccessible. But since this is the administrative interface for the contributors and not the front end of the website, I think I can live with myself for not making it accessible.

Saturday, June 9, 2007

The twitter thing

I have so many online presences at social websites these days (Orkut, LinkedIn, Geni,, Hyves) that I thought I'd add another: Twitter. It has been getting a lot of attention recently, since it is apparently a great way to monitor where well known people are during conferences.

I've been putting my activities on Twitter for a few weeks now. And so far I'm not really sure what the benefit is, either for me or for others. That might of course have something to do with the fact that I've set my profile to be only visible to friends, of whom I don't yet have any on Twitter.

But what I see from Twitter currently is that it is yet another way for you to tell people what you're doing. It's pretty much like a mini version of many personal blogs. So lots of messages are of the type "at the grocery", "on the bus to work", "stuck in traffic", "having fun with Dunya and Desi", etc.

The problem is that I don't believe in most of those personal blogs. Some people might find it interesting to read about one another's love life or their adventures at work, I only care about that type of story when it's exceptionally well written. Which -unfortunately- doesn't happen very often in the blogosphere.

I'm not saying that this site isn't personal or that it's well written, because I indeed often share my personal opinion in a rant-like fashion. But at least occasionally I try to write something that might be useful to some people in the community, or some personal opinion that could be interesting to someone else but my loved ones. I'm not sure if I'm succeeding at those things, but I think I have a better chance here that at Twitter.

"Grabbing cup of coffee"

Oops, sorry. That of course should have gone to Twitter.

Tuesday, June 5, 2007

My modern dentist

Yesterday early in the afternoon I got a text message on my mobile saying:

  • Dear sir/madam,
    You have an upcoming appointment at dental practice xxxx.
    Kind regards, the team at dental practice xxxx
    Appointment: 06/05/2007 at 8:00 AM

I just love it when even classic practices like dentists start to use modern technology. Well ok, text messages are not exactly modern anymore. But still... I can imagine this reminder might help some people making their appointments when they'd otherwise forget.

Oh and by the way: no holes. Thanks for asking.

Sunday, June 3, 2007

JavaFX: it's for building rich client applications

Last month, at JavaOne, Sun introduced JavaFX to the world. Those following more closely had already seen this language under it's previous name: F3 - Form Follows Function.

I see a lot of blogs that put JavaFX in the same category as Adobe's Flex and Microsoft's Silverlight - even Jeff Atwood does so at his much appreciated Coding Horror blog. I must admit that I haven't looked at Silverlight enough to know whether that comparison is valid, but to me JavaFX is certainly different to Flex.

Flex is a tool for building applications that run in the Flash player in your browser, so called Rich Internet Applications. And although it is apparently a great language and tool to use, it hasn't gained widespread adoption. The reason for that is probably very simple: there are less obtrusive ways to reach the same goal. Ajax is the buzzword for these applications now and they're often much more intuitive to their users. But enough has been said about that on other blogs.

JavaFX is a programming language that was created to declaratively build Swing applications. If you've never programmed Java GUI applications before: Swing is a client-side library/framework for building GUI applications, much like Microsoft's old MFC framework, their more recent WinForms or Borland's VCL.

Note that the resulting application of any of these frameworks doesn't run in your browser, it runs on your machine as a stand-alone application. And that to me is the main difference between Flex and JavaFX. The former is a tool for building rich internet applications, the latter is a tool for building fat client applications.

Friday, June 1, 2007

This scrum? Or that scrum? Or that scrum?

This week I took a training that now officially makes me a certified scrum master.

Or wait... let's make it sound even more official: I'm now a Certified ScrumMaster! There, that looks a lot better. And geeky, with a camel-case word in it. But actually all it takes to become a certified scrum master is completing a two day training. Now the training wasn't bad, mind you. But I do feel that a certification should require some kind of exam. Especially a certification that claims you're a master in something.

One of the things that I really noticed during our training is the apparent difference between the way our trainer implements scrum in companies and the way I understood it from Ken Schwaber's books (on agile software development and on agile project management) and video (Google TechTalk on scrum).

I have the feeling that in Ken's approach the role of the Product Owner is much less involved than what we've been taught this week. And that the actual ScrumMaster role is a lot less intensive then what Ken suggests in his TechTalk.

The Product Owner role we've learned during our training was pretty close to what Toyota seems to call the Chief Engineer. And that's a term we can probably all imagine what it means. In my recent history it has been called: technical lead, technical project lead, technical team lead, principal developer and I'm probably still missing a few. The only real difference I see is that the Chief Engineer is empowered, meaning that he/she has the backing of management and is allowed to do the things necessary to get a product or project completed. But of course having a Chief Engineer somewhat dilutes the role of the scrum master whose major responsibility is guarding that the team really follows the process. With such a simple process, that should never be a full time job. Which Ken seems to suggest it often is.

Of course in scrum it doesn't really matter if companies implement it slightly different. After all, this is an agile process. So what's a little flexibility between friends. And I actually believe that this flexibility is what makes scrum work for so many companies. Have a little faith in the ability of your people to somehow work towards the goals that you set out for them. It of course depends on the people, but then again... that's what I already said a few months ago.

What this training mostly showed me is that it really matters a lot who helps you implement scrum in your organization. If Ken Schwaber would have taught us, we probably would come away with a "completely" different interpretation of scrum. Not necessarily better or worse, but definitely different. Now that is something that you might want to consider before you book the first scrum training for your company.