2012-01-09 21:14

Writer's block

Interesting thing about writing a post every day: I didn't get blocked yet. Sure, this is only the 9th post, but considering my previous post-a-month cadence, and that I would just have nothing to write about, it's clear to me that writing leads to writing.

That is perhaps the most obvious thing that not everyone notices: the way to do things is to do things. The way to write free software is to write software that is free. To go to Alaska you have to go. To Alaska. To write, you have to write. To do music, you have to do music. To make bread, you have to make bread.

Will every piece of bread you make be good? Will everything you write be good? Will you get to Alaska? No. You will fail.

But if you don't do failed crap first, then there is no way to do anything decent later. I think it was Amadeo Carrizo (famous, old, goalkeeper) who said about a (not so famous, young, goalkeeper) "He's not bad, but he needs to be scored on a few hundred times more before he's good".

I have a long history of failure. I have a short story of successes. I am working on it.

2012-01-08 23:21

Abandonment issues: rst2pdf

Of all the corpses of my projects, there is one thatI feel worse about, which is rst2pdf. I feel bad about abandnoning several, but rst2pdf was actually a useful tool, used by a bunch of people, and that it has never gathered enough momentum with other developers is sad.

So, I will pick it up. I will spend about 4 hours a week on it. The plan is to:

  1. Gather some patches that are lingering on the issue tracker
  2. Fix some simple-ish bugs
  3. Make another release with 1) and 2)

And of course:

  1. Not let it fall in disrepair again

In the meantime, here is a nice thing I just heard about. Dimitri Christodoulou has hacked rst2pdf so that it can handle the raw:: html directive.

This, dear friends is completely nuts, absolutely out of scope for any given docutils tool, and just too cool :-)

I will try to hijack his code (proper credit and so on), and incorporate it into rst2pdf.

And Dimitri, or anyone else who wants to do cool stuff with rst2pdf: let me know! I will give you commit rights immediately!

2012-01-07 23:06

Python context managers: they are easy!

This comes from this thread in the Python Argentina mailing list (which I strongly recommend if you read spanish).

I was the other day trying to do shell-script-like-things on python (as part of a monster setup.py) and I was annoyed that in shell it's easy to do this:

cd foo
bar -baz
cd -

Or this:

pushd foo
bar -baz
popd

Or this:

(cd foo && bar -baz)

And on Python I had to do this, which is verbose and ugly:

cwd = os.getcwd()
try:
    os.chdir('foo')
    os.system('bar -baz')
finally:
    os.chdir(cwd)

This is what I wanted to have:

with os.chdir('foo'):
    os.system('bar -baz')

And of course, you can't do that. So, I asked, how do you implement that context manager? I got several answers.

  1. That's available in Fabric:

    with cd("foo"):
        run("bar")
    
  2. It's not hard to do:

    class DirContextM(object):
        def __init__(self, new_dir):
            self.new_dir = new_dir
            self.old_dir = None
    
        def __enter__(self):
            self.old_dir = os.getcwd()
            os.chdir(self.new_dir)
    
        def __exit__(self, *_):
            os.chdir(self.old_dir)
    
  3. It's even easier to do:

    from contextlib import contextmanager
    
    @contextmanager
    def cd(path):
        old_dir = os.getcwd()
        os.chdir(path)
        yield
        os.chdir(old_dir)
    
  4. That's cool, so let's add it to path.py

  5. Maybe check for exceptions

    @contextmanager
    def cd(path):
        old_dir = os.getcwd()
        os.chdir(path)
        try:
            yield
        finally:
            os.chdir(old_dir)
    

All in all, I learned how to do context managers, about contextlib, about fabric and about path.py. Which is not bad for 15 minutes :-)

2012-01-06 21:58

Book review: The Windup Girl by Paolo Bacigalupi

I started this book with high hopes. After all, this was a book by a new-ish author that had won Hugo Award for Best Novel (2010), Nebula Award for Best Novel (2009), Locus Award for Best First Novel (2010), John W. Campbell Memorial Award (2010), Compton Crook Award (2010) Compton Crook Award (2010), Goodreads Choice Award Nominee for Science Fiction (2009). Impressive, uh?

Well, I don't know what they saw in it. Shallow characters, pervasive fatalism disguised as depth, mprobable slang ust because it sounds cool (windup girl? Really? That's how they will call genetically engineered humans in the future? Windups? Yeah, right).

Oh, and it's full of orientalism. And of things like implanting gene dogs into windups to make them loyal and subservient. And ghosts. Oh, crap, almost nothing in this novel worked for me. Most pages had me slapping myself on the forehead.

I amnot against a solid dose of weird. I like weird. I read Miéville, for crap's sake. But this is not weird, it's contrived.

And don't get me started on the end. The end is such an obvious analogy to Eden it almost made me puke. It's like the end of Battlestar Galactica, but set on the future. And with ladyboys.

I had a better time reading H. Rider Haggard's "Allan Quatermain", which I saw mentioned in the awesome series "The victorian Hugos". Old and dated? Sure. But I would vote for it instead of "The Windup Girl" every day, and twice if they let me.

2012-01-05 22:09

That's Math! I Know Math! (No I don't)

The title is a quote from Jurassic Park, if you were wondering. A girl, chased by dinosaurs, runs into a computer, notices it's Unix, says "That's Unix! I know Unix!", and proceeds to hack something or other that lets her escape the previously mentioned dinosaurs.

Well, that's how life often feels for me, except with Math. And without dinosaurs. I am surrounded by trouble, something is completely broken in a way I can't quite get, things feel just slightly weird... and suddenly... that's math! I know math! (of course I don't know math, noone knows math. We all just know some math).

I may see an ad and notice the huge discount is just a cleverly disguised tiny discount. A snippet of news may reveal itself as complete nonsense after a cursory analysis. A forwarded mail may become slightly more annoying because of its obvious stupidity. Because of math.

Math is the tool I have to make sense of things. When the world gets confusing and scary, if it can be expressed in numbers, it calms me down. Afraid of the future? Let's consider the wonders of compound interest. Scared of death? Well, look at probabilities. Needing a little adventure? Well, there is game theory! Need a conversation starter? You can mention you once spent time in class figuring out the homeomorphism that explains the scene in Flashdance where the welder removes her bra through her sleeve.

Math tells me the world is not perfect. Math tells me the numbers I see on my computer are not really real numbers, and can't be trusted. Math tells me I can't cross all the bridges in Könisgerg only once. Math tells me the number one is the most frequent number in today's paper. Math tells me Plato was right and there is a universe of pure ideas, and this is but a reflection.

On the other hand, Math tells me I can cut an orange into a few pieces, which reassemble into two, identical, oranges. So take what she says with a grain of salt.

2012-01-04 13:48

Coffee and I

One of the most vivid memories of my late childhood was when my father finally let me to stay at his table in the Gran Doria café, when it was still located in the dark bowels of a galería in Santa Fe's San Martín street.

I was maybe 12, and I had seen him sit there with a cortado while my mother went shopping with us, or while I went to one of those things kids go to (artistic expression classes? Puppetry workshop?) and it was such a mistery. It was like a three hour hole in my dad's life of which I had no information.

What would he do there? Who did he talk to? Did he read something? And always there, at the table when I came back was an empty small cortado cup.

I suspect that's when I started liking the idea of coffee. I was, of course, an inveterate hot chocolate drinker (El Quillá brand, unknown beyond that city, yet superior in my mind to any others), after a long, long time of drinking warm sweetened milk. And I know I had tried coffee before and hated it, but of course, sitting there, I said "un cortado, por favor". And boy was that thing awful. I did not drink coffee again for twenty years.

I did learn to like tea, or at least tea with milk, and learned, in college, to drink mate like a sponge. Bitter and strong as hell, the closest caffeine delivery mechanism to an IV drip, slow, weak and constant over hours. You have not really been awake until it's 5 AM, you are on your third thermos, and it feels like 2PM. It's like the wrong kind of pill in the Matrix.

But then I moved to Buenos Aires and I was alone. And drinking mate alone is like drinking Vodka alone, depressing and dirty, so I started going to cafés and ordering lágrimas. A lágrima es like a backwards cortado. If you get a big cup and put a lágrima and a cortado in it you will get a decent café con leche. It's a pathetic beverage, only fit for the emotional wreck I was at the time.

But it's a gateway drink. And by 2002 I was drinking cortados. And by 2006 I had my own espresso machine and was some sort of caffeine Keith Richards, doing maybe 10 strong cups a day, buying expensive blends... and then I had to stop.

On January 1st 2008 I woke up at 4AM with intense chest pain. I thought I was having a heart attack. I walked to the hospital and it turned out to be gastritis. This happened again. And again. Not often, but once every year, then every six months, then every month, then four days in a row. And I had to give up coffee.

It was hell. I was asleep all day and awake all night, not having my crutch to modulate my sleep. I was grouchy, and annoying. I cheated. But then I stopped.

Sorry dad.

2012-01-03 00:01

The death penalty and other conspiracies.

Every once in a while, something awful happens. And then someone will say "the people who do that should get the death penalty". Invariably, that is a stupid argument.

Let's start by disposing of the obvious low blow: "if it happened to your son, you would ask for their death too". To which the obvious answer is, of course I would. And I would be pushing for a stupid solution to the problem.

If something really, really bad happened to my son, I would be suffering, and in a state of violent emotion and distress. If I told you to jump off a bridge, would you? I guess not, because you would notice I am at the edge of madness and just told you that because I am feeling that way.

Well, the same is true about a victim's relatives (or the victim himself) asking for a specific punishment: it's a request born from pain and suffering. And as a society, we should not decide our actions based on te proposals of the ones almost insane with grief. Because we want to take the action that is better for society, not for a specific member of it. So, forget about that appeal to sentiment, because while completely understandable, it is stupid, because those grieving are allowed to be stupid.

Another failed argument for the death penalty is that it discourages future crime. This has been shown not to be the case, because similar countries or states with and without death penalty show no significant difference on crime rates.

I suspect this is because in many cases the criminal doesn't intend to actually commit the part of the crime that brings the death sentence (murder when robbing? The criminal wanted to rob, not to murder) or he just would do it anyway (it's not as if child rapists expect to have a nice time when captured. They just do it assuming they won't get caught, or decide it's worth it anyway).

And of course, the main reason why the death penalty is a bad idea is that it would be applied by public employees. Do you trust the government to decide how much to charge you in taxes? No, you do it yourself, with an accountant, and tell them how much to take. Do you expect the police to find a wallet you dropped on the street? Do you trust the government's mail with really important packages? Are you confident about the government figuring out all environmental issues? Well, then why would you trust them to kill anyone they decide is a really, really bad guy?

The government is a great idea for things noone else wants to do (highways), or things noone else should be doing (law enforcement) but even in those cases you must allow for them providing a crappy service, and carefully use your input to limit what they can do.

The alternative is to assume that the government has a huge capability and competence but has just decided not to show it, which is perhaps the most amazing part of most conspiracy theories.

The US government can't kill Castro, but can kill Kennedy. A government can't keep the trains running, but can fake a moon landing. And so on, and so forth.

I once read a book where they described an interesting science: Conspiracy Theory Theory. It's the science of studying what conspiracy theories people believe in, to get insight into what they actually believe. If you are in favour of the death penalty, then you believe law enforcement doesn't make mistakes, or that killing a few random people every now and then (because they make mistakes) is not a problem. If the first, you are stupid, if the second, you are evil.

2012-01-02 18:10

The worst leash is the one you don't feel: a random walk through a piece of metatextual string

Almost noone likes to be tied down. That is surely a non-controversial statement. Of course, some people disagree (you freaks). But let's ignore them (freaks) for a few minutes, and consider the concept of tying and ties.

I have spent many an unpleasant minute trying to explain to laymen why there is a branch of mathematics that has a formal definition of what is or isn't a knot. Usually that is met by the usual eye-rolling and comments of "you stupid math people" and "it's obvious" (but it isn't). If you don't know what a knot is, and what is a knot, then you don't know whether you are tied to something or not.

How can you know anything if you don't know what things are attached to you, and what you are attached to? Literally, you can't know yourself without knowing about knots, and how they bind you. Even eastern primitives who didn't know about the germ theory of disease recognized the importance of this, and preached the need to detach yourself, to cut the knots tying you to the material world.

Consider the seminal 80's sitcom, Family Ties. It's all about the attachment between a boy and his money. And then the boy grows up, becomes a writer, goes to the big city and gets drunk and does a lot of drugs, but it is also about how he feels attached to his family... and about how the kid wears ties.

Is it a coincidence? I say it's impossible. Why is the clearest sign, the obvious indicator of belonging to grownup society a piece of string that you tie? Because otherwise it would fall off your neck? Yes. But sometimes an obvious symbolism is ust an obvious symbolism. You tie your tie, and you tie yourself.

Why don't women use ties? Well, because they have not yet reached that epoch in clothing. Ties are derived from Croatian Cravats and date all the way back to the 17th century. but women mostly still dress like 16th century peasants. If you look in renaissance pictures, all men have purses. Later, none of them do, because they have a great modern invention, called pockets. For some reason, women are stuck in the pre-pocket age of clothing.

Here's a simple exercise for heterosexually married people: count the pockets on women's garments and on men's garments. I (male) rarely can be found wearing fewer than 6 pockets. If I were to dress in modern clothes (suit), I would have over 10 pockets. Most women's wear (except jeans) has no pockets. Or (jeans) it's so ridiculously tight that you can't use the pockets. So women use purses. But if you use a purse, you are basically giving up a hand a certain part of the time. Would you give up a hand 10% of the time to make a fashion statement? I say if women were to make that decision consciously they wouldn't do it.

So why is that? Beats me. So, while men use ropes tied to their necks to show adherence to society, women are partly lamed for the same reason (not to mention the idea of buying shoes that are pretty but hurt a bit when walking). Goes to show that not all ties are visible. Following these conventions are invisible or only metaphorically visible ties. The later stoics (much smarter people than the previously mentioned eastern primitives: they had indoor plumbing) said things like this:

"Things not in our power include the body, property, reputation, office, and, in a word, everything which is not our doing. Things in our power are by nature free, unhindered, untrammeled; things not in our power are weak, servile, subject to hindrance, dependent on others."

Now, how much fun is it to say that everything you own is not in your power. That the very power you possess is not in your power. But they also said that you had two things that were the most important: the will to get and the will to avoid. Those are the basic tools of human existence. If you have the will to avoid pain, you can not buy painful shoes. If you have the will to get pockets, you get pants with pockets. And you can decide what you want to get or avoid by just thinking. There is no secret.

2012-01-01 16:40

2011

So, this is 2012. Looks a lot like the previous model. On the other hand, there are going to be some changes around here. For starters, I am going to post. I am going to post every day in 2012. In this blog. Here. In 2012. 366 posts. At least.

Of course, this is wishful thinking, it's just a new year's resolution, and those are, like everything, doomed to fail, to corrupt themselves, to fall prey to rationalization, latest victims of entropy and decay. Then again, so am I, and so are you, and it makes no sense to dwell in the sure failure to come, and instead I should focus on the current victory. This is the first day of 2012 and I am, indeed, posting today.

So, just to contradict myself, which I will do every time it may be more fun than being consistent with that moron I was in the past, let's talk about my past year.

Professionally, 2011 was a really big change, in that I stopped working on my own company and started (ok, that was in Dec 2009) working for Canonical. It has been really great in many ways, and not so great in others.

Great: I work with people I really like and respect. The work itself is full of interesting challenges.

Not Great: I have completely abandoned my free software projects, which are bitrotting.

Great: I have had the chance to visit three continents, and have awesome experiences.

Not Great: I have heard my kid cry on the phone about how he misses me. This year I may travel a bit less.

Great: Financial security for me and my family.

Not Great: If I had to grade my performance in a 1-10 scale, I may give myself a 6. I have lacked energy, and focus. I have been disorganized and lazy. I will try to improve.

Great: we shipped product.

Not Great: we could have shipped better product. I will do my part to make it better in 2012.

What else has been going on i my life in 2011? Well, my health is worse. I am fatter. I have been diagnosed with a hormonal imbalance which may account for some/most/all of it, and I will be starting treatment this month. This may also be to blame for part of my hypertension, and for my abysmal level of energy the last couple of years.

I have put my marriage under a big strain, which I hope I can revert in 2012, since I really love my wife, and want to make her happy.

I will get my mouth fixed this year. If you know me personally you may know what that means. I have awful teeth. I have never fixed them because of a perhaps understandable fear of having people put sharp things in my mouth. But I want to be able to smile to my family, so I will get it fixed. (BTW: you have not seen a honest, unthinking smile from me in about 15 years. Sucks, I know.)

How will I be able to do all these things? I don't know. I know I may not. I suspect I will not. I expect I will not. I will not. But I will try. I will do what I can, and take the fall for what I can't.

But right now, I am focusing on little bits. I am posting in this blog. 1 day down, 365 to go.

2011-10-25 22:32

¡Hippie Pachuli Sucio!

For the english readers: Sorry, spanish-only post!


En Argentina hay Internet. En la Internet hay un sitio que se llama Taringa. En Taringa hay links a libros escaneados.

Y no libros Creative Commons, ni de dominio público, libros publicados hace un rato, libros con autores que esperarían ganar algún mango con eso.

Y en Argentina hay leyes. Y una de esas leyes es la ley 11723 de propiedad intelectual. Y esa ley prohíbe copiar libros y repartir las copias, aunque no cobres por ello.

Entonces, en Argentina, hay una Taringa que tiene a sus dueños procesados por violar la ley 11723.

¿Está bien violar la ley? En general no. ¿En particular sí? Bueno, a veces, violar alguna ley con la que uno está en desacuerdo, puede estar bien. Por ejemplo, violar las leyes que segregaban a los negros en USA, estaba bien. Eso se llama desobediencia civil.

¿Entonces, lo que hacen en Taringa es desobediencia civil? Y que se yo. Ni idea. El tema es que uno no va y hace desobediencia civil esperando salir impune.

Uno lo haría porque quiere que lo pesquen, lo hace de forma pública y visible, de manera que al aplicársele el castigo, la represión o lo que fuera, se envíe un mensaje a la sociedad, para provocar el reemplazo de la norma injusta con una mejor, pero respetando el proceso democrático.

Veo muchos que se llenan la boca con "propagar la cultura" y con "el derecho inalienable a leer" y con "el antinatural e injusto monopolio del copyright". Mi respuesta para ellos es: Pfffffft. Con ruidito a pedo. Si pudiera salpicar un poquito de baba a través de la internet en su dirección mientras hago Pffffft, lo haría.

¿Saben cómo se crea y se comparte cultura libre, nenes? Creando y compartiendo cultura, nenes. Si querés que haya libros libres, escribí un libro libre. Si querés que haya música libre, componé música libre. Si querés que se copie arte, hacé arte y ofrecé el derecho a copia.

Si tu idea de propagar cultura es poner un PDF de una revista "de informática" en rapidshare, sos un gil. Sos un gil porque 1) el 99% de las revistas de informática son una garompa en forma de revista, y 2) porque te creés un vivo. Y todos los que nos creemos vivos somos giles.

Al hacer eso, creás la sensación de que la revista es valiosa y especial cuando en realidad es un recalentado de cosas que ya pasaron hace un mes o dos. Si te creés un vivo por eso, sos un gil. No hay nada ahí que no esté afuera. Si hubiera algo ahí que no está afuera, entonces sabés qué? El tipo que lo puso ahí adentro se merece que le garpen.

Sí, ya sé, el modelo de negocio en base a la venta de copias es naif e injusto. Que la protección del copyright fomenta la creación es una excusa y un mito. Pffffft. El solo hecho de que Disney sea tan grande que puede mover las leyes de EEUU para que Mickey nunca sea de dominio público debería darte la pista de que la protección del copyright ha sido buena para Disney. Y podrá gustarte o no lo que hacen (acordate: Pixar es parte de Disney), pero no podés decir que no crean cosas. En cualquier caso, podrás quejarte de que la protección del copyright funcionó demasiado bien y hay que debilitarla. Pero no podés decir que no fomentó la creación, por lo menos no sin mentir descaradamente.

Si realmente creés que repartir las cosas gratis es un mejor modelo de negocios que esa ingenuidad injusta de cobrar por las copias, DALE. Si empezás vos, ahora a aplicar ese modelo de negocios, mientras los demás están todavía con la perimida idea de cobrarle a la gente por lo que hacen... ¡Tenés una ventaja competitiva!

Ahora bien, si tu modelo de negocio es, en cambio, tomar lo que escribieron/cantaron/programaron otros, copiarlo y venderlo sin su permiso... bueno, digamos que no, no tenés ventajas competitivas porque eso lo puede hacer cualquier nabo que cree que va a salir impune.

Si en cambio creés en que está bueno compartir lo que hacés aunque no deje guita, entonces también es un buen momento para hacerlo.

Si realmente creés que la cultura libre es superior, usala y consumila en vez de consumir y usar la que no es libre. Si uno cree en la cultura libre, no piratea.

Si te llenás la boca hablando de cultura libre y después vas y te copiás el CD de Britney... sos un hipócrita que racionaliza para justificarse sus acciones ante sí mismo y sus pares. Te imaginás una opresión para sentirte un rebelde. Te hacés el piojoso para que te rasquen. Y no te lo respeto un corno.

Contents © 2000-2019 Roberto Alsina