Hello World, H2D2 style

Now that my experimental programming language, H2D2, includes the all important server part, I thought that I'd better record an example of the traditional 'Hello World' program:

Although these programs are very trivial, it shows that I can now do H2D2 programming from my browser. It's the server part which compiles the source into bytecode and then executes the program in timeslices. So the actual code is running inside the server and we're just seeing the output in the browser (alongside the source code of course). Since I recorded this in a coffee shop before work this morning, the H2D2 server was running locally inside Xcode on my Mac, for convenience. But I would be able to do the same thing even if the server was running elsewhere, like on my TP-Link router.

Considering that the whole H2D2 language is written in C, I think that's pretty good going. It seems reasonably fast and I don't even think I have the compiler optimisations turned on. Obviously there is a little bit of JavaScript doing the HTTP posts between the browser and the server. But I really do need to write some better code examples, which should be things that don't involve the Mandelbrot set for a change...

UPDATE: one of the "better code examples" I mention above can now be seen here.

Linux Voice and Elementary OS

It’s been many years since I’ve regularly read a computer magazine. But I miss those days really, I’ve not got anything against reading computer magazines, but I’ve not seen anything in a long time that catches my interest. But it’s nice to read something and then say to yourself “umm, I’d like to try that out for myself”.

Well, I suppose I do casually read the MSDN Magazine in electronic format, but I’m doing that because it’s part of my work, not because I’m doing it for fun. And I do still read articles on Dr Dobbs.

Anyway, after seeing the Linux Voice magazine mentioned on the Raspberry Pi blog some time ago, I have been reading every issue. This is something that I choose to read for fun, and I continue to look forward to each issue coming out.

But reading this magazine has resulted in me trying out lots of different distros. I have seen that there is a lot more stuff out there that I haven’t tried yet. So my old laptop has taken a bit of a hammering because I keep flattening it and reinstalling something else.

But … for a while, this may have changed. Because I’ve tried Elementary OS. I am very impressed. For me, it hits the right balance between looking really nice, and not hogging all my CPU cycles to achieve it. I can still run it on slightly older hardware and it works fine.

After installing, and without very much hassle, I found myself watching BBC iPlayer in Chromium, listening to music in the Spotify Linux client and writing some notes in the ReText markdown editor. But I was also enjoying the experience. I spend all day switching Operating Systems (every day I use Mac OS, Linux, Windows, iOS and Andriod), but after a few hours on Elementary OS I was thinking to myself “yeah, I reckon I could use this all day”.

So Elementary OS is the first one that I don’t really want to uninstall. I’m comfortable with it. I hope that feeling lasts. I have an old Desktop PC sitting around, I may install it there too.

I love it when a plan comes together

So recently, several of the different things I have been messing about with have come together. This was always in the back of my mind, but I didn't really know how long it was going to take. Recently, I have been working on:

  • building my own webserver (dweb)
  • cross-compiling for Linux on a TP-Link router (with OpenWrt)
  • ...and my own experimental programming language (H2D2)

Now I have bean able to bring all that together, what it means is that I can run H2D2 programs on my little TP-Link router. At the moment, I'm doing it through jQuery Ajax calls. So the programs are sent to the router with an HTTP POST from an ajax request, the router runs the program remotely and then returns the output back to the browser. Nice.

Here is a screenshot showing it all in action:

Woo-hoo... it works! Oh, and apologies for the partial ASCII Mandelbrot, I really can’t help it. The next experiment will probably be to do what H2D2 was actually designed for, namely to run a program partially on the router and then finish off the same program instance on some other platform. Then, I should be able to bounce a single program between the router, a Raspberry Pi and a desktop, which will be a neat trick.