Skip to main content

Ralsina.Me — Roberto Alsina's website

My first public python code works!

No, this is not a post an­nounc­ing I just wrote my first pub­lic python code. This is a post about my first pub­lic python code... from 1996!

In 1996, the soon-­to-be-here year of the Lin­ux desk­top was fu­eled by one of the mar­quee open source ap­pli­ca­tions of the time: LyX.

LyX was (is) a sort of word pro­ces­sor where you wrote and gen­er­at­ed La­TeX which then pro­duced what­ev­er you used to print. But I am di­gress­ing: LyX was cool be­cause it used one of the first good free graph­i­cal toolk­it­s: XForm­s.

Ok, it was not re­al­ly free, be­cause you could­n't dis­trib­ute patch­es.

And it was not all that good ei­ther, but we were com­par­ing it with Mo­tif, so it was much more free and much bet­ter than that mon­stros­i­ty.

BTW: The lat­est re­lease of XForms is from au­gust of 2009.

At the time, a 25-year-old me was in love with Python 1.3. Here's how I de­scribed it:

Python 1.3

It's a beau­ti­ful ,free, lan­guage. Get it from ft­p://ft­p.python.org http://www.python.org

Yes, Python 1.3. So, I want­ed to use this C GUI tool­kit used in this cool ap­p, and this neat lan­guage I was learn­ing and use them at the same time.

I ran (not walked) to my faith­ful Slack­ware 3.0 ELF in my 486DX2 PC and start­ed hack­ing. In a week­end or so I had a work­ing bind­ing.

I even start­ed writ­ing the holy grail of desk­top ap­pli­ca­tion­s, a GUI ver­sion of Pine, us­ing python and its IMAP mod­ule (python mail­er, or PyM):

//ralsina.me/static/im1.jpg
//ralsina.me/static/im2.jpg

I re­leased ver­sion 0.1 al­pha in 1996, May 13 ... and a few months lat­er Matthias Et­trich start­ed KDE and I found Qt and nev­er thought about XForms again.

Un­til this month.

For rea­sons that don't mat­ter, I men­tioned PyM in the PyAr mail­ing list the oth­er day, and ... well, would pyx­forms still work?

Why, pret­ty much, yeah!

I got the pyx­form­s-0.1-al­pha sources from some­where in the in­ter­net, in­stalled XForms 1.0.92sp2 (yes, the lat­est re­lease, from three months ago), of course I al­ready had python 2.6.4 in­stalled, added a set­up.py, edit­ed 10 lines of code and...

im1

Yes, it work­s. You can get this 0.2 ver­sion (co­de­name "C­thul­hu was here") here just 13 years af­ter 0.1.

No, I don't un­der­stand the weird round­ed cor­ner­s, or why the cur­sor looks weird and old when it's in­side the win­dow.

It's a RE­AL­LY small and fast toolk­it, though.

Hon­est­ly, is it use­ful for ay­one? Al­most cer­tain­ly not. Am I amazed some­thing I wrote in 1996 still work­s? Oh, yeah I am.

I'll be speaking in Mar Del Plata

I will be do­ing a brand-new nev­er seen in­tro­duc­tion to PyQt pro­gram­ming at the "Jor­nadas de Soft­ware Li­bre y Open Source" in Mar del Pla­ta to­mor­row or the next day.

More in­fo at http://­soft­ware­li­bre.md­p.ut­n.e­du.ar/

If you men­tion this blog and ask nice­ly, you get a can of cheap na­tion­al beer to­mor­row night (lim­it: 2 cans ;-)

Advertising to the math-deficient

As a for­mer fu­ture math­e­mati­cian, it drives me mad when I see an ad that looks like a great op­por­tu­ni­ty... as long as you don't crunch the num­ber­s.

Not that they are hard to crunch at al­l, in fact they are pret­ty much pre-crunched, but con­sid­er this one:

Fráve­g­a, a large elec­tron­ic­s/ap­pli­ances store is ad­ver­tis­ing that in novem­ber, for one day, EV­ERY­THING WILL BE FREE.

That's right, for one day in novem­ber, they will not charge one cent for any­thing. Ev­ery­thing has a price tag of $0.

Of course we don't know what day that is. It will be de­cid­ed ran­dom­ly af­ter the month end­s.

And... ok, and you don't get the mon­ey back, you get a vouch­er for the same amoun­t, and you can use it in Fráve­g­a.

So, while this may look like a big pro­mo­tion, it's ac­tu­al­ly doubt­ful Fráve­ga will spend any mon­ey what­so­ev­er in it, ex­cept the mon­ey spent print­ing the ban­ner­s.

How much does this cost?

As­sum­ing a ran­dom day, and that this cam­paign brings no new sales what­so­ev­er, it's 1/30th of the month­ly sales.

Al­so, they are not giv­ing you mon­ey, they are giv­ing you store cred­it. Since you can on­ly spend it at Fráve­g­a, in re­al­i­ty will be get­ting a "2x1" deal. You spent in novem­ber, got the sec­ond one for "free" in de­cem­ber.

So, what is re­al­ly hap­pen­ing is that 30 peo­ple spen­t, say, $1000 each in an oven, and Fráve­ga has to give them 31 oven­s.

That would mean this is the equiv­a­lent of a 3.33% dis­coun­t.

What? A 3.33% dis­count does­n't sound so ap­peal­ing? Of course not! They are tak­ing ad­van­tage of maths not be­ing in­tu­itive.

So, al­ways keep it in mind: when­ev­er you see num­bers in ad­ver­tis­ing, they are there to con­vince you to buy. More of­ten than not, it will not be as good a deal as it seem­s. This is an ex­tra­or­di­nary case in that "one day ev­ery­thing for free!" ac­tu­al­ly means "a 3.33% dis­count in av­er­age for a mon­th!".

BTW: the cost for fráve­ga if you win is more prob­a­bly less than $600 for a $1000 oven:

Fráve­ga buys two ovens (let's be gen­er­ous and say they paid $1800 for them?) and gets $1000.

But the $800 deficit goes against earn­ings tax, which is 35% so $280 come back.

And if they bought the ovens for $900 each, that means $314 are VAT, and since they are sell­ing you two ovens for $1000, there's a VAT re­fund of $140.

So, those $1000 ac­tu­al­ly are on­ly $580 af­ter tax­es.

This part about tax­es can be ter­ri­bly wrong, though ;-)

Myckey Mouse explains the Large Hadron Collider problems

You may have heard about the pos­si­bil­i­ty that the Large Hadron Col­lid­er is be­ing sab­o­taged from the fu­ture.

That may sound pre­pos­ter­ous, but it re­al­ly is quite rea­son­able, once you think about it a lit­tle.

Let's start with the ob­vi­ous:

Sup­pose you trav­el back in time and kill your grand­fa­ther. Then you would­n't ex­ist. And you could­n't trav­el back in time. And that's a para­dox.

Then there is the an­ti-­para­dox:

Sup­pose you can't trav­el back in time. Be­cause you did­n't save him, your grand­fa­ther died. Er­go you don't ex­ist.

That's not a para­dox, but sup­pose time trav­el is pos­si­ble: that means you can go back in time, save your grand­fa­ther, and thus make your own ex­is­tence pos­si­ble, er­go al­low­ing you to save him.

As soon as you al­low for time trav­el­ing to be pos­si­ble, the so­lu­tion for para­dox­es is ob­vi­ous: you can´t change change the past be­cause the fu­ture won't let you. The fu­ture "fac­tion" that tries to pre­serve the past will al­ways win, be­cause the past is fixed.

So, if you trav­el back in time and try to kill your grand­fa­ther by shoot­ing him in the head, an­oth­er per­son from the fu­ture will ap­pear be­hind you and dis­arm you. Or ap­pear be­hind you and kill you as soon as you had the idea to trav­el in time in the first place.

Or your kid will drop a coke bot­tle on your time ma­chine just be­fore you used it to kill his great-­gramp­s.

The ex­act mech­a­nism used to pre­vent you from be­com­ing a para­dox is un­known to you be­cause you need to go fur­ther "for­ward" to know it.

Now, back to the LHC: if in the fu­ture there is knowl­edge about time trav­el, and there is knowl­edge about how the LHC may de­stroy the world[1]_ then maybe some time tourist de­cid­ed to see how hu­man­i­ty dressed in the pre-ice-age er­a, comes to 2009 and while eat­ing a sand­wich, some­how spooks a bird which then drops a piece of bread in the ma­chin­ery.

Which of course, brings me to the best time-­trav­el show on TV: "Mick­ey Mouse Club­house­".

If you don't have an un­der­-4 kid, grand­son or nephew, you prob­a­bly don't know it, but let me give you a sum­ma­ry of each darn episode.

  1. Some­thing "bad" hap­pens (Goofy has a cold)

  2. A so­lu­­tion is pro­­posed (Give Goofy some Min­nie­strone soup)

  3. A fly­­ing ideogram of a mouse called Too­­dles shows a col­lec­­tion of tool­s:

    • Gi­ant can­dy cane

    • Roller skates

    • Pic­nic bas­ket

    • See­­­saw

  4. Some­thing else "bad" hap­pens (Pete wants the soup)

  5. The tools are ex­ac­t­­ly what's need­ed to solve the prob­lems pre­sen­t­ed to ac­­com­­plish the pro­­posed so­lu­­tion (Y­ou can use the see­­saw to move gi­ant rocks block­­ing your path).

This is ob­vi­ous­ly a case of the fu­ture pre­vent­ing some­thing from hap­pen­ing. How else would Too­dles know what tools to choose be­fore they are need­ed? There was no way to guess that a gi­ant rock would block the ravine through which Mick­ey and Min­nie would try to es­cape from Pe­te! 2

So, when­ev­er you need to think about para­dox pre­ven­tion, re­mem­ber Mick­ey and his friends and just call Too­dles.

1

No, I don't think the LHC would de­stroy the world.

2

Al­so, that part shows a com­plete ig­no­rance of how lever­age work­s.


Contents © 2000-2020 Roberto Alsina