Domino

Yesterday I watched Domino, a movie loosely based on the life of a bounty-hunter woman, played by Keira Knightley.

Where can I start describing the movie? Take a look at the IMDb review I link above for a good description. I agree to some extent with that review, in that the movie is like a videoclip/reality show mixture, and the video and music setup is… different. I didn’t like the brave use of the photography they do in the movie, with unfocused shots and a camera movement akin to that of a monkey on crack, but I have to admit it is well done.

The IMDb review says the movie is about attitudes and roles, not about a plot… sorry man, but a movie is a plot. Otherwise it is a videoclip, a documentary or whatever. When I watch a movie, I want a story to be told and understood by the audience. In this regard, Domino fails misserably. There is a story (I think), but one is hard pressed to follow it, not because it is complex, but because it is not well told. I believe it is not the director’s intention, either.

To summarize, a movie I can not recommend. Could make a better use of the action scenes, develop the plot more, and shoot the video more “conventionally”. But then, it would not be Domino.

Comments

Convert PS to PDF

I make extensive use of ps2pdf to convert PostScript files to PDF. As most GNU/Linux tools, this is a simple and incredibly useful one.

However, sometimes it might give problems. For example, I have sometime converted a PS to a PDF that Evince would open fine, but Acrobat Reader would not. I fixed this problem making use of the superb alternatives system present in Debian.

The first thing to know is that most of PS and PDF manipulation (including PS-to-PDF conversion) is done by calling a backend application called Ghostscript (GS). A quick search within the Debian packages shows that most (if not all) of the GS versions mentioned in the wikipedia page are available:

Bart[~/]: aptitude search ^gs-
i   gs-afpl                     - The AFPL Ghostscript PostScript interpreter
p   gs-aladdin                  - Transitional package
p   gs-cjk-resource             - Resource files for gs-cjk, ghostscript CJK-TrueType extension
i A gs-common                   - Common files for different Ghostscript releases
i A gs-esp                      - The Ghostscript PostScript interpreter - ESP version
p   gs-gpl                      - The GPL Ghostscript PostScript interpreter
v   gs-pdfencrypt               -

It turns out I was using gs-esp:

Bart[~/]: which gs
/usr/bin/gs
Bart[~/]: ls -l /usr/bin/gs
lrwxrwxrwx 1 root root 20 Jul  4 09:00 /usr/bin/gs -> /etc/alternatives/gs*
Bart[~/]: ls -l /etc/alternatives/gs
lrwxrwxrwx 1 root root 16 Jul 27 11:26 /etc/alternatives/gs -> /usr/bin/gs-esp

I remember having used different GS versions, and AFPL being the “best”, so I installed it and made the default gs point to it, with the Debian alternatives system (as root):

Bart:~# aptitude install gs-afpl
[...]
Bart:~# update-alternatives --config gs

There are 2 alternatives which provide `gs'.

  Selection    Alternative
  -----------------------------------------------
  * +   1        /usr/bin/gs-esp
        2        /usr/bin/gs-afpl

Press enter to keep the default[*], or type selection number:

There, I just pressed “2”, et voilà! Now my default GS is gs-afpl, and ps2pdf makes use of it. Any other GS version one could want to use, the procedure to change it would be the same.

Comments

Line breaking in LaTeX

I guess every LaTeX user has found herself in a situation when LaTeX would refuse to split a word in a way the user knows correct (but LaTeX doesn’t), and it has caused some kind of trouble in the formatting of the paragraph (or not). It is worth mentioning that LaTeX has a very good knowledge of how to hyphenate English words, and anyway will almost never split a word incorrectly. When in doubt, it won’t split it at all.

When such a situation arises, the user has (as usual with LaTeX) more than one way to fix it. We can tell LaTeX explicitly where it can hyphenate the word. Using an example from Leslie Lamport’s 1985 “LaTeX: User’s Guide & Reference Manual”:

LaTeX does not know how to hyphenate gnomonly. We can write the word like this: gno\-mon\-ly, and then it will know that the word can be splitted at the places where \- appears (the backslash is not an error, it is required).

However, it is an ad hoc solution. We might find ourselves writing gnomonly quite often (well, not really that often), and having to write gno\-mon\-ly all the times gets old after a while (for me, the second time). To avoid this MS Word-ish solution, we can add the following statement in our preamble: \hyphenation{gno-mon-ly gno-mon}. From that moment on, LaTeX will know how to hyphenate gnomon and gnomonly. However, it will still be unable to hyphenate gnomonic (for that, you would have to add that word to a \hyphenation statement, too).

A related problem can happen when long words or expressions appear at the end of a line. It might be impossible to split the word in such a way that the line containing it is not longer than all the other lines in the same paragraph. In such a situation, LaTeX issues a warning of overfull \hbox. To understand the problem, let’s see how LaTeX manages the linebreaks.

The user (through the page settings and style, and all the stuff in the preamble etc.) tells LaTeX six things about lines in paragraphs: desired line width (page width less margins, if it’s a one-column text), desired inter-word space, and minimum and maximum acceptable values for both. When LaTeX writes a text, it does the following:

  1. Choose an interger number of words, so that they are equally spaced by the desired inter-word space, and make the line have the desired line width.
  2. If it is not possible, it tries the least obstrusive fix that gives the best result, from the following:
    • Increase/decrese the inter-word space (within the acceptable limits) untill an integer number of words makes a line of desired width.
    • Split the last word in the line, so that the non-integer number of words makes a line of desired width.
  3. If none of the above yields a perfect line-width, test if it is within the acceptable limits.
  4. If the width of the line is not acceptable, print it anyway, and cast a warning (overfull \hline if it was too wide, underfull \hline if it was too thin, whatever is less incorrect).

Usually ill-sized lines are very ugly on the eye, even for small deviations, and so it would be interesting to fix these errors. It is important to understand that LaTeX’s standards on what inter-word space range is acceptable (and what line width range), are quite strict, and it prefers to stick to them and produce a line that is too wide, giving a warning in the output. Usually this is sensible, but often times we would rather override its standards, and make the freaking line fit in the fixed-width paragraph.

To do so, we can enclose the paragraph between \begin{sloppypar} and \end{sloppypar}. For example:

\begin{sloppypar}
This text that I am writing is in fact astonishingly and utterly incommensurably acojonantemente chungo to fit correctly in a line.
\end{sloppypar}

The sloppypar environment is such that the text within it has a much wider acceptable inter-word space range. This gives it a bigger flexibility in the point 2 above, so that we’ll hardly ever fall to point 3.

Comments

SATA HD plus IDE CD under 2.6 kernel

You can read in my troubleshooting page what problems I had with my CD unit in a computer with a SATA hard disk (under Linux kernel 2.6, not 2.4).

Basically it boils down to: if / is mounted on a SATA HD, the libata kernel module must be loaded at boot time. When libata is loaded, it “hijacks” not only the SATA interfaces, but also the IDE interfaces. When, later on, ide-generic and other IDE kernel modules are loaded, they don’t see the IDE ports, so the CDs/DVDs or other IDE HDs, are not found! Moreover, they can’t ever be found.

This can be overcome by loading some IDE modules before libata is loaded, as I outline in my “Troubleshooting” page. However, I recently discovered (with kernel 2.6.15), that an IDE module (precisely ide-generic would, conversely, hijack the SATA ports, making libata not find any SATA interface, and generating a kernel panic at boot time, because / could not be mounted.

Now, it seemed like I had no way to fix it, because if I loaded ide-generic first, I would get a kernel panic, whereas if I loaded libata first, I would have to make do without access to the CD. Luckily, I tried to find out how to load one of the modules without having it hijack the interface that it shouldn’t hijack. To do so, I used the modinfo utility:

Bart:~# modinfo libata
filename: /lib/modules/2.6.15-1-686-smp/kernel/drivers/scsi/libata.ko
author: Jeff Garzik
description: Library module for ATA devices
license: GPL
version: 1.20
vermagic: 2.6.15-1-686-smp SMP 686 gcc-4.0
depends: scsi_mod
srcversion: 54ECB7B28C0FB6028983484
parm: atapi_enabled:Enable discovery of ATAPI devices (0=off, 1=on) (int)

Then I tried to load libata (“load” means to put it in /etc/mkinitrd/modules), then running mkinitrd -o /boot/initrd.img-2.6.15-1-686-smp.custom 2.6.15-1-686-smp, then rebooting) with the atapi_enabled=0 parameter, so that it wouldn’t hijack the IDE, and it failed again :^(

They say that if you can’t beat an enemy you should join her, and that I did: I tried libata atapi_enabled=1 with the intention of having libata handle the IDE device properly (if I couldn’t make it ignore it), and it worked! The CD is emulated as a SCSI device (a /dev/sga0 device was generated), but it works.

Comments

My first use of a backup

Well, probably not first, and not a big “use” either, but still…

Yesterday I mistakenly deleted an important file, and hadn’t noticed until 10 minutes ago. I make daily backups, using rsync, as I mentioned some time ago, in this blog entry.

The “bad” part is that, since the error was made yesterday, the last backup (made last night) was “corrupted” (had the file missing). The good part is that I make incremental daily backups of the last seven days, then weekly of the last 4 weeks, then monthly of the last 6 months (son-father-grandfather backup). I just checked the backup of the day before yesterday, and there it was the deleted file!

You can make an idea of the efficency of incremental backups if I say that I keep 15 backups of my home/ directory (1 “current”, 7 daily, 4 weekly, 3 montly, because I started 3 months ago) in two different machines (appart from my own, of course), which would amount to about 43GB in each machine, were they all complete copies. Being as they are incremental, they actually fill up 5.9GB of disk space in either machine (more than 7 times less).

For an idea of what incremental backups are, read this link of my blog entry. Actually, I also started a Wikipedia entry for “incremental backup”. Maybe you can watch it before someone sensible deletes it (it was a redirection to the backup rotation scheme” entry, but I do not think they are the same thing). You could even add something to that entry, to make it more complete.

Comments (1)

Scary Movie 4

Yesterday I watched Scary Movie 4. Yes, it is not the kind of movie I’d choose in ideal conditions, but first there wasn’t really much to choose from, and second I went to the cinema with a friend who was less than willing to watch something like The road to Guantanamo, or The assassination of Richard Nixon. So Scary Movie 4 be it.

At this point, I guess everyone knows that the Scary Movie series satirizes the horror movies in general, making parodies of some selected ones (for example, for that one they chose War of the worlds, The Village, and Saw I and II). Not only they poke fun at some movies, but also to popular characters as the stupid scientology advocate Tom Cruise, and the incredibly inept and fanatic George Bush, elected head of the UN “for his genuine wit”, as they say, ironically, in the movie. These two persons were elected among the five dumbest persons in the USA last year by their fellow citizens, by the way.

As for the movie itself, it is funny, but not wicked funny. It has a couple of really good spoofs, but they try to make so many jokes, about so many movies/characters, that 75% of the jokes are a bit flat.

Not a bad movie, but definitely perfectible.

Comments

Bob Dylan in Donostia

The times, they are a-changing…

Indeed they are! The Dylan I saw and heard in the concert he gave yesterday in the Zurriola beach was not the one who earned his glory, but one living of his glory.

His voice has always been singular, but yesterday it was just degradated. He never let the camera get closer than a certain point, and we were so far away from the scenario that the giant panels were our only hope of catching a sight of his face. We never did.

He also made the whole performance seated in front of the piano, didn’t even introduce himself in the beginning, and actually said nothing during all the concert, except near the end, when he gave a brief speech of which I understood nothing.

I am no fanatic of Dylan, but I do like his most famous songs (“Blowing in the wind”, “Mr. Tambourine Man”, “Knocking on Heaven’s door”, “Like a rolling stone”), but also some others that are not that famous (“The times, they are a-changing”, “Don’t think twice, it’s all right”, “It ain’t me, babe”, “Maggie’s farm”…). However, yesterday he sang such twisted versions of them, that no one managed to identify half of them. He began with, The times, they are a-changing and Maggie’s farm, if I recall correctly… and I identified them by the lyrics, not the music. When he played Mr. Tambourine Man, the song was 3/4 through by the time people would recognize it.

Before Dylan played, Mikel Laboa did. He is getting really old, and it shows. He sang quite correctly (faithfull to his particular style, that not everyone understands), but his mental and physical health are deteriorating. Anyway, I can’t say I didn’t enjoy his songs. Some more than other, but all in all it was fine.

Comments

Post a Kriptópolis

Como tantas otras veces en muchos sitios, he mandado un comentario kilométrico a Kriptópolis, y me ha apetecido copiarlo aquí (para vanagloriarme de los listo que soy, y alimentar mi ego, sí. Si tienes un problema con ello, monta tu propio blog, jejeje).

El post es una respuesta a otro comentario, cuyos “argumentos” también cito (En cursiva):

“[…] mil ojos no tienen porque ver más que dos […] eso es como decir que por decir mil personas que una pared es negra, tienen más razón que yo, que digo que es blanca.”

Si mil personas dicen que una pared es negra, y tú dices que es blanca, pero yo NO he visto la pared… lo siento, pero me fío más de 1000 desconocidos que de uno. Presuponer que los 1000 tienen que equivocarse es mucho suponer, ¿no?.

Es más, tienes razón: ni me fío de ti, ni me fío de los 1000 (malditos mentirosos). Quiero ver la pared yo. ¿Puedo?. Si la pared es libre sí. Si es privativa, no.

“Además lo que se hizo con Linux, gcc etc lo puede hacer cualquier empresa de software, se llama auditar software y no hace falta que sea software libre, pagas y ellos te lo revisan”

Dime a qué empresa pago para que me audite el código de Windows. ¡Ah, perdona, no puedo! Va a ser que es ILEGAL acceder a ese código… Te refieres a que Microsoft pida la auditoría… ya, ya. Me quedo más tranquilo.

“y para eso ningún loco se va a mirar el código entero, vamos el que se crea que de verdad se han mirado todo el código fuente vive en el mundo de yupi. Lo que se utiliza es la regla 80-20 (o 20-80 da igual), que viene a decir que el 80% de los fallos se concentran en el 20% de los módulos, y eso es lo que miran, el 20% del código, obviamente siguiendo ciertos criterios para seleccionar los módulos más propensos a errores.”

Perdona, pero tú sí que vives en los mundos de Yupi. El 80% de los errores estará en el 20% del código, pero NADIE sabe en qué 20%. Si se supiera no serían errores. Por eso hay que mirar TODO.

¡Pero claro que nadie se mira todo! Pero sí que es cierto que ENTRE TODOS MIRAMOS TODO. Es exáctamente igual que en las publicaciones científicas: nadie se lee ni un 0.01% de las revistas que salen (ni siquiera las de su campo), pero intenta colar una mentirijilla y ya verás como hay algún cabrito en Wisconsin o Kuala Lumpur que te pilla (suponiendo que la mentira pasara el filtro de los referees y sea publicada).

“Lo de que da más seguridad, más confianza, es indiscutible, pero que por eso sea más seguro es perfectamente discutible.”

Estás confundiendo causa con efecto: da más confianza porque es más seguro, no al revés. ¿Ves cómo la frase así tiene más sentido?

“También es verdad que al ser abierto es más fácil encontrar los bugs, para bien y para mal (no todos son buenos samaritanos que informan inmediatamente del bug al equipo de desarrolladores o directamente proporcionan un parche, habrá quien se lo calle y se dedique a explotarlo) como dice UnAlien.”

Esto es una tontería. Por cada persona que se guarde para sí el error que encuentre habrá 10 que lo reporten, y otros 10 que estarán dispuestos a arreglarlo. Si no hay dispuestos 10 a arreglarlo, es que a nadie le interesa. Aunque fuera al revés, y hubiera 10 descubridores maliciosos por cada “buen samaritano” (que NO es así), ese buen samaritano sería suficiente, con tal de que el software sea libre, y el samaritano pueda 1) encontrar la solución, porque puede leer el código, 2) corregir el error, porque puede cambiar el código y 3) distribuir las correcciones, porque la licencia lo permite.

“Si se encuentran más bugs en IExplorer es porque compensa más dedicarle esfuerzo pues tiene más cuota de mercado, igual que a Window$. Aunque no dudo que de disponer del código podría ser terrible.”

Si se encuentran más bugs en IE es porque los tiene (en primer lugar), y porque sólo los desarrolladores pueden corregirlos, si les da la gana y cuando les dé la gana, con lo cual la vida de los bugs es larga y fructífera.

Y también vale esto para los virus. Nadie se dedica a hacer un virus para una pieza de software que otras 1000 personas van a tardar 2 días en parchear. Simplemente no merece la pena. Para cuando “sacas” tu virus, el programa ya ha cambiado. Un desarrollador de virus necesita una plataforma estática que atacar, que sepa que va a ser vulnerable suficiente tiempo para que el virus haga algo (e incluso le dé tiempo a él a programarlo). Es curioso que creamos que los 5 niñatos que andan haciendo virus por diversión sí tienen capacidades superhumanas para leerse TODO el código y programar virus al instante, mientras que entre los 100000 usuarios de ese programa, a los cuales les parece vital su seguridad, no son capaces de leerlo y arreglarlo.

“JMG, no te engañes, esos cientos de programadores si ven el código es porque trabajan en alguna parte de él, sino olvidate, te puedo asegurar que si algo odia un programador es revisar y probar código, hacerlo sin que te paguen molesta, pero es que tener que ver código de otro eso ya es un castigo. Por eso, entre otras cosas, se intentan seguir metodologías de forma extricta, porque si esperas que un programador lo haga por gusto vas bueno.”

Correcto. Tienes mucha razón, depurar código jode mogollón. Pero no más que tener que usar un programa defectuoso que sabes cómo arreglar, pero su estúpida licencia te lo impide.

Te falla una cosa: en el software libre no hay esa distinción artificial entre programador y usuario. El programador no es un pringao que se lo curra para otros… El programador es él mismo un usuario, que quiere que el programa funcione, y como otro no lo arregla (o aunque también otro lo arregle), lo intenta arreglar él. Además puede elegir a qué proyectos contribuye, y de qué manera, cosa que ayuda muchísimo a la motivación.

“Asociar calidad o seguridad con software libre es totalmente incorrecto, el software es bueno si se hace bien”

Asociar seguridad con conducir sobrio es totalmente incorrecto; una conducción es segura cuando se conduce bien, independientemente de que vayas ebrio.

“y auditar software lo puede hacer cualquiera,”

¿Cómo? Software Libre lo puede auditar cualquiera, pero el propietario NO. ¿Sabes eso, no?

“Y esto no es que lo diga yo, es que también he asistido a una conferencia larguilla de Stallman, y he leido algunas entrevistas y articulos suyos y JAMÁS dice que el software libre sea mejor o más seguro que el privativo,”

Pues hablaremos de otro Stallman, porque yo también he asistido a una conferencia suya (podéis ver la entrada en mi blog), y dijo cosas muy interesantes sobre el tema, como por ejemplo relato en mi blog bajo los títulos “Funcionalidades malas” y “Errores”.

Claro que igual tú no defines “libre de malware” como “mejor”.

“simplemente que es “mejor para el usuario” en el sentido de que es libre, que te dá libertad, y es lo normal, ese tio sabe de informática y afirmar que tiene mayor calidad simplemente por licenciarlo bajo GPL, BSD etc sería mentirse a sí mismo, una licencia es una licencia, ¡nada más! Esto ya parece una religión, demasiada fé ciega.”

Cierto, Stallman da énfasis a la libertad (independientemente de la calidad).

Pero tu postura de decir que “afirmar que tiene mayor calidad simplemente por licenciarlo bajo GPL es estúpido” es un argumento de hombre de paja. Criticas una bufonada que atribuyes a gente que no la ha dicho. La licencia no cambia nada de la seguridad ni calidad del programa. Directamente. ¡Pero indirectamente claro que lo hace! Te estamos diciendo los mecanismos que ciertas licencias libres permiten, y gracias a los cuales el SL puede ser mejor, y sigues sin captarlo. Es como decir que dar periódicos grátis puede ayudar a que la gente esté mejor informada, y tú digas que igualmente la gente puede decidir seguir sin leer las noticias.

“el saber nos hace libres”

No es del todo cierto. El saber y el poder actuar según ese conocimiento, sin coacciones ni imposiciones. De nada me vale saber cómo arreglar un bug del IE, si su licencia no me permite que lo haga.

Comments

Dynamic file read with Perl

GNU/Linux command-line users, programmers and hackers worldwide have probably come to know and love the wonderful tail shell command, together with cat, head, grep, awk and sed, easily one of the single most usefull commands.

A killer feature of tail is the -f (--follow) argument, which outputs the last lines of a file and then keeps waiting for new lines that might keep appearing in the file, and show them on the screen when they do. This is invaluable to keep track of, e.g., logfiles where new entries are being added all the time, and one does not want to be doing a tail by hand.

Since I am a great fan of Perl, and use its scripts for anything short of cooking dinner (but wait…), I have found myself in situations where I had to tail the last lines of a file. This can be done in several ways:

system "tail $file";

or

my $str = `tail $file`;
print $str;

or with a open() statement, then reading the whole file (or a part), and printing it. The first example with system is the most “direct” one, but reading the file (or a part) into a variable is very handy for doing with it all the nifty things Perl does so well to text strings (substituting, deleting, including, reordering, comparing…).

However, when tail -f was needed (i.e., keep on tracking the file and operate on the output as it appears), I kept using system calls, and all the formatting had to be done in the shell spawned by the system call, not by Perl. This was sad.

So, I was so happy when I discovered a simple trick to make open() read dynamically. There are better ways of doing it, more efficiently and correctly, but this one works, and is quite simple. If efficience is vital for you, this is not probably the place to learn about it. Actually, if you look for efficiency, you shouldn’t be using Perl at all :^)

Example of Perl code that reads dynamically a file “$in“:

open(INFILE,"tail -0f $in |") || die "Failed!\n";
while(my $line = <INFILE>)
{ 
  do whatever to $line;
};
close(INFILE)

Update: Explanation to the code above:

The open() call pipes the output of the tail command (notice the -f flag. Do a man tail to know more) to the file tag “INFILE”. The “||” sign is an [[logical disjunction|OR]], and means “do the thing on my right side if the thing on my left didn’t end successfully (but ONLY in that case!)”.

Next, we perform a while loop over the lines in the pipe. The “<INLINE>” construct extracts elements in INLINE, treating it as an array. As you can see, these elements are assigned to a new variable $line, and the loop continues while $line has some non-false value, i.e. while there are lines in INFILE.

The paragraph inside the curled keys is [[pseudocode]], obviously; you put there your code. And, for tidiness, once we exit the loop, and INFILE is exhausted of lines, we close it.

Comments (4)

Lord of War

They say, “Evil prevails when good men fail to act.” What they ought to say is, “Evil prevails.”

Yesterday I watched Lord of War… and what a movie it is!

I was a little worried that this could be one of Cage‘s bad actings, because I have a kind of love-hate relationship with this guy. I like most of his characters, but some of them are not well played, kind of not very believable.

However, in this movie Cage acts quite well, as do all other actors and actresses. The movie is very well made, with a photography, and specially a soundtrack, that helps telling the story quite beautifully.

However, the main point of the film is its truthfull, even cruel, portrayal of not only the weapon smuggling, but also the corruption and complicity of the “respectable” governments, and casts a dark shadow over the humanity as a whole, I believe. All that is accomplished through the speech of the main character, Yuri Orlov (Cage), a Ucranian immigrant in the USA who becomes the world’s biggers arm trafficker. Orlov tells us everything about his life as a smuggler, his moral degradation, his perception of the world, how the whole arm business works…

This movie is a definitive must-see, if you want to open your eyes to some sad truths. If you don’t, just go watch Superman and enjoy the good white American boy saving the world, the democracy, the right to bear arms, the land of the free, and the home of the brave.

Comments

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »