Posts tagged with 'Code'

Things that just work

  • Posted on January 12, 2010 at 10:34 pm

A lot of people dream of gadgets, software and hardware that just works. Just like that. Complexity is the enemy of this simple concept. Our office features an Redundant Array of Coffee Machines (RAIC level 1, parallel brewing). In theory we have four coffee machines. One is broken and features the highest complexity, the third one is slightly less complex and works, the last two are quite simple and never broke down.

Passenger Ruby on Rails Server Error

Rails deployment that just works.

Software can be complex, too. Note the year 2010 bug in various applications. Even one of my projects featured a year 2010 bug (technically it was a January bug which would have happened always in January). The screenshot shows a nice example of an optimistic Apache module used for deploying Ruby on Rails code. If you count internal server errors as productive tasks, then the module is absolutely correct – a fine example of deployment that Just Works™.

Whenever I hear the word passenger I have to think of Dexter. I don’t know why.

We have Dragons in the office!

  • Posted on December 28, 2009 at 9:21 pm

We’re sitting in the office and watch the streams from 26C3. Now that’s what I call cool! The streams are quite stable (except for the rush hours).

Speaking of dragons, I just upgrade the main virtualisation server to Linux kernel 2.6.32.2 and qemu-kvm 0.12.1.1. Hooray! In addition the main web server was upgraded from Debian 4.0 to Debian 5.0. It worked like a charm! That’s what I like about Debian.

Back to the dragons! Shhhh!

„VMAC not found”

  • Posted on December 8, 2009 at 11:31 pm

Well, the new Linux kernel 2.6.32 has a new crypto module called VMAC. It is a 64 bit hash that can be computed on 64 bit platforms – and this very fast. So I decided to look up what VMAC really does. I ended up in the CryptoLounge wiki. And there I clicked on a link to Wikipedia. And then I noticed that the article pointing to the VMAC algorithm had been deleted.

The lost page of VMAC in the English Wikipedia.

The lost page of VMAC in the English Wikipedia.

Note the Thanks, Wikipedia. sign on top of the missing item. Really, thanks a lot. In the meantime I’ll have a look at the C source code in my new kernel. Fortunately my filesystem doesn’t delete items on its own (maybe because I got the admin rights).

Spendenaufruf für de.wikipedia.org Nachfolger

  • Posted on November 12, 2009 at 4:58 pm

Das Aufbauen von guten Online-Enzyklopedien ist viel Arbeit. Einmal braucht man Software, dann natürlich Bandbreite, genügend Server und logischerweise die Inhalte. In bestimmten Kreisen mit mafiösen Strukturen muß man Information dann noch gegen Löschanträge verteidigen. Das kostet Zeit und letztlich Geld. Ich möchte daher auf das Projekt Levitation von Scytale hinweisen. Es soll die von Datenverlusten geplagte Deutsche Wikipedia ablösen. Die Zeit für eine solche Idee ist reif, aber der Autor braucht eure Unterstützung. Laßt euch also nicht zu Spenden verführen, die sowieso wieder gelöscht werden. Spendet gleich an den Autor von Levitation!

Frameworks – waste your day

  • Posted on August 3, 2009 at 11:50 pm

Everyone has a framework or a toolbox to tackle problems with. In an ideal world this simplifies the task at hand. It helps you focus on the problem. It saves you tedious lines of code and functions everyone has written before. My task is to write a simple web application where you basically edit database tables. It’s nothing fancy. It needs authentication and PostgreSQL support. So I checked out PHP Frameworks and started testing.

The site presents a nice table. You can easily see which one supports which feature. Some are very cool. Others have very nice features. The problem is that I don’t need what they offer. They are too big, too complex. I tried six frameworks  and deleted them again. Half of them had lousy tutorials. Almost all of them lacked an easy to understand  framework for authentication (I have the database design ready, I don’t need authentication libraries that have their own idea of the user account backend). Not a single framework enabled me to hack away and create the first pages of the application quickly.

So I guess it’s back to my own libraries and a template engine again. Smarty and pure PHP5 rock. Too bad.

The Joys of Implementing Secure Protocols

  • Posted on July 23, 2009 at 12:47 am

I get a lot of spam. I also have a lot of measures to defend against it. One method consists of a feedback loop that trains the spam filter with nice and nasty emails (often called ham and spam). Said method is implemented by means of two tiny Perl scripts. Basically the scripts do some mailbox inspection and shove all collected emails destined for training into two IMAP boxes. So far, so good. The problem is that the scripts stopped working, because I enforced the Secure Socket Layer (SSL) protocol at the IMAP server while doing an upgrade a few weeks ago. Encryption is always good in times like these, right? Well, yes, but the Perl scripts didn’t know how to use SSL. Let’s dive into the little hack and look for the problem.

I use the module Mail::IMAPClient for the IMAP stuff. Its documentation says that everyone wishing for SSL should use their own sockets and supply them to the IMAP object. In non-SSL mode the object likes to have the address of the IMAP server, an username and a password when being created. If SSL is used, then you can create the object and tell it about the SSL socket later. So that’s what I tried. While coding I also implemented the parameters for the key, its certificate and the certificate of the Certificate Authority. Using encryption without checking identities is pointless. It’s just a few lines anyway. There, done. Testing. Drumroll…and…it…doesn’t…work!

Ok, no problem. Let’s peek into the client/server conversation by using the tool ssldump. I have the key, so I can decrypt the data stream. The dump basically says that there is no connection. Ok, I used the option RawSocket instead of Socket; my fault. Corrected. Testing. No connection. Ok, I used the wrong selection of ciphers; my fault. Corrected. Testing. The layer 3 works, SSL works, but IMAP doesn’t. Mail::IMAPClient complains about an uninitialised variable called $server in its module. But that’s correct, I supplied the socket handle instead. Checking, testing. Doesn’t work. Ok, well, maybe I put back the server’s address into the object creation call. I have a socket, the module says it only needs the socket, so why not supply the server’s address a second time. It’s good to have a backup. Testing again – and it works!

Either I am getting old, it’s still too hot or some documentations aren’t meant to be parsed by human brains. Don’t get me wrong, Mail::IMAPClient does the job and I like it, but I could have done fine without this experience.

Let’s deploy the well-tested code on the production systems. Famous last words.

  • Comments are off for The Joys of Implementing Secure Protocols
  • Filed under

Von Barock Obama und den Stinker-Raketen

  • Posted on June 5, 2009 at 12:36 pm

Ich liebe gut durchdachte Algorithmen und Systeme. Manche verfolgen mich bis in den Alltag und werden meist rasch abgeschaltet. Automatische Korrekturen beispielsweise, die solche Vorschläge machen: „Internat statt Internet, Nato statt Nano, Cupertino statt Kooperation”

Konrad Lischka hat in einem Artikel auf spiegel.de die automatische Rechtschreibprüfung kritisch betrachtet (man findet den Artikel über diesen Link, der möglicherweise Spuren von Kinderpornografie enthalten kann: http://www.spiegel.de/netzwelt/web/0,1518,612714,00.html ). Offenbar finden sich auch prominente Opfer, wie Dokumente der NATO, der EU und der UNO bezeugen. Klar sind Lexika immer etwas spät dran, aber eine gute Software muß ja nicht immer einen Vorschlag liefern. Oft ist keine Aussage hilfreicher als Wortstürme.

  • Comments are off for Von Barock Obama und den Stinker-Raketen
  • Filed under

Geschichtsunterricht – A Cypherpunk’s Manifesto

  • Posted on May 23, 2009 at 10:23 am

Der Text mit dem Namen A Cypherpunk’s Manifesto ist nicht neu. Er wurde im Jahre 1993 von Eric Hughes verfaßt. Leser der Romane von Neil Stephenson dürften den Begriff Cypherpunk kennen (ja, und Hacker wohl auch). Das Manifest ist heutzutage wahrscheinlich eine Terroranleitung. Man sollte den Text spiegeln bevor er aus dem Netz von besorgten Politikern „verschwunden wird”.

„Privacy is necessary for an open society in the electronic age. Privacy is not secrecy. A private matter is something one doesn’t want the whole world to know, but a secret matter is something one doesn’t want anybody to know. Privacy is the power to selectively reveal oneself to the world. …”

Sehr lesenwert. Cypherpunk-Autoren gesucht (wollen die Schriftsteller nicht auch mitmachen?). Helft alle mit die Gesellschaft frei zu halten. Man kann bei Kommunikationsgewohnheiten anfangen, es muß nicht gleich hochkomplexe Mathematik sein.

  • Comments are off for Geschichtsunterricht - A Cypherpunk's Manifesto
  • Filed under

Fun with libraries

  • Posted on April 25, 2009 at 11:01 am

Parsing XML data is not a big problem. In theory. In practice you will most certainly use a framework or a library. I use C++ at the moment. And I use libxml++ which works really well. When walking through an XML document you just grab the content of the tags and get all the attributes you want. You have to be careful though. Accessing nonexistent attributes may lead to undefined behaviour. It’s best to stick to the example in the documentation and walk through the list of available attributes by iterator:

if ( (rule_type == USERAGENT) or (rule_type == REQUEST) ) {
    // Look for regexp attribute (still needs a try/catch structure ;)
    const xmlpp::Element::AttributeList& attributes = parentnode->get_attributes();
    for ( xmlpp::Element::AttributeList::const_iterator iter = attributes.begin();
          iter != attributes.end();
          ++iter) {
        const xmlpp::Attribute* attribute = *iter;
        if ( attribute->get_name() == "regexp" ) {
            string regexp_text = attribute->get_value();
            if ( regexp_text.length() > 0 ) {
                new_rule.pattern = make_u32regex(regexp_text);
            }
        }
    }
}

Don’t access the regexp attribute directly, always get a list and look at the list of existing attributes. It saves a few core dumps. And yes, I am using the DOM parser. I have no idea what the SAX parser does. Maybe you want to try and tell me about it.

Code Breakfast

  • Posted on April 24, 2009 at 10:51 am

regexp PCRE CPAN GC G1 WLAN USB UMTS HSDPA GPS CLF vector #include “rule_parser.h” main() void NULL INSERT DELETE SELECT FROM VACUUM UPDATE MVCC DWH RDBM TokyoCabinet DBM NDBM QDBM BerkeleyDB SQL WAL TCP UUID Blum-Blum-Shub ISO OpenMP g++ #pragma POSIX HTTPS SSL TLS AES 3DES SHA1 MD5 MD6 OpenSSL /dev/random HEAP RBL DNS CMDBA DWH BI IMAPv4 POP3 REST SOAP ICP PHPSESSID Cookie SHM KRB5 EHLO SMTP STARTTLS AUTH URL XSS CSS XSRF pattern core RSS TLB L2 VPN PEM key value SPK DKIM RSA DNS TXT A PTR SOA return(0);

Schreiben kann so einfach sein!

  • Posted on March 18, 2009 at 4:10 pm

Oft fällt einem nichts ein. Viel öfter schreibt man dann einen Aufguß fremder Ideen und packt die sprichwörtliche Kirsche (Kirche?) auf die Spitze. Das beschreibt die Blogosphäre eigentlich ganz gut. Das kann beispielsweise so klingen:

Is there a dog?

There was even an aging elf who lived near the edge of Felwithe who had long ago put down his fiery sword and gently laid his armor within a chestablished never to call himself a Paladin again. However, there werent many of those: not too long after I arrived in New York, his output began to fall off sharply. Suffice to say, there was a lot of jealousy and bitterness at the studio, and John got the worst of it. It would have been better had I not been trying to avoid stepping on or running into the 5 billion tourists there with us. I only need a couple of things from these people and then I won’t have to deal with them. The fact that I haven’t dated since I became Christian, that I haven’t had to deal with guys and boy troubles and confusion and responsibility and girls disliking me because I’m with the guy they like and friends hating me because I spend more time with my boyfriend then with them just all that junk that clutters one’s life when they begin to date.

The sky was heavy and we felt momentarily menaced in a way that looking at a stretch of land couldn’t produce, I’d argue

Yay! Klingt absurd und stellt eine geballte Urheberrechtsverletzung dar. Der Text wurde nämlich unter der Eingabe der Frage „Is there a dog? mit Hilfe von Catty v3 erstellt. Grundlage waren tausende von Blogs. Spart Zeit; so könnte man glatt ein erfolgreicher Autor werden.

Top