Angekommen in Schweden
Nach etwas längerer Blog-Abstinenz wollte ich mich mal wieder melden, zumal Günther den neuen Planet UNIX-AG angekündigt hat.
Nachdem ich meine Verteidigung hinter mir hatte, habe ich mich dann doch ernsthaft mit der Jobsuche befasst. Inzwischen bin ich hier in Skövde im sonnigen Südschweden gelandet. An der örtlichen Universität bin ich (vorläufig) als Gastlehrer angestellt und werde in den nächsten Monaten verschiedene Informatikkurse (mit-)betreuen.
Das Wetter hier erfüllt alle Erwartungen und Vorurteile der Deutschen, wie schon am ersten Tag ein Blick aus dem (Büro)Fenster zeigte:

Auch wenn das Wetter zwischen Tauen, Gefrieren mit Glatteis und Neuschnee schwankt, sieht es zwischendurch doch immer ganz nett aus:
Enlarge Fullscreen Programs in Wine
Back in the good old days, PC games used a resolution of 320×200, 640×480, or maybe 800×600 for the game play. This was even true for Windows games. Then it was common to have a 15″ CRT monitor which could display a large number of different resolutions with only little loss in quality.
Today, we have nice and shiny LCD displays, which are perfect for common office tasks. But with a horizontal resolution of e.g. 1600 pixel, you have a problem when playing these old games. Basically, you have two options when running your games with Wine: Scale the game’s small resolution to your display’s physical resolution (which looks ugly depending on the interpolation and the display’s aspect ration, e.g. widescreen displays) or run the game in a small window which makes a game designed for fullscreen displaying as large as your palm. No fun playing games here…
As far as I know, there is no possibility to scale a Windows program in Wine to make it more readable for high-resolution displays. However, I was able to create an ugly hack which allows us to “zoom” into these programs. The basic idea is to set up a dedicated X server with a fixed resolution for the Windows program and use a VNC connection (which can scale images) to get an enlarged view on this program.
If you like to follow the examples below, you will need to have the following programs installed:
- Xephyr, which is part of your X server installation
- Wine, installed and configured to run programs fullscreen (deselect “Emulate a virtual desktop” in winecfg)
- x11vnc
- RealVNC, TightVNC, or any other VNC client (server component not required here)
Most distributions such as Gentoo Linux provide packages for above programs.
Getting started
To run Windows programs within a scaled VNC session, the following four easy steps are neccessary. You can start each program in the background by appending an ampersand (&) or opening a terminal (simplifies debugging if something doesn’t work).
- Start Xephyr to initiate a nested X server session. Set the resolution to match the requirements of your game (here, it is set to 640×480). I observed that some programs crash if the GLX extension is activated, so I disabled it here. The display number is set to 5 (arbitrarily).
Xephyr -once -screen 640x480 -extension GLX :5 - Start Wine and your Windows program. Take care to use the display provided by the new Xephyr instance.
DISPLAY=:5 wine path/to/your/windows/program - Start the VNC server which attachs to Xephyr’s display. Only connections from localhost will be accepted (for security purposes) and the scaling factor will be set to 2 (change to other factor to match your requirements). Option “:nb” speeds up the scaling.
x11vnc -localhost -scale 2:nb -display :5 - Start the VNC client which connects to the server (the following example is for RealVNC).
vncviewer -FullColor -ZlibLevel 0 localhost
Well, this is rather cumbersome, but it works
Shell script
Here is a shell script which performs above operations:
#!/bin/sh
XEPHYR_BIN=/usr/bin/Xephyr
WINE_BIN=/usr/bin/wine
WINPROG_BIN=/path/to/windows/program.exe
X11VNC_BIN=/usr/bin/x11vnc
VNCVIEWER_BIN=/usr/bin/vncviewer
XDISPLAY=:5
# start Xephyr in background
# note: *with* GLX extension wine crashs sometimes
${XEPHYR_BIN} -once -screen 640x480 -extension GLX ${XDISPLAY} &
XEPHYR_PID=$!
sleep 2
# start wine
DISPLAY=${XDISPLAY} ${WINE_BIN} "${WINPROG_BIN}" &
WINE_PID=$!
# start VNC server
${X11VNC_BIN} -localhost -scale 2:nb -display :5 &
VNCSERVER_PID=$!
sleep 3
# RealVNC
## ${VNCVIEWER_BIN} -FullColor -ZlibLevel 0 localhost &
# TightVNC
${VNCVIEWER_BIN} -compresslevel 0 -nojpeg localhost &
# keep for both RealVNC and TightVNC
VNCVIEWER_PID=$!
wait ${WINE_PID}
sleep 1
kill ${VNCVIEWER_PID}
sleep 1
kill ${VNCSERVER_PID}
sleep 1
kill ${XEPHYR_PID}
Kindsbach mapped for OSM
During the last few month I mapped Kindsbach (small village near Kaiserslautern, Germany) for the OpenStreetMap project. Before I started, the map contained only the railway line (without station) and the country road passing through the village. Within three weekends totaling into about 8 hours of walking or cycling, I mapped basically all residential roads in Kindsbach.
Creating a map for OSM consists of two steps. First, real-world data must be collected. This data consists of both GPS coordinates and additional information such as street names, important traffic attributes (one-ways, speed limits, …), or other useful information (play grounds, parking lots, restaurants, …). Second, this data gets imported into OSM e.g. using JOSM. This (potentially time consuming) step is required to smooth the scattered GPS points and to integrate the additional information.
The additional information may be collected by making photos of relevant objects (such as traffic signs), as based on the photo’s EXIF time stamp the actual position can be determined later. Alternatively, voice recorders may be used to memorize street names. My favorite method is paper&pen. Below is a scan of a drawing of the south-west part of Kindsbach, which I created while walking through the streets:
After a few days, changes and additions made in JOSM were rendered on the OpenStreetMap website. Eventually, the map of Kindsbach looked as follows:
Mapping streets for OSM is a nice hobby. Besides of supporting the project, it is a good reason to switch off your computer and to get some fresh air…
Verteidigung
Vor 11 Jahren, 2 Monaten und 12 Tagen habe ich mein Studium an einer Universität begonnen. Nach meinem Diplom an der TU Darmstadt habe ich eine Promotion hier in Kaiserslautern begonnen, die jetzt (fast) abgeschlossen ist. Heute war die öffentliche Aussprache (Verteidigung) meiner Arbeit.

Anschließend gab es einen kleinen Sektempfang. Höhepunkt war die Überreichung des “Doktorhuts”:

Ich möchte allen meinen Freunden und Kollegen danken, die mich durch die guten und schwierigen Zeiten meiner Dissertation begleitet haben.
Searchable PDFs with Linux
Recently, I came across a news posting that there is an open source document management software called ArchivistaBox 2008/IX that can create searchable PDFs from scanned documents. Core components of this software package are Cuneiform (an OCR system) and hocr2pdf (a special PDF generator from ExactCODE).
Using these two programs (both are GPL-2), everyone can generated searchable PDFs which I will demonstrate in the following example.
Lacking a scanned document, I created a LaTeX document using a sample text from Project Gutenberg and generated a TIFF file using GhostScript:
pdflatex mammalia.tex
gs -r320 -dBATCH -sOutputFile=mammalia.tiff -sDEVICE=tiffgray mammalia.pdf
Tip: When scanning or generating TIFF images, try different image resolutions where the recognization rate is sufficient and the image size is still acceptable small.
Generating a searchable PDFs is a two-step process. First, cuneiform is used to generate a special HTML document which contains information where letters and words are located on the TIFF image.
This HTML document uses the suffix .hocr:
cuneiform -f hocr -o mammalia.hocr mammalia.tiff
Tip: You can use cuneiform to write its output in different other formats such as normal HTML or plain text. Use cuneiform -f to get a list of formats.
Tip: Linked against ImageMagick, cuneiform can read a large number of image formats, not only TIFF.
Once mammalia.hocr has been generated, the searchable PDF document is generated using hocr2pdf:
hocr2pdf -i mammalia.tiff -o mammalia-ocr.pdf <mammalia.hocr
Here, the TIFF image is used for the PDF’s visual content, but when you search for text, the meta information from the .hocr file is used to find and highlight the search hits in the document.
Above example is rather artificial, as the used TIFF image has a much better quality compared to a scanned document. If scan results degenerate (not all letters are recognized and some word boundaries are detected wrong), you may want to try the optional switch -s for hocr2pdf to use a more sloppy approach on detecting words.
Now you can use above tools to run your own document management system at home e.g. to scan incomming letters. Happy OCRing…
Note: Gentoo Linux users can use ebuilds from bug reports for cuneiform and exactimage.






