Building Raised Beds for Growing Veg – Sourcing Materials

Raised beds are expensive to buy! If you have the time, and the necessary tools then it’s relatively easy to make your own. Here is the result of some of my research for my latest raised-bed project.

Part 1: Materials

There are lots of materials you can make beds out of. Here are some of the ideas I found:

Scaffolding planks/plain wood
Cost per metre: £1 – £3 

This is the most common option. If you can get old scaffolding planks they’re usually cheap. Alternatively, plain untreated wood from the builders merchants will do the same job. Note that untreated wood will rot away after a few seasons – I’ve heard conflicting reports of it lasting anywhere from 1 to 5 years before needing to be replaced. This is the trade-off you choose to avoid preservatives potentially leaching into your soil.

You can buy pressure treated wood which will last a lot longer; again, it contains preservatives which may potentially leach into your soil. I found it very difficult to find reliable information about the likelihood of this but I don’t mind replacing my beds after a few years.

Railway sleepers
Cost per metre: £8 – £20 

If you can purchase railway sleepers which are non-treated, those will be perfect for your raised beds. They are thick, heavyweight items that will likely last for a long time.

However, real reclaimed railway sleepers almost always come coated in Creosote, which is a horrible preservative that is applied to the wood. You will recognise it as a dark, tarry substance. Due to its carcinogenic properties, it is not recommended to be used anywhere where it is likely to come into frequent contact with skin – and this probably includes raised beds! Additionally, I can’t imagine it will help your soil quality, or contribute toward the ‘organicness’ of your produce.

Recycled plastic
Cost per metre: £10+ 

This is my favourite option, if we weren’t concerned with price! Recycled plastic will last for a very long time, never rotting. It won’t release any undesirable chemicals into your soil, either. And they look good: some types can look very much like some kind of beautiful hardwood. However, they were out of my price range

Just google “recycled plastic raised beds” to find some of the many companies that make these.

Rubber – tyres
Cost per metre: £free, but labour required! 

Recycling old car tyres looks like probably the cheapest way to make very long lasting beds. Best of all, any tyre place will give you as many old tyres as you want. They normally have to pay to dispose of them so they’ll be happy to hand them over!

This option involves a lot of labour, though. You’ll need to cut the tyres up into square sections which you’ll bolt together into “rubber planks”, which you can form a raised bed from.

Another option is to simply lay them out and fill them with soil!

Although they’ll last a long time, and won’t cost you anything, the downside is that they will not look particularly attractive. Just google for ‘raised bed tyre’ to get information and photos.

Disabling the Remote Desktop beep on Windows 8

If you regularly remote desktop into another machine, you’ll know all about the system beep. I hate this beep! I was relieved to be able to switch it off in Windows 7 by disabling the Beep driver in the list of Non-Plug and Play Drivers under Device Manager. But that list of drivers has been removed in Windows 8, so that technique will not work.

Disabling the remote desktop beep in windows 8

I totally don’t recommend you mess with your registry because that would be very irresponsible indeed. So, start by opening Registry Editor…

  • To open Registry Editor, hit Win key and type regedit
  • Browse to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > Beep. There’s the little bugger!
  • I checked the values on this MSDN page. Set them as follows:
    - ErrorControl = 0 (Ignore it if it fails to start)
    - Start = 4 (Don’t start/disable the service)
Disabling the Beep service on Windows 8

I don’t know how to stop the service immediately, so you need to restart at this point. And the beep’s gone!

Editing a Google Spreadsheet using PHP and CURL

I wanted to edit a Google spreadsheet, and in particular, change the title of a worksheet – although the same concepts would apply to any kind of spreadsheet edit. I am using PHP and since there’s no client API for this, I am building up the HTTP requests using CURL.

This was a nightmare to figure out. The documentation is a bit sparse to say the least, when it comes to making the raw requests using PHP. In saying that, it is important you read it all first and don’t just take my word for things.

Scroll down for the full-blown version including debugging and explanatory comments.

If you’re here via Google, I will not stand in the way of your copying and pasting the code any further:

$accessToken = "your access token";
$editUrl = "$accessToken";
$entry = "<?xml version='1.0' encoding='UTF-8'?><entry>... snip ... </entry>"; //This is the entry element for the worksheet, containing any required changes.
$fh = fopen('php://temp','rw+');
fwrite( $fh, $entry);

$handle = curl_init ($editUrl);
if ($handle) {
	$curlOptArr = array(
		CURLOPT_PUT => TRUE, //It's a PUT request.
		CURLOPT_INFILESIZE => strlen($entry), //Size of the uploaded content
		CURLOPT_INFILE => $fh, //Uploaded content
		CURLOPT_SSL_VERIFYPEER => FALSE, //Req'd if the google SSL certificate isn't installed
		CURLOPT_HTTPHEADER => Array("content-type: application/atom+xml")); //Include a content-type header!
	curl_setopt_array($handle, $curlOptArr);
	$ret = curl_exec($handle);

OK, so let’s break that down, and include the full example that I used to debug the whole thing and work out exactly what CURL was doing.

Firstly, since CURL accepts a file to upload, and we’ve only got an in-memory string, we need to use PHP’s ‘temp’ file access to emulate a file handle:

$fh = fopen('php://temp','rw+');
fwrite( $fh, $entry);

Create another file handle to accept debug logging:

$debugOutput = fopen('php://temp', 'rw+');

Then set up the CURL options with all of the debugging shenanigans:

$curlOptArr = array(
	CURLOPT_INFILESIZE => strlen($entry),
	CURLOPT_VERBOSE => TRUE, //Ensure lots of debug output
	CURLOPT_STDERR => $debugOutput, //Writes loads of stuff to the debug file
	CURLOPT_HTTPHEADER => Array("content-type: application/atom+xml")

Now create the CURL object, submit the request and output all the lovely debug info.

$handle = curl_init ($editUrl);
curl_setopt_array($handle, $curlOptArr);
$ret = curl_exec($handle);
$errRet = curl_error($handle);
print("Result: $ret<br>");
print("Error: $errRet<br>");

$verboseLog = stream_get_contents($debugOutput);
echo "Verbose information:\n<pre>", htmlspecialchars($verboseLog), "</pre>";

Don’t forget to close the handles.


DIY Quandries

If you’re not into DIY then there’s no need to continue reading. This post is mainly for people googling for particular problems so that I can share a bit of hard-found knowledge!

Over the past year or so I’ve been renovating a house. It’s pretty much done but there’s lots of DIY issues that are new to me. Googling them didn’t get me anywhere, all you often find is a ton of scare stories.

Of course, the best advice is to go to a professional. If you want to try this at home, don’t blame me when you flood the place. With that in mind, here are a list of the DIY puzzles I’ve come across recently. 

Shower running hot and cold

This is commonly caused by a broken shower thermostat, which would be obvious because the other hot taps in the house run fine. If they also ran hot and cold, it would be a boiler issue, and that’s what’s happened in my case. I recently switched from gas cylinders to a bulk storage tank and apparently the plumber didn’t re-calibrate the boiler (or whatever it is they need to do). The boiler is cutting itself out as a safety precaution.

Pressure for the central heating loop dropping frequently

I had a leak in the system. I went round all the radiators, checked the pipes coming out of the floor for any leaking water, found one that was damp, and tightened it. Then open the inlet tap to re-pressurise the system and bleed all the radiators.

Lots of black smoke coming out of the car exhaust and juddery power

This was caused by a split in the intercooler pipe. It’s a very common fault and causes a lot of black smoke, poor performance and juddery power at about 2000RPM. The cost to have it replaced professionally is about £100, in my case, I bought a £25 replacement from ebay and fitted it myself in an hour. Another common cause on my car (Ford Mondeo) is a blocked-up EGR valve but that wasn’t the case here. My fuel consumption went from 35MPG to 50!

I got a good description of the problem and how to fix it from this forum thread.

Mould/damp on a particular wall

I assumed there was damp coming through from outside but this wasn’t the case. I had a lot of condensation which was causing it. I ventilated the place properly, kept it properly heated (the room was usually cold beforehand), treated the area with anti-fungal spray, repainted and that seems to have permanently sorted it! The main thing to remember is ventilation. I moved furniture away from the area so air could get to it.


Fun is Justification Enough

Today I watched a TED talk by a Korean author called Young-ha Kim and he was discussing the artist inside all of us. He mentioned concepts like a father playing with his children’s toys and finishing the Lego castle long after the child had become bored. Most of us have suppressed our artistic interests in favour of all the serious stuff in our lives… if it doesn’t make money then it isn’t worthwhile.

He also talked about the concept of the “artistic devil” – the notion that when you have an idea, you’ll pause and think about it for long enough that doubts start to creep in. The artistic devil is the voice inside our heads that provides the hundreds of reasons not to do something: there’s more important things to do, it’s a lame idea, people will laugh at you, EastEnders is on.

Although he was talking about art and specifically creative writing, there are so many parallels with software development that it’s unreal. It struck me straight away and held true throughout the talk.

We can earn a good living in this industry but we have so many opportunities to be creative. Indeed, developers are often very creative and get involved in open source and other types of community projects. But it’s hard to take those first steps…putting yourself in the public spotlight and subjecting yourself to scrutiny is difficult, as though it’s going to be a massive weakness to be “wrong”. There’ll always be people around to criticise. I am always coming up with project ideas but almost every time I’ll sit on it and think about it and come up with so many reasons to not go through with it. But if it’s a bit crap, who cares? The point is to do it because it’s fun.

I was writing a stack overflow question today. It’s actually the first one I’ve composed. I typed it out, thought about it, created a jsfiddle, thought about it some more, reworded it, and couldn’t help but think that I shouldn’t need to ask for help.

But actually, even engaging with a community like stack overflow can be a creative endeavour. Thinking carefully about how to form a question takes skill and the process can be fun. And of course, if I am stuck with a problem, someone else will be.

As Young-ha Kim points out, we’re all born artists. It’s obvious when you see your kids drawing on the walls with their crayons or building a sandcastle that will inevitably be washed away. There doesn’t need to be a point.

I’m going to start work on a little project of my own. It’s got nothing to do with work, it’s not going to make me rich, it might be bad art. It’s taken me a long time to realize that as long as I enjoy sitting writing the code, that’s the only justification I need. Anything else is a bonus.

Enabling remote SSH on Raspbian (Raspberry Pi)

I’m off to visit some family this weekend and I’d like to be able to use my Raspberry Pi while I’m away, so this will involve setting up SSH and making it visible remotely (outside my home network). I’d like to access it from my Android phone.

Enable SSH on Raspbian

Firstly install the SSH service by running this command:

sudo apt-get install ssh

Then start the service:

sudo /etc/init.d/ssh start

And now we want to make it start every time the Pi boots:

sudo update-rc.d ssh defaults

Next up, try a reboot and confirm everything works. Reboot by running sudo reboot.

Connecting to the Pi over SSH

To connect, you’ll need to know the IP address of your Pi. You can get that by typing sudo ifconfig. There will be a line starting “inet addr: …”, and the IP address is next to that.

I have connected to the Pi from my windows machine using PuTTY. Download here. Once you’ve got PuTTY installed, put it in a sensible location on your hard drive and open it. Fill in your Pi’s IP address, and in the Saved Sessions section, type “Raspberry Pi”. Click Save.

 You should be able to click Open and log in.

For convenience, I created a shortcut on my desktop that would open the session directly. Right click your desktop, and click Create Shortcut. Browse to putty.exe and create it. Then right click on the shortcut and go to Properties. Change the Target to this:

"C:\path\to\putty.exe" -load "Raspberry Pi"

 SSH from your Android phone

I installed a great app called ConnectBot. I tried a couple and this was the best. It’s open source and doesn’t have any ads. When you open it, just type in the address in the format “pi@:“. It’ll prompt you for your password.

Allow access from the internet

OK, I don’t recommend this. Everything up to now is in your own home network and is pretty much a walled garden, safe from bad people. Once you allow access from the internet, you’re potentially opening yourself up to hackers and I don’t have the knowledge to give proper security advice.

That said, I do know the first step is to change your password. Use the command passwd.

Next you need to open port 22 on your router, and set it to forward to your Raspberry Pi. This means that requests from the internet on that port will automatically go to the right place. On my Sky router the set up looks like this:

Next you will want to set the IP address of your Pi to be static, so that it doesn’t change when you reboot. In your router interface, check the list of attached devices and note your Pi’s MAC address:

Then add an entry to the list of reserved IP addresses:

Now you should be able to SSH into your Pi from your laptop (using PuTTY) or phone (using ConnectBot) and instead of entering the 192.168.0.x address, you can use your public broadband IP address.

Finally, if you don’t have a public static IP address (in other words, your ISP keeps changing your IP address) then how do you know what it is? You need to set up a DNS service on your Pi that will regularly check what the network public IP address is, and keep a domain name up to date. Then you can connect using a domain name instead of an IP and it’ll automatically resolve to the correct IP. There are lots of ways to do this – click here for some ideas.

Raspberry Pi media PC with XBMC

What to do with a £30 computer? I’ll get to writing some code for this thing after Christmas. For now, it’ll make a nice media PC. Here are all the details of what I went through to get this up and running.

You will need

  • Raspberry Pi
  • Power supply – a micro USB adapter (my samsung phone charger worked fine). Needs to be 5v and at least 700mA.
  • SD memory card. Make it 2GB or more. I bought this one.
  • USB keyboard (not strictly needed but it’ll be handy now and again)
  • Ethernet connection

Operating System

You could use Raspbian, OpenELEC or Raspbmc. They’re all Linux based and any one would do. Raspbian is the standard OS for the Pi, OpenELEC and Raspbmc will make running XBMC (XBox Media Center) easy. I went for Raspbmc. They’re all super easy to install. For Raspbmc, go here for the download. It just involves sticking the SD card into your laptop and running an installer to get the OS on to the card. Stick the card into your Pi, connect everything up, and voila.

It all seemed to work perfectly for me but keyboard input stopped working after about a minute, every time, and needed a reboot. This would be followed a few minutes later with the power going off. Now, if something goes wrong, and it will, you’ll need to start a trial and error process to narrow down what’s wrong. The Raspberry Pi forums are a great source of help and helped me realise that my power supply was dodgy. This quote sums it up:

This is often due to either (or both) a bad power supply (power supplied much below advertised one), power cable (someone compared a lot of them to wet rope, not ideal for conducting electricity), keyboard (some have power requirements much higher than the 100mA the Pi can supply, this is never listed in their specs, and can vary by production batch for off-brands), or mouse (ditto).

I switched it with my wife’s phone charger which worked perfectly (mine was from ebay – may have something to do with it). Trial and error is the key.

Next problem: audio didn’t work via the HDMI cable into my TV. Cue a change to the Raspberry Pi’s configuration file. This is a text file in the root of your SD card called config.txt containing a list of key-value pairs for configuring various options. I fixed my audio problem with a clue from this forum thread – adding these options to the config.txt:


Check this page for an explanation of those config options. I probably only needed the hdmi_drive option but I’m too lazy to test them individually.

Spot the Pi. Maybe a case is in order…

Now to remote control. You can use a lot of “one-for-all” type remotes, I wanted to use my phone. The official XBMC Remote doesn’t work with the latest XBMC (!) as the HTTP API has been deprecated and removed. Luckily, there are lots of better options available on the Android (and iOS) app stores. I used Yatse. Yatse is VERY slick – it detects the XBMC instance on your home network quickly and is easy to use.

Next up, BBC iPlayer and ITV player. There are lots of others available. The iPlayer app is actually better than the official one on my Blu-ray player as it gives live streaming too. To get it from your computer to the Pi, you need to create a shared folder that the Pi can see. I shared C:\xbmc with a new user called xbmc. You could just be lazy and share it with the ‘Everyone’ group. Copy the zip files in there. Next, in XBMC, go to System -> Settings -> Add-ons -> Install from zip file. Select your share from the list (you will need to create it there first and tell it to look at the C:\xbmc folder you created) and select the correct zip file. Then go back to the home screen and select Videos -> Add-ons. There they are!

Pi Store ideas

That’s XBMC up and running. It’s nice to have it up and running, but I imagine I’ll want to start tinkering with the Pi again. I’ll leave you with some ideas for development. Maybe some day these type of apps will end up on the brand new Pi Store!

Web server/downloader:

  • For an electricity worth about £4 a year the Pi is almost cost-free to run 24/7. It could be downloading all your stuff. It would be sweet to have a web interface where you could queue URLs or torrents or whatever and the Pi will download them whenever your connection isn’t busy.


  • It’d be nice to use smart phones as input devices for a game server running on a Pi and the TV. Like a multiplayer skiing game where the phone accelerometer allows you to steer.

Ideas for media pc/backup:

  • Use the Pi for backup. There’s an 8GB memory card which will be more than enough to back up documents at least. For a hardcore backup option, connect a USB hard drive to it.
  • Have a task running on the laptop which copies photos from My Pictures across to the Pi’s pictures folder.
  • App for our Android devices to automatically back up everything to the Pi on a regular basis while on the home WiFi network. Photos will then be browsable.
  • App for the Pi to backup everything on it to cloud storage.

Home automation:

  • Thermostat control. Wire in a tempertature sensor, use a relay for switching. Add a web server and a web app to allow remote access. I’m obsessive about the temperature in my house, so I would be able to chart it all.


Our health visitor today expressed surprise that our 9 month old baby has not eaten meat yet and suggested we speak to a dietitian. Which got me thinking about this topic.

When I’m out and about and eating food in public (eg. Christmas dinner!) Once thing that I will invariably be asked is why I’m vegetarian*. A reasonable question given the normal vegetarian choice in restaurants. Pasta isn’t too festive and nut roast couldn’t have a worse reputation.

The question is usually appended with a follow up like “is it an animal rights thing?” Well, no, although that may well be a valid reason.

My answer is to reverse the question: why do you eat meat? The only answer, the answer that all others derive from, is that we’ve all been brought up in a society where it’s normal. You eat meat because your parents taught you to, and because in society, we’re inundated with meat based foodstuffs. You’ve now developed a taste for chicken korma or slow cooked ribs or pepperoni pizza or rare steak** and that’s hard to let go of. Why should you? But it’s circular, and seems like a pretty lame reason to me.

After having been vegetarian for around 7 years I now can’t see any attraction in eating meat. I eat a much more balanced diet now than I used to, with a greater range of flavours. I’ve come to realise that the bulk of meat dishes taste of whatever you cook them in (chicken anyone?). And the idea of slaughtering an animal doesn’t seem worth it.

Tasty beef

Please don’t eat me

Don’t start me on the nutrition thing – a few hundred years ago, or maybe even 30 years ago (I wouldn’t remember), chicken would have been an important source of protein. We didn’t have the huge food supply we have today, and there weren’t 30 aisles in Tesco where you could get a vast selection of nuts and pulses, soya, and quorn, if that’s your thing. And if you’re among the large portion of people whose meat intake consists largely of cocktail sausages, chicken nuggets or fast food burgers, then….well, y’know.

So now that we know the bad reasons why you eat meat, here are some good reasons why you might want to be vegetarian.

Firstly, the well known health benefits as summarised here by the US Department of Agriculture “Dietary Guidelines for Americans“:

In prospective studies of adults, compared to non-vegetarian eating patterns, vegetarian-style eating patterns have been associated with improved health outcomes—lower levels of obesity, a reduced risk of cardiovascular disease, and lower total mortality. Several clinical trials have documented that vegetarian eating patterns lower blood pressure. On average, vegetarians consume a lower proportion of calories from fat (particularly saturated fatty acids); fewer overall calories; and more fiber, potassium, and vitamin C than do non-vegetarians. Vegetarians generally have a lower body mass index. These characteristics and other lifestyle factors associated with a vegetarian diet may contribute to the positive health outcomes that have been identified among vegetarians.

Environmental impact is another good reason:

Pachauri, who was re-elected the [United Nations Intergovernmental Panel on Climate Change]‘s chairman for a second six-year term last week, said diet change was important because of the huge greenhouse gas emissions and other environmental problems – including habitat destruction – associated with rearing cattle and other animals. It was relatively easy to change eating habits compared to changing means of transport, he said.

So now you know.

*I’m not really vegetarian, because I occasionally eat fresh, oily fish. Extremely good for you.
**if you like your steak cooked “well done”, you are a bad person.

The slow death of bookmarklets

The Content Security Policy specification, a technology to prevent cross-site scripting attacks, has advanced from Working Draft to Candidate Recommendation. Which is a good thing, but unfortunately has the side effect that bookmarklets are going to stop executing on any web page that implements it.

What’s a bookmarklet?

It’s a small piece of JavaScript embedded in a link. That link is then added to your browser’s bookmarks. When it’s clicked, the script is executed. A bookmarklet always takes the form:


the code can, if it wants, load code from any other site into the current pages’ DOM, and execute that instead.

One bookmarklet I use is Instapaper which submits the current page to your ‘read later’ list. And there are loads of bookmarklets to assist web designers.

What’s Content Security Policy?

A W3C specification, call it part of HTML5 if you want to. It’s a collection of new HTTP headers that a page can include to indicate a list of places from which JavaScript should be trusted. Any scripts which do not appear on that whitelist will not be executed, which means the site is well protected against XSS attacks (when the users have supported browsers).

For example, if I’ve got a bit of custom form validation code, then the current domain will need to be whitelisted, and if I’m running Google Analytics, I’ll trust Google too. To trust both locations the appropriate header would look like this:

Content-Security-Policy: script-src 'self'

But CSP does other things!

If you include a Content Security Policy header in your page, you’re also saying that the browser should adhere to a few additional security rules:

  • Inline scripts are banned (inside <script> tags in the page) to prevent injection attacks
  • ‘eval’ is ignored, and that includes its use within setTimeout/setInterval
  • The JavaScript: link format is ignored.
That last one is important because that’s what bookmarklets do. Additionally, if the bookmarklet loads an external script to run, that won’t work.

Current browser support

Firefox 4 and Chrome 16. Although, they are using X-Content-Security-Policy and X-WebKit-CSP respectively at the moment.

Current web uses

Twitter claim they’ve rolled it out on their mobile site, but looking at the headers, I can’t see any evidence of it. I found this site which is sending the X-Content-Security-Policy header (the Firefox one) and I can confirm my Instapaper bookmarklet is definitely dead there.

This post focuses on the JavaScript side of the CSP specification, but it can also apply to any other type of resource (fonts, images etc). Have a look at the HTMLRocks page for more info!