Older blog entries for fxn (starting at number 299)

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.

2 Apr 2004 (updated 2 Apr 2004 at 09:47 UTC) »

haruspex, dyork: Yeah, simulated small caps are not true smalls caps.

In case someone does not know this stuff, simulated small caps play with upper-case letters of a normal font in different sizes to get something that resemble them. True small caps, however, are fonts in themselves. To give an example anyone can try, LaTeX comes with Computer Modern true small caps. Compare that with the small caps used by Safari in dyork entries. The former looks smooth, well-proportionated, whereas the latter looks somewhat ugly.

dyork: They look right in Safari 1.2.1.

Quote of the day

From footnote 21 on page 35 of David Foster Wallace's Everything and More: A Compact History of ∞:

[If you're interested] Let's explicitize at the outset that the 'you might recall' and 'it goes without saying's and so on are not tics but rhetorical gambits whose aim is to reduce annoyance in those readers who are already familiar with whatever's being discussed. No particular experience or recall of college math is actually required for this booklet; but it seems only reasonable to assume that some readers will have strong math backgrounds, and only polite to acknowledge this from time to time. As was briefly mentioned in the Foreword, the rhetoric of tech writing is fraught with conundra about various different readers' expertise-levels and confusion-v.-annoyance curves. None of this is your problem, of course—at least not directly.

Listening

D'angelo, Playa, Playa.

I finished the proof-reading of the Beamer user's guide. I spotted 60+ typos, little inconsistencies, doubled words, etc. The patch was posted in its page at SourceForge and sent to Till Tantau, its author.

21 Mar 2004 (updated 21 Mar 2004 at 13:20 UTC) »

Listings

I noticed the last release of listings comes with the revised list of Ruby keywords I sent a few months ago.

Beamer

I just came across Beamer yesterday. I don't know how could I miss it when I looked for LaTeX presentation packages last year. I find it awesome:

  • Designed to generate PDF via pdflatex, though it supports dvips as well.
  • It is very easy and flexible to write slides with overlays.
  • You can organize presentations using sections and subsections, parts, or lectures. With commands for selective compiling, automatic TOC, side bars, etc.
  • Bodies can be divided in columns in a breeze.
  • Slide cross-references with PDF links and buttons.
  • Support for appendixes, where you can put additional slides that could be useful for questions or whatever.
  • Slides can have notes associated, and the document compiled including them or not.
  • Support for footnotes.
  • It is themable.
  • It features navigation bars.
  • Compatibility layers for Prosper and Seminar.
  • ....
Oh, and the 100+ pages user's guide is just excellent. It is both a tutorial and a reference, and gives hints for writing presentations. It has typos, but I am proof-reading it.

I have seen some features I planned for Halk, some others I could borrow, and some I doubt it'll offer in any early release.

I've alredy received all the prizes of the last Perl Haiku Contest from ActiveState. They said in a nice letter they received for about 350 entries.

I could choose between a license of Komodo and a license of the Perl Dev Kit, which was the one I chose. My main computer is a PowerBook, but I'll leverage the kit for sure somehow. In addition, they sent a couple of mugs, stickers, balloons, a T-shirt, and an ActiveCD.

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