Older blog entries for fxn (starting at number 118)

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!

Reading

These days I am finishing the second part of LOTR, together with the corresponding sections in The Atlas of Middle Earth. Reading LOTR with that atlas at hand is wonderful.

On the technical side I am reading Code Complete. Excellent.

26 Jul 2002 (updated 26 Jul 2002 at 17:00 UTC) »
sab39, GNU Emacs has builtin support for what you want: After you visit a file do M-x toggle-rot13-mode RET. That's all, ready to echo the text you type rot13ed.
MyAdvogato 0.9 is out.

As I commented yesterday, the main new features of this version are:

  • The edition of boxes is optional.
  • In recentlog, links to the user's personal page are highlighted no matter the actual linked text.
  • In recentlog, user name highlighting is case-insensitive.
You can download it as a tarball or as a zip file.

109 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!