An apology


I feel that I must apologise for the blog post yesterday. Readers with long memories will no doubt be feeling short changed by the way that I failed to meet their appetite for new, relevant articles and recycled an old one from 16 years ago.

I’m not the kind of person who fill his blog with old posts from way back. But I am the kind of person who fills his blog with apologies for posting old posts from way back.

Maybe tomorrow I’ll apologise for this post…..

Magic from the Wayback Machine


If you think that the current internet is a bit of a time sink, try taking a look at the past one.

I’ve been playing with the wayback machine, which has been carefully salting away copies of my deathless prose for around twenty years or so. I’ve just lost a big chunk time reading stuff I wrote ages ago. But some if it I rather like. Take this one, about debugging and magic that I wrote on 25th September 2003.

The Power of Magic

Been thinking about debugging (as one does). Debugging is what you do when the program doesn't work. Or works but does the wrong thing (nearly the same problem). The thoughts were prompted by a magic show on telly a few days ago. They showed the 50 best magic tricks (for which the number one was David Copperfield being chopped in half). Debugging a program is a bit like figuring out how a magic trick works. When I watch a magician setting up a trick I always want to jump up and go "No! That padlock is fake. There's an open link in the chain, you're hanging from a wire and that solid case you're going on about has got a trap door at the bottom. Oh, and what's that up your sleeve? And how come your assistant is twins?"

You get the picture... If everything the magician tells you is true, the trick must be impossible. This means that at some point he is telling you whoppers.

Broken programs are just the same. Something somewhere is not how it should be. Some part of the system is lying to you. This means that you debug the same way that you find out from a magician how a trick works; asking "Is the chain real?" etc etc.

Saying "It should work, I dunno why it doesn't" is tantamount to saying that you believe in magic. What you must do therefore is test all the things that you are assuming are true. "I know that this contains the customer number..." Really? How do you know? Did it start off with that number and change? Did the system that delivered the number send something else? Is the range of the numbers what you are expecting? And so on.

The worst thing that can happen is that you can end up convincing yourself that everything is OK. In that case you have what I call a "reality fault". And you start to believe in magic. At this point you have to resort to desperate measures:

  • First thing you do is walk away from the problem for a couple of hours. Often you will think of the answer; how the trick was performed. If that doesn't work, explain the trick to someone else. Two times out of ten you'll think of the answer during the explanation. One other time out of ten the someone else will tell you how the trick is done, or ask a question which changes how you view the problem: "Do you think he might have a fork lift truck in there somewhere?" or "What if the guy from the audience is in on it?".

  • Next thing you do is fiddle with the system in stupid ways. This is like asking the magician to perform the same trick, but using an elephant rather than his assistant. You might spot something this time. Send in completely invalid data. Send in lots of it. Send in lots of the same thing. This quite often gets you some behaviour which lets you track down the problem.

  • Then get the magician to do the trick in slow motion and freeze frame. Step through the code. Put in print statements. At some point you may well spot where your program does something it is not supposed to - and there you are at the solution.

  • Finally, run the trick backwards. The great advantage that a magician has is he knows how the trick will end. The audience doesn't. You can often figure out how it was done if you start from the result and try to figure out how to end up there. It is the same with debugging. Try to think how it could have ended up with that result.

  • OK. If you've done all that and it still fails you are in the one time out of a thousand where magic might actually exist. In this case you change the documentation and abracadabra! Your bug is now a feature! Failing that it is probably time to re-write the code.....

Making a Useful SatNav

satnav loop.jpg

I’ve been moaning about SatNav software for years. It is getting better though. My latest car displays a map that contains 3D renderings of the car parks I’m failing to find a way into. Very useful. Of course it also has a habit of getting the lane guidance wrong, which makes for amusing antics at roundabouts every now and then, but I guess nothing is perfect.

One thing that struck me as I was threading my way through the rain-soaked streets in Reading tonight was how the navigation software proudly displays the names of the streets I’m supposed to turn into. I think this is a bit of a waste of time. Only a local would actually know the street names, and they probably wouldn’t need to use a SatNav. And as for using the street names to confirm your navigation, that’s a bit of a non starter bearing in mind how hard these things are to find and read. What I really wanted was useful directions like “Turn left in front of the pub” or better yet “Follow that blue Prius”.

Actually, having thought about it, “Follow that blue Prius” is just about doable. I sat in a Tesla that could discern the vehicles in the traffic around me and finding their make and colour wouldn’t be too tricky. Link that up to the SatNav and off you go. Hmmm. Perhaps I should patent this.

Then again, once we have cars which are that clever I guess we might just get them to do all the driving and navigation themselves.

Super secure wallet


A while back I went into a clothes shop and bought something that fitted me perfectly. It was a wallet. It was half price, but since my old wallet had reached the point where my money might start escaping of its own accord, I thought it was a bargain.

It was sold as super secure because it uses special material to stop radio signals getting at the cards inside it. The idea is to stop sneaky people tapping into your bank balance by the use of portable contact-less card readers.

It works too. Last week I was trying to open en electronic lock and it didn’t work. I usually just wave my wallet at the door and it opens, but with the card in my super secure new wallet this failed to work.

I’m now pondering on whether super security is worth a loss of convenience….

Stupid Train Tickets


Every now and then I do something that I (but probably nobody else) think is rather clever. Like using both cores of an ESP32 so that a display keeps running when the WiFi is used to updated it.

And every now and then I do something that everybody thinks is rather stupid. Like last week. A while back I subscribed to an alert to tell me about the release of cheap train tickets. I wanted to get a day trip to London which would cost less than a flight abroad.

So today when I woke up and checked my phone I was pleased to see an alert that I could order some tickets at a massive discount. Mindful of the fact that lots of other people had received this message and there would only be a few seats as these prices I booked my trip and paid for it in double quick time. Clever me.

However, any feeling of smugness evaporated when I discovered that rather than buying day returns from Hull to London I had in fact booked day returns from London to Hull. Idiot me. I put my mistake down to the early hour and undue haste. The tickets are non refundable, and must be used with an, ahem, senior railcard, However, if you are old, live in London and have a desire to spend a day in Hull then it is just possible that I could sort you out.

iPod Classic Blast from the Past


I got out my old iPod Classic today. It still works, and it is still only half full.

And it is the only way that I can listen to some of my music. For example, take the album “Futurenow” from Go West. Good stuff. I bought it ages ago.

Unfortunately I didn’t actually “buy” it though. I got it from Apple iTunes, loaded a copy onto my iPod and got on with my life.

And then, for some reason, the licencing arrangements seem to have changed. Although Apple Music thinks I’ve got the album it presently only provides access to two tracks. Very annoying.

I can probably do a music match thing to add the missing music to my collection, but to do that I need to have the original files. And they are presently on my iPod and nowhere else. Very annoying. I’ve been looking at sneaky software that can pull the music files off an iPod, but so far I’ve not found anything that is guaranteed to work. Oh well.

Bolt Mystery Solved


Yesterday I went to a wedding and found a bolt in my trouser pocket. Very strange. Today I remembered why. The last time I wore my suit was at a Humber Care Tech Challenge communications event near the Humber Bridge. Because it was supposed to be posh the suit came out. Then, on the way back I stopped off to buy some bolts for holding air quality sensors to lamp posts. The one in my pocket was the pattern that I took along to make sure that I get ones that match.

Dead Dot Matrix


Dot matrix printers eh? You leave them standing for a year and then when you go to use them again they don’t work.

In retrospect this was a bit silly. And my joy in finding that I could get complete set of inkjet cartridges for a fiver may have been misplaced as they might have gummed everything up. I’ve narrowed the fault down to the print head or something else. A replacement print head (which may or may not fix the problem) can be obtained for around twenty five quid. So the question is: do I spend the money on a new print head or do I throw the printer away?

Vinyl Memories


My turntable belt arrived today, so I can now play my records again. I grabbed a few from the loft and fired them up. A few things sprang to mind:

  • you seem to have to do quite a bit just to play a record. There’s a lot of faffing around for 20 minutes of music. This is of course the inspiration behind my difficultifier of days gone by.

  • the sound is surprisingly good for a what a really primitive way of storing and retrieving sound

  • I really need to get myself a record cleaner

Having said all this, it was rather nice to hear all these sounds from the past.

Humber Street in Hull is Lovely

There is some rather nice artwork on the buildings

There is some rather nice artwork on the buildings

The weather in Hull was glorious today. We spent a goodly amount of time wandering down Humber Street looking for somewhere nice for lunch. Loads of choices, we went for Bert’s Pizza at the end which turned out to b a splendid choice. If you want to see what the future of life in Hull is really going to be like you should really go and take a look at the Fruit Market area. There’s just so much going on, and it is all nice.

Jelly belts


Number one son has discovered the joys of vinyl records. Today I thought I’d relive some of my youth and got my record deck down from the loft. Turns out that the drive belt has turned into a kind of jelly. Ugh.

Fortunately, through the magic of Amazon it turns out you can still get belts, and even the stylus, for my elderly Panasonic deck. The order went in today. Nostalgia beckons…

Always take some toys to meetings


Today I had a meeting about Connected Humber CIC. We are trying to spread the word about what we are doing. I took some toys along, including the prototype Air Quality sensor and my Air Quality Top Hat.

This turned out to be a real win. Everyone was very impressed (or very polite). I reckon you should always have some toys to show off when you are trying to impress. This doesn’t mean you should push them into everyone’s face as soon as you start, but that if the conversation turns to “What have you made then?”, it is really nice to be able to pull something out of your bag.