11 February 2008

php popen whitespace bug in windows

This popen path with whitespace bug, http://bugs.php.net/bug.php?id=40988&edit=1 make my day worse. Tired from long 9 hours journey from 'balik kampung', arrive at 3.30am and 8.30am go to office, huh. Then have to debug why the stupid php don't want execute the command.

I want use php to backup a postgis table. So

system('"C:\\Program Files\\PostgreSQL\\8.2\\bin\\pg_dump.exe" -t project_geom projectgis > '.$backup);

that, should straight forward, but the output is empty page. Then use popen to redirect the stdout and stderr, 2>&1 for debugging, I get this message

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

Tried many technique to solve: escapeshellarg(), backslash to slash, all lowercase, etc, then afters spent hours debugging, it was the php problem, not my code. grrr.

A 8.3 name (PROGRA~1) will still work on Windows, if it's not disabled
in the NTFS settings.

05 February 2008

Traffic images on google map

Simple map to show live traffic images.

Wake up early plus lazy to go to office :-( Rather than read reddit and google reader, this morning I decide to create simple map instead. Map for my town and click the marker for live traffic image, hah, deadly simple idea! Since lazy morning, I don't know any legal issue regarding the image, so "It's Easier to Ask Forgiveness Than Permission"