Skip to main content

Ralsina.Me — Roberto Alsina's website

PyWeek progress: the 4 hour mark

Sud­den­ly I was hav­ing a calm day at work, and Rosario is tak­ing care of the baby, so I spent a few hours on the Py­Week projec­t.

I have in­te­grat­ed Chip­munk with QGraph­ic­sS­cene.

What does it mean? That I can now...

  • Cre­ate a scene

  • Cre­ate a view on­­to that scene

  • Cre­ate bal­l­s, walls and poly­­gons as scene items

  • Watch said bal­l­s/wal­l­s/poly­­gons bounce around hap­pi­­ly un­der Chip­­munk di­rec­­tion.

For ex­am­ple, here's enough code to cre­ate a few balls a box and a stair­case:

self.scene=ChipScene()
self.ui.view.setScene(self.scene)

for x in range (0, 10):
    self.scene.addBall(x*50.0+10, 50.0, 10.)
    self.scene.addBall(x*50.0+20, 20.0, 10.)
self.scene.addWall(0., 0., 0., 500.)
self.scene.addWall(0., 500., 500., 500.)
self.scene.addWall(500., 500., 500., 0.)
self.scene.addWall(500., 0., 0., 0.)
for i in range (0, 20):
    self.scene.addWall(i*20, 200+i*20, i*20+20, 200+i*20)
    self.scene.addWall(i*20+20, 200+i*20, i*20+20, 200+i*20+20)

self.scene.addPoly([[0, 50], [0, 100], [100, 100], [100, 50], [0, 50]])

I de­clare that nifty.

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.

Thinking about this blog.

I sup­pose it hap­pens to ev­ery­one once in a while, and it has hap­pened to me of­ten in the past, but I am think­ing if I should keep on writ­ing this blog, or if some large change is need­ed.

Here are some ran­dom things from my head:

  1. Al­­most noone reads it. Re­al­­ly. It has less than 40 sub­­scriber­s. That's pa­­thet­ic for a blog that has con­­tent for over 7 years :-)

  2. Maybe I should post in span­ish, or at least bil­in­gual­­ly.

  3. Maybe I should write more fea­­tures. When I write a longish piece and an­­nounce it, there is a re­spectable traf­f­ic surge.

  4. On the oth­­er hand, I en­joy writ­ing it. And it's re­al­­ly very lit­­tle ef­­fort (spe­­cial­­ly now, with Bartle­Blog ;-)

  5. Maybe it should be more fo­­cused in one area, make it a python pro­­gram­ming blog, or a tu­­to­ri­als blog, or some­thing like that.

  6. But I am not a fo­­cused per­­son. I am a gen­er­al­ist. This week I have worked in the fol­low­ing things:

    • VoIP

    • Djan­­­go

    • PyQt

    • Lin­ux sysad­min­ing

    • Fire­wal­l/Proxy in­­­te­­­gra­­­tion with win­­­dows clients

    • Con­­­sult­ing in the most gen­er­ic sense, sit­t­ing with a com­­­pa­ny's IT staff and think­ing about their sit­u­a­­­tion.

    • Learn­ing PyGame

    And this was in 5 days of work. If I list­ed what I have done this year, it would take me 500 item­s. I am broad, how could my blog be nar­row?

  7. Maybe it's just not in­­ter­est­ing? Or bad­­ly done?

  8. Is it too nerdy? Is it not nerdy enough?

  9. I have had a blog with a small read­­er­­ship for 7 years, why is it both­­er­ing me now?

  10. If I stop, it does­n't mat­ter, I can al­ways pick it up again lat­er when I feel like writ­ing.

So, there. You, the 40 guys, com­ment on it if you want ;-)

Incredible new things.

Found on red­dit, from Lens Cul­ture

A mind­blow­ing pre­sen­ta­tion of im­age-brows­ing soft­ware by Mcrosoft Re­search at TED. Please watch it.

And then there is this re­search from CMU.

Re­al­ly awe­some stuff.

Now, this is re­al­ly sci­fi stuff. Or should have been. While sci­ence fic­tion was promis­ing jet­packs and vir­tu­al world­s, com­put­er sci­ence is pro­vid­ing new and in­cred­i­ble ways to ma­nip­u­late in­for­ma­tion.