Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Publicaciones sobre python (publicaciones antiguas, página 26)

PyWeek5

Well, it seems I am in trou­ble for Py­Week.

Why? Be­cause it's wednes­day and I have done noth­ing. Noth­ing! It's be­cause I have been work­ing a lot, re­al­ly, and I have a 4 month baby, too.

So, I am up­ping the ante.

I will do a Py­Day.

I am tak­ing to­mor­row off (yeah, right!) and I'm do­ing the game in one day. Maybe I will scrounge a few hours on sun­day, too.

It will prob­a­bly not be fit for the con­test be­cause:

  • I will use PyQt

  • I won't test it in any plat­­form oth­­er than my Lin­ux box

But here's the game con­cept (BTW: Twist­ed sucks as a theme. It sucks re­al­ly, re­al­ly, re­al­ly hard!):

Ac­cord­ing to the dic­tio­nary, Twist­ed al­so means per­vert­ed. So, this game, Twist­ed Lit­tle Boy is about a bad boy. A re­al­ly bad boy. But a clever one. He cre­ates ma­chines us­ing ran­dom equip­ment he finds to do evil, re­al­ly mean things.

I will prob­a­bly do a live-blog thing like those tu­to­ri­als I wrote years ago about PyQt.

There's a Google code project (ob­vi­ous­ly emp­ty): http://­code.­google.­com/p/twist­edlit­tle­boy/

See you all to­mor­row.

Django, the view from a parachute

In the last few days I have been learn­ing Djan­go in per­haps the hard­est way pos­si­ble: by be­ing hired to work on a site some­one else wrote.

I al­ready had the view from 10000 feet. And since I had to get to this thing rather quick­ly, I jumped on my para­chute from those 10000 feet, and learned it on the way down.

Here's what I knew:

  • Python Web frame­­work

  • Reg­ex­p-based URL dis­­­patch­ing

  • Its own tem­­plate lan­guage

  • Its own ORM and form stuff

I have hacked stuff based on Tur­bo­Gears, Col­u­brid, pure Cher­ryPy, Mako/Kid/Chee­tah/Cher­ry­Tem­plate tem­plates, Routes, Paste and about half a dozen oth­er frame­works or pieces that are used for frame­work­s, so how new could it be? Well, not very new. I am start­ing to no­tice a sort of same­ness in these things. They are all alike.

First, the con­clu­sion: I liked it, I could work with it.

Now for some lit­tle de­tail:

  • The URL dis­­­patch­ing is nice ,if not re­al­­ly in­­ter­est­ing. there seem to be two ways to do this, all frame­­works use one or the oth­­er, and al­­most ev­ery­one likes reg­ex­ps bet­ter.

  • The OR­M+new­­forms is quite nice! Of course ev­ery­thing was done with old­­for­m­s, which is... not quite so nice. But you can switch pieces as you go, and the code ac­­tu­al­­ly sim­­pli­­fies as you hack, so it's good.

  • The tem­­plate lan­guage I could live with­­out. It does­n't seem to be spe­­cial­­ly fea­­ture­­ful, and it did­n't seem as ex­pres­­sive to me as my cur­rent favourite, Mako. Luck­­i­­ly you can re­­place it eas­i­­ly. It's not that it's bad, it's just av­er­age.

So, I see no rea­son to learn it in­stead of Tur­bo­gears, or vicev­er­sa. On the oth­er hand, if you know one, you can learn the oth­er in per­haps a week­end, so there's no point on not hav­ing at least a ba­sic knowl­edge of both.

Be afraid, young pumpkins!

Al­low me to en­ter trash-talk­ing mod­e...

Be very afraid be­cause this year, my mighty skills are en­ter­ing Py­Week for the first time.

Just to make it in­ter­est­ing and some­what chal­leng­ing:

  • I will be en­ter­ing as an in­­di­vid­u­al, not in a team.

  • I have not writ­ten a line of PyGame code in my life.

  • I have writ­ten bare­­ly any game code at al­l.

  • I will sub­­mit my fi­­nal code one day ear­lier, just be­­cause I can.

Nonethe­less, I in­tend to kick ass­es and ask no ques­tion­s. I in­tend to over­whelm you all with a game of such awe­some­ness you will all whith­er like let­tuce in La­p­land. I will write code of such in­ge­nu­ity you will try to steal it and fail.

...ex­it­ing mod­e.

Should be fun and my en­try will prob­a­bly suck. But we'll see...

Me and FLOSS in the late '90s

I have no idea how, but I ran in­to this in Lin­ux­to­day:

KDE Pro­gram­ming Tu­to­ri­al 0.2 (Dec 22nd 1998, 00:09:36 )

Rober­to Alsi­na an­nounced that he up­load­ed to ft­p.kde.org the ver­sion 0.2 of his ex­cel­lent pro­gram­ming tu­to­ri­al. It is al­so avail­able here. Hope­ful­ly, this must-have ma­te­ri­al will be soon in­clud­ed in the kdes­dk pack­age and in CVS.

Now, this was pret­ty shock­ing be­cause I don't re­mem­ber writ­ing it (any­one knows where a copy may be?). I have no idea what was in it, and in fac­t, the idea of peo­ple learn­ing C++ from me in 1998 is so stupid it's shock­ing, since I knew very lit­tle.

Then it hit me, the URL! Ul­tra­7? That was my 486 at col­lege [1].

It had a web­server? What on earth had I been drink­ing back then? Why can't I re­mem­ber this???

Way­back ma­chine, come here! Fetch!

Here's my first home page. I must say it's pret­ty good. It's not gar­ish. Very We­b2.0 in the abun­dant white space.

First in­ter­est­ing thing: there is at least one ex­tant copy of PyX­Forms, my first free soft­ware pro­jec­t, used by ab­so­lute­ly noone.

And there are even two cool screen­shot of a func­tion­al pro­gram noone ev­er used [2]:

im1im2

In fac­t, I have no idea how I did that high­light­ed mes­sage dis­play.

Then all that pro­to-­good taste goes away when you reach the page for my most "pop­u­lar" project ev­er... Krn in my 1999 home page [4]. It' so 1999 free soft­ware style. All that's miss­ing is an elec­tric blue back­ground.

It seems I had dis­cov­ered The Gimp and it's ban­ner script­s!

BTW: I won­der what's Mag­nus Ref­tel do­ing nowa­days? We used to ex­change dozens of mails a day and for some rea­son we lost con­tac­t.

There was al­so a mail­ing list ar­chive for the very very very first posts of our pro­to LUG (which would lat­er be­come LUGLI)

And here's the best part, and the one that makes me kin­da sad... Themes for Qt1.

You can read a lit­tle about them in this thread.

I have writ­ten about them once or twice be­fore but here's the short ver­sion:

Raster­man was start­ing to hack themes for Gtk. I de­cid­ed they could­n't be the on­ly ones with this cool new tech­nol­o­gy but I had the big dis­ad­van­tage of not be­ing able to touch Qt's code be­cause of li­cens­ing is­sues. So I in­ter­cept­ed the draw­ing events us­ing a LD_PRELOAD hack and im­ple­ment­ed a theme full of gra­di­ents with­out mod­i­fy­ing or re­com­pil­ing Qt or KDE.

Now that's one of the most im­pres­sive hacks I have ev­er per­formed, even if it was a hack done with the most evil code ev­er, and... there seems to be no ex­tant copy of the code or the screen­shots.

Which is kin­da sad, in­deed.

Fixing old tutorials

I got a mail from a read­er telling me that he could­n't down­load the sources for Not­ty, the toy app I de­vel­oped in my Rapid Ap­pli­ca­tion de­vel­op­ment us­ing PyQt and Er­ic3 ... in re­al­time! tu­to­ri­al.

So, I checked and was shocked at just how much the serv­er moves had wrecked that ar­ti­cle, which is one of my favourites!

No im­ages, bro­ken link to the sources, no syn­tax high­light­s!

So, I re­jig­gered the thing quick­ly with some search and re­place (thanks re­struc­tured tex­t!) and now it should be up to stan­dard­s, ex­cept that... it's still about Qt3 and I am not even sure it works nowa­days.

Nor­mal­ly that would be sim­ple to fix: change the code as need­ed, make it work, and be hap­py.

But the fun thing about that ar­ti­cle was that it was writ­ten in 3 hours, and it talks about how it was writ­ten in 3 hours. So, I think I may have to do keep that and add a note with a link to a cor­rect­ed/up­dat­ed one, some­day.


Contents © 2000-2023 Roberto Alsina