Beware ye who use Zend_Config_Json and Zend_Config_Yaml. Basically, beware ye who use any Zend_Config implementation other than Zend_Config_Ini that offers substitution of constants – you are going to wreck the performance of your application unless you disable that feature with the ‘ignore_constants’ option.

Here’s why. Using Zend_Config_Yaml in ZF 1.11.2 an example, check out method _replaceConstants. This method is called for every string value in the configuration file. Feeling sick yet? If not, you have a very strong stomach, but this will evacuate it…


$> php -r 'print count(get_defined_constants());'
1301

All this just to get a feature that PHP offers natively to INI files – the automatic replacement of constants. Note that Zend_Config_Ini does not offer the ‘ignore_constants’ options. It cannot be disabled.

PHP’s flexible variable typing makes determining a value to be empty… well, see for yourself. Check out this diff for the NotEmpty validator in Zend Framework.

That can’t be right, surely! ;)

Update: the unit tests reveal the intent behind the odd-looking code change. Now the validator can optionally be very specific about what is considered empty.

Who’da thought that a single Tweet would have such impact?

During an IM chat with Daniel White he showed me his astonishing 3D Mandelbulb work. I asked if I could tweet about it and he agreed. Little did he know that this would lead to his website being Slashdotted and his work picked up by New Scientist!

Well deserved recognition for a true genius and nice guy.

How many users on Twitter have all “u”s as a username?

require 'net/http'
Net::HTTP.start( 'twitter.com' ) { |http|
    us=0
    us+=1 until Net::HTTPNotFound==http.request_head('/'+'u'*us).class
    puts us
}
# 15

Last Sunday, after getting bored implementing error handling in the Ruby version of the food journal, I decided to take a stab at the ICFP 2009 Programming Contest. Although already finished, the problem is so intense and interesting that I had to try. My solution is written in the lovely functional language Haskell.

Today, I achieved a milestone. My program can load and execute the Orbit virtual machine, run a sequence of frames and reports a score of -1.0 when the controlled satellite’s fuel is exhausted.

Browse the code on GitHub. Remember, I’m still learning, so don’t expect anything miraculous!

Continue reading ‘Controlling Satellites With Haskell’ »

I’m not by any stretch of the imagination an early adopter of technology. Nor am I (mostly) an old stick-in-the-mud who thinks that all programming should be done in COBOL. I love new technology but prefer other people to work out the bugs and niggles before I can use them reliably as tools.

So it is with some pleasure that I’ve decided to take the plunge and begin studying the Ruby programming language. Ruby has been around for 15 years now so the foundations are solid. Many rave about its simplicity, utility and natural-looking syntax.

My goal is to learn the lanugage by porting an existing application (the food journal written in PHP that I recently used to play with Zend Framework) first to the Ruby language, then to the web application framework Rails.

As usual, I embark on this project by reading a manual!

Update 12-Jul-2009: Browse the code on Github
Continue reading ‘Playing With Ruby’ »

The Zend Framework is a long-established and well-respected set of libraries for building PHP web applications. I’ve not used it before and I’ve recently become interested in learning more about it so I’ve decided to have a play. Rather than start entirely from scratch, I’m going to re-use the database schema of a famous dive-logging web application and see how much effort is involved in re-implementing the basics; logging in and displaying a page of dives.

More importantly, how much fun is it to work with?

Update 12-Jul-2009: Browse the code on Github
Continue reading ‘Playing with Zend Framework’ »

I eventually got off my ass and recovered the previous blog’s posts using the WordPress export/import mechanism. It seems to be ok after a brief eyes-over, the only issue so far being the (all too usual) UTF/ISO character encoding screw-ups, which I’ll correct manually over time. I’ve not yet re-enabled my plug-ins or theme as they were heavily customised for a previous version of WordPress and I can’t be arsed to rework them right now. Only Outreach will be missed, I reckon.

There’s not been that much going on to blog about. I’ve been learning the beautiful programming language Haskell but I’ve not really done much with it as I’m going through an inspirational downturn. I’m still working for an ISP in Sheffield. My Rock Band skills have peaked at expert guitar and hard drums.

The database for my old blog got corrupted, so I’m going to rebuild it on the latest WordPress. It’ll probably take a while and lots of links could be broken. Apologies for any inconvenience :)

Been in Western Australia for the last week at a major family do. Lots of fun and lots of alcohol so it’s been a fair test of stamina! The weather has been cool with the occasional day of rain, which is normal for us but a complete delight to the folks from the east who don’t see rain all that often.

Places visited so far; Perth (the capital), Margaret River (wine region) and Pemberton (for the family event). Next stop Fremantle maybe for diving.