Archive for May, 2010

Peterson’s First Law of Home Brewing

Wednesday, May 19th, 2010

q = (b*r)/100

The quality of your brew (out of 100) is equal to the number of batches (to a maximum of 100) you have brewed multiplied by how highly you rate it (out of 100) and divided by 100.

(Or, in plain English: “The beer you make yourself doesn’t taste nearly as good as you think it does, especially when you first start out”)

Brew Day

Friday, May 14th, 2010

Ingredients for making beer

Tomorrow morning is Brew Day. It’s been three weeks and I’m probably going to have restless dreams in anticipation.

For me, Brew Day usually starts at around 6am and finishes four or five hours later by which time I have over 20 litres of beer settled in my fermenter for the next week or two where it will magically turn sugary, malty water into delicious beer.

Above is a photo of all you really need to make beer; crushed malted barley, hops and yeast (at a trifling cost of only NZ$27 — that’s around 35c per standard 330ml bottle). All I have to do is let the malted barley sit in nice warm water for an hour or so where enzymes will convert the starches into sweet fermentable sugars, then I boil this sugary water up with some hops for an hour or so, cool it down and add the yeast which will do all the rest for me by eating the sugars and producing alcohol and carbon dioxide as waste products.

This week I’m making an English Ordinary Bitter which is a low alcohol beer (~3.5%ABV) with low carbonation, a malty/caramel flavour and aroma with hints of fruitiness and a light hop aroma. It’s a session beer which means that you can drink a truckload of it without feeling bloated from too much fizz and you won’t end up legless. But it’s a hard beer to get right; this is my third attempt and I’ve got high hopes for this one as it’s my first using all grain (instead of liquid malt extract).

Here is my recipe (for 21L):

Grain bill
3kg Maris Otter
200g Dark Crystal
100g Munich Malt
Mashed at 67 degrees C for 60 minutes
Mashout at 75 degrees C for 10 minutes

Hop additions
30g East Kent Goldings for 60 minutes
12g East Kent Goldings for 30 minutes
(1tsp Irish Moss for 10 minutes to clear out the protein)
10g East Kent Goldings for 1 minute
Boil for 90 minutes total to get rid of DMS

1 sachet rehydrated Safale s-04 English ale yeast
(yes, liquid yeast would be preferable but it’s really hard to come by here in NZ)

Sweet dreams!

Search and Replace PHP split() with Python

Tuesday, May 4th, 2010

A couple of days ago I upgraded to Ubuntu 10.04 which, in turn, upgraded my PHP version from 5.2 to 5.3. In PHP 5.3 they have completely deprecated the use of the split() function in favour of explode(). I did a quick search in my /work directory and it turns out that I have 832 files that are affected by this. All of them need to have split() replaced with explode() or the websites will throw errors every time they encounter it.

Here’s how I did it using an altered Python script I wrote a couple of years ago:

#!  /usr/bin/python
import os
import re

mydir = "/home/damian/work"

def doReplace(filePath):
	fin = open(filePath, "r")
	s = fin.read()
	fin.flush()
	fin.close()
	p = re.compile('(\s|\(|=)split\(')
	if p.search(s):
		fout = open(filePath, "w")
		s = p.sub(r'\1explode(', s)
		fout.write(s)
		fout.close()

for root, dirs, files in os.walk(mydir):
	for f in files:
		name, ext = os.path.splitext(f)
		if ext == '.php':
			doReplace(root + '/' + f)

(**UPDATE** I’ve switched the search and replace to use regular expressions because I found that ‘split()’ can be prefixed by a number of symbols but not others — i.e. don’t replace ‘preg_split()’)

The Wire

Sunday, May 2nd, 2010

Sal and I just finished the fifth and final season of The Wire on DVD last night. As far as I know it’s never been shown on NZ television before but I rate it as the best TV drama I’ve ever watched. Totally recommended.

Pope Song by Tim Minchin

Saturday, May 1st, 2010

Warning: contains offensive language.
But that’s kind of the entire point of the song if you listen to the lyrics.