When the “Python Vs PHP” war matters

February 21st, 2008

Yesterday I had a meet­ing with a cus­tomer about a new site I should develop for them. Since they’re a book pub­lisher, they wanted an online book store. Apart from the tech­ni­cal details (the site isn’t as simple as you may believe, they need a lot of not-so-easy-to-do stuff), the most impor­tant point we focused on is the fact that they have an inter­nal IT tech­ni­cian that han­dles all their com­puter needs. If you’re asking your­self why this mat­ters, keep reading:

  • me (to be precise, my company) stopped development of PHP sites about one year ago in favor of Python
  • we release the web site’s code to them
  • for this project, we haven’t been asked any kind of future support; this means that when the site is finished, we won’t touch the product anymore (unless they don’t pay us to do the modifies they need)
  • but they don’t want to pay us to these modifies, because they have their internal IT technician
  • their technician knows only PHP (and he never even known the Python’s existence until yesterday)

(Con­tinue reading…)

9 Comments, tagged with Coding, Django, PHP, Python, Web

Python listdir order

February 15th, 2008

Just a quick tip. If you’re using the python’s os.listdir() func­tion you may be not happy at all with the way it orders results. The fol­low­ing code snip­pet orders the result of the list­dir so it shows direc­to­ries first and then files, and sorts these two groups alphabetically:

import os
def custom_listdir(path):
    """
    Returns the content of a directory by showing directories first
    and then files by ordering the names alphabetically
    """
    dirs = sorted([d for d in os.listdir(path) if os.path.isdir(path + os.path.sep + d)])
    dirs.extend(sorted([f for f in os.listdir(path) if os.path.isfile(path + os.path.sep + f)]))

    return dirs

6 Comments, tagged with Coding, Python

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

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

« Previous PageNext Page »

Microblogging

Yesterday

twitter (feed #2)
I'm finding the priority thing in gmail incredibly useful [krat]
7:15pm via Twitter
twitter (feed #2)
So far the only protocol I found not to be speedcapped by my ISP is bittorrent. Not sure what's the rationale behind this. [krat]
1:08pm via Twitter
twitter (feed #2)
I probably overslept [krat]
12:08pm via Twitter

September 2nd

twitter (feed #2)
searching for a house might cause big headaches [krat]
10:12am via Twitter

September 1st

twitter (feed #2)
Just to say, video editing will never be my passion. Ever. [krat]
10:13pm via Twitter

August 31st

twitter (feed #2)
Uploading a video on youtube might take a loooooooong time [krat]
11:13am via Twitter

August 29th

twitter (feed #2)
Typical Sunday's hangover. I'm getting used to it. [krat]
12:27pm via Twitter

August 28th

youtube (feed #5)
Liked Lady Java.
7:53am via YouTube

August 27th

twitter (feed #2)
I don't like java but the videos from javazone are amazing: http://www.youtube.com/watch?v=Mk3qkQROb_k [krat]
2:40pm via Twitter
twitter (feed #2)
I hate postal offices [krat]
9:36am via Twitter

August 26th

twitter (feed #2)
I just did a mass clean up of my (very) old collection of cds & dvds [krat]
2:31pm via Twitter
twitter (feed #2)
sleepy [krat]
12:24pm via Twitter
twitter (feed #2)
I tried to turn the TV on today. Then I turned it off again after a fast zapping on the available channels. [krat]
8:10am via Twitter

August 25th

twitter (feed #2)
God bless air conditioning. [krat]
6:40pm via Twitter
twitter (feed #2)
RT @pyconit: A breve online i video dei talk di PyCon4. Stay tuned! [krat]
3:15pm via Twitter

August 24th

twitter (feed #2)
I haven't been using the twitter homepage for so long now that I didn't noticed they started recommending people to follow [krat]
6:34pm via Twitter
twitter (feed #2)
RT @EverywhereTrip: via @huffingtonpost: 20 Things I've Learned From Traveling Around the World for Three Years http://huff.to/dBVon7 [krat]
5:55pm via Twitter

August 23rd

twitter (feed #2)
Amazing (I'd say realistic too): http://theoatmeal.com/comics/apple [krat]
2:53pm via Twitter
twitter (feed #2)
My ISP set a speed cap of 150K/s over the most common protocols (torrent it's the only protocol that works at full speed). I hate my ISP. [krat]
12:25pm via Twitter

August 22nd

twitter (feed #2)
I slept at most 5h in the last three days, I should probably go get some rest [krat]
9:23pm via Twitter
twitter (feed #2)
back at home [krat]
4:28pm via Twitter

Powered by Lifestream.

Search

« Authored by Giuliani Vito Ivan »