September 2006

Josh Sierres is giving a workshop on Ruby on Rails so I'm going to take notes more for my own benefit than for yours.
So, what's the big deal about Rails?
Most important point is that it gets out of your way. Lots of people refer to it as a boring framework because the people who start using it in real business apps find it gives them more time to focus on business logic and less time on implementation details.
Productivity. Gains are massive. Not necessary to put a number on it because it's not measurable.
Happiness. Productivity makes people happy, and happy people are productive. Very important point. Rails programmers have a little smirk on their face because things start working better.
Creativity. Lots of people from design and usability are now using rails as their gateway into implementing tings, getting things prototyped without depending on a programmers. Designers can do this, without knowing Ruby at all, and can build an entire app in a few weeks, and do the design themselves.
Lots of plug-ins, lots of people contributing, nice atmosphere in the community, and a lack of tension.
'Bad things', that stop people using it. Rails is not a silver bullet. Anyone who says one tools solves all problems is a salesman.
Ruby is a slow language. So people say 'does it scale?'. Yes. Share-nothing always scales, i.e. the type of architecture where you have no shared resources between instances of the application (see Cal's book about scaling Flickr). These always scale. But you have to have the right people to build them. So pointless to talk about scaling really.
Some e.g.s: 37 Signals, MOG, Robot Co-Op.
Few experts, but you only need one.
Rails is not ready for The Enterprise. It's missing internationalisation, composite foreign keys in the database natively, etc. But Ruby's a very powerful language and people can write plug-ins and add behaviour without getting in the way of the user, so there are plugins for both these and other issues.
But is The Enterprise ready for Rails? It comes with its own philosophy…
But…. all this doesn't matter. Rails is good for most web apps – most people most of the time will get what they need to get done quicker with Rails.
Risk. Use risk inherent in switching to a new technology, Rails, to make yourself more valuable. Can easily demonstrate new projects in Rails.
Opposite of risk is not safety, it's stagnation.
Rails is:
– a tool for getting stuff done faster
– maturing very quickly, more and more programmers using it
– sneaking its way into all types of businesses
– supportive of AJAX, Agile development, and other buzzwords
Rails has an edge because
– AJAX functionality is in Rails in a way that puts it into Ruby itself
– uses one language for everything
– gives you the ability to create natural language mini-framework on Ruby
And it creates happy programmers.
Rails does not stop you needing to understand HTML or SQL, but it reduces your dependance on repetition. So gives you tools to make your HTML cleaner, or writing SQL for basic queries.
It's not a high level set of components like user authentication or shopping carts. Push back against this type of components, because there are so many ways of implementing business logic, like log-in or shopping carts, that it is bad to force one way on people by creating these sorts of components.
It's not magic, but it feels like it for a while.
Power of Rails comes from the Ruby language.
More about rails…
It's an Models, Views and Controllers framework. The Model is how is should work, the View creates the thing you look at and the Controller joins those two together.
Can override conventions, but best not to otherwise you'll not get the productivity gains. Can automatically create views and controllers.
It lets you test everything inside your Rails app, with very few exceptions. Building these tests gives you a sense of security and a way to mitigate the risk in your app to prove that it works without troublesome too and fro with browser.
A few ways to get started. Can build out your database first, then build the app around it, or you can generate database files and create a 'migration' which controls the changes you make to the database.
(Had to break off here and go to a session I'd promised to be in.)

So whilst I was at EuroOSCON, I had a chat with a few people about an idea for a website I have. Well, not really a website, more of a web app. One person I chatted to was Rob McKinnon, who managed to convince me that I could do the whole thing myself in Ruby on Rails. I explained how my programming skills are, in general, sub-incompetant, but he convinced me that I'm qualified enough to play with Rails and that I might even actually be over-qualified.
I'm not really sure I believe that. I mean, sure, yeah, I used to tinker with Perl, Python, JavaScript, (and, way back when, Basic), but whilst I could adapt other people's work, I could never write anything from scratch myself. Tinkering is, of course, where you start when you're learning how to code (which is one reason why software patents are such a stupendously bad idea, but that's another discussion), but there are important steps that come after tinkering, including sucessfully sticking together chunks of stuff you've got from other people, and finally, being able to create new, original scripts. I never really got that far up the learning curve. (Actually, to be honest, I stood well back from the learning curve and thought 'Oh, my, that looks a bit steep…')
So now I've decided that my web app is going to be my baby. I am going to code it, as much as I can. I'm going to learn Ruby on Rails, and whatever chunks of MySQL and CSS and whatever else I need to get a prototype web app up and running.
There will be confusion, yes. In fact, there already has been confusion, within about the first five minutes. Thanks Matt, for introducing me to Locomotive and helping me get started. Now, sitting on a plane to Lisbon, there is further confusion, but I'll have to wait til I land to sort that out, which is annoying because I thought I was doing really well.
There will be frustration. Again, actually, there already is frustration, but it's healthy. It's making me want to work harder on this, not give up, so that's ok.
There will be cursing and screaming and pulling of hair (mine, I hope, not anyone else's). This may actually be entertaining for you if you enjoy that sort of thing, so I'm considering selling tickets.
And eventually, there will be success.
Meantime, however, I have Agile Web Development with Rails, by Dave Thomas and David Heinemeier Hansson and I have already worked my way through creating my first 'Hello World' app. It was easy. Once I got Locomotive going, and was accessing the right version of Ruby, all I really had to do was do what they told me to in the book. That's not just easy, it's easypeasy.
Now I have a MySQL hiccup to get over, but once that's sorted I'll be away working on their example shopping cart web app. I'm already designing my tables and thinking about how my own app is going to work, and am eager to start actually playing with that, but until I have MySQL working properly, I am slightly stuck.
I will keep you up to date on my development.
Pun intended.

Feels like forever since I last blogged about what's going on here in the World of Suw, but with a half-hour to kill on the flight from London to Lisbon for SHiFT, and no real motivation to do any of the things I should be doing – like writing the talk I'll be giving or finishing the article that's, oh, a month late – I thought I'd just have a little bibble here.
I'm disappointed to have missed seeing Neil whilst he was in the UK, but my own travel schedule has been pretty mad and his signing was here and gone again before I noticed. San Francisco, then Brussels, now Lisbon and then, after a single night back in the UK, Vienna. I can't wait for the travel to stop. I honestly don't know how people like Neil and Cory, who always seem to be somewhere that's not home, manage to travel so much without getting utterly exhausted. Or maybe they do, and they just never mention it. Me, I'm booking 5th October off for a damn good sleep. Anyone calling my mobile before 4pm will be directed straight to answerphone. Meantime, I have to go be all chirpy and sociable when right now I feel more like I want to bury myself in writing and coding and working on ORG stuff.
Of course, the last two conferences were ORG-related, but that somehow doesn't manage to make me feel less guilty about being 'out of the office'. (When your 'office' is your coffee table, that whole phrase fails to make any real sense.)
The conferences I've been to have been great though – inspirational and fun and full of very cool people. I am, however, coming up to some sort of monthly Dunbar limit. If I have to engage in small talk with one more stranger I swear I will scream. Unless they can fix my MySQL problem or have a spare ¬£100k kicking about with which to fund ORG, in which case I'll just grovel appropriately.
I am fed up of flying too. The gate agent today got really snotty because the name on my passport (Susan) was not the same as the name on my ticket (Suw), primarily because I didn't book it. I felt like kneeing him in the bollocks, frankly, the git.
Plus there's a guy sitting near me with a cough that sounds as if he's trying to retch his heels up through his intestines. It's probably quite a satisfying cough to cough – lots of gurgling phlegm – but as an onlooker, it's quite vile.
In other news, Kevin got his work permit through and has started work at The Guardian. He's having a great time – good bunch of people, interesting challenges and a far more interesting neighbourhood to work in. Within a week, he'd located a local wine bar that does champagne tastings, so Monday night we went out to try a little champers. I wasn't quite prepared for the volume of free champagne on offer from Ruinart, so ended up getting completely hammered. Kev took tasting notes, which he's going to write up and I'll post them here as soon as he emails them to me. Suffice to say, the champers was great, the Dom Ruinart was lovely, but we plumped for ordering a couple of bottles of the Blanc de Blancs as that was more within our price range.
Right… about to come in for landing, so better shut the laptop down.

Last weekend I went to Brussels to take part in EuroFOO, a two day event held by O'Reilly to get together a diverse set of people so that cool and constructive conversations can happen. I have been publishing most of my notes over on Strange Attractor, but somehow it would seem wrong to publish these session notes there instead of here.
Because this session, run by Tor N??rretranders, was about chocolate. Here are my very rough notes taken during the session.
Chocolate is one of the few examples of a food whose full potential was first revealed in industrial manufacturing. Industrial age has resulted in a decline in food quality for most foodstuffs, except chocolate which was improved by better technology.
agriculture + industry = high glycemic index
Means converts to blood sugar very quickly. Problem is that it provokes hormone reactions, insulin, which removes blood sugar, so we eat and get hungry from eating. We now, on the whole, eat a lot of high GI food.
hi GI = metabolic syndrome
People becomes overweight, diabetes, high blood pressure, lots of problems particularly in the US are related to high GI food.
But chocolate is good for your health… even though chocolate is 'candy'.
Two studies published. Italians fed chocolate to people in labs and measured their insulin leavels. Dark chocolate makes your blood pressure go down and stabilises insulin levels. White chocolate does not.
Second study in Holland, free-living people (i.e. not in lab), one group didn't eat chocolate, one was normal, and the other had a high chocolate intake. High choc intake had half the mortality of the non-chocolate group.
The reason is that the chocolate bean is high in anti-oxidants, which are a self-defence mechanism for plants. 8% of cocoa powder is anti-oxidant. Good for blood vessels.
But bad for dogs and horses.
Choclate history (note: dates may be incorrect as I was hurriedly writing them down and I'm not good with numbers)
1000 – Mayans, use chocolate beans, to eat and as currency (cf gold chocolate coins!)
1528 – Introduced to Europe by Colombus, as a drink.
1815 – Changed it from a drink into a solid when the press was invented to create the coco mass, so that you can separate the butter and the powder.
1847 – Fry and Sons, discover that if you put more butter into the chocolate liquid it will becomes solid at room temperature.
1875 – Found you could add milk powder.
1878 – Lindt develops conching, which is a process of taking chocolate powder and mix it in the butter and the acids evaporate to increase quality.
1894 – Chocolate bar becomes commercial object.
Unusual edible substance: solid but will melt in the mouth. Never chew chocolate: Only amateurs chew. Storable yet edible, needs no preparation from the buyer, and can be stored at room temperature.
Has to do with anti-oxidants. Has shelf-life of a year.
Chocolate is a matrix of the butter and you can add othe rthings, i.e. small particles of cocoa and sugar or dried milk. So the butter will hold two or three other substances.
Cocoa powder expensive, sugar cheap, cocoa bitter, so… make it with lots of butter, or other vegetable fats, lots of sugar, not much chocolate powder, and it makes it cheap.
Can even make chocolate without cocoa powder – this is white chocolate. it has no powder at all, just butter. Low quality, no anti-oxidants because they are in the cocoa powder. don't want the sugar, don't have to worry about the fat because it's not bad for you.
1985 – a French company said there must be a market for quality chocolate.
1989 – Lindt introduced the percentage bar, 70% intro in 1989. Then the 85% and now even 99% (very bitter). So all companies are trying to put % signs, but others are trying to erode the meaning of the %.
Tor never eats lower than 85%, but found some of the 90% and 99% 'childishly easy to eat', but the % tells you how much is not sugar. So that doesn't tell you what the 85% is, so some companies are using cocoa butter, not cocoa powder, to fill in the 85%, and this results in lower quality chocolate.
So that corrupts the meaning of %.
You want a lot of powder, meaningful amount of fat, and something else than sugar. Can we put in something that's not sugar that we can put in chocolate? Stevia, perhaps, a mad sugary plant, can get it in powder. [Kevin says that Stevia behaves differently to sugar when it's cooked, so it's good for sweetening things like coffee, but it can't replace sugar in all circumstances.]
Bean types, and percentages of the bean crop:
1% Criollo – traditional cocoa bean, high quality
14% Trinitario – reasonable quality
85% Forastero – high yielding, stable, efficient crop that's not tasty, low quality.
Now you have chocolate snobbery.
But need to have better quality chocolate, and get more of the value chain happening in the producing countries, so that the producers make more money (currently the manufacturers in the West get most of the profit).
I have to say, I loved this session. Tor brought some different types of chocolate to taste, and it was amazing to tell the differences between the different brands and the different % chocolates. I don't think there was anyone who didn't enjoy the 85% Lindt, nor were there very many who liked the 99% because it was so bitter and, strangely, non-chocolatey. Fascinating stuff. I wish I had more time to investigate chocolate.EuroFoo06

DoesSecond Life + Google Mars = Second Life on Mars?
I'm disappointed that when I go to full zoom on Mars, I'm not faced with an angry hoard of Martians the way that if I go to full zoom on the Moon I'm faced with cheese.
I once had to write an essay, which I seem to remember did count towards my degree, proving that the Moon was not made of cheese. We were only allowed to use observational evidence. I flunked it.
Oops.
I also remember holding a piece of real Moon rock, and looking at thin sections of it down a microscope. It blew me away, completely. Moon rock is compositionally similar to some rocks found on Earth, yet there's no weathering so the crystals within the rock are in pristine condition. It's just amazing. Really beautiful. And to have had the honour of actually being able to hold a piece of Moon rock astonishes me still.
If only the conspiracy theorists had geology degrees, they'd understand that that rock is not replicable here on Earth at all.
Kevin actually met Buzz Aldrin once whilst doing a piece for the BBC for the 25th anniversary of the Moon landing. They had a bit of a chat, and Kevin says he was a really nice guy, a proper 1950s test pilot kinda guy. Cool!
I, on the other hand, have spent about two hours trying to lynch Mark Shuttleworth (the world's first space tourist) during a game of Werewolf. I don't think we really need to compare notes any further.

Richard Hammond, one of my favourite TV presenters responsible for making Brainiac and Top Gear such compelling viewing. I mean, I don't drive, and all I know about cars is that they have a wheel at each corner and go 'vrrooom' … why would I want to watch a programme about cars? But Richard, known affectionately as the Hamster, just made things so entertaining I started to think that maybe I might want drive myself again one day.
So I was very concerned to hear yesterday that the daft git had managed to crash the Vampire jet car at 300mph and was in hospital in a critical condition. His condition's stable now, and it appears he's improving, which is all good news, although no one will know how serious his brain injury is for a while yet.
I know there are thousands of fans out there who feel the same way I do, and they've come out en masse to do something about it. The people at Pistonheads.com have set up a page on JustGiving.com to collect donations for the Yorkshire Air Ambulance, who flew Hamster to Leeds General Infirmary. Initially they wanted to raise the ¬£340 that that single flight, but the last time I looked there were up to ¬£36,895, and it's going up by about a ¬£1000 every half hour as the network effect takes over. It's wonderful to watch.
So get well soon, Hamster. Looking forward to seeing you back behind the wheel and givin' it some attitude.

I'm working on a silly little project, but I need data. If you happen to be in the UK, and a drinker of non-diet soft drinks, can you take a look at the bottle and leave a comment for me with this data:
Full name of drink
Size of bottle or can in ml
Grams of sugar per 100ml (in the nutritional data, under “Carbohydrates, of which Sugar”)
I am only looking for British full-fat, non-diet drinks, not stuff like 'Coke Zero' or any of that malarky.
Results up here when I have enough data.
Thanks!

A couple of days ago, I lost all the music from my iPod, very little of which I actually had on my iBook. Kevin needed to get a file off my iPod and plugged it into a PC it hadn't been plugged into before. He grabbed the file and said no to some update requests and then a while later called me over because the iPod icon was flashing in iTunes. That was the point at which we released that the iPod had been updated in the background without either of us realising, erasing all my music.
In retrospect, I should have looked when he queried me about the updates, instead of saying 'just cancel them'. And I should have remembered to make sure that his copy of iTunes was set to 'manual update only'. But I didn't. So there we go. Music lost. I have some of it on my iBook, and I have some on some DVDs which I think are in Dorset. But still, lots is gone.
I couldn't really get upset. I mean, it's bits. I can re-rip stuff or I can re-download stuff. It's a pain in the ass but it's not fatal. I haven't lost any *thing* just some replaceable data.
Of course, now that I've imported what little music I had on the iBook onto my MacBook, and now that I've updated iTunes with the new version, it recognised that I had an iPod that had been synced to a different library, and asked if I was sure that I wanted to update it.
The irony of this is not lost on me. I don't think it's lost on Kevin either.

Stuck outside Holloway Road station waiting for it to be opened. It's shut (exit only) because there's a football match on at the Emirates Station and apparently there have been too many people using the station. They are also saying that it going to be shut every time there's a match on. Great.
I haven't minded the disruption caused by matches – the roads closing and the flood of supporters. But this is really annoying. Apparently “there was a sign up” but signs are easy to miss, and frankly that's not enough. At the very least LUL or, more appropriately, Arsenal should have given leaflets out, and ideally they should have leafleted every house and flat in the area. If I had known I could have walked to Caledonian Road which was unaffected.
Oh, and Kings Cross is shut, and the Victoria Line and Northern Line apparently suspended. Bloody useless. LUL are about as useful as a fart in a jacuzzi.

Like an idiot, I left my MacBook charger at the Corn Exchange in Brighton yesterday at d.Construct. If anyone picked it up, can you please email me? UPDATE: I've been told that my charger was indeed found, and handed in. I shall ring the Corn Exchange tomorrow to see what I need to do next. […]

I joined Second Life a few months ago, but my iBook couldn't handle running the client. I could only take three steps and then I'd have to wait for the client to catch up. Now I'm on a faster machine (which is a way of saying I bought a MacBook), it runs like a dream. […]

Just a quicky to let you all know that I'm home. Hardly slept on the plane at all so consequently I feel dreadful and am having a hard time staying awake. Off to go buy dinner now, and have a quiet evening in. Loved San Francisco, but it's good to be home.

Electric Sheep. I don't know if androids dream of them, but stare at them long enough and you'll end up hypnotised, if not actually asleep. I just can't wait til this kicks in during a client meeting. I'll give it five mins then start whispering “Double Suw's fee… Double Suw's fee…”.

Vince has put Nothing Travels Faster Than Bad News, the movie that we made last year, up on YouTube, along with a whole bunch of his other stuff. Bad News, if you remember, was the epic film that I helped out with, acted (very badly) in, and proudly made fake blood to my own recipe […]

Queen of the May

Every year, on May Day, a young woman is stolen away by the faeries to become their Queen for a year. This year, though, the faeries have bitten off more than they can chew. Shakti Nayar will do whatever it takes to get her own life as a botanist back. As she struggles to work out how to get home, she uncovers Faerie’s dark secret and finds that she is not the only human who needs saving.

The Lacemaker

All the threads looked the same to the innocent eye, but Maude could see the black heart running up through one strand as it wove its way through the lace roundel. She busied herself with tidying her bobbins as a customer browsed the lace mats on her stall.

“I’ll take this one,” the woman said, holding up a square piece, twelve inches across. Maude winced, picked up the piece she had just completed and held it out to the woman for her consideration.

Argleton

Matt is fascinated by the story of Argleton, the unreal town that appeared on GeoMaps but which doesn’t actually exist. When he and his friend and flatmate Charlie are standing at the exact longitude and latitude that defines Argleton, Matt sets in motion a chain of events that will take him places he didn’t know existed… and which perhaps don’t.

Subscribe to my newsletter

Meta

A Passion for Science

From the identification of the Horsehead Nebula to the creation of the computer program, from the development of in vitro fertilisation to the detection of pulsars, A Passion for Science: Stories of Discovery and Invention brings together inspiring stories of how we achieved some of the most important breakthroughs in science and technology.