Thursday, July 17, 2008

JNI issues on linux

Problem #1: when compiling JNI component on a linux machine, it was missing tons of type definitions from jni.h. It appears libgcj-devel-version needs to be installed as the jni.h in it has the native datatype definitions.

Problem #2: if you see an error message such as the following when executing JNI components:
wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
Chances are that your jni shared library .so was compiled to be 64bit but your JDK/JVM is 32-bit! just use 64-bit java to run it instead

Thursday, June 12, 2008

PHP failed when calling imagecreate

1. download libjpeg source code from here

2. manually change your Makefile before compiling PHP, make sure this is added:
-I/path/to/jpegsrc

GDLIB_CFLAGS = -I/usr/opt/distfiles/src/php-5.2.5/ext/gd/libgd -DHAVE_LIBPNG -DHAVE_LIBJPEG -I/opt/distfiles/src/jpeg-6b

3. make;make install or cp libphp5.so to replace your current one in apache
Reference: http://ca.php.net/gd

Friday, June 6, 2008

vmware server unable to see USB devices

vmware server under ubuntu is unable to see some USB devices
two ways to fix this:

1. execute this command:
mount -t usbfs none /proc/bus/usb

2. add the following to /etc/fstab
usbfs /proc/bus/usb usbfs auto 0 0

Reference:
http://www.blog.arun-prabha.com/2007/04/11/running-windows-under-ubuntu-edgy-using-vmware/

Wednesday, May 28, 2008

extract project lead email list in JIRA

select p.pname, ub.username, ps.propertyvalue from userbase ub,propertyentry pe, propertystring ps, project pwhere ub.id=pe.entity_id and pe.property_key=’email’ and ps.id=pe.id and p.lead=ub.username order by p.pname

Reference:http://confluence.atlassian.com/display/JIRA/Database+Schema

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