Android app: German license plates / Deutsche Kfz-Kennzeichen

December 27, 2011 – 2:36 pm
Search for the city, district or institution that the abbreviation on a German car number plate refers to. Also works on the way, without a data connection. Suche nach Stadt, Landeskreis oder Institution zum passenden Unterscheidungszeichen. Funktioniert auch unterwegs ohne Internetverbindung. Deutsche Kfz-Kennzeichen for Android on AppBrain

Retrieving Google geocoded co-ordinates in Python

August 3, 2011 – 1:50 pm
Import the json and the urllib2 modules: import json, urllib2 Programmatically contruct the URL to meet the requirements of the the geocoding webservice, i.e. make it look like this (click to view the JSON response): http://maps.google.com/maps/api/geocode/json?address=An+der+Bonnesse+18,+26725+Emden&sensor=false In Python, the JSON object will be returned as a dict of nested lists and dicts. Data can be retrieved like this: data = json.load(urllib2.urlopen(url)) lat = data['results'][0]['geometry']['location']['lat'] lng = data['results'][0]['geometry']['location']['lng']

LPI training

July 30, 2011 – 1:25 pm
Our LPI trainer is yet another work in progress. You can use our first sample questions to train for LPIC-1, exam 101: http://pygmalion.nitri.de/lpi.

Prisoner’s dilemma on Android

June 12, 2011 – 12:26 pm
The old prisoner's dilemma applet has been revitalized on Android. It was a fit occasion to clean up and rewrite those messy sources from the nineties.

Posting to a Facebook wall using the Graph API

May 28, 2011 – 6:08 pm
First, instantiate a new Facebook object. Nothing exciting here: require '../src/facebook.php'; $facebook = new Facebook(array( 'appId' => '..............', 'secret' => '..........................', )); As of PHP SDK version 3.0.0 you shouldn't use getSession() to verify a user's connectivity. Instead use getUser() directly: $user = $facebook->getUser(); Offer a login screen when the user is not connected. You may want to read through Facebook's new OAuth 2.0 authentication protocol, but you should be aware that the entire process can be handled over the API. Simply add the required permissions to the 'scope' (not 'req_perms') parameter of getLoginUrl(): if (!$user) { $url = $facebook->getLoginUrl(array( 'canvas' => 1, 'fbconnect' => 0, 'scope' => 'publish_stream' )); echo "<script type='text/javascript'>top.location.href = '$url';</script>"; } else { <execute your app code ...

Convert a WEP passphrase into hex

April 18, 2011 – 2:45 pm
Traveling the world you may find yourself in a place where the Wi-Fi access point is WEP protected. The owner can only provide you with an alphanumeric passphrase, whereas your Linux notebook expects you to enter the corresponding hexadecimal key. Somewhere on the web we found the following code to generate hex keys from passphrases and it works like charm! Compile and link it against the libcrypto shared library: gcc -Wall keygen.c /usr/lib/libcrypto.a -o wepkeygen Or get the the binary right here: wepkeygen.zip Generate a set of 64 bit keys (your best chance is that the first one will work): ./wepkeygen <passphrase> | tr -d ':' Generate a 128 bit key: ./wepkeygen -s <passphrase> | tr -d ':\n' That's all! keygen.c: /* * keygen.c * WEP Key Generators * * This program generates WEP keys using de facto standard key * generators for 40 and 128 bit keys. * * Link against OpenSSL's libcrypto.a * * I place this ...

Vodafone UMTS: unwanted image compression

February 15, 2011 – 5:39 pm
When surfing the web over Vodafone UMTS in Germany, you may notice that JPEG images are compressed and displayed in low quality. Press Ctrl-F5 (Strg-F5) in your browser to see the original images on the page. There are several ways around this. Solution 1 (MS Windows) Use Vodafone's HighPerformance Client to set the compression level. This will only help you if your UMTS stick is plugged into your Windows PC. If it is plugged into your router (e.g. Vodafone Surf-Sofort) you'll need another solution. Solution 2 (MS Windows) Use René's UMTS Proxy. Solution 3 (Firefox, Linux/MS Windows) Install the Modify Headers plugin. This is the most elegant solution for Firefox users. Restart Firefox and empty its cache. In 'Tools' -> 'Modify Headers' add the entry: Name: Cache-Control Value: no-cache On the 'Options' tab, check 'Always On'. Solution 4 This seems to be the best solution if the UMTS stick is plugged into the router. Run the following Perl script on a ...

Wardriving using an Ubuntu 10.04 notebook and a Garmin Etrex

February 3, 2011 – 2:13 pm
Most GPS software that ships with Ubuntu 10.04 uses gpsd to retrieve data from the GPS receiver. So make sure that you have gpsd installed. Unfortunately the new JSON protocol used by gpsd is not supported by some applications. You need to install Kismet 2011 or later. Get the deb packages from here: http://www.kismetwireless.net/download.shtml Furthermore you'll want to install GpsDrive 2.11 or later. Get the deb packages here: http://download.osgeo.org/livedvd/data/gpsdrive/lucid/ Be sure to literally follow the installation instructions in the README file or you'll end up in dependency hell. Set the interface of the Garmin to NMEA: SETUP -> INTERFACE -> NMEA OUT. (As a matter of fact we once managed to get things working over the Garmin protocol with the garmin_gps kernel module, but for some reason we did not succeed in reproducing that success. Besides, the garmin_gps module reportedly is unstable.) Connect the receiver ...

WDR 2 playlist GNOME panel applet

November 25, 2010 – 12:25 pm
The applet retrieves the current playlist of the German WDR 2 radio channel and displays it in a GNOME panel. It can easily be modified to fetch and display other data from the web (e.g. playlists, headlines, weather) if you are familiar with regular expressions. Download: playlist_wdr2.tar.gz

Default Glade window sizes

October 21, 2010 – 3:39 pm
By default, GtkWindow objects are displayed as compact as possible. In order to specify the preferred window dimensions, first set the visibility of the window to "No" in Glade Interface Designer (properties -> common tab.) In the code of the window class, call set_size_request(x,y) before making the window visible. E.g.: class appgui: def __init__(self): gladefile="gui.glade" windowname="window1" self.wTree=gtk.glade.XML (gladefile,windowname) ... ... ... self.window = self.wTree.get_widget("window1") self.window.set_size_request(320,640) self.window.show() return The basics of creating a GUI using PyGTK and Glade: http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/

Simple article rewriter

May 30, 2010 – 4:09 pm
A web based prototype of our article rewriter is available here. You can use it to enliven your (English) text or to create unique content. The script does not connect to a database but crawls the Internet to fetch synonyms. That may take a while, depending on the size of your text. It will only be working as long as the markup of the crawled pages does not change. You still have to do some verb conjugation and noun declination by hand. http://pygmalion.nitri.de/articlerewriter

Using a cellphone as a GPRS modem in Ubuntu (8.04)

May 1, 2010 – 8:20 pm
We're using a LG KC 910 Renoir. Connect the phone to your computer over the USB cable. Accept the connection in "PC Suite" mode or something similar (that is: not as a mass storage device). Make sure you have the wvdial package installed. Then type: sudo wvdialconf /etc/wvdial.conf The device (e.g. ttyACM0) will be scanned and the configuration file will be updated. Edit the file as root (sudo vi /etc/wvdial.conf) to include the following lines: Phone = *99# Username = <gprsuser> Password = <gprspassword> Stupid Mode = 1 User and password depend on your operator. You may find what you're looking for on this page: http://www.quickim.com/support/gprs-settings.html. The phone number is the GPRS dial-up and may vary as well. We used these lines to connect to KPN in the Netherlands: Phone = *99# Username = KPN Password = gprs Stupid Mode = 1 Run wvdial to set-up a PPP connection: sudo wvdial You should now have a working connection. DNS server entries have been updated in /etc/resolve.conf You may ...

Drupal 6.x: fatal error in installer

February 3, 2010 – 3:02 pm
During database setup the following fatal error may occur in the web-installer on some systems: Fatal error: Call to undefined function _user_password_dynamic_validation() in /var/www/localhost/htdocs/drupal/install.php on line 727 It can be solved by modifying the system table of your Drupal database: mysql -u -p use UPDATE system SET status = 1 WHERE name = 'block' OR name = 'user' OR name = 'node' OR name = 'filter'; exit Then reload the installer page on which the error occurred and your installation wil continue.

Adding a profile box and posting to the feed on facebook

September 24, 2009 – 6:36 pm
Building an app is easy. At least that's what facebook states. Yet it can be quite a challenge to get started if you're not famliar with facebook's API as the documentation can be quite confusing. Besides, the API seems to be still under development and therefore subject to changes. Chances are that you'll code against deprecated API (e.g. after googling for a solution). We'll demonstrate how to 1) add a profile box to a user profile and 2) post a message to the news feed. After we've set up the application in the Developer App, we'll start with some code to instantiate a facebook object with our unique API key and application secret. This object contains the api_client object with all the API methods we need. It also contains methods to retrieve some values we'll need during the application session, like the user's unique ID. // the facebook client library include_once 'facebook-platform/php/facebook.php'; // Get these ...

Dilution calculator for distillers

January 29, 2009 – 6:29 pm
This very simple Java application calculates the volume of water that needs to be added to an alcoholic distillate to reduce it to bottling strength. Although it's not a very complex calculation of course, life becomes a tidbit easier when the result is just a mouse click away. Invoke as follows: java -jar Dilute.jar To create a desktop launcher provide the full path to the jar file. This tool shouldn't be used for commercial purposes. Note that it doesn't take the phenomenon of contraction into account. Download: Dilute.jar

Tags:

WordPress LinkRoll Widget

June 29, 2008 – 5:23 pm
The simple widget that runs in our sidebar presents a random selection of stored links. The script parses the <title> tags on the referred pages to name the links. To install it copy the script file to your plugin directory. Activate the widget in WordPress under Plugins, add it under Design->Widgets and customize it. These values can be edited: Title. URL list. This is a text field containing all URLs separated by spaces. The number of random links to display. Download: linkroll.tgz

WordPress AdSense Widget

June 25, 2008 – 2:50 pm
We customized Mike Smullin's AdSense to meet the current specs. Our sidebar shows what it looks like. You can find our version right here. After installation and activation you only need to specify google_ad_client (your publisher ID) and google_ad_slot (to be pasted from the code provided by Google) on the Design->Widgets tab.

Google PageRank in PHP

June 23, 2008 – 2:53 pm
To obtain your PageRank in PHP without a 403 Forbidden error you'll have to calculate the PageRank Checksum and send it with your request. This is the way to go: http://www.hm2k.com/projects/pagerank We have added a simple demo. Get your PageRank right here.

Bypassing a cranky BIOS: boot from CDROM

June 23, 2008 – 11:57 am
After a major crash of our Acer Aspire 1642 the hard disk needed to be replaced. After booting from a life CD we successfully installed Ubuntu Gutsy on the new drive. Unfortunately, after reboot the BIOS appeared to be completely blind to it. A BIOS upgrade would not fix the problem. We worked around the problem by creating a boot CD that would load a kernel, recognize the drive and continue booting the root partion on it. First install the package syslinux. Create a working directory: mkdir bootcd Add isolinux.bin: cp /usr/lib/syslinux/isolinux.bin bootcd Copy the appropriate kernel and ramdisk images to bootcd/linux and bootcd/initrd.img respectively, e.g: cp /boot/vmlinuz-2.6.22-14-generic bootcd/linux cp /boot/initrd.img-2.6.22-14-generic bootcd/initrd.img Create a file bootcd/isolinux.cfg containg a line that will point to your root partition, e.g. /dev/sda1: DEFAULT linux initrd=initrd.img ro root=/dev/sda1 Create an iso image of the working directory: mkisofs -o bootcd.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -hide-rr-moved -R bootcd/ Burn the image to CD. Boot your system.

Tags: ,

Pinnacle PCTV USB2 on Suse 10.x

June 4, 2008 – 11:46 pm
Retrieved from the old wiki: To get the Pinnacle USB2 device working you'll need the kernel module for the em28xx chipset. This module is not included in the Suse distribution, so obtain the video4linux package v4l-dvb from linuxtv.org. Note: You do not need the usbvision package. It only supports USB1. The sources of your current kernel need to be installed in order to compile the v4l package. Simply get the kernel sources with Yast. Unpack the v4l package, change to its directory and build the modules: make make install Check for the presence of a running ivtv_tveeprom module: lsmod | grep ivtv_tveeprom If it is present remove it from the kernel: modprobe -r ivtv_tveeprom Insert the appropriate v4l-dvl modules: modprobe tveeprom modprobe tuner modprobe em28xx If module insertion fails, check out dmesg to find out what goes wrong, e.g.: dmesg | grep em28 em28xx: module not supported by Novell, setting U taint flag. em28xx: disagrees about version of symbol tveeprom_hauppauge_analog em28xx: Unknown symbol tveeprom_hauppauge_analog The ...

Tags: ,

Prisoner’s Dilemma applet

June 4, 2008 – 11:26 pm
Retrieved from the old wiki: The Prisoner's Dilemma source code has been released, a simple AWT based and multithreaded Java applet. /** The Prisoner's Dilemma @version 0.20 @author Serge Helfrich 03-Aug-2002 (0.01 11-Feb-1998) */ import java.awt.*; import java.awt.event.*; import java.applet.*; public class Pris00 extends Applet { double b = 1.85; double p = 0.1; int delay = 100; // increased for green thread support boolean paused; PrisCanv cv; PrisPan pn; public void init() { paused = false; Color bg = new Color(255,255,192); setBackground(Color.black); ...

Tags: