Tag: php

  • Mandatory reading for PHP devs

    I just wanted to give this site I stumbled upon some credit: http://www.hackingwithphp.com/. I’ve been developing with PHP for about 15 years, but still the part about performance taught me quite a lot. isset() is apparently faster than array_key_exists() and $i++is slow compared to ++$i. These are micro-optimizations, sure, but there’s no reason to rub PHP the wrong way… /Peder

  • Working around the IE9/IE8 XDR Post bug

    When creating a REST-API for a client we ran across this really weird problem. IE8/IE9 can’t make XMLHttpRequest to other domains via CORS. Microsoft invented their own solution for this problem, called XDR. The problem with XDR is that it doesn’t send a Content-type when doing POST requests, defaulting this value to “text/plain” instead. PHP…

  • Preventing overlapping cron jobs

    From time to time, we’re asked to fix broken sites built by other agencies. This can be extremely tricky, but if it’s technologies we know and love (PHP, MySQL, Apache, Memcached, WordPress, CodeIgniter, Laravel, Slim, etc) we usually say yes. If a site keeps falling every n hours/days, I start by checking if there are any…

  • Line-out scrobbler

    for years i’ve been trying to hijack music recognition services like shahzam to be able to recognize music. i’ve finally got this working thanks to the fine guys at echonest, who kindly provide a proper api for this. my proof of concept is running on a spare macbook. here’s how it works on the mac…

  • NOW On Roskilde

    Now On Roskilde is a mobile application which users easily can add to their homescreen. It shows what’s on right now, together with related artists playing in the near future. Since nothing is playing right now (+ the correct feed hasn’t been published yet), the app is pretty worthless at the moment. There is a…

  • CodeIgniter development site – on live environment

    We recently had to set up a development site for an existing CodeIgniter site, and we wanted to do this effortless. Ideal would obviously be to have a separate virtual domain or a separate box but hey, “ideal” isn’t always ideal, heh. By applying the same principle as in our previous WordPress article on the…

  • html5 validation with(!) facebook opengraph

    html5 is that new, cool(?) technology which you should(?) be using when making new sites. but, being the thorough developer you are – it just eats you up from the inside when your brand new html5 website won’t validate because your client decided to add a facebook like button. the facebook open graph protocol/namespace/api/whatever which…

  • php class for ffmpeg

    i’ve had a few projects over the last years where i’ve needed to convert some video file to flv, generate a thumbnail and get the video’s duration. i’ve never really got around to wrapping this into something reusable. but here it is, get it if you need it. you’ll also need a non-windows server with…