Cairo article published

I've got 3 posts or so queued up in my mind to write out, but some of them rather depend on doing other things first, so this will just be a quick note to say I have an article in the most recent php|architect magazine on the subject of "Vector Graphics with Cairo". This is a basic introduction to the PECL/Cairo extension which I've been helping out on for a while now. Thanks to Keith Casey for his input, to the folks at php|architect for letting me do it, and the long-suffering Elizabeth Marie Smith for putting up with all my stupid questions while working on this and other extensions!

Now, back to my regularly scheduled coding...

Debug of the year

I saw this article on the BBC, where a man who bought a packet of cigarettes from a petrol station in the US ended up being charged $23,148,855,308,184,500 instead. Wow. I was a little curious as to how this could have happened, though the number didn't look familar - I know roughly what 2^32, 2^32 / 2, 2^64, 2^64 / 2 look like, and this didn't appear to be any of those. A swift Google though led me to Stack Overflow, which is a fantastic site. Therein lies a quite plausible explanation:

Add the cents to the number and you get 2314885530818450000, which in hexadecimal is 2020 2020 2020 1250.

Do you see the pattern? The first six bytes has been overwritten by spaces (hex 20, dec 32).

Ingenious! I can imagine spending quite a while trying to come up with that...

PECL/Cairo 0.1.0 released

The first alpha of the PECL Cairo extension I've been helping out with has been released. Please download it, play with it, try and break it, and file bugs if you do! There isn't an official manual yet (for licencing-related reasons which I'm hoping to sort out soon), but I'll update this post when there is one. For now, there is a lot of stuff in the examples/ directory in the source which can be used as inspiration.

What I've been up to

I finally decided to get around to doing something about my site, so I've made a front page for it which is better than a straight redirect onto the blog. Hopefully it's reasonable.

I've been learning a bit more recently about the internals of PHP, and how to write extensions for it. I've been practicing by doing a bit of work on a Cairo wrapper that was started in the Google Summer of Code last year and until now has been mainly looked after by Elizabeth Marie Smith. She's put up with many, many newbie questions from me and so I've learned a lot while doing it. It's now at the stage where it'll run the eZ Components Graph component without too much complaining. It has a dual procedural and object-oriented API, so it should manage to run most things that use the existing cairo_wrapper extension. Thanks to all the regulars on #php.pecl and #php.doc on EFNet, and #php-gtk on Freenode for putting up with me while doing this. I've also written a quick wrapper for Tokyo Cabinet for the DBA extension in PHP which with a bit of luck will get committed to PHP6 some time soon.

In other news, I've been occasionally helping in the maintenance of Jubilee and An Sulaire, the two Sgoth Niseach boats I go sailing on occasionally. Hopefully they'll be going back in the water soon and we can get some sailing done. I'm looking forward to it.

PHP 5.3.0RC2

PHP 5.3.0RC2 has been released, which means that the next version of PHP is just around the corner. It comes right in the middle of the annual PHP Testfest. I rambled on a bit on the Freenode podcast a couple of weeks ago about this - it's an annual project where PHP usergroups and individuals around the world get together to improve the unit testing of PHP. This has benefits for everyone involved - PHP is improved, and more likely to maintain backward compatibility, and the people involved in writing the tests get to contribute in a meaningful way to the project, and hopefully learn something on the way. Several usergroups have events scheduled, and a couple have already taken place to great success. If you're a serious PHP user, and interested in getting involved, it's well worth checking out.

Even just grabbing the latest PHP release, compiling it on your platform, and running "make test" helps the project. It doesn't take much to do, and you can run it in the background while doing something else. Go for it!


About

User