Skip to main content

Ralsina.Me — Roberto Alsina's website

Writer's block

In­ter­est­ing thing about writ­ing a post ev­ery day: I did­n't get blocked yet. Sure, this is on­ly the 9th post, but con­sid­er­ing my pre­vi­ous post-a-­month ca­dence, and that I would just have noth­ing to write about, it's clear to me that writ­ing leads to writ­ing.

That is per­haps the most ob­vi­ous thing that not ev­ery­one no­tices: the way to do things is to do things. The way to write free soft­ware is to write soft­ware that is free. To go to Alas­ka you have to go. To Alas­ka. To write, you have to write. To do mu­sic, you have to do mu­sic. To make bread, you have to make bread.

Will ev­ery piece of bread you make be good? Will ev­ery­thing 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 any­thing de­cent lat­er. I think it was Amadeo Car­ri­zo (fa­mous, old, goal­keep­er) who said about a (not so fa­mous, young, goal­keep­er) "He's not bad, but he needs to be scored on a few hun­dred times more be­fore he's good".

I have a long his­to­ry of fail­ure. I have a short sto­ry of suc­cess­es. I am work­ing on it.

Abandonment issues: rst2pdf

Of all the corpses of my pro­ject­s, there is one thatI feel worse about, which is rst2pdf. I feel bad about aband­non­ing sev­er­al, but rst2pdf was ac­tu­al­ly a use­ful tool, used by a bunch of peo­ple, and that it has nev­er gath­ered enough mo­men­tum with oth­er de­vel­op­ers is sad.

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

  1. Gath­­er some patch­es that are lin­ger­ing on the is­­sue track­­er

  2. Fix some sim­­ple-ish bugs

  3. Make an­oth­er re­lease with 1) and 2)

And of course:

  1. Not let it fall in dis­­re­­pair 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 com­plete­ly nut­s, ab­so­lute­ly out of scope for any giv­en do­cu­tils tool, and just too cool :-)

I will try to hi­jack his code (prop­er cred­it and so on), and in­cor­po­rate it in­to rst2pdf.

And Dim­itri, or any­one else who wants to do cool stuff with rst2pdf: let me know! I will give you com­mit rights im­me­di­ate­ly!

Python context managers: they are easy!

This comes from this thread in the Python Ar­genti­na mail­ing list (which I strong­ly rec­om­mend if you read span­ish).

I was the oth­er day try­ing to do shel­l-scrip­t-­like-things on python (as part of a mon­ster set­ and I was an­noyed that in shell it's easy to do this:

cd foo
bar -baz
cd -

Or this:

pushd foo
bar -baz

Or this:

(cd foo && bar -baz)

And on Python I had to do this, which is ver­bose and ug­ly:

cwd = os.getcwd()
    os.system('bar -baz')

This is what I want­ed to have:

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

And of course, you can't do that. So, I asked, how do you im­ple­ment that con­text man­ager? I got sev­er­al an­swer­s.

  1. That's avail­able in Fab­ric:

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

    class DirCon­textM(ob­jec­t):
        def __init__(­self, new_dir):
            self­.new_dir = new_dir
            self­.old_dir = None
        def __en­ter__(­self):
            self­.old_dir = os­.getcwd()
        def __ex­it__(­self, *_):
  3. It's even eas­i­er to do:

    from con­textlib im­port con­textman­ag­er
    def cd(­path):
        old_dir = os­.getcwd()
  4. That's cool, so let's add it to

  5. Maybe check for ex­­cep­­tions

    def cd(­path):
        old_dir = os­.getcwd()

All in al­l, I learned how to do con­text man­ager­s, about con­textlib, about fab­ric and about Which is not bad for 15 min­utes :-)

Book review: The Windup Girl by Paolo Bacigalupi

I start­ed this book with high hopes. Af­ter al­l, this was a book by a new-ish au­thor that had won Hugo Award for Best Nov­el (2010), Neb­u­la Award for Best Nov­el (2009), Lo­cus Award for Best First Nov­el (2010), John W. Camp­bell Memo­ri­al Award (2010), Comp­ton Crook Award (2010) Comp­ton Crook Award (2010), Goodreads Choice Award Nom­i­nee for Sci­ence Fic­tion (2009). Im­pres­sive, uh?

Well, I don't know what they saw in it. Shal­low char­ac­ter­s, per­va­sive fa­tal­ism dis­guised as depth, mprob­a­ble slang ust be­cause it sounds cool (windup girl? Re­al­ly? That's how they will call ge­net­i­cal­ly en­gi­neered hu­mans in the fu­ture? Windup­s? Yeah, right).

Oh, and it's full of ori­en­tal­is­m. And of things like im­plant­ing gene dogs in­to windups to make them loy­al and sub­servien­t. And ghost­s. Oh, crap, al­most noth­ing in this nov­el worked for me. Most pages had me slap­ping my­self on the fore­head.

I am­not against a sol­id dose of weird. I like weird. I read Miéville, for crap's sake. But this is not weird, it's con­trived.

And don't get me start­ed on the end. The end is such an ob­vi­ous anal­o­gy to Eden it al­most made me puke. It's like the end of Bat­tlestar Galac­ti­ca, but set on the fu­ture. And with la­dy­boys.

I had a bet­ter time read­ing H. Rid­er Hag­gard's "Al­lan Quater­main", which I saw men­tioned in the awe­some se­ries "The vic­to­ri­an Hugos". Old and dat­ed? Sure. But I would vote for it in­stead of "The Windup Girl" ev­ery day, and twice if they let me.

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

The ti­tle is a quote from Juras­sic Park, if you were won­der­ing. A girl, chased by di­nosaurs, runs in­to a com­put­er, no­tices it's Unix, says "That's Unix! I know Unix!", and pro­ceeds to hack some­thing or oth­er that lets her es­cape the pre­vi­ous­ly men­tioned di­nosaurs.

Well, that's how life of­ten feels for me, ex­cept with Math. And with­out di­nosaurs. I am sur­round­ed by trou­ble, some­thing is com­plete­ly bro­ken in a way I can't quite get, things feel just slight­ly weird... and sud­den­ly... 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 no­tice the huge dis­count is just a clev­er­ly dis­guised tiny dis­coun­t. A snip­pet of news may re­veal it­self as com­plete non­sense af­ter a cur­so­ry anal­y­sis. A for­ward­ed mail may be­come slight­ly more an­noy­ing be­cause of its ob­vi­ous stu­pid­i­ty. Be­cause of math.

Math is the tool I have to make sense of things. When the world gets con­fus­ing and scary, if it can be ex­pressed in num­ber­s, it calms me down. Afraid of the fu­ture? Let's con­sid­er the won­ders of com­pound in­ter­est. Scared of death? Well, look at prob­a­bil­i­ties. Need­ing a lit­tle ad­ven­ture? Well, there is game the­o­ry! Need a con­ver­sa­tion starter? You can men­tion you once spent time in class fig­ur­ing out the ho­meo­mor­phism that ex­plains the scene in Flash­dance where the welder re­moves her bra through her sleeve.

Math tells me the world is not per­fec­t. Math tells me the num­bers I see on my com­put­er are not re­al­ly re­al num­ber­s, and can't be trust­ed. Math tells me I can't cross all the bridges in Könis­gerg on­ly once. Math tells me the num­ber one is the most fre­quent num­ber in to­day's pa­per. Math tells me Pla­to was right and there is a uni­verse of pure ideas, and this is but a re­flec­tion.

On the oth­er hand, Math tells me I can cut an or­ange in­to a few pieces, which re­assem­ble in­to two, iden­ti­cal, or­anges. So take what she says with a grain of salt.

Contents © 2000-2021 Roberto Alsina