It’s so nice to have standards. DocBook is one which is good enough for many uses. E.g., the notes for the linux system and network administration course I’m writing which I mentioned about some posts ago.
So, tell me why if you ask for an SVG image to be right aligned, 5cm wide and to scale height appropriately, the results with, respectively, the Norman Walsh XHTML XSL stylesheets and his same FO stylesheets and FOP, are the following:

The code was:
<imagedata
width=”5cm”
align=”right”
fileref=”stack_tcp_ip.svg”
format=”SVG”
scalefit=”1″/>
I know, I ask much, since I involved SVG, DocBook, XHTML, XSL and PDF all in a single cauldron, but… damn, they are ALL standards! :-P
– 2:15 update
I tried for a while to make things fit well, and they didn’t. So, I chose to make conversion to PNG beforehand. This worked well for HTML version, but gave very ugly results in PDF, which uses higher DPI. So I renounced to a single format, and gave double specification of images in the docbook (why have I used a vectorial format, then…). I tried to include PDF in PDF version, but FOP crashes on it (isn’t able to get information from PDF; the comic thing is that he says in turn: “Content is not allowed in prolog”, “Error while recovering image information” and “GRAVE: Image not available” - a perfect case of exception misunderstanding). So I chose for double version PNG (a 90dpi and a 600dpi one), and this way it worked. Almost. In the XHTML version, the “right” alignment is interpreted as a float, in the PDF, as a normal align. Well, I can’t have everything. All in all, I had to make some four trials, which should have all worked, and instead only one did. *GROWL*.
Posted by mattia as docbook, fo, fop, html, image, svg, xhtml, xml, xsl at 9:35 PM CEST
1 Comment »
Just in case someone is interested, here’s a graph which shows dot’s memory consumption on a random graph with no options as the number of nodes and edges increases, indipendently (click on the image for full view).

Only half of the graph is meaningful, the one on the side on the viewer (this is because I used dove tailing in exploring the node/edge space, and after that half dot run off with a >1Gb-memory-footprint run which OOM-killed it and prevented me to run anymore).
As you can see, the incidence of edges on the memory consumption is exponential, whereas the nodes’ effect is irrelevant. Since I want to graph something with about 50000 nodes and 70000 edges (splinder blog network), I wonder how I will be able to.
Posted by mattia as dot, graph, memory at 3:02 PM CEST
No Comments »
Substantially, this has made me mad. In the current status, you can’t reliably use getElementById on objects returned by an XMLHttpRequest. Useless to say, there’s a way to make things work correctly, but only under Firefox. Sigh.
Posted by mattia as ajax, ecmascript, html, xml at 2:19 PM CEST
No Comments »
I’m doing a course of system and network administration through Linux in a small company. Obviously, the choice for making virtual hosts and networks over which try the theory I taught fall on UML. To be exact, I found the Netkit project to be really promising (a joint work of several people from the Computer Networks Research Group of the University of Roma Tre and from the Linux User Group LUG Roma 3).
All the work is done at a remote server, which is big and fast enough to manage easily many virtual machines (and, most of all, which is reachable through Internet to make it easy for me to test the lesson on the same system on which it’ll be run ^_^). Netkit has many advantages, but by default, as UML does, links its terminal to an xterm.
I didn’t want to use X forwarding or stuff - especially because I run lessons on a Windows XP computer (sigh). So, I had dear putty at hand, and nothing more. Moreover, I wanted for my students to get the habit to use the terminal: they can easily learn to use graphical interfaces by themselves, but god knows how many times I have wished to have a competent person near me to tell me if it was possible to do this and that on a terminal faster when I began, and to discover those things after a lot of time. And if this all sounds to you like I’m a terminal zealot, well, I’m a terminal zealot :-).
So, I thought this setup. Accounts for every partecipant on the UNIX machine (luckily they are not a lot), a common account for making the exercises (an obvious account - username equal to password - but disabled to external access), and the screen utility to run the machines inside.
First problem. Try this:
mat@jericho:~$ su - exercises
Password:
exercises@jericho:~$ screen
Cannot open your terminal ‘/dev/pts/1′ - please check.
Why? because once the terminal device is given to a user - by login, ssh, or whichever mean, ownership is set accordingly. Simple to check:
exercises@jericho:~$ ls /dev/pts/1 -l
crw——- 1 mat tty 136, 1 May 9 00:03 /dev/pts/1
(Sometimes group users are given write permission - that is, users who are in the tty group can write each other messages by writing directly onto other’s consoles with simple “echo”)
So, the solution is simple:
mat@jericho:~$ chmod g+rw /dev/pts/1
mat@jericho:~$ chgrp exercises /dev/pts/1
mat@jericho:~$ ls /dev/pts/1 -l
crw-rw—- 1 mat exercises 136, 1 2007-05-09 00:07 /dev/pts/1
And if you try “screen” as user “exercises”, now it works fine.
The other problem was: how do I connect screen to UML machines? At first I tried a way I found many times on the net:
$ vstart -v –con0=pts star
After that, UML uses a pts, so connecting to /dev/ttyp?, where “?” is a number, gets it:
$ screen -S star /dev/ttyp0
Two problems with this approach:
- the name of the /dev/ttyp? is declared during boot. Netkit boot logs, even when verbose, are not verbose enough to include this information, so you have to guess. Not that it’s hard (first run, /dev/ttyp0, second run, /dev/ttyp1, etc…), but obviously this way you throw away security and get extra work every time you run a virtual machine (I assure you I’ve done it many times even for simple explanations)
- It didn’t work :-) - that is, screen interaction with tools like “less” was ugly, if pts was used. less didn’t understand the size of terminal or something like this, and it did a lot of mess. Try to explain a /sbin/ifconfig -a with some 6 interfaces when you can’t use “less” or “more”.
Ok, so what was the solution? very simple: do not use pts, but use standard input/output. To use standard I/O is told, in netkit, by “con0=this” (and not con0=fd:0,fd:1 as the UML command line would require). Now, the game was to run the netkit machine already inside a screen:
$ screen -S star -d -m vstart con0=this […]
the “-d -m” simply tells screen to start detached. At this point reconnecting to the started screen (screen -r star) gave satisfactory results, with less, more and the family working correctly.
Posted by mattia as netkit, screen, uml at 12:55 PM CEST
1 Comment »