Author Archives: Damo

New toy: HP ProLiant DL360 G4 Server

I haven’t posted for a long time, so I thought I’d write something about a purchase I made recently.  I decided to grab myself one of these:

Considering the incredibly low prices they are available for and the relative power; I couldn’t resist.  It’s not as erm… swish… as a Mac, but it is at least packing some decent specs:

  •  2 x Intel Xeon 3.00 GHz Processors with HT
  • 8GB of DDR 2 RAM (A disappointing 400MHz but still, can’t complain)
  • 2 x 36GB HP Hot-Swappable Ultra320 SCSI 15000RPM HDDs
  • Redundant power supply
And it set me back all of £96 on eBay UK.  Delivered next day for an additional £6.
What I’m actually going to do with it is another matter entirely – so far, I’ve downloaded Ubuntu 10.04 LTS for Desktops (yes, desktops, because I would actually like to use it as a PC while my other machine isn’t in the same place as me).  Ubuntu works quite well on it – I was impressed that there were no driver issues at all, it had the drivers for the SCSI controller (once I actually got them to appear!) with no messing about required.

I even managed to install a Belkin Wireless 802.11G network card and get it on my home network – another affront to the server form factor – but hey.  That took a bit of work to get it installed and running – especially considering with the backplate screwed to it, it didn’t actually fit in the 1U server form factor PCI slots.
Ultimately, I hope to subtly manoeuvre my server into the CompSoc rack at University – sneaking it in won’t be easy though – it’s heavily defended by overly-nostalgic nerds and squatted by cheap “AMD Duron” powered boxes left over from the early 00′s.

I did have one issue – early on, I couldn’t get the installers of any of the Linux distributions I tried to see the drive.  Later I realised that I couldn’t even see the disks in the HP Smart Array Manager.  After endless searching, I came across an article on the HP website that offered a simple solution.
It appears that after repeated insertions of the SCSI drives into the slots at the front of the server, the SCSI backplane can become disconnected from the motherboard and need reseating – a simple problem with serious consequences involving the drives showing the “failed” indicator – an ominous sight for any sysadmin.  In any case, a quick push down of that black connection solved the issue and the two drives popped up in the HP Smart Array manager – sweet.

 I know it’s an old piece of junk, big, loud and power hungry, but it’s a really powerful bit of kit for such a low price, restricted only by the slow RAM modules and the lack of space internally for any expansion to make it more… PC-like.
It does have some nice Out-Of-Band management features – the HP iLO (Integrated Lights Out) system allows easy management of the server, diagnostics, power control and more via a nice (but distinctly 2005) web interface.
I don’t know what I’ll end up doing with it – installing it in the CompSoc rack sounds like a good idea if I can persuade the nerds to part with their age-old 3U UPS that has been whining for new batteries for the past 2 years (and for which the batteries are no longer manufactured).
Fat chance.

Brainfuck Revisited: Turing Machines

At the risk of attracting too much attention to the reoccurring use of the “f” word on my blog, I have decided to pursue yet another BF-related project.

During the writing of my last post, I noticed how well BF could be used to define the behaviour of Turing Machines.  A turing machine is essentially a simple conceptual machine that consists of the following:

  • An infinitely long tape of cells that each contain a value.
  • A “head” that can be positioned over any given single cell.
The “head” can read or write from the value it is positioned over, and the “behaviour” of the machine dictates how it manipulates the values on the tape (if at all!).

I decided to build a little web application with two ideas in mind – firstly, to create a nice IDE to visualise Brainfuck development better.  Secondly, to implement a Turing Machine that uses Brainfuck as it’s behaviour definition language.

If you’d like to have a play then here it is.

Brainfuck Turing Machine

Brainfuck Turing Machine - My attempt at creating a better Brainfuck experience. If there is such a thing...

The web application I came up with is essentially a Brainfuck parser similar to the one I wrote before in PHP, but with a tape-style visualisation of the pointer slots.

Changes I’d like to add in future are a speed control for the parsing and perhaps a small ID for each cell to make debugging your BF “applications” (ehem…) easier.

Until next time! (And I promise the next post will be rated “U” for all audiences).

PHP Brainfuck Interpretation

It’s been a long time since I posted! I have now started back at university, moved in to a new flat and also moved this blog to the UK version of The Rackspace Cloud.  The latency is much lower to the server now and there is far less lag in SSH and other services.  Anyway, on with the randomness…

A good friend of mine, Ste, recently reintroduced me to  Brainfuck.  For the uneducated (and right now, probably offended), Brainfuck is an extremely lightweight and minimalistic programming language.  It’s really designed to be a muse for programmers that are bored as far as I can tell.

In any case, after playing around with it for a while, I thought I’d have a go at writing a PHP implementation of the interpreter. In fact I wrote two implementations, a lovely OOP-style one, and also a really short minified one to see just how small I can make the interpreter.

The first implementation I wrote is the OOP version.  It’s a bit over-complicated and full of itself but hey – isn’t all decent programming that way.  You can check out the source in my work repo - http://work.damow.net/work/

The more concise version of my interpreter (also downloadable from the work repo link above) is not exactly written with human readability in mind.  It still works fine however.  Essentially it is a function that takes a string of Brainfuck program characters and optionally an array of input byte values (read by the , character in Brainfuck).  All in 441 bytes of PHP.  I know I know, I’m just cruising for some pro to come and blast me out of the water with a 50-byte beast, but it’s the trying that counts!

<?php function p($p,$i){$p=str_split($p);$d=array();$o='';$c=$p[0];
while($c){if($c=='+')$d[key($d)]++;if($c=='-')$d[key($d)]--;if($c==
'.')$o.=chr(pos($d));if($c==','){$d[key($d)]=pos($i);next($i);}if($
c=='>')if(!next($d))$d[]=0;if($c=='<')prev($d);if($c=='['&&pos($d)=
=0){$l=1;while($l){$n=next($p);if($n=='[')$l++;if($n==']')$l--;}}if
($c==']'&&pos($d)){$l=1;while($l){$n=prev($p);if($n==']')$l++;if($n
=='[')$l--;}}$c=next($p);}return $o;}?>

In terms of future developments, I was thinking during my chat with Ste about Brainfuck that rather than try to expand the language by adding more characters to the command set (which I think would take away a bit of the charm from the language), one could add more functionality by mapping high-range pointers to other outputs, for example pixels on the screen to provide graphical output.  It would be really nice to write a Brainfuck workshop suite to provide functionality like that, but I don’t like to linger on one project unnecessarily for too long.

I’ll try to post more regularly, and make my posts include less of the “f” word in future, I promise.

Laters

Things I miss about Snow Leopard

I recently upgraded to Mac OS X Lion.  After my glassy-eyed initial impression of the shiny new features (I’m not making a good impression on behalf of the stereotyped Mac user here am I?) I found myself rather let down.

A lot of the swish and subtle user interactions we have grown to love in Snow Leopard have rather disappointingly disappeared from Lion; they’re not massive features like Dashboard or Launchpad, rather small, hidden, subtle yet surprisingly useful once you get using them.  And now they’re gone.

1   Among the first few I noticed was the Lozenge – that’s the little grain-of-rice shaped blob that appeared in the top right of most Mac OS X windows.  It used to show and hide any toolbar associated with the window, neatening up UIs when you weren’t going to use the toolbar for a period of time.

Lozenge

Lozenge - RIP

Continue reading

Damo in NYC – Part 3

I have just returned from the closing awards ceremony of the Microsoft Imagine Cup 2011 here in the wonderful city that is New York.  I can’t even begin to describe how much of a rush the last week has been.  I have met some amazing people, made some great friends, got some excellent networking done, seen some incredible projects and ideas put in to action and I can’t wait to have an opportunity to do it all again next year in Sydney, Australia.  The entire experience has left me full of excitement and energy that I feel I can focus on putting some more of my own ideas in to action myself, coding some great new projects using the technologies that I have learned about and putting in to use some of the hardware that Microsoft has kindly gifted to me (along with all, yes all of the other finalists).  I refer of course, to the Microsoft Xbox Kinect device that I am positively itching to get plugged in to a PC and to start writing some wonderful fun code for.

Flying the Flag

Flying the Flag - The flag of the United States of America flying high above Ellis Island

I feel like I need some time to relax before I can properly reflect on how incredible the week has been, but I’ll do my best to sum up some of the general sentiments of the competition.  The ultimate message that has come over to me is that it genuinely does not matter how your team fairs in the competitions; here at the Imagine Cup, everyone is a winner (despite the fact that at least among the UK guys that has become a colossal cliché).  I want to make it clear to everyone reading that once past the initial sting of disappointment upon not hearing your name and country called out by the guys on stage, there are no bitter feelings left behind at all – just being here is more than enough to put a smile on your face.

Kevin's Presentation

Kevin's Presentation - Our "1-Man Army" Kevin making his final round Embedded Development presentation

Every single person at the Imagine Cup finals has achieved something incredible already – we are working to change the world for the better, to bring solutions to the world’s biggest problems.  It’s not about money or companies or start-ups or anything else – at the core of it, we’re here to make the world a better place – and the teams that have that at heart are the teams that do the best here – I’ve seen that first hand.

NYC Skyline

I'll leave you with this wonderful NYC Skyline

I hope that next year we’ll have an even stronger project to bring to the Imagine Cup 2012 UK Finals and that I’ll be writing another post with a similar tone about the upcoming world finals in Sydney.  Although the UK entries didn’t achieve winning positions this year, we’re not disgruntled and certainly not discouraged, we plan to hit next year with a driving force to change the world, after all – that’s what it’s all about.