Archive for November, 2008

override_function() in PHP

Saturday, November 29th, 2008

I’ve been writing a wrapper for Cherokee’s MySQL load balancer to transparently replace PHP’s MySQL functions and provide connection pooling and database balancing at absolutely no cost. And I encountered a problem wanting to override those built-in functions.

It looks like the override_function() has a bug that prevents from using it to override two or more functions, since it issues this error:

Fatal error: Cannot redeclare __overridden__()

Judging by the C code for PHP’s override_function() function, instead of hardcoding the overriden function name it was planed to generate random names, but for reasons unknown to me this never happened.

Anyway, I can’t believe the fix for this is so simple and yet the solution didn’t appear in PHP’s excellent online documentation. It had me lost for a while, but it’s as simple as renaming the overriden function!! This is from the wrapper I mentioned, that will be distributed with Cherokee shortly:

foreach ($substs as $func => $ren_func) {
    override_function($func, $args[$func], "return $substs[$func];");
    rename_function("__overridden__", $ren_func);
}

Some guys are simply brilliant

Friday, November 28th, 2008

You know those times when you stumble upon a good idea and think it is plain genius?

Alvaro told me about it this morning and I just had to share it with everybody. This is what you will find if you visit http://apache-es.org, a community in Spanish built to talk about Apache and system administration.

apache-es2 Some guys are simply brilliant

The “aviso” part is a warning:

Apache-es.org, the only Q&A site about Apache that is running Cherokee!

As I said: plain genius!

Cherokee on steroids: v0.11 now with reverse proxy

Thursday, November 27th, 2008

Yesterday we reached yet another milestone in Cherokee’s development towards World Domination. After almost a month of hard work, our newest creation hit the streets. The official anouncement hasn’t even been made yet, but Cherokee 0.11.1 is out in the wild.

Besides our regular bug fixes and performance enhancements, it is shipped with some new features. SSI support was being requested every now and then, the SSL infrastructure has been reworked and the new reverse proxy is working flawlessly. The Windows build is not a reality yet, but great advances have been made towards that end. Cherokee is currently working under Windows, but the admin is not. And it has to be cross compiled, for now. Anyway, we’re one step closer to releasing a binary Windows build ;)

Cherokee Webserver

We have a lot of fresh ideas, and as always feedback and feature requests are more than welcome at the mailing lists. Here are links to download and read the online documentation with tons of new information and recipes. Enjoy! ;)

UPDATE: Link to the official anouncement.

Gems of wisdom from a three year old

Wednesday, November 26th, 2008

This weekend I had a little accident with the mountain bike. A truck came out of nowhere in the middle of the mountain -like they always do-, I got surprised, fell and took the hit with my bare hands. I’ll be spending some days with raw-flesh-style palms.  What can I say? I’m a fashion victim. Sort of.

Anyway, I was having my injuries treated at my sister’s when my nephew came by. He’s a three year old, so every answer I gave him about the accident raised another question.

This one was priceless:

Uncle, do you want my training wheels?

Python can do a lot of things

Thursday, November 20th, 2008

But it is not omnipotent. Leave that to Q. I stumbled upon this funny answer from back in 2005 and I had to share it. That guy is a genius! ;-)

I’m curious how I can make Python print text in color.

That depends strictly on your printer. With my hp LaserJet 1200, no way — not even Python’s power can overcome the hardware’s limitations in this regard… it’s a black-and-white printer and that’s all there is to it! If I did have a color printer, then I would have Python produce the appropriate postscript code, or “escape-sequences” in whatever printer-specific language a given printer requires to have it output color text (or, depending on my operating system, printer driver, filters, etc, I might have to send appropriate “escape-sequences” or whatever to the DRIVER in order to convince it to drive the printer appropriately).

The family keeps growing

Friday, November 14th, 2008

I posted a note about this at Cherokee’s main site, but I totally forgot to tell you over here. My bad.

However, it’s never late to share good news. A couple of days ago Cherokee’s family incorporated a Polish Cherokee Community as new member!

And they took a huge leap forward by creating Cherokee Polska, which isn’t just another site about Cherokee. So far they’ve translated everything, documentation included. And the effort has been worth it. They received thousands of unique visitors on their first day, and that is only the beginning.

cherokee-polska-small The family keeps growing

From here, I wish to extend my most sincere congratulations to these guys. Great work!

Since Cherokee has been steadily getting better and better, I expect more localization initiatives will keep popping up. We’ll see it in time. That’s a given.