2012-02-03 21:45

Alfajor: theory and practices

0708101901

An alfajor is, in theory, a simple thing. It's a dessert sandwich. The argentinian alfajor is usually filled with dulce de leche, which means you just can't screw it up. Even a bad alfajor is going to be good.

Yes, there are some regional alfajores filled with other stuff. Don't pay any attention to those impostors. They are hipsters wearing fake glasses they don't need. What you want is dulce de leche.

alfajor heaven

But the filling is only half of a sandwich, and a third of an alfajor. There is also the things that surround, hold and contain the notoriously sticky dulce: cookies. Some variants have tried to improve on the cookie by either going soft (cake!) or hard (Milka Mousse), but the real deal is a soft-ish cookie, not too soft (so the alfajor doesn't desintegrate) and not too hard (so it doesn't feel like eating a hockey puck).

Feliz cumpleaños

There is an impossible tradeoff, between dulce de leche and the cookie. Too much cookie, you are eating cookies. Too much dulce de leche, you may as well get a spoon and eat out of the jar (try it sometime). You want to balance, but the alfajor is walking food, it has to be edible by a 6-year old schoolkid while climbing a tree, it has to be solid enough, and not fall apart, and not cover him on melted frosting. The child has to be able to pass inspection of his hands after cleaning with just the wrapper and his own mouth.

Alfajor

The alfajor santafesino has adopted a minimax strategy, maximizing the amount of dulce de leche per amount of cookie, by using extra-thin "cookies" that are more like crackers, adding multiple layers, and making the whole alfajor thicker. I love it, but it is not for everyone.

Alfajores Cordobes

The alfajor de maicena goes in a completely different direction, having a tasty cookie that can hardly hold any dulce de leche because it's too friable. Somehow that works wonderfully as well.

Alfajorcito de Maizena

Then there is the covering. Chocolate, frosting, coconut, or nothing. Chocolate is bad in summer, melting and making you eat the alfajor from the wrapper as if it were a banana.

Ahora si... ya puedo empezar a trabajar...

But if you have no idea what an alfajor is, which one should you have? I could point you to the most sublime alfajores, which would be life-changing experiences, but I will not. If you tried those, which you can only get in out of the way places, known only to initiates, where could you go from there? It's like your first date being with Sofía Vergara. That would be just leading you into a life of disappointment.

Provecho...

So get a chocolate Havanna. Get a Cachafaz. Get a Capitán del Espacio. Get a tube of Jorgitos. And when you have done your apprenticeship, when you are an alfajorman, when you are ready. Then you will know.

Alfajores

PS: Thanks to Juan Rodriguez Monti for the idea for this post.

2012-02-02 22:00

$HOME is where .bashrc is

I have a confession to make. For the last year or so, my main operating system has been Windows 7. Yes, I know, it may come as a shock to some, specially if you have read this which is my post that had most hits in a day ever.

How did that happen? What happened to me? What was I thinking? It's a boring and uninteresting story.

I joined Canonical. My old notebook wouldn't cut it. My new one would not take Ubuntu without a fight. I said "hey, I will live in a VM!". The VM was deadly slow. I had to develop windows software (yes). Some stuff would not work right on the VM. And slowly, things just started piling up in the bare-metal OS, which was, yes Windows 7 Home Premium.

As a whole, Windows 7 is not horrible. Most things work well. What it is, is a desert for a developer. Sure, you can get a plant to grow there, but you have to put a lot of effort into it.

So, today I installed Kubuntu Oneiric (absolutely no problem now!), gathered all the data from the old notebook, the VM, the windows installation, deleted windows, and moved into Linux again, and made Windows the VM.

I missed it.

2012-02-01 22:00

Remaking the 70s

If you have read Coffee and I ... well, let's say the 70s filter is proper, and that this was a happy evening for me.

http://s0.i1.picplzthumbs.com/upload/img/0a/2f/c0/0a2fc0231fe0cb6e4a83ddd6e4e0546061e1997b_wmeg_00001.jpg

Stories don't repeat themselves if you don't let them.

2012-01-31 22:58

Consejos para el charlista tímido

Sorry, spanish only today!


Debo haber dado, en los últimos 15 años, unas 80 charlas. O tal vez 50. Qué se yo, no las ando contando. Desde hace unos cinco años a esta parte, me dicen que vienen saliendo buenas (con altibajos, por supuesto).

Entonces, inspirado por How to be a PyCon speaker and do it well acá van una serie de consejitos para que los que no se animan a dar charlas se animen.

Este es el más importante: el público no muerde. En serio, lo peor que vas a escuchar es algo del nivel de "se ve que estaba nervioso" o "se perdió un poco en tal parte" o "el tema no me interesó mucho". En la gran mayoría de los eventos que he estado, no hay ningún ánimo de agredir al orador. Nadie te va a tirar tomates. Y al día siguiente nadie se va a acordar si estabas nervioso.

Tenés que saber a quién le estás hablando. Hacéte un modelo de como es tu espectador ideal. Hacé una charla que le pueda interesar a ese modelo. Si tratás de hacer que le guste "a cualquiera" entonces no le va a gustar a nadie.

Pensá mucho el título. Si tu charla es para principiantes que quieran aprender flask, ponele de nombre algo como "Introducción para los que no saben nada nada nada de Flask pero quieran aprender un poquitito de como usar un microframework web que está buenísimo". No le pongas "Flask: un microframework web". Ok, no le pongas ninguno de los dos, ponele "Flask desde cero". Yo le pondría "Flaska, no me claves, los puñales, por la espalda" pero eso es porque me gusta Bottle.

No pienses los slides. Pensá lo que querés decir. Una vez que lo sabés, partílo en, ponele, 10 pedacitos de 3 minutos, y hacé un slide para cada uno. Si no podés hacer un slide, hacé dos.

Los slides son el menú, no la comida. Los slides no son la charla. Si puedo entender la charla viendo los slides, entonces o tu charla está estirada, o tenés muchos slides. Asegurate que se lean. No importa tanto que sean lindos: que se lean. Regla: poné los slides en tu notebook, poné el brillo en mínimo, y miralo desde 3 metros. Si no lo ves, no se vé.

Cuanto ensayar, depende de cada uno. Yo no ensayo, pero es porque soy un tarado. Si ensayás demasiado sale medio sin espontaneidad, tal vez. Pero si no ensayás nada, a veces ni sale. O sea, ensayá hasta que te sientas cómodo, y ahí pará.

Hablá como hablás vos. No trates de hablar como otro, aunque te guste mucho mucho mucho como habla. No trates de ser gracioso, si sos gracioso va a salir natural. No trates de ser interesante, si la charla es interesante alcanza.

No hagas cosas interactivas a menos que estés segurísimo que no te vas a trabar.

No hables de cosas que no te interesen "porque son importantes" o o "porque alguien debería hablar de eso".

Hablá fuerte, aunque tengas micrófono. Cuando hablás fuerte hablás más claro y pausado.

Tenés que saber cuanto tiempo te queda. Todo el tiempo.

Tenés que tener dos o tres puntos para terminar la charla. Cuando se te va acabando el tiempo, la terminás en el que mejor te quede.

"Decíles lo que les vas a decir, decílo, y decíles que les dijiste"

Si no sabés, admitílo. Si guitarreás, decí "estoy guitarreando, pero...". Si estás nervioso decí "me estoy meando", si te perdiste tirá todo a la mierda y uníte al circo Rodas (o pedí un segundo para ordenarte).

Ponéle onda a la parte de preguntas y respuestas. No pongas cara de "no entendiste una goma de lo que dije", porque capaz que es culpa tuya.

Rompé todas las recomendaciones que te dí si te parece que va a funcionar mejor. Por ejemplo, capaz que querés tener 100 slides y pasar uno cada 10 segundos. O no querés tener slides. O querés tener slides que hablan de otra cosa. O querés tener slides que pasen solos. O querés tener slides interactivos y actuar Mingo y Aníbal contra los fantasmas.

Y la más importante (si, ya sé que dije que la otra era lo más importante, no jodas): followup. Invitálos a charlar cuando te vean en el pasillo. Dejá tu mail, blog, twitter o lo que sea. Invitá una cerveza. La charla en sí sirve hasta ahí, es mejor si de la charla sacás un amigo.

2012-01-31 18:08

Garbage Collection Has Side Effects

Just a quick followup to The problem is is, is it not? This is not mine, I got it from reddit

This should really not surprise you:

>>> a = [1,2]
>>> b = [3,4]
>>> a is b
False
>>> a == b
False
>>> id(a) == id(b)
False

After all, a and b are completely different things. However:

>>> [1,2] is [3,4]
False
>>> [1,2] == [3,4]
False
>>> id([1,2]) == id([3,4])
True

Turns out that using literals, one of those things is not like the others.

First, the explanation so you understand why this happens. When you don't have any more references to a piece of data, it will get garbage collected, the memory will be freed, so it can be reused for other things.

In the first case, I am keeping references to both lists in the variables a and b. That means the lists have to exist at all times, since I can always say print a and python has to know what's in it.

In the second case, I am using literals, which means there is no reference to the lists after they are used. When python evaluates id([1,2]) == id([3,4]) it first evaluates the left side of the ==. After that is done, there is no need to keep [1,2] available, so it's deleted. Then, when evaluating the right side, it creates [3,4].

By pure chance, it will use the exact same place for it as it was using for [1,2]. So id will return the same value. This is just to remind you of a couple of things:

  1. a is b is usually (but not always) the same as id(a) == id(b)
  2. garbage collection can cause side effects you may not be expecting

2012-01-30 22:29

Sacrifices & Rock & Roll

Sorry: english only because my kbd is acting up an typing is a chore.


Here I am, writing in a place of evil so deep they charge you $56 (that's pesos) for a tiny sandwich and a bottle of water: the Gianni & Vittorio café at Córdoba Airport.

It's like Mordor, except the water is kinda-sorta-slightly-cold, and I carry no rings. And there is very little lava. But the evil... the evil is dense, as it can only be at airports, Minas Morgul, and perhaps the choripán place near Lisandro de la Torre station (which I strongly recommend).

But why do I do it? Because I have already failed. I will not post everyday this year. I may not even be close. But I will post as much as I can. And I promise it won't be filler about why I did not do a real post.

So, onto the meat of this post we go.

It's inevitable that airports will have expensive and bad food. It will be expensive because there are a limited number of sellers, and getting to be one of them is expensive. Since they can charge whatever they want, they have no incentives to provide quality or service.

Plus, they own a captive customer base, since you are locked there, and there is no place to go outside the airport etiher.

That is classic government-mandated market distortion, with the airport management as the government, and you playing the role of you. This kind of clear examples are good because they show capitalism and free market advocates actually have a decent point when they remark on the defects of imperfect markets.

OTOH, I don't see any communists around here oppressing me, I see only happy capitalists taking my money.

PS: it seems there was a tornado here today.

2012-01-28 18:14

The problem is is. Is it not?

This has been a repeated discussion in the Python Argentina mailing list. Since it has not come up in a while, why not recap it, so the next time it happens people can just link here.

Some people for some reason do this:

>>> a = 2
>>> b = 2
>>> a == b
True
>>> a is b
True

And then, when they do this, they are surprised:

>>> a = 1000
>>> b = 1000
>>> a == b
True
>>> a is b
False

They are surprised because "2 is 2" makes more intuitive sense than "1000 is not 1000". This could be attributed to an inclination towards platonism, but really, it's because they don't know what is is.

The is operator is (on CPython) simply a memory address comparison. if objects a and b are the same exact chunk of memory, then they "are" each other. Since python pre-creates a bunch of small integers, then every 2 you create is really not a new 2, but the same 2 of last time.

This works because of two things:

  1. Integers are read-only objects. You can have as many variables "holding" the same 2, because they can't break it.
  2. In python, assignment is just aliasing. You are not making a copy of 2 when you do a = 2, you are just saying "a is another name for this 2 here".

This is surprising for people coming from other languages, like, say, C or C++. In those languages, a variable int a will never use the same memory space as another variable int b because a and b are names for specific bytes of memory, and you can change the contents of those bytes. On C and C++, integers are a mutable type. This 2 is not that 2, unless you do it intentionally using pointers.

In fact, the way assignment works on Python also leads to other surprises, more interesting in real life. For example, look at this session:

>>> def f(s=""):
...     s+='x'
...     return s
...
>>> f()
'x'
>>> f()
'x'
>>> f()
'x'

That is really not surprising. Now, let's make a very small change:

>>> def f(l=[]):
...     l.append('x')
...     return l
...
>>> f()
['x']
>>> f()
['x', 'x']
>>> f()
['x', 'x', 'x']

And that is, for someone who has not seen it before, surprising. It happens because lists are a mutable type. The default argument is defined when the function is parsed, and every time you call f() you are using and returning the same l. Before, you were also using always the same s but since strings are immutable, it never changed, and you were returning a new string each time.

You could check that I am telling you the truth, using is, of course. And BTW, this is not a problem just for lists. It's a problem for objects of every class you create yourself, unless you bother making it immutable somehow. So let's be careful with default arguments, ok?

But the main problem about finding the original 1000 is not 1000 thing surprising is that, in truth, it's uninteresting. Integers are fungible. You don't care if they are the same integer, you only really care that they are equal.

Testing for integer identity is like worrying, after you loan me $1, about whether I return you a different or the same $1 coin. It just doesn't matter. What you want is just a $1 coin, or a 2, or a 1000.

Also, the result of 2 is 2 is implementation dependent. There is no reason, beyond an optimization, for that to be True.

Hoping this was clear, let me give you a last snippet:

>>> a = float('NaN')
>>> a is a
True
>>> a == a
False

UPDATE: lots of fun and interesting comments about this post at reddit and a small followup here

2012-01-27 22:49

Hello

Hello, my name is Roberto Alsina. You may know me from my appearances in "KDE Developers in the Stone Age" and "PyQt programmers gone wild".

On the other hand, I am not:

  • Roberto Alsina, who lives in Houston and is active in the Argentine expatriate community.
  • Amado Roberto Alsina, paraguayan politician.
  • Roberto Ariel Alsina (aka Roberstorm) who drives a motorcycle.
  • Roberto Alsina, puertorican architect.
  • Roberto Alsina, who lives in Villa Alemana and attended Colegio Buckingham.
  • Roberto Alsina Ruibal, who I hope is wearing a wig.
  • Roberto Gonzales Alsina, who lives in Canelones. I only eat canelones.
  • The FEARED Roberto Nava Alsina who, while only 15 years old, is scoring goals in some amateur league somewhere.
  • Roberto Lebron Alsina (I have slightly more hair)
  • Roberto Antonio Gómez Alsina, activist against bullfighting

Hopefully, this will clear things up. Thanks for reading.

2012-01-23 23:30

Re-Editar Drácula: Proyecto que me gustaría que alguien agarre.

This post makes no sense in english, so spanish only!

Drácula es un libro muy particular. Casi todo el mundo cree que sabe de qué se trata, pero en el 90% de los casos no es así. O sea, sí, saben que es de un vampiro, blabla.

Lo que no saben es nada del libro. Saben de las películas, del especial de Scooby Doo, delos chistes de vampiros, y cosas así, pero el libro en sí, no lo han leído.

¡Y es una lástima! Es un libro muy interesante. Para la época que se publicó, tiene un estilo dinámico y poco verborrágico. Está lleno de acción, escenas memorables (no es raro que se hayan hecho tantas películas), personajes interesantes. ¡Y encima es un libro tecnófilo! No es una lectura forzada leer Drácula como una micro-expresión de la lucha entre la ciencia y la técnica positivista contra la cultura medieval reaccionaria, o cosas así.

Y entonces, cuando el otro día ví, en Work of Art (un reality), a unos diseñadores crear tapas para Drácula, se me ocurrió:

Editemos Drácula

Agarremos el original, que es de dominio público, hagamos una traducción moderna, hagamos ebooks, y quién te dice, una edición en papel. Regalémosle a la gente la posibilidad de leer una versión moderna de este libro buenísimo. Una traducción que no sea castiza, ni dé vergüenza hablando de "estofado con polvo de pimiento rojo" si no que diga goulash, o por lo menos "estofado con paprika".

Yo tengo un poquito de cancha haciendo typesetting de libros. Seguro que se puede conseguir ilustrador/a/es copado/a/as/os para la tapa, títulos (¡o para ilustrar intercalado!)

Y... lo mejor es que:

  1. Es un libro relativamente corto
  2. Está escrito en muchas voces distintas. No estaría buenísimo que Mina Harker lo escriba una mujer? Que Van Helsing escriba totalmente distinto que Lucy?

Entonces: se necesitan muchas cosas, pero más que nada, se necesitan traductores.

¿Quién quiere salir en la tapa de este libro? ¿Quién quiere traer al auténtico Drácula, el vampiro en serio, un auténtico macho de los cárpatos, de vuelta a la vida?

Anótense en los comentarios.

Contents © 2000-2019 Roberto Alsina