Monday, 31 May 2010

Ubuntu Robots

Eeep, I got up to level 16 on the Robots game on my wee Ubuntu netbook.

Its an old game, there was a Doctor Who version of it on the Amstrad CPC 464, from an Amstrad Action cover tape/disk. The basic premise of the Ubuntu version is you start at the centre of a 45 x 30 square playing field, upon which are a two types of killer robots, you take it in turns to move. You can move one square in any direction, the robots move either one or two square towards you. If they touch you you die, if they crash into each other they blow up and leave a pile of debris.

One each level there are 10 additional robots, so on level 16, that I arrived at last night, there are 160 robots, that is, one for every eight and a bit squares. It was pretty crowded.

I died after four moves.

There's not much of a strategy really, after a while it all comes down to chance, and to get to level 16 I was just very lucky.

Windscreenhenge

Went away to the countryside this weekend, out towards Salisbury to track down ancient monuments.

Sadly, I missed the turn off to our hotel and a few moments later, in very slow moving traffic, the back windscreen of my Smart Car shattered. Apparently it happens quite often in older model Smarts where the demister heating element has such a shape that stresses build up and then cause a catastrophic failure.

As Monty Python taught us with Mrs. Niggerbater, well, things explode every day?

Although, for me, it kind of put a dampener on the whole weekend. The weather was pretty shite too.

The insurance mob were unable to do anything speedily, what with Smart car back windscreens not quite being an 'off the shelf' part, and it being a goddamn bank holiday weekend so no one really wanted to scour the nation's car parts depots looking for the blasted thing anyway. So, instead we soldiered on to Stonehenge and after discovering that the entrance fee was £6.90, we went and had a look at Woodhenge instead.

Torrential rain soon followed, I patched up my back windscreen hole with Lidl cardboard and we retired to the hotel for Eurovision.

The next morning, under beautiful sunshine, I drove back to London with my tail between my legs.

Sunday, 30 May 2010

Diane Abbott on Andrew Marr

I've been asked to write something nice and supportive about Diane Abbott after seeing her on the Andrew Marr show this morning. She truly is my favourite choice for Labour leader, but only for narrative purposes, it would make the story of British politics rather fine.

Also on Andrew Marr was Iain Duncan Smith, I though he looked very much like a 1950's statesman, which was kind of a cool anachronism, although he's pinched his body language from Tony Blair.

Anyhoo, that Diane Abbott, whilst she was being interviewed I couldn't take my eyes off her hands, the way she was constantly picking at the nail on the third finger on her right hand, all through the interview, regardless of the words coming out of her mouth, just pick pick pick.

Whilst IDS was doing Tony Blair hand gestures, Diane was just pick pick pick.

IDS's body language tutor must have said in one lesson, emphasize points by using your hand, grasping motions, open gestures, rolling gestures, gestures, gestures, gestures. Drumming in the lesson. Diane must have missed that lesson. Probably busy with diversity training.

I've listened intently, dragging my eyes away from her nail-picking and it seems the over-riding message of her leadership bid, it isn't policies or dogma, its just that she's not white or male, so my narrative reason for supporting her is entirely reasonable.

Not that her reasoning is that reasonable. She may not be male or white, but she is an Oxbridge graduate, so she's just like all the other candidates and miles away from the vast majority of Labour supporters. Not to say that an Oxbridge candidate can't represent a non-Oxbridge constituency, just that it forever cancels out any argument about who can represent the views of who.

Back to her policies, I'm not sure what they are, although when on the Marr show she was discussing public sector cuts with Iain Duncan Smith, Iain Duncan had said something along the lines of how up north public sector wages had squeezed out the private sector so factory owners were finding it difficult to employ quality staff at a price they could afford, with the subtext of if there were public sector cuts up north, the folk could easily find new employment, albeit with lower wages.

Diane Abbott's response was that in her constituency the public sector was the biggest employer, the last factory in Hackney closed twenty five years ago, if people in the public sector were made redundant they wouldn't be able to find new jobs and hence increase the burden on welfare.

To my jaundiced ears it sounded like her constituents are unemployable wastes of space who only have their jobs so that they don't show up in job seekers allowance claimant figures. And they might as well just be paid to dig holes and fill them in again, anything to keep them off the dole.

All the more reason to sack the lot of them.

That said, if what Diane said was correct, then maybe their pay could be cut drastically, as there's little private sector employment to compete with, and so Hackey could provide better value for money for the taxpayer than Iain Duncan Smith's northern masses.

But no no, Diane's line was they Hackney's public sector workers shouldn't face cuts as they're unemployable, almost as if giving them jobs is charity.

**UPDATE**
That's just Diane Abbott's portrayal of her Hackney public sector constituents. Me, I think they're probably very employable but are currently trapped in a public sector wage trap. They'd be able to fulfill their creative potential and self-actualisation far better in the private sector, but taking a hit on their wages is just too much.

Her point about the last factory in Hackney closing twenty five years ago show a contemptibly poor understanding of manufacturing. it doesn't take a factory to make a factory, give me a dozen lads, a few soldering irons and an RS Components catalog and I'll give you a world-leading cutting-edge manufacturing company.

Saturday, 29 May 2010

On planning

I'm not a big fan of changing one's mind. Not to say its a bad thing, but it just belies poor planning. Sure if the situation changes, and new information becomes available, then changing one's mind is necessary, rather than doggedly following the original plan to certain doom.

For example if offered a cup of tea, where the alternative is no hot drink at all, then I'd choose tea. But if subsequently offered tea or coffee or nothing at all, I'd go for coffee. And then as a last minute change, offered tea, coffee or hot chocolate, I'd change my mind a third time and opt for hot chocolate. As everyone knows, hot chocolate is yummy.

Lets arrange these options in order of yumminess:-
1. Hot chocolate
2. Coffee
3. Tea
4. Lying in bed scratching one's arse.

So, as these option became available be changed our mind several times so as to reach the ideal situation.

But then, imagine if you will, the "Well you can make it yourself" nuclear option. To process it, lets re-arrange the four options into how much faffing/washing up is involved:-

1. Lying in bed scratching one's arse - No faffing or washing up
2. Tea - one tea bag to dispose of, spoon and mug to wash up
3. Coffee - ground coffee to dispose of, spoon, mug and cafetiere to wash up
4. Hot chocolate - milk to source and dispose of empty, mug, spoon, and sauce pan with burnt on milk to wash up.

We can clearly see that yumminess and faff/washing up are inversely proportional, and given the initial satisfactory state of lying in bed scratching one's arse, as more and more options become available we change our mind each time, and eventually end up back at the initial state with no hot drink, but rising levels of frustration.

I'm sure this is how politics is, just look at the progress of ID cards in the UK over the last
ten years.

It doesn't have to be like this though. If the initial proposition had the appropriate quality of information, all the options offered and the "Well you can make it yourself" subclause, then no changing of mind would have to happen at all, no rising levels of frustration, just a leisurely scratching of one's arse in bed on a Saturday morning.

Wednesday, 26 May 2010

Back in the shirt

Its been an odd eighteen months, redundancy, unemployment, volunteer work, crap job, unemployment and now pleasant temping.

I'm in an office, essentially pressing buttons until computer screens and printers go right, then putting bits of paper in order. I'm wearing a shirt and optionally a tie, and whilst this isn't quite the captain of industry role I thought I'd find in London, its all right.

The digital radio in the corner is telling me not to worry about a thing, cos every little thing is going to be all right.

The drive to work in the morning is averaging around 45 minutes, and to get home its around double that. To get trains and buses, it would be more expensive and an hour and a half either way.

The pay is a lot better than the sandwich factory, the hours are sociable and the work involves databases and makes London a better place.

Occasionally, I'm driven out to areas of wasteland to prod around with tape measures and count trees.

Its turned out nice again.

I'm wondering if I did something wrong eighteen months back and somehow I could have ended up in a nice job like this a lot sooner, did I just wander into the wrong agencies, fill in the forms wrong. Or was the credit crunch/recession as bad as I can blame it, things just turned out this way through no fault of my own.

Elsewhere on the internet Dirty Vicar uploaded some old photies of the last Bowie meetup from 2008, friends from a now closed down internet forum. There's still Facebook and Twitter, but the threads connecting us are frayed and stretched. Every so often I notice folk missing from my Facebook friendslist, acquaintances severed, no great loss, we were never that close, but still that old world becomes a little bit smaller.

Maybe its just me, getting further and further away from the man I used to be, Glasgow, Bowlie, popscene.

I went along to MJ Hibbett's Totally Acoustic thing at The Lamb on Conduit Street last night, I arrived in time to catch the last ten minutes of his latest Dinosaur Planet show. It was great, with rapid costume changes, new songs and jokes, it was like a Lew Stringer comic strip made flesh. Kind of sad that I missed most of it.

Then again, I've been to loads of the Totally Acoustic shows. Maybe that's not enough for gig-going and social, its a Red Queen kind of thing, you gotta run as fast as you can just to keep up. And I've been slacking.

Its been months, maybe years, since I went to HDIF, and I've never been to Crimes Against Pop, or dozens of the newer promotions that people I used to know have been putting on.

Must try harder.

Now the unemployment issue has been resolved, I can get out more.

Saturday, 22 May 2010

Python text document stats script

Desperately I spend the last three weeks refreshing my knowledge of Python, the easy peasy scripting language I'd once used in my youth to test CD players and hi-fi RS232 commands. I re-acquired Dive Into Python and Python For Dummies and ploughed through.

Sadly I didn't get the job I was learning it for, but instead refired my enthusiasm for learning programming languages. So, I've acquired Learning Perl and when that is done I'll be trying my hand at Ruby, just like the cool kids use.

I wrote me a wee program in Python that analyzes the text file of my 2001 novel Shag Times and comes up with various statistics for it.

I plan to re-write the same program in Perl as soon as I've finished reading Learning Perl, and then write the same program again in Ruby if that's even possible.
### Program to do the following
### * open shagtimes.txt
### * provide a word count
### * count unique words
### * provide top ten most popular words
### * provide all single occurance words
### * calculate average word length
### * find longest word

import textwrap

# Opening Shag Times and processing it a bit
book = open('shagtimes.txt')
book = book.read()
book = book.lower()
### Code to remove punctuation
stuff_to_replace_with_space = (".", ",", "?", "/", "=", "-", ";", ":")
stuff_to_remove = ("\'", "(", ")", "\"")
for item in stuff_to_replace_with_space:
book = book.replace(item, " ")
for item in stuff_to_remove:
book = book.replace(item, "")
print "======================================="

# Doing the word count
book = book.split()
wordcount = len(book)
print "The document contains %i words in total" % wordcount
print "======================================="

# Doing the unique count
uniques = []
for item in book:
if item not in uniques:
uniques.append(item)
uniquecount = len(uniques)
print "The document contains %i unique words" % uniquecount
print "======================================="
uniques.sort()

# Finding top ten popular words
print "The top ten most used words:-"
occurancelist = []
for item in uniques:
occurances = book.count(item)
occurancelist.append((occurances, item))
occurancelist.sort()
occurancelist.reverse()
for item in occurancelist[:10]:
print item
print "======================================="

# Finding single use words
print "Words that were used only once:-"
singleuse = []
singleusecount = 0
for item in occurancelist:
c, w = item
if c == 1:
singleuse.append(w)
singleusecount+=1
singles = ""
while singleuse:
for item in singleuse:
singles = singles + (singleuse.pop()) + ", "
singles = textwrap.wrap(singles, width=70)
for i in singles:
print i
print "======================================="
print "A total of %i words were used only once" % singleusecount
print "======================================="

# Finding average word length
chartotal = 0.000
for item in book:
chartotal = chartotal + len(item)
avechar = chartotal/wordcount
print "The average word length was %.3f letters long" % avechar
print "======================================="

# Finding longest word
longlength = 0
for item in uniques:
if len(item) > longlength:
longlength = len(item)
print "The longest word was %i letters long" % longlength
print "These words were that long:-"
for item in uniques:
if len(item) == longlength:
print item
print "======================================="

Can someone recommend me a good book for learning to program in Ruby?

Friday, 21 May 2010