Older blog entries for fxn (starting at number 121)

25 Aug 2002 (updated 25 Aug 2002 at 22:20 UTC) »

Reading

This week I have read Free as in Freedom, I bought the printed version, and have started Literate Programming, which jao lent me (those are friends! :-). By the way, a printed manual of his GNU MIX Development Kit has been recently published by GNU Press.

I need to be somewhat acquainted with agent-based simulation because of a project I am involved in at work. I have found Why Agents? On the Varied Motivations for Agent Computing in the Social Sciences to be a very good introduction to the usefulness of this methodology in the social sciences scenario. It is not quite clear to me how one can capture social behaviour and model it in a way that relevant conclusions can arise, but people seem to be doing it.

Literate Programming

I heard about Literate Programming before, when I studied LaTeX in my graduate days, but the book I mentioned above is arousing a latent interest. I have always felt I am naturally inclined to this paradigm.

Curiously enough, in my daily visit to Freshmeat I've come across the announcement of a new version of Ben Pfaff's GNU libavl, which is implemented in a custom literate programming system called TexiWEB. There is a HTML version of the documentation, I think it's an impressive work.

Music

Music of the day: Steely Dan. They are damn elegant.

23 Aug 2002 (updated 23 Aug 2002 at 23:31 UTC) »

XML-RPC and MyAdvogato

Besides being cleaner, I wonder whether retrieving certificates using XML-RPC would be faster than fetching the personal page of the user and extracting them from it, as we do. If that was the case, MyAdvogato could use XML-RPC if it found any suitable module at run time, and screen scraping if not.

AFAICT, it seems that the current interface doesn't provide a mean to ask for the data we need, however. Maybe I could contribute to mod_virgule a bit here, writing a pair of routines.

Perl Golf

I liked so much refereeing the TPR(0,4c) that I have volunteered to do it again in the forthcoming TPR(0,5), to begin next September 1st. I won't be on vacation and won't be able to expend as much time on it as in the previous tournament, but it doesn't matter, it will be a lot of fun anyway.

21 Aug 2002 (updated 21 Aug 2002 at 23:58 UTC) »

Bram, thank you very much for pointing out pipelining. I have done some trials fetching a pair of pages from Advogato the CGI typically downloads. The sequential way needed 11-19 seconds whereas a persistent connection with pipelining needed 9-12 seconds.

Thus, pipelining is somewhat faster, but more important than that, as far as I have read it seems to me that technique is the one MyAdvogato should employ to fetch the pages. I'll implement it for the next release.

20 Aug 2002 (updated 20 Aug 2002 at 12:57 UTC) »

Not much coding during vacation.

I did trials to rewrite the routine that fetches pages from Advogato in MyAdvogato to use a persistent connection. The CGI downloads two pages usually, the one to be wrapped and the personal page of the user to extract the necessary data, and currently closes explicitly each connection for several reasons. It turned out that there was almost no difference in time, it seems to be dominated by the download of the pages, at least behind this dial-up connection. I don't know whether I'll change the original routine.

Reading

Once finished the second part of LotR, the book I have just begun today is the Spanish translation of John J. Ratey's A User's Guide to the Brain. It is an overview targeted to non-specialists of what neuroscientists know nowadays about how the brain works.

9 Aug 2002 (updated 9 Aug 2002 at 12:34 UTC) »

The TPR(0,4c) finished today at 5 UTC. There was a lot of activity in the last hours, including changes in the top of the leaderboard. It was a very exciting night, in my timezone 5 UTC is 7 AM and we were receiving submissions all the night, until the end.

66 golfers played in this tournament, they submitted 507 solutions in total, 231 for the factorial and 276 for the postorder. The winner among the veterans was Juho Snellman, and Markus Laire was the winner in the beginner's category.

The winning solution for the factorial (where the script had to print to stdout the rightmost non-zero digit of the factorial of the argument, in the range 0..9999, followed by a newline) was this 44 by Juho Snellman:

    #!perl -l
    $_*=$`%9e9,??for+1=~?0*$?..pop;print$`%10

In that program the range operator has to its left the value returned by +1=~?0*$? (the purpose of the + is to improve the tiebraker compared to an everyday space after the for), and the argument to its right (pop()ped because shift() is longer). The regexp there is then silently reused in ?? to remove trailing zeroes in conjuction with $`, a clever trick. The modulus let's the program deal with parameters in the specified range. Normally one would use 1e6 to do the computations with the last six digits, but, again, 9e9 solves the problem as well and has a better tiebraker.

The winning solution for the postorder (where the script received the preorder and the inorder of a binary tree with nodes in 'A'..'Z' and had to print its postorder and a newline) was this amazing 49 that was found by three golfers, Stephen Turner, Rick Klement, and Eugene van der Pijll:

    #!perl
    s~~
    @ARGV~;print$1until!s~(.)(?=(.).*\2.*\1| )~~s

The first substitution is a golfish way to initialize $_ to a newline followed by the arguments joined with a space in between. The algorithm uses the fact that the node to be printed in each iteration is the leftmost in the inorder whose immediately following node, if any, appears earlier in the preorder. The way it prints the mandatory newline is elegant.

Bram, that's a slippery topic. If we talk about Model Theory we have a formal framework where interpretation or model is defined in terms of mathematical objects. But existence and interpretation in the sense you seem to use are another issue, which I am sure you know, only we have different opinions on this.

There are first-rate specialists in Foundations of Mathematics that doubt we humans have any clue of what the natural numbers actually are. We take some things for granted intuitively, but the model in one's head is likely to be different from the model in any other person's head, for they are inherently vague.

Some years ago there were some interesting threads in the FOM mailing list regarding these issues, I remember Professor Sazonov was one thinking in that line. This message from 1998 addresses it somewhat but there were more.

It's impressive being behind the scenes in a Perl Golf tournament.

For the factorial 48s were more or less expected, but as of this writing we have three people solving the postorder in 49 strokes. That's too much!

2 Aug 2002 (updated 2 Aug 2002 at 02:12 UTC) »

Wow, the TPR(0,4c) has started very strong. I've checked for about 50 solutions today in five hours. There are some amazingly clever solutions.

There are two holes in this tournament: finding the rightmost non-zero digit of a factorial, and computing the postorder, given the preorder and inorder of a binary tree. Best solutions right now use 48 and 50 keystrokes respectively.

Thanks goodness for -MO=Deparse.

I am going to referee the forthcoming TPR(0,4c) Perl Golf tournament, together with other three golfers. These days the holes have been discussed and now test cases are being tested themselves. It's gonna be an exciting week, join us next August 1st!

112 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!