Tuesday, December 29, 2015


Recently, I installed the iOS app Pythonista (see http://omz-software.com/pythonista/) on my iPad. The original intention was to kickstart Python programming for my son. However, the little app turned out to be so practical that I got addicted myself.

Over the past few weeks I've started a little project on German spelling. My Pythonista app 'rechtschreibung' allows you to test different rulesets of German spelling and immediately see the impact on a text which was especially written for that purpose.

The source code is avaibale at https://github.com/marcus67/rechtschreibung. I'm afraid you wil have to have Pythonista installed to try it.

Saturday, January 25, 2014

Running XBMC as a VDR client on Raspberry Pi

Since I had been using the VDR (Video Disk Recorder) for several years on my local server using xine with the XVDR protocol I wanted to have the same functionality on my new Raspberry Pi. However, instead of the rather basic XINE I decided to try the more fancy XBMC client.

At first I thought that this would just boil down to installing the required Debian packages and I kind of got started well using this page to install the XMBC itself on the Raspberry Pi. It also helped me to set up the UDEV system correctly to identify my remote control (HAMA 52451).

Still. I soon found out it was a little more difficult than this. Both client and server need a specific plugin for the XVDR protocol which was not available on either system.

So, I set out (for the first time in a long while) to actually compile the required packages from sources found in Git-Hub.

Server Portion

The VDR plugin source code is available here. You need to clone the repository into a local folder. See this page at StackOverflow on how this is done. Then, configure, compile, install, and restart VDR. Pretty straight forward.

Client Portion

The XBMC plugin sourde code is available here. Again you need to clone the repository into a local folder. But be careful! Client and server versions have to match! In my case the XBMC was version Frodo. The server plugin turned out to match the version. The client plugin, however, was a newer version by default. Therefore, I had to clone a specific branch of the repository. I needed the xbmc-frodo branch. The command for cloning is as follows:

git clone -b xbmc-frodo https://github.com/pipelka/xbmc-addon-xvdr.git xbmc-addon-xvdr

As it turned out the default environment on my Raspberry did not contain some utility packages required for building the source package. I came across error complaining about the lack of:

  • libtoolize -> install package libtool
  • aclocal -> install package automake
  • zip -> install package zip
Otherwise building was straight forward. The only additional configuration that I did was choose an explicit installation prefix while configuring:

./configure --prefix=/usr/lib/xbmc

I used the target dist-zip for installing the package.

Making it work

When I tried to start the XMBC PVR plugin on Raspberry I obtained the run-time error that the connection to the server could not be established. Looking at the VDR log at /var/log/user I saw the following lines:

Dec 22 22:35:32 casimir vdr: [23074] XVDR-Error: Invalid or missing '/var/lib/vdr/plugins/xvdr/allowed_hosts.conf'. 
falling back to 'svdrphosts.conf'.
Dec 22 22:35:32 casimir vdr: [23074] XVDR-Error: Invalid or missing /var/lib/vdr/plugins/xvdr/../svdrphosts.conf. Adding to list of allowed hosts.
Dec 22 22:35:32 casimir vdr: [23074] XVDR-Error: Address not allowed to connect (/var/lib/vdr/plugins/xvdr/allowed_hosts.conf)

This was caused by the missing configuration file in /var/lib/vdr/plugins/xvdr. I created a new allowed_hosts.conf with the format described here, restarted the server and the client, and voila! I had a working XBMC client!

Sunday, January 5, 2014

Error upon Horde login of specific users due to preference corruption

After some upgrade in Horde (unfortunately I do not remember which one) I had trouble with some of my Horde users. Upon login I received the error message

Ein schwerer Fehler ist aufgetreten:
Horde_Prefs_Scope::serialize() must return a string or NULL
Details wurden für den Administrator mitgeloggt.

which hinted at some problem with the preferences for these users. After the error I had to either delete all cookies related to Horde or (in my case simpler) delete all cookies of the browser to login as ANY other user, even for as those that actually still worked!

I found out that it is sufficient to delete all Horde preferences of the corrupted user relating to scope horde to fix the problem.

Of course, the Horde settings will have to be reconfigured manually afterwards!

The following two little scripts can be used to selectively delete the preferences for one user given as parameter to the shell script.

#! /bin/bash
echo "Deleting preferences for user $horde_uid"
mysql -u horde -p -A -e "set @horde_uid=\"${horde_uid}\"; source ${sql_script};"

This is the script delete_prefs.mysql.

DELETE FROM `horde`.`horde_prefs` 
 WHERE `horde_prefs`.`pref_uid` = @horde_uid 
   AND `horde_prefs`.`pref_scope` = 'horde';

Tuesday, December 31, 2013

Fixing page not found issue with Horde nag ("nag/t/save")

As described in Horde ticket 11596 the nag application of the Horde Framework is the only application that requires rewrite rules.

When rewriting is not enabled (which is often the default) upon each edit action the user is redirected to a page ending in path nag/t/save which is not found on the server. To make nag work the following measures have to be taken:
  1. rewriting has to be enabled in the Apache webserver,
  2. local overwriting of .htaccess files has be allowed,
  3. the .htaccess has to be located in the nag subdirectory (e.g. /usr/share/horde/nag)
  4. in case the Horde base URL is not / the .htaccess file has to contain a RewriteBase tag denoting the base path of the URL.
This is how to do all the configuration in detail:

Enabling rewrite

Apache2 comes with a helper script called a2enmod which takes the name of the module as its parameter. So, in this case a

    a2enmod rewrite

should be sufficient.

Permitting local overwrite of htaccess

The Apache2 configuration file for Horde should look like this (with /Horde being the base URL and /usr/share/horde being the installation root of the Horde web application):

    Alias /Horde /usr/share/horde

    <Directory /usr/share/horde>

       Options FollowSymLinks
       AllowOverride Limit FileInfo


Locating the .htaccess file for nag and optionally setting the rewrite base

In the web directory of the nag application there has to be a local .htaccess file containing the following rewrite rules:

    allow from all

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /Horde
        RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        RewriteCond   %{REQUEST_FILENAME}  !-d
        RewriteCond   %{REQUEST_FILENAME}  !-f
        RewriteRule ^(.*)$ rampage.php [QSA,L]

The text highlighted in green is only required if the Horde application has a base URL different from /.

Wrappping it up

The Apache server needs to be restarted after these changes:

    service apache2 restart

Monday, December 30, 2013

Eliminating time shift with birthdates while synching iPhone and Horde

Ever since I used my iPhone with Horde I've had trouble with synching birthdates: due to timezone conversions the dates on the server usually were shifted to earlier times. If the same entry got synched several times the shifts would accumulate usually moving the birthdates several days.

Originally, I fixed this by directly modifying one of the PHP files. However, just yesterday I made an upgrade to the latest stable GIT version of Horde (5.1.5) only to find out that the problem still prevails: Horde ticket 12581.

Following the suggestion in the ticket I explicitly set the date.timezone setting in the php.ini file of my Apache2 server located in /etc/php5/apache2/php.ini:

date.timezone = "Europe/Berlin"    

This setting is normally commented out. Apparently, it has to be the same as the server setting. After this change the birthdays were "stable". :-)

By the way I had gotten the following run-time error when running another PHP application at a much earlier time but kind of forgot to react to it:

Warning: date(): It is not safe to rely on the system's timezone settings. 
You are *required* to use the date.timezone setting or the 
date_default_timezone_set() function. In case you used any of those methods 
and you are still getting this warning, you most likely misspelled the timezone 
identifier. We selected the timezone 'UTC' for now, but please set 
date.timezone to select your timezone.

Wednesday, December 25, 2013

Configuring an additional static route in /etc/network/interfaces

A while ago I've added a third network to my system. The first two networks are directly connected to my server and so a normal entry in /etc/network/interfaces suffices for these interfaces to bring them up and configure routing, e.g.

auto eth1
iface eth1 inet static
        mtu 1500
        dns-search chaos chaos-hs

The third network, however,  is not directly visible to the server but is connected to the client which is located in the network. So, in this case I have to install a static route for the third network to be visible to the server.

As I found out there is no configuration entry for declaring an addtional static route per se. Instead, it has to be done using the general configuration entry post-up which takes a command to be executed after the interface has been brought up. In this case it must a regular call to the standard route command:

auto eth0
iface eth0 inet static
        mtu 1500
        dns-search chaos chaos-hs
        post-up route add -net gw

Friday, December 20, 2013

iPhone 5 Wallpapers

Going through my pictures taken this fall I came across two which make excellent wallpapers for my iPhone 5. They can be found at hdphonewallpapers.com and at www.iphoneforums.net .