Tuesday, March 23, 2010

Use LibSVM in WEKA in an Archlinux box

I found both WEKA and libSVM in AUR, however, neither maintainer considered that a user might use them together... It seem we Archie got to work it out ourselves, so here is what I did:

Dowload WEKA tarball from AUR, and Change weka.sh to

#! /bin/sh
# Note: the '-Xmx256m' flag is used to set the maximum memory that the java
# program is allowed. When working with large data sets, this number may need
# to be increased based on how much memory you wish to allow weka to have.
# Specifying command line arguments will override the defaults shown here.
# Example: '-Xmx512m'
DEFAULT_ARGS='-Xms32m -Xmx256m'
if [ $# -gt 0 ]; then
java -classpath
weka.gui.GUIChooser $ARGS

Do not forget to change the MD5SUM of weka.sh in PKGBUILD file :) Modify LibSVM PKGBUILD to:

# Contributor: Pierre Gueth
# Modified by: Yuanjie Huang
pkgdesc="A library for Support Vector Machines classification, include
binaries and python bindings."
arch=(x86_64 i686)
build() {
cd "$srcdir/$pkgname-$pkgver"
make || return 1
install -D -m755 svm-train $pkgdir/usr/bin/svm-train
install -D -m755 svm-predict $pkgdir/usr/bin/svm-predict
install -D -m755 svm-scale $pkgdir/usr/bin/svm-scale
install -D -m644 java/libsvm.jar $pkgdir/usr/share/java/libsvm.jar
cd "python"
python setup.py build || return 1
python setup.py install --root $pkgdir

Then makepgk and install, have fun.

Monday, March 22, 2010

Where is mendeley user config stored?

Mendeley Desktop is a nice academic research resource management tool. However I messed its configuration up, and got to reset it. But there is no such a directory as .mendeley as I expect in my home directory, so I got to find it like this:

for f in `ls -a1F | grep -E '^\.[A-Za-z]+/$'`; \
do find $f -print | grep -E '[Mm]endeley'; done

Then simply delete everything I got, and bring Mendeley back happily ;)

Thursday, March 18, 2010

Linux Hibernation in short

In order to hibernate in Linux, you need a user space script and an backend. Two User space scirpts widely used are:

  • pm-utils : used in OpenSuse, Ubuntu, etc
  • hibernation-scirpt : used by gentoo, etc

The linux kernel comes with hibernate backend named swsusp but you can also try other tool, so your options are:

  • uswsusp : need to be installed
  • tuxonice : you got to patch the kernel
  • swsusp : comes without extra effords

My choise is pm-utils + uswsusp for I’m too lazy to patch and compile a kernel, and I’ve been using pm-utils for a long time.

And one more thing to mention, even hibernation-script comes with tuxonice, it can use uswsusp as backend.

GAE Hello world error

Google App Engine supports SSL now, however Python 2.5 does not come with SSL socket in stock :(

gae$ /usr/local/bin/dev_appserver.py \
Traceback (most recent call last):
File "/usr/local/bin/dev_appserver.py", line 50, in <module>
execfile(script_path, globals())
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver_main.py", line 338, in <module>
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver_main.py", line 297, in main
server = MakeRpcServer(option_dict)
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver_main.py", line 259, in MakeRpcServer
File "/usr/local/google_appengine/google/appengine/tools/appcfg.py", line 114, in __init__
self.opener = self._GetOpener()
File "/usr/local/google_appengine/google/appengine/tools/appcfg.py", line 317, in _GetOpener
AttributeError: 'module' object has no attribute 'HTTPSHandler'

To resovle the problem you got to recomile Python with SSL support as instructed by Patrick Altman and then follow a regular  configure – make – make install routine.

Then you need to Edit the Modules/Setup.dist to uncomment a couple of lines:

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
_ssl _ssl.c 
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl 
-L$(SSL)/lib -lssl -lcrypto