Thomas Fischer's Weblog

Life, Linux, LaTeX

Waltag

leave a comment »

Waltag

Aus aktuellem Anlass möchte ich auf den Wahltag am kommenden Sonntag hinweisen. Wer noch nicht so wie ich per Briefwahl abgestimmt hat, kann also noch dem großen Moment des Kreuzchen-machens entgegenfiebern.

Wer sich noch nicht sicher ist, was er wählen soll, sollte sich in der Parteienlandschaft außerhalb der “großen” Parteien umschauen. Bei mehr als 10 weiteren Parteien für die Zweistimme sollte sich eigentlich für jeden etwas finden. Gerade für computer-affine Bürger hat sich in den letzten Monaten eine Alternative entwickelt. Stimmen für kleine Parteien sind übrigens keine verschenkten Stimmen, da Parteien pro erhaltene Stimme Geld vom Staat bekommen können.

Hilfe bei der Entscheidungsfindung bietet übrigens die Bundeszentrale für politische Bildung (kennen einige von uns sicher noch von den Heftchen aus dem Gemeinschaftskundeunterricht) mit ihrem Wahl-O-Mat.

Tip: Wenn keiner der Kandidaten der Erststimme zusagt (insbesondere keiner der beiden großen Blockparteien), kann die Erststimme auch getrennt von der Zweitstimme ungültig gemacht werden (z.B. durch Durchstreichen).

Advertisements

Written by Thomas Fischer

September 22, 2009 at 20:02

Posted in Society

Tagged with , , ,

Automatic AdBlock filter list updates in Konqueror

with 4 comments

As a KDE user, Konqueror is my favorite browser. It offers smooth integration into KDE, both in looks and features (e.g. using the Okular part to view PDFs). Its rendering engine is so good that it was forked into WebKit used in Apple’s Safari and Qt. One aspect Konqueror lacks in comparison to Firefox, though, is the support of plugins/addons of all kinds to add more features to the browser. There is a set of security and privacy enhancing plugins for Firefox I use myself and recommend to others. One of them is AdBlock Plus which uses a well-maintained list of URLs to block if you want to experience the net with less annoyance.

On the other side, Konqueror has a similar adblocking functionality built-in since KDE 3.5 (late 2005). In the configuration dialog, users can add fragments or regular expressions of URLs to be blocked. Maintaining such a list yourself is quite cumbersome, especially if you have accounts on several computers. At least since March 2007 there has been a feature request in KDE’s bug tracking system to add an automatic updater to Konqueror’s ad-filtering.

Last weekend, I started to scratch the itch and implemented an automatic filter list updater. Luckily, the internal format of AdBlock entries in Konqueror matches the one use by AdBlock Plus, except that some advanced features are not (yet) supported. Based on the then-current KDE 4.2.4 code I made changes to both kdelibs and kdebase. The former one contains the KHTML component including the actual filter, the latter contains the code for Konqueror’s settings GUI.

The changes I made to kdelibs work as follows: Read the khtmlrc configuration file to get a list of filter files following the format used by AdBlock Plus. My example configuration file contains several lists from easylist.adblock.org. The filter list files are downloaded and cached if no local copy is available or if it is outdated. Each filter list file is loaded and added to Konqueror’s current filter list each time the browser is started. The user-configured filter list is not modified, as the changes occur in memory only.

If you edit your khtmlrc manually to add new filter lists, this works already fine without GUI. For a better usability experience, I modified Konqueror’s settings dialog so that users can select from a list of preconfigured filter lists (currently, all lists from EasyList) which to actually use. Additionally, the time interval to refresh the lists can be configured.

Manual filter in Konqueror's AdBlockAutomatic filter in Konqueror's AdBlock

I refrained from adding an option to add, modify or delete list entries in the GUI. This is simply for two reasons: (1) Users may tend to enter filter lists that do not follow the format (e.g. from other adblocking filter sites) and (2) the list of available filter lists does not change that often that it cannot be changed in the next monthly update of KDE. If users are eager to add more lists not officially approved, they can still edit their configuration files manually.

All patches and an example configuration file are available from bug report 143495 in KDE’s bug tracking system. If you have constructive suggestions, please add you comments to the bug report (do not post comments in this blog, that won’t help). To support the patch in getting approved and added to the official code base, vote for the bug (login required).

Update (20091201): I posted the patches on KDE’s Review Board a few days ago and got a review from David Faure. There are some minor issues to change and fix, but his overall comment was “Nice (but obviously not for 4.4 due to the feature freeze, it will have to be for 4.5)” 🙂

Update (20100812): My AdBlock extension has become part of KDE 4.5 🙂 Check out this screen shot:AdBlock filter list in KDE 4.5

Written by Thomas Fischer

August 5, 2009 at 22:08

Posted in KDE, Linux

Tagged with , ,

Mittsommer in Schweden

leave a comment »

Am vergangenen Wochenende war Mittsommer hier in Schweden. Anders als in Deutschland hat Mittsommer (schwed. Midsommar) hier Feiertagscharakter, was man spätestens daran merkt, daß Geschäfte, die eigentlich immer offen haben*, plötzlich erst später aufmachen.

Nun, wir haben die Gelegenheit genutzt, eine kleine Nachtwanderung auf den Hausberg Billingen zu machen.
Die drei folgenden Bilder zeigen den gleichen See (fragt mich nicht nach dem Namen), wobei die dunklen von Norden nach Süden und das helle Bild von Süden nach Norden jeweils gegen Mitternacht aufgenommen wurden. Der Nebel deutet an, daß es gar nicht trocken-sommerlich warm war…

Midsommar auf Billingen

Midsommar auf Billingen


Midsommar auf Billingen

Midsommar auf Billingen


Midsommar auf Billingen

Midsommar auf Billingen

Von besagtem Billingen aus hat man auch eine schöne Sicht auf die Stadt Skövde (wobei es auf dem Bild etwas heller aussieht, als es wirklich war):

Midsommar: Blick auf Skövde

Midsommar: Blick auf Skövde

Mit diesen Bildern gehe ich in den Sommerurlaub und wünsche allen ein schönes Mittsommerfest! 🙂

* Anders als in Deutschland üblich verkaufen Lebensmittelgeschäfte, die sonntags offen haben, normalerweise kein Benzin.

Written by Thomas Fischer

June 22, 2009 at 22:02

Posted in Schweden, Skövde

Drawing GPS Traces on Map Tiles from OpenStreetMap

with 7 comments

Important note: I have created a page in the OpenStreeMap Wiki which gets updated along with updates in this script. Therefore the information on this blog page is partially outdated.

Ever wondered how to show your GPS traces to non-techie friends? This article may be the answer to your question.

Last weekend, I had the problem of visualizing a GPS trace to show a friend where I had been. Sending a .gpx file may be an answer to this question, but for someone not related to this whole map-making voodoo this file won’t help.

Well, given that a world map rendered as .png files is freely available from the OpenStreetMap project, isn’t there a way to draw GPS tracks on those images? The OpenStreetMap project allows you to download map tiles of size 256×256 pixel. To access those tiles (and to know which tile), you have to calculate the tile number depending on latitute, longitude, and zoom level. Using the coordinates from a .gpx file, all neccessary tiles can be retrieved and glued together to your own map. On this map, the tour as described by the .gpx file can be drawn.

Script

To simplify this process, I wrote a Perl script, which takes one or several .gpx files as input and generates a PNG image containing the map tiles and the GPS tracks as colored lines.

The script is available for download, released under the GPL version 3 or any later version.

The script’s usage is quite simle. Run

perl gpx2png.pl GPSTRACK.gpx

to generate a file called map.png which contains the track in a PNG file.

The output can be controlled by setting command line options:
-o FILENAME: Output filename of the image.
-z N: Zoom level, where N is a number between 1 (world) and 16 (most details) or “auto” (automatically determines a reasonable zoom level, default).
More command line options are shown when running the script with -h.

If you are familiar with Perl, you can change even more default settings (e.g. colors) at the start of the Perl script.
Perl hackers are welcome to send bug reports (I’m sure there are bugs) and suggestions for improvements.

Example

Below example visualizes two GPS tracks from Skara region (randomly selected) using the script’s default settings:

perl gpx2png.pl -o skara-default.png 369116.gpx 369119.gpx
Visualization of two GPS tracks close to Skara, Sweden

Visualization of two GPS tracks close to Skara, Sweden

Using custom settings such as done by running

perl gpx2png.pl -z 7 -o skara-zoom7.png 369116.gpx 369119.gpx

results in this image:

Two GPS tracks in the Skara region with zoom level 7

Two GPS tracks in the Skara region with zoom level 7

For reference, see how the original map looks like.

Update 20090623 I uploaded a new version which is more configurable and draws waypoints as small circles on the map.

Update 20090709 The new version improves the projection of coordinates on tile images (suggested by Pedja); tile sources can be selected via command line.

Important note: I have created a page in the OpenStreeMap Wiki which gets updated along with updates in this script. Therefore the information on this blog page is partially outdated.

Written by Thomas Fischer

May 4, 2009 at 21:33

Posted in openstreetmap

Tagged with , ,

Angekommen in Schweden

with one comment

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:
Blick aus Büro

Auch wenn das Wetter zwischen Tauen, Gefrieren mit Glatteis und Neuschnee schwankt, sieht es zwischendurch doch immer ganz nett aus:

Skövde (Dälderna) im WinterSkövde (Dälderna) im WinterSkövde (Dälderna) im Winter

Written by Thomas Fischer

March 10, 2009 at 21:05

Posted in Skövde

Enlarge Fullscreen Programs in Wine

with 8 comments

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).

  1. 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
  2. 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
  3. 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
  4. 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}

Written by Thomas Fischer

February 14, 2009 at 14:50

Posted in Linux

Tagged with ,

Kindsbach mapped for OSM

leave a comment »

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:

Kindsbach (sketch)

After a few days, changes and additions made in JOSM were rendered on the OpenStreetMap website. Eventually, the map of Kindsbach looked as follows:

South-west of Kindsbach, Screenshot from OSM

South-west of Kindsbach, Screenshot from OSM

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… 😉

Written by Thomas Fischer

December 29, 2008 at 17:30

Posted in openstreetmap

Tagged with ,