Re: [Tutor] database programming

2005-02-21 Thread Alan Gauld
> Oh, and don't forget the c.commit() part! That had me running around > in circles all night last night. Yep, I got got with lack of commit syndrome when I started with SQL too :-) > PS Anyone know if there's a way to get a list of tables in a DB? I've > got the pragma to get a list of columns i

Re: [Tutor] design?--having subclassed methods add logic in the middelof class methods

2005-02-21 Thread Alan Gauld
> All code below is pseudo-code. > > Is this an acceptable design for doing this? > > # in Node class > > def _parse(self, list_of_lines): > > # some parsing based on whole list_of_lines > > for line in list_of_lines: > _subclass_preparse(line) > # Do line parsing stuff

[Tutor] Re: database programming (list of tables)

2005-02-21 Thread Bob Gibson
Liam: I agree with Kent. It depends. Not only on the database, but also on the interface (API) used to connect to the database. For example, if you use ODBC to connect to all of your databases, you should be able to use the SQLTables() routine. For more details, see the following: ht

Re: [Tutor] database programming

2005-02-21 Thread Liam Clarke
/me smacks head. Thanks Kent. Exactly what I need. Regards, Liam Clarke On Mon, 21 Feb 2005 16:21:23 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Liam Clarke wrote: > > > PS Anyone know if there's a way to get a list of tables in a DB? I've > > got the pragma to get a list of columns in

Re: [Tutor] design?--having subclassed methods add logic in the middel of class methods

2005-02-21 Thread Brian van den Broek
Kent Johnson said unto the world upon 2005-02-21 16:40: Brian van den Broek wrote: I am exploring ways of having the methods of a sub-class insert additional logic into their version of a class's methods, while still running the original class's method logic. All code below is pseudo-code. My N

Re: [Tutor] Time Controlled Execution

2005-02-21 Thread Mike Bell
On Windows it looks like msvcrt will give you a non-blocking terminal read -- on mac / *nix systems it looks a little trickier: http://mail.python.org/pipermail/pythonmac-sig/2004-February/010140.html The os module in windows doesn't even have O_NONBLOCK. That seems like trouble. m On Sun, 20

Re: [Tutor] More Advanced Calculator.

2005-02-21 Thread Kent Johnson
. Sm0kin'_Bull wrote: With your helps i managed to program Advanced Calculator. But, I want to change(or add) some to it. 1. How can i /n/n result bit? I tired.. but, I can't You can use the print command to print your results. You can give print a list of values and it will print them separated w

Re: [Tutor] design?--having subclassed methods add logic in the middel of class methods

2005-02-21 Thread Kent Johnson
Brian van den Broek wrote: Hi all, I am still building my toolset for working with treepad files. (This is the one all my recent posts concerning Node classes have been about.) I am exploring ways of having the methods of a sub-class insert additional logic into their version of a class's method

Re: [Tutor] database programming

2005-02-21 Thread Kent Johnson
Liam Clarke wrote: PS Anyone know if there's a way to get a list of tables in a DB? I've got the pragma to get a list of columns in a table, but just in the off chance... AFAIK there is no standard way to do this - it is different for each database. For SQLite, see this FAQ: http://www.sqlite.org/

Re: [Tutor] database programming

2005-02-21 Thread Liam Clarke
>>>import sqlite >>>x = sqlite.connect('mysqlitedb') >>>cx = x.cursor() >>>cx.execute( 'create table foo (columnA varchar(15), columnB number(3))' ) >>>cx.execute ('insert into foo (columnA, columnB) values ("Parrot", 90)') >>>x.commit() >>>cx.execute('select * from foo') >>>cx.fetchall() [('Parr

[Tutor] More Advanced Calculator.

2005-02-21 Thread . Sm0kin'_Bull
With your helps i managed to program Advanced Calculator. But, I want to change(or add) some to it. 1. How can i /n/n result bit? I tired.. but, I can't 2. How can i enable it to calculate float-pointing numbers? (Which will make it complicated) It should looks like this... Please input data Numb

[Tutor] design?--having subclassed methods add logic in the middel of class methods

2005-02-21 Thread Brian van den Broek
Hi all, I am still building my toolset for working with treepad files. (This is the one all my recent posts concerning Node classes have been about.) I am exploring ways of having the methods of a sub-class insert additional logic into their version of a class's methods, while still running the

Re: [Tutor] database programming

2005-02-21 Thread Danny Yoo
On Mon, 21 Feb 2005, Chris Mallari wrote: > hi there! can u pls send me sample code in accessing a simple database > using python. Hi Chris, You may want to look at the Database topic guide: http://www.python.org/topics/database/ It has links to examples, tutorials, and other documentati

Re: [Tutor] Help debuging a small program

2005-02-21 Thread Kent Johnson
Mark Kels wrote: Hi list ! Here is a small port scanner I made to practice sockets and GUI programming ( WARNING: the program crash when scan button is clicked): How far does it get? How do you know? I would put some debug print statements in. Also you should call sk.close() in the else clause of

[Tutor] Help debuging a small program

2005-02-21 Thread Mark Kels
Hi list ! Here is a small port scanner I made to practice sockets and GUI programming ( WARNING: the program crash when scan button is clicked): #--Imports-- from Tkinter import * import socket #--The result GUI window function- def result(): global result_t #I

RE: [Tutor] Initializing with a call like: someClass.open("someFile")?

2005-02-21 Thread Ryan Davis
You could make the __init__ take the filename: def __init__(self, filename=None): #do whatever And then instantiate the object like: >>>x = someClass(filename="someFile") Alternatively, you could make the Open function a module level function, defined in someClass.py, but not in the actual c

Re: [Tutor] Time Controlled Execution

2005-02-21 Thread Pierre Barbier de Reuille
I really don't think you can have a common way to do this on both systems. First, the way to kill a process is quite different on both systems (the os.kill function works only on UNIX systems, and I don't know is there is such a function available in Python for MS Windows). Then, I really doubt

Re: [Tutor] database programming

2005-02-21 Thread Michael Dunn
Hi Chris, If you just want to learn about databases, then sqlite is a good way to go. It's small, it's typeless (which means you don't have to define ahead of time what sort of thing is going to go in which bit of the database; python is typeless too), and it is not split into client and server (m

[Tutor] Re: database programming

2005-02-21 Thread Bob Gibson
> hi there! can u pls send me sample code in accessing a simple database > using python. > > Chris Mallari > thanks Chris: How about "Jython"? Here's an article that I just wrote: http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0502gibson/index.html Bob

Re: [Tutor] Initializing with a call like: someClass.open("someFile")?

2005-02-21 Thread Kent Johnson
Christian Meesters wrote: Hi My cryptic subject is perhaps not sufficient - I'll try to make it a little better: Assume you'd like to write something like: import someClass x = someClass.open("someFile") Here '.open' should read in the data and initialize the instance - with or without calling __

Re: [Tutor] Help needed with script to batch-create shapefiles

2005-02-21 Thread Chris Bromley
Dear All, Just a quick follow up for those of you who are interested. The batching script is now working and is attached below. The intermediate step of saving the xy layer to a folder was unecessary and has been removed. The 'MakeXYEventLayer' command only creates "in memory" layers and not

[Tutor] database programming

2005-02-21 Thread Chris Mallari
hi there! can u pls send me sample code in accessing a simple database using python. Chris Mallari thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Initializing with a call like: someClass.open("someFile")?

2005-02-21 Thread Christian Meesters
Hi My cryptic subject is perhaps not sufficient - I'll try to make it a little better: Assume you'd like to write something like: import someClass x = someClass.open("someFile") Here '.open' should read in the data and initialize the instance - with or without calling __init__. How is this