Archive for the ‘Hacking’ Category

Asterisk for FRITZ!Box 7270 Updated to Version 1.6.2.9

Monday, July 5th, 2010

It has been a while since I published my guide to cross-compile Asterisk for the FRITZ!Box 7270. This guide and build script was based on Asterisk 1.6.0.19.

Asterisk development has not stopped, though, so the current Asterisk branch – currently at revision 1.6.2.9 – got out of sync with the asterisk-freetz-build script.

Now, what is so great about community-based software is that it facilitates contributions by others: Recently, I received an e-mail from Thomas Rueter, who provided me with a set of patches to compile Asterisk 1.6.2.8 using asterisk-freetz-build. His patches served as a basis for a revamped asterisk-freetz-build v0.2 package, which is capable of cross-compiling Asterisk 1.6.2.9 and chan_capi 1.1.5 for Freetz 1.1.x.

If you just want the updated package, you can grab it here. In case you are interested into contributing to its development, a copy of it is now available on GitHub.

And if this executive summary does not make too much sense to you ;-) , feel free to read my original blog post, which I also updated to reflect the version change.

US International Keyboard Layout w/o Dead Keys for Microsoft Windows

Monday, May 3rd, 2010

As much as I would like to completely switch over to Linux, for some tasks I am unfortunately still stuck with Microsoft Windows. This comes with the issue that Windows natively does not ship with the keyboard layout that I am routinely using under Linux: US International (No Dead Keys).

Fortunately, there is an easy solution available: Using the The Microsoft Keyboard Layout Creator it was a matter of seconds to remove the dead keys from the the stock US International keyboard layout.

The resulting keyboard layout file is available for download for your convenience. You can easily import this file into the Microsoft Keyboard Layout Creator and turn it into installable keyboard layout DLLs.

Hash It! 1.1.0 adds ccSLD support

Friday, April 30th, 2010

A couple of days ago I visited the UK and also took my Android smartphone with me. After accessing some loal .co.uk web sites I quickly noticed that Hash It! would not figure out the right site tag for them when it was invoked from the Android web browser via the “Share” intent.

So, I just rolled an update, Hash It! 1.1.0, which adds support for the most common ccSLDs (country code second-level domains), such as .co.uk, .ac.uk or .com.sg.

Hash It! 1.1.0 is available via the Android Market. Details are also available at: http://android.ginkel.com/

Enjoy!

Java Method Signature Name Mangling

Sunday, April 25th, 2010

As with any modern programming language that supports method overloading, Java uses name mangling to distinguish methods that share the same name, but only differ in their parameters. Now, actually figuring out the exact algorithm used by javac by googling the Internet turned out to be quite tricky. Eventually, I dug up the following description, which at least serves as a starting point:

http://asm.ow2.org/doc/faq.html#Q7

P.S.: This would not even have been an issue if HTC would open-source their proprietary code for the HTC Desire…

Hash It! Updated to Version 1.0.2

Tuesday, April 20th, 2010

It has been a while since I last worked on Hash It!, but thanks to the bug report of an attentive user I just uploaded a new version (1.0.2) of Hash It! to the Android Market. Bottom line: Hash It! now works correctly on Android 1.5.

Hash It! is licensed under the GPLv3 and as such comes with full source code for your entertainment.

Further details on how to download it to your mobile phone as well as the changelog are available at: http://android.ginkel.com/

Get it while it is still hot! ;-)

Android: Maps API Key Issues

Monday, April 19th, 2010

When using Google Maps from within your Android application you need to obtain an API key in order to be able to retrieve Maps data at run-time. This API key is derived from the fingerprint of the signature key used to sign the application’s APK. Consequently, if the signature key used by your application at a given point in time no longer matches the one used to register the Maps API key, using the MapView will silently fail (the map will just display a gray grid instead of the expected map data). So far, so good.

As it seems, the Android ADT Eclipse plug-in also comes with an undocumented “feature”: If no “Custom debug keystore” is set in the Android Build Preferences, it will apparently use a different key to sign the APK when deploying it to a phone connected via USB than when deploying it to the Emulator. So, all your Maps applications will suddenly start to fail displaying map data once they are deployed on a real device for testing purposes.

To work around this issue, set the “Custom debug keystore” setting (empty by default) to the same value as the “Default debug keystore”.

PHP Unicode support – or the lack thereof

Wednesday, March 31st, 2010

Well, I just had the pleasure to fix special character (umlaut) handling in a legacy PHP application. To put it short: It has been a while since I saw so many i18n issues as I figured out in PHP (version 5) during the last hour:

  • PHP strings are just plain byte arrays. Their content is non-portable as it is dependent on the current default encoding.
  • The same applies to the representation built by serialize. It contains a length-prefixed byte representation of the string without actually storing any encoding information.
  • Most PHP (string) functions have no clue about Unicode. For a detailed list including each function’s risk level, refer to: http://www.phpwact.org/php/i18n/utf-8

Note to self: Never ever use PHP for a new project.

Duplicity – Backup to the Cloud

Sunday, March 7th, 2010

Due to current events I started to think about options for a backup solution that would be able to cope with a complete disastrous loss of hardware. So, off-site storage was warranted.

What I came up with is a backup solution based on Duplicity and Amazon S3.

Storing personal data in the cloud may ring one or another alarm, but with Duplicity the data is safe from prying eyes as all backed up data is sent through GnuPG using public-key encryption before being transferred to Amazon’s data center. You should, however, make sure that one of the private keys used for encrypting the backup is locked away in a safe place, so you have it handy when it is time to perform a restore.

As far as storage costs are concerned, storing 50 GB of data in the AWS S3 cloud for a month costs around 6 EUR, which I personally consider quite competitive for redundant off-site data storage.

Naturally, one drawback remains: Bandwidth usage. It takes a while to load the first full backup into the cloud as the upstream of most DSL lines is rather limited. After that initial load has completed, however, Duplicity is capable of appending incremental backup sets to the existing backup data, so the incremental backups complete much faster.

P.S.: It may sound a little weird that I chose Amazon Web Services as a storage provider after my recent trouble with Amazon.de, but after some thorough market analysis AWS remained as the only feasible option.

Das funktioniert doch alles nur zufällig…

Tuesday, February 16th, 2010

…ist einer der Gedanken, die einem bei einem Blick hinter die Kulissen so mancher Software in den Sinn kommen, wenn verschiedene Komponenten scheinbar mit heißer Nadel miteinander verbunden wurden und sich Bugs gegenseitig ausnivellieren.

Während diese Feststellung bei den meisten Softwarepaketen eher zu einer Fluchtreaktion des Betrachters führt, ist es umso erstaunlicher, dass es klugen Köpfen gelungen ist, das leichtfüßige Nebeneinander verschiedener Komponenten ohne strenge Bindung zum Paradigma zu erheben und darauf eine agile Softwareentwicklungsplattform aufzubauen. Das war die Geburtsstunde von Ruby on Rails.

Hiermit ist es möglich, umfangreiche Applikationen ohne das sonst häufig übliche Abhängigkeitswirrwarr zwischen den verschiedenen Komponenten zu bauen, das die Wartung ebendieser Applikationen sonst häufig zur Geduldsprobe werden lässt. Vielmehr verbinden sich Komponenten über Konventionen – ohne dass in den meisten Fällen eine direkte Abhängigkeit definiert werden muss.

Das ist dann in etwa so, als würde man einen Sack voller Lego-Steine ausschütten und wie durch Magie entsteht daraus ohne weiteres Zutun der Todesstern. ;-)

Mir gefällt’s jedenfalls…

ActionMailer and mod_fcgi

Tuesday, January 26th, 2010

Lately, I have been playing around a lot with Ruby on Rails and am currently finishing my first full-fledged application. While I am using WEBrick directly launched from my Eclipse development IDE in my development environment the production site is currently using Apache + mod_fcgi to run the application. This is where all the problems started. ;-)

The application sends out e-mail notifications (using ActionMailer) for various state transitions, which worked flawlessly on the development machine. In the production setting, however, sending mails failed complaining that it cannot find the associated mail template:

ActionView::MissingTemplate (Missing template event_mailer/approval_requested_notification.erb in view path app/views):
app/models/event_observer.rb:3:in `after_enter_awaiting_approval'
/usr/lib/ruby/1.8/observer.rb:185:in `notify_observers'
/usr/lib/ruby/1.8/observer.rb:184:in `each'
/usr/lib/ruby/1.8/observer.rb:184:in `notify_observers'
(eval):10:in `create_or_update_without_callbacks'
app/controllers/event_controller.rb:71:in `request_approval'
public/dispatch.fcgi:24

Well, after putting some thought into possible differences between development and production and ruling out any relevant configuration differences in config/* all that remained was the fact that dev uses WEBrick while production uses mod_fcgi. One thought lead to another and it turned out that WEBrick sets the application root as the current working directory during startup while mod_fcgi does not.

So, the workaround is simple: Set the current working directory to the application root in config/environment.rb, such as:

Dir.chdir(File.dirname(__FILE__) << '/../')