Tuesday, April 22, 2008

extract the last field in unix shell script

scratch notes on aws exacting the last field!
echo “ABC.123.QIP.ERR” | awk -F. {’print $(NF-0)’}

- dot after F is the field deliminator
- minus zero is the field to extract from backwards of the string

Monday, April 14, 2008

dvd burning failed in ubuntu gutsy

Not sure if this started to happen after gutsy upgrade, but DVD burning failed on random basis… until I run the following commands everytime before burning then it would be successful.

hdparm -d1 -X66 -c1 -Y /dev/hdc
hdparm /dev/hdc

Tuesday, April 1, 2008

subversion with apache integration apr-util issue

I was compiling subversion 1.4.0 to be integrated with apache httpd 2.2.8. Everything went smoothly during the compilation process until I tried to access subversion through http, it shows the error message below everytime and resulted in error 500 in the browser:

[Mon Mar 17 16:04:17 2008] [error] [client 10.225.32.40] Could not fetch resource information. [500, #0][Mon Mar 17 16:04:17 2008] [error] [client 10.225.32.40] Could not open the root of the repository [500, #22][Mon Mar 17 16:04:17 2008] [error] [client 10.225.32.40] Can’t set position pointer in file ‘/path/to/repo/db/revs/11857′: Invalid argument [500, #22

It turns out that subversion linked with a different version of apr-util than apache httpd, see blow:

[user@hostname bin]$ ldd ./httpd grep aprlibaprutil-1.so.0 => /path/to/httpd-2.2.8/lib/libaprutil-1.so.0 (0×00ca0000)libapr-1.so.0 => /path/to/httpd-2.2.8/lib/libapr-1.so.0 (0×0035b000)
[user@hostname bin]$ ldd /path/to/httpd/modules/mod_dav_svn.so grep aprlibaprutil-0.so.0 => /path/to/subversion/lib/libaprutil-0.so.0 (0×00111000)libapr-0.so.0 => /path/to/subversion/lib/libapr-0.so.0 (0×00ca4000)

The reason is that subversion-deps-1.4.0.tar.gz comes with an older version of apr-util than the one in apache httpd 2.2.8.To resolve this issue, simply copy the new version of apr and apr-util source to subversion build directory and recompile:

cp -pR ../httpd-2.2.8/srclib/apr/ apr
cp -pR ../httpd-2.2.8/srclib/apr-util/ apr-util
make clean; ./configure –prefix=/path/to/subversion –with-apxs=/path/to/httpd/bin/apxs ; make ; make install