Dead trees

Claire reads a lot more than me. Claire got a lot more books than me for Christmas. And yet our bed side tables look like this at the moment:

Despite my attachment to “book as object” it’s pretty hard to argue for dead trees when you see that.

Also two of the books I got for Christmas (Perdido Street Station and 1q84) weigh in at about 1,000 pages each. Frankly I find books of this size a bit off putting, to the point that I may not have asked for them if I’d realised they were quite so damn long. And then I saw this tweet from Neal Stephenson (himself author of many 1,000 page plus novels):

No one will ever call my novels bloated again because they won’t have the faintest idea how long they actually are.

When we were doing some work on the future of books for HarperCollins one of the things that really resounded was that novels are 3/4″ thick for a very practical reason; manufacturing. Charlie Stross blogged about this much better than I could, but it’s clear that eBooks are going to revitalise many forms of publishing; short stories, serialisations and epics. Tolkien would have got his way and had Lord Of The Rings published in a single volume if it were published now.

A year in music

Following on from last year I’ve been running the numbers on this year’s listening habits. This year has been directly affected by my signing up to spotify; lots more back catalogue stuff and less obvious front runners each month. That said, each month was still easily typified by something… I’ve also put together a spotify playlist of how 2011 sounded for me for the masochists among you (one track from each album in chronological order)

  • January: The Decemberists; still going from last year, plus New! Album!
  • February: …still going with The Decemberists (need inspiration)
  • March: Other Beach Boys had solo careers? Really? Dennis Wilson!
  • April: In which I discovered my new favourite band, and the album I played most all year – Wolf People’s Steeple
  • May: Drone rock! Oh yes! Moon Duo!
  • June: New Fleet Foxes! Turned out to be shit, but it took a few plays to realise
  • July: New Bon Iver!
  • August: Neil Young! (caused entirely by this awesome Neil Young playlist)
  • September: Drone rock! Oh yes! Wooden Shjips!
  • October: New Wilco!
  • November: Deerhunter side project you say? Why yes, I’d like some of that. Atlas Sound
  • December: WHY HAVE I NEVER HEARD OF TUNNG BEFORE?

And my albums of the year?

  1. Mazes
  2. West
  3. Tomboy
  4. Unknown Mortal Orchestra
  5. Circuital

Special mention has to go to Wolf People’s Steeple; by far and away my most played record this year (despite it being released in 2010).

For those who wish to run the same analysis of their own habits you can download the script from my github. As long as you have python installed it will work like so:

python fetcher.py username year

e.g.

python fetcher.py offmessage 2011

Second screen advertising

The “rise of the second screen” should, in many ways, be a godsend for TV advertisers.

Until recently putting URL, Facebook or Search calls to action at the end of a 30 second spot in the middle of Coronation Street was always a leap of faith when, for most viewers, the computer was turned off in the next room.

Nowadays however, when according to some reports up to 75% of us are using other media while watching TV, there’s a real chance that an advert’s call to action is going to get followed.

What’s vital in this new environment is that the agencies producing these campaigns take into account this change in behaviour and the related routes of access.

And by this I mean “Don’t even think of using Flash

If you’ve persuaded someone to search for your term and click the link you’d better make sure they get more than “you are trying to access this site from a non-Flash enabled device”.  Particularly when your site is at best a poor implementation of the Github 404 page.

More on heroku and Lucid

In my last post on heroku, django and Ubuntu Lucid I went through a fair old rigmarole and a lot of (Ruby illiterate) guesswork to get the Heroku toolchain working on Ubuntu Lucid (10.04 LTS).  Only a few days later Heroku published official Python and Django documentation.

Unfortunately, if you’re new to Ruby even Heroku’s excellent documentation isn’t quite enough… Essentially there’s still an assumption that you know what the hell you’re doing with Ruby.  Obviously for people steeped in Python this is not the case!

The Linux readme says the following:

apt-add-repository 'deb http://toolbelt.herokuapp.com/ubuntu ./'
curl http://toolbelt.herokuapp.com/apt/release.key | apt-key add -
apt-get update
apt-get install heroku-toolbelt

That’s all very well, but it isn’t all the steps. To actually get the Heroku toolchain working on a previously Ruby-less Ubuntu Lucid install you’ll need to do the following:

sudo apt-get install ruby libopenssl-ruby libreadline-ruby curl
apt-add-repository 'deb http://toolbelt.herokuapp.com/ubuntu ./'
curl http://toolbelt.herokuapp.com/apt/release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install heroku-toolbelt

Note the following:

  • Ruby is not a dependency of heroku-toolbelt, so you can install the toolbelt without Ruby
  • Just installing Ruby isn’t enough – you’ll get “no such file to load — net/https” unless you also install libopenssl-ruby
  • You’ll also get “no such file to load — readline” unless you also install libreadline-ruby
  • Without some faffing (that I’ve not done yet) you can’t install Foreman as Heroku recommends because the Lucid packaged version of RubyGems is too low to meet the dependencies. Personally I don’t see this as necessary for dev environments on smaller projects, but if I were to try a larger one this would need to be resolved

Hopefully this will help others new to Ruby trying to make the most of Heroku’s excellent infrastructure.

Heroku, Django and Ubuntu Lucid

The short version

The following commands on a previously rubyless Ubuntu Lucid machine will get a Django project called awesome with an app called nonsense running on Heroku. Explanations are at the end.


sudo aptitude install rubygems1.9.1 libopenssl-ruby1.9.1
gem install addressable
gem install heroku
ln -s ~/.gem/ruby/1.9.1/bin/heroku ~/bin/heroku
ssh-keygen -t rsa
heroku keys:add
mkdir -p ~/projects/heroku-django
cd ~/projects/heroku-django
virtualenv --no-site-packages .
source bin/activate
pip install psycopg2
pip install gunicorn
pip install Django
pip freeze > requirements.txt
django-admin.py startproject awesome
cd awesome
python manage.py startapp nonsense
cat >Procfile <<EOF
web: bin/gunicorn_django --workers=4 --bind=0.0.0.0:$PORT awesome/settings.py
EOF
cat >.gitignore <<EOF
bin/
include/
lib/
*.pyc
EOF
git init .
git add .
git commit -m "Initial commit"
cd ~/projects/heroku-django
heroku create --stack cedar
git push heroku master
heroku run bin/python awesome/manage.py syncdb --app app-name-XXXX
firefox http://app-name-XXXX.herokuapp.com/ &

The details

dtt101 has been nagging me about the benefits of Heroku for ages now. It’s fair to say that the fact that the two main frameworks it advocates are Rails and Node rather put me off (I am, after all, Python through and through). I’d seen the odd blog post recently that suggested that you could run Django (and all sorts of other things) on their new Cedar platform, but hadn’t taken it particularly seriously. This morning, however, I came across the excellent Deploying Django on Heroku (Mac OS X) so I thought I’d finally have a look at trying it out for one of my own projects.

The server that hosts House Price Please is due to be decommissioned so it needed a new home. It’s also fair to say that it’s never had that much traffic, so it makes an ideal candidate for trying heroku out.

All these steps were on Ubuntu Lucid (Isotoma‘s standard desktop OS). They also assume that you’ve already got a Heroku account.

The heroku CLI is provided as a Ruby Gem, so the first step was to get rubygems installed. Lucid provides 1.8, 1.9 and 1.9.1 from apt, so I plumped for 1.9.1. In theory I could then use the gem install command to install the heroku gem.


sudo aptitude install rubygems1.9.1
gem install heroku

However, this blew up saying ‘launchy relies on addressable’, so I needed to try again, installing addressable first:


gem install addressable
gem install heroku

There are also some warnings about /var/lib/gems/1.9.1 not being writeable, but I’m not aiming for a system wide install of the heroku CLI, so that’s fine. However, to get the heroku command on my path I had to do the following:


ln -s ~/.gem/ruby/1.9.1/bin/heroku ~/bin/heroku

Next step is to add ssh keys to heroku. If you’ve not already got a key pair you’ll need to generate one using ssh-keygen -t rsa. Then add them to heroku using:


heroku keys:add

On a previously rubyless machine this blows up for with a message saying no such file to load -- net/https. To fix this I had to:


sudo aptitude install libopenssl-ruby1.9.1

When you run heroku keys:add again it will upload the public key from your .ssh directory. If you’ve got more than one it will offer you a choice.

From this point on you can pretty much follow the instructions at the post that inspired this one. The only changes I’d make are:

  • You don’t need the second (celeryd) line in the Procfile (unless of course you plan on using celery for async tasks)
  • You need to push to heroku before you syncdb, not after

Once I’d converted housepriceplease to this structure (we use buildout on our servers) I dumped the data on the old live server using python manage.py dumpdata housepriceplease > data.json, checked data.json into the fixtures directory of my main app and ran:


heroku run bin/python housepriceplease/manage.py loaddata data.json --app high-wind-5409

Finally I following the instructions for custom domains on the excellent Heroku dev center to point housepriceplease.co.uk at Heroku, and voila! we’re live:

housepriceplease.co.uk

Minor edit: On the Heroku/Facebook page (which is well scary, actually) there is a link to some instructions for installing the Heroku toolbelt for Linux. Looks very new, but likely that the faffing with Ruby at the start of this article may not be needed soon.

This never happens to me!

The Kindle edition of the rather excellent book Red Plenty is broken.  It has lots of footnotes in it that are completely unlinked from the body of the text.  This, combined with the Kindle’s inability to show footnotes in any other way than inline, means that at the end of every chapter you find yourself either undertaking a very fiddly process of trying to skip back and forth to reread the text, now with footnotes, or simply angrily flicking past them (which in the case of this book is 24 pages for the first chapter; or “click, pause” 24 times).

I’d been really looking forward to reading this, so I was genuinely pissed off.  I ranted a bit on Twitter (as you do) but then actually got angry enough to go and write a review on Amazon.  I’ve never done this before, but felt cross enough about the combination of a) poor execution of something so simple by the publisher, b) the fact that the Kindle edition was £1 more than the paperback, and c) that Amazon has no Kindle returns policy (even if it’s fundamentally broken), that I actually went and did it.  Spleen vented, I moved on (after checking that it had been published, of course).

This morning, through the contact form of our company website, the author got in touch with me.  He asked me about the problems with the book (not having a Kindle himself) and offered me an author’s copy of the book to make up for my poor experience.

Isn’t that awesome? (and doesn’t it show how hard it is for publishers to add value in a world of pure digital distribution?)

And of course I can’t let this pass without linking to this conversation on Twitter 😉

…gone tomorrow

Thanks for the kind words from friends in response to my previous post, which included:

  • Go on, do it
  • You mean you haven’t done it already?
  • Less an antennae, more a CB aerial in the front garden of a bungalow

So… It’s done

It is, quite literally, a weight off….

Hair today…

By a very bizarre turn of events I happen to know the last time I went to a hairdresser. I’m guessing this is neither unusual nor important to most people. In my case, however…

During my first year at University the Sisters of Mercy played their tenth anniversary concerts in Leeds on the 16th and 17th February. The weekend before (which I calculate to be Saturday 9th Feb 1991) I went home to Cheltenham and had my hair cut at “His Nibs” as I always had every 3 months or so until then; just the usual crop so common to those of us with head-hair curlier than our pubes.

As it turned out that was my last haircut. I decided to let my freak flag fly from that moment on (your hair is, after all, your antenna) and have not crossed the threshold of a hairdresser since then.

This week, 2011, the Sisters play their 30th anniversary concerts at the same venue, and so I am reminded of my last haircut, twenty years ago this week.

The overwhelming question this raises is, of course, “can a man enter his forties with a ponytail?”

Answers on a postcard. please.

Halloumi Curry

A really tasty curry – the garam massala and cinnamon balance the heat of the chillis and the richness of the tomatoes nicely, while the Halloumi gives an interesting alternative to meat.

This is a simplification of the Halloumi Curry recipe on The Superflux blog (thanks to Anne for pointing me to it!)

Preparation time
15m
Cooking time
45m
Difficulty
2
Serves
2

Served

Ingredients
  • 2 small onions
  • 3 cloves of garlic
  • 1 inch thumb of ginger
  • 1 tsp mustard seeds
  • 2 tsp cumin seeds
  • 2 birds eye chillis
  • 4 cloves
  • 1 bayleaf
  • 1 cinnamon stick
  • ¾ tsp salt
  • 2 fresh tomatoes
  • small bunch (approx. 15g) of fresh coriander
  • 1 can whole tomatoes
  • 1 ½ tsp garam massala
  • ¼ tsp turmeric
  • 1 ½ tsp ground coriander
  • 150g pack of Halloumi cheese
Preparation

Peel and finely chop the onions. Peel and grate the ginger and the garlic. Finely chop the chillis (seeds in or out, depending on your heat preference).

Get the oil good and hot over a medium flame in an oven proof dish (casserole dish preferably). Once it’s up to temperature put the mustard and cumin seeds in. As soon as the mustard seeds start to pop put the chopped chillis, the cloves, the cinnamon stick, the bay leaf and the onions, garlic, ginger and salt in the pan. Give it a good stir over a high heat for a moment or two, before turning the heat down and cooking gently until the onions go soft and translucent (which should take a little over 5 minutes). You’ll need to give it a little stir every now and again as they cook.

While you’re waiting, finely chop the tomatoes and the fresh coriander. When the onions have softened turn the heat up a little and put the chopped tomatoes and the chopped coriander in. Give it a good stir and cook the tomatoes down for another couple of minutes. Once the tomatoes have broken down nicely add the can of tomatoes. Bring it up to the boil quickly, before reducing the heat to a simmer. Now add the ground coriander, the turmeric and the garam massala.

Leave it to simmer uncovered on a low heat for about 30 minutes. You’re aiming to thicken it, but not to the point of it catching on the bottom of the pan. If it looks too thick you can always add some water. It will depend on the amount of juice in your can of tomatoes. Once you’re done pull out the cinnamon stick and the bay leaf (and the cloves if you can find them!).

At this point you can leave it to cool for later, or move straight on to the next step.

About 15 minutes before you’re ready to eat, reheat the sauce and, once it’s bubbling nicely, chop the Halloumi into cubes and add it to the pan.

When the cheese feels soft it’s ready. This should be in about 12 to 15 minutes.

Serve with Cabbage Sabzi if you’re feeling virtuous or Ginger and Pepper rice and some Naan if you fancy a full on blow out.

forkd.com

Technology, cricket, music, food.