stinky emails

Nikolaus Gradwohl2008-06-23T06:14:00+02:00

Last week a college came up with the theory, that nobody would have mails lying around in his inbox, if they would start to stink after a while. To check this, i came up with the "email-stinky-o-mat" i already have hacked together a small ruby script that calculates the "stinkycount" for a mailbox.

require 'net/imap'
require 'date'

imap = Net::IMAP.new('mailhost')
imap.login( 'user', 'password')

imap.select( "INBOX" )
stinkycount = 0
imap.search(["BEFORE", "#{(Date.today()-20).strftime( "%d-%b-%Y" )}" ]).each do |message_id|
stinkycount += 1
end
puts "#{stinkycount} stinking messages found"

this count can now be sent to a microcontroller (an arduino for example) which starts a fan, that is standing next to a reservior containing someting stinky - et voila (imagine drum roll here) - emails start to stink after 20 days :-)

read more ...

Javadeus08

Nikolaus Gradwohl2008-06-20T05:44:00+02:00

Yesterday i attended to the javadeus08, the first java-conference by sun in austria.

Most of the sessions were really interesting, and i definitly have to give jmaki a try :-)

The only thing, that annoyed me, is that there was no free wlan and that even the speakers had a veeeeeeeeery slow connection for their demos

read more ...

workbench

Nikolaus Gradwohl2008-05-31T19:06:00+02:00

6 years ago we have put up a table in our cellar for soldering and making stuff. since then we put various stuff in big boxes on the table an in front of it "just until we find a proper place" ... :-/

today we finaly managed to clean our cellar, put up 3 new shelves and store the stuff in them, and - TADA - the table can be used now!!

i just went down and soldered a kit - just because i can :-)

read more ...

chuck icontrol

Nikolaus Gradwohl2008-05-22T18:04:00+02:00

I own a m-audio icontrol and some time ago i started to play with chuck a programming language for making electronic music. today i managed to link them together and use my icontrol to start and stop my chuck programms :-)

next thing i will try is to convert the values from the "endless"-knobs to floats and to pass messages to the sub programms

1 => int device;

MidiIn min;
MidiOut mout;
MidiMsg msg;

// open the device
if( !min.open( device ) ) me.exit();
if( !mout.open( device ) ) me.exit();
[0,0,0,0,0,0,0,0] @=> int on[];
[-1, -1, -1, -1, -1, -1, -1, -1] @=> int ids[];
["beep.ck", "sing.ck", "autoloop.ck", "", "", "", "", "" ] @=> string names[];
while ( true ) {
    min => now;

    // get the message(s)
    while( min.recv(msg) ) {
        // print out midi message
        <<< msg.data1, msg.data2, msg.data3 >>>;

        if ( msg.data1 == 176 && msg.data2 >= 64 && msg.data2 < 72 && msg.data3 == 127 ) {
            msg.data2 - 64 => int chan;
            if ( on[chan] == 1 ) {
                0 => on[chan];
                sendOff( chan );
                if (ids[chan] > 0) {
                    Machine.remove( ids[ chan ] )
                        -1 => ids[chan];
                    }
                } else {
                    1 => on[chan];
                    sendOn( chan );
                    if ( names[chan] != "" ) {
                        Machine.add( names[chan] ) => ids[chan];
                    }
                }
            }
            // send( msg.data1, msg.data2, msg.data3 );
        }
    }

    fun void sendOn( int chan ) {
    send( 176, 64 + chan , 127 );
    }

    fun void sendOff( int chan ) {
    send( 176, 64 + chan, 0 );
    }

    fun void send( int d1, int d2, int d3 ) {
        MidiMsg msg;
    d1 => msg.data1;
    d2 => msg.data2;
    d3 => msg.data3;
    mout.send( msg );
    }
read more ...

multitouch

Nikolaus Gradwohl2008-05-11T16:26:00+02:00

since i have heard of lemur i wanted to try a multitouch display. i later found instructions on instructables.com showing how to build an DYI-Multitouch Display using a pictureframe, some infrared leds, a modified webcam and a lcd projector .

i dont own a lcd projector and so my multitouch display still remained a dream.

but recently i found a blog-post showing how to build a "moultitouch light". This version doesnt use infrared but normal light and it doesnt display the picture on the display but uses a second monitor.

i quickly hacked together my own version multitouch

and managed to get some of the demos running :-) - VEEEEERY COOL

(aehm - yes the penguin is a webcam)

i didnt manage to get the flash demos running on linux but the smoke demo and the calibration tool are working now

read more ...

simple Java Set/Map initialization

Nikolaus Gradwohl2008-04-20T07:55:00+02:00

When you need a array in java filled with some data, initializing it is easy

String[] bla = new String[] { "Foo", "Bar", "Bla" };

and done. but when you need a Map or a Set prefilled with some data it starts getting complicated. you can either use a static initializer block like

public class Bla {
    static Set<String> dings;
    static {
        dings = new HashSet<String>();
        dings.add("foo");
        dings.add("bla");
    }
}

or you fill your set or map in the contructor if it is still null (be carefull if you use this in a multithreaded application)

another way i have learnd at the last jax is using this code

public class Bla {
    static Set<String> dings = new HashSet<String>() {{ 
        add("Foo"); add("Bar"); add("Bla"); }};
}

neat isn't it?

this also works with a Map

public class Bla {
    static Map<String,String> dings = new HashMap<String,String>() {{ 
        put("k1", "Foo"); put("k2", "Bar"); put("k2", "Bla"); }};
}
read more ...

Typo Update

Nikolaus Gradwohl2008-04-10T07:32:00+02:00

I recently updated my blog to the latest shiny blinking bleeding edge "typo version":http://www.typosphere.org the updates really went very smooth and my nagios tells me that the stability has improved very much :-)

read more ...

download bots

Nikolaus Gradwohl2008-03-15T17:13:00+01: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!

bots

read more ...

Rfid-Reader (part2)

Nikolaus Gradwohl2008-01-18T22:23:00+01: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

RFID-Reader

read more ...

Multicard setup with freevo

Nikolaus Gradwohl2008-01-15T07:07:00+01: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

VIDEO_GROUPS = [
    VideoGroup(vdev='/dev/video0',
            adev=None,
            input_type='tuner',
            input_num=0,
            tuner_norm='pal',
            tuner_chanlist='europe-west',
            desc='Default Video Group',
            group_type='ivtv',
            record_group=None,
            vcr_cmd='/usr/local/bin/ivtv-record.py %(filename)s %(channel)s %(seconds)s',
      ),
    VideoGroup(
            vdev='/dev/video0',
            adev=None,
            input_type='tuner',
            input_num=0,
            desc='DVB Viewer',
            group_type='dvb',
            record_group=None,
            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 "generic-record.py" where i changed the line 'self.rec_command = config.VCR_CMD % cl_options' to 'self.rec_command = vg.vcr_cmd % cl_options'

read more ...