download bots

Nikolaus Gradwohl2008-03-15T17:13:00+00:00

UPDATE: I posted some building instructions for Download-Bots

i just started a lengthy download and had to kill some time so i started to build some toy-robots for my kids.

it took me aproxymatly 90 mb to build 2 robots

so while downloading my next ubuntu cd 1 could build 12 of them and while downloading the iphone sdk i could make another 48! An army of little robots! World donimation! muaaahahaha!


read more ...

Rfid-Reader (part2)

Nikolaus Gradwohl2008-01-18T22:23:00+00:00

due high public demand ( i have a reader! ) i post a photo of my rfid-reader. The small black dot on the plastic-disk surrounded by copper-wire is the actual rfid-transponder chip - awsome


read more ...

Multicard setup with freevo

Nikolaus Gradwohl2008-01-15T07:07:00+00:00

I'm using freevo for my vdr and like it very much. Recently in austria terestrial analog tv has bin turned off and everyone had to switch to DVB. So our block got a big Satelite-Receiver and a box that transcodes the DBV-S signal to DBV-C. and i hat to put a DVB-C card in my freevo box ...

to "make the hunt more interessting (shirkan - the jungle-book)" some of the channels still come over analog-tv. freevo handles mulit-card setups very well, but only if the cards are the same type. So i had to patch it a little to support my setup where some channels have to be recorded and viewed from one card and some from the other.

i extended the 'VideoGroup' class by a "vcr_cmd" member, and wrote a little record-pluin that sets the command depending on the channel description

            desc='Default Video Group',
            vcr_cmd='/usr/local/bin/ %(filename)s %(channel)s %(seconds)s',
            desc='DVB Viewer',
            vcr_cmd = 'mencoder -oac copy -ovc copy -o %(filename)s -dvbin card=1
                            "dvb://%(channel)s" -endpos %(seconds)s'

ivtv-record is a small script i have written because i cant use the ivtv plugin anymore (it doesnt use the cmd variables). my record-plugin is a extenion to the "" where i changed the line 'self.rec_command = config.VCR_CMD % cl_options' to 'self.rec_command = vg.vcr_cmd % cl_options'

read more ...

network environments

Nikolaus Gradwohl2008-01-15T06:45:00+00:00

i have a new version of my "detect where i am" script that workes absolutly hands free. i rarely turn my mac off, most of the times it stayes in sleep mode when im traveling from one site to another.

so i use "SleepWatcher" a great tool from Bernhard Baehr to trigger a script that scanns for known wlans and changes my proxy settings

read more ...


Nikolaus Gradwohl2007-12-12T22:38:00+00:00

I got my RFID-Reader 2 plus from conrad running!!! it took me just 5 months to find out what "stabilized 5V+" means :-)

the reader can be configured to send all the id strings it reads. but unless a barcode reader, it isnt triggerd by the user but sends the strings it finds all the time like crazy - looks cool in a terminal program :-) is also fun to see which tags are read if more than one is in the reading distance - maybe i make a game out of that :-)

read more ...

PDF for N770

Nikolaus Gradwohl2007-12-07T06:42:00+00:00

I own a Nokia 770 which i use to read pdf-files in the subway. i realy like it, but it has one downside - it is extreamly slow in changing the page if the page has to be zoomed or scrolled. the solution i found was to define a custom papersize for my "print-to-pdf" dialog, which fits into my N770 screen without the need to scroll or zoom.

if i want to read some website-content offline in the subway, i just have to print it to pdf using my custom page-format and copy it to my device using bluetooth.

read more ...

automatic proxy configuration in firefox

Nikolaus Gradwohl2007-11-03T15:43:00+00:00

In an erlier article i describe how to switch between the network environments i am using, but there was one programm i could not convince to let me change the proxy settings via apple script - firefox.

i still needet to switch the firefox settings per hand - something i didnt like at all.

one day the little "fetch proxy settings for url" dialog part from the firefox proxysettigns made me courious and i found out, that firefox expects a javascript file on this url, which tells firefox what proxy to use.

function FindProxyForURL(url, host) {
    if ( dnsResolve( host ) == "" ) {
        return "DIRECT";
    } else {
        return "PROXY proxyhost:8080";

this script can use some predefined functions like "isInNet" or "dnsResolve" to determine which network Im in and use the appropriate proxy. the file doesnt even have to live on a http server, a file:// url is sufficient.

e voila - no more manual proxy switching

read more ...

Using "functional"-Programming to map Resultsets to POJOs

Nikolaus Gradwohl2007-09-26T20:40:00+00:00

When I use jdbc to develop a small tool, where using a OR-Mapper like Hibernate is overkill, I always dislike that i have to dublicate all the "getStatement" "execQuery" "while (" stuff.

i dont like to repeat stuff in my code. It would be very easy if java had closures, but i dont want to wait until java7 to simplify my code so I needet another idea.

java has no closures but it has something that can be used in a similar manner - Anonymous inner classes.

so to simplify the following class

Connection con = getConnection()
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( "sqlstring");
List<Foo> result = new ArrayList<Foo>();
while ( {
    Foo f = new Foo();
    f.setProperty1( rs.getString( "property1" ));
    f.setProperty2( rs.getString( "property2" ));
    result.add( f );
// imagine catch/finaly block here

i define a interface called Function

interface Function<T> {
    public T valueOf( ResultSet rs ) throws SQLException;

Then i define a QueryMapper like this

public class QueryMapper<T> {
    private Database db;
    public QueryMapper( Database db ) {
        this.db = db;

    List<T> listOf( Function<T> f, String query ) {
        List<T> res = new ArrayList<T>();
        Resultset rs = ... get resultset for query ..
        while ( ) {
            res.add( f.valueOf( rs ));
        // catch/finaly block here
        return res;

So all i have to do in my code now is calling

Function<Foo> fn = new Function<Foo>() {
    public Foo valueOf( ResultSet rs) throws SQLException {
        Foo res = new Foo();
        res.setPropery1( rs.getString( "property1" ));
        res.setPropery2( rs.getString( "property2" ));
        return res;

QueryMapper<Foo> qm = QueryMapper<Foo>( db );
List<Foo> res = qm.listOf( fn, "select * from foo");

I can even recycle the Function objects ( if i query different object of the same type but with different ids for example ) thats more how i like it

read more ...

using Applescript to switch working environments

Nikolaus Gradwohl2007-09-16T17:40:00+00:00

Halve of my time i'm working at a costomers office, everyone has a different network environment, some usuale proxies some don't. in some environments i can use my mailclient, in some i have to use my webmail account.

so i usualy spent the first 5 to 10 minutes of my workday switching network profiles, configuring proxies, changing my subversion configurations, stopping and starting various propgramms, etc

doing repetitive stupid work is something i dont like. im a computer programmer and these are exactly the ones that sould be automated in my oppinion.

so i startet to create a little applescipt for every environment im in. it switches to the correct network profile stops my mailclient where nessesery and changes my current subversion profile, if a proxy is required.

changing the subversion config was the easiest part. i just fired up iterm and changed the config by setting a symlink using a shellscript so i have two copies of my .subversion/servers file one for using the proxy and one for direct connections, and the 'servers' file is a symlink to one of those

well at least i thought it woult be easy ...

the tricky part starts when iTerm is running but has no open windows. then i have to start a Termintal before i can call the shellscript so this is what the shellscript-starting part looks like

tell application "iTerm"
    delay 1
    if (count of windows) is 1 then
        set myterm to (current terminal)
        set myterm to (make terminal)
    end if
    tell myterm
        set mysession to (launch session "Default Session")
        tell the last session
            write text "/Users/nikki/tools/switchsvn2 default"
        end tell
    end tell
end tell

and the corresponding shell script is

cd ~/.subversion
rm servers
ln -s servers.$1 servers

to switch the current network profile applescript UI events need to be activated. Then applescript can be told to click on various menu items like this

tell application "Finder"
end tell

tell application "System Events"
    click menu item "networkprofilename" of menu "Location" 
                  of menu item "Location" of menu "Apple" of menu bar 1 of process "Finder"
end tell    

to start the applescript files i use quicksilver. So all i have to do now when starting my working day in a different environment is fire up quicksilver using - and entering the name of the environment

thats how i like it :-)

read more ...


Nikolaus Gradwohl2007-04-26T11:25:00+00:00

Im currently sitting in Wiesbaden at the Jax2007 (missing a keynote from SAP :-) ) i've seen a lot of new interessting tools and techniques which will keep me busy some times.

webtest from canoo, for example has evolved in a very interesting way since i gave it the last try,

one thing that many of the speakers are showing ist the tendency to use more languages on the JVM and choose the right tool for the problem. and not let the language shape the solution.

there were some nice sessions showning how to generate textual DSL with ruby or open architecture ware.

this time there were some netbeans sessions where new features from the upcoming netbeans 6 release where shown - realy nice

and i heard abount ApacheDS a ldap server which is completely written in java and can be embedded into other applications.

ok the sap keynote is comming to an end - i will go to the next session now ...

read more ...