Being directly involved with two open source projects, Gallery and Habari, I sometimes get to witness some rather esoteric problem solving. I would never call myself a great developer,
probably not a developer at all, but sometimes people present code that just leaves me wondering if some people come from other planets.
Most of the time this involves some rather heavy regexp trickery like the one below:
/(translate|i18n)\(\s*(((\s*\.\s*)?
('((\\')?[^']*)*[^\\]'|"((\\")?[^"]*)*[^\\]"))*)\s*\)/s
Thats from some kind of language related code in Gallery 2, at least it was in 2004 when the quote is from, that Alan Harder created an insane Regular Expression statement for.
I can't even begin to try and understand what it matches and I'm pretty sure my head would
explode if I did. For some reason regexp seems to constantly elude me.
My other example is more current and from the #habari irc channel. A recent code commit in the svn trunk caused this site to bail out with a sql related issue.
Thanks to Jay Pipes it was a fairly easy fix, involving some simple SQL statements:
CREATE TEMPORARY TABLE dup_slugs SELECT tag_slug, COUNT(*) FROM habari__tags GROUP BY tag_slug HAVING COUNT(*) > 1; SET @row_count:= 1; UPDATE habari__tags INNER JOIN dup_slugs ON habari__tags.tag_slug = dup_slugs.tag_slug SET habari__tags.tag_slug = CONCAT(habari__tags.tag_slug, (@row_count:= @row_count + 1));
I still can't read that properly, but it did indeed fix the problem I had with a recent change to the tags table in Habari resulting in duplicate tags. Or something similar.
My only conclusion is, good developers are in fact aliens. No doubt about it.