Tuesday, December 30, 2008

intellij keyboard freeze on linux

intellij 8.0 keyboard randomly freezes and becomes unresponsive on ubuntu linux. The problem is cause by some strange interaction with scim keyboard input system. Exit scim and the keyboard will work again.

Monday, December 22, 2008

ssh public key authentication and permission

the user home directory must have be chmod g-r ~
otherwise rsa public key authentication would not work

Friday, December 12, 2008

virtualbox command line

turn off vm
VBoxManage controlvm vmname poweroff

clone vm hd
VBoxManage clonevdi source.vdi clone.vdi

Wednesday, October 15, 2008

jini 2.1 install problem on linux

Preparing to install...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
nawk: error while loading shared libraries: libm.so.6: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/bin/ls: error while loading shared libraries: librt.so.1: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
hostname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory



solution:
% cat jini2_1.bin | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > jini.bin
% sh ./jini.bin

Tuesday, September 30, 2008

VirtualBox command lines

To shutdown VM:
VBoxManage controlvm "vmName" savestate

Tuesday, September 23, 2008

serial modem locked

linux store serial port lock files in /var/lock
simply remove the LCK.. and it should unlock the modem

Thursday, August 21, 2008

Error code: ssl_error_rx_record_too_long

had trouble setting up ssl on ubuntu 8.04. keep getting Error code: ssl_error_rx_record_too_long in firefox

this is how I fixed it:

create ssl certificate for apache on ubuntu 8.04 :
sudo mkdir /etc/apache2/ssl
sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem

cd /etc/apache2/sites-available
cp default ssl

edit ssl, add
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem

enable site,
a2ensite ssl

htpasswd syntax

add new user to subversion password file

htpasswd -m /etc/svn-auth-file sally

change application context in grails

to change the application context in a grails app,
in Config.groovy add grails.app.context=/mycontextpath

Sunday, March 30, 2008

creating an iso from file on linux

I have a file that I need to convert to iso so that I can mount it cd a CDROM in QEMU. Here's how to do it:

mkisofs -o foo.iso foo.file

Thursday, March 6, 2008

change postgres user password

ALTER USER postgres WITH PASSWORD '';

Wednesday, February 27, 2008

groovy script to rename a lot of files

I got a hold of 1692 mp3 files of Chinese characters for a Chinese-English dictionary that I wrote with my 16year old cousin to introduce him to programming in Groovy. The dictionary is called xiaosu cidian 小苏词典 http://www.diningphilosophers.net/xiaosu

The mp3 files are all in uppercase but I wanted them in lower case. Here's the script I wrote to do that:


new File(".").eachFile{ f->
def cmd = "mv $f.name ${f.name.toLowerCase()}"
cmd.execute()
}


Much easier than with Java!

Tuesday, February 12, 2008

internationalization (i18n) in grails

any .properties files put in grails-app/i18n can be used to store internationalized text.

for example, grails-app/i18n/foobar.properties

the internationalized text can be accessed in the view using

Monday, February 11, 2008

grails configuration file

To access a key in Config.groovy, grailsApplication.config.key

extracting html form unicode data

tomcat has problems with extracting unicode data (chinese for example) from submitted form. The form must be method="post". method="get" will not work in tomcat but works in jetty

Thursday, January 31, 2008

ubuntu package management

list all packages installed on system:
dpkg --get-selections

list all files in package:
dpkg -L

find which package a file belongs to:
dpkg -S


sudo apt-get remove