chris blogs: March 2007

27mar2007 · Celebrating Two Years of Anarchaia!

How quickly the went the two years with your (near) daily favourite dose of links, IRC quotes, lyrics and quotes? It’s hard to believe.

And, in this second year, tumble logs really became popular, not at least due to the help of Tumblr, the first tumblelog hoster open for everyone! The Tumblelist is almost running over!

Of course, you ask for the yearly statistics (previous year in parentheses):

  • Anarchaia as of today consists of
    • 669 posts (336)
      • 13555 snippets (7353)
        • 9445 links (5003)
        • 1440 pictures (763)
        • 979 IRC quotes (657)
          • 584 #ruby-lang quotes
          • 255 #ruby-de quotes
          • 33 #rpa quotes
          • 17 #rubyist.org quotes
          • 10 #haskell-blah quotes
          • 10 #camping quotes
          • 70 other quotes
        • 1242 lyrics (590)
        • 311 quotes (251)
        • 138 thoughts (89)
    • totaling 3.4 megabytes, 61320 words and 316340 sentences.

I’d like to thank all my readers for their kindness, thankful mails and popularity-increasing links. I hope you enjoy it as much as I do—every day anew.

Now, on to another year of tumblelogging!

NP: Dead Moon—Destination X

26mar2007 · Three Years of "chris blogs"

This blog is now three years old, and I guess it will stick around for some more time, but I don’t blog as much as I did in the beginning anymore. Mostly, because I don’t have interesting things to say.

Let’s look at some interesting facts:

  • The 5 most played artists of the year were:

    5 Tom Waits
    4 Bob Dylan
    4 Pearl Jam
    3 The Smiths
    3 Ton Steine Scherben

  • The raw entries are 2.1 megabytes in 445 files (62 posts this year.)

  • Nukumi2, my blog software, has not been touched in this year. This shows it’s proven, but also essentially dead. I’m only planning the next platform so far.

  • I only posted 36 quotes out of real-life this year (698 total).

Now, on to the next year of blogging! (And I got to prepare some things for an even bigger celebration tomorrow…)

NP: Ane Brun—Rubber & Soul

25mar2007 · Switching to zsh

With the help of the nice folks in #ruby-de, I finally switched to the Z shell after using GNU Bash for over seven years (with a rather short tcsh intermezzo, admittedly).

I’ve wanted to do the switch for some time, but I never managed to make it familiar enough for daily use (the default setup is unusable). Well, I now got a reasonable .zshrc together, and want like to share some parts of it.

Completion is the most awesome feature of zsh, although the recent Bash versions are steadily coming closer. Let’s enable the completion:

zmodload zsh/complist
autoload compinit && compinit

I don’t want it to think // means anything special, though:

zstyle ':completion:*' squeeze-slashes true

Add colors like in ls(1) for the file name completion:

eval `gdircolors`
zstyle ':completion:*' list-colors ''
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}

And then, make the completion feel as Bash-like as possible (show all completions after two TABS, don’t cycle, put the prompt always below the completions):

setopt BASH_AUTO_LIST
setopt NO_AUTO_MENU
setopt NO_ALWAYS_LAST_PROMPT

History management, this is essentially how I configured it for Bash too:

setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
setopt APPEND_HISTORY
setopt EXTENDED_HISTORY
HISTFILE=~/.zsh_history
SAVEHIST=1000
HISTSIZE=1000

The prompt, I used a rather bloated prompt with Bash; this is a stripped-down version with everything removed I don’t need. (And the monochrome version.)

PROMPT="%(?..[%?] )%(1L.%L.)#%h<%l>%m:%(4~,.../,)%3~%(!.#.$) "

How it looks, for example:

[1] 2#276<p5>lilith:.../rack/lib/rack$

This means, the last command exited with status 1, it is a second-level subshell, line 276 of history (for !), running on ttyp5 on my trusty iBook lilith, and I’m a normal user ($) in the rack/lib/rack directory on my disk (I know where that is).

I don’t use a right-hand-side prompt at the moment because I think it’s confusing, especially if your terminal isn’t very wide.

Terminal title, using a precmd. Host and path are enough for my purposes.

precmd () {print -Pn "\e]0;%n@%m: %d\a"}

Z line editor, zsh’s version of readline has a very good Emacs keybinding support which we’ll enable and configure it to regard / as a word seperator too (highly useful for editing paths):

WORDCHARS=${WORDCHARS//[&=\/;!#%{]}
bindkey -e

Mess, finally, mess dir support for zsh:

function mess {
  DIR=`~/bin/mess.rb "$@"`
  [[ $? -eq 0 ]] && cd "$DIR"
}

That’s essentially it; as you see, nothing really special but it’s a non-trivial configuration I’m very comfortable with so far.

Now, what benefits does zsh give me?

  • Mighty globs (** alone is worth the switch).
  • A good multiline editor.
  • Ready-made completion of just about everything.
  • Better redirection (shortcuts like |& for 2>&1, which I always get wrong).
  • Control structures I can remember (for x (1 2 3); echo $).
  • Better scripting (I don’t really do shell scripts anymore, tough).
  • Tetris. Ehem.

The only thing so far I couldn’t find out was how to disable file name escaping in the completion list, but that’s a minor aesthetic feature. Feel free to tell me if you know how that can be fixed.

Addition from January 19, 2007: zsh supports UTF8 line editing if the locale is right. For English messages, therefore set LANG=en_US.utf8 as LANG=C will not work.

NP: Guns N’ Roses—There Was A Time

17mar2007 · Meilensteinfestschulbüchereiausverkauf

Heute feierte das Wieland-Gymnasium ein Meilensteinfest dank rezenten Schulleiterwechsels.

Dabei wurde auch die Schülerbücherei aufgelöst (oder zumindest dezimiert), und man konnte die Bücher zu Spottpreisen vor dem Container retten. Ich jedenfalls habe diese zwölf Bücher für 2€ gekauft (in absteigender Größe, mit Datum der Auflage):

  • Walter R. Fuchs, Knaurs Buch der Denkmaschinen, 1969.
  • Heinrich Tietze, Gelöste und ungelöste mathematische Probleme, 1964.
  • Siegfried Heinrichs, Mein schmerzliches Land. Gedichte, 1978.
  • Egmont Colerus, Von Pythagoras zu Hilbert, 1940.
  • Hermann Hesse, Der Steppenwolf, 1974.
  • Jack Kerouac, On the Road, 1978. (Mein Lieblingsbuch.)
  • John Steinbeck, Grapes of Wrath, 1955.
  • Ernest Hemmingway, A Farewell to Arms, 1948.
  • C. D. Kernig, Person und Revolution: Marx – Lenin – Mao, 1973.
  • Ephraim Kishon, Wie unfair, David! Satiren, 1971.
  • Dr. Wolfgang Krull, Elementare und Lineare Algebra, 1959, Sammelband.
  • G. E. Lessing, Nathan der Weise, 2000.

Trotz tausenden englischen Grammatiken und Stilbüchern konnte ich keine Ausgabe von Strunk and Whites The Elements of Style finden. Schade, aber hat sich trotzdem gelohnt.

Und ich komme irgendwie zur Erkenntnis, dass der richtige Zeitpunkt um eine komplette Liste aller meiner Bücher zu machen bereits vorbei ist…

NP: Tom Waits—World Keeps Turning

11mar2007 · The day editors became handaxes

For some reason, almost everyone is hot about Ruby IDEs nowadays.

However, I still prefer using a “classic” editor, and I edit just about everything with it.

A Handaxe

The editor is a lot like a handaxe. It’s an old tool, but it’s proven, and can be used in a lots of ways: hitting something, cutting meat, opening fruits. And, I can (and do!) use it to create other tools. It’s a sharp and powerful tool. Also, my handaxe is customized just how I like it. For example, if you are left-handed, your handaxe surely will look different than the handaxes of the others.

On the other hand, a modern IDE is a lot like a wrench. If you needed a wrench, you’d be happy to have one. Trying to turn a bolt with a handaxe will be difficult. But can your wrench drive nails? Maybe if you are good at it. Cut meat? Hardly.

You may now argue that this is a really bad comparison, and maybe you are right. But compare how the intelligent Stone Age man did all his day work with a hand axe, and how the experienced developer does everything with his editor: it’s not that far off. Do you know of a mechanic that only has a wrench?

I like my editor. It fits my needs perfectly, and I can customize everything how I need it.

NP: Tom Waits—Lucinda

03mar2007 · Rack 0.1, a modular Ruby webserver interface

Today I’m proud to release Rack 0.1.

Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

The exact details of this are described in the Rack specification, which all Rack applications should conform to.

Supported web servers

The included handlers connect all kinds of web servers to Rack:

  • Mongrel
  • WEBrick
  • FCGI
  • CGI

Any valid Rack app will run the same on all these handlers, without changing anything.

Supported web frameworks

The included adapters connect Rack with existing Ruby web frameworks:

  • Camping
  • Rails (alpha)
  • more to come soon, …

These frameworks include Rack adapters in their distributions:

  • Ramaze
  • Maveric
  • Racktools::SimpleApplication

Available middleware

Between the server and the framework, Rack can be customized to your applications needs using middleware, for example:

  • Rack::URLMap, to route to multiple applications inside the same process.
  • Rack::CommonLogger, for creating Apache-style logfiles.
  • Rack::ShowException, for catching unhandled exceptions and presenting them in a nice and helpful way with clickable backtrace.
  • Rack::File, for serving static files.

All these components use the same interface, which is described in detail in the Rack specification. You can choose to use them exactly in the way you want.

Convenience

If you want to develop outside of existing frameworks, implement your own ones, or develop middleware, Rack provides many helpers to create Rack applications quickly and without doing the same web stuff all over:

  • Rack::Request, which also provides query string parsing and multipart handling.
  • Rack::Response, for convenient generation of HTTP replies and cookie handling.
  • Rack::MockRequest and Rack::MockResponse for efficient and quick testing of Rack application without real HTTP round-trips.

rackup

rackup is a useful tool for running Rack applications, which uses the Rack::Builder DSL to configure middleware and build up applications easily.

rackup automatically figures out the environment it is run in, and runs your application as FastCGI, CGI, or standalone with Mongrel or WEBrick—all from the same configuration.

Where can I get it?

You can download Rack 0.1 here:

Alternatively, you can checkout from the development repository with:

darcs get http://chneukirchen.org/repos/rack

(Patches using “darcs send” are most welcome.)

Installing with RubyGems

A Gem of Rack is available. You can install it with:

gem install rack

I also provide a local mirror of the gems (and development snapshots) at my site:

gem install rack --source http://chneukirchen.org/releases/gems

Contact

Please mail bugs, suggestions and patches to .

You are also welcome to join the #rack channel on irc.freenode.net.

Thanks to

  • Michael Fellinger, for helpful discussion.
  • Christoffer Sawicki, for the Rails adapter.
  • Armin Ronacher, for the logo and racktools.
  • Marcus Rückert, for help with configuring and debugging lighttpd.
  • The WSGI team for the well-done and documented work they’ve done and Rack builds up on.

Copyright

Copyright (C) 2007 Christian Neukirchen http://purl.org/net/chneukirchen

Rack is freely distributable under the terms of an MIT-style license.

Links

Rack: http://rack.rubyforge.org/
Rack’s Rubyforge project: http://rubyforge.org/projects/rack

Camping: http://camping.rubyforge.org/
Ramaze: http://ramaze.rubyforge.org/
Maveric: http://maveric.rubyforge.org/
racktools: http://lucumr.pocoo.org/trac/repos/racktools/

79b46158b7b30adcd7a9148cc7ed4305  rack-0.1.0.tar.gz
61a51b2f609833f4e0c11213a0070721  rack-0.1.0.gem

NP: Tom Waits—Take Care Of All My Children

Copyright © 2004–2016