You can't say that you weren't warned.
(Click on the image to zoom.)
So, what does my desk say about me?
I recieved my copy of the 2nd edition of The Python Cookbook yesterday, too. Nice to see my name in print, however miniscule my contribution. Nice to get a free copy, too. ;-)
I've not had much chace to look through it yet, but it looks interesting. The new chapters on generators, descriptors and metaclasses look particularly useful. More later.
Mum came down on Tuesday night for a visit. She met up with Steve and I at The Alex, which was nice - they've been reading each other's blogs for ages. Steve was much as she expected, except that she "didn't expect him to be such a sweetie".
Well, that's a first. Steve being called a sweetie, that is - Mum calls people sweeties all the time.
Anyway, as usual, Steve and I sorted out all the world's problems over a few pints, with Mum's assistance this time. And as usual, some bugger screwed it all up again by morning.
Then we went to The British Museum. Amazingly, Mum's never been before. As ever, you can only see a tiny fraction on any one visit, so we concentrated on the Asian section. If you've ever visited Mum's blog, you can't help but have noticed that she has more than a passing interest in Buddhism.
My post to the Python for Kids thread is something I've been meaning to get around to with Freja for a while. She's only eight, but the's confident with and facinated by computers, so I thought that giving her a go wouldn't do any harm if I didn't push her.
So far, she's having a blast. At first, she just drove the turtle around, changing its colour on the way. But towards the end, I suggested that she make a square, and she managed that easily enough. I'll have a bash at loops with her soon, but I really don't want to overload her.
There was another script that I knocked up for her that she had fun with, first just running it, then making simple modifications:
your_name = raw_input("What's your name? ")
if your_name.lower() == "freja":
print "You're very stinky,", your_name
print "You smell lovely, ", your_name
She worked out for herself how to replace 'freja' with 'daddy'. Ah, simple pleasures. ;-)
Note to self: Check out PyLogo.
Michael Spencer's code limerick is, well, I don't think that superb is too strong a word. It's not just that it's a limerick itself, it's what it outputs that makes it so cool.
Yes, I know; I really need to get out more.
Surprisingly enough, my last review wasn't allowed to stand, so I had another one today. I didn't come out of this one quite so well. ;-)
They aren't going to sack me. Too much paperwork, apparently.
It wasn't too bad, though. I was brought up on my admin, as I was expecting. They are keen on the fact that I try too keep the company up to date, but I need to work a lot harder to getting buy-in from the team, too.
I'll be getting a new PC ;-) But not a Mac. :-(
There might be - shudder - public speaking training coming up too...
I've just been accused of looking like a geography teacher.
There's me saying that I'd be happy to see the back of lambda, and the effbot goes and posts ElementPlist, a beautiful use for them. Nothing there you couldn't do without lambda, but not so elegantly.
He only does it to make me look stupid, you know. ;-)
Now if someone can just help Tim to put the files up on Sourceforge, we'll be in motion. ;-)
Check out Google Code. Google is open sourcing some cool stuff. First featured project: PyGoogle, a Python wrapper for the Google Web APIs. There are RSS feeds, too, so you can keep up to date with what they are up to.
The last meetup went very well, from what little I can remember. I'm organising another for April the 13th, again at The Stage Door. Pythonistas (or is that Pythoneers?) and the Python curious all welcome.
My Mum and my sister have really taken my holiday problem to heart, and have organised a whole bunch of stuff for me to do. So much, in fact, that for the first time in several years, I've actually had to go and buy a diary to remember it all. I've just send off a holiday request for 18 days to El Presidente.
(This has the additional advantage of getting me out of Salsa yet again. That's now postponed to April the 12th.)
Oooh, a nice big pile of books has just arrived:
Guinness St Patrick's Day to all my readers, if any.
Guido's thinking about ditching lambda, reduce(), filter() and map(). I don't use any of them, so I'd be quite happy to see them go, and the proposed product(), any() and all() functions look really good.
I'm with Peter, though - they shoudn't be builtins. We have enough of those already. I seem to remember the martellibot proposing a reductions module at some point. That would be a much better place for them - and for sum(), for that matter. Not only would that avoid bloating the builtins, it would also help to avoid the problem of people already having objects named 'any' or 'all'.
Last night's Roar With Laughter was, uh, interesting.
Chambers & Nettleton were, well, rubbish. Perhaps it's just me - I really can't stand comedy songs.
Tim Vine came on for a brief 10 minute set. He wasn't on the bill, and the material was a bit rough. I think he was just using us to try out some new stuff. He's welcome to do so again - he was fantastic.
Johnny Candon's set was very funny, but rather uncomfortable. He asked if there were any parents in the audience, and I was the only one to respond. He proceeded to interrogate me for several minutes about my family history, my children, my relationships and my ex's relationships for what felt like ten minutes (but was probably only a minute or two) in front of sixty or seventy people. Still, very funny, though, and when he asked another audience member if she was a "proper nanny, or a shaky nanny", it was one of the high points of the night for me.
Sarah Kendall; well, what can I say? She pretty much died. She got off to a bad start being heckled about the size of her watch(!) before she'd even started, and she never really recovered. It didn't help that half the (generally good natured) heckling came from a Scot whose accent she didn't understand. And at one point she was accused be being an aggressive racist. The 'aggressive' bit was just absurd, and I really don't believe the racism accusation to be fair, either. She might have been a little naive in her choice of language, though. So, Sarah, on the million to one chance that you read this, here's a couple of rules to keep you out of trouble.
Anyway, it was a good night on the whole. Well worth a visit.
Tube closure bombshell. Bugger. That's going to be inconvenient, to say the least.
Update: Well, that's the Colliers Wood residents' view covered, then.
This is so cool that I'm going to have to do a straight steal from Edward: "The rubber duck can be referred to informally as a rubber duckie or a rubber ducky. Amongst collectors of rubber ducks, the spelling rubber duckie has achieved prominence, but both spellings are considered acceptable."
The Wikipedia's Random Page feature is a real time waster.
Mexican police are being forced to read books: Mexican officers brought to book. What a fantastic idea. There are a few books I'd like to force some of my cow orkers to read...
To name but a few.
My entire team is
malingering off sick today. Every single one of them. (OK, with the exception of Tulna, who's off on holiday.)
That means I'm in charge. I've already raised the purchase order for a speced-up 15" PowerBook, and I'm doing my review this afternoon. I think I might come out of it rather well.
I have no idea what it is that they all do together to spread the bug, by the way, but clearly I'm being left out of it.
Update: I've done the review. It turns out that I'm an exemplary employee, with virtually no faults, save for a tendency for over-modesty. A promotion and a very large pay rise are in order.
Last night's Python meetup was a blast. I still haven't sobered up. We had nine people at one point, which was pretty good. It ended up with Edward, Chris and I drinking Mojitos until stupid o'clock at Cubana, watching a couple of rather cute girls playing some rather good salsa.
I didn't get home until half past two. :-)
If you were there, please leave a comment so I know who you all were...
I might give the traditional kebab on the way home a miss, though...
I picked up Firefly the other weekend, on DVD. What can I say? Andy was right, I was wrong. Firefly is the best TV Sci Fi I've seen in years. Believable characters, good actors, an interesting setting and a promising plot. It's a real shame that they cancelled it - I really would have liked to have seen where it would have gone.
Buffy was still rubbish, though.
Time for a Manhattan Project to combat global warming. I would have linked to the original article if it wasn't behind a paywall.
I don't like it much, but I have to agree with Lord May - in practise, we need to go nuclear. I mean, yes, in theory, if we adjusted our lifestyles enough, and invested enough in renewable power, we could do without it, but I really can't see it happening.
Can you? Really?
While I'm posting silly little Python scripts, here's one I prepared earlier.
def inc_string(string, allowGrowth=True):
'''Increment a string.'''
CHAR_RANGES = [
Bunch(from_char=48, to_char=57), # digits
Bunch(from_char=65, to_char=90), # upper case
Bunch(from_char=97, to_char=122), # lower case
string_chars = list(string)
string_chars[-1] = chr(ord(string_chars[-1]) + 1)
for index in range(-1, -len(string_chars), -1):
for char_range in CHAR_RANGES:
if ord(string_chars[index]) == char_range.to_char + 1:
string_chars[index] = chr(char_range.from_char)
string_chars[index-1] = chr(ord(string_chars[index-1]) + 1)
for char_range in CHAR_RANGES:
if ord(string_chars) == char_range.to_char + 1:
string_chars = chr(char_range.from_char)
raise ValueError, string + " cannot be incremented."
The story behind this one is that I was building a database conversion utility, converting both schema and data from one database engine to another. Thing was, the target database only allows 10 characters in its table and column names. (OK, actually, it doesn't - but it's a whole lot easier to access if you stick to 10 characters.) I stripped down the longer entity names by removing whitespace and spacing characters, then non-leading vowels, and at the last resort, I truncated.
This worked on the whole, and the column and table names were not a great deal less readable than an RPG programmer is used to anyway. ;-) But I was getting the occasional duplicate, so I came up with this.
"Letís assume that youíre reasonably competent, reasonably coherent, and reasonably mature." Oh dear.
Software Patents in the EU. A Bad Thing.
The shuffle the lines of a large file thread on c.l.py reminded me of Richard Papworth's superb Cookbook recipe, Retrieving a line at random from a file of unknown size. The wonderful thing about this recipe is that the file only needs to be read once, and it doesn't need to be kept in memory, but every line in the file has an equal chance of being selected.
I came up with a quick hack that allows the selection of multiple lines, but it soon occurred to me that this approach is far too pretty to be restricted to files - you can do the same with any iterator:
def random_items(iterator, items_wanted=1):
selected_items = [None] * items_wanted
for item_index, item in enumerate(iterator):
for selected_item_index in xrange(items_wanted):
if not random.randint(0, item_index):
selected_items[selected_item_index] = item
You can run this over a file;
random_items(open(file_name)), but you can also run it over any other kind of iterator.
This is in Python of course, but I don't see any reason why you couldn't implement this in any language that has iterators.
Fuller version with kind-of-unit-tests: random_items.py
BTW, how do you unit test something that gives random results properly?
Update 10th March: Faster initial allocation of
Doughnut jam and keyboards - not a good combination.
Not of course that there's any problem at all with my keyboard. Oh no. But Tulna's off on holiday this week, and I suppose there's always the outside chance that her keyboard (which is co-incidentally identical to mine) may be a little on the sticky side when she gets back...
I'll be the one with the tin of Spam. See you there...
I saw End Of The Century: The Story Of The Ramones this weekend. It was superb. If you are even slightly into The Ramones, or rock in general, you need to see this. These guys didn't just play punk, they were punk. Tap will never seem the same again...
It was part of a double bill at The Clapham Picture House. The other half was Coffee and Cigarettes, but that went so far over my head that I didn't even feel the wind. There was one obvious theme to start with - people talking but not communicating - but that seemed to tail off towards the second half, and all I was left with was a bunch of unconnected short films with a few shared lines. Some of it was funny, but I'm sure that I missed the point.
But deciding upon Java is only the first step - you need a whole bunch of stuff to go along with it. One of our recent projects was intended to be a pilot, and I was fairly happy with the toolset that we used for that, so mostly we'll be updating that list.
In the end, though, we ended up not using Hibernate and not using Struts - we wrote our own. This time, I'd like to use frameworks for these layers rather than building our own workable but time consuming and frankly far inferior versions.
Hibernate looks by far the front runner for the persistence layer, but selecting the MVC framework isn't so easy. Struts is certainly the de facto standard here, but I'd like to be using Spring for other things in any case, and I gather that its MVC component is really good, so I lean towards using that too.
Good idea? Bad idea?
There are a few other additions to the original toolset:
Anyone think that we shouldn't be using any of this stuff? Anything essential that I'm missing?
You can see why they were concerned - prior to the scare, they had a superb reputation. I mean, complicity in genocide-or-is-that-just-crimes-against-humanity is pretty trivial stuff, right?
The Cradle Rocks, via boing boing. The AC/DC For Those About To Rock Tee is nothing short of brilliant. I only wish they did stuff big enough for my girls. Ella, in particular, says that she wants to be a punk when she grows up - thanks to School of Rock.
Anyone know where I can get a Ramones tee-shirt for a six year old?
Update: More punk kid's tee shirts - UK based.
As if the British honours system wasn't in enough disrepute; Microsoft's Gates being knighted. What next - a posthumous lordship for Robert Maxwell? A Nobel Peace Prize for George W. Bush and Tony Blair?
(And yes, I know that Henry Kissenger already has a Nobel Peace Prize. Satire is dead.)
Channel 4 is running a poll to decide which of the UK's vilest buildings should be demolished. The Tower in Colliers Wood is currently topping the poll.
I walk past The Tower (or The Brown and Root Tower as long-time Colliers Wood residents still call it) at least twice every day. And it's true - it is hideous. But it's been there for as long as I can remember, and I've lived in Colliers wood, on and off, since I was four. I remember using it to find my way home when I was lost. So, I have a funny kind of affection for the thing.
Besides, there's just about zero chance of it actually being knocked down - it would take out the tube line beneath it if you just blew it up - so it's all a bit of a waste of time really.
Yet another meme.
"Copy the list on to your blog, put in bold the ones you have listened to (completely from begining to end) and then add three more albums that you think people should have heard."
Sgt. Peppers Lonely Hearts Club Band - The Beatles
London Calling - The Clash
Blood Sugar Sex Magik - Red Hot Chilli Peppers
Think Tank - Blur
This is Hardcore - Pulp
Moon Safari - Air
Elastica - Elastica
Never Mind the Bollocks Here's the Sex Pistols - Sex Pistols
OK Computer - Radiohead
The Kiss of Morning - Graham Coxon
Ziggy Stardust and The Spiders from Mars - David Bowie
The Wall - Pink Floyd
Setting Sons - The Jam
America Beauty - The Grateful Dead
Toxicity - System of a Down
Train a Comin' - Steve Earle
Folksinger - Phranc
Come From the Shadows - Joan Baez
Bat out of Hell - Meatloaf
The River - Bruce Springsteen
The Very Best of Joan Armatrading - Joan Armatrading
Copperhead Road - Steve Earle
Dark Side of the Moon - Pink Floyd
Brothers In Arms - Dire Straits
Outside - David Bowie
Passionoia - Black Box Recorder
Version 2.0 - Garbage
Too Young To Die (Greatest Hits) - St. Etienne
Via badly dubbed boy.
Coming in to work on a badly overcrowded and very slow running tube with a nasty hangover is no fun, I can tell you.
But last night was a good one.
It looked like it might get a bit nasty at one point. We used a back room that had been booked by a bunch of performance poets. Java nerds versus poets - what a rumble that would have been.
In fact, we just moved to the front of the pub, where I remained undefeated on the pool table.
Oh, and don't forget the Python meet up next week...
The Internet went missing today. It's only just come back - hence no posts today.
I think the sys-admins eventually found it under the sofa.
Update Wednesday 2nd: This was it - Redbus power failure - companies form group to voice concerns.