$ cat /dev/brain > /dev/blog

Life is written in chapters but the table of contents is missing.


29 Nov

Wordpress on lighttpd: Rewrite rules with WP Super Cache and WPtouch


Screenshot blog.jeanpierre.de (WPtouch)As a few of my readers already know, this weblog is run by a Wordpress 2.x installation on a lighttpd web server (on top of a Debian Linux host). I have also installed, among others, the following plugins for Wordpress:

  • WP Super Cache — Serves a cached HTML version of Wordpress pages instead of serving each page as PHP output for every single request. This speeds up loading time and reduces the web server load. A lot!
  • WPtouch — When a user is using a mobile device, e.g., an iPhone, iPod touch, Android phone etc., they will see a slightly different layout of this blog, particularly optimized for small screen sizes.

lighttpd does not understand Apache’s RewriteRules that are used for permalinks in Wordpress. Therefore, you’ll have to come up with your own set of rewrite rules. Based on the rewrite.lua script initially written by Giovanni Intini, I have come up with a slightly modified version that takes the presence of the WPtouch plugin into account.

To install this script, perform the following steps:

  1. Download the latest version of the rewrite.lua script from my github project site.
  2. Place rewrite.lua in the root directory of your Wordpress installation, i.e., the same directory where you find the Wordpress PHP files such as wp-config.php.
  3. Update your lighttpd config file for the host running Wordpress and include this command:
    magnet.attract-physical-path-to = ( server.document-root + "/rewrite.lua" )1
  4. Make sure the Mobile device support option of the WP Super Cache plugin is enabled and the Rejected User Agents list is up-to-date. You’ll find those options in the Settings -> WP Super Cache menu of Wordpress once WP Super Cache has been activated.

The lighttpd host configuration should now look somewhat similar to this:

$HTTP["host"] == "myblog.com" {
server.document-root = “/srv/www/myblog/wordpress”
accesslog.filename = “/var/log/lighttpd/
myblog/access.log"
magnet.attract-physical-path-to = ( server.document-root + “/rewrite.lua” )
}

Restart lighttpd to put the changes in place. Check your error log for any strange entries. Check the WP Super Cache settings of your blog and try to view it from a mobile device or an iPhone simulator, e.g., iPhoney.

Let me know if you’d like to further improve the rewrite.lua code. Just go ahead, clone it from the github repository and start working on it! If you’re interested in writing your own LUA code check out the Programming in Lua book or the Programming in LUA website.

  1. This requires ModMagnet being set up for your lighttpd server. Follow the previous link if you need help installing it. []

12 Mar

Google Latitude has been broken for days…


For a few days, I have been unable to connect to Google Latitude on my mobile phone. Dr. Schäuble will not be amused.

Google Maps is broken

Other services such as Web, E-Mail, IRC, SSH — “everything else requiring a data connection” — do work on my phone, as does the “regular” map service of the Google Maps Mobile app. Latitude shows up correctly on iGoogle, too.

Update: At least, I am not alone with this problem. No solution in sight, though. :(

Update 2: And it’s working again. Nice.


13 Jan

Re: How many mobile phones did you own?


Palm Treo 680vowe fragt die Leser seines flying circus: How many mobile phones did you own?

Also… dann mal ran an den Speck:

14 Telefone in … 12 Jahren. Eindeutig zu viel und ich glaube sogar, noch welche vergessen zu haben… ;-)


09 May

AppleScript für die Synchronisation mit iSync und Bluetooth


Schon seit einer Weile bin ich auf der Suche nach einer Möglichkeit, an meinem Powerbook die folgenden Arbeitsschritte mit einem Mausklick zu erledigen:

  • Bluetooth einschalten
  • iSync öffnen, mit meinem Sony-Ericsson K750i synchronisieren und wieder schließen
  • Bluetooth wieder abschalten

Bei macosxhints habe ich einen Artikel gefunden, der genau dies erledigen soll — leider klappte das nur mit der englischen Version von OS X.

Also habe ich ein wenig am Quelltext angepasst und jetzt funktioniert das Skript auch wunderbar bei der deutschen Version (der Download findet sich weiter unten).

Nach dem Download des Skripts kann es an einem beliebigen Ort abgespeichert werden, ich habe es im Ordner Library/Scripts innerhalb meines Benutzerordners abgelegt. Das hat einen großen Vorteil, den ich gleich erläutern werde…

Sollte es noch nicht geschehen sein, muss nun über die Systemeinstellungen das Bluetooth-Symbol in der Menüleiste aktiviert werden.

Anschließend öffnen wir das AppleScript Dienstprogramm (zu finden in Anwendungen -> Applescript). Hier aktivieren wir die Checkboxes bei “GUI-Skripting aktivieren” und “Skriptmenü in der Menüleiste einblenden”. Neben der Uhr erscheint jetzt ein AppleScript-Symbol, wenn wir darauf klicken, öffnet sich ein Menü, in dem unten unser Script zu finden ist (wenn es in Library/Scripts abgespeichert wurde…). Mit einem Klick darauf wird dann automagisch Bluetooth aktiviert, eine Synchronisierung durchgeführt und Bluetooth wieder ausgeschaltet. Voilà!

Download: Applescript zum Einschalten von Bluetooth und automatischer Synchronisierung mit iSync