Unicode math symbols as operators in PHP6?

Noted over on Sara Golemon’s blog today. Can we expect this sort of thing to be in future PHP code?

var_dump(¼, ½ ¾);
// float(0.25)
// float(0.5)
// float(0.75)

var_dump(1 ≤ 2, 2 ≯ 3, 5 ≠ 6);
// bool(true)
// bool(true)
// bool(true)

var_dump(3 × 4, 15 ÷ 5);
// int(12)
// int(3)

var_dump(1 « 3);
// int(8)

/* Your font may be too small,
 * but that's a skull and crossbones */
☠('aka die/exit');

Well, no, not really – she implemented it just for fun, but it’s an interesting idea, and face it – who doesn’t want to be able to use all the keys on the Space Cadet Keyboard?

Space Kadet keyboard


Sometimes you really do feel like you’re missing out by not going to events like this 😀

And sod it, Michael Schwern’s talk about improving as a programmer definitely sounded interesting.

Oh well. There’s always next year, and downloading slides and reading the blog entries and watching the videos on youtube…. but they’re just not the same really.

Mechanism, not Policy

Over on Diamond Notes, a somewhat skeptical take on the recent Postgres benchmarks news. Can’t say I agree with it, and I did comment on it, but something did go click for me while thinking about it, hence this entry. See, the problem isn’t just performance. MySQL just doesn’t do the right thing.

I mean, I can understand the principle of implementing the smallest featureset you think a user would need and then optimising the bejaysus out of it – Epiphany would be a better browser than Firefox for 90% of the time for me because of that approach (it’s just Epiphany’s way of doing bookmarks that gets in the way) because Epiphany is always faster and less of a memory hog than Firefox since it doesn’t try to do everything. Emacs and vi is another example – sure emacs can do just about anything, but vi starts in a heartbeat and if you just want to add one line to your .muttrc/aliases, there’s not much point in firing up emacs. Of course, if you’re doing a chunk of work… but that’s another story.

The point was, before the digression, while MySQL was faster than Postgres in previous benchmarks, it wasn’t doing the job right. Sure, it was faster… but only if you wrote your SQL the MySQL way. Don’t use JOINs because MySQL doesn’t do those well. Yes, I know, there are better ways to do things than JOINs (and if you grok set theory, easier ways), but forcing end users to write SQL a certain way – and punishment with poor performance is forcing them – is the same as putting policy in the kernel. It violates one of the core tenets of unix kernel philosophy: Mechanism, not Policy.

There was also the point that MySQL didn’t really do SQL. I mean, transactions. Obvious example, I know, and everyone and her aunt has commented on it, so no need here beyond the usual “come on” response to the “oh, but you don’t need transactions” line. You might be right that there are other ways to do things, but guess what? That’s my choice as the developer, not yours. That’s the entire point to SQL – it lets me abstract away from the actual storage policy and just worry about the arrangement of the data in tables. In other words, it’s a Mechanism for me to implement my Policy with. And that’s a very powerful thing. But MySQL didn’t fully implement that Policy and it implements some parts of it more favorably than others, thus imposing it’s Policy on me through what’s meant to be an impartial Mechanism.

And yes, I know, Postgres adds to the SQL standard with its OO features. But that’s not the same thing. Adding to the standard is fine – so long as you implement the standard first.
So frankly, seeing Postgres doing so well in the performance benchmarks isn’t just a nice sight from the point of view of performance – it’s a nice sight from the point of view of doing the right thing. It means that the last thing that was holding back the better way of doing things has now  been taken away. LAPP stacks? About time too!


I guess there’s irony in this, but less than a fortnight after submitting some code to mantisBT, I’m now trying to update a perl migration script (m2bz, by Julian Mehnle) to handle a migration from Mantis 1.0.3 to Bugzilla 3.0 (currently it works from Mantis 0.17.5 to Bugzilla 2.16.3).

I know, it’s no great hunk of coding, but I thought it was worth a grin.

(I should point out, by the way, that this isn’t because Mantis is bad software, it’s just that the time tracking chunk of Bugzilla is better than that of Mantis right now, and that’s something that’s required at the moment. There are other features in Bugzilla that are nice bits of icing as well, but the time tracking’s the main thing.)


Hmmm. One of the fun things when a client specifies W3C html compliance as a requirement is that you can spend a surprising amount of time picking just what W3C standard they want you to comply with in the first place. And now it seems that there’ll be another one to choose from. HTML 5 has just been revived as a standard in development, as a reaction to CSS and XHTML. Which means that at some point in the future, you’re going to have CSS 3, XHTML 2.0 and HTML 5 out there.

Daniel has a good summary of the whys and what’s involved. Some of the new features look downright spiffy – DOM support improved (right about the time that PHP is pushing away from DOM to get to SimpleXML – doh…), improved support for Forms (native data validation and better native input controls look like good timesavers to me), and more content tags (article, dialog, video, canvas and progress were listed).

As Daniel says though, this is still a standard in draft form; meaning we’re years from mainstream implementation yet. Pity some parts are already out of date so, but then again, I can’t see someone using old hardware thinking too kindly on the idea of upgrading everything because of a new version of software that can probably be abused just as badly as the last few versions to produce whatever the HTML5 version of the blink tag will be.

Xdebug 2.0 released

Hmmm. First PHP application programmers start GoPHP5.org, then the php core team announces the EOL for PHP4, then namespaces get added into PHP6, and now Xdebug 2.0 is finally released. It’s not quite the precambrian, but it’s definitely been a busy few days!

Xdebug, for those of you who prefer to debug PHP code using echo and var_dump(), is a bloody lovely zend extension for php that lets you get proper debugging information for when stuff goes pear-shaped (excuse the pun). From the official announcement:

It is finally here, Xdebug 2.0.0 has arrived! After about four years of work I finally found it ready to release. Have fun! After almost four years of work, Xdebug 2 is finally ready. With improved functionality and many new features it is ready to totally change the way you develop in PHP. Some of the new features and updates include improved stack traces, execution traces to files, code coverage analysis and much improved remote debugging support. Xdebug’s documentation has also been rewritten for more clarity.

I’m leaving it for Monday to install at work, but I’m going to check the installation goes okay at home over the weekend. Finally getting function traces without having to call PEAR::Log every five microseconds? Yes please! And nicely timed just before a bout of dev work in the office too


Top twelve IT skills

Spotted over on SysAdmin’s Diary, a reference to an article in Network World Asia entitled 12 IT skills that employers can’t say no to.
It’s an… interesting list:

  • Machine learning
  • Mobilizing applications
  • Wireless networking
  • Human-computer interface
  • Project management
  • General networking skills
  • Network convergence technicians
  • Open-source programming
  • Business intelligence systems
  • Embedded security
  • Digital home technology integration
  • .Net, C #, C ++, Java — with an edge

Good grief.
Sometimes you have to despair. Let’s take a slightly less naive gullible buzzword-friendly analysis-free look at that, shall we?

Machine learning
Not machine learning, the AI field with years of development and reseach, but how to construct SQL statements to extract data efficiently from large databases.
Mobilizing applications
WAP. And HTML for small screens. And common sense about how to do UI on small screens. Palm pilot programmers, you’ve been doing this for years.
Wireless networking
Network administrator who knows about 802.11 and Bluetooth and a few others, particularly the whole bit where you don’t send your credit card details in the clear on a radio link that you can receive from a mile away with the right kind of gear (ps. that means the kind of gear anyone can buy in any amateur radio shop for a lot less than your subsequent monthly repayments will end up being). Or, as we used to call them, network-administrators-who-know-what-they’re-doing.
Human-computer interface
How the average user expects the computer to operate. Well, this is a fair enough thing to seek out in someone who’s going to do UI design, but is the company going to pay for the double-blind user trials and listen to them?
Project management
You have to wonder, with management horror stories already fuelling at least one rather well-known comic strip, what’s the ratio of how many people out there actually do know how to do this to how many people out there will claim to know how to do this? My guess is it’s a shockingly low number…
General networking skills
I find it a bit hard to believe there are developers out there who don’t know this sort of thing.
Maybe it’s more accurate to say that I find it a bit hard to believe that there are people who claim to be developers out there who don’t know this sort of thing and get away with it.
Network convergence technicians
Network-administrators-who-know-what-they’re-doing. Seriously.
Open-source programming
In other words, all that OSS has achieved in the eyes of some recruiters is to highlight those who would normally have been described as “well motivated”.
Business intelligence systems
In other words, are you a complete code geek, with no idea of what happens outside the server room, or do you happen to know that Mary in accounting needs to know how much was spent on kitchen supplies last week rather than what was spent on coffee, and what was spent on tea, and what was spent on sugar and so on. In my youth, we used to call this “cop-on”. Or “common sense”. Or “not being a <expletive deleted>”.
Embedded security
No, they don’t actually mean Embedded security, they just mean computer security, and they don’t mean as a specialisation, but as just another component in your skillset, and at the level of “Don’t save passwords in plaintext in a public file”. (This would also qualify as “cop-on” IMHO).
Digital home technology integration
Installing your fridge so it can talk to your TiVo so as to know when to order more beer and nachos (the day before the all-Ireland football finals). Seriously? This is a job now?
.Net, C #, C ++, Java — with an edge
“someone with Java who can also be a team lead or a project coordinator”. Good grief. If you want a programmer, hire a programmer. If you want a project manager, hire a project manager. If you want a team lead, internally promote a developer with the necessary skillset and time on the project. Hire someone who claims they can do it all, and you’re liable to get someone that can’t do anything properly…

The annoying thing is, I can’t tell if this is a bad article written by someone who doesn’t understand the industry; or if this really is what recruiters seek. If it’s the latter, it’s a bloody good reason to keep PHBs away from job requirement documents and let the techies write them. I mean, seriously. You want a PHP coder who’s got experience working in a Symfony framework and postgresql? Ask for that. Don’t ask for a “self-starting, well motivated open source developer with general networking and database skills and a history of working with clients to fulfill diverse requirements in a deadline driven environment”. Because the last time I checked, that just described working.

More on PHP5 adoption

Matthew Mullenweg isn’t terribly impressed with GoPHP5 or the php-internals people on the whole topic of dropping PHP4 and moving on to PHP5 and PHP6. Now, given that Matt’s the guy who founded WordPress, I reckon his opinion’s worth listening to, and given how much time I spend using vim, LaTeX and mutt, I know where he’s coming from; but he’s wrong in this instance, or at least, he’s looking at it the wrong way.

See, the difference between PHP4 and apps like LaTeX or vim is that, well, LaTeX is done. As in, it works, it’s bug-free (no, seriously, it’s as bug-free as it gets outside NASA, and a bit more so on occasion), and it does everything that its users require it to do, and well. PHP4… doesn’t. Yes, you can build apps with it, and yes, many great ones have been written. Cool. But it’s object model is fundamentally … not an object model. And it’s slower than PHP5. And if PHP itself is to survive as a language in what is a competitive space, it has a lot of work that needs doing to it. Fundamentally, it’s not done yet. It’s getting better – but to do that, it has to change, and if that means PHP4 is being left behind, I don’t think that’s worth any more tears than, say, Debian 3.0 being left behind when Debian 4.0 replaces Debian 3.1 as the stable release. It’s just how this stuff works.

Vidyut on the other hand, agrees with Matt, but more from the point of view of the end users, rather than the developers. And that’s not really all that on point, to be honest. If the developer does his or her job well, then the end user should never know what the engine is doing in the background – which, ironically enough, is his first reason as to why the PHP4->PHP5 move is a bad idea. I don’t quite get that reasoning myself. As to saying that the code clean-up that PHP5 permits is completely pointless… well, that’s just plain silly really. I mean, you can’t say that the end users shouldn’t know what the engine is doing on one hand, and on the other say that they think your code is fast and clean.

Maybe it’s a confusion over who the end users are. I mean, from the php-internals point of view, app developers are the end user; and from the developer’s point of view, the end users are, well, users.

This whole idea, though, of forking off PHP5 and leaving PHP4 alone… well, in effect, that’s what’s being done. PHP4 is being dropped. So, if you want to maintain it, do what the Joomla core team did, take a snapshot of the code and start with your maintenance and release cycles and keep PHP4 going.

I don’t think it’s a good idea though. I’ve coded in PHP5 and in PHP4, and I’ll never code in PHP4 again if I have any degree of choice in the matter. It’s too difficult to properly implement and maintain designs in it when the number of developers rises above one!

Postgres performance

For a long time now, most who’ve used both have felt that Postgres was a better database than MySQL, myself included. But until now, the stick that MySQL keep beating Postgres over the head with was performance. MySQL might be a toy database (okay, it’s moving away from that these days, but only in the last few versions and that’s not really enough dev time to be stable enough for critical stuff), but it was fast on cheap hardware, and for pragmatic web development, that meant it beat out Postgres every day of the week.

Not any more

Basicly, for the first time in a seriouly major benchmark, postgres not only outperformed mysql, but it nearly matched oracle (which was running on hardware that cost more than twice as much).

There’s also this earlier post, which basicly showed that Mysql on a single-CPU machine starts off faster than Postgres, but falls off as the number of concurrent users
rises, until it’s way behind postgres, which remains pretty invariant as the number of users rises. It also shows that postgres takes advantage of multiple CPUs better than MySQL does (up to 16 CPUs anyway, where the postgres team say they still have work to do).

Something to think about. Do you expect to ever have more than one or two users on your site? Better start with postgres so, and save yourself the cost and hassle of a later switch (I don’t care how good your database abstraction layer is, no DAL is so good that you don’t have to change your app when you switch database. Maybe more on that later.)

PHP4 End of Life

Got to hand it to the internals people, when an idea’s a good one, they run with it. First the announcement that namespaces are now officially a part of the development trunk for PHP, then this:

PHP 4 end of life announcement

Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.

The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.

For documentation on migration for PHP 4 to PHP 5, we would like to point you to our migration guide. There is additional information available in the PHP 5.0 to PHP 5.1 and PHP 5.1 to PHP 5.2 migration guides as well.

So we will finally see adoption rates for PHP5 climb a bit. You have to wonder – will the lessons learnt here prevent the PHP4-5 problems during the PHP5-6 cycle?

Stochastic Geometry is Stephen Fry proof thanks to caching by WP Super Cache

%d bloggers like this: