Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

A day at the movies (March 21, 2007)

I have this agree­ment with Rosar­i­o: we will go to the movies to­geth­er. But not, un­der any cir­cun­stances, to see some­thing like Crank.

So, on wednes­days (cheap tick­et­s, yipee!) if I am down­town, I will go see that kind of things.

Two weeks ago, it was Rocky Bal­boa. Yes­ter­day it was Crank.

Crank

This is a spe­cial movie. It may seem on the sur­face to be an or­di­nary brain­less ac­tion/vi­o­lence/­sex spec­ta­cle, the kind many take for grant­ed nowa­days. How­ev­er, there are some things noone thinks about when watch­ing it.

When I was a kid, this movie's cin­e­matog­ra­phy would have been im­pos­si­ble. It shows how ac­tion films made 20 (maybe 10) years ago look cheap to­day, be­cause tech­ni­cal ad­vance has been mas­sive.

The script may be dum­b, and med­i­cal­ly in­com­pre­hen­si­ble (like the al­ter­na­tive us­es of ephedrine and ep­i­neph­rine for the same thing. They are not.), but you know what? It's an ex­cuse to have a guy that can't stop. The movie is about a bad guy that can't stop, not about "Haitian hard­core shit. Made of plant shit, man!". Come on, is ra­dioac­tive spi­der bite any bet­ter? Or brain cloud in Joe ver­sus the Vol­cano any bet­ter? (Ok, bad ex­am­ple there).

No one com­plains that Spidey makes no sense. Or that Kong is too large. And that's OK. Then why is the idea of a guy that needs con­stant adren­a­line stupid?

I think that this movie is seen as stupid speaks more about how many things we have al­ready seen. This is not even the first movie about a poi­soned char­ac­ter guar­an­teed to die look­ing for re­venge I saw (That would be D.O.A. which is ac­tu­al­ly a pret­ty de­cent movie).

Look at ac­tion movies like Die Hard. Is it any less stupid? Maybe (and maybe not). But it was there first.

And at least Crank does­n't take it­self too se­ri­ous­ly.

As a bonus, it con­tains the best spo­ken-­por­trait-that-look­s-just-­like-the-guy-scene ev­er.

BTW: it's re­al­ly not a good movie.

Rocky Bal­boa

Warn­ing: this be­low is a lit­tle per­son­al, ram­bling, and prob­a­bly not a movie re­view.

You can make a case for this ac­tu­al­ly be­ing a good movie. It may not get all the way there, but it's a de­cent job, done by com­pe­tent crafts­men. You have to con­sid­er the movie as part of a larg­er thing, the sports movie genre. In par­tic­u­lar, the box­ing movie.

Ev­ery­one has seen them ... Un­der­dog ... Long Odds ... Train­ing Mon­tage ... Fi­nal Fight .. Last Round ... it's al­most like the con­ven­tions lie be­sides con­ven­tion­al nar­ra­tive, just a se­ries of clich­es wait­ing for you, com­ing at you like a riv­er. You can hear the up­per case ini­tials like waves ham­mer­ing at your tem­ples.

But I have many soft spot­s. And one of them is for box­ing, and it's for pure­ly per­son­al, sub­jec­tive, un­de­fen­si­ble rea­son­s.

My dad had a stroke many years ago. He was al­ways a dry man. Af­fec­tion with him was not ex­act­ly a sim­ple mat­ter. We had very lit­tle in com­mon.

But on late fri­day nights we would watch the fight­s. We would talk about them, he with the dif­fi­cul­ty of not be­ing used to talk to me, lat­er that of the hemi­plegic, me with the dif­fi­cul­ty of talk­ing to him.

Af­ter a while, I start­ed liv­ing alone, but kept watch­ing the fight­s, and when I vis­it­ed him, we would do it to­geth­er. Un­til Ben­n-M­c­Clel­lan, which cured me from any en­joy­ment of box­ing I ev­er had.

But I can still ap­pre­ci­ate ex­act­ly how hard box­ing is. Any sport at a high lev­el re­quires skills I don't have, and is hard. Now think about prac­tic­ing a sport (Any sport. Fig­ure skat­ing, if you will!) while an­oth­er guy, just as strong and quick as you is try­ing to beat the crap out of you. That's box­ing. You are not go­ing to con­vince me there is any­thing hard­er in sports (ex­cept maybe some oth­er com­bat sport).

And Rocky Bal­boa is a tale about a guy whose heart is so bro­ken he can on­ly think about that skill he used to have, and he gets a mirac­u­lous chance at do­ing that again, and it's a god­damn fairy tale, and noth­ing else, but I know how the eyes of a guy who would die, who would kill for a chance at do­ing some­thing he can't pos­si­bly do look like.

And that kills me. And this movie killed me. And I got shiv­ers at the end. And I am a goof­bal­l.

Finally a half-decent look for this

I spent an­oth­er cou­ple of hours tweak­ing the blog tem­plates, and the lat­est is half-rea­son­able. Still a few prob­lem­s:

  • The ban­n­er is very ug­­ly on IE

  • Stuff is mis­­aligned (too much margin/­­padding tweak­ing)

But hey, it work­s, and it looks ok, which is more than the usu­al.

I am al­so try­ing feed­burn­er's site stats ser­vice, which is pret­ty de­cen­t.

Official RaSPF page

Ok, time to go a lit­tle more pub­lic with this.

Here's a page for it (click on "read more") and I will ask the open­spf guys to put it on the im­ple­men­ta­tions list (let's see how that goes).

RaSPF on its way to release

I have been able to work some more on RaSPF and the re­sults are en­cour­ag­ing.

Thanks to val­grind and test suites, I am pret­ty con­fi­dent it does­n't leak mem­o­ry, or at least, that it does­n't leak ex­cept on very rare cas­es.

I think I found a neat way to sim­pli­fy mem­o­ry man­age­men­t, though, and that's what I want­ed to men­tion.

This is prob­a­bly triv­ial for ev­ery­one read­ing, but I am a lim­it­ed C pro­gram­mer, so when­ev­er some­thing works un­ex­pect­ed­ly right, I am hap­py ;-)

One prob­lem with C mem­o­ry man­age­ment is that if you have many ex­it points for your func­tion­s, re­leas­ing ev­ery­thing you al­lo­cate is rather an­noy­ing, since you may have to do it in sev­er­al dif­fer­ent lo­ca­tion­s.

I com­pound­ed this prob­lem be­cause I am us­ing ex­cep­tions (yeah, C does­n't have them. I used this).

Now not on­ly do I have my re­turns but al­so my throws and what­ev­er un­caught throw some­thing I called has!

Hel­l, right?

Nope: what ex­cep­tions com­pli­cat­ed, ex­cep­tions fixed. Look at this func­tion:

bstring spf_query_get_explanation(spf_query *q, bstring spec)
{
    bstring txt=0;
    struct bstrList *l=0;
    bstring expanded=0;
    bstring result=0;
    struct tagbstring s=bsStatic("");

    try
    {
        // Expand an explanation
        if (spec && spec->slen)
        {
            expanded=spf_query_expand(q,spec,1);
            l=spf_query_dns_txt(q,expanded);

            if (l)
            {
                txt=bjoin(l,&s);
            }
            else
            {
                txt=bfromcstr("");
            }
            result=spf_query_expand(q,txt,0);
            throw(EXC_OK,0);
        }
        else
        {
            result=bfromcstr("explanation: Required option is missing");
            throw(EXC_OK,0);
        }
    }
    except
    {
        if(expanded) bdestroy(expanded);
        if(txt) bdestroy(txt);
        if(l) bstrListDestroy(l);
        on (EXC_OK)
        {
            return result;
        }
        if(result) bdestroy(result);
        throw(EXCEPTION.type,EXCEPTION.param1);
    }
}

It does­n't mat­ter if spf_­query_­ex­pand or spf_­query_dns_txt throw an ex­cep­tion, this will not leak.

Nice, I think :-)

C is not Python II.

RaSPF, my C port of PySPF, is pret­ty much func­tion­al right now.

Here's what I mean:

  • It pass­es 75 in­­ter­­nal unit tests (ok, 74 , but that one is ar­guable).

  • It pass­es 137 of 145 tests of the SPF of­­fi­­cial test suit­­e.

  • It agrees with PySPF in 181 of the 183 cas­es of the lib­spf2 live DNS suit­­e.

  • It seg­­faults in none of the 326 test cas­es.

So, while there are still some cor­ner cas­es to de­bug, it's look­ing very good.

I even spent some time with val­grind to plug some leaks ( the in­ter­nal test suite runs al­most leak­less, the re­al app is a sieve ;-)

All in al­l, if I can spend a lit­tle while with it dur­ing the week, I should be able to make a re­lease that ac­tu­al­ly work­s.

Then, I can re­write my SPF plug­in for qmail, which was what sent me in this mon­th-log tan­gen­t.

As a lan­guage wars com­par­ison:

  • The sloc­­count of raspf is 2557 (or 2272 if we use the ragel gram­­mar source in­­stead of the gen­er­at­ed file)

  • The sloc­­count of PySPF is 993.

So, a 2.6:1 or 2.28:1 code ra­tio.

How­ev­er, I used 4 non-­s­tan­dard C li­braries: bstr­lib, udns, and helpers for hash­es and ex­cep­tion­s, which add an­oth­er 5794 LOC­s.

So, it could be ar­gued as a 8:1 ra­tio, too, but my C code is prob­a­bly ver­bose in ex­treme, and many C lines are not re­al­ly "log­ic" but dec­la­ra­tions and such.

Al­so, I did not write PySPF, so his code may be more con­cise, but I tried my best to copy the flow as much as pos­si­ble line-per-­line.

In short, you need to write, ac­cord­ing to this case, be­tween 2 and 8 times more code than you do in Python.

That's a bit much!


Contents © 2000-2020 Roberto Alsina