29 November 2008

Vim smart syntax highlighting

Smart because it syntax highlighting sql in php heredoc. gedit and nano don't support this. I don't know about other editor.
I used font size 16 all the time, big font eh ;-)

24 November 2008

Disable scrollkeeper on Ubuntu

"proses ini hampir memakan 90% cpu dan memory, dan seringkali menyebabkan sistem menjadi hang" -- happen to me today and not at right time.

To disable:

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

* http://blog.its.ac.id/kholis/2008/11/01/scrollkeeper-di-ubuntu/
* http://mapopa.blogspot.com/2008/09/disable-scrollkeeper-on-ubuntu-is-good.html

31 October 2008

Google Maps driving direction to Machang, Malaysia

Google Maps driving direction back again as today, 31 Oct 2008. It not official, I guessed (since not mentioned in Google LatLong). So, I give it a try from Kuala Lumpur to Machang

From Misc

The routing is accurate and fast (compared to Garmin Que+malsingmaps which lead me to Ipoh instead of Gua Musang before reach Machang). But the direction is not detail enough, see the instruction no 24 in screenshot below. "Continue on 8 -- 307 km" but from the map, the blue road show that you have turn right at Pekan Gua Musang.

From Misc

You should try 'Print' function, look useful. Hey, this driving direction also works on Google Maps on my Windows Mobile, Dopod M700. On mobile version, you have feature 'My Location' and integration with GPS works for me.

Cannot wait to see Malaysian Street View :-)

16 October 2008

1.0 is greater than 0.9.x [ies4linux]

helmi@gandalf:~/Packages/ubuntu/ies4linux-$ ./ies4linux
IEs4Linux 2 is developed to be used with recent Wine versions (0.9.x). It seems that you are using an old version. It's recommended that you update your wine to the latest version (Go to: winehq.com).

and when

helmi@gandalf:~/Packages/ubuntu/ies4linux-$ wine --version

what?? I't wrong warning dude. 1.0 > 0.9.x

19 September 2008

IE innerHTML - "Unknown runtime error"

"Unknown runtime error" -- only in IE. Occur when click 'innerHTML WITH form tag'

<div id="replaceme"></div>
<div onclick="replace();return false;">innerHTML WITHOUT form tag</div><br/>
<div onclick="replace2();return false;">innerHTML WITH form tag</div>
function replace() {
document.getElementById('replaceme').innerHTML = 'REPLACED';
function replace2() {
document.getElementById('replaceme').innerHTML = '<form>REPLACED form</form>';

innerHTML supposed to supported on all major browser, http://www.quirksmode.org/dom/innerhtml.html

Current solution, don't wrap the #replaceme div in form tag

30 August 2008

"unable to resolve host" that matter

The "unable to resolve host" is matter when I have problem installing mysql.

Whenever sudo in my hardy , I got "unable to resolve host" . No harm and my terminal works as usual, so just ignore it.
helmi@hix2:~> sudo -s
sudo: unable to resolve host hix2
Then, today wanna use mysql for my pet project.
helmi@hix2:~> sudo dpkg --configure mysql-server-5.0
sudo: unable to resolve host hix2
Setting up mysql-server-5.0 (5.0.51a-3ubuntu5.2) ...
* Stopping MySQL database server mysqld
Reloading AppArmor profiles Warning: found /etc/apparmor.d/force-complain/usr.sbin.named, forcing complain mode
: done.
* Starting MySQL database server mysqld
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.0 (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
Nothing in /var/log/mysql.err or /var/log/mysql.log , but something in /var/log/syslog
Aug 30 05:07:00 hix2 mysqld[2817]: 080830 5:07:00 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'host'
Then "unable to resolve host" become matter now. Solution: add following line to /etc/hosts, then reconfigure mysql hix2

15 May 2008

Connect winxp lappy to kubuntu using samba

I want transfer files from my lappy to my kubuntu desktop FAST. I managed make my lappy talk to kubuntu via ssh (winscp), but not fast enough. Yeah, I know it caused by encrypt, bla bla ... I'm the only one who use LAN in my home, so who cares about security???

Anyway, since new to setup samba, I thought it just matter click Next, Next, ... and so on. Not that easy maa. After setup it in kubuntu, whenever I submit uname/passwd from windows xp, it keep popup the uname/passwd, without error msg. Spend hours RTFM, google , read article, ... then, manage to fix it. When troubleshoot, I reach to the:

C:\> net view \\bigboy
System error 5 has occurred.

Access is denied.

Then, it easier to fix when know cause of the problem. Just enable the 'encrypt password = yes'. I also added the samba user by smbpasswd

11 May 2008

Why I hate innerHTML

Why I hate innerHTML? Because IE suck! It doesn't work for select tag in IE. I have something like

<select id="foo"><option value="1">baz</option></select>

Javascript that doesn't work in IE:
document.getElementById("foo").innerHTML = '<option value="2">baz</option>';

Solution -- have to use DOM lah! Note that use innerHTML will destroy the tag events. My prefered solution:

document.getElementById("foo").options[0] = new Option("baz", 2);

Astute reader may ask, why not use dom method add() ? Again, because IE suck!

var x=document.getElementById("foo");
x.add(y,null); // standards compliant
x.add(y); // IE only


More love/hate on innerHTMl, http://www.wait-till-i.com/2006/04/18/innerhtml-vs-dom-pot-noodles-vs-real-cooking/

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"