't Bijstere spoor

't Bijstere spoor

A blog about Web development

PHP Quicksearch in firefox

If you're a PHP developer, you'll likely often need to open up php.net to find out the [the order of ;)] arguments for a function.

Generally i just type, php.net/functionname, but if you want to save 4 more keystrokes you can easily add a quick search. Just open up your bookmarks (or places if you're on FF3). And add a new bookmark to the Quick Searches folder.

PHP quicksearch

Use 'php' in the keyword field, and for the url, use:

http://www.php.net/search.php?show=quickref&pattern=%s

Now, you can simply type php in_array in your address bar, and you can find out if the needle or the haystack comes first.

p.s.: similarly, the 'slang' quicksearch has helped me adjust to north america a lot ;)
p.p.s.: lovin' the firefox 3 experience on beta, can't wait for all the extensions to work..


SabreAMF 1.0-beta4

Just posted a new release candidate for SabreAMF. SabreAMF was missing proper handling of arrays with mixed string and numeric keys in the AMF3 serializer.

Google Code download page


SabreAMF 1.0-beta3

Some bugs were found in encoding integers using AMF3 (thanks Kevin Martin).

These should now be resolved. A new download is up on Google Code.


Flash Uploader on Mac not triggering onComplete event

We have had a whole bunch of issues with the Flash 8 uploader on OS/X in the past. Now its completely broken on leopard, but before we weren't able to do multi-file uploads because the 'onComplete' event wasn't triggered from within flash.

We've been using a (modified) version of SWFUpload and also our Flash applications have had this issue..

Today I read on The Joy of Flex-blog that there's actually a really simple solution to this problem. Have your PHP (or other server-side) simply return some data. Our upload-endpoint normally always returned nothing at all, because it seemed unnecessary, but returning a small body in your HTTP response fixes the issue!

As you can tell, I'm excited.


PHP shutdown sequence

I needed to figure out in what order PHP shuts down, after the end of a script has been reached, so I created a small testing script. Maybe this is of use for someone else trying to google this like I tried.

<?php

    
// Testing shutdown sequence

    
function shutdown() {

        echo 
"register_shutdown_function\n";

    }

    
register_shutdown_function('shutdown');


    class 
MyClass {

        function 
__destruct() {

           echo 
"Object destructor\n";

        }


    }

    function 
obcallback($buffer) {

        
$buffer .= "Output buffer callback\n";
        return 
$buffer;

    }

    
ob_start('obcallback');

    
$myObject = new MyClass;

    function 
dummy() { }

    function 
sessionclose() {

        echo 
"Session close\n";

    }

    function 
sessionwrite() {

        echo 
"Session write\n";
    }

    
session_set_save_handler('dummy','sessionclose','dummy','sessionwrite','dummy','dummy');

    
session_start();

?>

The output, on PHP 5.2.0 on the cli is:

register_shutdown_function
Object destructor
Output buffer callback
Session write
Session close

I was mostly interested in this because I wanted to work with a custom session handler. This means I can basically not use objects in combination with session handlers, unless I don't rely on $this.


MemCached and MySQL UDFs

Looks like MySQL gets MemCached UDF's (user defined functions).

This was mentioned by Patrick Galbraith on the MemCached mailing lit yesterday. This is amazing news, as this will allow you to update or invalidate cache entries from within MySQL using a trigger. This reduces the complexities of cache invalidations by a huge extent. Its unclear if this is part of the MemCached project or a separate project.

Can't wait!