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 ;-)


Contents © 2000-2024 Roberto Alsina