The Programming Bible

In the beginning God created the heavens and the earth.

Now the earth was without form and void, and darkness was upon the face of the deep, and the Spirit of God moved over the earth. And God said “Let there be light”, and there was light. God saw that the light was good, and used it to produce the green screen.

And it came to pass that man would begin to program in assembler. But God saw that His deadline included a seventh day for rest and His project would slip. And thus God created FORTRAN in His own image and saw that it was good.

And FORTRAN did begat FORTRAN I. And FORTRAN I did begat ALGOL. And ALGOL did live for a great many years, whence it was a good father – for it did begat CPL and BASIC and PL/I and Pascal. And CPL did give life to portable code in the form of its descendant C. And BASIC did begat many programming careers with the BBC Micro. And PL/I did provide Ian with a career in PL/X. And Pascal did provide many an undergraduate with their first assignment.

Yet ALGOL also did begat Simula, and thus the earth became laid waste with object-oriented programming.

With C, the earth was good, but sin crept in and it did tempt programmers with the forbidden fruit of inexpensive computational power. And thus His programmers became lazy and listened to the serpent Simula and did spawn the devil’s incarnation in the form of C++. Thus God was downcast in their profligacy with their use of expensive runtimes.

Yet man did continue to spurn the Lord and used the evil of C++ to produce Java. And thus man did claim it to be as fast as C, yet the Holy Trinity were blinded by marketing when man re-wrote RPC using XML. And thus Java did begat Web Services.

Here endeth today’s lesson.

Typical!

Just at the point where I have loads of ideas for blog entries, I go and lose my internet connection. Last night saw the death of my trusty D-Link router. No final fanfare, no friendly “goodbye packet”, just a silent disconnect and steadfast refusal to do any more data exchange. That’s rare for two reasons: (a) routers very rarely fail anyway; and (b) it failed during steady-state power-on status – these sort of things normally fail at power-up due to thermal shock.

After a fruitless trip to Novatech in Portsmouth (including an 8-mile detour down the M275 due to a missed exit), I decided to bite the bullet and go to PC World where I would spend way over the odds just for the convenience of walking into the store.

Except that I managed to pick up a decent Linksys (i.e. Cisco) router for just £40 – that’s twenty less than the same out-of-stock model in Novatech. So I’ve saved £20 on the router, but spent a tenner on diesel.

Configuration of the WAG54G2 router was easy and it looks unfortunately stylish, given that it’s going to be stuffed away on a high shelf for the rest of its life.

For an extra bonus point, I was expecting this to be expensive, but I don’t seem to be able to find it much cheaper on the web either. PC World: everything you stock is no longer overpriced; only some of it.

E-mail Fix and Disk of Doom

We returned home on Saturday having spent a nice long week away in the North East with parents – hence no blogging. Unfortunately, I’ve been without e-mail since Tuesday because something had broken with my PC at home (which manages my e-mail and runs 24×7). That meant I’ve been without my e-mail fix for about 5 days now. 🙁

I first noticed something was wrong when I couldn’t connect with my usual webmail access. My mini-ITX PC fetches my mail and stores it locally, which I can then access from wherever I am in the world via a web interface. Something broke with this and I couldn’t work out what it was without physically accessing the machine: I couldn’t get any sort of remote access and being the security-conscious type that I am, there’s no “back-doors” to the system.

Unfortunately, on returning home I find that the PSU for the USB external drive on my mini-ITX PC has given up the ghost. It’s a laptop-style brick power supply, which is now failing to give any output. That meant the machine wouldn’t boot at all. I tried taking the disk from the external enclosure and installing directly into my mini-PC, but that had its own problems.

Normally the system boots off a CompactFlash card, which then passes control to the USB storage device. Now the USB storage device was missing, but the bootstrap on the CompactFlash card didn’t have the necessary modules to boot from an internal drive. The disk itself had an old, old version of the bootstrap code, which meant I could boot the system (of sorts), but it meant I couldn’t access anything USB or network. So that was a catch-22 situation. The only system I could successfully boot was running a kernel for which I had no modules available.

I’ve finally now fixed things by creating a new bit of bootstrap code and booting from the hard disk using all-sorts of mkinitrd hackery. At least the system is now up and running, if not necessarily exactly how I wanted it.

Pico PSU

As part of my ongoing Mini-ITX hobby project, I decided that it needs to be quieter because it lives in Lucy’s bedroom and is powered-on 24×7. With today’s energy prices, I also wanted to make sure it was as low-power as possible.

The existing PSU was the one supplied with the case: an already low-power (110W) job with a single quiet fan. The motherboard itself is a fanless-design Epia SP from VIA. There were also two small (40mm) fans in the case to keep some airflow moving because of the standard-size DVD writer and a belt ‘n braces 80mm fan to keep things nice and cool elsewhere. The fans were software controlled based on CPU temperature, but they still ran about 20% of the time keeping things cool.

I decided to have a re-think and get rid of the DVD writer – I can always create the ISO images on the Linux machine and then transfer them to my main PC for writing at a later date. That’s a huge power drain gone (upto 31.5W peak). Taking the fans out dropped power consumption by another 2W.

I also decided to ditch the original power supply and bought a picoPSU. This is a nifty little device which is tiny and plugs directly into the motherboard ATX header. As you can see from the picture below, there’s very little to it and crucially, no fans in sight. The main thing to note is that it’s tiny. Two 50p pieces would easily cover it. The whole unit is powered by a “brick” which is a bit like a laptop power adaptor: again a fanless component.

 picoPSU

It arrived the other day and later that night I took the system apart and after some fiddling, installed it into the case. The DVD writer was removed, along with the power supply, the three redundant fans. Even for such a small case, there was a lot of room. The other surprising this was that I found the whole PC was so much lighter than I had been expecting.

Anyway: time for the big test. I plugged everything in (minus a monitor: it never uses one anyway), pressed the power switch and some lights came on, but nothing seemed to happen. Bugger: I must have got a faulty one. And then the system beeped it’s usual happy POST complete beep. Eh?

Ah yes: I’m so used to building regular PCs I was used to various fans spinning up and hard drives whirring into action. The whole mini PC boots Linux off a 256MB compact flash card, with main storage on an external USB hard drive. So with a fanless motherboard, fanless PSU, and no hard drive, the thing is totally silent. It’s a little unnerving at first to build a PC which is completely silent, but I was suddenly very happy with how quiet things were.

It’s been running continuously for over 2 days now and the internal CPU temperature is quite happy hovering around the 52C mark – up slightly from 43C previously. That might sound high, but it’s well within the standard operating temperature guidelines. Overall, power consumption dropped from 32W to 21W. In real money, that equates to a saving of about a tenner a year in electricity.

Now We Can Measure How Geeky Things Are

I’ve only just discovered the Google chart API. Now the acronym “API” has already sent 40% of my readers scattering for cover, with another 45% disappearing once I point out API stands for Application Programming Interface. Stick with me here, because it’s one of the fundamental keys to modern computers.

Actually don’t.

I started with the best of intentions, but then ended up trying to explain the concept of an API to non-programmers and it got a bit long. Maybe someday I’ll go back to revisit that, but until then you can see below how I’ve used the Google Chart API to produce a nice pretty chart. Enjoy.

Sample Google Chart API call

1 2 3 4 7