Skip to main content

Ralsina.Me — Roberto Alsina's website

The pain of having seen something once

It must be hor­ri­ble to have said some­thing smart, maybe even in­sight­ful, on­ce, and be la­beled for life as a vi­sion­ary, or a pun­dit, or some oth­er sim­i­lar in­sult.

Con­sid­er Clay Shirky's com­ments on this ar­ti­cle. It's ab­so­lute non­sense, based on ran­dom guess­ing.

I prom­ise this: this blog will have no in­sight on any­thing as long as I write it. I could­n't han­dle the pres­sure.

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­up.py) 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
popd

Or this:

(cd foo && bar -baz)

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

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

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"):
        run("bar")
  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()
            os­.chdir(­self.new_dir)
    
        def __ex­it__(­self, *_):
            os­.chdir(­self.old_dir)
  3. It's even eas­i­er to do:

    from con­textlib im­port con­textman­ag­er
    
    @con­textman­ag­er
    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 ex­­cep­­tions

    @con­textman­ag­er
    def cd(­path):
        old_dir = os­.getcwd()
        os­.chdir(­path)
        try:
            yield
        fi­nal­ly:
            os­.chdir(old_dir)

All in al­l, I learned how to do con­text man­ager­s, about con­textlib, about fab­ric and about path.py. 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.


Contents © 2000-2020 Roberto Alsina