Now you know how to say hello in english

January 28th, 2008

I have a love/hate rela­tion­ship against the hello mes­sages shown in all the world lan­guages on flickr. That’s why this morn­ing I was talk­ing with a friend on IRC about this and a bad idea jumped in my mind: do an IRC bot that says hello in many lan­guages when some­one joins a channel.

It’s from sev­eral years that I don’t do any­thing IRC related, but this time I had two spe­cial weapons in my back­pack: python and twisted. The final bot is ~90 lines of code, half of the which are for the hello list and the entire coding process took less than 20 minutes.

(Con­tinue reading…)

Django and syncdb’s signal processing

January 1st, 2008

One fea­ture of django is worth to note is that it sup­ports sig­nals. In fact, under its skin it imple­ments PyDis­patcher, a python library that allows to emit sig­nals and to dis­patch them.

If at first glance this couldn’t look so useful to you, well, this hasn’t been true for me since it was exactly that kind of stuff I was look­ing for. What I was trying to do was to imple­ment some kind of auto-​installer for an appli­ca­tion that I’m writ­ing, and in order to do so I had to run the set up after that the syncdb com­mand is issued. So the main prob­lem was: how do I know when a user does the syncdb in a non-​intrusive way?

After some googling, I found that in django exists the semi-​hidden fea­ture of sig­nals, so I began explor­ing them. The only thing you can look at on the offi­cial site is a page on their wiki, and addi­tion­ally there are some cool arti­cles over the net. Anyway, if you want to know a fast way to catch the syncdb com­mand just follow up the reading.

(Con­tinue reading…)

Microblogging

  1. January 28th

    1. Finally something to eat! http://t.co/FH3x3oGR [krat]

      1:10am via Twitter

  2. January 27th

    1. Finally some cleanup on my inbox. Feels cleaner now. [krat]

      5:13pm via Twitter

  3. January 26th

    1. panzerotti & peroni [krat]

      7:49pm via Twitter

  4. January 25th

    1. I lost count of how many times I wanted to expand the tweet stream and clicked "favorite" instead [krat]

      11:15am via Twitter

  5. January 23rd

    1. It's hateful when you have to chase people who owe you some money [krat]

      5:45pm via Twitter

    Powered by Lifestream.

Search