ruby symbols vs string vs constant

Nikolaus Gradwohl2009-02-10T03:13:00+01:00

on saturday i was asked by a ruby-newbie (sorry - i had to write it :-) ) whats the difference between a symbol, a string and a constant in ruby. even tough there are realy, realy many articles about ruby symbols ( a google search for "ruby symbols" results in 1,340,000 hits - so this is the 1,340,001 aricle covering the topic) there is obviously still some confusion out there. So i try my own definition here.

read more ...

Ruby Caldav Library 0.2

Nikolaus Gradwohl2009-01-28T04:16:00+01:00

I have made a new version of my ruby caldav lib.

version 0.2 is a bugfix release, there are no new features but i removed some essential typos

read more ...

osc sequencer in ruby

Nikolaus Gradwohl2009-01-20T05:29:00+01:00

I wrote a simple osc sequencer in ruby using rosc. The script triggers the drum-kit and the bass i implemented last week.

the pattern may also be of different length. This allows very interesting polyrythmic loops.

require 'osc'
Host = 'localhost'
Port = 3334

c =
hh ='/drum', 's', "hh" )
bd ='/drum', 's', "bd" )
sn ='/drum', 's', "sn" )

ba ='/bass', 'i', 64 )

#c.send sn, 0, Host, Port
bpm = 120
step = 1.0/8;
s = bpm * step / 60.0 ;

snd = [ bd, sn, hh ]
pattern = [
[1, 0, 0, 1, 0, 1, 0, 0 ],
[0, 0, 1, 0, 0, 0, 1, 1 ],
[1, 1, 1, 1, 1, 1, 1, 1 ]
bass = [
40, 40, 0, 40, 40, 0, 43, 0,
40, 40, 0, 40, 40, 0, 38, 0 ]

count = 0;
    (0..2).each { |i|
        c.send(snd[i], 0, Host, Port) if pattern[i][count % pattern[i].length] == 1

    ba.args = [bass[ count % bass.length]]
    c.send( ba, 0, Host, Port ) if bass[ count % bass.length ] != 0

    sleep s
read more ...

typo on debian

Nikolaus Gradwohl2008-09-27T12:10:00+02:00

Yesterday i have installed typo on a debian box. First i installed ruby, rails, mongrel, rake and gem - and when i wanted to install typo it told me that it didnt like my rails version :-/

so i installed rails 2.0.2 and then typo. After installing the blog, and configuring apache (i haaaaaaate mod_proxy rewrites in apache - i cant tell you how much!) typo thrwe some exceptions every time i wanted to write an article.


after googleling for some time, i found out that rails 2.0.2 isnt working with ruby 1.8.7. Instructions how to downgrade ruby can be found here and instructions how to keep debian from upgrading it again can be found here

read more ...

Ruby Caldav Library

Nikolaus Gradwohl2008-07-14T06:27:00+02:00

I have a DAViCal running and i wanted to write a simple jabber bot that reminds me when i have forgotten to enter my timesheet data. So i have hacked together a simple ruby library to access the caldav protocol. More info and sourcecode is available on the project page

read more ...

Nagios Glitzerlampe

Nikolaus Gradwohl2008-07-13T16:58:00+02:00

I made a new project page for my nagios visualisation system written in ruby.

read more ...

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 ='mailhost')
imap.login( 'user', 'password') "INBOX" )
stinkycount = 0["BEFORE", "#{( "%d-%b-%Y" )}" ]).each do |message_id|
stinkycount += 1
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 ...

Typo Update

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

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

read more ...