Thanks to everyone

It’s been a very trying and tiring day, going to work at 8:00 and just getting in at 21:10.

I’ve been seeting up today for the Shropshire skills fair in Telford, taking out the newly christened “Aberystwyth Field Robotics Group” for an exhibition. Mark, Fred and myself have spent the afternoon setting up for the lots of visiting school children in the next two days.

It was very nice to get home and find so many messages of congratulations on my facebook wall, it helps a little towards easing having to be driving to Telford at 06:00 for the next two days.

I’m just really looking forward to FOSDEM at the weekend.

Arduino model railway control

I’ve been playing with a couple of Arduinos for the last week, and doing some physical computing, interfacing with real devices from the microcontroller. It’s been interesting doing some low level electronics again, and it was a great feeling about half an hour ago to have the model railway running under computer control – using the laptop to send commands over the USB port to the Arduino, which then does PWM to control the speed of the train.

There were a few hiccups along the way – not least of which the Arduino crashed repeatedly when the train started moving – it appears that the power pack I was using didn’t like having its load being PWMed, causing voltage problems. I resorted to running the Arduino off the USB supply, disconnecting the common 12V power input to the board, and just using that external power pack to provide power for the direction change relay and output to the loco. Make sure that you keep the ground connected though, as the Darlington TIP120s need that to be common in order to work.

The eventual use for this project is to automate the model layout in the Corris Railway Museum, and allow visitors to put coins in a slot and the train will then run for a number of returns depending on the coin put in. More coins – the train runs a little quicker. The software allows for reed switches at either end of the line for reversing, as well as reed switches for stations.

The hardware driver circuit is shown here in the schematic below (I know it’s pretty rough, but it’s as good as I can do at short notice), and photo of the really dodgy looking breadboard prototype.

The diodes are 1N4004s and the caps are 0.1μF to protect against reverse current from the inductive loads.

MRCC1Breadboard MRCC1

Computer Errors – in Haiku

Three things are certain:
Death, taxes, and lost data.
Guess which has occurred.

Everything is gone;
Your life’s work has been destroyed.
Squeeze trigger (yes/no)?

Windows NT crashed.
I am the Blue Screen of Death.
No one hears your screams.

Seeing my great fault
Through darkening blue windows
I begin again

The code was willing,
It considered your request,
But the chips were weak.

Printer not ready.
Could be a fatal error.
Have a pen handy?

A file that big?
It might be very useful.
But now it is gone.

Errors have occurred.
We won’t tell you where or why.
Lazy programmers.

Server’s poor response
Not quick enough for browser.
Timed out, plum blossom.

Chaos reigns within.
Reflect, repent, and reboot.
Order shall return.

Login incorrect.
Only perfect spellers may
enter this system.

This site has been moved.
We’d tell you where, but then we’d
have to delete you.

Wind catches lily
Scatt’ring petals to the wind:
Segmentation fault

ABORTED effort:
Close all that you have.
You ask way too much.

First snow, then silence.
This thousand dollar screen dies
so beautifully.

With searching comes loss
and the presence of absence:
“My Novel” not found.

The Tao that is seen
Is not the true Tao, until
You bring fresh toner.

The Web site you seek
cannot be located but
endless others exist

Stay the patient course
Of little worth is your ire
The network is down

A crash reduces
your expensive computer
to a simple stone.

There is a chasm
of carbon and silicon
the software can’t bridge

Yesterday it worked
Today it is not working
Windows is like that

To have no errors
Would be life without meaning
No struggle, no joy

You step in the stream,
but the water has moved on.
This page is not here.

No keyboard present
Hit F1 to continue
Zen engineering?

Hal, open the file
Hal, open the damn file, Hal
open the, please Hal

Out of memory.
We wish to hold the whole sky,
But we never will.

Having been erased,
The document you’re seeking
Must now be retyped.

The ten thousand things
How long do any persist?
Netscape, too, has gone.

Rather than a beep
Or a rude error message,
These words: “File not found.”

Serious error.
All shortcuts have disappeared
Screen. Mind. Both are blank.

Program aborting:
Close all that you have worked on.
You ask far too much.

Your file was so big.
It might be very useful.
But now it is gone.

Chip and pin just as fallible as old system?

A Guardian article about how chip and pin is not really any more secure than the old system, and the only change is that banks are now not paying claims, instead blaming the card owner for giving their cards and pins out. Their argument – you can’t copy these chips!

The article raises some important security concerns. Also, do you believe that reported card crime is down, now that you don’t report it to the police, the bank does that for you after they decide if it’s worth reporting?

And rather than make another post, I just have to link to this article about airport and airline security, and how completely absurd the whole thing is.
Personally, I fell that they’ve already won, by getting us to allow our government to take away civil liberties, whilst most of the voting public either encourage it, or just lay down and take it.
One of the comments near the top of the page, made by a pilot who is also subject to these security checks puts it quite succinctly:

Let’s think about something. I am in my pilot uniform and going through security and about to fly an aircraft and passengers from point A to B. I and my co-pilot will be sealed in the cockpit in front of a security door that cannot be opened from the outside. I will have in my hands the only “lethal” weapon used on 9/11, – the control yoke. So just what is it the TSA is checking me for? A gun? A knife? What? If I had been recuited by ‘the bad guys’ do I need to carry ANYTHING lethal? Of course not! Therefore, I should not have to go through security at all!

What do you get from your ISP in India?

50 days in the slammer if you’re unlucky!

Lakshmana Kailash K. who is described as a 26 year old techie was arrested and held for 50 days. Apparently he was fingered by google and his ISP for posting unflattering pictures of Chhatrapati Shivaji Maharaj, who is apperently a revered figure in India on orkut (google’s social networking site). Google coughed up the IP address, and the ISP traced it back to his account. Unfortunately they got it wrong somewhere, and he was released 50 days later when the caught the real culprits.

The UK apparently still has a way to go to erode freedom of speech to level in India – but I think the politicians are taking leads from various places. 😉

http://www.cnet.com/8301-13739_1-9811569-46.html

Model-View-Controller song lyrics

Model-View-Controller lyrics

I’m reposting them here – the song appears to have a habit of disappearing, and these lyrics are too good to lose:

Model, View, Controller
Lyrics and music by James Dempsey.

Model View, Model View, Model View Controller
MVC's the paradigm for factoring your code,
into functional segments so your brain does not explode.
To achieve reusability you gotta keep those boundaries clean,
Model on the one side, View on the other, the Controller's in between.

Model View � It's got three layers like Oreos do.
Model View creamy Controller

Model objects represent your applications raison d'�tre.
Custom classes that contain data logic and et cetra.
You create custom classes in your app's problem domain,
then you can choose to reuse them with all the views,
but the model objects stay the same.

You can model a throttle in a manifold,
Model level two year old.
Model a bottle of fine Chardonnay.
Model all the twaddle stuff people say.
Model the coddle in a boiling eggs.
Model the waddle in Hexley's legs.

One, two, three, four.
Model View � You can model all the models that pose for GQ.
Model View Controller

View objects tend to be controls that view and edit,
Cocoa's got a lot of those, well written to its credit.
Take an NSTextView, hand it any old Unicode string,
the user interacts with it, it can hold most anything.
But the view don't knows about the Model:
That string could be a phone number or the words of Aristotle.
Keep the coupling loose and so achieve a massive level of reuse.

Model View � All rendered very nicely in Aqua blue
Model View Controller

You're probably wondering now.
You're probably wondering how,
the data flows between Model and View.
The Controller has to mediate,
between each layer's changing state,
to synchronize the data of the two.
It pulls and pushes every changed value.
Yeah.

Model View � mad props to the smalltalk crew!
for Model View Controller

Model View � it's pronouced Oh Oh not Uh Uh
Model View Controller

There's a bit more on this story,
a few more miles upon this road,
well nobody seems to get much glory
writing controller code.
Well the model is mission critical
and gorgeous is the view,
But I'm not being lazy, but sometimes it's just crazy
how much code i write is just glue.
And it wouldn't be so tragic,
but the code ain't doing magic:
it's just moving values through.
And I wish I had a dime
for every single time
I set a TextField's stringValue.

Model View � how we're gonna deep�six all that glue
Model View Controller

Controller's know the Model and View very
uahh � intimately
They often are hardcoding
which is very verboten for reusability.
But now you can connect any value you select
to any view property.
And I think you'll start binding,
then you'll be finding less code in your source tree.
Yeah I know I was astounded,
that's not even a rhyme.

But I think it bares repeating
all the code you won't be needing,
when you hook it up in IB.

Model View � it even handles multiple selections too
Model View Controller

Model View � hope I get my G5 before you
Model View Controller

Yeah, yeah, yeah. Yeah.

Excel 2007, 65,535 displays as 100,000 and testing

From Risks:

According to a *NY Times* blog (Pogue’s Posts), Excel 2007 for Windows doesn’t cope properly when multiplying two numbers that should yield 65535 (http://pogue.blogs.nytimes.com/2007/09/27/a-big-excel-boo-boo/).
Instead, it gets 100,000.

For a very nice explanation and discussion of its relevance, see Joel Spolsky, Joel on Software blog http://joelonsoftware.com/items/2007/09/26b.html

Have a look at Joel’s blog, and pay especial attention to the talk about testing – the fact that the bug appears to be in the presentation layer, and the testing is probably going to take results from before the presentation layer kicks in.

One more thing occurs to me. If there is this sort of bug that happens on 12 out of 18446744073709551616 possible cases, and it has only just been found, how many more are out there?