This is the archive for December 2007. Recent posts can be found at the main blog page.

Gnome Specimen 0.4 is out!

I have just released Gnome Specimen 0.4, your favourite tool for previewing and comparing fonts on your Gnome desktop.

Gnome Specimen

User-visible changes since the previous release:

A simple preprocessor for CSS files

Anewt, the Almost No Effort Web Toolkit (a collection of PHP libraries designed to aid rapid web development, mostly written by me), offers a simple preprocessor for CSS files, implemented as a Makefile. It is available from the scripts/ directory in the anewt.uws bzr branch, but for your convenience I’ve put up a snapshot over here: css-cpp.make

This Makefile acts as a simple preprocessor for CSS files. It uses the C preprocessor (cpp) to do the actual work. Using this file allows you to use variables (eg. aliases for color names, lengths, sizes, or sets of common properties) in your CSS files.

Since cpp and CSS both use the # character for different purposes, simple substitution (with a very unlikely string) will be done before actually invoking cpp. The % character is used to call cpp directives, so #define and #include become %define and %include, respectively.

Sample input:

%define MY_SHADE_OF_RED  rgb(196,   0,  12)
%define MY_SHADE_OF_BLUE rgb( 10,  42, 240)
html {
background-color: MY_SHADE_OF_RED;
color: MY_SHADE_OF_BLUE;
}

Sample output from the above sample input:

html {
  background-color: rgb(196,   0,  12)
  color: rgb( 10,  42, 240)
}

Usage is simple. First you need to create files with a .csst (CSS Template) extension. The corresponding .css files will be generated automatically, overwriting the existing .css file with the same name. This file may contain defines, includes, and so on.

Now, symlink or copy this file as “Makefile” into the directory containing the .csst and .css files. Then run make:

$ ln -s /path/to/anewt/scripts/css-cpp.make Makefile
$ make css

Alternatively, call make with a parameter:

$ make -f /path/to/anewt/scripts/css-cpp.make css

Or just execute this file from the right directory:

$ /path/to/anewt/scripts/css-cpp.make css

If your own project also uses a Makefile, you can include this file. To do that, put the following line into your own Makefile:

include /path/to/css-cpp.make

Then you have your own targets depend on the targets in this file:

all: css
clean: clean-css

Enjoy!

(This message is based on the comments in the source file, which may be updated in the future. This snapshot is posted to my blog in response to Nicolas Trangez who asked for a CSS preprocessor)

Kopi Luwak

Together with a friend of mine, I wanted to try Kopi Luwak (Civet Coffee), the most exclusive coffee in the world. Luwaks, also known as Asian Palm Civets, are cat-sized mammals living in south-east Asia. These furry animals eat the coffee berries, but the coffee beans themselves pass through their digestive system untouched. The beans are then retrieved from the Luwak’s feces, washed, roasted, and sold for big money.

Yuck, you’d say. It is common wisdom that anything that has been in contact with feces should not be considered healthy. Well, not exactly true in this case. Investigation by food scientists reveiled that roasted Kopi Luwak beans had lower bacterial counts than control beans, most likely due to the thorough washing process involved with the preparation of the coffee.

Luwak

Drawing of a Luwak (from Wikipedia), also known as koffierat (coffee rat) in Dutch, for obvious reasons.

Yesterday I picked up my previously made reservation of 100 grams Kopi Luwak at a local coffee specialities store. For a small cup of coffee, roughly 6 grams of coffee are needed. I prefer doubles though, so I can make roughly 8 decent cups of coffee… plenty for the people who will be drinking this really exquise drink with me.

Though Kopi Luwak is notoriously known for being extremely expensive, it’s not that bad. My 100 grams costed only EUR 18, which is not that expensive at all compared to the price you pay for, say, 8 double espressos in a coffee bar.

Update: No, I haven’t tried it yet. I promised to wait until that friend I mentioned above comes over to try it together with me. For now I’ve put the ground beans inside a tin can and stored that whole lot in my freezer. Hopefully it stays okay for a few days.