When I’m building Javascript/jQuery based webapps, my go-to method of performing AJAX requests is via jQuery .post() using JSON.

My code normally looks something like this…

var postUrl = '/someurl.php';
var postData = {'id': 123, 'data': 'xyz', 'bool': true}; // etc
var jqXhr = $.post(postUrl, postData, function(data){
	// Do something with the result here...
}, 'json');

This generally works fine and is quick and easy, however you run into trouble with boolean values… they end up getting posted as the strings ‘true’ and ‘false’. Of course you can hack around this in the back-end but it’s far from ideal.

Below is a better way I have devised that behaves properly when it comes to data types other than strings…

var postUrl = '/someurl.php';
var postData = {'id': 123, 'data': 'xyz', 'bool': true}; // etc
var jqXhr = $.ajax({
	type:			"POST",
	url:			postUrl, 
	data:			JSON.stringify(postData), 
	contentType:		"application/json; charset=utf-8",
	success:		function(data){
		// Do something with the result here...
	dataType:		'json'

So go back to using .ajax() rather than the short hand .post(), and use JSON.stringify() for the stuff you want to send back.

In the back end you have to add an extra step to retrieve your data. In php you must decode the result of file_get_contents(‘php://input’). Because I was altering existing code I put the resulting array into the variable $_POST at the top of my script as seen below…

$_POST = json_decode(file_get_contents('php://input'), true);


I’ve got a 1970′s 24″ Webb AB series mower that could do with some paint work sorting out. It seemed difficult to pin down what colour the paint used was so I bought a British Standard colour swatch book and here I am publishing the result of my investigations.

At first when looking at the top of the mower nothing seemed to be a great match to the presumably faded paint. But then I removed the unneeded brake from the rear roller (I don’t have the seat), the unfaded paint on this part is a very close match to Olive Green (220-381C) which I’m confident it must have been painted in originally.

1970's Webb Lawnmowers are painted Olive Green (220-381C).

Mine’s the earlier belt driven one, but I think this will also apply to the later chain driven model and other Webbs of around the same age.


Ben Thompson: Apple Watch: Asking Why and Saying No

While watching the unveiling of Apple’s Watch last week I was ‘feeling’ what Ben above articulates so well. Why do I want this device?

I now recognise that when I was studying Industrial Design at University, the best projects were the ones that really asked why something should exist, and the proposed solutions answered that question well. Unfortunately it was very common amongst students on my course (myself included) to go off on a tangent, creating great looking designs along with beautiful CAD renderings of solutions that had absolutely no solid answer to the why question. I hope Apple haven’t fallen into this trap.

Clark Goble:

I just can’t quite figure out how many people would want the watch. I didn’t see that Apple made a compelling need case for it. Say what you will about Jobs. But he always had a killer function — even for the iPad. Exercise seems to be the attempt for the watch, but even that isn’t that compelling given the limits of the watch itself.

I’m not a big jewelry wearer so I found myself coming to the watch from the fitness angle too. However when you find out that it relies on the GPS in your iPhone you know that it’s a non-starter. My iPhone is a bit big to take running with me, but to track runs and be a music player it’s my best option so I do. The Apple Watch doesn’t allow me to leave my phone at home, so that doesn’t help me. If Apple can move this way for version 2, then their watch plus a pair of bluetooth earphones could be compelling.


A few tips for adding cup holders to the front of an E39 BMW.

I had the now obsolete Traffic Master system so I replaced it with the cupholders (available on eBay).

However when fitting I struggled to work out what you need to screw them to. Apparently you need some metal clips that give you something to screw to.

Looks like the part number is ’07-14-6-988-451′. Also described as a ‘Body Nut’.

Edit: Here’s a link to what seems to be the correct clip.


A little while ago I compiled some ARM vs x86 Geekbench data.

The figures are for the base model Macbook Air released each year, and the processor found in the iPhone (I’ve left out the iPad only A5X). When surfing Geekbench I discounted values that seemed to be obvious outliers. If anyone knows where you can find an average score by CPU please let me know.

iPhone CPU, Date, Score 

1176JZ(F)-S 412 MHz, 07/07, 137
1176JZ(F)-S 412 MHz, 07/08, 137
Cortex-A8 600 MHz, 07/09, 148
A4, 06/10, 210
A5, 10/11, 406
A6, 09/12, 1278
A7, 09/13, 2557

MacBook Air CPU, Date, Score 

Core 2 Duo L7500, 02/08, 2315
Core 2 Duo L9300, 10/08, 2557
Core 2 Duo L9400, 07/09, 3093
Core 2 Duo U9400, 10/10, 2033
Core i5-2467M, 07/11, 4559
Core i5-3317U, 07/12, 5636
Core i5-4250U, 07/13, 5919

Continue reading


Interesting article centring on a feature in a canary build of Google Chrome. Desktop browsers hiding the protocol and mobile Safari hiding the url has bugged me too.


Recently in an update to the Mac OS X Dropbox client they added a ‘Move to Dropbox’ right click menu entry (without asking).

Continue reading


I’ve been running ‘barefoot style’ for nearly a year now. The important part of running ‘barefoot style’ is actually having a fore/mid foot strike rather than actually running with nothing on your feet. The aim is to get away from a heel strike, which is the common way people run in regular supportive running shoes. A heel strike is close to impossible to do barefoot (or in minimal footwear). Continue reading


I don’t know who decided to include the admin bar by default in your theme/front end when logged in to WordPress, but I find it really irritating when laying out a new theme.

I just want to see how my theme looks and behaves! The admin bar means you worry if anything will be affected when logged out. Continue reading


Although Mozilla announced they would no longer be supporting their Thunderbird mail client as of last summer, it remained in my mind a decent free client, especially for Windows where decent free mail clients seem hard to find.

This week when I had the opportunity to escape Microsoft Outlook I downloaded Thunderbird and discovered however that some sloppy, ugly UI has crept in. The worst of this is the new rounded tabs. Continue reading