[Tutor] Logfile Manipulation

2009-11-08 Thread Stephen Nelson-Smith
I've got a large amount of data in the form of 3 apache and 3 varnish logfiles from 3 different machines. They are rotated at 0400. The logfiles are pretty big - maybe 6G per server, uncompressed. I've got to produce a combined logfile for -2359 for a given day, with a bit of filtering (remo

Re: [Tutor] Local vs global

2009-11-08 Thread bibi midi
On Sun, Nov 8, 2009 at 8:38 AM, Dave Angel wrote: > > You have the following line at top-level: > > if ask.lower not in reply: > > But you're not calling the method str.lower(), you're just creating a > function object from it. You need those parentheses. > > if ask.lower() not in reply: > >

Re: [Tutor] pattern searching

2009-11-08 Thread bob gailer
Lie Ryan wrote: Ajith Gopinath wrote: Thanks folks. || a j i t || On Sat, Nov 7, 2009 at 7:49 AM, bob gailer > wrote: Shashwat Anand wrote: @Bob: the solution seems promising, and it's fast. Thanks for the improvement. However I would like to d

[Tutor] TimeOut in between threads

2009-11-08 Thread somnath chakrabarti
Hi Python Tutor members, I am learning the concept of threads in Python and trying to write a Python code that will start a thread (say t1) from main or any other thread and then t1 will call a certain function f1(). If the execution of function f1() takes more than a specified time (say 1000 secs

Re: [Tutor] SQLite database not update correctly

2009-11-08 Thread Emmanuel Ruellan
It's working fine now, but actually I didn't write exactly what you suggested. The "commit" method belongs to the connection, not to the cursor. Therefore, in my script it should be conn.commit(). On Sun, Nov 8, 2009 at 9:15 PM, Che M wrote: > > > I've got a functions that should update an sqlit

Re: [Tutor] SQLite database not update correctly

2009-11-08 Thread Emmanuel Ruellan
Thanks a lot, Che! It's working fine now. On Sun, Nov 8, 2009 at 9:13 PM, Che M wrote: > > I've got a functions that should update an sqlite database, among other > things. However > > the database doesn't get updated. When used in isolation, the update > statement works > > fine. What am I d

Re: [Tutor] SQLite database not update correctly

2009-11-08 Thread Che M
> I've got a functions that should update an sqlite database, among other > things. However > the database doesn't get updated. When used in isolation, the update > statement works > fine. What am I doing wrong? > Below is the function. The whole script can be found at > http://past

[Tutor] SQLite database not update correctly

2009-11-08 Thread Emmanuel Ruellan
Hi tutors, I've got a functions that should update an sqlite database, among other things. However the database doesn't get updated. When used in isolation, the update statement works fine. What am I doing wrong? Below is the function. The whole script can be found at http://pastebin.com/m53978f

Re: [Tutor] pattern searching

2009-11-08 Thread Lie Ryan
Ajith Gopinath wrote: Thanks folks. || a j i t || On Sat, Nov 7, 2009 at 7:49 AM, bob gailer > wrote: Shashwat Anand wrote: @Bob: the solution seems promising, and it's fast. Thanks for the improvement. However I would like to do a minor change

Re: [Tutor] Local vs global

2009-11-08 Thread Lie Ryan
bibi midi wrote: On Sun, Nov 8, 2009 at 6:20 AM, bibi midi > wrote: Thank you all for the helpful insights. I will keep in mind the naming rules in Python, so as not to have it in collision with Python's builtins. The mention to tidy up e.g. "co

Re: [Tutor] TimeOut in

2009-11-08 Thread Alan Gauld
"somnath chakrabarti" wrote Below is the code that I have written to do the timeout implementation. But I am getting error as follows. Can anybody please help me where I am going wrong? I have no idea how this framework is upposed to work but my guess is that the problem lies here: de

Re: [Tutor] Local vs global

2009-11-08 Thread ALAN GAULD
> Remember, that unlike Pascal, in Python you don't call the > function unless you include the parentheses. And since you are unlikely to be old enough to have programmed in Pascal(!), I'll add unlike VB you don't call the function unless you include parentheses. :-) Alan G.

Re: [Tutor] Local vs global

2009-11-08 Thread Dave Angel
bibi midi wrote: On Sun, Nov 8, 2009 at 6:20 AM, bibi midi wrote: Thank you all for the helpful insights. I will keep in mind the naming rules in Python, so as not to have it in collision with Python's builtins. The mention to tidy up e.g. "compartmentalize" code is also noted. I agree de

Re: [Tutor] Local vs global

2009-11-08 Thread Eri Mendz
On Sat, Nov 7, 2009 at 3:26 PM, Dave Angel wrote: > Alan Gauld wrote: >> > Alan - Excellent comments, as usual. > > bibimidi - I would point out that after you remove the 'global choose' line > as Alan said, you should rename the global variable you're using to store > the return value.  They're a

Re: [Tutor] Printing Sideway...

2009-11-08 Thread Ken G.
Okay, thanks. Understood. It's not a big thing here. Thought I would ask. Ken Alan Gauld wrote: Ken G. wrote: I am using Ubuntu 9.04 as my primary OS. I have Windows XP installed in the first partition (dual boot). I have Python 2.6.2 installed on both OS. The printer is a Cannon MX30

[Tutor] TimeOut in

2009-11-08 Thread somnath chakrabarti
Hi Python Tutor members, I have a requirement where I am trying to give a solution for Magic Square puzzle for sizes ranging from 3 to 5 and using different Solvers. I have the below MS class derived from Problem class which is defined in constraint.py. The Problem class has a method called getSol

Re: [Tutor] Local vs global

2009-11-08 Thread bibi midi
On Sun, Nov 8, 2009 at 6:20 AM, bibi midi wrote: > Thank you all for the helpful insights. I will keep in mind the naming > rules in Python, so as not to have it in collision with Python's > builtins. > > The mention to tidy up e.g. "compartmentalize" code is also noted. I > agree definitely. >

Re: [Tutor] Printing Sideway...

2009-11-08 Thread Alan Gauld
Ken G. wrote: I am using Ubuntu 9.04 as my primary OS. I have Windows XP installed in the first partition (dual boot). I have Python 2.6.2 installed on both OS. The printer is a Cannon MX300. To print on the envelope, I use Windows Works v4.5 which is easy to use. I just learned how to prin

Re: [Tutor] Classes that do operator overloading

2009-11-08 Thread Alan Gauld
"spir" wrote English is terrible. From wiktionary (abstracts)/ Indeed. and the fact that computer Scientists often abuse English makes it worse! header Text, or other visual information, used to mark off a quantity of text, often titling or summarizing it. This is probaly the closest to