Skip to main content

(German) Egon Bahrs "Rat an jeden Einzelnen"

Das aktuelle Interview mit Egon Bahr im ZEITmagazin hat mir gut gefallen. Besonders diese Stelle kurz vor Ende:

ZEITmagazin : Wir wollen nicht mit Willy Brandt enden, sondern mit Ihnen. Haben Sie eine Botschaft an die nachfolgenden Generationen?

Bahr: Generation ist mir ein zu großer Begriff. Vielleicht habe ich einen Rat an jeden Einzelnen, und das ist die griechische Botschaft "Erkenne dich selbst", Gnothi seauton. Du musst das machen, was in dir drinsteckt, damit du dich voll entfaltest, im Interesse der Gesellschaft und im eigenen Interesse. Wenn du dich überschätzt, wird es zuweilen komisch und lächerlich; wenn du dich unterschätzt, ist es schade.

Fixing invisible bloat from comments in a Wordpress database

When upgrading my installation of Wordpress today, I noticed that the related MySQL tables had grown to a few hundred megabytes. It turned out to be (invisible but kept) spam comments (in table wp_comments) and Akismet analysis results (all of table wp_commentmeta). This is what got my database down to 6 MB again (make backups before, no warrenty!):

TRUNCATE wp_commentmeta;
OPTIMIZE TABLE wp_commentmeta;

DELETE FROM wp_comments WHERE comment_approved = "spam";
OPTIMIZE TABLE wp_comments;

svneverever 1.2.2 released + UTF-8 bug in svn2git 1.0.8

When working on (the still on-going) migration of the Gentoo java project repositories from SVN to Git I ran into bugs with svn2git 1.0.8 and my own svneverever 1.2.1. The bug with svn2git 1.0.8 was a regression that broke support for (non-ASCII) UTF-8 author names in identity maps. That's fixed in dev-vcs/svn2git-1.0.8-r1 in Gentoo. I sent the patch upstream and to the Debian package maintainer, too. For svneverever, a directory that re-appeared after deletion was reported to only live once, e.g. the output was

(2488; 9253)  /projects
(2490; 9253)      /java-config-2
(2490; 2586)          /trunk

if directory /projects/java-config-2/trunk/ got deleted at revision 2586, no matter if was re-created later. With 9253 revisions in total, the correct output (with svneverever 1.2.2) is:

(2488; 9253)  /projects
(2490; 9253)      /java-config-2
(2490; 9253)          /trunk
          ^

That's fixed in svneverever 1.2.2. If svneverever is of help to you, please support me on Flattr. Thanks!

Howto import contacts from a Wammu backup file into Android 4.0.x

The scenario:

  • You managed to backup your previous phone's data using Wammu (or Gammu) to a .backup file
  • You want to import previous contacts into your new, Android 4.0-based smartphone

What worked for me:

  1. Extract contacts from the .backup file to a single, multi-contact .vcf vCard 2.1 file using Gammu:
$ gammu convertbackup myinput.backup byoutput.vcf
$ file myoutput.vcf 
myoutput.vcf: vCard visiting card
  1. Enable USB mass storage mode on the phone, connect PC and phone using USB
  2. Copy the .vcf file into the root folder of the mounted file system
  3. Make sure data has been written in full, e.g. run sync on the Linux shell
  4. Disable USB mass storage mode
  5. Open contacts, pick import from USB storage
  6. Give it some time, done.

LightZone in Gentoo betagarden

If you are running Gentoo, heard about the release of the LightZone source code and got curious to see it for yourself:

# layman -a betagarden
# emerge -av media-gfx/LightZone

What you get is LightZone 100% built from sources, no more shipped .jar files included. One word of warning: the software has not seen much testing in this form, yet. So if your pictures mean a lot you, make backups before. Better safe than sorry.

Building LightZone from Git for Linux

Intro

Hello! Since I read on LWN.net that the LightZone source code has been released as free software, I was curious to see if that software was compile- and runnable on my very machine. A friend of mine actually uses digital darkroom software and was still looking for something that worked on Linux. So I was curious if it could be done. When googling for "build LightZone Linux" or "compile LightZone Linux" there does not seem to be much help so I'm writing about a recipe that worked for me here. From now on I refer to a Git snapshot of 2013-01-06, commit ed3d11e5a1a3774d0b242722a4ee8315d7fe634d precisely. My understanding of LightZone is still in the process of building up so if you have any corrections or extensions to this, please comment below. Thanks!

Quick code and build system overview

LightZone is written in Java and C/C++, the build system uses Ant and GNU make, more precisely Ant calling GNU make. The code base is split to four major components/folders:

  • lightcrafts
  • linux
  • macosx
  • windows

The Java code strictly requires Sun Java 6 at the moment, since internal classes (e.g. from package com.sun.image) are used. When compiling you get warnings like

warning: com.sun.image.codec.jpeg.JPEGCodec is Sun proprietary API and may be removed in a future release

and with Java 7 these classes were actually removed. Also, since Java is involved, there are a bunch of pre-compiled .jar files (and one .so file) in the Git repository. Ideally, you replace these with self-built versions, e.g. for security reasons. Comparing the set of .class files from the .jar archives with the sets of .java files of available Subversion tags leads to this mapping for unbundling:

  • linux/lib/libmlib_jai.so — sun-jai-bin 1.1.3
  • linux/lib/jh.jar — javahelp 2.0.05
  • linux/lib/mlibwrapper_jai.jar — sun-jai-bin 1.1.3
  • lightcrafts/lib/script-api.jar — replace with empty .jar file, code included in Sun Java 6
  • lightcrafts/lib/substance-lite.jar — substance 3.3 (with integrated laf-widget 3.0 and laf-plugin 1.0)

Several C/C++ libraries are bundled too. I have not bothered unbundling those, yet.

Fixing

A few things are broken, other things just could use some tuning. Patches for all of these issues can be found in Gentoo betagarden. Broken things include:

  • The build system hard-codes our machine to be Pentium 4.
  • One of the makefiles does not support GNU make 3.82 or later.
  • uname -p is called where uname -m seems needed.
  • The C++ code misses symbol CHAR_BIT and uses unavailable _mm_srai_epi64.
  • The fork daemon location (LightZone-forkd) needs some adjustment.
  • build.xml references a .jar file from the windows folder even for Linux builds.
  • Some files raise UTF-8 errors from Java since they are encoded as Latin1.

Other things you might want to patch:

  • Crash reports should be off by default.
  • The license check should be skipped.
  • Unpatched, LightZone calls itself version "3.9.1 (-1)" with -1 being a Subversion revision.

Building

Once you have patched the issues mentioned earlier, building is as easy as:

$ ( cd lightcrafts && ant )
$ ( cd linux && ant )

Installation

If you are aiming at a package for a Linux distribution, the installed files and locations could be something like this:

/usr/bin/LightZone              # Bash script invoking Java VM, details later
/usr/bin/LightZone-forkd        # Fork daemon ELF binary called by Java code
/usr/lib64/LightZone/*.so       # ELF libraries
/usr/share/LightZone/lib/*.jar  # Java code

In a non-packaging scenario, /usr/local or /opt may make better destinations. These are the .jar files you need to install:

  • lcjai.jar
  • lightcrafts-linux.jar
  • lightcrafts.jar
  • lightzonehelp.jar

Some of those you find twice: one symlink and one regular file. The regular file is what you want, just ignore the symlink. File script-api.jar does not really seem needed, since Sun Java 6 includes that code already. If you manage to unbundle Substance, substance-lite.jar is no longer needed either.

Execution

From an execution script you expect the following:

  • Start a Java VM and make it run the Linux launcher as the main class
  • Add all needed .jar files to the class path
  • Ensure that the .so files are found, i.e, setting java.library.path and LD_LIBRARY_PATH

The script could be something like this:

#! /usr/bin/env bash
jar_dir=/usr/share/LightZone/lib
so_dir=/usr/lib64/LightZone

export LD_LIBRARY_PATH="${so_dir}"

exec java -classpath "${jar_dir}"/lightcrafts-linux.jar\
:"${jar_dir}"/lightzonehelp.jar\
:"${jar_dir}"/lcjai.jar\
:"${jar_dir}"/lightcrafts.jar\
:/usr/share/substance/lib/substance-lite.jar\
:/usr/share/javahelp/lib/jh.jar\
:/usr/share/sun-jai-bin/lib/mlibwrapper_jai.jar \
-Djava.library.path=/usr/lib64/sun-jai-bin:/lib:/usr/lib:"${so_dir}" \
com.lightcrafts.platform.linux.LinuxLauncher

That's it for a start. Please contact me, if you have any quesions.