Some numbers on FLOSS

Looking at the Free Software page in the Wikipedia (to which I have contributed with the “However, direct economic benefit is hardly the main reason[…]” paragraph), I found the following link.

Although it’s about 9 months old, it is still meaningfull, and makes for a good reading. Also check this Groklaw article.

Go ahead and “get the facts”.

Comments

Symmetry change in Gaussian optimization

Ever have a Gaussian job die with this error?:

Omega: Change in point group or standard orientation.

It simply means that up to that point the molecule had a certain symmetry (for example, it was planar), and the last optimization step made it jump to another (usually lower) symmetry (for example, bend out of the plane). This is regarded as an error by Gaussian, and thus it aborts the job.

However, sometimes we are not interested in mantaining the symmetry, maybe even the high symmetry of the input was just a coincidence! One way or another, we might be interesting in having this job go on even if the symmetry changes. To do so, we just need to include the following IOp in the input file:

IOp(2/16=1)

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)

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)

What I want in a Desktop Environment

Probably just a reminder to myself (things to test that a DE or WM I consider using has).

In no particular order:

Panel

I want the posibility to have a panel that looks like Engage, or the modubar desklet of adesklets.

All of them are, yes, clons of the Mac “Dock”.

Volume control

Yes sounds stupid, but I want something like the convenient applet in the Xfce panel, which turns volume up and down when scrolling the mouse wheel over it.

There are workarounds, like having a mixer (e.g. kmix) icon in the system tray, which fulfill the same task (you can hover and scroll), or configuring a keybinding for it.

Maybe both, specially the latter, are even better than what I originally wanted, so… nevermind.

Alt+Tab cycling for ALL windows

I have tried Enlightenment DR16, and the default is to cycle only raised windows (that is, the minimized ones don’t appear in the cycle). How stupid is that? And I am sad to say that I haven’t been able to change this default behavior. I have given Enlightenment DR17 a try, and it does cycle through all windows…

Iconbox with all windows

I absolutely love the Xfce iconbox, which is a replacement for a “normal” taskbar, i.e., a place where iconified windows “go”. The only thing I think is less than perfect is its looks. The Enlightenment iconbox looks better, specially since you can make it 100% invisible, so that only the icons are visible.

Problem with Enlightenment iconbox: only minimized windows appear there. Again (second time with a window issue in E.), how silly is that? In Xfce you can configure the iconbox to show all windows, or just minimized ones. Having all windows appear in the iconbox is very handy. When you minimize a window, it goes to the iconbox. You can then maximize it clicking in its iconbox icon. Now, without moving the mouse, you can change your mind and minimize it back, clicking the icon again. But in E. you can’t, because the icon is no more there!

Themeability

I like some Enlightenment themes but I prefer the Xfce way of having a theme for the window manager, and another one for the “general look and feel”. The latter includes font types and sizes, scrollbar styles, button styles and so on. In E., it’s all-in-one, so one theme might have a very nice window decoration, but awful scrollbar or button style…

Easy and powerful keybindings

Most WMs have customizable keyboard shortcuts. The ones of Xfce are not espectacular, but can be accepted.

Shading with mouse

This is a very small detail, but very usefull. 99% of WMs shade the window (“roll it up”, showing only the topbar) when scrolling up with the mouse over its topbar. No need to say, scrolling down unshades the window back. In some WMs (e.g., KDE), you can even configure what you want to have done when scrolling with the mouse over the topbar of a window.

Well, there are WMs where you can not do that trick! Sad.

Comments

Microsoft and Creative Commons

I have come to know that Microsoft has planned to add to MS Office a plug-in for licensing the documents thus produced under one of the Creative Commons licenses (if the author so wishes, of course).

You can read about it in Slashdot, C|Net and Lawrence Lessig’s blog.

Now, a lot of people see it as something possitive (including Enrique Dans[es]), but I don’t see it completely clear. It seems to be a big boost to the popularity of CC licenses, no doubt about it.

But, is it good news to the freedom of the culture?. It would seem so, since more people will license their works under a CC (many even unwillingly, because they hit the incorrect button in their toolbar, or have the defaults of their Office wrongly configurated), but it is not. They key point is twofold:

1) What the hell is this plug-in good for? What can the author achieve with it that is not promptly achieved just adding a “This work is licensed under blah-blah-blah” manually (keyboard-lly)? It is implied that someone will write a 500-page book, but is too lazy to manually add a statement that could be inserted clicking the ultra-mega-kewl MS Offiz plug-in button…

2) What good is it to free one’s artistic (or otherwise) work under a permisive copyright, if it is burdened by a proprietary format such as those MS Office saves under?

These two facts (doesn’t benefit the author, doesn’t benefit the freedom) make it clear that (as all the steps MS takes) it mainly benefits MS. It effectively helps the author refrain from controling her work too tightly, but moves this “control” into its (MS’s) own hands. Free distribution of important, interesting, popular CC documents will make it even more important to have MS Office if these documents are DOC or similar. More so, MS could threat to cut support for the readers of such documents, increase their price, tighten the piracy controls for MS Office, and/or legally prosecute the compatible readers (OpenOffice.org)… all that supported by a more tight grip in the freedom of choice of the public.

And remember: all the aforementioned attacks to the users’ freedom can only be done from a power position… power given to them in first place by the users. Don’t fall for it!

Comments

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