# The unknown format, 3

The popular web server Apache does not deliver .svg or .svgz files with the correct headers, with the consequence that no browser will be able to render .svg line art directly. Fortunately, there is an easy fix.

To my dismay, dhttpd suffers from the same limitation. Thanks to Haui, who created a patch, and piet, who applied it, this dhttpd delivers .svg line art correctly -- allowing me to display facts and figures in an aesthetically pleasing way while retaining a snappy response even for low-bandwidth connections. :)

# The unknown format, 2

Oh well...you would expect that "good" file formats are supported by all major applications. Right?

Surprise, surprise. Ever tried to export a plot as svg in Mathematica? Works perfectly...and the resulting svg is perfectly empty.

How do we get an svg in these cases? Probably, the least problematic way starts with the creation of an eps, i.e., an encapsulated postscript (without preview, please). Importing this eps file in scribus and exporting it as svg already constitutes the end of the least problematic way.

Alternatively, you may want to try the canonical way: pstoedit -f plot-svg infile.eps outfile.svg. Or eps2svg from Justus Piater. Or OpenOffice Draw, which does an acceptable job in many cases (but in other cases, it exports png images embedded in an xml file as svg :/).

For me, scribus worked flawlessly. The high-resolution plots obtained by clicking on the respective images below are, by the way, smaller than their own preview. Cool. ;)

# Complexity

People often confuse symmetric and asymmetric encryption, particularly with regard to the key length. There are, however, fundamental differences between these two distinct encryption schemes. Their key lengths cannot be compared in a straightforward way.

In symmetric encryption, the complexity C (the key space, which attackers have to search) is basically identical to the key length. In asymmetric encryption, C is much lower than the key length as a consequence of the different mathematical algorithm required to allow an asymmetric encryption scheme at all.

The fastest method for searching the key space of, e.g., the RSA encryption technique, is of course still exponential (and the problem is presumably still NP complete), but the exponent is sublinear in the key length n in bits.

The left figure shows C (the effectice key length) of the RSA algorithm vs. n. As you see, the complexity of AES 256 (the NSA "top secret" classification) is out of reach for RSA.

The right figure shows the same thing assuming the existence of a quantum computer with a sufficient number of qubits (right now, 8 qubits are the state-of-the-art). You see that working quantum computers would render asymmetric encryption into a relict of the stone-age (they would also accelerate decryption of AES and the likes, since that scales as O(n^½). This attack, however, is easily counteracted...just double your key length.)

# Select lines

The script described just below always integrates the whole spectrum. What if you want to select a part of it? The easiest way to select a certain number of lines in a file is this one:

head -n $last_line$filename | tail -n $nr_of_lines  Note that nr_of_lines=$(($last_line-$first_line+1))


# Poor Man's Integrate

Well, not so poor after all. If you have data you'd like to integrate, such as spectra of any kind, there's no need for octave or other numerical software (at that point). You can do that with the bash. How? Easy:

 1 2 3 4 5 6 7 8 #!/bin/bash sum=$(awk '{sum +=$2} END { printf ("%f\n", sum) }' $1) points=$(cat $1 | wc -l) firstx=$(cut -f 1 $i | head -n 1) lastx=$(cut -f 1 $i | tail -n 1) delx=$(calc $lastx-$firstx) int=$(calc$delx*$sum/$points) echo $int  The command 'calc' refers to any of the one-line calculators described here. The script integrates the second column ("$2") of your data file. Save it as 'pmi' and call it with 'pmi data.dat'. The script takes 90 ms for 100000 values on my machine (measured with haui's great 'time' program). Haui might be able to reduce this execution time to a mere blink of the eye by perl magic. 8)

# Goodbye, Chrome

SunSpider Javascript Benchmark

 konqueror 4.1.0 3.7 s VMPlayer 2.0.5 running Suse 10.3 chrome 0.2.149.29 4.4 s VirtualBox 2.0.0 running Windows XP SP3 opera 9.60 b1 4.9 s native firefox 3.0.1 7.0 s native seamonkey 1.1.11 10 s native opera 8.54 12 s VMPlayer 2.0.5 running Windows NT4 SP6 firefox 2.0.0.16 12 s VMPlayer 2.0.5 running Debian Etch konqueror 3.5.9 26 s native IE 6 56 s VMPlayer 2.0.5 running Windows NT 4 SP6 IE 7 62 s VirtualBox 2.0.0 running Windows XP SP3

No comment.

# Terminus

I like anti-aliased fonts, I really do. But not in the console! I was never really satisfied with my console font until I found terminus. Have a look: left, the monospace default; right. terminus. I think it's just perfect.

# The unknown format

We are used to it, but if one just thinks about it one moment, it's actually totally weird: often the worst ist the most popular. Take operating systems, for examples, or browsers. Or image formats.

Let's consider a very simple example such as a circle on a transparent background. Saving that as an SVG takes, regardless the color, 4.2 kB, and as an SVGZ 1.3 kB. An acceptable approximation of this line art for the web requires about 19.5 kB as PNG. As a GIF, the size is reduced to about 10 kB, but naturally the color isn't accurate. One can reduce the size further by using the JPG format, but to come even close to the size of the SVG original, one has to accept extreme artefacts.

Still, the JPG and GIF formats dominate the web. Oh...I forgot: the IE cannot display SVG images even in its soon-to-be 8th incarnation. Fortunately, Wikipedia decided to go along and to publish much of their line art in the SVG format.

# Visibility

Sometimes one would like to emphasize the output of a script, be it for better visibility, or just for fun. There are two very easy ways to do that:

• color
• ASCII art :)

The commands

echo -en "\033[1;33m"
figlet Danger, Will Robinson!
echo -en "\033[0m"


will give you a yellow text in giant, ASCII art letters once you have installed figlet.

# Transparent or pseudo-transparent?

There are currently lots of people who seem to favor the Linux desktop not for technical reasons, but for aesthetic ones. Well, there's nothing wrong about that. You may also like Mickey Mouse for its intellectual merits, or Uncle Scrooge for being philanthropic.

Just kidding...I'm the first to agree that the Linux desktop can be the most aesthetically pleasing of all, and I also perfectly agree with the idea that this fact is important for user acceptance. However, .... well, frankly, nobody I know gives a shit about user acceptance.

In any case, it seems that at the moment Compiz is the most (often singular) seductive element for Linux newcomers. It is simply fashionable to install Ubuntu (sometimes Linux 11) and to get excited about wobbly Windows and the Cube (TM). If people express a certain indifference about these features, the unfailing argument of Compiz aficionadas is: but it enables true transparency!

Hey, it even gets worse. On Ubuntu sites, one finds nonsense like: "With only Compiz Fusion and Gnome-Terminal you can have a transparent terminal that looks like it is part of your desktop."

Now, I very much like my terminals to be transparent, as well as my gkrellm. Pseudotransparent, that is....and I really do not see any reason for truly transparent terminals. I want them to be an unobtrusive part of the desktop, and not to be on top of one or dozens of other windows. What would I gain from that? Nothing but a headache since I'd get confused by the letters below.

Well, just have a look at my desktop, anyway:

A (pseudo)transparent rxvt, as the three on the left, is obtained with following command:

kstart --window one --windowclass URxvt --skiptaskbar --skippager --type Dock --onbottom urxvt +sb -bl -tr -fg white -bg black


If you prefer the xfce terminal, start it with the following options:

terminal --geometry 85x35 --hide-menubar --hide-borders --hide-toolbars


To the best of my knowledge, there are only two transparent gkrellm themes. They are called invisible (from Paul Cannon) and transparent (from Piotr Esken-Temski). The one you see in the above screenshot is a customized version of Piotr's theme ;)