[Tutor] cylinder texture map?

2006-10-12 Thread Michael Shulman
Hello, You guys gave fantastic advice for my last question about point in polygon testing, thanks. New question; I'd like to make a scrolling background for a game I'm working on. I was thinking, since it's all in orthographic view, that a horizontal cylinder which rotates with a texture woul

Re: [Tutor] SQL Queries For MySQL

2006-10-12 Thread Alan Gauld
> query = "SELECT * FROM DB WHERE NAME = %s" % (name) > cursor.execute(query) There can be security issues with this style, especially if the parameters can be modified by users - for example you read the values from a web page. The cursor.execute() call has the ability to pass the parameters

[Tutor] Why is random.choice so much slower than random.random()?

2006-10-12 Thread Dick Moores
Why is random.choice so much slower than random.random()? In fact, by a factor of 12! And randint(). Some 25 times slower than random(). Why? (I know that random() is the basis for most of the other functions in the random module, and a look at random.py, though I don't complete understand it, g

Re: [Tutor] Why is random.choice so much slower than random.random()?

2006-10-12 Thread Luke Paireepinart
Dick Moores wrote: > Why is random.choice so much slower than random.random()? In fact, by > a factor of 12! And randint(). Some 25 times slower than random(). Why? > (I know that random() is the basis for most of the other functions in > the random module, and a look at random.py, though I don't

Re: [Tutor] Why is random.choice so much slower than random.random()?

2006-10-12 Thread Kent Johnson
Dick Moores wrote: > Why is random.choice so much slower than random.random()? In fact, by > a factor of 12! And randint(). Some 25 times slower than random(). Why? > (I know that random() is the basis for most of the other functions in > the random module, and a look at random.py, though I don't

[Tutor] python tutor

2006-10-12 Thread deandermo
can any one please help im looking for a personal tutor that can help me with learning python . im finding it alien to me as i am a beginer ive tried numerous websites and i am still finding it stranfe to . can anyone help me ?? many thanks dean dermody _

[Tutor] tutor required

2006-10-12 Thread deandermo
please can you help me ? i need a private tutor to learn me python , i know this may seem strange but im finding it really difficult to learn , ive very website there is 'and im just not learning , i would feel better iff i had someone teaching it me ,. do you know of anyone who could help me

[Tutor] (no subject)

2006-10-12 Thread dean dermody
do you know of any private tutors to tach me python thank you Hotmail is evolving - be one of the first to try the Windows Live™ Mail Beta ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Fwd: do you know how to do this

2006-10-12 Thread ALAN GAULD
Forwarding to the group... --- anil maran <[EMAIL PROTECTED]> wrote: > Date: Thu, 12 Oct 2006 01:46:44 -0700 (PDT) > From: anil maran <[EMAIL PROTECTED]> > Subject: do you know how to do this > To: Alan Gauld <[EMAIL PROTECTED]> > > The user, password and group are stored in a session on disk >

Re: [Tutor] python tutor

2006-10-12 Thread Alan Gauld
This list does not provide private tutors as such. But you can ask questions about topics that you don't understand on the web sites (preferrably with a link to the page in question) and people will try to clarify what is meant. The advantages of the list approach are: 1) More tutors so more cha

Re: [Tutor] Why is random.choice so much slower than random.random()?

2006-10-12 Thread Dick Moores
At 04:33 AM 10/12/2006, Kent Johnson wrote: >Looking at the code and your numbers, my guess is that the time to make >a Python function call on your computer is about 2 microseconds (20 msec >/ 1). (I mean the entire overhead - looking up the function and >actually calling it.) Hm. Does this t

[Tutor] Help with basic user-data file

2006-10-12 Thread Asrarahmed Kadri
Folks,   I am trying to modify the userManagement program given in Core Python Programming. It uses a dictionary to store user-password information. The usernames are the keys and the passwords are the values. Now I want is to add a third element; last login time. I want to store this information

Re: [Tutor] Why is random.choice so much slower than random.random()?

2006-10-12 Thread Kent Johnson
Dick Moores wrote: > At 04:33 AM 10/12/2006, Kent Johnson wrote: >> Looking at the code and your numbers, my guess is that the time to make >> a Python function call on your computer is about 2 microseconds (20 msec >> / 1). (I mean the entire overhead - looking up the function and >> actually

Re: [Tutor] SQL Queries For MySQL

2006-10-12 Thread johnf
On Thursday 12 October 2006 00:31, Alan Gauld wrote: > > query = "SELECT * FROM DB WHERE NAME = %s" % (name) > > cursor.execute(query) > > There can be security issues with this style, especially > if the parameters can be modified by users - for example > you read the values from a web page. > >

Re: [Tutor] Help with basic user-data file

2006-10-12 Thread Rob Andrews
To keep the information, the simplest solution is simply to save it in a text file that the program can load into memory when it starts up again. For sensitive information like passwords, a little extra fuss is generally merited. When someone logs in, you can save a value like time.strftime(time.c

[Tutor] question about number of threads

2006-10-12 Thread shawn bright
Hey there, i have an app that runs several processes as threads. using the threading.Thread() now, i have another app that does the same thing. Now, pretty soon, we will be combining all the features of the two packages together into one app. My question is, is there a limit on how many threads

Re: [Tutor] Help with basic user-data file

2006-10-12 Thread Asrarahmed Kadri
It means there is no need of entering the data in the dictionary,??   How will I then implement the uniqueness of loginnames???   Thanks for the support. regards, Asrar  On 10/12/06, Rob Andrews <[EMAIL PROTECTED]> wrote: To keep the information, the simplest solution is simply to save it ina text

Re: [Tutor] Help with basic user-data file

2006-10-12 Thread Rob Andrews
When a login name is being created, you can pull a list of existing login names from file, and run a check to see if it is in the list. If the new name is in the list, have it kick back a message telling the user to try another name. Also, your program could suggest a new user name in such a case,

Re: [Tutor] question about number of threads

2006-10-12 Thread Kent Johnson
shawn bright wrote: > Hey there, > i have an app that runs several processes as threads. > using the threading.Thread() > > now, i have another app that does the same thing. Now, pretty soon, we > will be combining all the features of the two packages together into one > app. > > My question is

Re: [Tutor] SQL Queries For MySQL

2006-10-12 Thread Jason Massey
On 10/12/06, johnf <[EMAIL PROTECTED]> wrote: On Thursday 12 October 2006 00:31, Alan Gauld wrote:> > query = "SELECT * FROM DB WHERE NAME = %s" % (name)> > cursor.execute(query)>> There can be security issues with this style, especially > if the parameters can be modified by users - for example> y

[Tutor] Fwd: question about number of threads

2006-10-12 Thread shawn bright
-- Forwarded message --From: shawn bright <[EMAIL PROTECTED]>Date: Oct 12, 2006 9:15 AM Subject: Re: [Tutor] question about number of threadsTo: Kent Johnson <[EMAIL PROTECTED]>oh, well then i do not have anything to worry about. I was  talking about a move from 6 threads to 10. he

Re: [Tutor] SQL Queries For MySQL

2006-10-12 Thread Python
On Thu, 2006-10-12 at 06:19 -0700, johnf wrote: > On Thursday 12 October 2006 00:31, Alan Gauld wrote: > > > query = "SELECT * FROM DB WHERE NAME = %s" % (name) > > > cursor.execute(query) > > > > There can be security issues with this style, especially > > if the parameters can be modified by user

[Tutor] how to check whether a file exists or not??

2006-10-12 Thread Asrarahmed Kadri
Hello,   Sorry, but this is a very basic questions... Can you tell me how to check the existence of a file.. Also if a file exists, and we open it in a write mode, it would be truncated to zero length. So what is the way out of this??#   Regards,   Asrar-- To HIM you shall return.

Re: [Tutor] how to check whether a file exists or not??

2006-10-12 Thread Ziad Rahhal
On 10/12/06, Asrarahmed Kadri <[EMAIL PROTECTED]> wrote: Hello,   Sorry, but this is a very basic questions... Can you tell me how to check the existence of a file..     to check if a file exists, you can use os.path.exists(path)     or look at http://python.org/doc/current/lib/module-os.path.html

Re: [Tutor] python tutor

2006-10-12 Thread Danny Yoo
> 1) More tutors so more chance of one finding an explanation you > understand Another advantage that can't be overstated is that of checks-and-balances: if any one of the tutors here gives erroneous advice, the other tutors here will provide error-correction. (I've had this happen for mysel

[Tutor] do you know how to do this

2006-10-12 Thread Danny Yoo
>> Date: Thu, 12 Oct 2006 01:46:44 -0700 (PDT) >> From: anil maran <[EMAIL PROTECTED]> >> Subject: do you know how to do this >> To: Alan Gauld <[EMAIL PROTECTED]> >> >> The user, password and group are stored in a session on disk using >> flup.middleware.session. You can change this to fit your n

Re: [Tutor] cylinder texture map?

2006-10-12 Thread Danny Yoo
On Thu, 12 Oct 2006, Michael Shulman wrote: > I'd like to make a scrolling background for a game I'm working on. I > was thinking, since it's all in orthographic view, that a horizontal > cylinder which rotates with a texture would simulate this very well. I have to admit I'm clueless about p

Re: [Tutor] cylinder texture map?

2006-10-12 Thread Adam Bark
On 12/10/06, Danny Yoo <[EMAIL PROTECTED]> wrote: On Thu, 12 Oct 2006, Michael Shulman wrote:> I'd like to make a scrolling background for a game I'm working on.  I> was thinking, since it's all in orthographic view, that a horizontal> cylinder which rotates with a texture would simulate this very

[Tutor] embedding lists in configuration files

2006-10-12 Thread William O'Higgins Witteman
I am looking for a way to use a plain text configuration file in a Python program instead of hard-coded values. The configuration data currently is in the form of a couple of lists and some triple-quoted strings. I was looking at the ConfigParser module, but I cannot see how to use this format to

[Tutor] Fwd: Help with basic user-data file

2006-10-12 Thread Rob Andrews
I'm forwarding this to the tutor list, as I'm swamped at work. -- Forwarded message -- From: Asrarahmed Kadri <[EMAIL PROTECTED]> Date: Oct 12, 2006 9:17 AM Subject: Re: [Tutor] Help with basic user-data file To: Rob Andrews <[EMAIL PROTECTED]> Thanks. Can you please also tell me

[Tutor] float object not callable error

2006-10-12 Thread Kristinn Didriksson
Hello, I an completely new to programming and am trying to teach myself Python using Python Programming by John Zelle. Essentially I am an ex- tech writer trying to learn how to program. My system: Mac OS X 10.4, Python 2.5, TextMate editor Here is the problem: I get 'float' object not callable

Re: [Tutor] float object not callable error

2006-10-12 Thread Danny Yoo
> Here is the problem: > > I get 'float' object not callable error. Hi Kristinn, Ah. Ok. The problem is a notational one. You're reusing notation that you've learned from your math classes, that is, that: a b informally represents the multiplication of numbers 'a' and 'b'. Furthermor

Re: [Tutor] float object not callable error

2006-10-12 Thread Bob Gailer
Kristinn Didriksson wrote: > Hello, > I an completely new to programming and am trying to teach myself > Python using Python Programming by John Zelle. Essentially I am an ex- > tech writer trying to learn how to program. > My system: Mac OS X 10.4, Python 2.5, TextMate editor > Here is the prob

Re: [Tutor] do you know how to do this

2006-10-12 Thread anil maran
Dear DannyTHanks for your prompt response. THis is not a homework problem, I m trying to learn how to do sessions logins I m trying to do the following 1) have logins/passwords stored in postgresql, currently this is my code, python+psycopg2 talking to postgresql running in backend. if i.email != "

[Tutor] Help with generating session id

2006-10-12 Thread anil maran
Hi guysI m trying to maintain Sessions for each user, and a session-id that needs to be stored in cookie. I m unable to figure out how to generate session-id that can be stored in a cookie and sync with a session.The problem is this everytime someone logs in check and see if they have session info

Re: [Tutor] Help with generating session id

2006-10-12 Thread Luke Paireepinart
anil maran wrote: > Hi guys > I m trying to maintain Sessions for each user, and a session-id that > needs to be stored in cookie. I m unable to figure out how to generate > session-id that can be stored in a cookie and sync with a session. > The problem is this > everytime someone logs in check

Re: [Tutor] embedding lists in configuration files

2006-10-12 Thread Luke Paireepinart
William O'Higgins Witteman wrote: > I am looking for a way to use a plain text configuration file in a > Python program instead of hard-coded values. The configuration data > currently is in the form of a couple of lists and some triple-quoted > strings. > > I was looking at the ConfigParser modul

Re: [Tutor] Fwd: Help with basic user-data file

2006-10-12 Thread Kent Johnson
> From: Asrarahmed Kadri <[EMAIL PROTECTED]> > Date: Oct 12, 2006 9:17 AM > Subject: Re: [Tutor] Help with basic user-data file > To: Rob Andrews <[EMAIL PROTECTED]> > > > Thanks. > Can you please also tell me how to check the existence of a file using > python builtin functions. If path is a st

Re: [Tutor] embedding lists in configuration files

2006-10-12 Thread Kent Johnson
William O'Higgins Witteman wrote: > I am looking for a way to use a plain text configuration file in a > Python program instead of hard-coded values. The configuration data > currently is in the form of a couple of lists and some triple-quoted > strings. > > I was looking at the ConfigParser modu

Re: [Tutor] how to check whether a file exists or not??

2006-10-12 Thread John Fouhy
On 13/10/06, Asrarahmed Kadri <[EMAIL PROTECTED]> wrote: > Also if a file exists, and we open it in a write mode, it would be truncated > to zero length. So what is the way out of this??# You can open in append mode.. >>> f = open('foo', 'w') >>> f.write('Hello ') >>> f.close() >>> f = open('foo'

[Tutor] wxPython book

2006-10-12 Thread Alan Gauld
I just noticed WxPython in Action (Paperback) by Noel Rappin, Robin Dunn on Amazon.co.uk. I wondered if anyone has got the book and would like to comment on it? One of the main reasions I stick with Tkinter is that I have Grayson's book as a reference. If this is as useful for wxPython I mi

Re: [Tutor] SQL Queries For MySQL

2006-10-12 Thread johnf
On Thursday 12 October 2006 07:14, Jason Massey wrote: > On 10/12/06, johnf <[EMAIL PROTECTED]> wrote: > > On Thursday 12 October 2006 00:31, Alan Gauld wrote: > > > > query = "SELECT * FROM DB WHERE NAME = %s" % (name) > > > > cursor.execute(query) > > > > > > There can be security issues with thi

Re: [Tutor] embedding lists in configuration files

2006-10-12 Thread Alan Gauld
> Python program instead of hard-coded values. The configuration data > currently is in the form of a couple of lists and some triple-quoted > strings. > > I was looking at the ConfigParser module, but I cannot see how to > use > this format to represent lists or triple-quoted strings. Are there

Re: [Tutor] wxPython book

2006-10-12 Thread wesley chun
> WxPython in Action (Paperback) > by Noel Rappin, Robin Dunn i'll probably be picking up a copy of it myself. i've seen positive comments about the book. more reviews available at Amazon US: http://www.amazon.com/exec/obidos/ASIN/1932394621 there's also a wxWidgets book if you need to know the

[Tutor] Trying to understand sys.getrefcount()

2006-10-12 Thread Tony Cappellini
I'm using Python 2.3.4After reading this in the docs getrefcount( object) Return the reference count of the object. The count returned is generally one higher than you might expect, because it includes the (temporary) reference as an argument to getrefcount().I decided to try some experiments c

Re: [Tutor] wxPython book

2006-10-12 Thread Alan Gauld
Thanks Wes, After posting it dawned on me that the US site might have more (any!) reviews, and sure enough there is one mega review and several shorter ones, none negative. I think I'll be buying... The wxWidgets book I'll pass on, I have an old one from about 10 years ago (from when I was active

[Tutor] Help me : Why this code is not working??

2006-10-12 Thread Asrarahmed Kadri
    I have created two buttons. The code for button2 is not working as I want it to be. When I click button2, the application should exit, but it isnt. Can someone fix it?? from Tkinter import *from tkMessageBox import * def callback():    showinfo('message','I am here...') def QUIT():    ans = as

Re: [Tutor] Help me : Why this code is not working??

2006-10-12 Thread Luke Paireepinart
Asrarahmed Kadri wrote: > > > I have created two buttons. The code for button2 is not working as I > want it to be. When I click button2, the application should exit, but > it isnt. > Can someone fix it?? > > from Tkinter import * > from tkMessageBox import * > > def callback(): > showinf

Re: [Tutor] SQL Queries For MySQL

2006-10-12 Thread Python
On Thu, 2006-10-12 at 14:46 -0700, johnf wrote: > On Thursday 12 October 2006 07:14, Jason Massey wrote: > > On 10/12/06, johnf <[EMAIL PROTECTED]> wrote: > > > On Thursday 12 October 2006 00:31, Alan Gauld wrote: > > > > > query = "SELECT * FROM DB WHERE NAME = %s" % (name) > > > > > cursor.execut

Re: [Tutor] Help me : Why this code is not working??

2006-10-12 Thread Asrarahmed Kadri
Thanks a lot. It was quick. I will send the traceback from now on.   -Asrar  On 10/13/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Asrarahmed Kadri wrote:>>> I have created two buttons. The code for button2 is not working as I > want it to be. When I click button2, the application should exit,

[Tutor] tkinter tutorials

2006-10-12 Thread Amadeo Bellotti
I am currently interseted in learning tkinter and what beeter way then with a project so im making a python IDE and i was wondering if there were any good tutorials that are out there for tkinter and a book or 2 would be nice thank you ___ Tutor maillist

Re: [Tutor] tkinter tutorials

2006-10-12 Thread Danny Yoo
On Thu, 12 Oct 2006, Amadeo Bellotti wrote: > I am currently interseted in learning tkinter and what beeter way then > with a project so im making a python IDE and i was wondering if there > were any good tutorials that are out there for tkinter and a book or 2 > would be nice thank you Joh

[Tutor] How to write strings with new line character in a file

2006-10-12 Thread Asrarahmed Kadri
Folks,   I am trying to enter names in a file; each on a new line with this code, but not working:   done = 0 while not done:    str = raw_input("Enter login name:\t to quit type 'q': ")if str == 'q':    done = 1    else:     str = str + '\n'    fd.write(str) The traceback is as un

Re: [Tutor] do you know how to do this

2006-10-12 Thread Danny Yoo
> a login page that takes a username and password, checks it against a > database, and then sets a cookie of (hash(secret,user, time),user,time). Hi Anil, Ok, separate the concerns about where the inputs are coming from. It will seem weird, but just for the moment, forget completely about the

Re: [Tutor] How to write strings with new line character in a file

2006-10-12 Thread Danny Yoo
> > while not done: >str = raw_input("Enter login name:\t to quit type 'q': ") >if str == 'q': > done = 1 >else: > str = str + '\n' > fd.write(str) Hi Asrarahmed, What's 'fd'? Where is it defined? (I have a guess, but I'd rather that you show where fd is being defi

Re: [Tutor] wxPython book

2006-10-12 Thread Dennis O'Brien
There is a good interview on Python 411 last week with the authors of the book. http://www.awaretek.com/python/index.html You can also find a few other shows about gui toolkits in Python. This is a great resource if you want to learn about Python while you commute. --Dennis - Original Mes

Re: [Tutor] Responding to a request for input from a MS-DOS program

2006-10-12 Thread Jeffrey Kennedy
Hi Alan, I think I might be trying to walk before I can crawl; for benefits of other newbies, I'll summarise lessons learned so far. Firstly, I spent ages trying to find out why the Python documentation syntax for Popen, using stdin=PIPE, didn't work: Traceback (most recent call last): File ""

Re: [Tutor] How to write strings with new line character in a file

2006-10-12 Thread Bob Gailer
Asrarahmed Kadri wrote: > Folks, > > I am trying to enter names in a file; each on a new line with this > code, but not working: > > done = 0 > *while not done: > str = raw_input("Enter login name:\t to quit type 'q': ") > if str == 'q': > done = 1 > else: * > * str

Re: [Tutor] Help with basic user-data file

2006-10-12 Thread Liam Clarke
Hi Asrarahmed, There's a few questions in there, and unfortunately I don't have a copy of your book. But I'll try to answer them, and I'll change the order so that they build on each other. >I am not sure of using time function in python.. Depending on what you're trying to do, the simplest w