Useful when testing login multiple users for a web application during development
firefox -P profile2 -no-remote
An error occurred: The requested layer (1.0.0) does not exist. Available layers are:
helmi@gandalf:~/Packages/tilecache-2.10/TileCache/Services$ diff -C3 TMS.py TMS_fix.py
*** TMS.py 2010-02-02 16:12:32.000000000 +0800
--- TMS_fix.py 2010-02-02 16:13:06.000000000 +0800
***************
*** 13,18 ****
--- 13,19 ----
elif len(parts) < 2:
return self.serviceCapabilities(host, self.service.layers)
else:
+ parts = parts[-5:]
layer = self.getLayer(parts[1])
if len(parts) < 3:
return self.layerCapabilities(host, layer)
http://twitter.com/helmi03/status/8534440936
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)
helmi@gandalf:~/Packages/php> sudo pecl install gearman-0.6.0
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
<!--[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]-->
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
autocmd FileType php set keywordprg=~/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


| state | district | the_geom |
| Selangor | Petaling | POINT(101.497838106615 3.27468487066054) |
<Style name="jalan_casing2">
<Rule>
<Filter>[jenis] = 'lebuhraya'</Filter>
<MaxScaleDenominator>&maxscale_zoom7;</MaxScaleDenominator>
<MinScaleDenominator>&minscale_zoom7;</MinScaleDenominator>
<LineSymbolizer>
<CssParameter name="stroke">#808080</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Layer name="jalan_lebuhraya" srs="+proj=latlong +datum=WGS84" status="on">
<StyleName>jalan_casing2</StyleName>
<StyleName>jalan_fill</StyleName>
<StyleName>jalan_text</StyleName>
<Datasource>
<Parameter name="type">postgis</Parameter>
<Parameter name="password"></Parameter>
<Parameter name="host">localhost</Parameter>
<Parameter name="port">5432</Parameter>
<Parameter name="user">helmi</Parameter>
<Parameter name="dbname">road</Parameter>
<Parameter name="table">(select * no_jalan, 'lebuhraya' as jenis, the_geom from jalanraya.lebuhraya) as jalan</Parameter>
<Parameter name="estimate_extent">false</Parameter>
<Parameter name="extent">-180,-90,180,89.99</Parameter>
</Datasource>
</Layer>
(select * no_jalan, 'lebuhraya'::varchar as jenis, the_geom from jalanraya.lebuhraya) as jalan
httpd.exe: Syntax error on line 127 of C:/Program Files/OSGeo/MapGuide/Web/Apache2/conf/httpd.conf: Cannot load ../Php/MgHttpHandler.dll into server: The specified procedure could not be found.
LoadFile ../Php/php5ts.dll
LoadFile ../Php/ACE.dll
LoadFile ../Php/MgHttpHandler.dll # put this directive here, the first one and restart apache service
LoadFile ../Php/MgFoundation.dll
LoadFile ../Php/MgGeometry.dll
LoadFile ../Php/MgMapGuideCommon.dll
LoadFile ../Php/MgMdfModel.dll
LoadFile ../Php/MgMdfParser.dll
LoadFile ../Php/MgPlatformBase.dll
LoadFile ../Php/MgWebApp.dll
<?php
$st = 'schema.table';
print join('.', array_map(create_function('$a', 'return \'"\'.$a.\'"\';'), explode('.', $st)));
st = 'schema.table'
print '.'.join('"'+i+'"' for i in st.split('.'))
sqlite3 trac.db .dump | sqlite3 trac2.db
cp trac.db trac.broken.db
cp trac2.db trac.db
class RegexFilter extends FilterIterator {
protected $regex;
public function __construct(Iterator $it, $regex) {
parent::__construct($it);
$this->regex = $regex;
}
public function accept() {
return preg_match($this->regex, $this->current());
}
}
function find_files($path, $pattern, $include_dir=FALSE) {
$objects = new RecursiveDirectoryIterator($path);
$objects = new RecursiveIteratorIterator($objects, RecursiveIteratorIterator::SELF_FIRST);
$objects = new RegexFilter($objects, $pattern);
return $objects;
}
$files = find_files('/tmp', '/.py$/');
foreach ($files as $file) {
echo $file;
}
function find_files4($path, $pattern, $callback=null) {
$path = rtrim(str_replace("\\", "/", $path), '/') . '/';
$matches = Array();
$entries = Array();
$dir = dir($path);
while (false !== ($entry = $dir->read())) {
$entries[] = $entry;
}
$dir->close();
$files = array();
foreach ($entries as $entry) {
$fullname = $path . $entry;
if ($entry != '.' && $entry != '..' && is_dir($fullname)) {
$this->find_files($fullname, $pattern, $callback);
} else if (is_file($fullname) && preg_match($pattern, $entry)) {
if (!$callback) {
$files[] = $fullname;
} else {
call_user_func($callback, $fullname);
}
}
}
if (!$callback) {
return $files;
}
}
#!/usr/bin/python
fn = '/home/helmi/world.csv'
columns = file(fn).readline()
print 'create table world (%s text);' % " text,".join(columns.split(','))
print "copy world from '%s' with csv header;" % fn
python csv2psql.py | psql mydb
sudo apt-get install xmlstarlet
helmi@gandalf:/tmp> xmlstarlet val -e --xsd http://code.google.com/apis/kml/schema/kml21.xsd tree.kml
tree.kml - valid
# for offline xsd
helmi@gandalf:/tmp> wget -c http://code.google.com/apis/kml/schema/kml21.xsd
helmi@gandalf:/tmp> xmlstarlet val -e --xsd kml21.xsd tree.kml
tree.kml - valid
# without option -e, don't know status when xsd file not found
helmi@gandalf:/tmp> xmlstarlet val --xsd invalid_kml21.xsd tree.kml
# better version
helmi@gandalf:/tmp> xmlstarlet val -e --xsd invalid_kml21.xsd tree.kml
I/O warning : failed to load external entity "invalid_kml21.xsd"
Schemas parser error : Failed to locate the main schema resource at 'invalid_kml21.xsd'.
# of course you can validate kml generated by php
helmi@gandalf:/tmp> xmlstarlet val -e --xsd kml21.xsd http://localhost/~helmi/tree_kml/trees.php
http://localhost/~helmi/tree_kml/trees.php - valid
RewriteEngine on
RewriteBase /~helmi/tree_kml/
RewriteRule trees\.kml$ trees.php [NC] # note that without option R
sudo mv /usr/bin/scrollkeeper-update /usr/bin/scrollkeeper-update.real
sudo ln -s /bin/true /usr/bin/scrollkeeper-update
sudo find /var/lib/scrollkeeper/ -name \*.xml -type f -exec rm -f '{}' \;
sudo dpkg-divert --local --divert /usr/bin/scrollkeeper-update.real --add /usr/bin/scrollkeeper-update