2009-09-08

Converting SVG to PDF

Inkscape output to PDF or save to PDF is no good. It changes the fonts to ugly Bitstream Vera whatever. Use Batik Rasterizer instead.


Install it anywhere you like. In my case, it's located in /opt/batik.

To convert files, use the command as shown (assuming you're in the directory where the SVG file is located):

$ java -jar /opt/batik/batik-rasterizer.jar -m application/pdf Figure1.svg


2009-09-03

Getting LibSVM to work with Weka on Mac

Somehow, the only way to use LibSVM with Weka is by using the bash command-line.

Step 1: Get Weka.
Assume the bleeding edge version 3.7.0. Unzip and put in /Applications folder.

Step 2: Get LibSVM.
a. Iowa State site (http://www.cs.iastate.edu/~yasser/wlsvm/wlsvm.zip):
If you use Safari to download, it will be unzipped in the Downloads directory. The files you need are ~/Downloads/WLSVM/lib/wlsvm.jar and /Downloads/WLSVM/lib/libsvm.jar
b. Taiwan site(http://www.csie.ntu.edu.tw/~cjlin/libsvm/libsvm-2.89.zip):
Using Safari to download, the file you need is ~/Downloads/libsvm-2.89/java/libsvm.jar

Step 3: Open Terminal and copy to Weka.app. Assume you have privileges to write into Weka.app.
a. Iowa State version:
$ cp ~/Downloads/WLSVM/lib/*.jar /Applications/Weka/weka-3-7-0.app/Contents/Resources/Java
b. Taiwan version:
$ cp ~/Downloads/libsvm-2.89/java/libsvm.jar /Applications/Weka/weka-3-7-0.app/Contents/Resources/Java

Step 4: Set CLASSPATH
$ export CLASSPATH=$CLASSPATH:/Applications/Weka/weka-3-7-0.app/Contents/Resources/Java/

Step 5:Run Weka from Terminal!
$ java -classpath $CLASSPATH:weka.jar:libsvm.jar weka.gui.GUIChooser &

Conclusion: Bash sucks less!