leah blogs: Ruby

24mar2010 · chris blogs rebooted

After ages, suddenly chris blogs got rebooted!

I finally trashed my old blogging software Nukumi2, and moved chris blogs onto the same small script that also empowers Trivium.

A few things have changed or had to be changed:

  • Haloscan is gone, thus comments are gone for now as well. I thought they’d migrate to Echo transparently, but that at least seems to be broken.

  • The RSS feed and the Atom 0.3 feed is gone. All feeds now redirect permanently to the Atom 1.0 feed. Welcome to 2010!

    I won’t promise to blog more here now, but at least I’m not blocked by some old software I need to save from bit-rot.

Some trivia on the fork: It went down from 172 LoC to 162 LoC, 65 insertions/73 deletions, which proves my point that every blog has special needs and thus a custom script is worth it. Keeping backwards compatibility (no significant link should be broken) added lots of complexity.

NP: Princeton—Shout It Out

28sep2009 · Back from Curucamp 2009

I just came home from Vienna where I attended Curucamp 2009, the probably most unconference ever. ;-) We were about thirty people, and there was a fair share of interesting talks. Of course, there was a lot of socializing, too. We had real luck with the weather. And there even was a head measuring contest!

If you are interested in my slides about Simplicity in Code, you can find them at the usual place.

NP: Pearl Jam—Unthought Known

22aug2009 · Why I use the MIT license

The internet probably is the closest thing to working anarchy mankind ever had. I don’t want to, and I don’t see any point in restricting other peoples’ freedom. Since 2004, I therefore license all my new code under the terms of the MIT license or comparable licenses (notably the Ruby license).

I do this for pragmatic reasons. I’d prefer to do it like Bernstein, but this is unfortunately a lot more hassle for non-private users of my software. Using MIT is also easier than creating my own licenses. The MIT and the ISC license fit my idea of software licensing best. I mainly use MIT because it’s more popular and well known.

I have evaluated putting some works into the public domain (or license them as CC0), but I can’t do this easily for various reasons: First, I live and code in Germany, where you can’t place things into the public domain without already being dead for a long time. Second, I do not want to give up all my moral rights, because then the code can actually be used against myself (mainly “any distortion, mutilation or other modification of, or other derogatory action in relation to the said work”, I don’t care about the rest). I do not know if this matters in real life, and I hope it does it not, but I don’t want to risk it. (Still, I think CC0 is the most important recent addition to the license landscape.)

(In general, I’d even prefer if my code was regarded authorless—which does not mean I don’t care about it. But neither I don’t care at all what you do with the code, and I’ll not endorse it nor want to be identified with it in other ways—especially if you distribute modified copies! I’ve been considering anonymous or pseudonymous releases for these reasons. Again, pragmatism strikes: apart from murky and inconvenient ways to release and ensure archival, it is problematic for others that depend on the legal system to use my works.)

I consider it unfortunate that we spend so much energy on licensing debates, clarification of terms and persecution of violation. Rather, let’s code. As long as there is a single available copy of free code, its freedom is kept and can be multiplied at no cost. For code that is worth anything, it will.

I realize “bad guys” don’t cease to exist—whether they “steal”, don’t share, lock up code, or have business models in mind you don’t like. But it’s not my fault they are that way, and neither it is my job to “teach them lessons”. Good deeds have to come from yourself, and why should I not give anyone the possibility to do so.

Thus, more power to you! Now go forth and do whatever you think is right.

NP: Danger Mouse—Revenge

10may2009 · Devil's RailsConf 2009 Dictionary

[This seems to be an appropriate literary device to reconstruct an event which makes it hard to remember in which order things happened. Also, it’s easy to be silent on certain things I have nothing to say of as well as just rant a bit here and there.]

888 Noodle Bar: has good and comparatively cheap lunch at ☞Las Vegas Hilton.

A Hat Full of Tricks with Sinatra: Blake Mizerany shows how to make a really good tutorial: By knowing your stuff well and being an eloquent speaker, you can nicely adapt to the speed of the audience. No preparation required.

Barry Manilow: the superstar of ☞Las Vegas Hilton. Use Barry Manilow key cards to open your door. Buy Barry Manilow water and Barry Manilow energy drinks at the hotel’s own Barry Manilow shop.

Bellagio: less tasteless hotel with a nice buffet and fountains.

Box Lunch: euphemism for serving cold sandwiches every day.

CabooseConf: a room where people read their email.

Carpet: The only thing not carpeted in ☞Las Vegas are the roads. One wonders why.

Continental Breakfast: euphemism for toasted bagels and cream, along with empty coffee containers.

Envy: excellect place to have Steaks at.

Keynote: Chris Wanstrath’s keynote reads so well I regret having missed it.

Las Vegas: The paradise of ADHD patients, the land where neon grows outside, the most tasteless city of the world. Not found here: dogs, birds and people reading books. Also, anything to not make you spend money.

Las Vegas Hilton: an off-strip hotel with that vintage 80’s porn feeling that the eponymous daughter lacks. Full of ☞Barry Manilow.

Mist: Place to be smoking a hookah if you need to wake up 6 hours later to get your flight.

Nobu: excellent place to have Sushi at. It was just perfect.

Rack: the hottest thing at the Conference. Not these. Really, I didn’t see a single talk that did not mention Rack.

Rails 3 and the Real Secret to High Productivity: DHH makes me go “I told you so” non-stop for an hour.

Rails Core Panel: Are you guys letting Yehuda turn Rails into Drupal?

SOCKS over SSH: Way to surf when the Conference ☞WiFi HTTP proxy goes down. On one occasion I had 500kb/s for myself.

Sexy Blackjack: good luck trying to find it in ☞Las Vegas.

Smacking Git Around – Advanced Git Tricks: Scott Chacon shows how to make a fast-paced and really comprehensive presentation where everyone can learn something.

SpaceQuest Bar: at the heart of ☞Las Vegas Hilton, this is where I made $123.50 out of $7.50 with Video Poker.

Speakers Lounge: a room where people read their email, not always out of coffee.

Superbook Deli: serves ice cream at 4am, just in time when you return from downtown ☞Las Vegas after a few bottles of Jägermeister and ☞Sexy Blackjack.

Tempo: Bar at ☞Las Vegas Hilton that serves a nice Old Fashioned.

The 4-hour Workweek: EPIC FAIL by Timothy Ferriss. I wish I logged #railsconf during that talk, it was the best part (mail me your logs, if you have them, please).

The GitHub Panel: best panel, all questions answered (and pre-collected) and fun to listen to.

What Killed Smalltalk Could Kill Ruby Too: Finally a good (standing-ovation!) keynote, by Robert Martin. Even if I don’t agree with all points, allowing to make a mess easily is a problem in most languages I like.

What Makes Ruby Go: An Implementation Primer: Charles Nutter and Evan Phoenix go into relevant implementation details and lighten a few dark corners: Who knew super was that weird?

WiFi: inexistant for free outside, and highly limited at the Conference. (Seriously, if you do a tech conference for over 1000 people, why do you only get a 20mbit line?!)

Finally, I’d like to tell everyone at the conference, whether they paid lunch, dinner, drinks or the whole trip as well as everyone I spent nice hours with: thank you very very much! I had a great time, and I’m looking forward to meet you at a less crazy place.

NP: Sheryl Crow—Leaving Las Vegas

01may2009 · Off to RailsConf 2009

RailsConf 2009

Tomorrow I’m flying to Las Vegas to attend RailsConf 2009.

If you’d like to meet up, feel free to contact me.

Also, you should visit the panel I’ll speak at: Tuesday, May 5th, 2009: The Future of Deployment, “This panel is a chance to get forward thinkers from all the different parts of the Ruby web stack in one room.”

There likely will be a Rack hackfest (half the core team is there), maybe as part of CabooseConf or even more informally. Stay tuned and watch out for tweets.

NP: Bob Dylan—It’s All Good

25apr2009 · Rack 1.0 has been released!

Today we are proud to release Rack 1.0, which was close to almost be codenamed MiddleWarem4Ever.

See the full release announcement with change log.

Thanks to everyone that helped development!

NP: Bob Dylan—Chimes Of Freedom

30mar2009 · Upcoming talks

It’s kind of conference season again! You can see me speaking at these events:

RailsConf 2009

I’m looking forward to meet you at these events.

All material will be posted on my talks page of course.

NP: De los Muertos—This Changes Everything

19feb2009 · Review: Lighttpd

by Andre Bogus.
Packt Publishing, Birmingham 2008.
223 pages.

[Full disclosure: I have received a copy of the book in exchange for this review.]

The web server Lighttpd has become rather popular in the last few years and thus it was just a matter of time someone wrote a book about it. Packt published Andre Bogus’ book in October 2008. I review the first edition.

After a short overview of what Lighttpd is, the book starts with a chapter about installing Lighttpd. It is fairly detailed and contains installation instructions for many Linux distributions as well as how to install from source. It explains which configure options there are and which dependencies one needs to take care of.

Chapter 2 deals with basic setup of Lighttpd. After a quick overview of how to run Lighttpd the book dives into the configuration files. This chapter includes a short tutorial into regular expressions (PCRE style) as well as they are essential for rewriting/redirecting URLs and configuring specific parts of your site.

Chapter 3 explains how to set up CGI and virtual hosts. It gives an overview of the three modules for virtual hosting and explains how to use each one (mod_simple_vhost, mod_evhost, mod_mysqlvhost). Then, it shows how to setup and configure CGI, FastCGI and SCGI backends. While the setup is explained pretty well, I missed a section on debugging CGI, especially since this can be quite tricky at times. While not really part of Lighttpd, I’d also have expected a quick explanation on how to setup virtual hosts in the domain name system.

Chapter 4 is about serving and streaming static files, a task which Lighttpd really was made for. Traffic shaping, securing downloads with tokens and FLV streaming are addressed here.

Chapter 5 explains logging and log formatting as well as user tracking. Again, it would have been nice to mention more tools: there is a whole section on click stream tracking but the reader wont learn about any tool he can use to make sense of this data.

The next chapters are about security: Chapter 6 shows how to setup SSL with self-signed keys, an own CA, or by buying a certificate. This chapter is a bit too short and doesn’t detail debugging SSL, either. Chapter 7 tells how to secure parts of the site with passwords and the various authentication backends as well as how to avoid DDOS attacks by using mod_evasive. Chapter 8 explains how to run Lighttpd in a chroot, possibly separated from the backends.

Chapter 9 is about optimizing Lighttpd. The author uses http_load to benchmark the web server and shows a few options that can be configured in Lighttpd and the underlying OS (Linux and BSD are addressed) to make it faster. Elementary caching is explained as well. This chapter ends with an rather useless section on how to profile Lighttpd with gprof but doesn’t explain how this would help you to speed up your web server.

Chapter 10 (available online) is about migration from Apache. The reader should have no problems moving simple to medium complex Apache setups to Lighttpd, given that he can workaround the lack of .htaccess in Lighttpd. This section also tells how to use Lighttpd as a reverse proxy to forward requests it cannot (yet) take care of to different web servers.

Chapter 11 shows how to setup a few common web applications: Ruby on Rails with mod_fastcgi, Wordpress, phpMyAdmin, MediaWiki, Trac, AWStats and AjaxTerm. Apart from the last, they all use mod_fastcgi, which makes this chapter not very exciting.

Chapter 12 and 13 contain really original content that is not found easily on the net: Extending Lighttpd with Lua scripts (Chapter 12) and with C modules (Chapter 13). The author gives a short introduction to Lua and provides a few examples of using it to script Lua with mod_magnet: a random file server and a shoutbox are implemented. Chapter 13 introduces the Lighttpd API and shows how to write the random file server as a Lighttpd module. There also is an example of a module that adds proper doctypes to HTML pages.

The book concludes with an overview of HTTP status codes and a list of all Lighttpd configuration options.

Conclusion: The book is pretty compact and therefore occasionally too shallow. But it is well researched (I found no serious technical errors and just the few typographical goofs that are especially annoying in source code but seem to be unavoidable in modern technical books) and documents all aspects of the actual Lighttpd configuration. It includes many well-commented examples and code snippets. I would have wished it provided more detail on debugging configurations, setting up web servers beyond the actual Lighttpd configuration and modern application deployment (reverse proxying, load balancing…). Also, I found the index of the book rather lacking (for example, there is no mention of “Content type” in it). The stressed administrator may rather straight turn to Google or the Lighttpd wiki (which explains all options as well) than trying to find them in the book. Last but not least, I’d like to remark that the book is part of the “Packt Open Source Project Royalties” and the Lighttpd project gets “some of the money” Packt makes from each sale.

I can recommend the book to administrators and web developers that are new to Lighttpd but already have some experience in setting up web servers/web applications and who would like to get a good overview of the possibilities Lighttpd provides. Due to the last two chapters, the book also can be interesting for people that want to extend Lighttpd.

Rating: 4 of 5 points.

NP: Crash Worship—Bajo la Piel

05sep2008 · A RailsConf Europe 2008 diary... NOT

Around RailsConf Europe in six words.

Sunday: Arrival by train, St. Oberholz.
Then All-you-can-eat, Tacheles top floor. Yay.

Monday: St. Oberholz, Bratwurst on Rails.
Taught Geoffrey how to use zsh.

Tuesday: Vietnamese dinner with Sean O’Halpin.
Then RejectConf at Pirate Cove (Arr!),
Then to Ambulance Bar and Tacheles Garden.
To bed at about 5 am.

Wednesday: Deutsches Technikmuseum, dinner at Marx.
Then Ambulance Bar, Tacheles first floor.
To bed at about 6 am.

Thursday: Dinner at the Ständige Vertretung.
Then Ambulance Bar (See the pattern?).

Friday: Flight home, way too early.

Thanks and greetings wholeheartedly go to:
Scholle5 for the apartment and WiFi,
Members of #caboose I stayed with,
for the good time and community,
Geoffrey Grosenbach for his unhidden praise,
Sean O’Healpin for dinner and beer,
All barkeepers in previously mentioned places,
Yikes, I accidentally my whole fleshlight!

See you all in near future.

Almost overheard: Rails is getting stale.

NP: Queen Adreena—Princess Carwash

30aug2008 · Off to Berlin

Busy packing my stuff to travel to Berlin where I’ll play lobbyist at RailsConf Europe 2008 (i.e. I don’t have a ticket.)

Please contact me if you want to meet up, I’m there until early Friday morning and have lots of free time.

I’ll be taking my EEE PC with me, so mail and IRC ought to be available, given I find some free WLAN (no deal).

I’m staying with Jarkko Laine, Cristi Balan, Andrei Bocan, Manfred Stienstra, Eloy Duran, and Lars Pind. Gonna have a good time.

Anarchaia will resume publishing Friday, September 5.

NP: Queen Adreena—Medicine Jar

08aug2008 · Taming $RUBYLIB with the Z shell

Ok, I’m fed up. Writing a good package manager for Ruby is a fight against windmills.

So let’s do the easiest thing that could possibly work. Redefining Kernel#require is a no-go, for it will lead to the gates of hell. Installing multiple projects to the same location is error-prone, requires non-trivial amounts of code and introduces packaging effort.

Luckily, most packages these days run directly from a checkout or their released archives (and if you provide neither, you’re doing it wrong). Essentially, all you need to make it convenient setting and manipulating $RUBYLIB, “A colon-separated list of directories that are added to Ruby’s library load path ($:).” The Z shell (1, 2) to the rescue!

Add this to your .zshrc (or .zshenv, if you want it in non-interactive shells as well):

# unique, exported, tied array of $rubylib to colon-seperated $RUBYLIB
# 08aug2008  +chris+
typeset -T -U -gx -a RUBYLIB rubylib ':'
rubylib-add()   { rubylib+=("$@") }
rubylib-del()   { for i ("$@") { rubylib[(r)$i]=() } }
rubylib-reset() { rubylib=(); [[ -f ~/.rubylib ]] && source ~/.rubylib }

This creates a zsh array rubylib which value reflects $RUBYLIB and vice versa (zsh does the same for $PATH and $MANPATH, for example), and defines three functions to add and remove paths as well as reset the variable.

Also, create a file ~/.rubylib where you set the defaults. I simply use:

rubylib-add ~/projects/{testspec,bacon,rack}/lib
rubylib-add ~/src/{camping,markaby}/lib

Remember, you can use the full power of zsh to set this:

rubylib-add ~/src/rubystuff/*/(lib|ext)(/)

You need to use (x|y) instead of {x,y} here to only expand to existing files. The final (/) ensures these files really are directories.

Reload your .zshrc, and voila, your packages are accessible from every Ruby script. Now, if a project has different requirements, just create a script there to adjust $RUBYLIB. Or use vared to interactively change the load path.

[Thanks to et for improving rubylib-del.]

NP: Curve—Dirty High

21may2008 · Review: Practical REST on Rails 2 Projects

Practical REST on Rails 2 Projects
by Ben Scofield.
Apress, Berkeley 2008.
284 pages.

[Full disclosure: I have received a copy of the book in exchange for this review.]

The book, targeted at intermediate and advanced Rails users, starts with a chapter “Why REST?” that tries to explain how REST helps interconnect applications and reflects the structure of the web. As examples for such connectivity a few mashups are presented. The author states that APIs can make web applications much more useful and interesting, but costly to develop. He contrasts REST with XML-RPC and SOAP. Finally, the basics of REST are outlined: It is a client/server architecture based on stateless requests that describe and transform resource representations. The author argues that REST makes it easier to develop clients and servers and extend these applications in the future, last but not the least because REST is implemented well in Rails 2.

After demonstrating the use of (deprecated) ActiveWebService, the author shows how these ideas are expressed nowadays in Rails 2, outlining the history of simply_restful. He continues by explaining the new styles of URI routing that also dispatch on the HTTP method like map.resources/map.resource/nesting and map.namespace. The author also addresses Rails’ support for multiple output formats and new helpers related to routing. Scaffolding is discussed and will be used in the book. At last, there is a mention of ActiveResource to use RESTful Rails applications together.

The third chapter develops the main application of the book dubbed MovieList. It is used throughout the rest of the book. MovieList, a site that informs about movies and their releases, lets users express their interests and displays when new movies with the same actors are released. The code is not developed test-first, but the downloadable code contains a test suite. Occasionally the code is pretty weird, for example it defines setters that are merely called for their side-effects using #update_attributes. In some places, explicit iteration over ActiveRecords would have been solved better by doing it in the database. Also, the generated HTML is partly unsemantic and hard to scrape (which is not that bad if the data can be reached by the API, you may argue). The author explicitly defines notifications and interests for the movies to belong to the logged-in singleton user (they reside at /user/interests, not /users/:id/interests), supposedly so one cannot see other people’s interests. In later chapters, he decides however to at least revert this for notifications—it would have been better to properly design it in first place, as it actually is a nice feature and more RESTful anyway (can you speak of “current users” in a stateless request, really?) and show how to protect the page for users that don’t want to allow it to be seen. The author mentions at the end of the chapter that a “great deal of planning, testing and other work has gone undescribed”; wouldn’t it have been useful to have these parts in the book as well? The actual architectural concerns of REST applications are not really mentioned in the book.

The next four chapters deal with accessing the MovieList applications from other technology. Chapter 4 uses JavaScript to provide a widget users can embed on their homepage and shows how to do full-fledged access to the application using AJAX after extending it to support JSON. Chapter 5 shows how to access the site using the PHP framework Squidoo. During this, a feature is added to allow users to display the movie releases within a time frame. This is the code used to parse the relative time, and I’m not kidding:

raw_time = params[:time] || '1 month'
time = eval("#{raw_time.sub(/ /, '.')}.from_now")

How this gaping remote code injection hole passed any kind of technical review is a miracle to me. Ironically, the next section is called “Injection Flaws”, and addresses SQL injection and so-called “HTML injection”, which actually is passing anything you want as parameters. The author then decides to “fix” it by checking the time parameter in the PHP script calling the Rails application. Duh.

Chapter 6 builds an client for the iPhone, optimized to its interface constraints: a small screen, popup keyboard and lower bandwidth. It uses the commonly used approach of defining a new Rails format that is triggered by a special subdomain or by user agent sniffing. The chapter shows how to use iUI to make the interface look native, too.

Chapter 7 shows how to embed the application to Facebook either by using iframes or the FBML. I have no idea how the contents of this chapter are related to REST, especially since the FBML approach actually calls everything using POST.

Chapter 8 is called “Dealing with success” and is about making the application faster and more robust. Apart from the classic caching approaches (which work very well in REST due to the idempotency of GET, but see below) and foreshadows of denormalization, it contains a few general hints on Rails and database performance. It also addresses throttling access to the API by using API keys and setting up auditing to monitor the site.

Finally, Chapter 9 tries to place “Rails in the enterprise” and explains the chances, but also the problems of REST and Rails in the enterprise. It contains a small example of how to create a RESTful interface for a SOAP backend.

Conclusion: Generally, I found the book lacking. Instead of shifting focus to the design and architecture of real-world REST applications and showing up the patterns that can be used to help development, the book shows how to combine a simple CRUD application with half a dozen of buzzword loaded Web 2.0 stuff. The semantics of REST are only half-heartedly addressed (a third of page 13 discusses what the HTTP methods mean), the idempotency of GET merely assumed (it’s actually in a parenthesized half-sentence on page 72), and the actual means of applying REST (proper status codes, correct/multiple content types) are not made explicit. Instead of wasting over 15 pages on screenshots unrelated(!) to the application and another 2 pages on showing a WSDL that is very much useless, the reader would have had more benefit from a table of HTTP status codes and content types. Also, writing a REST client in Ruby is not addressed by means other than (the limited, non-general) ActiveResource.

I think this sounded too negative, please bear with me: The book is okay. It’s well written, and if you like a whirlwind tour of Web 2.0 things one can do it’s a good read. It’s just not really about REST, or at least not what I’d expect of a book about REST.

Rating: 3.5 of 5 points.

NP: Dandi Wind—Hostages

17may2008 · Workshop on Self-sustaining Systems 2008

These are my personal notes from the Workshop on Self-sustaining Systems (S3).

[A quick note beforehand: The descriptions make use of a metric called “lines of code” (LOC), which widely is regarded as being insufficient for measuring program size. Due to lack of better means, I decided to mention them nevertheless. Take them with a grain of salt.]

The conference started after lunch, but we got there earlier so we had the chance to socialize with the HPI people already.

Ian Piumarta gave the first invited talk on his Late-bound lambda object architecture, wherein he decided to fight the fact that software tends to become too complex by finding out how much you can say with how little. He started by contrasting the three cubic miles of paper that is the US case law to Maxwell’s four tiny equations which are able to fully explain all electromagnetic phenomena.

Moving to software, he showed the source code line counts of some popular projects, and we could see, for example, that OpenOffice.org has more lines of code than the entire FreeBSD operating system. Comparing lines of code with the size of literary categories, he decided that 20kLOC, which roughly resemble a 400 page roman, are the maximum size of a program a programmer has the chance of fully understanding.

He continued explaining how it is possible to get much done in such a limited amount of code by showing off how simple things like shape rendering, which only consists of a few elementary transformations, is enough to render fonts and essentially provide a full graphical interaction system.

He gave a quick tour of other interesting ideas to be further investigated, such as multiple subjective perspectives, which result from the realization that objects have several roles, or regarding computation as “fields” (re)acting on particles, a concept which makes it easy to specify complex interactions between many objects.

Since predicting anything is difficult, he argues that it highly important to be as dynamic as possible, by using the fewest minimal abstractions that allow for any possible feature/paradigm to be added to the language/system.

His design combines functions and objects into the foundation of his system, COLA. Functions, represented as s-expressions provide the proto-behavior, while proto-structure expresses form by providing objects that messages are sent to. They provide the dichotomic base, since without function, form cannot be animated while function has no representation without form. This results in a self-describing structure.

(Actually, after the talk he told me they are trying to unify functions and objects into one thing, I’m very curious about the result.)

His talk was larded with memorable insight such as looking at GTK+ and noticing “C is highly deficient and wasteful” or encouraging the students to look at the “old” papers where technology was severely limited because “sometimes progress is behind you”.

The next talk was by Christophe Rhodes, who spoke on SBCL – A sanely bootstrappable Common Lisp. After a short overview of Common Lisp, he summarized the history of SBCL, which started as a fork of CMUCL in 1998. The main reason of the fork was that CMUCL was horrible to bootstrap and it actually wasn’t possible to compile CMUCL without already having the last version of CMUCL before that.

Christophe Rhodes emphasized the importance of a system being able to rebuilt itself from a “blueprint” since it makes the result a lot clearer, easier and predictable. He showed an example of a bug in a core data structure which was easily fixed by changing the structure and recompiling the system—without the ability to rebuilt from scratch, magic hackery would have been required to modify the existing structures to be compatible enough until they could replace themselves.

SBCL nowadays can be compiled using half a dozen of different CL implementations and does, once built, not any dependencies on the build environment.

This unusual level of self-sustainability has many benefits: it is more fun, enables quicker turnaround, makes the system more future-proof, and doesn’t limit improving the core of the system to hackers with magic abilities. Instead, every developer can work on the code because in the end it’s just another big Lisp program. Because of this, more people can help with the system and maintain it, thereby having more control over the destiny of the system as a whole.

Charlotte Heerzel was the next, presenting Reflection for the masses, in which she showed how to implement 3-Lisp using CLOS. She noticed that programming languages are made powerful by abstractions, but there are cases where one wants to get rid of them, for example if you need access to the current continuation.

Reflexive languages, on the other hand, allow the programmer to control internalization, normalization, and externalization within the language.

She showed lots of code, implementing a small Lisp interpreter in CPS and then adding structural reflection by exposing the internal data structures as abstract data types and behavioral reflection by introducing reflective-lambda, which has access to the current continuation, environment and code. For example, this allows to implement when as a first-class function.

The first day ended with two social events: first, there was a boat trip around Potsdam, where I had the great luck to sit on a table next to Richard P. Gabriel and Pascal Constanza. We had a long interesting discussion with them about the lack of (helpful?) limitations in programming, what designers really do, how Java became popular, the danger of the obvious and demonising copy and paste programming. I learned one thing about how rpg decides which poems to publish, which I cannot keep back:

Richard P. Gabriel writes a poem each day, and once a year, he needs to select six of them for publishing (six seems to be the usual amount the publisher wants). So how does he do it? Using a computer, he randomly picks sets of six, until all of them don’t suck. Then he sits down and revises them.

We crystallized this as the essence of design: to choose the things that don’t suck.

Afterwards, we had a dinner buffet on a restaurant boat until night.

The next day started with Daniel H. H. Ingalls (say it in German!) demonstrating The Lively Kernel – a self-supporting system on a web pagex. He admitted that web programming is complicated, but implementing Morphic in JavaScript seemed like an easy thing to do. While he explicitly mentioned that he is not proud of the code, he thinks it’s easy enough and works well.

The whole Lively Kernel is rendered using dynamically generated SVG and doesn’t include any (visible) HTML at all. All drawn stuff are vector objects. In good Smalltalky manner, the system uses MVC extensively.

After a short demonstration with some turtle graphics and live-code editing, he pointed out some of the non-obvious features of it: For example, to support multiple people working on it, they introduced a change-set format for JavaScript which allows to check in modified parts of the system into version control. Also, they have a pretty sophisticated system for profiling by dynamic method rewriting to insert measuring code.

The whole Lively system at the moment is a mere 10kLOC of JavaScript and already includes many details such as rich-text-boxes.

On the topic of security, Dan Ingalls proclaimed that his security philosophy was like this: “Make it work, then make it secure, and I hope someone else does step 2.”

Carl Friedrich Bolz presented a joint-work of eight Pythonists and Squeakers titled Back to the future in one week – Implementing a Smalltalk VM in PyPy which they started in October during a five day sprint.

PyPy, initially a Python implementation in Python, but now moving towards a general compiler tool-chain, enables one to write highly flexible language implementations because most things are late-bound. Therefore, garbage collection, object layout and the threading system can be exchanged easily and allow for lots of experimentation. PyPy aims to autogenerate dynamic compilers from interpreters written in a reduced set of Python called RPython with nevertheless allows full-fledged compile time metaprogramming.

They already implemented all Squeak bytecodes and most of the primitives. The resulting system, SPy, can load unmodified Squeak images and run simple benchmarks. It is roughly 10x slower than Squeak itself, and they plan to support the graphical builtins in the future as well.

The team continued hacking on SPy in a sprint in Berlin just after the S3.

Guillermo Adrián Molina next introduced Huemul, a Smalltalk implementation that directly generates native code. It is a very small system of only 4.5kLOC since it doesn’t try to do everything but instead reuse existing code. For example, he uses libc, pthreads, setjmp/longjmp, GTK+ for the UI and OpenGL. The system is MIT-licensed and inspite of lacking real optimizations already pretty fast: It runs roughly 832 million bytecodes/s and therefore is comparable to the performance of commercial Smalltalk systems.

Huemul looks very interesting and certainly is a thing that deserves more attention.

Are bytecodes an atavism?, Theo d’Hondt wondered when he noticed that people are fixated on virtual machines: They think it’s the only way to write a fast system.

However, interpreters are the simplest way to express the semantics of a language.

After a glimpse of the history of bytecode from BCPL over Pascal-P to Smalltalk, Self and Java, he presented Pico, a tiny language implemented using CPS that is smaller than Scheme that was roughly as fast as PLT Scheme (as of 2004)

Based on his experience with Pico, he decided to write PicoScheme, which is written in a subset of C and works by compiling s-expressions into an abstract syntax tree that then is interpreted. Soon he realized that “Scheme isn’t all that simple to implement”, but now he has a very promising implementation of the most parts of Scheme (nothing really relevant is missing) that is as fast as PLT by now. It also is very compact: the GC only has 150 LOC.

After the talk, he promised to open PicoScheme to the public in the future.

The last talk was called On Sustaining Self by Richard P. Gabriel. I only can recommend to take any chance to hear him speaking because he’s doing excellent presentations—I’m unable to do his audio-visual impressions justice, so please excuse the rough sketches: The talk started off with playing Hogni Lisberg’s cover of “All along the watchtower” while Noble and Biddle’s eternal words of their Manifesto in “Notes on Post-Modern Programming” appeared on the screen. “There must be some way out of here!”

The ultimate goal of all computer science is the program. The performance of programs was once the noblest function of computer science, and computer science was indispensable to great programs. Today, programming and computer science exist in complacent isolation, and can only be rescued by the conscious co-operation and collaboration of all programmers.

There are three ways to build self-sustaining systems according to Gabriel: First, Designed Perfection, which is what most people try to do today; it is very efficient, but entropy will get you. Second, Instinctual Adaption, which is resilient and flexible. Third, Learning, which is costly, but gives the best results in a highly dynamic environment.

A poem assembles on the screen; to brilliant guitar music there appears:


and it morphs into:


He proclaims:

Abstraction ignores the relevant,
therefore it requires ignorance!

He does a case-study on Levittown, which overcame the limitations and plannedness of itself and turned into a non-designed suburb.

He presented a case of artificial evolution showing the FPGA evolution experiment that generates very effective chip designs that nobody really understands how they work.

Finally he enters an dialogue with himself asking “How are cities designed?” At first look, they look modular, but they are so full of interconnected dependencies that they are impossible to modualize really. Also, the nature of the city is not planned.

In the end, the recognizance: Design is an illusion.

(I highly recommend you to watch the video when it is online.)

Summary: Attending the conference has been a great pleasure. Although being rather short and small (only one-and-a-half days and maybe 50 attendees), there were top-notch invited talks and many important people (and also many unknown, but friendly, clever and interesting ones!) around that everyone simply could talk to. The social events were well organized (free dinner, free beer) and actually allowed to socialize.

I seriously hope S3 can turn into a periodic conference because I’d really like to attend it again.

[Let’s also mention the not-that-good-stuff, just for the sake of completeness and so you see there’s not much to dislike: introductionary marketing speeches; the “Workshop” in the name misrepresents the conference; occasional WiFi failure.]

NP: Bob Dylan—I Believe In You

13may2008 · Off to Potsdam: Attending S3

Tomorrow I take the train to Potsdam to attend the Workshop on Self-sustaining Systems (S3), which means I get the chance of meeting rpg and many other people that worked on Lisp, Self and related cool stuff in real life.

The stuff I’m working on got not finished by far, but maybe I can write down enough on the train to explain it to interested parties.

If you want to hook up, don’t hesitate to contact me. I’m there until Saturday morning.

Anarchaia and chris blogs will resume publishing Sunday, May 18.

NP: Manu Chao—Politik Kills

29mar2008 · Celebrating Three Years of Anarchaia!

It has been another year of your favourite (near) daily favourite dose of links, IRC quotes, lyrics and quotes?

Lots has happened in that time! Tumblelogs really turned mainstream, new platforms like Soup appeared, and tumblelogging was featured at the Telegraph, Chaosradio Express and Rails Podcast.

Time for the yearly statistics (previous year in parentheses):

  • Anarchaia as of today consists of
    • 996 posts (669)
      • 18499 snippets (13555)
        • 12797 links (9445)
        • 2100 pictures (1440)
        • 1148 IRC quotes (979)
          • 610 #ruby-lang quotes
          • 371 #ruby-de quotes
          • 34 #rpa quotes
          • 17 #rubyist.org quotes
          • 14 #haskell-blah quotes
          • 10 #haskell quotes
          • 10 #lisp quotes
          • 82 other quotes
        • 1860 lyrics (1242)
        • 379 quotes (311)
        • 205 thoughts (138)
    • totaling 4.8 megabytes, 443416 words and 85119 lines.

Thanks for all your kind mails, contributed links and other pleasantness. I still enjoy it as much as I hope you do as well.

However, Anarchaia will have to change in the future: when my study begins (roughly October), I won’t have the time any more to do a daily issue. But I will try my best to make at least a weekly version of it.

Now, on to another year of tumblelogging!

(BTW, chris blogs turned four this week as well. 48 posts this year and still no new blogging software. I’m working on it, really!)

NP: Grotus—Good Evening

24mar2008 · Off to Seelbach

Tomorrow I’m going to leave early for Seelbach deep in the Black Forest where I’ll spend the rest of the week educating myself on civil service (which I finished for two thirds already, but hey, who cares).

Anarchaia and chris blogs will resume publishing Saturday, March 29.

Please notice that this means I will not be able to attend Euruko 2008 in Prague this year. That’s sad, but I can’t help it (not that I’d have anything to talk about). Enjoy the program.

Regarding conferences, I am planning to go to the Workshop on Self-sustaining Systems in May and RailsConf Europe in September (I hope there will be a CabooseConf Europe, really).

I expect to have occasional Internet access in Seelbach, else mail will have to wait. It’s my first travel with the EEE.

NP: Grateful Dead—Promised Land

04feb2008 · Introducing gitsum

The major showstopper before I was seriously considering going to Git was the lack of an darcsum-like interface for Git.

Yesterday night I finally decided to write it.

git-status (included as git.el in the Git distribution) is usually good enough to use, but I often like to do partial commits, that is, commit only parts of a file. Git can do that now for some time, using git add --interactive or frontends like git-hunk-commit or git-wt-add. Still, there was no way to do it conveniently in Emacs.

Let me introduce gitsum:

Gitsum screenshot

You can freely delete hunks you don’t want to commit, split big changes, or even edit the patch directly if you feel adventurous. It also integrates into git-status so you can easily switch between these frontends.

Gitsum is hosted at http://github.com/chneukirchen/gitsum (which I highly recommend) and is mirrored at http://git.vuxu.org/, patches and additions are welcome! It’s still very fresh and has some rough corners, but I already notice my increase in productivity.

NP: Twelve Tone Failure—As I Hit the Floor

18jan2008 · Review: Ruby on Rails Enterprise Application Development

Ruby on Rails Enterprise Application Development
by Elliot Smith and Rob Nichols.
Packt Publishing, Birmington 2007.

[Full disclosure: I have received a copy of the book in exchange for this review.]

The book targets Rails beginners that have a little prior knowledge of Ruby and Ruby on Rails and aims to accompany them on their way to Rails mastership. It focuses on the iterative and stepwise development of a small CRM system for a small company. Since the chapters don’t anticipate, it can be read straight forward, while the reader continuously learns and refines his skills.

It starts with a general introduction on why to use a web-based client-server architecture for business applications, and then recommends Rails to implement them, last but not the least because it is open source and enables easy testing.

Next, the reader is introduced to basic database design, elementary normalization and how Rails’ ORM works. Then, it discusses Rails naming conventions and includes a list of reserved words in Ruby. A list of reserved class names is unfortunately not included, it would have been very helpful since Ruby already claims some very generic class names (Date, Thread, etc.).

Contradictory to the introduction, now nevertheless follows a tutorial on how to setup and install Rails. The book was written before Rails 2 and generally speaks of outdated versions, however, most of the content is not affected by this—still, there may be some traps if one tries to follow it with more recent Rails versions. After setting up Rails, the installation of a database (MySQL throughout the book) and a revision control system (Subversion) is explained.

After these preliminaries, a Rails project is created and the book explains the Rails directory structure. Tables are set up, migrations introduced, and the reader learns about the essential ActiveRecord API with finds and relationships. Validations are addressed as well; the regular expression for email checking is broken. After a quick overview of unit testing and Test::Unit (TDD is discussed but not used), the reader can check in the code for the first time.

Now, they generate controllers, introduce ERB and pagination (using the built-in paginate), how to do links and layout and furthermore how to use partials and flash. The chapter also shows how to write functional tests.

The application is ready for a first deployment. After an overview of the typical Rails hardware requirements, the book explains how to set up Mongrel.

The next chapter focuses on user experience. The authors introduce routes for better bookmarking, show how to add search and input validation and finally give examples of using AJAX for autocompletion. They also point out that AJAX should be used sparingly and only when it makes sense. The chapter also makes an excursion on how to setup Instiki as a help system.

After this, the book deals with improving error handling, authentication (for which they use unsalted password hashing) and file uploads. After displaying a primitive version of file uploads, it is shown how to install plugins and how to use acts_as_attachment.

Then, more serious deployment gets addressed. They introduce Capistrano, explain how to set it up and then use it for upgrading, downgrading and database-related tasks. A list of common problems is provided to help fix likely issues. The authors also explain how to install automatic start-up scripts, session cleaning and log rotation. The rest of the chapter deals with optimizing the Rails application: how to find and identify the bottlenecks with profiling and how to speed up Rails with the different kinds of caching available or by using eager loading. Finally, they also address scaling by using multiple Mongrels and Apache as a reverse proxy and static file server.

The last chapter, “Down the Track” tries to school the reader when it’s okay to break Rails’ conventions. They give situations where the use of custom SQL or using multiple databases is required or advantageous. The chapter also outlines general virtues of a business application developer, such as the importance of understanding the business processes, that successful applications primarily need to yield profit, that automation is good, and reporting important.

The book is concluded by an appendix showing how to setup your own Gem server.

Conclusion: The book does not satisfy the introductory claims: it is often too detailed on the basics and too shallow on the crucial things and sidetracks the reader into unimportant issues. The writing is occasionally clumsy and sometimes overuses the passive voice to incomprehensibility. Some code examples are syntactically invalid and a few Ruby-related commentary plainly wrong. Throughout the text, replace all occurrences of “property” by “attribute” and of “ampersand” by “commercial at”. Various other mistakes sprinkle the book, occasional typos, random font changes and weird spacing suggest the book was produced in a hurry. People with typographic sense will be shocked by the table of contents and complete and the utter lack of typographical quotes. The few illustrations are reproduced in a very low resolution.

Still, the book may be useful for Rails beginners that are interested in the development of an “enterprise application” and would like to know what else there is to keep track of. The complete Rails newbie however will stumble due to the preknowledge of Ruby, whilst the slightly advanced Rails developer will hardly learn anything new and would be better off with specific books on deployment or system administration to extend his knowledge.

Rating: 3 of 5 points.

NP: Minutemen—Love Dance

01jan2008 · Unsubscribing ruby-talk

To: ruby-talk-ctl@ruby-lang.org
Subject: unsubscribe
From: Christian Neukirchen <chneukirchen@gmail.com>

I finally got around unsubscribing ruby-talk, which has a feeling of both pity and relief. I didn’t read it for the last months, and only skimmed the overgrowing thread list. There was no way to keep up.

What I don’t want to miss are the software announces, therefore I set up a quick’n’dirty RSS feed to keep me up to date.

It’s been over three years and more than 800 messages. See you somewhere else.

(Of course, I’ll continue to post my ANN’s there.)

NP: Morcheeba—Fear and Love

12nov2007 · A Euruko 2007 diary

Friday afternoon: Flight FDH–VIE

Intersky sucks: it’s expensive, uncomfortable, and sitting next to the propellers of that small machine was no fun. The weather also sucked and made the flight feel more like a rollercoaster than a bus ride. Motto of the flight: “Ich beschwöre euch, meine Brüder, bleibt der Erde treu” (… and “Verächter des Lebens sind es, Absterbende und selber Vergiftete, deren die Erde müde ist: so mögen sie dahinfahren!”.)

Friday evening: Das Lederer

Euruko almost DDOS’ed Das Lederer, the Viennese restaurant we went to in the evening. The waiter planned for 15 people but then we were 60. ;-)

Also, I finally met Manuel in real life. We figured out that I read his del.icio.us network more often than he does.

Friday night: Metalab

After dinner and a few beers, we went to the Metalab. This is a seriously great place. Where else can you solder, etch boards, develop photos, cook dinner, surf the web, read Concrete Math, smoke, have 8-bit color lighting control, drink Club-Mate, meet guys creating a Web 2.0 porn site (NSFW) or the best hosted tumblelog solution, play kicker, and maybe even make meta-LSD?

If you ever get to Vienna, going there is a must-do IMO if you are geeky.

We stayed at the Metalab until 4:30, then we walked to the flat, and took the tram for the last few stations—if you don’t have a ticket, you can just buy one there. Very nice.

Saturday morning

Roughly four ours of sleep later I head to the university, miss the entrance and walk around it once. It’s a great building with huge staircases and marble columns, and actually the second-oldest university of Europe, which Jürgen Mangler tells us in his introduction about this year’s host, the University of Vienna. There have been four initial fields back in the fourteenth century, which were theology, jurisprudence, medicine and philosophy. The computer science department actually belongs to the jurisprudence, which is weird. He goes on and speaks about the Viennese coffee culture and that good waiters must be mean. After his intro, we decide what talks there will be and in which order.

Hal Fulton is chosen to give the keynote, Future of Ruby. After a short recap of the Ruby history (Hal was one of the first ten Ruby users in the US), he shows the growth of the community by using the ruby-talk as a metric. Then, he shows which new features are planned for 1.9 and 2.0. There also are many new implementations of Ruby going on, which focus on speed and interoperation. In his opinion, Ruby is enterprise ready for a long time. He also wants to see Ruby on handheld and phones. Notable quote: “If you have to work on Java for eight hours a day, you go home and kick your dog.”

Next, Tim Becker presented a small library of his, Dbrb, which is a very simple DWIM API for doing SQL things in Ruby. He’s not a fan of Rails and ORM in general, and DBI is very complex to use. Therefore, he decided to create a really simple SQL library, which he first tried to hack into Ruby strings etc. to make it invisible but then he just defined a method, cleverly named sql, which does everything. With it, one can easily query and change data using SQL without all the messy details. There also is profiling support to help you find bottlenecks. Dbrb is a seriously cool idea because I think all direct database interfaces for Ruby are much too complicated and I hate myself for not having the idea in the first place. Sometimes, things almost are too simple.

David Anderson presented his Informl Wiki, which essentially is a Wiki with support for forms and database objects. He demoes a portal for King Louis XIV and shows how easy it is to make simple CRUD apps and entry forms. They have a cool wikish and simple markup format for forms and one can do database queries and report generation with it as well. You’ll find it here.

In the lunch break, we had some pizza.

Then, Ramine Darabiha and Sven C. Köhler demonstrated Mysit.es, which aims to provide a central data storage for all your Web 2.0 sites and they showed how to create a new service with it. Lots of Myfoo.es-jokes came up, the one I like most is “Myfec.es — Put your shit online, literally.”

After this, I gave my talk Introducing Rack. The material is online, so I’ll not go deeper into Rack here.

Stephan Kämper talked about Transitions next up, which he classified into social, qualitative and quantitative and personal ones. He showed that Euruko itself is full of transitions, and how they matter in daily life. He also showed that there are many transition effects in Keynote.

Kingsley Hendrickse spoke on Riess Automation, which is a library to script the Internet Explorer using COM. He didn’t like Watir anymore, so he decided to write Riess, which is better designed, has a nicer DSL, is quicker, has builtin assertions and also can work without JavaScript. He accesses the DOM via COM directly and provides a CSS selector like API to do assertions on the DOM. He also quickly demostrated Hyperdrive, which can be used for testing any Win32 application. As well as “automating tasks in World of Warcraft”, that is.

Then, Peter Szinek gave a presentation on ScRUBYt!, which is a DSL for writing web scrapers, a task generally known to suck. However, with ScRUBYt!, which uses Hpricot and WWW::Mechanize, it becomes fun again. His examples at least looked a lot simpler than the usual scraping code I’ve seen. There also is Firescrubyt, which uses Firewatir (to talk to Firefox) and Scrubyt and can be used to scrape AJAXy sites.

The last talk on Saturday was Martin Grund on Easy DSLs with Ruby, where he explained what DSLs are and showed how to create a simple, lispy, external DSL with Dhaka. Then, he demoed a DSL he’s been writing, RMQL, which is a kind of simplified XQuery.

Saturday evening: Universitätsbräu

This evening, I had my first Schnitzel and after some beers, Jürgen Mangler and I started hacking some deepish metamagic trick which we would talk about the next day then.

After dinner, we went to the Metalab where we stayed until half past three and then went home—where I talked to Jürgen and his girlfriend and we tried to explain her what we hacked in the evening.

I went to bed short before five o’clock, whereas they went to see an episode of Stargate. Yeech.

Sunday morning

I woke up after another four hours of sleep, but since I tried to be polite, I didn’t wake Jürgen, which made us be late, which was a bit troublesome because he had the key to open the conference place. ;-)

Jürgen and I presented our yesterday-late-hack, **super: an exercise in drunken programming*. Instead of *foo and bar, we used food and beer as metavariables.

The following talk was by Kingsley Hendrickse again, this time on BDD with RSpec. After explaining the idea behind BDD a bit, he tried to develop an address book in a pair-driven BDD style. That is, he’d write the tests^Wspecifications and someone in the audience would write the code. They didn’t get very far, though. Probably everyone had not had enough sleep

Next, Paul Battley spoke on Fun with trees. He tried to find similar product names for work and needed a fuzzy string match for that. After showing a few well-known algorithms how to do that (Soundex and Metaphone, for example), he introduced metric trees based on the Levenshtein distance, which results in a so-called BK-Tree. He explained how to build, query and use them.

Stephan Kämper talked on Quality in code after, since there has been lots of discussion about “beautiful code” recently. He referenced Zen nnd The Art of Motorcycle Maintainance, and showed various small Ruby hacks on how to make more beautiful code.

Then, Hal Fulton quickly presented a Proposal for an in operator in Ruby. Fine with me.

In the lunch break, I had my second Schnitzel at the Cafe Einstein.

Tim Becker spoke on DTrace, which really is impressive. There are 45k different things in Leopard you can probe for and he showed how to write D scripts (which reminds me a lot of awk) to discover various things. He showed how to inspect Ruby with DTrace in a high-level way. Very powerful stuff.

After that, Ry Dahl gave a talk on Ragel & Ruby, where he first explained what Ragel is, when to use it and how state machines work. He showed pieces of Hpricot for explanation purposes. Ragel can generate multiple languages, but the recent Ruby generator is very slow, but useful for development and experimentation.

Martin Grund and others showed Twizzr then, a recreational game they wrote the night before. It’s a few hundred LOC camping application that is well tested. Twizzr is a quiz game interfacing via Twitter. One recieves news headlines and needs to figure out the obscured word in them. They had some problems with the Twitter API because it limits to 70 messages per hour.

The last talk was by Sacha Schlegl on his ebXML implementation with a very clever name: Hefeweizen.

Then, Euruko 2007 ended and I have to say I really had a great time this year. There was a very friendly and open atmosphere as well as an excellent location in the University of Vienna where they have WLAN that works and enough multiple sockets for everyone. I hope everyone of the roughly 70 people that attended (there even were a few girls, contrary to last year!) enjoyed it as much as I did.


Song of the weekend: LaborCase—Vanille (heard at the Metalab).

There were no videos made this year, but if you really want to see a video, search for two girls one cup (NSFW).

NP: Bob Dylan—Winterlude

Copyright © 2004–2022