collecting results in threading app

2008-04-04 Thread Gerardo Herzig
Hi all. [EMAIL PROTECTED] over here. Im missing some point here, but cant figure out which one. This little peace of code executes a 'select count(*)' over every table in a database, one thread per table: code class TableCounter(threading.Thread): def __init__(self, conn, table):

Re: collecting results in threading app

2008-04-04 Thread Gerardo Herzig
John Nagle wrote: Gerardo Herzig wrote: Hi all. [EMAIL PROTECTED] over here. Im missing some point here, but cant figure out which one. This little peace of code executes a 'select count(*)' over every table in a database, one thread per table: code class TableCounter(threading.Thread

Re: request for Details about Dictionaries in Python

2008-03-14 Thread Gerardo Herzig
Saideep A V S wrote: Hello Sir, I am a beginner level programmer in Python. I am in search of a function for 'On-Disk' Dictionaries which is similar to On-Disk Hash tables in Perl (i.e., tie function in Perl). Could anyone help me with the concept. I have also searched the net, but

Re: request for Details about Dictionaries in Python

2008-03-14 Thread Gerardo Herzig
Saideep A V S wrote: Hello Sir, Thank You a ton. I was looking for this function. As far what I've understood from the Shelve module is that, there would be no memory wastage and the whole transactions would be done from and to the file we specify. Am I right?. My actual task is to build a

compiling plpython compilation error

2008-03-03 Thread Gerardo Herzig
Hi all. Im having a hard time trying to compile the plpython package. This is the error make gives me: [EMAIL PROTECTED]:/usr/local/src/postgresql-8.2.5/src/pl/plpython make gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels

Re: How to pass shell variable to shell script from python

2008-02-27 Thread Gerardo Herzig
Rockins Chen wrote: Hi all, I encountered a problem: I have a python script, let's just name it caller.py, It calls a shell script, which is named callee.sh. In callee.sh, it need a shell variable $target, which should be supplied by caller.py(cannot pass by argument). I try to use os.environ to

Re: Weird cgi error

2008-02-25 Thread Gerardo Herzig
Jesse Aldridge wrote: I uploaded the following script, called test.py, to my webhost. It works find except when I input the string python . Note that's the word python followed by a space. If I submit that I get a 403 error. It seems to work fine with any other string. What's going on here?

Re: standardization allows?

2008-02-19 Thread Gerardo Herzig
[EMAIL PROTECTED] wrote: Standardization allows RCA cables, bumpers, and 115V plugs. The Bill of Rights allows Huckleberry Finn. What is the analogue of the Bill of Rights for programmers and users, whether of programming languages or latter-generation software? I want that drogues, man --

Re: Removing Pubic Hair Methods

2008-01-30 Thread Gerardo Herzig
Sion Arrowsmith wrote: Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Tue, 29 Jan 2008 11:48:38 -0800, Tobiah wrote: class genital: def pubic_hair(self): pass def remove(self): del(self.pubic_hair) I think `pubic_hair` is an attribute

sharing objects between classes

2008-01-28 Thread Gerardo Herzig
Hi all. Im wondering the way to share a database connection between some classes: So far, i came up with a simple class schema, where each class means each different relation, i mean i have the follow classes class Database(object): ## make the connection self.conn = make_conn() class

Re: *** AMERICAN BASTARDS DESERVE TO BE RAPED ***

2008-01-14 Thread Gerardo Herzig
James Matthews wrote: When did this list become a politics dialog? Please keep on topic Python! Thanks James On Jan 12, 2008 8:07 PM, Joe Riopel [EMAIL PROTECTED] wrote: On Jan 12, 2008 2:00 PM, radiosrfun [EMAIL PROTECTED] wrote: Whether we agree on tactics or not - if it come to a

dealing with binary files

2008-01-07 Thread Gerardo Herzig
Hi all. Im trying to read a binary data from an postgres WAL archive. If i make a xfile = open('filename', 'rb').xreadlines() line = xfile.next() i see this sort of thing:

Re: dealing with binary files

2008-01-07 Thread Gerardo Herzig
Tom Brown wrote: On Mon, 2008-01-07 at 11:57 -0200, Guilherme Polo wrote: 2008/1/7, Gerardo Herzig [EMAIL PROTECTED]: Hi all. Im trying to read a binary data from an postgres WAL archive. If i make a xfile = open('filename', 'rb').xreadlines() line = xfile.next() i see this sort

Re: Extract a number from a complicated string

2007-12-21 Thread Gerardo Herzig
Horacius ReX wrote: Hi, I have to read some data from a file, and on each block it always appears the followng string; xyz.vs.1-81_1 . It appears a lot of time with different numbers like; xyz.vs.1-81_1 xyz.vs.1-1234_1 xyz.vs.1-56431_1 and so on My problem is that I need to extract from this

Re: How to delete this file ???

2007-12-21 Thread Gerardo Herzig
hank/ann wrote: pop up that says: error loading c:/progra~1\mywebs~1bar\2bin\mwsbar.dll the specified module could not be found this pop up appeares on desktop each time we log on cannot get rid off it can you help Ann import os.Linux :P --

plpythonu and hello concurrent world

2007-12-05 Thread Gerardo Herzig
Hi all. Im having some problems with a small concurrent plpython function. Based on a small example [1] about concurrent programming, there is some code which works fine under python: #! /usr/bin/python import threading, random import time def myPrint(str): print 'searching...', str

Re: Python is not a good name, should rename to Athon

2007-11-30 Thread Gerardo Herzig
[EMAIL PROTECTED] wrote: Python is a good programming language, but Python is not a good name. First, python also means snake, Monty Python. If we search python in google, emule, many results are not programming resource. If we search PHP, all results are programming resource. Second, python

Re: i want to know what is the problem in this code

2007-11-26 Thread Gerardo Herzig
nani wrote: i am getting the following error for below code type 'exceptions.KeyError' Python 2.5.1: C:\Python25\python.exe Mon Nov 26 10:13:17 2007 A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. C:\Program

Re: dictionary and list

2007-10-30 Thread Gerardo Herzig
Beema shafreen wrote: hi everbody, I have a file, a b c d e 2722316 2722360A_16_P03641972150-44 2722510 2722554A_16_P2136023916-44 2722570 2722614A_16_P03641973

Re: Which index can i use ?

2007-10-29 Thread Gerardo Herzig
Abandoned wrote: Hi.. I want to do index in postgresql python. My table: id(int) | id2(int) | w(int) | d(int) My query: select id, w where id=x and id2=y (sometimes and d=z) I have too many insert and select operation on this table. And which index type can i use ? Btree, Rtree, Gist or Hash ?

Re: Simple HTML template engine?

2007-10-16 Thread Gerardo Herzig
allen.fowler wrote: Hello, Can anyone recommend a simple python template engine for generating HTML that relies only on the Pyhon Core modules? No need for caching, template compilation, etc. Speed is not a major issue. I just need looping and conditionals. Template inheritance would be a

Re: multimethods decorator

2007-10-11 Thread Gerardo Herzig
Bruno Desthuilliers wrote: [EMAIL PROTECTED] a écrit : Gerardo Herzig a écrit : Hi all. Im reading the Gido's aproach using decorators at http://www.artima.com/weblogs/viewpost.jsp?thread=101605 It looks good to me, but the examples shows the functionality using functions. Now, when

multimethods decorator

2007-10-10 Thread Gerardo Herzig
Hi all. Im reading the Gido's aproach using decorators at http://www.artima.com/weblogs/viewpost.jsp?thread=101605 It looks good to me, but the examples shows the functionality using functions. Now, when i try to give this decorator into a method, if i try the class test(object):

Re: migrating to packages

2007-10-05 Thread Gerardo Herzig
Bruno Desthuilliers wrote: Gerardo Herzig a écrit : Carl Bank a écrit : Add these lines in __init__.py: from MYCLASSES.A import A from MYCLASSES.B import B Ummm, that works indeed, but forces me to import all (more than A and B) classes, rigth? Why so

Re: migrating to packages

2007-10-04 Thread Gerardo Herzig
On Oct 3, 2007, at 11:42 AM, Gerardo Herzig wrote: Hi all. I have a single file with several classes, wich i want to separate into several packages. The big file is named, say MYCLASES, and contains a class named A(object), and B(A). We have been using this MYCLASES in the from

Re: List of objects X Database

2007-10-04 Thread Gerardo Herzig
MindMaster32 wrote: I am writing a script that has to read data from an ASCII file of about 50 Mb and do a lot of searches and calculations with that data. That would be a classic problem solved by the use of a database (SQLite would suit just fine), but that would require the user to install

migrating to packages

2007-10-03 Thread Gerardo Herzig
Hi all. I have a single file with several classes, wich i want to separate into several packages. The big file is named, say MYCLASES, and contains a class named A(object), and B(A). We have been using this MYCLASES in the from MYCLASES import B syntax, but i cant reproduce this syntax using

Re: database persistence with mysql, sqlite

2007-09-24 Thread Gerardo Herzig
coldpizza wrote: Hi, I want to run a database query and then display the first 10 records on a web page. Then I want to be able to click the 'Next' link on the page to show the next 10 records, and so on. My question is how to implement paging, i.e. the 'Next/Prev' NN records without

Re: Python Regex Question

2007-09-20 Thread Gerardo Herzig
[EMAIL PROTECTED] wrote: I need to extract the number on each td tags from a html file. i.e 49.950 from the following: td align=right width=80font size=2 face=New Times Roman,Times,Serifnbsp;49.950nbsp;/font/td The actual number between: nbsp;49.950nbsp; can be any number of digits before

executing list of methods (and collecting results)

2007-09-20 Thread Gerardo Herzig
Hi all. Im in this situation: I want to perform several kind of (validating) methods to a given value. Lets say i have a class named Number, and the following methods: is_really_a_number(), is_even(), is_greater_than_zero(), and so on. All of them returning booleans. I want the

parsing long `To' and 'Cc' from email

2007-09-06 Thread Gerardo Herzig
Hi all. Im trying to develop yet another email filter. Just for fun for now. Im having a little trouble parsing long 'To' and 'Cc' headers. Sometimes p.e. the 'To' header comes like '[EMAIL PROTECTED], [EMAIL PROTECTED]' others comes like 'My self [EMAIL PROTECTED], My brother [EMAIL

Re: parsing long `To' and 'Cc' from email

2007-09-06 Thread Gerardo Herzig
Steve Holden wrote: Gerardo Herzig wrote: Hi all. Im trying to develop yet another email filter. Just for fun for now. Im having a little trouble parsing long 'To' and 'Cc' headers. Sometimes p.e. the 'To' header comes like '[EMAIL PROTECTED], [EMAIL PROTECTED]' others comes like 'My self

Re: Help me understand this script

2007-09-05 Thread Gerardo Herzig
Ryan J Nauman wrote: Can someone help me understand this script please? I understand everything except for the anagram function. Could you break it down into more than 1 line of code for me or explain it? (I understand WHAT it does but HOW?) Thanks. Script ### # SCRABBLE.PY # # purpose: #

Re: How does super() work?

2007-09-03 Thread Gerardo Herzig
Lamonte Harris wrote: I've searched Google, and other search engines to try to find out how super() works. Can someone explain in short detail how super() works? I may and may not need to know this information, but it is good to know. There is at least one explanation in the python.org

Re: pure python for sms

2007-08-31 Thread Gerardo Herzig
Neil Hodgson wrote: Gerardo Herzig: Hi dudes. Im looking for a python implementation for sending sms to a cell phone. I was try using some free pages, but i want to use a python. Do i need a cellphone conected to my machine? Or can i send sms to some cell via some python library

pure python for sms

2007-08-30 Thread Gerardo Herzig
Hi dudes. Im looking for a python implementation for sending sms to a cell phone. I was try using some free pages, but i want to use a python. Do i need a cellphone conected to my machine? Or can i send sms to some cell via some python library? Waiting for advice. Thanks! Gerardo --

Re: Setting a read-only attribute

2007-08-30 Thread Gerardo Herzig
[EMAIL PROTECTED] wrote: I have an object and wish to set an attribute on it which, unfortunately for me, is read-only. How can I go about this? Cheers. -T I guess we all need an code example to show us the way 'read only' is implemented. If you cant access to the class wich you are

extending of adding method?

2007-08-28 Thread Gerardo Herzig
Hi all. I have a question about design. The general question would be: Where is the line beteween extending a class and adding new methods to that class? And the particular case im involved is: I have a class (say USERCLASS) who implements a user interface. One of his methods is called

Re: Is it reasonably easy easy to something like this with python?

2007-08-28 Thread Gerardo Herzig
walterbyrd wrote: This is made with a php5 framework called qcodo. http://examples.qcodo.com/examples/dynamic/inline_editing.php With qcodo it's easy to make grids that are sortable and inline editable. Qcodo grids work from the database - not an xml table or array. Qcodo handles complex data

Re: Is it reasonably easy easy to something like this with python?

2007-08-28 Thread Gerardo Herzig
walterbyrd wrote: On Aug 28, 1:31 pm, Gerardo Herzig [EMAIL PROTECTED] wrote: walterbyrd wrote: The one who make that table sorteable is AJAX. Not php. The php part is kind of trivial (so it would be `trivial' in python too). It just reads some data and format it in an html table

Re: advice about `correct' use of decorator

2007-08-23 Thread Gerardo Herzig
BJörn Lindqvist wrote: On 8/22/07, Gabriel Genellina [EMAIL PROTECTED] wrote: On 22 ago, 10:00, BJörn Lindqvist [EMAIL PROTECTED] wrote: As I said, you can accomplish the exact same thing by calling a function from within the function that requires the user to be logged in. def

Re: advice about `correct' use of decorator

2007-08-17 Thread Gerardo Herzig
Laszlo Nagy wrote: Are you developing a website or a GUI program? It will be used in a web development. It is an important point? Yes, I think. Unless you use AJAX. :-) Most web sites work this way: user clicks - request to server - process on server - response I would rather enclose

Re: advice about `correct' use of decorator

2007-08-17 Thread Gerardo Herzig
BJörn Lindqvist wrote: On 8/16/07, Gerardo Herzig [EMAIL PROTECTED] wrote: @is_logued_in def change_pass(): bla bla And so on for all the other functions who needs that the user is still loged in. where obviosly the is_logued_in() function will determine if the dude is still loged

Re: Help me!!

2007-08-16 Thread Gerardo Herzig
Anhoter HURRA for list comprehensions: a = ['a', 'b', 'c', 'd'] b = ['a','c'] [x in b and x.upper() or x for x in a] ['A', 'b', 'C', 'd'] Is what you want? Cheers Gerardo I'm trying to compare the list with another list and if it is there in both I'm changing it to upper case and adding

advice about `correct' use of decorator

2007-08-16 Thread Gerardo Herzig
Hi all. I guess i have a conceptual question: Im planing using a quite simple decorator to be used as a conditional for the execution of the function. I mean something like that: @is_logued_in def change_pass(): bla bla And so on for all the other functions who needs that the user is

Re: advice about `correct' use of decorator

2007-08-16 Thread Gerardo Herzig
Gerardo Herzig wrote: Hi all. I guess i have a conceptual question: Im planing using a quite simple decorator to be used as a conditional for the execution of the function. I mean something like that: @is_logued_in def change_pass(): bla bla And so on for all the other

Re: advice about `correct' use of decorator

2007-08-16 Thread Gerardo Herzig
Steven Bethard wrote: Gerardo Herzig wrote: Hi all. I guess i have a conceptual question: Im planing using a quite simple decorator to be used as a conditional for the execution of the function. I mean something like that: @is_logued_in def change_pass(): bla bla And so on for all

Re: Question about properties.

2007-08-10 Thread Gerardo Herzig
king kikapu wrote: On Aug 10, 1:33 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Fri, 10 Aug 2007 03:21:29 -0700, king kikapu wrote: Hi, i read in a book the following code snippet that is dealing with properties: class ProtectAndHideX(object): def

(May be OT) developing in jython, using in java?

2007-07-31 Thread Gerardo Herzig
Hi all. I dont know if this is the right place for asking this, but maybe some of you know where i must go. The thing is: Im writing a very simple class (in python) to access some LDAP server. A companion will access to the same LDAP server too, but his developing in java. So i said ok, wait,

Re: SQLObject 0.9.1

2007-07-26 Thread Gerardo Herzig
Oleg Broytmann wrote: Hello! I'm pleased to announce the 0.9.1 release of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and

Re: Delete a file from a CGI

2007-06-01 Thread Gerardo Herzig
When you execute a cgi, the program runs under the apache user (ussualy www or wwwrun or so), so THAT user needs permissions for deleting the file. Other approach could be suid'ing the cgi program. Gerardo HI! I want to delete a file from a CGI, but I always get a Permission denied error.

using google search api for python

2007-05-22 Thread Gerardo Herzig
Hi all. Im looking for the pyGoogle for making google searchs y a python script. The thing is, all im founding is an AJAX api, but the application ill use is NOT a web app. So, someone know if there is a pure python api that i can download and use? Thanks! Gerardo --

I25 barcode generator?

2007-04-26 Thread Gerardo Herzig
Hi. Im looking for an I25 barcode generator. I found a couple of nice EAN barcode generators, but this application needs an I25 barcode. Since this will be an web application, i need to do it in the server side. In python, off course :) Anybody knows one? Thanks! Gerardo --

getting user id (from an arbitrary sys user)

2007-03-14 Thread Gerardo Herzig
hi all. What i need to know is if there is some function like os.getuid(), but taking an argument (the username, off course), so i can do getuid('myuser') Thanks you dudes! Gerardo -- http://mail.python.org/mailman/listinfo/python-list

list comprehension (searching for onliners)

2006-10-20 Thread Gerardo Herzig
Hi all: I have this list thing as a result of a db.query: (short version) result = [{'service_id' : 1, 'value': 10}, {'service_id': 2, 'value': 5}, {'service_id': 1, 'value': 15}, {'service_id': 2, 'value': 15}, ] and so on...what i

Re: list comprehension (searching for onliners)

2006-10-20 Thread Gerardo Herzig
You are the man, you are the man!! Yes, i need those dicts in order to assign them to a nested TMPL_LOOP for the htmltmpl templating engine. Thats why i cant use the solution provided by Max, and thanks to Jon too!! Thanks a lot dudes, i hope someday ill turn myself into some of you guys who

plpython and pickle

2006-08-17 Thread Gerardo Herzig
Hi all, sory if this is kind of [OT], but cannot find the answer for this behaviour Im programming a db function using plpython...i have a db called 'sessions', and a postgres 8.1.2 database called 'test'. In 'sessions', i store several values in a `pickled' way so If a do You are now

operator creation?

2006-03-10 Thread Gerardo Herzig
Hi all. Ill try to explain mi situation: Lets say i have an DB object, who implements the querys to the database trough a method called DBObject.doQuery. On the other hand, i have 50 sql functions stored in the database. So i can call DBObject.doQuery('select * from my_sql_function()')...Ok, what