I don't like PHP's new namespace separator. I prefer '::' to '\'.
Aaaaargh... why did they choose the escape character?
Monday, October 27, 2008
Slow lighttpd using IPv6
I've been wondering why lighttpd seems to be so slow when IPv6 is enabled. I discovered that I had to bump the minimum and maximum number of FastCGI process (min-procs/max-procs) by twice as much because it appears that lighttpd divides the available PHP processes between IPv4 and IPv6. I dunno why it does that.
Thursday, October 16, 2008
How to destroy all gif interfaces in FreeBSD
To destroy all gif interfaces in FreeBSD (vanilla Bourne shell):
for i in `ifconfig -a | grep gif | grep -v '%' | sed -n -e 's/\(.*\):.*/\1/p'`; do
ifconfig $i destroy
done
Monday, October 13, 2008
Stuck DVD inside MacBook
A DVD got stuck inside my MacBook. What I did was to insert a prepaid card (it's made of plastic that's thin yet durable enough for this purpose) into the DVD slot, pushed it upwards and pressed the eject button. The DVD then came out.
Thursday, October 09, 2008
Looking for a used PC
I'm looking for a used Pentium III (or better) PC that I can use as a router/firewall. No need for monitor, keyboard, or CD-ROM. Just a CPU with enough hard disk and RAM. Please contact me if you have one. Cebu area only.
Wednesday, October 01, 2008
Library dependency woes
One of my Unix workstation is now fucked up due to forced installation of incompatible libraries. I guess I'll have to reformat it in order to start from a clean slate. I'm planning to temporarily transfer my files to my external harddisk, but FreeBSD can't seem to read it although it has been formatted as UFS. I formatted that harddisk on my Mac OS X laptop, thinking that it can be read in FreeBSD, but Mac OS X seems to have a different interpretation of what UFS is. Blah. I guess I need to reformat my external harddisk to FAT32 too. Oh wait. If I format it as FAT32, what would happen with my file permissions? Maybe I'll just use tar or something. Blah, blah, blah.
Wednesday, September 10, 2008
Google Chrome Browser on Mac OS X
While waiting for a Mac OS X version of the Chrome browser, I've content myself with VMWare Fusion's Unity feature instead:

Cool, huh?

Cool, huh?
Monday, July 07, 2008
Figlet Preview
Problem:
I wanted to use figlet but I can't decide which font to use.
Solution:
To inspect all fonts visually, simply do:
% cd /usr/local/share/figlet
% for i in `ls *.flf | sed -n -e 's/\(.*\)\.flf/\1/p'`; do echo Phuselage | figlet -f $i; done | less
Your mileage may vary; the font dir may be different on your operating system.
I wanted to use figlet but I can't decide which font to use.
Solution:
To inspect all fonts visually, simply do:
% cd /usr/local/share/figlet
% for i in `ls *.flf | sed -n -e 's/\(.*\)\.flf/\1/p'`; do echo Phuselage | figlet -f $i; done | less
Your mileage may vary; the font dir may be different on your operating system.
Friday, June 20, 2008
Synchronizing two CVS repositories using Mercurial
We're in a situation where we have access to some of our partner's source code. We need to keep in sync with their repo, otherwise our copy would quickly become stale.
Currently, we can do this manually because our changes are still small. A few months from now, however, our changes will eventually drift away from their code and merging it with our tree would become difficult.
A distributed version control system is in order. Here's how I did it:
In theory, exporting it back to CVS is no longer needed. In practice, however, I needed to maintain "compatibility" with my fellow developers who only use CVS. I hope we'll eventually migrate away from CVS though because merging lots of files is really time consuming. Merging/branching is CVS' main weakness.
Currently, we can do this manually because our changes are still small. A few months from now, however, our changes will eventually drift away from their code and merging it with our tree would become difficult.
A distributed version control system is in order. Here's how I did it:
+-----------------+ +------------+ +------------+ +----------------+
| Upstream | | Immutable | | Working | | Local |
| CVS repository |-------->| Mercurial |---------------->| Mercurial |-------->| CVS repository |
+-----------------+ import | repository | Mercurial pull | repository | export +----------------+
+------------+ +------------+
|^
||
||
v|
User
In theory, exporting it back to CVS is no longer needed. In practice, however, I needed to maintain "compatibility" with my fellow developers who only use CVS. I hope we'll eventually migrate away from CVS though because merging lots of files is really time consuming. Merging/branching is CVS' main weakness.
Thursday, June 19, 2008
MySQL: How to merge two databases
I'm currently managing a couple of databases in a production server. The problem: I need to know what new tables were created from Database 1 and merge them to Database 2.
Here's the solution:
0. Backup the target database.
% mysqldump -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database2 > Database2.sql
1. Extract the table names from the source and target databases.
% echo show tables | mysql -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database1 | sed '1d' > one.tables
% echo show tables | mysql -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database2 | sed '1d' > two.tables
2. Perform the merge.
% mysqldump -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database1 \
`diff --unchanged-line-format='' --new-line-format='%l ' two.tables one.tables` | \
mysql [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database2
Here's the solution:
0. Backup the target database.
% mysqldump -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database2 > Database2.sql
1. Extract the table names from the source and target databases.
% echo show tables | mysql -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database1 | sed '1d' > one.tables
% echo show tables | mysql -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database2 | sed '1d' > two.tables
2. Perform the merge.
% mysqldump -h [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database1 \
`diff --unchanged-line-format='' --new-line-format='%l ' two.tables one.tables` | \
mysql [HOST] -P [PORT] -u [USERNAME] -p[PASSWORD] Database2
Wednesday, June 04, 2008
Unix/Linux Tip: Syntax check your PHP files
If you wish to syntax check (lint) all the PHP files in your current directory, simply do:
for i in `ls *.php`; do
php -l $i
done
for i in `ls *.php`; do
php -l $i
done
Thursday, May 29, 2008
Fedora/Redhat Linux: C/C++ : unfound library "mysql.h"
If you encounter this problem while compiling an application that links to MySQL, you can fix this by simply installing mysql-dev:
# /etc/init.d/mysqld stop
# yum install mysql-dev
# /etc/init.d/mysqld stop
# yum install mysql-dev
Saturday, April 26, 2008
FreeBSD Tip: How to delete all IPv6 address in an interface
You can delete all IPv6 addresses in an interface using the following command (vanilla Bourne shell):
Note: replace le0 with your interface name.
while i="`ifconfig le0 | grep inet6 | grep -m 1 -v '%'`"; do
ifconfig le0 $i delete
done
Friday, April 25, 2008
Bridge problem with FreeBSD 7.0-RELEASE
Problem
The FreeBSD Handbook states that "if the bridge host needs an IP address, then the correct place to set this is on the bridge interface itself rather than one of the member interfaces."
With FreeBSD 6.x and FreeBSD 8.0-CURRENT, setting the IP address on the bridge works without any problem. With FreeBSD 7.0-RELEASE, however, this does not work. The OS doesn't even properly boot when the IP address is set via /etc/rc.conf.
Solution
This is probably a temporary solution, but try setting the IP address to one of the member interface. This is in direct opposition to the advice given in the Handbook, but it works for me.
If this is a bug (which I suspect it is), a patch probably exists somewhere. Please feel free to leave a comment.
The FreeBSD Handbook states that "if the bridge host needs an IP address, then the correct place to set this is on the bridge interface itself rather than one of the member interfaces."
With FreeBSD 6.x and FreeBSD 8.0-CURRENT, setting the IP address on the bridge works without any problem. With FreeBSD 7.0-RELEASE, however, this does not work. The OS doesn't even properly boot when the IP address is set via /etc/rc.conf.
Solution
This is probably a temporary solution, but try setting the IP address to one of the member interface. This is in direct opposition to the advice given in the Handbook, but it works for me.
If this is a bug (which I suspect it is), a patch probably exists somewhere. Please feel free to leave a comment.
Friday, April 18, 2008
JPEG support for ImageMagick
Problem
On Debian Linux, there seems to be no out-of-the-box support for JPEG in ImageMagick.
Solution
First, install libjpeg62-dev library. libjpeg62 doesn't work because it doesn't include the necessary development files. Next, download ImageMagick's source and compile it manually. Use ./configure --with-jpeg=yes for configuring.
On Debian Linux, there seems to be no out-of-the-box support for JPEG in ImageMagick.
Solution
First, install libjpeg62-dev library. libjpeg62 doesn't work because it doesn't include the necessary development files. Next, download ImageMagick's source and compile it manually. Use ./configure --with-jpeg=yes for configuring.
Wednesday, April 16, 2008
Tuesday, April 08, 2008
OpenLaszlo IDEforLaszlo Eclipse plugin

Syte GMBH has provided an update for IDEforLaszlo plugin to support OpenLaszlo 4.0.10 and OpenLaszlo 3.4. IDEforLaszlo has been stale for quite some time now, and I'm glad that someone has offered their time and effort for this project. I'll be checking it out later.
IDEforLaszlo can be found at http://www.syte.ch/en/laszlo.xml.
Friday, April 04, 2008
Technical Humor
Yeesh, I found the links for the April 1 RFCs. Here's a dose of highly technical humor:
WARNING: Reading the above documents may result in nosebleed.
WARNING: Reading the above documents may result in nosebleed.
Tuesday, April 01, 2008
Morph eXchange
Our friends from Morph Labs has just launched version 2.0 of their Morph eXchange website. Congratulations, butterfly!
Subscribe to:
Posts (Atom)