golden times again for filesharing 06. Aug 2008
Wie heise online bereits berichtete, erarbeiteten die deutschen Generalstaatsanwaltschaften Leitlinien zum möglichst einheitlichen Umgang mit dem Phänomen der Massenstrafanzeigen. In Nordrhein-Westfalen (NRW) mündete dies nun in einem Schreiben an die Staatsanwaltschaften. Demnach sollen in NRW Anschlussinhaber nur noch ermittelt werden, wenn sie mehr als 3000 Musik- oder mehr als 200 Filmdateien über ihren Tauschbörsen-Client zum Download angeboten haben. Ähnliche Empfehlungen wie die von den Generalstaatsanwaltschaften in NRW gibt es auch in Baden-Württemberg, Bayern und Sachsen-Anhalt. (via heise)
Die Musik- und Filmindustrie flucht verständlicherweise wie ein Rohrspatz.
music elitarism 05. Aug 2008
Eike schreibt wunderbar schnoddrig über Musik-Snobismus.
ecoplan album download 28. Jul 2008
Das 2002er CDr-Album Elevator Friendship von Luc Hespel aka Ecoplan gibt es nun auf seiner Website als Download. Ich habe mir das Album damals bei ihm direkt per Post bestellt. Das war die Zeit wo ich gerade frisch nach Mannheim gezogen war und meinte ich müßte sämtliche Locations des Rhein-Neckar-Deltas mit Electronica von Morr Music und City Centre Offices beschallen. Die lokalen House-DJs haben mich deswegen manchmal komisch angeguckt, aber das Publikum hat sich selten beschwert. Das war außerdem die Zeit wo ich angefangen habe mit Traktor aufzulegen, was damals tatsächlich noch ein echter Hingucker war. Mittlerweile legen wahrscheinlich sogar meine Oma und ihr Hund mit Traktor auf. Wenn sie nicht in Live Klötzchen schieben.
ruby 1.9 utf-8 mostly works 07. Jul 2008
I was curious to see how far the implementation of utf-8 in Ruby 1.9 has developed. First we assign a pure Ascii string and check it’s encoding.
>> a = "Restaurant"
=> "Restaurant"
>> a.encoding
=> #<Encoding:US-ASCII>
Okay, nothing spectacular so far. Next we take a Unicode string.
>> b = "Café"
=> "Café"
>> b.encoding
=> #<Encoding:UTF-8>
Looking great, now let’s work with that string.
>> b.each_byte {|byte| puts byte}
67
97
102
195
169
=> "Café"
Here we see the utf-8 encoded é as two bytes.
>> b.each_char {|char| puts char}
C
a
f
é
=> "Café"
Works as expected.
>> b.size
=> 4
In Ruby 1.8 this would have returned 5.
>> b.reverse
=> "éfaC"
In Ruby 1.8 this would have generated a broken character at the start.
>> b.chop
=> "Caf"
In Ruby 1.8 this would have generated a broken character at the end.
>> b.upcase
=> "CAFé"
This is where work is still needed! In Ruby 1.8 there is Nikolai Weibull’s Ruby Character Encodings Library that does the job.
>> require 'encoding/character/utf-8'
=> true
>> b = "Café"
=> "Caf\303\251"
>> b.length
=> 5
>> b = u"Café"
=> u"Caf\303\251"
>> b.length
=> 4
>> b = +"Café"
=> u"Caf\303\251"
>> b.length
=> 4
>> puts b.upcase
CAFÉ
The library however is not compatible with Ruby 1.9. Another outstanding issue is the sorting of arrays containing Unicode strings.
>> a = %w[ä a b c]
=> ["ä", "a", "b", "c"]
>> a.sort
=> ["a", "b", "c", "ä"]
The result would be okay, if I wanted swedish sorting order, but what if I wanted german sorting order? This needs to be addressed. There are libraries for this in Java, so Ruby shouldn’t stand behind!
predefined character classes in grep 06. Jul 2008
Many regex implementations have “macros” for various character classes. In Perl, for example, \d matches any digit ([0-9]) and \w matches any “word character” ([a-zA-Z0-9_]). Grep uses a slightly different notation for the same thing: [:digit:] for digits and [:alnum:] for alphanumeric characters. (BSD)
Finally, certain named classes of characters are predefined within bracket expressions, as follows. Their names are self explanatory, and they are [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:], [:lower:], [:print:], [:punct:], [:space:], [:upper:], and [:xdigit:]. For example, [[:alnum:]] means [0-9A-Za-z]. (grep man page)
Was unter Ruby
line = "length 1450"
puts line if line =~ /\d{4}/
heißt wird also unter der bash mit grep zu
export line="length 1450"
echo $line | egrep [[:digit:]]{4}
was zwar die regulären Ausdrücke unnötig aufbläht, aber immerhin die gleiche Funktionalität zur Verfügung stellt.