Re: Algorithm for Labels like in Gmail
Hi George, George Sakkis wrote: > Google for "many-to-many relationships". In short, you have two entity > classes (say emails and labels) where each instance of one entity may > be associated to zero or more instances of the other entity. In > databases you implement this by having three tables, one for each > entity and one for their association: > >Email RelEmailLabel Label > -- --- > ID<--- EmailID ID > subjectLabelID ---> name > ... ... > Ok, but how can I keep my Relationship Table out of bugs, bad data?! I wonder how i'll control the following: 1st) Given an generic email, in which group(s) is it contained? 2nd) Given a group, which Emails/contacts does it contain? I don't have much expererience with databases (yet). Will the pysqlite work with ease? Because I don't mean to make a big big program, just something very simple for my personal use. > > Then you can associate mails to labels by joining all three tables > together on the IDs. Of course you can implement this in memory as well > but you should probably want to store them in some persistent area > anyway, so an rdbms the way to go. Sqlite (with pysqlite) would meet > your needs just fine. I'll google for this module tomorrow and try to learn something about it. I plan to post the code I manage to write. BTW which is the best way to store all those data files? Plain text files? Some kind of binary file? or what? Thank you once again, Rodolfo -- http://mail.python.org/mailman/listinfo/python-list
Re: Algorithm for Labels like in Gmail
Thanks to you all. I'll start trying the buzhug solution, which seems more pythonic. But I feel like I gotta learn how to use databases... once I studied SQL a litle bit, but don't remember much. I'll play around with Python and then I show what I got. Bye Rodolfo P.S: Is there a way to do a "clear screen" on a Python program? I mean something like the "cls" command in MS-DOS -- http://mail.python.org/mailman/listinfo/python-list
HTTP Session Issue
Hi, I'm working with a 100% dependecy-free web app for python, and I'm taking an overview about HTTPServer and CGIHTTPRequestHandler. In my researches, I don't found anything about HTTP Sessions... Can python natively hadle http sessions, or I'll must write with by hand? Rodolfo. -- http://mail.python.org/mailman/listinfo/python-list
Problems with HTTP Request
Hi folks!
I'm writing my own web server in python, and I'm getting problems to handle
POST requests.
This is a snippet of my code (of an HttpRequest class):
try:
length = int(self.myRequestHandler.headers.get('content-length', 0))
except ValueError:
length = 0
pdata = self.myRequestHandler.rfile.read(length)
# extract POST data from pdata
The application is executed normally, the response is sent back to the
client, but something is keeping the connection open. I discovered that the
problem is in the lines above, but no exception is raised. I tested
replacing this line:
pdata = self.myRequestHandler.rfile.read(length)
by this:
pdata = self.myRequestHandler.rfile.read(length-1)
On this way, the web server works fine, and close the connection after
response ends. But my request is uncomplete, because the last char is not
readed.
I don't know what to do anymore. I need help =/
Thanks in advance.
--
Rodolfo Carvalho
Web Developer
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Python module question
Hi folks I have a question for this mailing list. When I'm writing a class, I can rewrite the method __getattr__() to modify the object's method/attribute access behavior. My question is: can I code a method __getattr__() to change the behavior of the 'import' command? -- Rodolfo Carvalho Web Developer [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
