Older blog entries for fxn (starting at number 305)

1 May 2004 (updated 1 May 2004 at 11:13 UTC) »

ZF might be inconsistent (cont.)

cerquide: the link to the draft works for me. The paper had been revised by first-class specialists as professor Solovay from Berkeley, some flaws were found but they seemed fixable, except one, which is not yet clear. I don't know whether the author will keep that archive up to date, though revisions are being uploaded these days.

A researcher pointed out a problem in the FOM mailing list that seems fundamental and would invalidate that conclusion, but not much public discussion is being done. The author replied. There's a thread in the Mathematics community of Orkut as well.

ZF might be inconsistent

There's a paper (draft) that claims that unless there's some error it follows from the exposition that ZF is inconsistent. The author is a researcher at MIT.

This sensational remark is discreetly made in the conclusion.

24 Apr 2004 (updated 24 Apr 2004 at 15:54 UTC) »
AbiWord 2.1.2 runs on Mac OS X, good work! Thank you hub!
22 Apr 2004 (updated 22 Apr 2004 at 09:39 UTC) »

With the last release of Beamer you can put movies and sounds in your presentation: This new version includes a package for including sounds and movies in a beamer presentation. The package also works stand-alone and can be used with any other latex class (like article or prosper). Other new features are the option to automatically break a frame into several frames, to automatically shrink a frame to fit the available area, to add special zoom areas and some other new stuff.

Hey this package rocks even more. Incidentally, the documentation patch I sent after proof-reading the user's guide has been applied.

21 Apr 2004 (updated 21 Apr 2004 at 15:53 UTC) »

It had been a while since I played Perl Golf. Today someone posted a mini-golf problem in the fwp mailing list, and since I woke up very early in the morning (4am) I decided to have some fun with it.

Given two strings $x and $y we have to put in $n the index of the first character where they differ. If the strings are equal $n has to be undef. For example, if $x is "foo" and $y is "foobar" then $n has to be 3.

I sent a few solutions and by now the shortest one is mine (with a fix pointed out by Yitzchak Scott-Thoennes):

    {$x ne$y&&$x=~/./sg&$y=~/\G\Q$&/g&&redo;$n=$-[0]}

It's a pity playing golf requires so much effort to squeeze a solution until you get something more or less good. It remembers me to how work with koans is explained in books (I have never worked with koans myself), you visualize your solution and try to improve, change, explore other approaches, consult the documentation to take advantage of corner cases, try to gain some character via some side-effect, reordering, think, think, think, ..., you have to be one with the problem, so to speak. Takes time, concentration, and it's very intensive. Solutions often come by saturation. Otherwise I would play more frequently.

14 Apr 2004 (updated 14 Apr 2004 at 20:45 UTC) »

One of the guidelines in Halk is that presentations should be portable and self-contained as much as possible. They should ideally be seen as a file you drop to your hard disk. Running it and pointing your browser to some local port is all what would be needed. No installation, no setup.

This brings some internal issues, as what happens with custom preprocessors and beautifiers, but another kind of problem are dependencies.

Let's imagine you are giving a tutorial about some Python module which is not standard. The code in the presentation needs that module installed to run, what do we do? A solution is for the author to document that the presentation requires that module. Ugh. A presentation property could be some Perl code that checked dependencies so that the engine could warn the user with some informative message about what is missing and how to get it.

But I think an important number of cases can be solved if the config file provides authors with a mean to set environment variables. Since the presentation directory is owned by the author (in Halk's sense) he can install dependencies there. And since he is allowed to use filenames relative to the presentation root everywhere we can provide calls like

    setenv 'PYTHONPATH', 'lib';
or for a presentation about some Java library:
    setenv 'CLASSPATH', 'lib/*.jar', 'lib/*.zip', 'classes';
Those wildcards are possible with zero effort thanks to Perl's glob() builtin.

That won't cover all the cases, for instance if a library has native code and the author includes versions for several operating systems we can easily offer:

    setenv 'LD_LIBRARY_PATH', 'linux_lib' if RUNNING_ON_LINUX;
    setenv 'DYLD_LIBRARY_PATH', 'macosx_lib' if RUNNING_ON_MAC_OS_X;
So that trick would cover a few more. And in the end we always have a README as last solution :-).
13 Apr 2004 (updated 13 Apr 2004 at 07:53 UTC) »

Halk

Some classes are already implemented. I did some trials with HTTP::Daemon and works like a charm. In a few lines you've got a simple HTTP server running where you can hook your custom code. It comes with LWP and based on its classes.

I founded an interesting module for config files called Config::General. It provides a syntax based on Apache's, where tags can be nested a la XML, there's file inclusion, variable interpolation, here documents, .... The example of two days ago becomes:

   title: About Foos And Bars
   author: The Author
   theme: clean
   pretty_printer: source_highlight_wrapper.sh
   
   <section>
     title: Section Title
     <subsection>
       title: Subsection Title
   
       <slide>
         title: Slide Title
         body: <<BODY
   This slide introduces foo, which is further detailed
   <a href="[% link_to_sref('bar') %]">later</a>.
   BODY
       </slide>
     </subsection>
   </section>
but looks too verbose to me compared to
   title 'About Foos And Bars';
   author 'The author';
   theme 'clean';
   pretty_printer 'source_highlight_wrapper.sh';
   
   section 'Section Title';
   subsection 'Subsection Title';
   
   slide 'Slide Title', <<'BODY';
   This slide introduces foo, which is further detailed
   <a href="[% link_to_sref('bar') %]">later</a>.
   BODY
Moreover with the latter to configure a presentation those functions are created as clousures before do()ing the file and Perl does the rest. Couldn't be easier.

9 Ball

I entered a 9 Ball Tournament to be held next Sunday in Namcos' at Diagonal Mar. It has been a long time since I touched the cue, but it will funny.

11 Apr 2004 (updated 11 Apr 2004 at 11:34 UTC) »

Pasting code in Advogato

Pasting code is something not to be abused here, but I think it would be normal to see it now and then in the diary of software developers more than we do.

That has a couple of inconveniences though, not a big deal, but:

  • Special characters have to be substituted with HTML entities.
  • mod_virgule doubles blank lines in pre blocks and adds a spurios leading space.
I faced that once again yesterday and said no more. I wrote a simple filter anyone can use. It does the following:
  • Escapes special characters.
  • Puts a dummy space in blank lines to avoid the bug.
  • Indents the whole block.
  • Wraps the result in a pre tag.
  • Puts the result in the clipboard on Mac OS X and Win32.
In particular, if the stuff to paste is in you editor and the program supports passing some selected text to an external program (M-| in Emacs) the code can be easily copied that way from the very source.

Of course the first application of that script has to be to blog his very listing, but since it is a bit long I'll just post a few lines:

   #!/usr/bin/perl
   
   use strict;
   use warnings;
   
   # indentation of the whole block
   my $indent = ' ' x 3;
   
   # coderef for setting the clipboard
   my $clip = $^O eq 'darwin'  ? \&clip_macosx :
              $^O eq 'MSWin32' ? \&clip_win32  :
                                 \&clip_unsupported;
   
   # ...
10 Apr 2004 (updated 10 Apr 2004 at 10:11 UTC) »

A possible way to write presentations in Halk could be using procedural Perl:

   title 'About Foos And Bars';
   author 'The author';
   theme 'clean';
   pretty_printer 'source_highlight_wrapper.sh';
   
   section 'Section title';
   subsection 'Subsection Title';
   
   slide 'Slide Title', <<'BODY';
   This slide introduces foo, which is further detailed
   <a href="[% halk.link_to_sref('bar') %]">later</a>.
   BODY

That would be simply do()ed, and does not require to know Perl, but to know the syntax of the config file, which can be documented. Recursive file inclusion is trivial. It has the drawback that its flexibility is limited however, but what we want to configure might not be that complicated.

9 Apr 2004 (updated 9 Apr 2004 at 12:02 UTC) »

I think Halk is going to be based on some templating system for configuration and slides, and on PAR for distribution of the program and stand-alone presentations.

From Beamer I've realized the best solution for writing presentations in this kind of tools is in my opinion to have by default the slides in a single file, and to provide an include facility to structure large presentations. This way short presentations are easy to write, and includes let authors organize their presentations as they wish.

Granted, that's an old idea, but in the prototype there was a directory structure. Its purpose was to have the slide and its related files in a single directory. Since in the presentations the prototype was written for almost every slide has a program and its corresponding HTML listing that sort of made sense. But for Halk that would be clearly a wrong choice.

Now, after seeing YAML wouldn't be a good choice for the config file, I pondered XML. If presentations are going to be writable in a single file I won't choose XML for two reasons:

  • There's no clean including mechanism in XML that I know. The canonical options seem to be to create an entity like this
    <!DOCTYPE spec SYSTEM "spec.dtd" [
    <!ENTITY section1 SYSTEM "section1.xml">
    ]>
    
    which I don't like for a friendly config file, or to use XInclude, whose corresponding Perl module I couldn't even install. I could try to add some custom solution for it but the second reason has more weight:
  • Since presentations are written in HTML the config file would need to be full of CDATA markers. I don't like that idea.

Next step is to try to come with a neat solution for the requeriments I've got using some templating system. The candidates are Text::Template for its simplicity and, and the Template Toolkit for its power and clear syntax. In any case, authors wouldn't be required to know Perl or to study any of the choosen solutions unless they want to. The documentation should ideally explain how to write slides in a self-contained way.

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