28 October 2009

gearman php problem on jaunty

Get this error on my ubuntu jaunty, works perfectly on hardy. I don't have the solution (hope expert out there post solution in comment)
helmi@gandalf:/tmp> php reverse_client.php 
Sending job
ALERT - canary mismatch on efree() - heap overflow detected (attacker 'REMOTE_ADDR not set', file '/tmp/reverse_client.php', line 10)

How I install:
helmi@gandalf:~/Packages/php> sudo pecl install gearman-0.6.0

some info:
helmi@gandalf:~/Packages/php/gearman-0.6.0> phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
helmi@gandalf:~/Packages/php/gearman-0.6.0> echo '<?php phpinfo();' | php| head 
phpinfo()
PHP Version => 5.2.6-3ubuntu4.2

System => Linux gandalf 2.6.28-15-server #52-Ubuntu SMP Wed Sep 9 11:50:50 UTC 2009 i686
Build Date => Aug 21 2009 19:12:00
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
Scan this dir for additional .ini files => /etc/php5/cli/conf.d

helmi@gandalf:~/Packages/php/gearman-0.6.0> gearmand -V
gearmand 0.10 - https://launchpad.net/gearmand

16 October 2009

Fix IE6 png transparency

Don't know who use IE6 these days (already 2009 lah), but one of my friend need to fix his website. So here the css (modified from a google result)

<!--[if lt IE 7]>
<style>
img {
  position: relative;
  behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
  this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
  this.src = "http://imgur.com/ZOqET.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),                                                                                                                                                     
  this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
  this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));
}
</style>
<![endif]-->

09 October 2009

Inconsistent PHP - I'm sick of it

PHP is inconsistent, sick of it. $needle or $haystack? Which one first? List of php function that inconsistent needle/haystack

helmi@gandalf:/usr/share/doc/php-doc/html> grep -l needle *| grep ^function | sed 's/^function.//'| sed 's/.html$//'| sed 's/-/_/'
array_search
grapheme_stripos
grapheme_stristr
grapheme_strpos
grapheme_strripos
grapheme_strrpos
grapheme_strstr
iconv_strpos
iconv_strrpos
in_array
mb_stripos
mb_stristr
mb_strpos
mb_strrchr
mb_strrichr
mb_strripos
mb_strrpos
mb_strstr
mb_substr-count
stripos
str_ireplace
stristr
strpos
strrchr
str_replace
strripos
strrpos
strstr
substr_count


So I refer to php manual everytime use these functions, grrr. For vim, i override key binding for 'K' (:help K) - "Run a program to lookup the keyword under the cursor". In .vimrc
autocmd FileType php set keywordprg=~/bin/php_doc

and my ~/bin/php_doc

#!/bin/sh
FN=`echo $1 | sed 's/_/-/g'`
echo ********************** $FN **********************

echo $FN
w3m file:///usr/share/doc/php-doc/html/function.$FN.html

02 October 2009

OpenStreetMap data for Malaysia = impressive progress!


Version 17 Apr 09

Version 24 Sept 09


OpenStreetMap data for Malaysia = impressive progress!
Quite a lot of new road added at Kuala Lumpur for 5 months work.
Map above viewed using udig.
Google Map Maker is available for Malaysia, but don't think it easy for offline usage/internal use (hint:shapefile).