chris blogs: January 2006

29jan2006 · xoxo-rb 0.1 released

For this week’s Ruby quiz, I ported xoxo.py and the result is:

xoxo.rb, a XOXO parser and generator for Ruby

xoxo.rb is a Ruby library for loading and dumping data as XOXO, an simple, open outline format written in standard XHTML and suitable for embedding in (X)HTML, Atom, RSS, and arbitrary XML.

xoxo.rb is a straight port of the functionality of xoxo.py, but with an API more similar to Marshal and YAML.

Darcs repository (“darcs send” is welcome for patches):
http://chneukirchen.org/repos/xoxo-rb

Download xoxo-rb 0.1.0 now at:
http://chneukirchen.org/releases/xoxo-rb-0.1.0.tar.gz

NP: Bob Dylan—Driftin’ Too Far From The Shore

28jan2006 · Announcing Fugi

My first Rails application goes live! It is a 2ch-inspired forum software with an emphasis on short, anonymous posts and a never-seen-before two-dimensional layouting. Just when Joel’s off-topic forum shuts down, Fugi goes live. This happened incidentally (and yes, I think I know about (one of) the reasons), but people are welcome to come over. As well as everyone else.

“Fugi” is japanese and means: bring up a matter, discussion, debate, but also: immorality, injustice, misconduct, adultery. We’ll see how this turns out.

Want to check it out? There you are: http://fugi.anarchaia.org

There are still some rough edges, especially with respect to IE, which I’ll fix later. Also, it’s not completely feature complete (especially tagging discussions needs to be added), but there aren’t too many things to appear in the future.

Fugi is comparatively restrictive in terms of markup and formatting; this is by incident. All I should add is some way to have <br />s, that will ease entering code. This is by design, I want to see how people still are able to hack it and produce amazing ASCII art and other unimaginable things….

Fugi also likely will replace the HaloScan comments of “chris blogs” and add a new way to talk-back for Anarchaia.

Please spread the word and happy discussion!

NP: Wir sind Helden—Müssen nur wollen

23jan2006 · Dextrine, Telefonanieren und Platon

Auch das neue Jahr bleibt nicht von Quotes verschont, wenn auch sich die Frequenz derer wohl senken wird, da entweder nix lustiges passiert, ich in einem anderen Kurs bin oder die Quotes so unverschämt sind, dass, wären sie so modifiziert um veröffentlichbar zu sein, sie nicht mehr lustig sind. (Junge, wer den Satz ohne Stocken lesen konnte und dann auch noch verstanden hat, hat ein gutes Leseverständnis.)

Nazi Goreng

DextrineDes isch wie Latrinen, nur mit Dex-.

[neue chemische Bindung:] Shishu-Bindung (bekannt nach dem indischen Chemiker “Hapkeine Shishu”)

Albino-King Kong und die schwarze Frau.

Telefonanierwerbung

[meint den Film:] Try getting rich and die…Try singing…

Ich find Platoon besser als Platon.

Was ist die Bedeutung der PCR? [meint: Polymerasekettenreaktion] — [Schüler meldet sich:] Ach nee, der Fußboden war PVC.

Metaphysik der Titten

Türkischer RasenBeschneidet sich selbst.

NP: Wir Sind Helden—Bist Du Nicht Müde

18jan2006 · Getting on a running train

Sometimes I feel so low-down and disgusted
Can’t help but wonder what’s happenin’ to my companions,
Are they lost or are they found, have they counted the cost it’ll take to bring
All their earthly principles they’re gonna have to abandon?
There’s a slow, slow train comin’ up around the bend.
—Bob Dylan, Slow Train

I’ve been doing Rails for three days now (for a project you’ll soon hear of), and, while it was not my first attempt to get started, it certainly was the most successful one.

[Please take the following with a grain of sand, according to rails stats, I already wrote 119 lines of code with Rails. :-)]

The pain kept within reasonable limits, it’s no problem to install Rails without RubyGems by adding an appropriate link for vendor/rails, table pluralization can be disabled easily too (I didn’t do it, though, it’s actually pretty comfortable), mostly, it stays out of my way.

The biggest problem so far is not my lack of understanding something, but not knowing what actually exists. Often, there are useful helpers you just need to know of. Sometimes I wish I had gotten into Rails earlier, so I could have tracked development and wasn’t just run over by it now.

According to Phil Karlton, the two hardest things in Computer Science are naming and cache invalidation. While I didn’t yet touch the latter one with respect to Rails, I certainly hit the former.

Naming the models is comparatively easy, even if some names that I’d really have liked to use are not possible because Ruby already has classes with that name (what do you call a group of posts, if Thread is already taken?); naming controllers is very hard for me, I’m not sure why.

The second biggest problem is fighting with ActiveRecord; in fact, I think all my problems so far can be reduced to wrong use of ActiveRecord. I just hope we will get along better together in the future. (Once you got it to work, it’s pretty nice, of course.) Maybe my database schema was a bit too difficult for a first use. (Featuring self-referential entries etc.)

Finally, an admission: I actually started writing the application five days ago. After fighting with ActiveRecord for a short time, I gave up and wrote an CGI (whopping 483 lines of code). Then, I decided to give it a try again and rewrote it in Rails. That was easy then, of course. The schema just had to be adjusted marginally, the HTML and styling already was done. This may not be the worst idea to get into Rails, provided you have an appropriate application.

So here I am, I think I got on the train, let’s see if I manage to find a seat or get kicked out at the next train station…

[This post was titled “Selling my soul for a train ticket” first, but I decided that would be a bit too negative. ;-)]

NP: Ton Steine Scherben—La Response

12jan2006 · Playing Ogg in iTunes

For a long time I sticked to iTunes 4—not only because it looked far better, but also because it had Ogg Vorbis support using qtcomponents, which used an old API that wasn’t supported in more recent versions of iTunes.

Since a fairly big part of my music collection is encoded in Ogg, I simply didn’t update iTunes. However, QuickTime 7 files are more and more taking over the web, and QT7 conflicts with the old iTunes.

This dilemma recently was solved with XiphQT. XiphQT allows for playing back Ogg Vorbis and Speex in every application that uses QuickTime (including Safari).

Installation is trivial, all you need is to get the package from the XiphQT site and install it like any mpkg. Be sure to already have the updated iTunes installed. If you are on OS X 10.3, XiphQT will work too but you may have to reboot to make QT detect the plug-in. (I simply installed it before rebooting anyway.)

XiphQT works very well in my experiences so far, while qtcomponents always seamed to jerk a bit.

Oh, one more thing: Once you have iTunes 6.0.2 installed, be sure to disable the MiniStore by clicking the leftmost button on the right bottom. Else, iTunes will transmit all clicked-on songs to external servers.

NP: Antony and the Johnsons—You Are My Sister

06jan2006 · Keeping your home clean with "mess"

During daily usage of Unix-like systems, users tend to create a lot of temporary files: say, outputs of scripts you want to re-use, one-shot scripts that were too long for the command line, sources and build directories of programs you want to try, papers you downloaded for later reading, video files you want to play using an external program…

These files tend to aggregate in your current working directory and clutter it up. Soon, everything in that directory becomes messy and you never ever manage to really clean it up—it’s just too messy to get a proper overview.

Most novices—among them me in my earlier days of Unix—tend to have ~, the home directory, as their default current working directory, thereby messing up their whole home directory. Don’t do that.

In later time, I moved over to /tmp for all my needs of messing around, but on every system crash or unintentional reboot, /tmp gets cleared on OS X—while not directly a loss of data (you aren’t supposed to keep anything really important in the mess directory), you really wanted to keep the temporary data around for some time.

Therefore, I tried something different, and I’ll try to outline its use and implementation:

The “mess”system of keeping your home clean works using a small helper script mess.rb (written in Ruby for no good reason, a shell script would do) and a ~/mess directory in your home directory. This mess directory has a structure like this:

~/mess/
    2005/
        48/
        49/
        50/
        51/
        52/
    2006
        01/
    current --> 2006/01

There is a directory for each year, containing a directory for each running week in the year. A link ~/mess/current links to the current week, mainly for convenience.

The script mess.rb (download) is accompanied by a small bash function, mess(), which you add to your .bashrc:

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

This function simply runs the mess.rb and changes the working directory to whatever mess.rb outputted.

What mess.rb does is probably clear, I constructs a path based on the current year and week, creates a directory with that name unless it already exists and finally updates the ~/mess/current link to reflect the current directory. Therefore, whenever you feel like messing around, type mess and enter your weekly sandbox.

Within this sandbox, only a few rules^Wrecommendations exist:

  • You should not access files of the weeks before directly, instead move them once to the current week directory.

  • If you need to access a file you already moved, put it into an appropriate folder in your home directory (or create one if you don’t know where to put it).

  • Every sunday evening, remove left-over build directories and other big files (podcasts, videos, etc.) you don’t need anymore.

You can ignore the third recommendation if you don’t care about disk space.

Now, if you follow these rules strictly, what is the result? Old week directories do not contain important files anymore (because they either are in newer week directories, or cleaned up already). When you want to reclaim the disk space, you simply back them up onto a cheap medium (use whatever you prefer), and remove them. My weekly directories here average at about 40 megabytes in cleaned up state (up to 1.5 gigabyte if big builds took place). There are between 150 and 1200 files in them.

Why did I choose to make a new directory every week? I think weeks are a good time range: months definitely would be too long to keep an overview, and days would be unreasonably short (I didn’t try days yet, if you feel adventurous, try it and report).

This is the way I keep my home directory clean and still can mess around however I like, I’ve been using the method since November and I’m very satisfied with it so far.

(I’d like to know if anyone knows how I can put the symbolic link ~/mess/current into the sidebar of the open dialog in Mac OS X, it always tries to resolve it…)

NP: Bob Dylan—Sweetheart Like You

Copyright © 2004–2016