package playne

imports "programmer"

Senior Bug Developer

  • sprintf, floats and rounding

    So I had some fun figuring out why my Spec tests were failing today. tl;dr – do not use floats for currency (BigDecimal will sort you out in Ruby) I was starting to question my highschool math today as I was seeing things like this: php > echo sprintf(“%0.2f\n”, 1.045); 1.04 and irb(main):003:0> ‘%0.2f’ %…

  • Adventures with Google Content API and OAuth

    So recently I have had the opportunity to play with Google’s Content API and their OAuth API. I have needed to use it in “offline” mode, as I want to interact with Google when the authorising user is not present (cron jobs and such). Here are my lessons learnt. You can Indeed use OAuth on…

  • Well Done Opera

    So I got this funny dialog from Opera today 🙂

  • Now SPDY Enabled!

    So I got bored and installed the apache2 beta mod_spdy module and now you should be served via spdy! You can get the apache module from here:

  • Telstra Rally Australia 2006

    Some pictures from the Telstra Rally Australia 2006 Corportate Cup

  • PHP: for vs foreach

    So this week I was asked the question on which was quicker in PHP – A for loop or a foreach loop. It turns out that my assertion that they were both about the same performance was about right. Here are my test results jason@server:~/php$ php speedtest.php Starting test: Test for loop data length=4000000 Mem:…

  • rm: Too Many Files

    Ever come across a folder you need to delete but there are too many files in it? Basically the shell expansion of * attempts to put everything on the commandline – so: jason@server:~/images/# rm * turns into jason@server:~/images/# rm image1.jpg image2.jpg image3.jpg image4.jpg… and there is a limit (albeit rather large) on the length of…

  • Why is my Quad Core VPS Running Slowly?

    Or how a host schedules CPU cycles.

  • The case for turning it off and on again

    So the other day we started having issues with our mail server. The symptom was the mail queue showing hundreds of emails with a message like “SMTP Server rejected at greeting”. Amavis (the mail scanner / coordinator) was rejecting mail and ClamAV was not working properly. We found that simply restarting the Amavis daemon and…

  • WordPress – Stop screwing with the timezone!

    So my dates were not displaying correctly and it turns out that WordPress is to blame. After checking the data and finding that it was correct, I was confused as to why a wordpress page was displaying the wrong date for a correct unix timestamp. WordPress was screwing with the timezone setting of PHP. This…