Monday, October 26, 2009

Specs failing with Daylight Saving Time change?

So I've been banging my head for the past hour or so, trying to work out why some of our specs have suddenly started failing without the code having been touched, and it comes down to an inconsistency in how Rails is handling UTC offsets when Time objects are manipulated:


>> Time.now
=> Mon Oct 26 15:55:20 0000 2009
>> Time.now.utc
=> Mon Oct 26 15:55:26 UTC 2009


OK, that's fine. Now let's try a calculation:


>> (Time.now - 1.day).utc
[Sun Oct 25 14:55:41 UTC 2009


What? Where did that one hour offset come from??

It turns out THAT is the source of all the specs which suddenly failed for no apparent reason this morning.

The good news is, it's easy to fix:

>> Time.now.utc - 1.day
=> Sun Oct 25 15:56:08 UTC 2009

MUCH better!

Ooh, we're in IDC's "10 most innovative software companies"!

Oooh, shiny! We just got named as one of IDC's 10 most innovative sub-$100m software companies to watch

I guess we scored more highly on the "Web 2.0-like functionality moves into the enterprise" category more than the other two, and by itself it might not mean much, but it's still great to be thought of in those terms. Makes me feel all warm and fuzzly.

Tuesday, October 13, 2009

Al's Ultimate Lasagne Recipe

OK, ok, so I've never posted a recipe on here before. BUT, pretty much everyone I've ever made this lasagne for has said wow, you've GOT to give me the recipe for that! - the most recent example being a guy who had spent years living in Italy, no less - and I can't sleep tonight, so here goes.

Last year I added some refinements from Heston Blumenthal's 'Perfect' bolognese, but mercifully this version takes about 3-4hrs, rather than 3 days. You can add whatever embellishments you like, here I'm just going to describe the basic sauce preparation.

You will need:

Pans


  • A heavy-bottomed frying pan (our Le Creuset pan was perfect for this) that can get really hot

  • A large sauce pot / casserole dish

  • A large lasagne dish - deep enough for at least 3 layers of sauce, plus about half an inch of bechamel sauce

  • A medium sauce pan for the bechamel sauce


Ingredients

NOTE: all quantities are approximate. Don't be the kind of cook who has to measure everything to the 3rd significant figure - taste often and see what you think it needs, it's much more fun!


  • About 1kg of lean minced beef (preferably organic, or at least free range - we like Waitrose's, and 2 of their 500g packs works nicely)

  • About 400g of lardons (again, 2 packs of the Waitrose Free-Range lardons work nicely)

  • 1 red onion, 1 white onion

  • 1 stick of celery

  • 1 or 2 carrots, depending on size - we're aiming for roughly equal quantities of diced carrot, red onion and celery, so adjust as needed

  • 3 tins of chopped tomatoes

  • 3 or 4 mushrooms - we like Portabellini
  • a bulb of garlic, the fresher the better

  • 2 large bay leaves

  • 2 large/4 small star anise

  • about 1tbsp Thai fish sauce (we like Squid Brand, which you should be able to get from any good Chinese food store)

  • about 1tbsp Lea & Perrins Worcester Sauce

  • about a third of a bottle of red wine

  • Maldon sea salt & freshly ground black pepper

  • A tablespoon of Marmite

  • Butter. Probably about 100g, maybe a bit more

  • Olive oil - it's best to NOT use extra virgin, you're going to be frying with it - but really, it doesn't make that much difference in the end

  • Lasagne sheets

  • A decent handful of basil leaves (MUST be fresh - dried is no good here)

  • A decent handful of fresh oregano (ditto)

  • The vine from some vine tomatoes (that's where most of the smell comes from, not the tomato itself)

  • For the bechamel sauce - maybe 50g of plain flour and about 1/3 pint of milk, plus about 50g of good mature cheddar (Cathedral City Extra Mature works well).

Preparation (20 mins)


  1. Dice the carrot, the red onion and the celery. We're aiming for equal quantities of each, in equal-sized pieces.

  2. Chop the white onion - these pieces don't need to be the same size as the previous lot, they can be bigger and rougher.

  3. Slice the mushrooms, so they're maybe half a centimetre thick

  4. Lightly crush and peel all the cloves of garlic. I use a good whack with my fist on top of a large knife on top the clove. It doesn't need to be obliterated, just kind of half-crushed, so the skin comes off easily.

  5. Take half of the semi-crushed garlic and chop it finely.

  6. In a small bowl, crush (with your fingers is fine) a good tablespoon of sea salt and grind about an equal quantity of black pepper (you're going to be handling raw beef next - you don't want the juices from your hands to hang around on the pepper mill, do you?)

  7. Season the beef - I tip one pack of beef onto the other, then separate the strands back into the empty pack. Each time you make a full layer, sprinkle on some salt and pepper

Cooking stage 1 (20 mins)


  1. In the big pot, pour a good layer of olive oil. Heat over a low-to-medium heat.

  2. Add the semi-crushed (not chopped) garlic cloves. Cook until they're just going golden but still soft (burnt garlic is bitter and grim), then remove them and save for later

  3. Increase the heat slightly, and add the diced red onion, carrot, and celery. Stir these occasionally while they soften.

  4. Put the heavy-bottom frying pan over a medium-to-high heat, and add some olive oil

  5. In the frying pan, add the chopped white onion and star anise. Fry until the onions are caramelising - i.e. going golden brown. Then tip the contents of the frying pan into the big pot (before the onions start to burn and go bitter.

  6. In the frying pan, turn the heat up to full and start to sear the beef. Do this layer-by-layer - ALL the beef must be touching the pan, otherwise it'll broil instead of searing, so just do a little at a time. Keep it moving until it's browned outside but pink in the middle, then tip into the big pot. Repeat until all the beef is seared.

  7. ...remember to keep stirring the big pot every so often!

  8. In the frying pan, add a big lump of butter - probably 50g or so. This will sizzle and spit for a while. Once it's stopped sizzling, all the water has gone out of it, so then add the chopped garlic and mushrooms and saute these until they're golden brown at the edges but still plump and juicy. Then tip them into the large pot (the butter will help give the sauce a nice sheen)

  9. Make sure the frying pan is hot, then sear the lardons. You're looking for golden crispy edges, but plump and juicy pinkness. These will probably release a fair amount of fat into the pan - this is fine, it's all good for the sauce. When done, tip everything into the big pot.

  10. Now de-glaze the frying pan by tipping the red wine into it and keep stirring it and scraping the tasty bits off the bottom until the wine is reduced by about half. Tip into the large pot. You can now wash the frying pan - everything from now on takes place in the large pot (except the bechamel sauce)

  11. In the large pot, add the tomatoes and stir well.

  12. Add the Thai fish sauce and Worcester sauce, stir, and reduce the heat to low-to-medium

  13. Crack the bay leaves in half, and add to the pot

  14. Chop and add the lightly-browned garlic that you used to flavour the oil with, right back at the start

Reducing the sauce (1hr-2hrs)


  1. Leave the sauce pot simmering with the lid half-on for about an hour, stirring occasionally and adding pepper if needed. (Taste!)

  2. Sometimes I add a tablespoon of Marmite if the sauce needs more depth, sometimes not - depends on the ingredients

  3. It's done when it's done - i.e. when it looks and tastes like really good bolognese-style sauce, and isn't too runny or too dry.

  4. When it *is* done, turn the heat off and leave it to cool with the lid on for about 45mins

  5. Once it's cool, chop the basil and oregano and stir through. At this point, you can add the vine of the tomatoes and leave it to rest and infuse for about half an hour, then take the vine out again.

Layer the lasagne (5 mins)


  1. Put the oven onto 180 degrees C to heat up

  2. Put a layer of sauce in the bottom of the lasagne dish, then add a layer of lasagne

  3. Repeat at least once, preferably twice (depending on the size of your dish and how much sauce you have) until you've used all the sauce - but make sure that your top layer is sauce, not pasta!

Bechamel Sauce (5 mins)


  1. In the saucepan, melt about 50g of butter over a medium heat

  2. Add the flour and stir quickly until you have a good consistency - still "smearable", not a dry lump

  3. Begin adding milk a little at a time and stirring until absorbed. Make sure you don't add too much too quickly or it'll curdle.

  4. When you have a nice medium-thick-but-still-easily-pourable sauce, add the grated cheese and grind some more pepper into it.

  5. Stir until the cheese is all melted, then pour over the top of your lasagne, making sure it's all covered

  6. Grate a bit more cheese on top

Final baking (45 mins)


  1. Bake the lasagne in the oven at 180 degrees C for about 45 mins, or until the top is golden brown and ever so slightly crispy around the edges.

  2. Remove from the oven and leave to rest for about ten minutes before serving



And that's it! Quality of ingredients counts for a lot, but the biggest clincher is the care taken to make sure that each ingredient is individually well prepared and cooked before adding to the pot. Enjoy!

Saturday, October 03, 2009

Blogspot ATOM in Feed-normalizer / Simple-RSS

Both Cragwag and Sybilline are using the excellent Feed-normalizer for parsing RSS and ATOM feeds, but there's been a niggling problem with the ATOM generated by Blogger / Blogspot in particular - the resulting links on each entry end up pointing to the comments, not the post itself.

So I just forked simple-rss at github and fixed this.

Turns out that simple-rss is just taking the first link tag that it comes across and using that as the link for a post, which in the case of Blogspot ATOM is the comments link.

On inspection of the ATOM RFC it says (section 4.2.7.2) :

atom:link elements MAY have a "rel" attribute that indicates the link relation type. If the "rel" attribute is not present, the link element MUST be interpreted as if the link relation type is "alternate".

Looking at the Blogspot ATOM, it looks like every element has a link rel="alternative" that points to the URL you would see if you navigated to the post from the blog homepage, so I've made it choose that link if it exists.

Github should build the gem automatically - but it's taking a long time to do it, so in the meantime, you can download it from http://github.com/aldavidson/simple-rss and build it locally:


gem uninstall simple-rss
cd (source root)
rake gem
cd pkg
gem install -l simple-rss


That should fix the problem