Thursday, June 25, 2009

Heathrow to Suvarnabhumi

Went to the gate as soon as it was announced. As with the rest of T3, it was a zoo, this time full of teenagers or young twentysomethings all off to, as far as I could tell, Thailand. Not really surprising I guess, given the airline and destination: Thai Airways flight TG917 London Heathrow to Bangkok Suvarnabhumi.


The best thing, in fact the only good thing, about getting to the gate early, is that they did early boarding for Royal First, Royal Silk, and people with gold cards. Business class is Royal Silk, and that's what I was booked in, thanks to having forked out ~£500 and half the miles I'd spent the best part of 3 years accruing with BMI. I always feel privileged and lucky to fly in such comfort, but yesterday this feeling was topped up with a significantly high amount of snobbish fuck-me-glad-I'm-not-in-the-same-cabin-as-those-fuckers. Early boarding gave me the opportunity to stride past them with a huge sense of superiority (or, OK, shuffle past them, a little put out by all the "why's he going up when they've called the posh people only?" stares I was getting). Either way: win.

Upstairs on a 747 is so cosy. Every time I've been there (once with Cathay Pacific, a few times with BA, and now once with Thai) I've loved it. It's kind of better than business class because it's such a private cabin, in which you never see anyone else. I felt out of place. Not in a I-don't-belong-here kind of way -- I got over that ages ago -- but more in an "oh, everyone else is Thai, and the staff are speaking Thai, and in fact the staff and the punters all seem to recognise one another" kind of way. I think there were only 2 non-Thais, me included, amongst the 26 passengers. Eek! So there's no reason why this should really have surprised me at all, it just felt more ... foreign, than, say, Singapore Airlines or Cathay Pacific.

I certainly didn't see what was so funny about the guy dishing out champagne having a Chinese name, but it caused semi-uproar among some passengers.

My bag didn't fit in the overhead compartment. I blame Jeremy Kyle. In fact it almost didn't fit in the one between the seat and the window either, and JK had to come out so I could squash it in. In the compartment behind that one I spotted 3 huge Boeing 747 Schematics manuals. Ace.

Aircon was either off or broken. It was sweltering. I had a couple of orange juices and a very cold hot towel (which also happened at the end of the flight) and settled down to check out the entertainment magazine. Unfortunately mine only had the cover, not the actual pages. Oh well.

The entertainment system -- including the giant projector screen at the front of the cabin -- was stuck in soothing music and map display mode while everyone boarded. Much better map than on BA, including the 3D pilot view of win (though, sadly, not an actual camera out from the cockpit). And while I had to make sure my seat remained upright with my footrest folded yadda yadda yadda for take-off, I availed myself of the in-seat massage button. It lasted AGES. I'm sure someone else I flew with in 2006 has a similar thing. Cathay? Qantas? Someone in that part of the world.

The headphones Thai give out are SHIT. Really really bad. I had to have the volume at maximum to have any chance of hearing all the dialogue in Frost/Nixon; after half hour or so I gave up and plugged my own in, and the difference was astonishing. It's only a pair of £30 noise-isolating JBL things, but bloody hell. I turned the volume down to almost the minimum from then on!

Frost/Nixon itself was preceded by a short video about wellbeing in the air. All that stretch your legs, roll your neck, draw circles with your ankles, etc etc stuff. Presented by a wacky cartoon character called STAN THE EXERCISE MAN. A real "what the fuck?" moment, that -- but not as bad as the laughable dubbing in the film itself, where Kevin Bacon clearly says "fuck" or some other disgraceful curse. What I heard was someone completely different, about an octave higher, say "If you cheat us on the 60 per-cent" before KB took over the rest of the sentence. AWFUL.

Didn't see all the film. Fell asleep. Saw the ending, not sure how much I missed though, I think about half hour. A combination of being really tired, not having had much Diet Coke, and the Thai business class seat being preposterously comfortable meant I actually, for the first time ever, didn't see a complete film on a long-haul flight. I tried to watch Anchorman -- which the system said is 191 minutes long, really!? -- and fell asleep half hour in, waking up as it was finishing... so I started it again, and did exactly the same thing. FAIL. Or alternatively, win, since sleep is actually what you're meant to do.

Ah yes, the seat. It goes flat, but not 180 degrees, so there's a real sliding-forwards danger. I avoided that. It also felt comfortably wider than BA's business class seat. I could look up the actual seat pitch etc, but instead I'm going to go "yay, I'm smaller than I used to be!", or something.

At about 7am UK time, I felt a buzzing in my pocket. It was my phone's alarm going off. Oops. By "my phone", I mean the second handset I've brought with me, having bought a Vodafone SIM just before so I can do texts and calls in Australia for a pittance. At home it had been sitting on the side with its battery out, but now that it's back in it remembered there was an alarm set... and it wasn't on silent mode. Thankfully I caught it before, as far as I could tell, anyone else noticed. Though they may have noticed the fat western bloke flinching like crazy and playing with a mobile phone. The upside of this incident was that, well, it woke me up, around 5 minutes before the crew were going to anyway: it was time to serve the pre-descending-into-Bangkok meal.

I've turned the alarm off now.

The cabin crew were wearing different uniforms when serving breakfast. What the hell? Seems like a lot of effort to go to. Sure you might want to change into something fresh, but something actually different? Nice touch I guess.

When the staff were making an announcement, the monitor said PA IN PROGRESS. Without much of a gap between PA and IN. My leg's fine, ta.

Wednesday, June 24, 2009

Surbiton to Heathrow

My cab turned up on time. The driver even knocked on the door! Nice bloke, drove a strange route but got me there quickly enough. Heathrow T3 is a fucking ZOO, and strange things were afoot at entrance D -- people just wandering up and going in, but one special queue for one airline in particular, not sure which. Maybe Etihad?


Anyway it's a horrible, shabby terminal. I checked in at the Thai business desks which used to be the Singapore Airlines desks -- I know because Ruth checked in there last year. I'd already done it online, with baggage, all the way to Australia, despite the website telling me last night I hadn't done the second leg.

The first security question I was asked was "have I asked you the security questions?". Nice. Got directed to Lounge B near gate 11 after the formalities were over. She'd said "You know where the lounge is?" to the bloke in front of me, but not to me, just straight out with the directions. Possibly he had status with Thai Airways on his boarding pass, but more likely he looked the part while I don't. BASTARDS.

Up to departures and another scrum. Fast track was merely faster track. In 2006 I had this down pat -- all metal out, shoes off, laptop out, straight through, bingo. These days I'm clumsy and stupid: dropped me laptop, prepared to take shoes off without noticing that no-one else was doing it (ie, we didn't have to), and I left the m2-to-USB-stick adapter in my pocket which set the bloody alarm off. Grr. Tiny little thing had to go through separately again while I was putting my belt back on.

Sent a message to twitter (and therefore Facebook) before I even got the lounge. As if anyone expected anything different.

This lounge has self-service beer -- like all* business lounges. Better yet, this lounge has self-service beer taps. I've been in one like that before, the AAdmirals Club in Tokyo Narita. That was better, in that I was allowed a beer when I was there. But I'm on antibiotics now and being a good boy. Bah.

Cold food. The little potatoes of varying colours in the potato salad are olives. And we have to eat with plastic fucking cutlery! At least there are cheeses. Diet Coke from a tap, not mixer-size cans, is an improvement over many lounges. My laptop still works (for now?). Despite epic extra emergency expense of last few weeks (sparky, health treatment, € exchange rate at Hellfest) a tiny part of me was hoping it was broken, as an excuse to buy a VAT-less new Macbook Pro in Dixons Tax Free. But that would have been financial suicide: I don't have a job, nor the means with which to live without one for longer than a couple of months. Less, if I'd bought one. This thing'll have to do until I get a job offer.

Yesterday the doc said "not ideally" when I asked if I can have a drink while on these thrush pills. That's not an outright refusal, right? And she at least said I could have one or two on my birthday. Would it be really bad if I had one or two between now and then? Possibly. It is, frankly, stupid to chance it. I have shit skin and a skin issue for which I am being medicated. Best carry on being the good boy.

Best go. Laptop says 19 minutes of battery life left, and history tells me it means I WILL DIE ANY SECOND AND YOU WILL LOSE EVERYTHING YOU'VE WRITTEN. Forgot the plane-socket-adapter too, so this is it 'til Bangkok probably. Oh well. Maybe I'll go have a dri...FUCK IT.

Friday, June 12, 2009

Doing shit offline

I was just thinking it was cool that I'm already the 3rd hit, at the time of writing, for "do shit offline" when searching on Google. But then I snapped out of it. Yes, my generation game post yesterday was about websites, but not all software engineering is about the web. The stuff I bang on about needn't spit out HTML or PHP or anything of the sort. I have an mp3-fixer-upper (mentioned below) which spits out a shell script. That's because these are just software engineering techniques (patterns, if you will) for generating lots of similarly structured output from minimal input: lots of unique data, but comparatively few templates.

I work as a software engineer whose career has mostly led him to working with websites; I do not work as a web developer. And despite currently being on the dole, I figured I might as well pimp some software that helps with doing shit offline, huh. These are 2 projects I've been intimately involved with as both developer and user.

r3

Yahoo!'s r3 is ostensibly an internationalisation/localisation tool, but to my mind its real power comes from the fairly complex, at first glance, inheritance path concept. This brings object-oriented techniques to file generation, and there's the key word: r3 is first and foremost a file generation tool. In go templates, out come files.

I was one of the core engineers on the team which developed and maintained r3's predecessors, which were internal CMS tools at Yahoo!. I had fairly heavy involvement in some of the architectural and design discussions and decisions made during r3's genesis, and was the sole internal customer representative at the team's first "next steps" planning etc session 18 months later. I'm quite a fan, even if the public docs aren't quite up to scratch.

pork.py

This is something I knocked up in Python in the last couple of months. I even blogged about it before. So much for "don't repeat yourself", huh? It's a simple script which marries YAML to a template, and creates some output. The output can be STDOUT or a file, and 4 template engines (of sorts) are supported. It's meant to be standalone, but deliberately usable as the central pivot of a get-some-data, produce-some-output, put-it-somewhere pipeline. In fact, when used this way you don't even need YAML - just a couple of python dictionaries. See my mp3-fixer-upper for an example of how.

Thursday, June 11, 2009

The Generation Game

Let me tell you a story (or "lie", if you prefer). In 3 acts.

Act 1

I live on a roundabout. Like that bloke who lived on a roundabout, or the fella from Parliament Square. And I'm famous. People come up to the roundabout from one of the 5 roads, and before they make their way round it they ask me my name. But I'm mute, so I have to write it down on a sign for them and hold it up. They read it, and go on their way, so I throw the sign away. But then someone else turns up on another road, and I have to get round to them and do the same thing.

It's really very tiring, writing my name on signs over and over again all day. The worst thing about it is the traffic around this roundabout flows very slowly, and people get annoyed at how long it takes to drive round me. All they want is to know my name, but they have to wait 'til I've told loads of other people before they even get to ask. I've even heard that a lot of people just aren't even bothering to come my way any more.

Act 2

I still live on a roundabout. People still drive up to ask my name. But y'know what? I've got a couple of mates now. No-one's interested in them, which is good, 'cos it means I can just get them to write the signs for me. They write about 25 and then have a rest. Now, when people drive up to ask me my name I just take one of the signs out and show it to them, then throw it away.

It's much better. I get to tell so many people my name now, way more than before. It's still not perfect though -- when one or both of me mates is ill I have to scramble around as before. And once 25 drivers have come and gone, the 26th one has to wait ages while a sign gets written for them. But still. I'm loads more popular!

Too popular.

The council gave me a second roundabout. And a third. I'm a tourist attraction. So now there are people driving up to three roundabouts, and I've had to draft in a lot of introvert mates. And every time 25 people have gone past one of the roundabouts my mates have to draw another 25 signs. They're getting burnt out. I'm going to have to start paying them (more).

Act 3

I haven't got many mates any more. Just one, in fact. Got 10 roundabouts though, and well prepared for any more. I had a bit of a brainwave, see.

Me and my mate made 50 signs. And we attached them to posts, facing the roads at each roundabout. So now, when people come up, they can ask my name but it's already there. Right in front of them. Sometimes there's an accident and I have to replace one, but in general it works a treat.

People don't even need to ask me the question any more, and if I change my name, well, I only need to tell my mate. He can make some new signs. And he doesn't take much looking after.

The analogy explained (in case it wasn't obvious)

I used to be a fully dynamic website. Database queries on every request. I had a bit of traffic. Not much though.

Caches were my friends. They're databases, and I still had to do queries, but smaller and faster ones. But I had to maintain the databases which just duplicated the data I already had. And they kept emptying and coming back to ask the main database the same query as they asked half hour ago. They needed a bit of looking after.

I'm now a damn fast website. I get through a lot of traffic. My one companion is a generator/publisher. It prepares stuff in advance which doesn't change, and just places it there, right in front of all the traffic. And if I get twice the traffic? He can probably cope. Five times the traffic? Maybe then I'll need another one.

The moral

Seriously, just do shit offline. The Q in SQL is for "query". Like question. Why would you want to ask the same question multiple times if you know the answer doesn't change, or changes rarely -- and, crucially, if you know when it changes? Why even use a cache if it's only going to expire, and you need to maintain both the databases and the code which populates them? Moreover, the code and database are there to do nothing but store exactly the same information as you already have. What happened to "don't repeat yourself"? Is that only for code?

The master/controlling source of a website's data (eg a CMS for a media site), knows when data changes, so just push it out. Not to some intermediary - again, why bother? Just push it out all the way to the front. Generate it. Build it. Publish it.

I'm not arguing for no dynamism in websites. I'm just saying look, make the dynamism appropriate. Base it on the user, their behaviour, their request, or whatever -- but not on the things you already control. Changed your name? Don't wait for someone to ask you, get it out there before they even ask.

Want to know a query whose answer rarely changes? "What's the main body of the content at URL /2009/06/fail/?" One which changes regularly? "What's the most recent bit of content on the site?" Just think. about which parts of your site, and which parts of each page, actually change based on some kind of external input, be it the time and date, some facet of the current user, or some other unique facet of the individual request. You can do more of those, and provide more functionality, if you generate/build/publish the stuff that you control.

Do shit offline. Capiche?

Saturday, May 16, 2009

GPS cocks

Hot on the heels of PORK and Did someone say pub?, here's my latest bit of extra-curricular online action. It's juvenile, it's big, and it's clever: it's GPS cocks.


The premise is simple. As I say on my twitter profile, I consider myself to be a 1974 vintage London native who is yet to mature. That is to say that I've retained a juvenile sense of humour (aided and abetted by a Viz subscription). So when, the other week, my mate Nige set me a challenge for a walk to spell out a word, I took that ball and ran with it. And turned it into two balls and a shaft. I decided to scribble a virtual cock on the landscape.

The Cerne Abbas Giant may have got there way before me, and this guy may have been drawing things with GPS trails for years (and taking it all very seriously), but as far as I can tell I am a pioneer in the fledgling scribbling-genitals-with-technology-like-a-schoolkid-on-an-exercise-book space. I'm also giggling a lot.

So, behold, gpscocks.com. Buy a GPS (from my Amazon store ;-) ), log your tracks, and send the parts which look like parts to me. FAME AND FORTUNE AWAITS.

Thursday, May 14, 2009

My pious, holier-than-thou view on expenses

I used to have a job where I could legitimately run up and claim expenses, when I was at Yahoo! and travelling internationally. I don't have it on record but I think I only once, ever -- in, I dunno, 15 or so overseas trips over 8.5 years -- claimed for something other than flights and hotels, that is to say that all they had to do was get me near the office and put a roof over my head. No meals, no cabs or other local transport, no bar bills, in fact back in the UK office I didn't even buy any books. No nothing. I had my own reasons for this, and never had any issues at all with, or criticised, any of my colleagues who did what was, actually, expected of us all. They were genuine entitlements, which I chose not to take up. And this stance, somewhat amusingly, has now given me a nice big high horse to sit on, a lofty pious holier-than-thou moral perch from which I can spit invective down toward a whole bunch of this country's politicians.


These MPs can all go fuck 'emselves. The rules (pdf link), as just read out on Question Time, were/are clear as daylight. The claims should be for things which are "wholly, exclusively, and necessarily incurred" in order to do the job of an MP. There's more, but really, what the fuck. How is that not clear? Why does this system need reform? People in the audience are asking this question, making this point, time and again, and the MPs (including, depressingly enough, Menzies the merciless) are just basically ignoring it.

Margaret Beckett's just said the whole issue is distracting everyone from the "very real" issues facing this country, like unemployment etc etc. So clearly she doesn't think that the people running the country and elected in good faith being a bunch of morally bankrupt greedy careerist untrustworthy shysters is a very real issue facing this country. Get to fuck you cow.

Tuesday, May 12, 2009

Making bacon

Did I ever mention how much I wanted to be a DJ? Ah, yes, I did. Repeatedly. OK then! But did I ever mention that I now am a DJ, of sorts? Because I .. oh, wait. I've done that too. Seems I need some other flimsy excuse to big up mixcloud.com and my shows. And this is it! In an attempt not to gain listeners, but to hopefully entice others to make shows that I can listen to, here's a guide to how I make PORK. (No animals were harmed during the writing of this post; the chicken in the curry I've just ordered died ages ago. Probably)

Now, I could just say "I use such-and-such-a-piece-of-software, go read the instructions", but that would be pretty damn lazy of me, so what the hell: Flight of the Conchords doesn't start for ages, I'll kill the intervening time trying to be helpful. I may not succeed.

All that said, I do need to mention the software, as it is pretty central to the whole process.

The software #1

I use Übercaster. It's a Mac-only piece of kit which isn't free, both of which may alienate a lot of people from the start. But I only have a Mac; and I did try a few free hoops, but jumping through them proved comparatively painful.

The songs

I wrote a bunch of stuff here about how I go about picking the songs, and now I've deleted it: it was all pointless guff and bunkum. The simple fact is I buy and listen to loads of metal, and when a song grabs me by the bollocks I note it down. When I've got to 10-12 songs I call it a setlist.

The setlist

I have a formula. It goes something like this:
  • start with something which sounds like a pig
  • flip-flop between death metal and grindcore
  • play something a bit lighter about three-quarters the way through
  • finish with a beast
Not exactly rocket surgery.

The software #2

Back to the nuts-and-bolts how-I-make-the-show bit.

Übercaster is awesome. I want to make that clear. I'm not on commission, this isn't an advert, and I forked out 80 quid even though I could have easily got a cracked or hacked copy. I forked that out because I used it for the first 3 shows in free mode and loved it. The way Übercaster lets (actually, makes) me work is what makes the show so easy and fun to do. The enforced workflow is this: prepare, record, cut, release.

Prepreparation

OK, so there's still a step prior to Übercaster: I copy the mp3s I'm going to use into a directory for the episode, numbered in the setlist order. So for example 01-AnnotationsOfAnAutopsy-GoreGoreGadget.mp3 and so forth.

Prepare

Now I'm ready to fire up Übercaster. To begin with I'm presented with a mostly empty screen, with nothing but the mic configured. You can do a lot of things at this stage, if you're more professional than I am: set up auto-timings (if you know how long you want to, or are going to, speak for), use a show "template" which contains, say, the jingles or ads you're going to play already, etc etc. But I'm just going to play music and talk, so it starts thus:

Into this window I drag and drop the songs. Once they're imported, most times my OCD takes over a little bit and I arrange them into the right order, normally in 3 columns. Why do I do that? No idea. Here's some proof that I don't always.


Note the numbers in the boxes. They are the shortcut keys I have assigned each song. This is my favourite feature of the software: a key turns the sources on and off while you're recording, which means mute/unmute for the mic and play/stop for the songs. I set them up to be orderly and intuitive: M for the mic, 1-9 for songs 1-9, 0 for the tenth song, and if there are more, shift+1-9 for songs 11-19 (though I'm unlikely to ever play that many songs in one show). The next picture shows the dialog which comes up when you set it. It's so simple, and means no dicking around with the mouse/trackpad during the show.


Record

Actually recording the show is so easy -- because of the keyboard shortcuts, because all the chat is freeform, and because I do no mixing, beat-matching, cross-fading, etc, it's simply this:
  • click record
  • wait for the 3-2-1 intro countdown
  • say "My name's Darren, and this is PORK"
  • hit 1, hit M
  • ... song 1 finishes, hit M, talk ...
  • hit 2, hit M
  • ... song 2 finishes, hit M, talk ...
  • rinse and repeat 'til the last song
Here's the recording screen, with a song playing. The red boxes are the live sources, and the "clip" (song) shows how long it has left. It starts to flash with 5 seconds to go, which is handy. You can also see there's an overall running time near the bottom left too, plus the familiar record/stop/pause controls. There are other fancier bits too, volume levels and source controls, but I'm such a basic user they mean nowt to me.

I use a Logitech ClearChat Pro USB mic to record my voice, these days. Prior to that (for the first two shows) I just used the laptop's builtin mic. Nothing pro here, and I've no desire to spend money on more equipment.

The spiel

I have very little in mind about what I'm going to say between each songs. I mean, fairly obviously I'm going to say who and what I either just played or am about to play (or both), and I'll make some repetitive claims as to the filthy provenance of each song, and sometimes I'll say what album and/or year it came from. If the band are playing at Hellfest I tend to mention that, ditto if I ever saw the band live. But other than that I let the emotion take me where it wants. The key point, I believe, is that I listen to the songs live. They're not just cut and pasted in, with me doing the talking bits pretending I've just heard the song. I have just heard the song! And how it makes me feel feeds what I say.

I'm led to believe that Bruce Dickinson sounds rubbish and wooden on his radio show, as if he's reading a script and having his talking bits spliced in between the songs. The opposite approach to mine. Maybe his is better, I don't know.

Cut

Back to Übercaster. Cutting, for me, is just tidying up. Do I go back and listen to my own voice? Sort of. Sometimes I'll listen to entire links, but mostly I'll just listen to the transitions between chat and pork. In "cut" mode, Übercaster lets you drag entire clips around, and also shorten them by grabbing the ends and moving them inward. So, since generally I turn the mic off after the song starts, cutting mostly consists of ripping off the overlapping bits from the mic. Then I tighten the gaps between music and talking up a bit -- perhaps talk over a fading out cymbal or what have you -- and we are GO.


Übercaster lets you do loads more than I do with it. You can create volume envelopes, and by having multiple sources playing at once you can do mixes etc. I could fade a song out and talk over it, or fade it in, etc etc. But I don't. This software is powerful and I only scratch the surface. Pork scratchings, if you will.

Release

Release is their single-word for saying "save". Of course I'm being a bit flippant, and it's more than that: releasing an Übercaster project actually means saving it to mp3, filling the mp3 with ID3 tag metadata (including album art), etc etc. What's more, it has integration to things like Amazon S3 and FTP, meaning it'll acutally publish it on the internet if you want. But I only put mine up on mixcloud, so saving it as an mp3 is good enough for me.

Publicise

I'm really not going to document the mixcloud upload process here. Come on! Suffice it to show that I put the setlist in a text editor ready to cut and paste in, but that's about it. Then I go announce it on twitter (and therefore Facebook), and hey presto. PORK.

Squeal for me


Pork Radio Show, originally uploaded by alex_lee2001.

My ex-colleague Alex is a superstar. Though I'm still getting a proper logo done ;-)