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

0 Comments, tagged with Coding, Geekness, Python

CMake and its generated files

January 17th, 2008

When I’m work­ing on a project, the only thing I hate more than a seg­fault is to work into a direc­tory where source files are mixed with other files that doesn’t have any­thing to do with the project itself.

These days I gave a look at cmake since I hate auto­tools and I wanted to try some alter­na­tive. It’s nice (apart from its windows-​like names), but it has a little prob­lem: it gen­er­ates a lot of files.

So I googled for some way to clean the direc­tory from its files but I haven’t found none. So I wrote my own simple script that cleans a direc­tory (and its sub­di­rec­tory) from the cmake files. Here it is:

#!/usr/bin/bash

# removes CMake generated files
find . -name 'CMakeCache.txt' -print0 | xargs -0 /bin/rm -f
find . -name 'cmake_install.cmake' -print0 | xargs -0 /bin/rm -f
find . -name '*.dir' -print0 | xargs -0 /bin/rm -fr
find . -name 'Makefile' -print0 | xargs -0 /bin/rm -f
find . -name 'CMakeFiles' -print0 | xargs -0 /bin/rm -fr

Pay atten­tion to the fact that you can’t have a direc­tory named *.dir because this script would remove it. Apart from this, it works quite well.

2 Comments, tagged with Coding

BCManager is evolving

January 13th, 2008

I just done a video of how bcman­ager works. Its devel­op­ment is now stopped from… too much, but I plan to begin once again as soon as I free myself from some urgent stuff. Here is the video:

0 Comments, tagged with Geekness, Me, Python, gtk

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

0 Comments, tagged with Coding, Django, Python, Web

Microblogging

  • Funny thing: yesterday night I had an idea about a good blog post I could make. But now I completely forgot what that idea was about. 12 hours ago #
  • I think pownce has a little issue with caching since if I delete a message and I write a new one, it doesn't appear in my homepage. Nov 16, 6:34pm #
  • I didn't know that something like [(x,y) for x in range(10) for y in range(x)] was possible in Python. Nov 16, 3:45pm #
  • I'm about to go to the local LUG dinner: pizza for everyone. Nov 14, 9:15pm #
  • Lately I've been very interested in fast data structures with minimum memory usage. Just surprised to find out that list comprehension in Python are sometimes slower for large quantities of data than classic for loops. Still trying to understand why (if someone has a clue, please let me know). Nov 12, 12:44pm #
  • So wordpress was silently modifying HTTP request headers and I was getting a 400 when fetching Pownce RSS. Now everything works as expected on my blog, shame on WP. Nov 9, 3:58pm #
  • Experimenting with document language identification. Nov 6, 10:23pm #
  • So looks like I finally found an interesting topic apart from web development: information retrieval. Nov 3, 5:13pm #
  • Planning a trip to Bologna in December Nov 1, 5:24pm #
  • After today, I want to go as far as I can from Italy. Oct 29, 11:49am #

Search


« Authored by Giuliani Vito Ivan »