Mar 20: ZSH madness
Ok, it's geek time now. If you don't know what a unix shell is, please scroll down, there are some non-geek blog posts with pictures and stuff. ![]()
After Sipprecht showed me his pimped ZSH prompt, my first thought was: "How ugly!", but a second look revealed some interesting features that prompted me to explore the Z shell a little bit further.
ZSH was introduced 1990 by Paul Falstad (OMG: what a geek, look at his geocaching.com stats!) as an enhancement of the bourne shell. It can be used interactively (i.e. you type commands) and as a scripting language. Besides being fully compatible with the bash shell, the Z shell has some original features and behaves much smarter in some situations. The most prominent changes that I encountered so far are:
- The Prompt
- It's possible to specify a left and a right prompt. The right prompt will disappear when typing long lines. Prompts are really a matter of taste, and these options make a customization of the prompt easier. My prompt now looks like this, with the working directory on the left and the time on the right. Note how zsh shows other user's homes with
~userinstead of/path/to/the/user/dir.
- Tab Completion
- So that's the killer: If you deal with several files/dirs starting with the same characters and hit the Tab key, bash shows you a list of alternatives and you have to figure out by yourself the difference in the name and type an appropriate character to narrow the file list down. Very annoying. Especially when dealing with long similar file names, this behavior takes forever to find a single file. But zsh comes to the rescue: If you press Tab once, you see the list of alternatives and by hitting Tab again you can cycle through all the alternatives! With menu completion enabled, one can even navigate through the file list with the cursor keys and select the target.
Additionally zsh can expand substrings of file names. Say you have manyP01XXXX.jpgfiles in your picture directory and want to pickP012344.jpg, then you could type44and press Tab and the shell will expand it to all files with44somewhere in their name. - Globbing a.k.a. Wildcard Expansion
- Second killer: Everybody knows how to list a subset of all files in a directory by specifying a pattern, e.g. doing
ls *.javato list all files ending with.java. If we wanted to list all java files, which reside in subdirectories, we need the help of find:find . -name "*.java". Not so in zsh which provides additional operators in file patterns. Here we use**/, and it will search all directories recursively:ls **/*.java.
Another huge advantage: After we type a pattern and hit Tab, if one or more files match the pattern, zsh replaces the pattern with a list of the matching filenames! Awesome. Now it's easy to see which files are affected by a pattern before executing a command, e.g.rm.
There are a lot more handy features, like auto_cd, multiple output streams, shared history and global aliases (in the above screenshot you see that I made ... to be an alias for ../..). I am still figuring out what can be done with the zsh and in the meanwhile I also learn new things about bash that I didn't knew before.
You can download my current zsh configuration and just rename the file to .zshrc and put it in your home dir.
As pointed out by some Bedenkenträger here, the main pitfall with adopting the new shell is switching back to ye olde bash, e.g. on other machines. It would probably be very annoying to hit Tab without anything happening. But these concerns should not prevent the adoption of superior technologies.
In this spirit: Happy chsh-ing.
Mar 18: Breaking News: Schneechaos in Leipzig
Wer - wie ich - ständig rummotzt, dass früher alles besser war und es in L.E. nie wieder Schneien wird, der wurde heute eines besseren belehrt. Es gibt Schneeee.. Am Gemüseladen merkte ich erneut die Faulheit Professionalität der Crew, als die Damen überlegten ob es sich lohnt die Auslagen vor dem Laden doch lieber hineinzuräumen. Nach kurzer Diskussion war schnell beschlossen, dass der Schneeeinfall sicher nicht lange dauert und es sich daher kaum lohnt aktiv zu werden. Und tatsächlich, während ich die Zeilen hier schreibe, kommt auch wieder die Sonne zum Vorschein.. Naja, das war mal wieder ein kurzer Spaß, ich freu mich schon auf ein hoffentlich frühlingshaftes Ostern..
Mar 6: Evil form spam protection
Everybody who has ever set up an HTML form on a website (e.g. contact form for sending eMails), knows that some nasty spam bots visit your site from time to time and submit the form with random spam. The usual countermeasure is to verify that an actual human being is submitting the form. This verification is normally done with the help of a Captcha, a small image containing random letters. By typing the letters into an input field, you prove to be human, because it is assumed that bots cannot recognize the letters in the image. (Actually nearly every Captcha implementation has been defeated so far and trained bots can circumvent their protection.)
Over at Marian's website, we have a form for online support requests by customers and encountered an increasing amount of spam coming to the support staff's inbox through the HTML form. Since I was to lazy to set up a captcha - although I liked to idea of the reCAPTCHA - I tried a different, evil, mean, unfair but still elegant way of blocking spam posts. Knowing that spam bots want to deliver their advertisement links in any possible way, I just set up an additional input field in the form:
<input type="text" name="website" value=""/>
This field is hidden using CSS display:none on the surrounding element, so that normal users don't see it. One can assume, that bots usually don't care much about CSS and try to fill out all form fields, especially the one labeled "website". They just can't resist.. hrhr.. For CSS unaware user agents and screen readers, we add a (also hidden) text message, telling the user to leave the field empty. Now, with our trap in place, everytime the form is submitted, we just check if this input field is left empty. If it was indeed filled out, we reject the submission with an error message, since it was probably submitted by a bot.
Outcome: During February, the form was submitted 7 times with a non-empty website field, everytime containing a spam link. No other spam came through our filter and the support staff is happy. I know, it's not much data now, but principially this easy method seems to work quite well in our case. Evil grin..
Note: Obviously this trap only works for "generic" spam bots, which have no prior knowledge about our form and the madness of its programmer.. Usability note: There might be some issues with browsers automatically filling certain form elements, based on visits to other forms with same input field names.
Feb 28: TBI Winterseminar 08 in Bled
Last week it was again time for the annual TBI winter seminar in Bled, Slovenia. This year roughly 70 people from the research groups in L.E., Vienna, Freiburg and Copenhagen and other places attented the meeting. Thus we had a full week of talks, which were held in the hotel's conference room this time. As usual we had a broad range of topics, not only covering RNA stuff.
Since the talks were scheduled in afternoon and night sessions, we had plenty of time during the day to get around in perfectly sunny and warm Bled. On Thursday there was the bioinformatics afternoon in Ljubljana, with some talks of the local bioinformatics folks. During the day we visited Ljubljana's castle and after the talks we experienced Ljubljana at night.
Caching
On Saturday, Sylvia, Jana, Alex and me went on a presumably easy walk to find a geocache hidden at a nearby river. We first followed the street leaving Bled and then went more or less straight to the first waypoint following the GPS directions.
After a small half-hour break in the sun, we were just 50m away from the place but suddenly realized, that we were standing on top of a - say 50 meter - high bluff, whereas the river was down in the valley.. Well, that's what I would call the worst case.. We than decided to give up and walk back to Bled, after having a small break on the top of that hill. After climbing down (some decided to slip down
), the GPS showed the location to be not that far away, so we were motivated again and crossed the river.
Arriving at the coordinates and finding nothing there, Alex eventually entered the correct coordinates in the GPS, which were only some hundred meters away. So we went on and after climbing another hill (fuck hills!) we reached the first waypoint, which was a memorial stone. Using the engraved date we calculated the final coordinates, but they seemed to be not really reachable from our place in a passable time, so we again decided to give up and walk down the way back to the bridge.
During the way downhill, the location became closer and closer as we passed on and suddenly we eventually reached the final coordinates. We found the ammo box quite quickly and we all were pretty excited about the happy end. There was even a HGTTG-GeoCoin in the box. When we arrived back in Bled, it was already dark and we estimated that we have been walking about 15km on that day. The trip was very adventurous and exhausting, but was totally worth all the ups and downs..
Jan 17: Nachwuchsförderung am IMISE
Da nun schon seit geraumer Zeit stark rückläufige Studienanfängerzahlen in der Medizininformatik zu verzeichnen sind, wurde es nötig selbst aktiv Nachwuchskräfte zu trainieren und für das Fach zu begeistern. Experten der AG Infodienste haben dazu ein Spezialtrainingsprogramm entwickelt, um zukünftige Studenten optimal auf die vielfältigen hochspezialisierten Anforderungen an Medizininformatiker vorzubereiten.
Im Bild zu sehen ist Staff Sergeant Mücke beim Rekrutentraining.
Update 21/01/07
Nun hat auch die Leipziger Volkszeitung die politische Brisanz des Themas erkannt und einen entsprechenden Artikel in ihrer Rubrik "Forschung und Hochschule" veröffentlicht.
Sorry für die schlechte Qualität des Fotos, aber die Auflage war natürlich sofort vergriffen und ich konnte lediglich einen schnellen Schnappschuss der Seite machen.
Die Weihnachtsfeiertage sind überstanden, die kurze Erholungszeit zwischen den Jahren ist auch schon um.. was bleibt noch zu tun? Ach ja, das neue Jahr begrüßen.. Ich wünsche euch einen "Guten Rutsch" und ein schönes Jahr 2008!
