September, 2010

Inconsistent JSON arrays using PHP’s json_encode

14th September, 2010 - Posted by david

I’d be amazed if anyone ever has come across this problem before, but it’s one that stumped me recently and I feel would make a good first ‘real’ post for this new blog.

Firstly, a bit of background: in work, we have an API that uses the XML-based SOAP protocol over HTTP. You can request data either using a PHP SOAP plug-in, or by passing your parameters as encoded JSON over a HTTPS connection. The data you get back is usually an array of properties, with various fields set. When data is requested in JSON, it’s returned in JSON. On the main server, we use memcached, which gets checked for a given query before we hit the main database. Whenever a query is made to the API, if there’s nothing in the cache, we hit the database and then cache the result for 5 minutes, to reduce the impact on our primary database; pretty standard stuff for a big website.

Read more...

First Post

3rd September, 2010 - Posted by david

I work as a web developer for daft.ie, Ireland’s largest and busiest website and have been there since August 2008. In my 2+ years of professional web development, I’ve come across many tips and tricks, which I’d like to share with anyone who’s interested. Alot of them have come from serious browsing for solutions on Google, Stackoverflow and the like, while some I’ve come up with myself. My main aim here is to share my knowledge by providing (hopefully) simple guides for people with similar problems, to save them the hassle I went through originally!

Read more...