triptico.com: Angel Ortega's Site

2009-06-18

How to enter spanish quotes (« and ») under MS Windows

The crappy way: Alt-174 for « and Alt-175 for ».

The more definitive, but not at all not cumbersome way: download a thing called Microsoft Keyboard Layout Creator from http://www.microsoft.com/downloads/details.aspx?familyid=FB7B3DCD-D4C1-4943-9C74... and create your own keyboard layout, probably using a standard one as template. This program will prepare a .msi installer for you. After executing it go to Control Panel and set your layout as the default one.

You most probably want to set « to AltGr-Z and » to AltGr-X, as any Linux user know and love.

Or take my spanish keyboard layout: keybspao.msi with source keybspao.klc.

2009-05-30

«Terra Incognita», a la venta en Amazon.com

Mi libro Terra Incognita (1997) ya se vende en Amazon.com.

http://www.amazon.com/gp/product/B002ADC3ZU/sr=8-11/qid=1243405490/ref=olp_produ...

2009-05-10

Minimum Profit 5.1.2 released

A new version of the Minimum Profit text editor has been released. It includes the following features:

  • The grep action can now be recursive.
  • New syntax color for special documentation blocks.
  • Fix searching into empty selected blocks (this was bug #1269).
  • New action section_list, that shows a list of sections in the current document to jump to. Sections are usually function definitions and special marks in programming languages.
  • New action seek_misspelled, to search the next misspelled word. It has been assigned to keycode f5.
  • New action ignore_last_misspell, to add the last misspelled word found by seek_misspelled to a whitelist so it won't be found again.
  • New action seek_repeated_word, to search for words starting or ending with the same number of letters up to a maximum distance. It's controlled by the new configuration directives mp.config.rw_num_chars and mp.config.rw_max_dist. It has been assigned to keycode f6 (this keycode was previously assigned to join_paragraph, which has no keybinding now).
  • The action open_templates_file has been fixed.
  • Several GTK interface updates by fellow developer Sebastian Vöcking.
  • New command line option -d, to change the working directory.
  • Several fixes to the win32 driver; word wrapping, combobox drop-down sizes, underlined text.
  • Avoid hanging if the external ispell program is broken.
  • The dump() function now dumps its argument as MPSL code.

2009-04-06

Semana de monstruos

Igual que hice en enero y febrero con Las Tijeras del Viajero (1996), hoy queda inaugurada la semana monstruosa: desde hoy hasta el sábado publicaré diariamente un minirelato del libro Las Tijeras del Viajero. Monstruos (1997).

Basta con suscribirse al siguiente RSS:

http://triptico.com/?t=RSS;tag=las%20tijeras%20del%20viajero.%20monstruos

2009-03-12

Gruta version 2.2.0 released

Version 2.2.0 of the Gruta CMS, codenamed "Osmannoro", has been released. This release needs Artemus version 4.1.2. The following changes were made:

  • Story rendering is cached, resulting in faster page loading.
  • An existing story can be copied to another topic from the story edition form.
  • The template stories_by_date has changed the order of their output values; now they are topic_id, id and date.
  • The RSS template now accepts an optional CGI argument tag, to get feeds on stories by tag.
  • Multiple sources are no longer supported; it never really worked well, made the code cumbersome and had no real advantage after all. The cgi caller needs not to be changed, as the sources argument is still supported (only the first one is used, though), but the scalar source is preferred now.
  • The file format in the FS source has changed; the .META extension has been changed to .M, and .TAGS to .T. Also, new files appear in the stories directory with the .A and .B extensions, holding the rendered abstract and story body, respectively. The transition is made automatically on the first run, no manual operation is needed.
  • New argument hard_top_ten_limit to Gruta::Source::FS, to set the maximum number of stories to be tested when generating the top read stories index (previously hardcoded to 100).
  • New argument min_size_for_gzip to Gruta::CGI, to set the minimum size for the output body to be Gzip compressed (previously hardcoded to 10000).
  • If a story pointed by a story:// pseudo-url has a publication date in the future, only the title is shown (i.e., it's not clickable).
  • The Mbox source is officially deprecated.
  • Static URLs are also generated for the CSS, RSS and SITEMAP pages. The following mod_rewrite rule must be added to the ones suggested in the previous version:

 RewriteRule ^/style\.css$     /?t=CSS              [PT]

Artemus 4.1.2 released

Version 4.1.2 of the Artemus template toolkit has been released. The following changes were made:

  • New template function sort.
  • New template function reverse.
  • Templates can be loaded from external sources by using the new loader_func argument to new().
  • The Perl module Artemus is now an alias for the Artemus4 module, as a way to smooth the future transition to version 5. No changes need to be done.

2009-03-03

Nueva edición impresa de «Terra Incognita»

La segunda edición en papel de mi libro Terra Incognita (1997) está lista para comprarla en la tienda Lulu.com.

El texto incluye algunas correcciones de fallos tipográficos y estilo. Pero lo más interesante es la nueva presentación y diseño hecho por Marisa Ortega, gran profesional que además es mi hermana.

Una vez más, se demuestra que el aspecto es fundamental y lo que antes parecía un panfleto sin el menor interés ahora parece un libro de verdad.

2009-01-29

Overriding mod_rewrite if a file exists

I use mod_rewrite intensively on this site, mainly to make the transition from the old static files layout to this new, dynamic one based on my Gruta CMS. Following the premise that URLs must be eternal, I've used mod_rewrite magic to make old URLs like

http://triptico.com/software/mp.html

still be accesible, but be interally redirected to

http://triptico.com/?t=STORY;topic=software;id=mp

Anyway, it may prove useful to only do this redirection if a file with that path and name does not already exist in the filesystem. This can be used, for example, to serve special, manually crafted HTML pages, statistics made by other software, or to 'freeze' a special page to avoid too much server load.

So these are the magic words:

 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}      -f
 RewriteRule ^ %{DOCUMENT_ROOT}%{REQUEST_URI}    [L]

They must be entered before any other rewriting directives.

What they mean is, if a file exists (-f) with a path formed by the site's document root plus the requested uri, rewrite the query to it and stop rewriting ([L]).

2009-01-20

Traducción: Una amistosa introdución a la codificación de vídeo, parte 3: sonido con pérdida

Una amistosa introdución a la codificación de vídeo, parte 3: sonido con pérdida, por Mark Pilgrim.

Grutatxt 2.0.15 released

Version 2.0.15 of the Grutatxt text conversion package has been released. The following changes were made:

  • New parameter url-label-max to the HTML driver to set a maximum size for URLs.
  • New script pod2grutatxt, to convert Perl documentation in POD format to Grutatxt.
  • The pre mode is really verbatim, so bold / italic markup is not processed.

2009-01-17

File locking in Perl

File locking in Perl is done with the flock() function. It's portable among architectures, is advisory-only and locks full files.

It accepts two arguments: a file handle and an operation id. As expected, it allows only one writer or many simultaneous readers, with no wait. Locks are automatically released on closing. The usage is simple:

  1. Open the file (for reading or writing).
  2. Call flock() with the file handle, and a second argument of 1 (if reading) or 2 (if writing).
  3. Do whatever operations you do to the file.
  4. Close it.

And that's it. The magic numbers 1 and 2 can also be used as LOCK_* constants imported from the Flock module. The perldoc documentation is comprehensive, take a look at it.

Example reader:

 open F, 'index.db'; # open for reading
 
 # lock file. If a writer has it locked, it will
 # wait until released. Many readers will read the
 # file simultaneously without blocking.
 flock F, 1;
 
 while (<F>) {
    # do things...
 }
 
 # lock is released
 close F;

And a writer:

 open F, '>index.db'; # open for writing
 
 # lock file for writing. If there is another reader
 # or writer using the lock, it will block until
 # released.
 flock F, 2;
 
 # file is now locked
 # write stuff to the file...
 
 # lock is released; any readers or writers waiting
 # will unblock and go on with its business
 close F;

As these locking semantics are advisory-only, anyone can screw everything by writing without locking, so take care.

2009-01-16

Traducción de Linux Weekly News: Btrfs apunta a su inclusión

LWN: Btrfs apunta a su inclusión, por Jonathan Corbet.