<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Julius' Blog</title>
  <link href="http://blog.plenz.com/atom.xml" rel="self" />
  <link href="http://blog.plenz.com/" />
  <updated>2012-04-30T12:53:51+02:00</updated>
  <id>http://blog.plenz.com</id>
  <author>
    <name>Julius Plenz</name>
    <email>blog@plenz.com</email>
  </author>
  
  <entry>
    <title type="html">Reisebericht Sudan</title>
    <link href="http://blog.plenz.com/2012-04/reisebericht-sudan.html" />
    <updated>2012-04-30T12:44:00+02:00</updated>
    <id>http://blog.plenz.com/2012-04/reisebericht-sudan</id>
    <content type="html">&lt;p&gt;Die letzten beiden Wochen habe ich nichts gebloggt, weil ich an einem
kleinen Projekt geschrieben habe, das nun endlich fertig ist:
&lt;a href=&quot;http://www.plenz.com/sudan/&quot;&gt;Mein Reisebericht &lt;em&gt;Von Kairo nach Khartoum&lt;/em&gt; über die
Sudan-Reise.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Der Bericht ist eine hoffentlich amüsante und interessante
Zusammenstellung von Erlebnissen; ich habe mich bemüht, auch Leuten,
die noch nicht in Afrika gereist sind, zu vermitteln, wie das Leben
dort abläuft.&lt;/p&gt;

&lt;p&gt;Falls ihr's lesen wollt, plant ein bisschen Zeit ein: Es sind über 150
Fotos und ca. 40 DIN A4-Seiten Text.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">I'm back</title>
    <link href="http://blog.plenz.com/2012-04/im-back.html" />
    <updated>2012-04-10T15:51:00+02:00</updated>
    <id>http://blog.plenz.com/2012-04/im-back</id>
    <content type="html">&lt;p&gt;I'm back from Sudan! &amp;ndash; After six weeks of travelling in the desert,
mostly taking cheap sleeping options and uncomfortable local transport it
is a huge relief to have these certain luxury items again: Water from
the tap (which you can drink!), a hot shower, a washing machine and a nice
bed.&lt;/p&gt;

&lt;p&gt;I wrote a travel diary and will use excerpts to write up a travelog
with some photos from the journey. (This will take some days,
naturally.) Already I tried stitching together a panorama image of
&lt;a href=&quot;http://g.co/maps/yxerq&quot;&gt;Marawi&lt;/a&gt;, taken in the first morning light
from the top of &lt;a href=&quot;https://en.wikipedia.org/wiki/Jebel_Barkal&quot;&gt;Jebel
Barkal&lt;/a&gt; near Karima. It's
a very typical pattern which you can see anywhere along the Nile: a
few hundred meters of fields, then the main village, a tarmac road
&amp;ndash; built by the Chinese, mostly &amp;ndash; and then: hundreds of
kilometers of desert.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/panorama-marawi.jpg&quot;&gt;&lt;img src=&quot;/img/panorama-marawi.thumb.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is shivery-cold here in Berlin; already I miss Khartoum's
every-day-above-40°C weather.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Travelling up the Nile</title>
    <link href="http://blog.plenz.com/2012-02/travelling-up-the-nile.html" />
    <updated>2012-02-23T18:35:00+01:00</updated>
    <id>http://blog.plenz.com/2012-02/travelling-up-the-nile</id>
    <content type="html">&lt;p&gt;I'm so excited! Tomorrow afternoon, together with a good friend of
mine I'll board a plane to Cairo, Egypt. There, we'll try to acquire
visas to enter Sudan. Essentially, we will travel up the river Nile
from Cairo via Aswan, Wadi Halfa, and Atbara to Khartoum. If we have
time, we'll also visit Port Sudan. In total, we have six weeks of time
on our hands.&lt;/p&gt;

&lt;p&gt;I hope I'm prepared well:
I've been learning a bit of Arabic at university for the past two
semesters; also, I've been reading the &lt;a href=&quot;http://www.sudantribune.com/&quot;&gt;Sudan
Tribune&lt;/a&gt; the past few months to stay up
to date about the situation there. &amp;ndash; Other than that, it's the
usual stuff you should bring: insect repellent, anti-malaria tablets,
water purifier, sunblocker, a good book and a (paper) notebook. Oh,
and they don't have ATMs in Sudan, so it's all cash. Better hide it
well.
(&lt;em&gt;Correction:&lt;/em&gt; There are no ATMs for international CCs like Master, Visa oder
AmEx. For the local banks, there are quite a few.)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/urlaub.jpg&quot;&gt;&lt;img src=&quot;/img/urlaub.thumb.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I had to cut down on my initial travel plans, which would have led
from Cairo to Dar es Salaam (via Khartoum, Juba, Kampala), crossing
five countries in total. This is not feasible any more, however, due
to the high tension and violence in Southern Sudan (especially in the
Abyei region). &amp;ndash; On the upside, it'll be a rather relaxed
journey now!&lt;/p&gt;

&lt;p&gt;In Khartoum it's 36°C right now... &amp;ndash; See you in April!&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Bookdump</title>
    <link href="http://blog.plenz.com/2012-02/bookdump.html" />
    <updated>2012-02-22T20:41:00+01:00</updated>
    <id>http://blog.plenz.com/2012-02/bookdump</id>
    <content type="html">&lt;p&gt;&lt;img src=&quot;/img/thinking-kahneman.jpg&quot;
alt=&quot;Cover of Kahneman's »Thinking, fast and slow«&quot;
style=&quot;float:right; margin: 0 0 .7em .3em&quot; /&gt;
Ein Buch, das man sich wirklich nicht entgehen lassen sollte, ist
&lt;strong&gt;Thinking, fast and slow&lt;/strong&gt; von Nobelpreisträger &lt;strong&gt;Daniel Kahneman&lt;/strong&gt;.
Es ist sicherlich kein sehr mitreißendes Buch, aber auch nicht allzu
trocken oder komplex. Thema des Buches sind die zwei Akteure &lt;em&gt;System
I&lt;/em&gt; und &lt;em&gt;System II&lt;/em&gt; &amp;ndash; die Intuition, die zwar schnell, dafür aber
ungenau arbeitet und leicht zu täuschen ist, und das, was wir
&quot;angestrengtes Nachdenken&quot; nennen.&lt;/p&gt;

&lt;p&gt;Im Wesentlichen geht es darum, was für Mechnismen gewissen für uns
typischen Denkmustern zugrund liegen, wie wir sie analysieren können,
und was für Fehlinformationen sie uns glaubhaft machen können. Als
wissenschaftliche Grundlage dienen dafür Gedankenexperimente, die
großteils auch an Gruppen von Probanden getestet werden. (Jeweils
gegen monetäre Entschädigung, häufig ist die Höhe der Entschädigung
auch Grundlage des Experiments; wer finanziert sowas eigentlich? Und
warum mache ich nie bei solchen Studien mit, wo man durch Beantworten
einiger weniger Fragen ein paar Dutzend Euro erhalten kann? &amp;ndash;)&lt;/p&gt;

&lt;p&gt;Kahneman erklärt anhand einiger simpler kognitiver Illusionen, denen
wir tagtäglich erliegen und die uns als scheinbar rationale Wesen
objektiv völlig irrationale Handlungen unternehmen lassen, wie wir
diese Illusionen a) erkennen können und teilweise auch b) dagegen
vorgehen können.&lt;/p&gt;

&lt;p&gt;Das Buch hat übrigens einen guten Index, so dass ich auch die äußerst
passende Zusammenfassung aus dem Nachwort wiederfinden konnte:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;The way to block errors that originate in System 1 [intuition] is
simple in principle: recognize the signs that you are in a cognitive
minefield, slow down, and ask for reinforcement from System 2 [careful
thinking, as in: doing the math, considering statistics]. This is how
you will proceed when you next encounder the &lt;a href=&quot;http://en.wikipedia.org/wiki/M%C3%BCller-Lyer_illusion&quot;&gt;Müller-Lyer
illusion&lt;/a&gt;.
When you see lines with fins pointing in different directions, you
will recognize the situation as one in which you should not trust your
impression of length. Unfortunately, this sensible procedure is least
likely to be applied when it is needed most. We would all like to have
a warning bell that rings loudly whenever we are about to make a
serious error, but no such bell is available, and cognitive illusions
are generally more difficult to recognize than perceptual illusions.
(p. 417)&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Im Nachwort räumt Kahneman übrigens mal eben so mit der &lt;a href=&quot;https://en.wikipedia.org/wiki/Chicago_school_of_economics&quot;&gt;Chicago
School&lt;/a&gt;
auf, die ja wesentlich auf der Illusion eines &quot;rationalen Menschen&quot;
aufbaut: &lt;q lang=&quot;en&quot;&gt;The economists of the Chicago school do not face
that problem [whether to protect people from themselves], because
rational agents do not make mistakes. For adherents of this school,
freedom is free of charge.&lt;/q&gt; (p. 412) &amp;ndash; &amp;ndash;&lt;/p&gt;

&lt;p&gt;Etwas leichtere Kost war &lt;strong&gt;Philip Roths&lt;/strong&gt; &lt;strong&gt;Nemesis&lt;/strong&gt;. Im Sommer 1944
geht es ums Überleben: Für die einen, weil sie in den Krieg ziehen
müssen, für die anderen, weil sie zu jung sind, und sich zu Hause mit
einer Polioepidemie konfrontiert sehen. Auch wenn der Protagonist
diesmal nicht krebskrank in der Midlife-Crisis steckt, gelingt es Roth
doch leider nicht, mal einen Roman zu schreiben, in dem es nicht um
Tod, Verfall und Bedauern über das eigene Leben geht. Nichts also,
womit ich mich identifizieren kann. &amp;ndash; Viel eher kam ich dagegen
mit &lt;strong&gt;Charles Bukowskis&lt;/strong&gt; autobiographischem Character &lt;em&gt;Chinaski&lt;/em&gt; in
&lt;strong&gt;Das Liebesleben der Hyäne&lt;/strong&gt; zurecht: Ein herrliches Buch, das ich an
einem Abend gelesen habe. Hoffentlich bin ich mit 50 auch noch so gut
drauf!&lt;/p&gt;

&lt;p&gt;Mal wieder zwei nicht zu Ende gelesene Bücher, die mich nicht vom
Hocker gehauen haben: &lt;strong&gt;Thomas Pakenham: Der kauernde Löwe&lt;/strong&gt;, eine
monumentale, aber doch etwas schwerfällige Biographie der Eroberung
und Kolonialisierung der Mitte des afrikanischen Kontinents (also im
Wesentlichen auch die Suche nach der Quelle des Nil) &amp;ndash; &lt;strong&gt;Anne
Michaels: Wintergewölbe&lt;/strong&gt;, ein Roman über den Ab- und Wiederaufbau des
&lt;a href=&quot;http://en.wikipedia.org/wiki/Abu_Simbel_temples&quot;&gt;Abu-Simbel-Tempels&lt;/a&gt;.
Die Abschnitte über die forcierte Umsiedlung der Nubier (und das
Pendant in Kanada) ist spannend und ergreifend, aber alles
pseudo-bedeutungsschwere dazwischen langweilt nach den ersten drei
Seiten, leider.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">&quot;Shouting in the Dark&quot;</title>
    <link href="http://blog.plenz.com/2012-02/shouting-in-the-dark.html" />
    <updated>2012-02-21T15:56:00+01:00</updated>
    <id>http://blog.plenz.com/2012-02/shouting-in-the-dark</id>
    <content type="html">&lt;p&gt;Al Jazeera's documentary about the Bahrain protests, &lt;em&gt;Shouting in the Dark&lt;/em&gt;,
&lt;a href=&quot;http://www.aljazeera.com/news/middleeast/2012/02/201222184931745785.html&quot;&gt;has received a prestigeous award&lt;/a&gt;.
The documentary is really worth watching.&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube-nocookie.com/embed/xaTKDMYOBOU&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/iframe&gt;


&lt;p&gt;I found the insidious practices of the Bahraini prince &amp;ndash; and the Arab
league's suport &amp;ndash; extremely unnerving.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Bundespräsident</title>
    <link href="http://blog.plenz.com/2012-02/bundespr%C3%A4sident.html" />
    <updated>2012-02-19T23:33:00+01:00</updated>
    <id>http://blog.plenz.com/2012-02/bundespräsident</id>
    <content type="html">&lt;p&gt;Ich vermeide es größtenteils, über Politik zu schreiben. Das liegt
im wesentlichen daran, dass es einfach sehr viele Leute gibt,
deren Tagesgeschäft das ist und die folglich darin um einige
Größenordnungen besser sind als ich. Außerdem ist es so, dass mich die
Beschäftigung mit Politik fast ausnahmslos wütend macht: Täglicher
Politik-Nachrichten-Konsum ist bestens dazu geeignet, den Glauben an
Fortschritt in unserer Gesellschaft zunichte zu machen.&lt;/p&gt;

&lt;p&gt;Aktueller Anlass ist natürlich &lt;a href=&quot;http://tagesschau.de/inland/kandidatensuchebundespraesident106.html&quot;&gt;die Einigung vierer von fünf im
Bundestag vertretenen Parteien auf Gauck als neuen
Bundespräsidenten&lt;/a&gt;.
Man &lt;em&gt;bemüht&lt;/em&gt; sich dort noch nicht einmal, diesem Gauck irgendwelche
Qualitäten, die ihn als Bundespräsidenten auszeichnen würden,
zuzusprechen: &lt;q&gt;Merkel sagte, mit Gauck verbinde sie vor allem die
gemeinsame Vergangenheit in der DDR. Für Gauck habe sich der Weg von
der Kirche in die Politik von fast alleine ergeben. Ihn zeichne aus,
ein &quot;wahrer Demokratielehrer&quot; geworden zu sein.&lt;/q&gt; &amp;ndash; Ja,
Demokratielehrer schön und gut. Aber Aufgabe des Bundespräsidenten
sollte es ja nicht sein, Demokratie zu lehren. Seine Aufgabe sollte es
vor allem auch sein, den Fokus auf Probleme im Land und im politischen
Diskurs zu lenken. Das kann man von Gauck wohl eher weniger erwarten.&lt;/p&gt;

&lt;p&gt;Im wesentlichen scheint ein schlagendes Argument zu sein, dass sich
viele Deutschen Gauck als Präsidenten wünschen. Das klingt auch
vernünftig, bis man &lt;a href=&quot;http://www.nachdenkseiten.de/?p=11012&quot;&gt;die Hintergründe
recherchiert&lt;/a&gt;. Kaliber
&quot;Guttenberg ist so nett&quot;, sag ich nur.&lt;/p&gt;

&lt;p&gt;Ein &lt;em&gt;Pastor&lt;/em&gt; soll Präsident in Deutschland werden. &amp;ndash; Pastoren:
Das sind diejenigen, die professionell, das heißt um ihr täglich Brot
zu verdienen, Tag für Tag, Woche für Woche Unwahrheiten predigen. Das
sind diejenigen Menschen, die die evangelische Kirche repräsentieren
&amp;ndash; und somit im Grunde ihres Wesens &lt;em&gt;gegen&lt;/em&gt; Fortschritt und
Selbstverantwortlichkeit sind. (Man darf sich wohlgemerkt nicht von
der Tatsache blenden lassen, dass auch Gutes aus diesen Kreisen
kommt!) &amp;ndash; &amp;ndash; Wenn wir eines in diesem Land &lt;em&gt;nicht&lt;/em&gt; gebrauchen
können, dann einen zahnlosen,
&lt;a href=&quot;http://www.rhein-zeitung.de/startseite_artikel,-Wulff-Nachfolge-Stimmung-gegen-Gauck-im-Netz-_arid,382775.html&quot;&gt;anti-sozialen&lt;/a&gt;,
&lt;em&gt;christlichen&lt;/em&gt; Bundespräsidenten.&lt;/p&gt;

&lt;p&gt;Auch wenn man Fefes Ratschläge vielleicht nicht immer erst nehmen
sollte: Die &lt;a href=&quot;https://blog.fefe.de/?ts=b1c0b489&quot;&gt;Nominierung Georg Schramms&lt;/a&gt;
wäre in der Tat &lt;a href=&quot;https://blog.fefe.de/?ts=b1c0b489&quot;&gt;ein Geniestreich&lt;/a&gt;
der Piraten &amp;ndash; &lt;a href=&quot;https://blog.fefe.de/?ts=b1bf98cf&quot;&gt;gewesen&lt;/a&gt;. Ich
habe heute zwei Stunden lang alte TV-Mitschnitte von Schramm geschaut
&amp;ndash; die nota bene alle in öffentlich-rechtlichen Kanälen liefen,
das hat mich doch positiv überrascht! &amp;ndash; und da ist wirklich mal
ein Mann, der mit der Faust auf den Tisch haut, &lt;a href=&quot;http://youtu.be/urvK7_OCpjQ&quot;&gt;ein Loblied auf den
Zorn singt&lt;/a&gt; und &lt;em&gt;wirklicht&lt;/em&gt; etwas zu
sagen hat.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Sag ich doch, andere können das besser. So zum Beispiel Deniz Yücel
in &lt;a href=&quot;https://taz.de/Kommentar-Gauck/!88277/&quot;&gt;seinem Replik&lt;/a&gt; auf die Kritik
Lobos, der dessen &lt;a href=&quot;https://www.taz.de/Kolumne-Besser/!88071/&quot;&gt;Kolumne&lt;/a&gt; kritisierte:
&lt;q&gt;Der Holocaust, meint er [Gauck], ist eine Ersatzreligion der Gottlosen. Damit stellt
er sich in die Tradition von Leuten, die ein Leben und Denken ohne Gott für
unvorstellbar halten und den Nationalsozialismus gerne für ein Produkt der
Gottlosigkeit halten, anstatt darin auch das in Ideologie wie Praxis
modernisierte und radikalisierte Ergebnis des christlichen Antijudaismus zu
erkennen.&lt;/q&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">C Programming Exam Fail</title>
    <link href="http://blog.plenz.com/2012-02/c-programming-exam-fail.html" />
    <updated>2012-02-17T15:26:00+01:00</updated>
    <id>http://blog.plenz.com/2012-02/c-programming-exam-fail</id>
    <content type="html">&lt;p&gt;I just wrote an exam for the course &lt;em&gt;Technische Informatik III&lt;/em&gt; which was about
operating systems and network communication. In the exercises throughout the
semster, we &lt;a href=&quot;http://git.plenz.com/ti3/&quot;&gt;had to program in C a lot&lt;/a&gt;. Naturally,
in the exam was one task about interpreting what a C program does.&lt;/p&gt;

&lt;p&gt;It was really simple: Listening on a UDP socket and print incoming packets
along with source address and port. The program looked somewhat like this (from
what I remember; also some things were done in a not so clever way on the exercise
sheet, and they had obfuscated the variable names to a non-descriptive
&lt;code&gt;a&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt;, etc.):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;sys/types.h&amp;gt;
#include &amp;lt;sys/socket.h&amp;gt;
#include &amp;lt;netinet/in.h&amp;gt;
#include &amp;lt;arpa/inet.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;error.h&amp;gt;

int main(int argc, char *argv[])
{
    int sockfd;
    struct sockaddr_in listen, incoming;
    socklen_t incoming_len;

    char buf[1024];
    int len; /* of received data */

    /* listen on 0.0.0.0:5000 */
    listen.sin_family = AF_INET;
    listen.sin_addr.s_addr = INADDR_ANY;
    listen.sin_port = htons(5000);

    if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
        perror(&quot;socket&quot;);

    if(bind(sockfd, (struct sockaddr *) &amp;amp;listen, sizeof(listen)) == -1)
        perror(&quot;bind&quot;);

    while(1) {
        len = recvfrom(sockfd, buf, 1024, 0, (struct sockaddr *) &amp;amp;incoming,
                        &amp;amp;incoming_len);
        buf[len] = '\0';
        printf(&quot;from %s:%d: \&quot;%s\&quot;\n&quot;, inet_ntoa(incoming.sin_addr),
                ntohs(incoming.sin_port), buf);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I lol'd so hard when I saw this. It's a classic off-by-one error. (Can
you spot it, too?)&lt;/p&gt;

&lt;p&gt;If you want to store &lt;em&gt;x&lt;/em&gt; bytes of data in a string, reserve &lt;em&gt;x+1&lt;/em&gt;
bytes for the NULL termination character. Here, if you send a message
that is exactly 1024 bytes long (or longer, as it'll get truncated),
&lt;code&gt;buf[len]&lt;/code&gt; will actually be the 1025&lt;sup&gt;th&lt;/sup&gt; byte. Which might
just be anything.&lt;/p&gt;

&lt;p&gt;And those guys want to teach network and filesystem programming
&amp;ndash; hilarious. :-D&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Momente im Winter</title>
    <link href="http://blog.plenz.com/2012-02/momente-im-winter.html" />
    <updated>2012-02-13T09:26:00+01:00</updated>
    <id>http://blog.plenz.com/2012-02/momente-im-winter</id>
    <content type="html">&lt;p&gt;In manchen Momenten hasse ich das Leben hier: Habe gerade eben den Zug
in Dresden verpasst, und der nächste fährt erst in zwei Stunden. Der
Gutschein der Deutschen Bahn, den ich vor ein paar Wochen per Post
bekam und den ich nun einzulösen gedachte, ist nur für Fahrkarten
gültig, deren Wert fünfzig Euro übersteigt (wohlgemerkt &lt;em&gt;nach&lt;/em&gt; 50%
BC-Rabatt) &amp;ndash; hat man ja auch eher seltener, wenn's keine ganz
große Reise ist.&lt;/p&gt;

&lt;p&gt;Und so sitze ich am Hauptbahnhof bei frostigen Graden. Na immerhin
macht es sich bezahlt, dass ich UMTS eingerichtet habe &amp;ndash; das
funktioniert nämlich.&lt;/p&gt;

&lt;p&gt;Wäre doch bloß Sommer, dann wär's sicher ganz angenehm hier.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">minimizing Linux filesystem cache effects</title>
    <link href="http://blog.plenz.com/2012-02/minimizing-linux-filesystem-cache-effects.html" />
    <updated>2012-02-09T23:43:00+01:00</updated>
    <id>http://blog.plenz.com/2012-02/minimizing-linux-filesystem-cache-effects</id>
    <content type="html">&lt;p&gt;Last weekend I toyed around a bit and tried to write a &lt;a href=&quot;https://github.com/Feh/nocache&quot;&gt;shared object
library that can be used via &lt;code&gt;LD_PRELOAD&lt;/code&gt; to minimize the effect a
program has on the Linux filesystem
cache&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Basically the use case is that you have a productive system running,
and you don't want your backup script to fill the filesystem cache
with mostly useless information at night (files that were cached
should stay cached). I didn't test whether this
brings measurable improvements yet.&lt;/p&gt;

&lt;p&gt;The coding was really fun and provided me with yet another insight how
the simple concept of file descriptors in UNIX is just great. (GNU
software is tough, though: I got stuck once, and &lt;a href=&quot;http://stackoverflow.com/questions/9161116/intercepting-the-openat-system-call-for-gnu-tar&quot;&gt;found help on
Stackoverflow&lt;/a&gt;,
which I had never used before.)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Fragen</title>
    <link href="http://blog.plenz.com/2012-02/fragen.html" />
    <updated>2012-02-02T22:42:00+01:00</updated>
    <id>http://blog.plenz.com/2012-02/fragen</id>
    <content type="html">&lt;p&gt;Gute Vortragende &amp;ndash; seien es Dozenten, Professoren oder einfach
nur Leute, die etwas referieren oder präsentieren &amp;ndash; zeichnen
sich unter anderem dadurch aus, dass sie mit den Zuhörern
interagieren, an den richtigen Stellen Pausen machen und
weiterführende Fragen stellen, statt monoton zu reden. Man kann dieses
&quot;Fragen stellen&quot; aber in zweierlei Hinsicht falsch bzw.
kontraproduktiv einsetzen.&lt;/p&gt;

&lt;p&gt;Zunächst sind Suggestivfragen nur teilweise angebracht. Fragen wie
&quot;Fällt Ihnen hieran etwas auf?&quot;, die bewirken sollen, dass das
Publikum die Situation kritisch unter die Lupe nimmt und eventuelle
Ungereimtheiten aufspürt, sind gut. Aber rhetorisch anmutende Fragen
wie &quot;Alles verstanden?&quot;, bei denen spürbar wird, dass ein &lt;em&gt;Ja&lt;/em&gt; erwartet
wird, sind meist nicht produktiv: Die wenigsten werden sich melden,
falls sie etwas nicht verstanden haben, und der Vortragende wiegt sich
in falscher Sicherheit. Eine gute Alternative ist: &quot;Gibt es Fragen bis
hierher?&quot;, und eine anschließende kleine Besinnungspause.&lt;/p&gt;

&lt;p&gt;In meinen Augen wirklich desaströs ist eine zu lose, offene, aber
zugleich extrem erwartungsvolle Fragetaktik. &quot;Wie können wir X
erreichen?&quot;, ohne dass das Auditorium auch nur ansatzweise weiß, wie
das Problem angegangen werden kann. Dann macht sich Verwirrung breit,
und spätere Fragen, die möglicherweise sehr einfach zu beantworten
sind, werden möglicherweise gar nicht oder zumindest nur sehr zögerlich
beantwortet, weil das Publikum meint, die Fragestellung missverstanden
zu haben, genau &lt;em&gt;weil&lt;/em&gt; die Lösung auf der Hand liegt. &amp;ndash; Das
lähmt die Interaktion nachhaltig.&lt;/p&gt;

&lt;p&gt;Zwei solcher Fragen, die eine kaum zu beantworten, die nachfolgende
trivial, seien hier als Beispiel angeführt:&lt;/p&gt;

&lt;p&gt;&amp;ndash; Was haben wir nun für ein Problem bei der kanonischen Wahl der
Basis des Tangentialraumes? (Gesuchte Antwort: Weil &lt;em&gt;M&lt;/em&gt; nicht in einem
umgebenden Raum betrachtet werden kann, muss T&lt;sub&gt;p&lt;/sub&gt;M mit Hilfe
von Äquivalenzklassen der Differentiale von Kurven, die in &lt;em&gt;M&lt;/em&gt; durch
&lt;em&gt;p&lt;/em&gt; verlaufen, untersucht werden.)&lt;/p&gt;

&lt;p&gt;&amp;ndash; Welche Struktur hat T&lt;sub&gt;p&lt;/sub&gt;M dann? (Gesuchte Antwort:
Vektorraumstruktur.)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Pizzabäcker</title>
    <link href="http://blog.plenz.com/2012-02/pizzab%C3%A4cker.html" />
    <updated>2012-02-01T00:31:00+01:00</updated>
    <id>http://blog.plenz.com/2012-02/pizzabäcker</id>
    <content type="html">&lt;p&gt;In letzter Zeit mache ich mehrmals pro Woche selbst Pizza. Das
schmeckt nicht nur besser und ist viel billiger als Fertigpizza, es
macht auch einfach Spaß und hat etwas meditatives.&lt;/p&gt;

&lt;p&gt;Ich mache einmal die Woche Teig aus einem Würfel Hefe, ca. 700g Mehl
und 0.35L Wasser &amp;ndash; der reicht für drei große Pizzen. (Den Teig
eine Stunde gehen lassen, ab dann aber im Kühlschrank abgedeckt
aufbewahren!)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/pizza0.jpg&quot;&gt;&lt;img src=&quot;/img/pizza0.thumb.jpg&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;/img/pizza1.jpg&quot;&gt;&lt;img src=&quot;/img/pizza1.thumb.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/pizza2.jpg&quot;&gt;&lt;img src=&quot;/img/pizza2.thumb.jpg&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;/img/pizza3.jpg&quot;&gt;&lt;img src=&quot;/img/pizza3.thumb.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/pizza4.jpg&quot;&gt;&lt;img src=&quot;/img/pizza4.thumb.jpg&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;/img/pizza5.jpg&quot;&gt;&lt;img src=&quot;/img/pizza5.thumb.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/pizza6.jpg&quot;&gt;&lt;img src=&quot;/img/pizza6.thumb.jpg&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;/img/pizza7.jpg&quot;&gt;&lt;img src=&quot;/img/pizza7.thumb.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/pizza8.jpg&quot;&gt;&lt;img src=&quot;/img/pizza8.thumb.jpg&quot; /&gt;&lt;/a&gt;
&lt;a href=&quot;/img/pizza9.jpg&quot;&gt;&lt;img src=&quot;/img/pizza9.thumb.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lecker!&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Krebsgeschwüre dieser Welt</title>
    <link href="http://blog.plenz.com/2012-01/krebsgeschw%C3%BCre-dieser-welt.html" />
    <updated>2012-01-30T19:47:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/krebsgeschwüre-dieser-welt</id>
    <content type="html">&lt;p&gt;Ich habe eben versucht, meinen altes Notebook auf Ebay einzustellen.
Schließlich und endlich &lt;a href=&quot;http://www.ebay.de/itm/Gebrauchtes-IBM-Thinkpad-X41-12-1-Docking-Station-zwei-Netzteilen-/110817677671&quot;&gt;hat es dann auch
geklappt&lt;/a&gt;.
Nicht, dass das einfach war: Anscheinend kann man den Ebay Richt Text
Editor nicht mit Firefox benutzen. Zumindest ich kann das nicht.
Deswegen konnte ich keine Artikelbeschreibung einstellen.
Mangels Alternativen habe ich dann Windows XP in einer KVM gebootet,
und das Angebot mit dem Internet Explorer erstellt. Der funktioniert
aber auch nur teilweise: Das Tutorial über die neue Art und Weise, wie
eBay Geld überträgt, musste ich durch&quot;klicken&quot;, indem ich oben in der
URL die &lt;code&gt;pageNr&lt;/code&gt;-Parameter hochgezählt habe. Die &quot;Weiter&quot;-Buttons
waren leider nicht sichtbar, außer auf der letzten Seite.&lt;/p&gt;

&lt;p&gt;Ich habe lange nicht mehr eine so inkompetent aufgebaute und
unübersichtliche Seite wie eBay benutzt. Ein pures Wunder, wie das
Leute tagtäglich benutzen können.&lt;/p&gt;

&lt;p&gt;Merken die Leute nicht, dass es benutzbare und unbenutzbare Webseiten
gibt? Gibt eBay kein Geld für Usability-Tester aus?! &amp;ndash;
Unbegreiflich für mich.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">shredding</title>
    <link href="http://blog.plenz.com/2012-01/shredding.html" />
    <updated>2012-01-30T14:09:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/shredding</id>
    <content type="html">&lt;p&gt;I'm currently &lt;a href=&quot;http://man.cx/shred&quot;&gt;shred&lt;/a&gt;ding my old X41's hard drive, because
I want to sell it (if you are interested, contact me). I'm overwriting it with
zeros, ten passes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ shred -vfz -n 10 /dev/sda
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Luckily, the disk was fully encrypted all the time. So it's just a precaution.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/x41-shred.jpg&quot;&gt;&lt;img src=&quot;/img/x41-shred.thumb.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Ten Years of Vim</title>
    <link href="http://blog.plenz.com/2012-01/ten-years-of-vim.html" />
    <updated>2012-01-30T02:17:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/ten-years-of-vim</id>
    <content type="html">&lt;p&gt;About ten years ago, I began using &lt;a href=&quot;http://www.vim.org/&quot;&gt;Vim&lt;/a&gt;. Since
about eight years ago, I have been using Vim for every email, every
piece of code, literally &lt;em&gt;every&lt;/em&gt; text I write. Today,
I want to write a short text about how I came to use Vim and what I
like about it.&lt;/p&gt;

&lt;p&gt;I don't really remember when I first used Vim. It must have been
around the time when I was programming PHP a lot. I had access
to a &quot;real&quot; computer at home &amp;ndash; running Windows XP &amp;ndash; in
2002 for the first time; before that, I could only use older
Macintoshs. It's typical for first-time Vi users to stumble into
believing &amp;ndash; by hear-say, I guess &amp;ndash; that it is indeed a
&lt;em&gt;really&lt;/em&gt; superior editor, until &lt;em&gt;they try it out the first time and
can't even save&lt;/em&gt;, because they don't know how to. That were my
first experiences too, probably.&lt;/p&gt;

&lt;p&gt;Anyhow, at some point in time I ditched &lt;a href=&quot;http://www.zend.com/products/studio/&quot;&gt;PHP Zend
Studio&lt;/a&gt; for
&lt;a href=&quot;http://www.scintilla.org/SciTE.html&quot;&gt;SciTE&lt;/a&gt;. Later, I got to know Vim
(i.e., by reading a tutorial about it and actually understanding it)
and was instantly hooked. Probably, the guys over at
&lt;a href=&quot;http://www.html-q.net/&quot;&gt;#html.de&lt;/a&gt; talked me into it. Ironically, I
used Vim before I ever used a UNIX-like operating system.&lt;/p&gt;

&lt;p&gt;In my Vim learning curve, I identify seven important advances:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;em&gt;Understanding the Modes Concept.&lt;/em&gt; &amp;ndash; This, of course, is
something everybody needs to grok. It's fairly straight-forward,
once you think about it.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Understand the Visual Mode and Yank/Paste.&lt;/em&gt; &amp;ndash; Line-wise
selection already gives you more power than a regular editor when
moving code.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Understand Mappings and Macros.&lt;/em&gt; &amp;ndash; Even today I am amazed
how few people automate things. If it's one line, do it manually.
If it's three lines, carefully think about the task &lt;em&gt;while
recording a macro for it&lt;/em&gt;!&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Unterstanding Windows.&lt;/em&gt; &amp;ndash; Multiple files and stuff.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Consequently using [h], [j], [k], [l].&lt;/em&gt; &amp;ndash; This actually was
a much bigger step that you might think. I went to great lengths to
achive this: &lt;a href=&quot;http://git.plenz.com/configs/tree/.vimrc?id=8609adce1234194c5481e4e196684374bc80cbea#n127&quot;&gt;I configured the arrow mapping to &lt;code&gt;:echoerr&lt;/code&gt; a
message.&lt;/a&gt;
Today, I configure all programs to use Vim key bindings, especially
for horizontal and vertical navigation. It's the first thing to do.
I only use the arrow keys for Mplayer seeking.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Using Text Objects.&lt;/em&gt; &amp;ndash; See &lt;code&gt;:help text-objects&lt;/code&gt;, if you
don't know about them.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Switching to a US keyboard layout.&lt;/em&gt; &amp;ndash; Once you do this, all
the Vim commands begin to make sense. (I used a German layout
before.)&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Steps 1&amp;ndash;5 happened in the first two years. The text object only
came with more recent Vim development, and I'm not quite sure when I
adopted them. Learning the US layout was around 2006, maybe.&lt;/p&gt;

&lt;p&gt;When I switched to using Debian in 2004, using Vim for all tasks
already felt natural. Of course, at that point I finally came to
understand Vim not merely as a text editor, but as a &lt;em&gt;philosophy&lt;/em&gt;.
And that is what fascinates me to this day: The Vi way of editing text
is much more than a set of clever key bindings. It's a
&lt;a href=&quot;http://stevelosh.com/blog/2010/09/coming-home-to-vim/#a-language-of-text-editing&quot;&gt;language&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/vi-ned.jpg&quot; style=&quot;float:right;margin:0 0 .2em .5em&quot;
title=&quot;Oh, Ned! You are a Vi man after all!&quot; alt=&quot;Vi-vs.-Emacs fight&quot; /&gt;
In a way, I'm really professional at using Vim. If I think of the
tasks I do, I suspect there are very few superfluous keys I press
during editing. I have acquired a really good intuition of how to skip
to a particular line, to a particular function parameter or a certain
word in a sentence. (I use [H], [M], [L] for global on-screen
navigation a lot, and I heavily use the [f], [t], [F] and [T] jump
commands.) Just as you don't actually think about the letters you type
when you become a good typist, I don't think about what command keys I
press in Normal mode. I just press them, and the cursor magically
moves around to where my eyes rest. This is good.&lt;/p&gt;

&lt;p&gt;On the other hand, I am just using core Vim features, most of which
are already found in original Vi implementations. My really
&lt;a href=&quot;https://github.com/Feh/configs/commits/master/.vimrc&quot;&gt;conservative .vimrc change history&lt;/a&gt;
shows that I pretty much settled my editing habits. &amp;ndash; But: &lt;em&gt;I have
never used a third-party plugin before.&lt;/em&gt; Strange as it may sound, I
never felt the urge to do so.
&lt;a href=&quot;https://wincent.com/products/command-t&quot;&gt;Command-T&lt;/a&gt; certainly looks
like it could be of use; however, I usually start a new Vim instance
and go with the Z Shell completion, which I suspect to be superior in
more than one way, to find the file(s). &amp;ndash; Thus I must acknowledge
that there might be vast possibilities yet do discover. (Oh, and while
confessing, there's another big one: I have never used
Emacs. All I know about it is hear-say.)&lt;/p&gt;

&lt;p&gt;For keyboard enthusiasts, there are two quirks with Vim: It mainly
relies on Escape for mode switches, and the keys for many
combinations are aligned for QWERTY layouts. There's just no way
around it: while [c] and [d] are mnemonic for &lt;em&gt;cut&lt;/em&gt; and &lt;em&gt;delete&lt;/em&gt;, [h],
[j], [k], [l] simply aren't. There's no way justify their use when
switching to Dvorak, and that's why I didn't (switch). I also once
tried mapping [j][j] to Escape, or using the Caps Lock key as Escape
replacement; I can't really stick to using it. (I also stick to
calling &lt;code&gt;vim&lt;/code&gt; on the command line instead of a shorter alias. It is
the fourth most command I type, after &lt;code&gt;sudo&lt;/code&gt;, &lt;code&gt;git&lt;/code&gt;, and &lt;code&gt;man&lt;/code&gt;.)&lt;/p&gt;

&lt;p&gt;For me, text editing is equal to using Vim. I feel like a four-year
old moving a mouse when I'm forced to use another editor on other
people's computers. And because text editing is really clumsy with
regular text editors, I no longer wonder why people don't really
bother to correct errors: the effort is just not worth it.&lt;/p&gt;

&lt;p&gt;If I had to sum up the difference between Vim and other editors in one
sentence, it is this: &lt;em&gt;While other editors are great for creating
text, Vim is also great at &lt;strong&gt;manipulating&lt;/strong&gt; text&lt;/em&gt;. And text
manipulation, for most programmers and authors, is what it's all about.&lt;/p&gt;

&lt;p&gt;:wq&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Kamikazes</title>
    <link href="http://blog.plenz.com/2012-01/kamikazes.html" />
    <updated>2012-01-30T00:03:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/kamikazes</id>
    <content type="html">&lt;p&gt;Gerade mal zweistellige View-Zahlen? Das wundert mich. &amp;ndash; Ich embedde das
mal direkt, vielleicht hilft das...&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/yMiQsmnMKBU&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;




&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/IrAi7UUpfps&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;




&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/xOzgFjLleVk&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;

</content>
  </entry>
  
  <entry>
    <title type="html">Rapzeugs</title>
    <link href="http://blog.plenz.com/2012-01/rapzeugs.html" />
    <updated>2012-01-22T17:56:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/rapzeugs</id>
    <content type="html">&lt;p&gt;Was so liegen geblieben ist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Marsimotos Release war ja noch viel krasser gehypet als &lt;em&gt;23&lt;/em&gt; von
Sido und Bushido. Leider ist auf der Platte im wesentlichen das
durchgekommen, was ich nicht mag. Hat mich also nicht vom Hocker
gehauen, wobei &lt;a href=&quot;http://vimeo.com/34148292&quot;&gt;der Film&lt;/a&gt; teilweise
ziemlich cool war. &quot;I got five&quot; ist die erwähnenswerte Ausnahme.&lt;/li&gt;
&lt;li&gt;Letzte Woche habe ich &lt;a href=&quot;http://blutzbruedaz-film.de/&quot;&gt;Blutzbrüdaz&lt;/a&gt;
gesehen. Lohnt sich auf jeden Fall, und ist irgendwie ein lustiger
Mix aus Realität und Fantasie.&lt;/li&gt;
&lt;li&gt;Was momentan aus Wuppertal kommt ist wirklich der Hammer. Prezident
hat mal eben so sein komplettes Album &lt;em&gt;Querschläger&lt;/em&gt; &lt;a href=&quot;http://www.whiskeyrap.de/&quot;&gt;online
gestellt&lt;/a&gt;. Und auch Mythos und Antagonist
aka. Kamikazes haben &lt;a href=&quot;http://meinrap.de/2011/11/20/exklusiv-kamikazes-koenigsmische-download/&quot;&gt;ein Mixtape online
gestellt&lt;/a&gt;,
das Albumpotential hat. Verdammt gut.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Bei mir läuft die Königsmische auf Repeat.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">vlock and suspend to ram</title>
    <link href="http://blog.plenz.com/2012-01/vlock-and-suspend-to-ram.html" />
    <updated>2012-01-20T19:43:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/vlock-and-suspend-to-ram</id>
    <content type="html">&lt;p&gt;I've had weird race conditions when using &lt;code&gt;vlock&lt;/code&gt; together with &lt;code&gt;s2ram&lt;/code&gt;. It
appears suspend to ram &lt;a href=&quot;http://lxr.free-electrons.com/source/kernel/power/console.c&quot;&gt;wants to switch
VTs&lt;/a&gt;, while
&lt;code&gt;vlock&lt;/code&gt; hooks into the switch requests and explicitly disables them. So some of
the time, the machine would not suspend, while at other times, &lt;code&gt;vlock&lt;/code&gt; wouldn't
be able to acquire the VT.&lt;/p&gt;

&lt;p&gt;To solve this, I wrote a simple &lt;code&gt;vlock&lt;/code&gt; plugin, which simply clears the lock
mechanism, writes &lt;code&gt;mem&lt;/code&gt; to &lt;code&gt;/sys/power/state&lt;/code&gt; and later reinstates the locking
mechanism. This plugin is called after &lt;code&gt;all&lt;/code&gt; and &lt;code&gt;new&lt;/code&gt;. Thus, the screen will
be locked properly before suspending.&lt;/p&gt;

&lt;p&gt;Here's my &lt;code&gt;suspend.c&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;unistd.h&amp;gt;
#include &amp;lt;errno.h&amp;gt;
#include &amp;lt;sys/types.h&amp;gt;
#include &amp;lt;sys/stat.h&amp;gt;
#include &amp;lt;fcntl.h&amp;gt;

/* Include this header file to make sure the types of the dependencies
 * and hooks are correct. */
#include &quot;vlock_plugin.h&quot;
#include &quot;../src/console_switch.h&quot;

const char *succeeds[] = { &quot;all&quot;, &quot;new&quot;, NULL };
const char *depends[] =  { &quot;all&quot;, &quot;new&quot;, NULL };

bool vlock_start(void __attribute__ ((__unused__)) **ctx_ptr)
{
    int fd;

    unlock_console_switch();

    if((fd = open(&quot;/sys/power/state&quot;, O_WRONLY)) != -1) {
        if(write(fd, &quot;mem&quot;, 3) == -1)
            perror(&quot;suspend: write&quot;);
        close(fd);
    }

    lock_console_switch();

    return true;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Simply paste it to the &lt;code&gt;vlock&lt;/code&gt; modules folder, &lt;code&gt;make suspend.so&lt;/code&gt; and copy it to
&lt;code&gt;/usr/lib/vlock/modules&lt;/code&gt;. I now invoke it like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;env VLOCK_PLUGINS=&quot;all new suspend&quot; vlock
&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Xorg, really?!</title>
    <link href="http://blog.plenz.com/2012-01/xorg-really.html" />
    <updated>2012-01-20T13:27:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/xorg-really</id>
    <content type="html">&lt;p&gt;Are you fucking kidding me? &lt;a href=&quot;http://gu1.aeroxteam.fr/2012/01/19/bypass-screensaver-locker-program-xorg-111-and-up/&quot;&gt;You reintroduce broken behaviour that possibly
has devastating security consequences and and make it &lt;strong&gt;the
default&lt;/strong&gt;?!&lt;/a&gt;
Yeah I agree the &quot;usual&quot; X server locking approach is not the best way to do it
&amp;ndash; but to knowingly smash the security of people's computers on a grand
scale... that's priceless.&lt;/p&gt;

&lt;p&gt;(My locking solution is &lt;code&gt;env USER=feh vlock -a -n&lt;/code&gt;, again.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; &lt;a href=&quot;http://who-t.blogspot.com/2012/01/xkb-breaking-grabs-cve-2012-0064.html&quot;&gt;Why it happened&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">zsh: complete words from tmux pane</title>
    <link href="http://blog.plenz.com/2012-01/zsh-complete-words-from-tmux-pane.html" />
    <updated>2012-01-19T20:53:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/zsh-complete-words-from-tmux-pane</id>
    <content type="html">&lt;p&gt;Today I wrote a rather cool Z-Shell completion function: It will
present all words that are found in the current tmux pane in a zsh
completion menu. That means you can actually complete words from the
&lt;em&gt;output&lt;/em&gt; of commands that you just executed. (In a way it's a little
bit like the &lt;a href=&quot;http://www.opensource.apple.com/source/zsh/zsh-53/zsh/Functions/Zle/keeper&quot;&gt;keeper
function&lt;/a&gt;,
without the overhead of remembering to call &lt;code&gt;keeper&lt;/code&gt; in the first place.)&lt;/p&gt;

&lt;p&gt;The code below defines two keybindings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ctrl-X t&lt;/strong&gt; to do a &lt;em&gt;prefix&lt;/em&gt; completion: only words from the pane
that share the same prefix will be presented&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ctrl-X Ctrl-X&lt;/strong&gt; to do a &quot;find stuff like crazy&quot; completion. If you
see the output and just enter something from the middle of the word,
it'll just as well complete. For example, if you see &lt;code&gt;176.9.247.89&lt;/code&gt;
somewhere in the pane, try typing &lt;code&gt;.9&lt;/code&gt; and hitting Ctrl-X twice.
It'll complete to that IP address.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Here's the code:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;_tmux_pane_words() {
  local expl
  local -a w
  if [[ -z &quot;$TMUX_PANE&quot; ]]; then
    _message &quot;not running inside tmux!&quot;
    return 1
  fi
  w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} )
  _wanted values expl 'words from current tmux pane' compadd -a w
}

zle -C tmux-pane-words-prefix   complete-word _generic
zle -C tmux-pane-words-anywhere complete-word _generic
bindkey '^Xt' tmux-pane-words-prefix
bindkey '^X^X' tmux-pane-words-anywhere
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current
zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;How does it work? &lt;code&gt;_tmux_pane_words&lt;/code&gt; will just capture the current
pane's contents (&lt;code&gt;capture-pane&lt;/code&gt;), print out the buffer that
contains it (&lt;code&gt;show-buffer&lt;/code&gt;) and then delete it again
(&lt;code&gt;delete-buffer&lt;/code&gt;). &amp;ndash; The rest of the magic happens via Zsh's
excellent completion mechanisms.&lt;/p&gt;

&lt;p&gt;See it in action (after typing &lt;code&gt;spm^X^X&lt;/code&gt;):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/2012-01-19-205829_508x163_scrot.png&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">Wenn der kleine Hunger kommt...</title>
    <link href="http://blog.plenz.com/2012-01/wenn-der-kleine-hunger-kommt.html" />
    <updated>2012-01-17T20:11:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/wenn-der-kleine-hunger-kommt</id>
    <content type="html">&lt;p&gt;... Rucolasalat mit Tomaten!&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/rucolasalat.jpg&quot;&gt;&lt;img src=&quot;/img/rucolasalat.thumb.jpg&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">trying pthreads</title>
    <link href="http://blog.plenz.com/2012-01/trying-pthreads.html" />
    <updated>2012-01-17T01:37:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/trying-pthreads</id>
    <content type="html">&lt;p&gt;Today I played around with POSIX threads a little. In an assignment,
we have to implement a very, very simple webserver that does
asynchronous I/O. Since it should perform well, I thought I'd not only
serialize I/O, but also parallelize it.&lt;/p&gt;

&lt;p&gt;So there's a boss that just accepts new inbound connections and
appends the fds to a queue:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;clientfd = accept(sockfd, (struct sockaddr *) &amp;amp;client, &amp;amp;client_len);
if(clientfd == -1)
    error(&quot;accept&quot;);
new_request(clientfd);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;new_request&lt;/code&gt; function in turn appends it to a queue (of size
&lt;code&gt;TODOS&lt;/code&gt; = 64), and emits a &lt;code&gt;cond_new&lt;/code&gt; signal for possibly waiting
workers:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pthread_mutex_lock(&amp;amp;mutex);
while((todo_end + 1) % TODOS == todo_begin) {
    fprintf(stderr, &quot;[master] Queue is completely filled; waiting\n&quot;);
    pthread_cond_wait(&amp;amp;cond_ready, &amp;amp;mutex);
}
fprintf(stderr, &quot;[master] adding socket %d at position %d (begin=%d)\n&quot;,
    clientfd, todo_end, todo_begin);
todo[todo_end] = clientfd;
todo_end = (todo_end + 1) % TODOS;
pthread_cond_signal(&amp;amp;cond_new);
pthread_mutex_unlock(&amp;amp;mutex);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The workers (there being 8) will just emit a &lt;code&gt;cond_ready&lt;/code&gt;, possibly
wait until a &lt;code&gt;cond_new&lt;/code&gt; is signalled, and then extract the first
client fd from the queue. After that, a simple function involving some
reads and writes will handle the communication on that fd.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pthread_mutex_lock(&amp;amp;mutex);
pthread_cond_signal(&amp;amp;cond_ready);
while(todo_end == todo_begin)
    pthread_cond_wait(&amp;amp;cond_new, &amp;amp;mutex);
clientfd = todo[todo_begin];
todo_begin = (todo_begin + 1) % TODOS;
pthread_mutex_unlock(&amp;amp;mutex);

// handle communication on clientfd
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(Full source is here: &lt;a href=&quot;http://git.plenz.com/ti3/tree/ueb9/webserver.c&quot;&gt;webserver.c&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;Now this works pretty well and is fairly easy. I'm not very
experienced with threads, though, and run into problems when I do
massive parallel requests.&lt;/p&gt;

&lt;p&gt;If I run &lt;code&gt;ab&lt;/code&gt;, the Apache Benchmark tool with 10,000 requests, 1,000
concurrent, on the webserver it'll go up to 9000-something requests and
then lock up.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ ab -n 10000 -c 1000 http://localhost:8080/index.html
...
Completed 8000 requests
Completed 9000 requests
apr_poll: The timeout specified has expired (70007)
Total of 9808 requests completed
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The webserver is blocked; its last line of output reads like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[master] Queue is completely filled; waiting
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If I attach strace while in this blocking state, I get this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ strace -fp `pidof ./webserver`
Process 21090 attached with 9 threads - interrupt to quit
[pid 21099] recvfrom(32,  &amp;lt;unfinished ...&amp;gt;
[pid 21098] recvfrom(23,  &amp;lt;unfinished ...&amp;gt;
[pid 21097] recvfrom(31,  &amp;lt;unfinished ...&amp;gt;
[pid 21095] recvfrom(35,  &amp;lt;unfinished ...&amp;gt;
[pid 21094] recvfrom(34,  &amp;lt;unfinished ...&amp;gt;
[pid 21093] recvfrom(33,  &amp;lt;unfinished ...&amp;gt;
[pid 21092] recvfrom(26,  &amp;lt;unfinished ...&amp;gt;
[pid 21091] recvfrom(24,  &amp;lt;unfinished ...&amp;gt;
[pid 21090] futex(0x6024e4, FUTEX_WAIT_PRIVATE, 55883, NULL
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So the children seem to be starving on unfinished &lt;code&gt;recv&lt;/code&gt; calls, while
the master thread waits for any children to work away the queue. (With
a queue size of 1024 and 200 workers I couldn't reproduce the
situation.)&lt;/p&gt;

&lt;p&gt;How can one counteract this? Specify a timeout? Spawn workers on
demand? Set the &lt;code&gt;listen()&lt;/code&gt; backlog argument to a low value? &amp;ndash; or
is it all Apache Benchmark's fault? *confused*&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">&quot;Wofür Deutschland Krieg führen darf. Und muss.&quot;</title>
    <link href="http://blog.plenz.com/2012-01/wof%C3%BCr-deutschland-krieg-f%C3%BChren-darf-und-muss.html" />
    <updated>2012-01-08T20:48:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/wofür-deutschland-krieg-führen-darf-und-muss</id>
    <content type="html">&lt;p&gt;&lt;img src=&quot;/img/ulrich-deutschland-krieg-streitschrift.jpg&quot;
style=&quot;margin:0 .7em .2em 0; float:left;&quot; /&gt;
Ich habe unter der Woche &lt;strong&gt;Bernd Ulrichs&lt;/strong&gt; Streitschrift &lt;strong&gt;Wofür Deutschland Krieg
führen darf. Und muss.&lt;/strong&gt; vom Oktober 2011 gelesen. Das Buch war für mich unter
mehreren Aspekten interessant. Einerseits beleuchtet es die
Hintergründe der Kriege, die ich damals als Kind noch nicht
mitbekommen habe &amp;ndash; den Namen UÇK kannte ich zwar aus den
Nachrichten, wusste aber damit nichts zu verbinden &amp;ndash; und
bietet so eine gute Perspektive auf die jüngere Deutsche Geschichte,
gerade auch in Hinblick auf die Auswirkungen der Wiedervereinigung auf
die geopolitische Sicherheitslage Europas und der Welt, sowie das
politische Selbstbewusstsein Deutschlands. Andererseits meldet sich
hier aus der Generation meiner Eltern ein Kriegsdienstverweigerer und
ehemaliger Mitarbeiter des Fraktionsvorstandes der Grünen im Deutschen
Bundestag zu Wort, der mittlerweile stellvertretender Chefredaktuer
und Leiter des Politik-Ressorts der Zeit ist.&lt;/p&gt;

&lt;p&gt;Das ganze ist flüssig zu lesen, aber natürlich kontrovers &amp;ndash; und
das soll es ja auch sein. Zunächst muss gesagt werden, dass das Buch
eine Reihe interessanter Einsichten enthält, die auch sehr treffend
ausformuliert sind. Über die Tatsache, dass sich in der deutschen
Bevölkerung nur sehr schwierig eine stabile Mehrheit für einen Einsatz
der Bundeswehr finden lässt, bemerkt er ganz richtig (S. 53):&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Hinzu kommt ein ganz profaner Umstand. In Deutschland finden
unablässig irgendwelche Wahlen statt, weshalb eine kriegführende
Bundesregierung einem andauernden Plebiszit ausgesetzt ist, das sie
nur überstehen kann, solange andere als die militärischen Fragen
wahlentscheidend sind.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Und weiter:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Die Regierung wird infolgedessen dazu tendieren, die Fragen von
Krieg und Frieden möglichst nicht zu thematisieren, ja, ihre
Thematisierung aktiv zu verhindern.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Eine weitere interessante Beobachtung stellt Ulrich über die
&quot;spezielle Verbindung&quot; zwischen Deutschland und Israel an (S. 73):&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;In der wachsenden Distanz zu Israel und in die zunehmende Skepsis
gegen Militäreinsätze hinein bringt nun die Merkel-Doktrin
Deutschland näher an einen Militäreinsatz für Israel. Hier liegt
eine enorme latente Spannung.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Schaut man auf das Inhaltsverzeichnis, so kann man das Buch in einige
wesentliche Thesen zusammenfassen:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Aufweichung der Bündnistreue: Emanzipation von der Bündnispflicht,
hin zu Von-Fall-zu-Fall-Entscheidungen.&lt;/li&gt;
&lt;li&gt;Die Kriege im Irak und in Afghanistan waren falsch; die auf dem
Balkan und in Libyen richtig.&lt;/li&gt;
&lt;li&gt;Künftige Militäreinsätze im Ausland sollten &quot;Polizeicharakter&quot;
haben, Völkerrecht ist teilweise überholt.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Meine Generation, also die zur Zeit des Niedergangs der DDR oder nach
dem Mauerfall Geborenen, sind in meinen Augen sehr pazifistisch
eingestellt, und das ist gut so. Rundheraus würde ich sagen: Krieg ist
immer falsch.&lt;/p&gt;

&lt;p&gt;Leider stimmt das nicht. Ja, wenn man an all die Kriege denkt, die
Amerika so geführt hat im Südosten Asiens, oder wie die Kriege in
Afghanistan und dem Irak laufen: das ist abgrundtief falsch. &amp;ndash;
Andererseits muss man sich immer wieder den
&lt;a href=&quot;http://de.wikipedia.org/wiki/V%C3%B6lkermord_in_Ruanda&quot;&gt;Ruandischen Genozid&lt;/a&gt;
vor Augen halten, und die damalige
&lt;a href=&quot;https://en.wikipedia.org/wiki/Rwandan_Genocide#United_Nations&quot;&gt;Passivität der UN&lt;/a&gt;.
Dadurch, dass westliche Mächte nicht eingegriffen haben, &lt;em&gt;obwohl&lt;/em&gt; sie
ziemlich gut wussten, dass ein riesiger Völkermord passierte, &lt;em&gt;das&lt;/em&gt; ist
unverantwortlich. &amp;ndash; Wenn man sagt &quot;Krieg ist in keinem Fall
tragbar&quot;, dann öffnet man dem Kulturrelativismus Tür und Tor. Profan
ausgedrückt, sagt man: &quot;Lass die Anderen doch mit sich selbst
klarkommen. Wenn sie sich abschlachten, dann ist das nicht mein
Problem, und nicht einmal notwendigerweise falsch.&quot; &amp;ndash; eine
solche Einstellung ist sehr, sehr gefährlich. Von daher ist für den
Pazifisten die Fragestellung, ob es &lt;em&gt;überhaupt&lt;/em&gt; legitime Kriege gibt,
eine sehr viel schwierigere, als sie auf den ersten Blick scheint.&lt;/p&gt;

&lt;p&gt;Im Nachhinein kann man möglicherweise sagen, dass der Einsatz der
Bundeswehr als Teil des NATO-Bündnisses in Libyen gerechtfertigt
gewesen wäre. &lt;a href=&quot;http://www.dw-world.de/dw/article/0,,15493120,00.html&quot;&gt;Der Einsatz ist mittlerweile
beendet&lt;/a&gt;, und
der Aufbau des Landes kann beginnen. Wenn ein Präsident die Luftwaffe
gegen das eigene Volk einsetzt, dann sollte es schwer sein,
wegzuschauen. &amp;ndash; Natürlich muss man sich überlegen,
&lt;a href=&quot;http://img.dailymail.co.uk/i/pix/2007/12_02/gaddafiEPA1012_468x533.jpg&quot;&gt;wer&lt;/a&gt;
&lt;a href=&quot;http://www.chinadaily.com.cn/world/images/attachement/jpg/site1/20090710/0013729e48090bc1321e37.jpg&quot;&gt;denn&lt;/a&gt;
die Machtposition Gaddafis über Jahrzehnte gefestigt hat. Aber man
kann und darf die Frage nach militärischer Intervention nicht mit
einer antiimperialistischen Floskel à la &quot;hätten wir nicht X gemacht
... wäre nicht Y passiert&quot; abtun. Dort sterben Leute.&lt;/p&gt;

&lt;p&gt;Ich tue mich auch schwer in der Frage, zumal ich von einer anderen
Prämisse ausgehe, was die Situation zugegebenermaßen leichter macht:
Ich empfinde nichts für das Staatenkonstrukt Deutschland. Deutsche
Kultur, insbesondere die deutsche Sprache und Literatur, sowie
klassische Musik bedeutet mir etwas &amp;ndash; das geht aber über
Staatengrenzen hinaus. Der Großteil von Deutschland &amp;ndash; das heißt,
alles außerhalb von Hamburg und Berlin &amp;ndash; bedeutet mir
&lt;em&gt;nichts&lt;/em&gt;, ganz einfach &lt;em&gt;nichts&lt;/em&gt;. Ich habe da schließlich nie
gelebt. Aber ohne die Grundlage von konstruierten Staaten, die
gemeinsam agieren, entfällt natürlich die Notwendigkeit zur
Verantwortung gegenüber anderen Staaten &amp;ndash; es bleibt die
Verantwortung von Menschen gegenüber anderen Menschen, und dort sind
die Menschenrechte ein ziemlich allgemein akzeptierter Konsens.&lt;/p&gt;

&lt;p&gt;Zusammenfassend lässt sich sagen, dass das Buch einige spannende
Einsichten, auch in das Wirken von Presse und Politik, bereit hält.
Und es ist beeindruckend zu sehen, wie ein ehemaliger überzeugter
pazifistischer Aktivist heute Kriege zu legitimieren versucht.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title type="html">mutt sidebar patch improvements</title>
    <link href="http://blog.plenz.com/2012-01/mutt-sidebar-patch-improvements.html" />
    <updated>2012-01-08T19:32:00+01:00</updated>
    <id>http://blog.plenz.com/2012-01/mutt-sidebar-patch-improvements</id>
    <content type="html">&lt;p&gt;It is generally accepted as an almost universal truth that mutt sucks,
but is the MUA that sucks less than all others. While people use
either Vim or Emacs and fight about it, I hardly see any people fight
about whether mutt is good or bad. There is, to my knowledge, no
alternative worth mentioning.&lt;/p&gt;

&lt;p&gt;Mutt dates back well into the mid-nineties. As you might imagine, with
lots of contributors over the course of almost two decades, the
code quality is rather messy.&lt;/p&gt;

&lt;p&gt;When development had stalled for quite a while in the mid-2000's, a
&lt;a href=&quot;http://synflood.at/blog/index.php?/archives/337-Forking-mutt.html&quot;&gt;fork was attempted&lt;/a&gt;.
While mutt-ng was quite popular for a while, most changes were
incorporated back into mainline mutt at some point.
(Ironically, the latest article in the &lt;a href=&quot;http://mutt-ng.supersized.org/&quot;&gt;mutt-ng development
blog&lt;/a&gt; is from October 2006 and is
titled &quot;mutt-ng isn't dead!&quot;). The development of main mutt gained
some momentum again, triggered in large parts by the
contributions of late Rocco Rutte.&lt;/p&gt;

&lt;p&gt;I remember two big features that the original mutt authors just
wouldn't integrate into mainline: The headercache patch and the
sidebar patch. About the former I can't say anything, but lately I've
been fixing the Sidebar patch in various places. (We use mutt at work
and rely heavily on e-mail communication, so we'd like a bug-free user
agent, naturally.)&lt;/p&gt;

&lt;p&gt;When all the mutt forking went about five years ago, I didn't know
much about it. Retrospectively, I see the people did a hell of a job.
Long before mutt-ng was forked, &lt;a href=&quot;http://guckes.net/&quot;&gt;Sven&lt;/a&gt; told me he
and &lt;a href=&quot;http://michael-prokop.at/&quot;&gt;Mika&lt;/a&gt; met in Graz for several weeks to
sift and sort through the availbale patches, intending to do a &quot;super
patch&quot;.&lt;/p&gt;

&lt;p&gt;Mutt's code quality is arguably rather messy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There's a wild mix of 2-, 4- or 8-space indentation, often mixed
with spaces (or vice versa)&lt;/li&gt;
&lt;li&gt;The user interface is &lt;em&gt;completely&lt;/em&gt; tangled with application logic&lt;/li&gt;
&lt;li&gt;It uses curses directly. Go figure&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;On top of that, the Sidebar patch tries to make it even worse. Imagine
this: mutt draws a mail from position (line=x,char=0) to the end of
the line. Now the sidebar patch will introduce a left &quot;margin&quot;, such
that the sidebar can be drawn there. Thus, all code parts where a line
is started from the leftmost character has to be rewritten to check
if the sidebar is active and possibly start drawing at
(line=x,char=20).&lt;/p&gt;

&lt;p&gt;The sidebar code quality is a fringe case of bad code. Really, it
sucks. However, there's no real way to &quot;do it right&quot;, since original
mutt never planned for a sidebar.&lt;/p&gt;

&lt;p&gt;Who maintains the sidebar patch? &amp;ndash; Not sure. There's a version
at &lt;a href=&quot;http://thomer.com/mutt/&quot;&gt;thomer.com&lt;/a&gt;, but he says:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;July 20, 2006&lt;/strong&gt; I quit. Sadly, there seems to be no desire
to absorb the sidebar patch into the main source tree.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The most up-to-date version is found at
&lt;a href=&quot;http://www.lunar-linux.org/mutt-sidebar/&quot;&gt;Lunar Linux&lt;/a&gt;. Last update
is from mid-2009.&lt;/p&gt;

&lt;p&gt;Debian offers a &lt;code&gt;mutt-patched&lt;/code&gt;
&lt;a href=&quot;http://packages.debian.org/mutt-patched&quot;&gt;package&lt;/a&gt; that includes the
sidebar patch, albeit in a different version than usually found 'round
the net. In short, this patch is a mess, too.&lt;/p&gt;

&lt;p&gt;But since I made all the fixes, I decided to contact the
package's maintainer, Antonio Radici. He promptly responded and said
he'd happily fix all the issues, so I started by opening two
&lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646941&quot;&gt;bug&lt;/a&gt;
&lt;a href=&quot;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646942&quot;&gt;reports&lt;/a&gt;.
Nothing has happened since.&lt;/p&gt;

&lt;p&gt;The patches run quite stable for my colleagues, so I think it's best
to release them. Maybe someone else can use them. Please note that I
have absolutely no interest in taking over any Sidebar patch
maintainance. ;-)&lt;/p&gt;

&lt;p&gt;For some of the patches I provide annotations. They all feature quite
descriptive commit messages, and apply cleanly on top of the
&lt;a href=&quot;http://anonscm.debian.org/gitweb/?p=pkg-mutt/mutt.git&quot;&gt;Debian mutt repository&lt;/a&gt;'s
master branch.&lt;/p&gt;

&lt;p&gt;The first four patches are not by me, they are just the corresponding
patches from the &lt;code&gt;debian/patches/&lt;/code&gt; directory applied to have a
starting point.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0001-applying-debian-patches-mutt-patched-multiple-fcc.patch&quot;&gt;0001-applying-debian-patches-mutt-patched-multiple-fcc.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0002-applying-debian-patches-mutt-patched-sidebar.patch&quot;&gt;0002-applying-debian-patches-mutt-patched-sidebar.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0003-applying-debian-patches-mutt-patched-sidebar-dotted.patch&quot;&gt;0003-applying-debian-patches-mutt-patched-sidebar-dotted.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0004-applying-debian-patches-mutt-patched-sidebar-sorted.patch&quot;&gt;0004-applying-debian-patches-mutt-patched-sidebar-sorted.patch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The first few patches fix rather trivial bugs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0005-Fix-sidebar-compilation-errors-on-IRIX-systems.patch&quot;&gt;0005-Fix-sidebar-compilation-errors-on-IRIX-systems.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0006-Fix-counting-of-flagged-mails-in-mboxes.patch&quot;&gt;0006-Fix-counting-of-flagged-mails-in-mboxes.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0007-Fix-various-sidebar-drawing-issues.patch&quot;&gt;0007-Fix-various-sidebar-drawing-issues.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0008-Fix-setting-CurrBuffy-when-invoking-mutt-via-f.patch&quot;&gt;0008-Fix-setting-CurrBuffy-when-invoking-mutt-via-f.patch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Now come the performance critical patches. They are the real reason I
was assigned the task to repair the sidebar:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0009-cache-time-when-sidebar-last-counted-all-the-mails.patch&quot;&gt;0009-cache-time-when-sidebar-last-counted-all-the-mails.patch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This patch fixes a &lt;em&gt;huge&lt;/em&gt; speed penalty. Previously, the sidebar would
count the mails (and thus read through the whole mbox) &lt;em&gt;every time
that mtime &gt; atime&lt;/em&gt;! This is just an incredible oversight by the
developer and must have burned hundreds of millions of CPU cycles.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;This introduces a member `sb_last_checked' to the BUFFY struct. It
will be set by `mh_buffy_update', `buffy_maildir_update' and
`buffy_mbox_update' when they count all the mails.

Mboxes only: `buffy_mbox_update' will not be run unless the
condition &quot;sb_last_checked &amp;gt; mtime of the file&quot; holds. This solves
a huge performance penalty you obtain with big mailboxes. The
`mx_open_mailbox' call with the M_PEEK flag will *reset* mtime and
atime to the values from before. Thus, you cannot rely on &quot;mtime &amp;gt;
atime&quot; to check whether or not to count new mail.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Also, don't count mail if the sidebar is not active:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0010-only-count-mail-if-sidebar-is-active.patch&quot;&gt;0010-only-count-mail-if-sidebar-is-active.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0011-buffy-check-msg_unread-if-sidebar-is-active.patch&quot;&gt;0011-buffy-check-msg_unread-if-sidebar-is-active.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0012-fix-sidebar-and-buffy-updates.patch&quot;&gt;0012-fix-sidebar-and-buffy-updates.patch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Then, I removed a lot of cruft and simply stupid design. Just consider
one of the functions I removed:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;-static int quick_log10(int n)
-{
-        char string[32];
-        sprintf(string, &quot;%d&quot;, n);
-        return strlen(string);
-}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That is just insane.&lt;/p&gt;

&lt;p&gt;Now, customizing the sidebar format is simple, straight-forward and
mutt-like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sidebar_format

    Format string for the sidebar. The sequences `%N', `%F' and
    `%S' will be replaced by the number of new or flagged messages
    or the total size of the mailbox. `%B' will be replaced with
    the name of the mailbox. The `%!' sequence will be expanded to
    `!' if there is one flagged message; to `!!' if there are two
    flagged messages; and to `n!' for n flagged messages, n&amp;gt;2.
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0013-introduce-sidebar_format-option.patch&quot;&gt;0013-introduce-sidebar_format-option.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0014-introduce-sidebar_folderindent-option.patch&quot;&gt;0014-introduce-sidebar_folderindent-option.patch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;While investigating mutt's performance, one thing struck me: To decode
a mail (eg. from Base64), mutt will create a temporary file and print
the contents into it, later reading them back. This also happens &lt;strong&gt;for
evaluating filters that determine coloring&lt;/strong&gt;. For example,&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;color   index  black green  '~b Julius'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;will highlight mail containg my name in the body in bright green (this
is tremendously useful). However, for displaying a message in the
index, it will be decoded to a temporary file and later read back.
This is just insane, and clearly a sign that the mutt authors wouldn't
bother with dynamic memory allocation.&lt;/p&gt;

&lt;p&gt;By chance I found a glib-only function &lt;code&gt;fmemopen()&lt;/code&gt;,
&lt;a href=&quot;http://linux.die.net/man/3/fmemopen&quot;&gt;&quot;fmemopen, open_memstream, open_wmemstream - open memory as stream&quot;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;From the commit message:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;When searching the header or body for strings and the
`thorough_search' option is set, a temp file was created, parsed,
and then unlinked again. This is now done in memory using glibc's
open_memstream() and fmemopen() if they are available.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This makes mutt respond much more rapidly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0015-keep-buffer-like-temp-file-in-memory.patch&quot;&gt;0015-keep-buffer-like-temp-file-in-memory.patch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Finally, there are some patches that fix various other issues, see
commit message for details.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0016-Bugfix-use-realpath-on-initial-folder.patch&quot;&gt;0016-Bugfix-use-realpath-on-initial-folder.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0017-Sidebar-Copy-numbers-before-leaving-mailbox.patch&quot;&gt;0017-Sidebar-Copy-numbers-before-leaving-mailbox.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0018-Fix-Buffy-Sidebar-and-mail_check_recent-issues.patch&quot;&gt;0018-Fix-Buffy-Sidebar-and-mail_check_recent-issues.patch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0019-Copy-number-of-flagged-messages-when-leaving-mbox.patch&quot;&gt;0019-Copy-number-of-flagged-messages-when-leaving-mbox.patch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;There you go. I appreciate any comments or further improvements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 1:&lt;/strong&gt; The original author contacted me. He told me he's written most of
the code in a single sitting late at night. ;-)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt; The 16&lt;sup&gt;th&lt;/sup&gt; patch will make mutt crash when you compile it with &lt;code&gt;-D_FORTIFY_SOURCE=2&lt;/code&gt;. There's a fix:
&lt;a href=&quot;http://plenz.com/tmp/mutt-sidebar-patches/0020-use-PATH_MAX-instead-of-_POSIX_PATH_MAX-when-realpat.patch&quot;&gt;0020-use-PATH_MAX-instead-of-_POSIX_PATH_MAX-when-realpat.patch&lt;/a&gt; (thanks, Jakob!)&lt;/p&gt;
</content>
  </entry>
  
</feed>

