Thursday, August 25, 2005

German Eichberger, PMP

Today I passed the PMP-Exam!!

Ok, that's nothing for a Software Engineer to be proud of but sometime's it helps to understand the other side... I will first celebrate - I don't know about you, but studying about months makes me thirsty...


Monday, August 22, 2005

FreeNX GLX or Software Rendering (Mesa)

I have worked the last couple of weeks with FreeNX and GLX. That was really slow and we constantly reduced the number of polygons. So today I tried to use software rendering (Mesa) because NX is optimized for 2D transfers.

The result is that the interaction was much faster but in the full resolution not that fast. I tried to monitor the processes to see if it's a problem of the computer power or the network -- I am slightly thinking it's a network problem though.

Maybe I need to run tests with different test data, too. I don't know how representative a 200 slice MRI image of a human head is;-)

Anyway we will go forward with this solution but I will keep my slider to reduce the resolution (e.g. details) just in case...

How did I get the software render on the machine?
Given that we are using VTK I just had to replace the system's OpenGL with Mesa's one
  1. I first compiled Mesa in my home directory (target linux-x86)
  2. replaced in VTK's ccmake (use "t" for the expert mode) all references to OpenGL libraries with the newly created ones
  3. recompiled VTK
  4. tested the application

Friday, August 19, 2005

FreeNX on Debian and Redhat

Given that the VTK installation is -uhm- challenging and not everybody has a huge computer we decided to experiment with some remote desktop applications. After a short evaluation (and believe me there isn't that much -- X, VNC, NX, and something backed by SUN) we decided to go with NX.

Early versions of FreeNX lack the GLX support which is critical for a 3D application like VTK so make sure to get a recent copy (>=1.5). Unfortunately there is no compression for GLX so make sure to reduce the triangles to make the application fast over the net...

In the Debian case you just add deb http://www.linux.lk/~anuradha/nx/ ./ to your apt-sources and then install them as usual. Run nxsetup, add a user with nxserver, and you are ready to go with one of the many clients offered at NoMachine's site. Beware: For some reasons the OS X client doesn't work with FreeNX.

The Redhat/Fedora people didn't do such a good job: I installed freenx-0.4.4-1.rh.0.noarch.rpm and nx-1.5.0-0.FC1?.1.i386.rpm from the FreeNX Fedora Howto and followed the instructions. I also carried out the following commands: nxsetup --clean --install --setup-nomachine-key Which created the nx user and his group. Unfortunately the rights for the keys sshd uses seem to be wrong in /var/lib/nxserver/home/.ssh -- I followed this guide to fix it. Lastly the public keys used by this installation are different from the ones used in the NoMachine-Clients. So you either copy the keys from somewhere on to your machine, generate the right keys, or copy the keys from your machine to the clients. I decided to go the later route and this worked fine for me.

Next week I will explain how to set-up moznx beacuse ultimately we want people just to click a link to use the VTK application and not worry about keys...

Thursday, August 11, 2005

VTK Java Installation on RH 9 and Debian

So at home I am using Debian and at work we are using Redhat. Both systems are completely different and coming from Debian Redhat looks pretty weird.

First of all both systems don't come with a decent Java installation. RH seems to put per default the gcj-stuff on I could rant about for hours. Anyway you will have to download the JDK from SUN and install it. On Debian I used the tar.gz version which did a fabulous job -- on RH I used the .rpm version which just threw the whole installation in /usr/java and left the gcj stuff intact, e.g. /usr/bin/java links to gcj...

Then you download VTK (Version 4.4) and Cmake, follow the instructions, enter ccmake . and then use "t" to change some things in the expert mode (especially RH tends to put in the gcj stuff so be sure to do that and also make ln -sf /usr/java/j2sdk<your favorite version> /usr/local/java)

Java-Settings (Debian):
JAVACOMMAND /usr/local/java/bin/java
JAVA_ARCHIVE /usr/local/java/bin/jar
JAVA_AWT_INCLUDE_PATH /usr/local/lib/java/include
JAVA_AWT_LIBRARY /usr/local/lib/java/jre/lib/i386/libjawt.so
JAVA_COMPILE /usr/local/java/bin/javac
JAVA_INCLUDE_PATH /usr/local/lib/java/include
JAVA_INCLUDE_PATH2 /usr/local/lib/java/include/linux
JAVA_RUNTIME /usr/local/java/bin/java


Normal Settings (no "t")

BUILD_EXAMPLES ON
BUILD_SHARED_LIBS ON
CMAKE_BACKWARDS_COMPATIBILITY 2.2
CMAKE_BUILD_TYPE
CMAKE_INSTALL_PREFIX /usr/local
VTK_DATA_ROOT ../VTKData-release-4-2
VTK_USE_HYBRID ON
VTK_USE_PARALLEL OFF
VTK_USE_PATENTED ON
VTK_USE_RENDERING ON
VTK_WRAP_JAVA ON
VTK_WRAP_PYTHON OFF
VTK_WRAP_TCL OFF


After a couple of configures you can finally hit generate and the system will generate the makefiles. Run make and a long coffee break later you should have something compiled.

Adjust the LD_LIBRARY_PATH to include <Your favorite VTK installation path>/bin and off you go for your first test ride. Well, you might want to add the VTK Java Examples and then you will have to do the following additional steps:


mkdir classes/
cp ~/VTK/Wrapping/Java/vtk/* ~/VTK/java/vtk/
cp ~/VTK-Examples/Wrapping/Java/vtk/* ~/VTK/java/vtk/
cd ~/VTK/java/vtk
mv vtkSettings.java.in vtkSettings.java
cd ..
/usr/local/java/bin/javac -d classes/ vtk/*.java
/usr/local/java/bin/javac -d classes/ vtk/util/*.java
cd classes/
/usr/local/java/bin/jar cvf vtk.jar vtk/
/usr/local/java/bin/jar i vtk.jar
cp vtk.jar ../../bin/


This allow you to just import vtk.jar as an external jar in eclipse to use all the things in vtk.util.

Hopefully that works out for you. Let me know if you have any trouble and I might follow up in this blog.

Tuesday, August 09, 2005

libgmail adjustments and database backup

So today I want to share my little adjustments to libgmail, Python's binding to access gmail. libgmail comes with lots of excellent little programs. Most notably is gcp which copies a file from the local filesystem to gmail. Hence it's the ideal system to perfrom for instance nightly backups of a database to gmail.

Unfortunately gcp asks you every time for the password/login so it can't really run as a cron job -- at leat not that easy. That's why I chnaged some lines and dubbed the new program gecp:

-----------------------------------------------------------------------------------
#!/usr/bin/python2.3
#
# gcp.py -- Demo to copy a file to Gmail using libgmail
#
# $Revision: 1.1 $ ($Date: 2004/10/17 13:34:04 $)
#
# Author: follower@myrealbox.com
#
# License: GPL 2.0
#
import os
import sys
import logging

# Allow us to run using installed `libgmail` or the one in parent directory.
try:
import libgmail
logging.warn("Note: Using currently installed `libgmail` version.")
except ImportError:
# Urghhh...
sys.path.insert(1,
os.path.realpath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
import libgmail


if __name__ == "__main__":
import sys
from getpass import getpass

# TODO: Allow copy from account.

try:
filename = sys.argv[1]
destination = sys.argv[2]
pw = sys.argv[3]
except IndexError:
print "Usage: %s :[

---------------------------------------------------------------------------------

You can use gecp <filename> <gmail-account>[:label] <password> to copy a file to your gamil account. Be careful: GMail limits the filesize to 10MB so you have to split longer files accordingly. (To reassemble them again juts use cat file1 file2 file3 > targetfile;-)

I am using the following little script in a cronjob to backup the content of a MySQL database:

---------------------------------------------------------------------------------
#!/bin/bash

cd ~german/backup/
#remove all files
rm -f ~german/backup/survey-*
rm -f ~german/backup/xsurvey-*

#dump database
date=`date -I`
mysqldump --opt -u admin --password="MyDBPassword" MyDatabaseName | bzip2 -c > ~german/backup/survey-$date.sql.bz2

#split
split -b10m survey-$date.sql.bz2 xsurvey-$date

#copy to gmail
for file in xsurvey-*;do python ~/libgmail/demos/gecp.py $file MyGMailAccount:Backup MyPassword; done

-------------------------------------------------------------------------------------

I hope this is of some use for somebody;-)

Monday, August 08, 2005

Hello

Hi,

my name is German but to not confuse me with my natinality people in the US call me G-Man; hence the name for my Blog. This is a somewhat commercial endeavour since we will have ads benefitting my company e-nnovate Technologies Inc.

Topics I like to cover are FreeNX, VTK, ITK, etc. It doesn't matter if you don't understand the acronyms yet I will explain them later...

I work a couple of jobs: lot's of consulting - e-nnovate, ICG. DFL, Adjunct Faculty @ Mesa College and of course a real one - UCSD Extension IT courses

I will write about a couple of things in the next few days...