Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-17 Thread Jon Clements
On Sun, 17 Jun 2012 23:17:37 +, Steven D'Aprano wrote: > On Mon, 18 Jun 2012 08:41:57 +1000, Chris Angelico wrote: > >> On Mon, Jun 18, 2012 at 3:06 AM, Rafael Durán Castañeda >> wrote: >>> The language Python includes a SystemRandom class that obtains >>> cryptographic grade random bits fro

Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-16 Thread Jon Clements
On Sun, 17 Jun 2012 12:31:04 +1000, Chris Angelico wrote: > On Sun, Jun 17, 2012 at 12:15 PM, Yesterday Paid > wrote: >> I'm making cipher program with random.seed(), random.random() as the >> key table of encryption. >> I'm not good at security things and don't know much about the algorithm >> u

Re: Compare 2 times

2012-06-06 Thread Jon Clements
On 06/06/12 14:39, Christian Heimes wrote: Am 06.06.2012 14:50, schrieb loial: I have a requirement to test the creation time of a file with the current time and raise a message if the file is more than 15 minutes old. Platform is Unix. I have looked at using os.path.getctime for the file cre

Re: file pointer array

2012-06-06 Thread Jon Clements
On 06/06/12 19:51, MRAB wrote: On 06/06/2012 19:28, Jon Clements wrote: On 06/06/12 18:54, Prasad, Ramit wrote: data= [] for index in range(N, 1): # see Chris Rebert's comment with open('data%d.txt' % index,'r') as f: data.append( f.readlines() ) I think "dat

Re: file pointer array

2012-06-06 Thread Jon Clements
On 06/06/12 18:54, Prasad, Ramit wrote: data= [] for index in range(N, 1): # see Chris Rebert's comment with open('data%d.txt' % index,'r') as f: data.append( f.readlines() ) I think "data.extend(f)" would be a better choice. Jon. -- http://mail.python.org/mailman/listinfo/pytho

Re: DBF records API

2012-06-01 Thread Jon Clements
On 01/06/12 23:13, Tim Chase wrote: On 06/01/12 15:05, Ethan Furman wrote: MRAB wrote: I'd probably think of a record as being more like a dict (or an OrderedDict) with the fields accessed by key: record["name"] but: record.deleted Record fields are accessible both by key and by

Re: sqlite INSERT performance

2012-05-31 Thread Jon Clements
On Thursday, 31 May 2012 16:25:10 UTC+1, duncan smith wrote: > On 31/05/12 06:15, John Nagle wrote: > > On 5/30/2012 6:57 PM, duncan smith wrote: > >> Hello, > >> I have been attempting to speed up some code by using an sqlite > >> database, but I'm not getting the performance gains I expected. >

usenet reading

2012-05-25 Thread Jon Clements
Hi All, Normally use Google Groups but it's becoming absolutely frustrating - not only has the interface changed to be frankly impractical, the posts are somewhat random of what appears, is posted and whatnot. (Ironically posted from GG) Is there a server out there where I can get my news group

Re: Dynamic comparison operators

2012-05-25 Thread Jon Clements
> > Any time you find yourself thinking that you want to use eval to solve a > problem, take a long, cold shower until the urge goes away. > > If you have to ask why eval is dangerous, then you don't know enough > about programming to use it safely. Scrub it out of your life until you > have l

Re: Email Id Verification

2012-05-25 Thread Jon Clements
On Friday, 25 May 2012 14:36:18 UTC+1, Grant Edwards wrote: > On 2012-05-25, Steven D'Aprano wrote: > > On Thu, 24 May 2012 05:32:16 -0700, niks wrote: > > > >> Hello everyone.. > >> I am new to asp.net... > >> I want to use Regular Expression validator in Email id verification.. > > > > Why do y

Re: A question of style (finding item in list of tuples)

2012-05-21 Thread Jon Clements
On Monday, 21 May 2012 13:37:29 UTC+1, Roy Smith wrote: > I've got this code in a django app: > > CHOICES = [ > ('NONE', 'No experience required'), > ('SAIL', 'Sailing experience, new to racing'), > ('RACE', 'General racing experience'), > ('GOOD', 'Experienced

Re: key/value store optimized for disk storage

2012-05-05 Thread Jon Clements
On Friday, 4 May 2012 16:27:54 UTC+1, Steve Howell wrote: > On May 3, 6:10 pm, Miki Tebeka wrote: > > > I'm looking for a fairly lightweight key/value store that works for > > > this type of problem: > > > > I'd start with a benchmark and try some of the things that are already in > > the standa

Re: HTML Code - Line Number

2012-04-27 Thread Jon Clements
On Friday, 27 April 2012 18:09:57 UTC+1, smac...@comcast.net wrote: > Hello, > > For scrapping purposes, I am having a bit of trouble writing a block > of code to define, and find, the relative position (line number) of a > string of HTML code. I can pull out one string that I want, and then > th

Re: HTML Code - Line Number

2012-04-27 Thread Jon Clements
comcast.net> writes: > > Hello, > [snip] > Any thoughts as to how to define a function to do this, or do this > some other way? All insight is much appreciated! Thanks. > Did you not see my reply to your previous thread? And why do you want the line number? Jon. -- http://mail.python.or

Re: Web Scraping - Output File

2012-04-26 Thread Jon Clements
comcast.net> writes: > > Hello, > > I am having some difficulty generating the output I want from web > scraping. Specifically, the script I wrote, while it runs without any > errors, is not writing to the output file correctly. It runs, and > creates the output .txt file; however, the file is

Re: Newbie, homework help, please.

2012-04-21 Thread Jon Clements
On Saturday, 21 April 2012 18:35:26 UTC+1, someone wrote: > On Saturday, April 21, 2012 12:28:33 PM UTC-5, someone wrote: > > Ok, this is my dillema, not only am I new to this programming buisness, > > before the last few days, I did not even know what python was, and besides > > opening up the

Re: Using arguments in a decorator

2012-04-21 Thread Jon Clements
On Saturday, 21 April 2012 09:25:40 UTC+1, Steven D'Aprano wrote: > On Fri, 20 Apr 2012 09:10:15 -0700, Jon Clements wrote: > > >> But I don't know how. I know that I can see the default arguments of > >> the original function using func.__defaults__, but w

Re: Using arguments in a decorator

2012-04-20 Thread Jon Clements
On Friday, 20 April 2012 16:57:06 UTC+1, Rotwang wrote: > Hi all, here's a problem I don't know how to solve. I'm using Python 2.7.2. > > I'm doing some stuff in Python which means I have cause to call > functions that take a while to return. Since I often want to call such a > function more th

Re: How do you refer to an iterator in docs?

2012-04-19 Thread Jon Clements
On Thursday, 19 April 2012 13:21:20 UTC+1, Roy Smith wrote: > Let's say I have a function which takes a list of words. I might write > the docstring for it something like: > > def foo(words): >"Foo-ify words (which must be a list)" > > What if I want words to be the more general case of so

Re: Regular expressions, help?

2012-04-19 Thread Jon Clements
On Thursday, 19 April 2012 07:11:54 UTC+1, Sania wrote: > Hi, > So I am trying to get the number of casualties in a text. After 'death > toll' in the text the number I need is presented as you can see from > the variable called text. Here is my code > I'm pretty sure my regex is correct, I think i

Re: escaping

2012-04-16 Thread Jon Clements
On Monday, 16 April 2012 11:03:31 UTC+1, Kiuhnm wrote: > On 4/16/2012 4:42, Steven D'Aprano wrote: > > On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote: > > > >> This is the behavior I need: > >> path = path.replace('\\', '') > >> msg = ". {} .. '{}' .. {} .".format(a, path, b) > >

Re: ordering with duck typing in 3.1

2012-04-09 Thread Jon Clements
On Monday, 9 April 2012 12:33:25 UTC+1, Neil Cerutti wrote: > On 2012-04-07, Jon Clements wrote: > > Any reason you can't derive from int instead of object? You may > > also want to check out functions.total_ordering on 2.7+ > > functools.total_ordering > > I w

ordering with duck typing in 3.1

2012-04-07 Thread Jon Clements
Any reason you can't derive from int instead of object? You may also want to check out functions.total_ordering on 2.7+ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Gotcha's?

2012-04-05 Thread Jon Clements
On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote: > Greetings, > > I'm going to give a "Python Gotcha's" talk at work. > If you have an interesting/common "Gotcha" (warts/dark corners ...) please > share. > > (Note that I want over http://wiki.python.org/moin/PythonWarts already). >

Re: Async IO Server with Blocking DB

2012-04-04 Thread Jon Clements
On Tuesday, 3 April 2012 23:13:24 UTC+1, looking for wrote: > Hi > > We are thinking about building a webservice server and considering > python event-driven servers i.e. Gevent/Tornado/ Twisted or some > combination thereof etc. > > We are having doubts about the db io part. Even with connectio

Re: help with subclassing problem

2012-04-02 Thread Jon Clements
On Thursday, 29 March 2012 21:23:20 UTC+1, Peter wrote: > I am attempting to subclass the date class from the datetime package. > Basically I want a subclass that can take the date as a string (in multiple > formats), parse the string and derive the year,month and day information to > create a

Re: Best way to structure data for efficient searching

2012-04-02 Thread Jon Clements
On Wednesday, 28 March 2012 19:39:54 UTC+1, larry@gmail.com wrote: > I have the following use case: > > I have a set of data that is contains 3 fields, K1, K2 and a > timestamp. There are duplicates in the data set, and they all have to > processed. > > Then I have another set of data with 4

Re: Fetching data from a HTML file

2012-03-23 Thread Jon Clements
On Friday, 23 March 2012 13:52:05 UTC, Sangeet wrote: > Hi, > > I've got to fetch data from the snippet below and have been trying to match > the digits in this to specifically to specific groups. But I can't seem to > figure how to go about stripping the tags! :( > > Sum class="green">24511 a

Re: Data mining/pattern recogniton software in Python?

2012-03-23 Thread Jon Clements
On Friday, 23 March 2012 16:43:40 UTC, Grzegorz Staniak wrote: > Hello, > > I've been asked by a colleague for help in a small educational > project, which would involve the recognition of patterns in a live > feed of data points (readings from a measuring appliance), and then > a more general

Re: Python is readable (OT)

2012-03-22 Thread Jon Clements
On Thursday, 22 March 2012 08:56:17 UTC, Steven D'Aprano wrote: > On Wed, 21 Mar 2012 18:35:16 -0700, Steve Howell wrote: > > > On Mar 21, 11:06 am, Nathan Rice > > wrote: [snip]. > > Different programming languages are good for different things because > they have been designed to work in dif

Re: urllib.urlretrieve never returns???

2012-03-19 Thread Jon Clements
On Monday, 19 March 2012 19:32:03 UTC, Laszlo Nagy wrote: > The pythonw.exe may not have the rights to access network resources. > >> Have you set a default timeout for sockets? > >> > >> import socket > >> socket.setdefaulttimeout(10) # 10 seconds > I have added pythonw.exe to allowed exceptions.

Re: Style question (Poll)

2012-03-15 Thread Jon Clements
On Wednesday, 14 March 2012 21:16:05 UTC, Terry Reedy wrote: > On 3/14/2012 4:49 PM, Arnaud Delobelle wrote: > > On 14 March 2012 20:37, Croepha wrote: > >> Which is preferred: > >> > >> for value in list: > >> if not value is another_value: > >> value.do_something() > >> break > > Do

Re: Global join function?

2012-03-14 Thread Jon Clements
On Wednesday, 14 March 2012 18:41:27 UTC, Darrel Grant wrote: > In the virtualenv example bootstrap code, a global join function is used. > > http://pypi.python.org/pypi/virtualenv > > subprocess.call([join(home_dir, 'bin', 'easy_install'), > 'BlogApplication']) > > >

Re: Jinja2 + jQuery tabs widget

2012-03-14 Thread Jon Clements
On Wednesday, 14 March 2012 14:16:35 UTC, JoeM wrote: > Hi All, > > I'm having issues including a {block} of content from Jinja2 > template into a jQueryUI tab. Does anyone know if such a thing is > possible? An example is below, which gives me a 500 error when loading > the page. > > Thank

Re: How to decide if a object is instancemethod?

2012-03-14 Thread Jon Clements
On Wednesday, 14 March 2012 13:28:58 UTC, Cosmia Luna wrote: > class Foo(object): > def bar(self): > return 'Something' > > func = Foo().bar > > if type(func) == : # This should be always true > pass # do something here > > What should type at ? > > Thanks > Cosmia import insp

Re: Fast file data retrieval?

2012-03-12 Thread Jon Clements
On Monday, 12 March 2012 20:31:35 UTC, MRAB wrote: > On 12/03/2012 19:39, Virgil Stokes wrote: > > I have a rather large ASCII file that is structured as follows > > > > header line > > 9 nonblank lines with alphanumeric data > > header line > > 9 nonblank lines with alphanumeric data > > ... > >

Re: Finding MIME type for a data stream

2012-03-08 Thread Jon Clements
On Thursday, 8 March 2012 23:40:13 UTC, Tobiah wrote: > > I have to assume you're talking python 2, since in python 3, strings > > cannot generally contain image data. In python 2, characters are pretty > > much interchangeable with bytes. > > Yeah, python 2 > > > > if you're looking for a s

Re: os.stat last accessed attribute updating last accessed value

2012-02-06 Thread Jon Clements
On Feb 4, 9:33 pm, Python_Junkie wrote: > I am trying to obtain the last accessed date.  About 50% of the files' > attributes were updated such that the file was last accessed when this > script touches the file. > I was not opening the files > > Anyone have a thought of why this happened. > > Pyt

Re: Constraints -//- first release -//- Flexible abstract class based validation for attributes, functions and code blocks

2012-01-27 Thread Jon Clements
On Jan 27, 6:38 am, Nathan Rice wrote: > > May I suggest a look at languages such as ATS and Epigram? They use > > types that constrain values specifically to prove things about your > > program. Haskell is a step, but as far as proving goes, it's less > > powerful than it could be. ATS allows you

Re: Find the mime type of a file.

2012-01-25 Thread Jon Clements
On Jan 25, 5:04 pm, Olive wrote: > I want to have a list of all the images in a directory. To do so I want > to have a function that find the mime type of a file. I have found > mimetypes.guess_type but it only works by examining the extension. In > GNU/Linux the "file" utility do much better by a

Re: Parsing a serial stream too slowly

2012-01-23 Thread Jon Clements
On Jan 23, 9:48 pm, "M.Pekala" wrote: > Hello, I am having some trouble with a serial stream on a project I am > working on. I have an external board that is attached to a set of > sensors. The board polls the sensors, filters them, formats the > values, and sends the formatted values over a seria

Re: can some one help me with my code. thanks

2012-01-20 Thread Jon Clements
On Jan 20, 9:26 pm, Terry Reedy wrote: > On 1/20/2012 2:46 PM, Terry Reedy wrote: > > > > > > > > > > > On 1/20/2012 1:49 PM, Tamanna Sultana wrote: > > >> can some one help me?? > >>> I would like to create a function that, given a bin, which is a list > >>> (example below), generates averages fo

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Jon Clements
On Nov 14, 5:03 pm, Tobias Oberstein wrote: > > > I need 50k sockets + 100 files. > > > > Thus, this is even more strange: the Python (a Twisted service) will > > > happily accept 50k sockets, but as soon as you do open() a file, it'll > > > bail out. > > > A limit of 32k smells like a overflow i

Re: my new project, is this the right way?

2011-11-14 Thread Jon Clements
On Nov 14, 10:41 am, Tracubik wrote: > Hi all, > i'm developing a new program. > Mission: learn a bit of database management > Idea: create a simple, 1 window program that show me a db of movies i've > seen with few (<10) fields (actors, name, year etc) > technologies i'll use: python + gtk > db:

Re: Get keys from a dicionary

2011-11-11 Thread Jon Clements
On Nov 11, 1:31 pm, macm wrote: > Hi Folks > > I pass a nested dictionary to a function. > > def Dicty( dict[k1][k2] ): >         print k1 >         print k2 > > There is a fast way (trick) to get k1 and k2 as string. > > Whithout loop all dict. Just it! > > Regards > > macm I've tried to underst

Re: simple file flow question with csv.reader

2011-11-02 Thread Jon Clements
On Nov 2, 11:50 pm, Terry Reedy wrote: > On 11/2/2011 7:06 PM, Dennis Lee Bieber wrote: > > > On Wed, 2 Nov 2011 14:13:34 -0700 (PDT), Matt > > declaimed the following in gmane.comp.python.general: > > >> I have a few hundred .csv files, and to each file, I want to > >> manipulate the data, then s

Re: understand program used to create file

2011-11-01 Thread Jon Clements
On Nov 1, 7:27 pm, pacopyc wrote: > Hi, I have about 1 files .doc and I want know the program used to > create them: writer? word? abiword? else? I'd like develop a script > python to do this. Is there a module to do it? Can you help me? > > Thanks My suggestion would be the same as DaveA's.

Re: Loop through a dict changing keys

2011-10-16 Thread Jon Clements
On Oct 16, 12:53 am, PoD wrote: > On Sat, 15 Oct 2011 11:00:17 -0700, Gnarlodious wrote: > > What is the best way (Python 3) to loop through dict keys, examine the > > string, change them if needed, and save the changes to the same dict? > > > So for input like this: > > {'Mobile': 'string', 'cont

Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith wrote: > I've got to write some tests in python which simulate getting a page of > HTML from an http server, finding a link, clicking on it, and then > examining the HTML on the next page to make sure it has certain features. > > I can use urllib to do the basic fetch

Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith wrote: > I've got to write some tests in python which simulate getting a page of > HTML from an http server, finding a link, clicking on it, and then > examining the HTML on the next page to make sure it has certain features. > > I can use urllib to do the basic fetch

Re: Reading a file into a data structure....

2011-10-13 Thread Jon Clements
On Oct 13, 10:59 pm, MrPink wrote: > This is a continuing to a post I made in > August:http://groups.google.com/group/comp.lang.python/browse_thread/thread/... > > I got some free time to work with Python again and have some followup > questions. > > For example, I have a list in a text file like

Re: Usefulness of the "not in" operator

2011-10-08 Thread Jon Clements
On Oct 8, 11:42 am, candide wrote: > Python provides > >      -- the not operator, meaning logical negation >      -- the in operator, meaning membership > > On the other hand, Python provides the not in operator meaning > non-membership. However, it seems we can reformulate any "not in" > express

Re: Simplest way to resize an image-like array

2011-09-30 Thread Jon Clements
On Sep 30, 5:40 pm, John Ladasky wrote: > Hi folks, > > I have 500 x 500 arrays of floats, representing 2D "grayscale" images, > that I need to resample at a lower spatial resolution, say, 120 x 120 > (details to follow, if you feel they are relevant). > > I've got the numpy, and scipy, and matplo

Re: Wrote a new library - Comments and suggestions please!

2011-09-27 Thread Jon Clements
On Sep 27, 6:33 pm, Steven D'Aprano wrote: > Robert Kern wrote: > > On 9/27/11 10:24 AM, Tal Einat wrote: > >> I don't work with SAS so I have no reason to invest any time developing > >> for it. > > >> Also, as far as I can tell, SAS is far from free or open-source, meaning > >> I definitely am n

Re: Wrote a new library - Comments and suggestions please!

2011-09-26 Thread Jon Clements
On Sep 26, 12:23 pm, Tal Einat wrote: > The library is called RunningCalcs and is useful for running several > calculations on a single iterable of values. > > https://bitbucket.org/taleinat/runningcalcs/http://pypi.python.org/pypi/RunningCalcs/ > > I'd like some input on how this could be made mo

Re: Need help with simple OOP Python question

2011-09-05 Thread Jon Clements
On Sep 5, 3:43 pm, Peter Otten <__pete...@web.de> wrote: > Kristofer Tengström wrote: > > Thanks everyone, moving the declaration to the class's __init__ method > > did the trick. Now there's just one little problem left. I'm trying to > > create a list that holds the parents for each instance in t

Re: How does this work?

2011-06-04 Thread Jon Clements
On Jun 5, 4:37 am, Ben Finney wrote: > writes: > > I was surfing around looking for a way to split a list into equal > > sections. I came upon this algorithm: > > > >>> f = lambda x, n, acc=[]: f(x[n:], n, acc+[(x[:n])]) if x else acc > > >>> f("Hallo Welt", 3) > > ['Hal', 'lo ', 'Wel', 't'] > >

Re: checking if a list is empty

2011-05-06 Thread Jon Clements
On May 7, 12:51 am, Ian Kelly wrote: > On Fri, May 6, 2011 at 4:21 PM, Philip Semanchuk wrote: > > What if it's not a list but a tuple or a numpy array? Often I just want to > > iterate through an element's items and I don't care if it's a list, set, > > etc. For instance, given this function d

Re: Finding empty columns. Is there a faster way?

2011-04-21 Thread Jon Clements
On Apr 21, 5:40 pm, nn wrote: > time head -100 myfile  >/dev/null > > real    0m4.57s > user    0m3.81s > sys     0m0.74s > > time ./repnullsalt.py '|' myfile > 0 1 Null columns: > 11, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 33, 45, 50, 68 > > real    1m28.94s > user    1m28.11s > sys     0m0.

Re: TextWrangler "run" command not working properly

2011-04-14 Thread Jon Clements
On Apr 14, 9:52 pm, Fabio wrote: > Hi to all, > I have troubles with TextWrangler "run" command in the "shebang" (#!) > menu. > I am on MacOSX 10.6.7. > I have the "built-in" Python2.5 which comes installed by "mother Apple". > Then I installed Python2.6, and left 2.5 untouched (I was suggested to

Re: pattern matching

2011-02-24 Thread Jon Clements
On Feb 24, 2:11 am, monkeys paw wrote: > if I have a string such as '01/12/2011' and i want > to reformat it as '20110112', how do i pull out the components > of the string and reformat them into a DDMM format? > > I have: > > import re > > test = re.compile('\d\d\/') > f = open('test.html')  

Re: For loop comprehensions

2011-02-11 Thread Jon Clements
On Feb 11, 11:10 pm, Benjamin S Wolf wrote: > It occurred to me as I was writing a for loop that I would like to > write it in generator comprehension syntax, eg. > >   for a in b if c: > > rather than using one of the more verbose but allowable syntaxes: > >   for a in (x for x in b if c): > >  

Re: Arrays/List, filters, Pytho, Ruby

2011-02-11 Thread Jon Clements
On Feb 11, 9:24 pm, "LL.Snark" wrote: > Hi, > > I'm looking for a pythonic way to translate this short Ruby code : > t=[6,7,8,6,7,9,8,4,3,6,7] > i=t.index {|x| x > If you don't know Ruby, the second line means : > What is the index, in array t, of the first element x such that x > If can write it

Re: Converting getCSS Count Code from java to python

2011-02-02 Thread Jon Clements
On Feb 1, 4:23 am, SMERSH009 wrote: > Hi, I'd love some help converting this code to the python equivalent: > > private int getCSSCount(String aCSSLocator){ >     String jsScript = "var cssMatches = eval_css(\"%s\", > window.document);cssMatches.length;"; >     return Integer.parseInt(selenium.get

Re: how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread Jon Clements
On Jan 24, 7:44 pm, dmaziuk wrote: > Hi everyone, > > I've wrapper class around some sql statements and I'm trying to add a > method that does: >   if my_cursor is a sqlite cursor, then run "select > last_insert_rowid()" >   else if it's a psycopg2 cursor, then run "select > currval( 'my_sequence'

Re: statement level resumable exception

2011-01-21 Thread Jon Clements
On Jan 21, 8:41 am, ilejn wrote: > Arnaud, > > it looks like a solution. > Perhaps it is better than plain try/accept and than proxy class with > __getattr__. > It is not for free, e.g. because syntax check such as parentheses > matching is lazy too, though looks > very interesting. > > Thanks a l

Re: Developing a program to make a family tree.

2011-01-14 Thread Jon Clements
On Jan 14, 7:39 pm, Ata Jafari wrote: > Hi there. > I'm trying to develop a program like family tree maker. I have all > information, so there is no need to search on the net. This must be > something like trees. Can someone help me? I'm at the beginning. > Thanks. > > -- > Ata J. Tabrizi > atae.t

Re: Career path - where next?

2011-01-12 Thread Jon Clements
On Jan 12, 4:37 pm, Alan Harris-Reid wrote: > Hi there, I wonder if any Python folk out there can help me. > > For many years I was a contractor developing desktop and web > applications using Visual Foxpro as my main language, with Foxpro, > SQL-server and Oracle as back-end databases.  Unfortuna

Re: Building sys.path at run-time?

2010-12-30 Thread Jon Clements
On Dec 30, 4:24 am, Roy Smith wrote: > In article <87k4irhpoa@benfinney.id.au>, >  Ben Finney wrote: > > > Roy Smith writes: > > > > I've got a problem that I'm sure many people have solved many times. > > > > Our project has a bunch of python scripts > > > A very common problem. The solutio

Re: Partition Recursive

2010-12-23 Thread Jon Clements
On Dec 23, 5:26 pm, macm wrote: > Hi Folks > > I have this: > > url = 'http://docs.python.org/dev/library/stdtypes.html? > highlight=partition#str.partition' > > So I want convert to > > myList = > ['http',':','//','docs','.','python','.','org','/','dev','/','library','/','stdtypes','.','html','?'

Re: Hosting a Python based TCP server

2010-12-23 Thread Jon Clements
On Dec 23, 12:01 pm, Oltmans wrote: > Hi all, > > I'm writing a very small TCP server(written in Python) and now I want > to host it on some ISP so that it can be accessed anywhere from the > Internet. I've never done that before so I thought I should ask for > some advice. Do you guys know any go

Re: help with link parsing?

2010-12-22 Thread Jon Clements
On Dec 22, 4:24 pm, "Colin J. Williams" wrote: > On 21-Dec-10 12:22 PM, Jon Clements wrote: > > > import lxml > > from urlparse import urlsplit > > > doc = lxml.html.parse('http://www.google.com') > > print map(urlsplit, doc.xpath(&

Specialisation / Interests

2010-12-21 Thread Jon Clements
Hi all, Was thinking tonight (now this morning my time): What would we consider the "long time" posters on c.l.p consider what they respond to and offer serious advice on. For instance: - Raymond Hettinger for algo's in collections and itertools - MRAB for regex's (never seen him duck a post whe

Re: Scanning directories for new files?

2010-12-21 Thread Jon Clements
On Dec 21, 7:17 pm, Matty Sarro wrote: > Hey everyone. > I'm in the midst of writing a parser to clean up incoming files, > remove extra data that isn't needed, normalize some values, etc. The > base files will be uploaded via FTP. > How does one go about scanning a directory for new files? For no

Re: help with link parsing?

2010-12-21 Thread Jon Clements
On Dec 20, 7:14 pm, "Littlefield, Tyler" wrote: > Hello all, > I have a question. I guess this worked pre 2.6; I don't remember the > last time I used it, but it was a while ago, and now it's failing. > Anyone mind looking at it and telling me what's going wrong? Also, is > there a quick way to ma

Re: Modifying an existing excel spreadsheet

2010-12-21 Thread Jon Clements
On Dec 20, 9:56 pm, Ed Keith wrote: > I have a user supplied 'template' Excel spreadsheet. I need to create a new > excel spreadsheet based on the supplied template, with data filled in. > > I found the tools > herehttp://www.python-excel.org/, andhttp://sourceforge.net/projects/pyexcelerator/.

Re: Case Sensitive Section names configparser

2010-12-08 Thread Jon Clements
On Dec 8, 10:32 am, RedBaron wrote: > Is there any way by which configParser's get() function can be made > case insensitive? I would probably subclass dict to create a string specific, case insensitive version, and supply it as the dict_type. See http://docs.python.org/library/configparser.html#

Re: Packages at Python.org

2010-12-01 Thread Jon Clements
On Dec 1, 10:32 pm, Ethan Furman wrote: > kirby.ur...@gmail.com wrote: > > > With Microsoft abandoning Visual FoxPro come 2015, we have 100K > > developers > > jumping ship (rough guess), perhaps to dot NET, but not necessarily.** > > > This page is potentially getting a lot of hits (I'm not privy

Re: Packages at Python.org

2010-12-01 Thread Jon Clements
On Dec 1, 8:56 pm, "kirby.ur...@gmail.com" wrote: > >http://packages.python.org/dbf/ > > > So how *do* you get source code from such a web place?  I'm not > > finding > > a tar ball or installer.  Sorry if I'm missing something obvious, like > > a link > > to Sourceforge. > > Thanks to very quick

Re: Login using usrllib2

2010-12-01 Thread Jon Clements
On Dec 1, 10:16 am, Chris Rebert wrote: > On Wed, Dec 1, 2010 at 1:53 AM,   wrote: > > Hi All, > > > I'm using urllib2 module to login to an https server. However I'm unable to > > login as the password is not getting accepted. > > > Here is the code: > > > import urllib2, urllib > > values={'User

Re: Parsing markup.

2010-11-26 Thread Jon Clements
On Nov 26, 4:03 am, MRAB wrote: > On 26/11/2010 03:28, Joe Goldthwaite wrote: >  > I’m attempting to parse some basic tagged markup.  The output of the >  > TinyMCE editor returns a string that looks something like this; >  > >  > This is a paragraph with bold and italic elements in >  > itIt can

Re: memory management - avoid swapping/paging

2010-10-22 Thread Jon Clements
On 21 Oct, 16:45, Nobody wrote: > On Thu, 21 Oct 2010 02:34:15 -0700, Jon Clements wrote: > > I'm after something that says: "I want 512mb of physical RAM, I don't > > want you to page/swap it, if you can't do that, don't bother at all". > >

memory management - avoid swapping/paging

2010-10-21 Thread Jon Clements
Hi all, Is there a cross-platform way using Python to guarantee that an object will never be swapped/paged to disk? I'll be honest and say I'm really not sure if this is a particular language question or rather specific to an OS. Under linux it appears I could create a ramfs and mmap a file under

Re: Reading Outlook .msg file using Python

2010-10-21 Thread Jon Clements
On 20 Oct, 18:13, John Henry wrote: > On Oct 20, 9:01 am, John Henry wrote: > > > > > On Oct 20, 1:41 am, Tim Golden wrote: > > > > On 19/10/2010 22:48, John Henry wrote: > > > > > Looks like this flag is valid only if you are getting messages > > > > directly from Outlook.  When reading the msg

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-13 Thread Jon Clements
On 12 Oct, 20:21, "J. Gerlach" wrote: > Am 12.10.2010 17:10, schrieb Roy Smith: > > > [A]re there any plans to update the api to allow an iterable instead of > > a sequence? > > sqlite3 (standard library, python 2.6.6., Windows 32Bit) does that already:: > > import sqlite3 as sql > > connection =

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-12 Thread Jon Clements
On 12 Oct, 18:53, Jon Clements wrote: > On 12 Oct, 18:32, Roy Smith wrote: > > > > > On Oct 12, 1:20 pm, Jon Clements wrote: > > > > On 12 Oct, 16:10, Roy Smith wrote: > > > > > PEP 249 says about executemany(): > > > > >    

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-12 Thread Jon Clements
On 12 Oct, 18:32, Roy Smith wrote: > On Oct 12, 1:20 pm, Jon Clements wrote: > > > On 12 Oct, 16:10, Roy Smith wrote: > > > > PEP 249 says about executemany(): > > > >         Prepare a database operation (query or command) and then > > >        

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-12 Thread Jon Clements
On 12 Oct, 16:10, Roy Smith wrote: > PEP 249 says about executemany(): > >         Prepare a database operation (query or command) and then >         execute it against all parameter sequences or mappings >         found in the sequence seq_of_parameters. > > are there any plans to update the api

Re: re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread Jon Clements
On 17 Sep, 19:59, Peter Otten <__pete...@web.de> wrote: > Jon Clements wrote: > > (I reckon this is probably a question for MRAB and is not really > > Python specific, but anyhow...) > > > Absolutely basic example: re.sub(r'(\d+)', r'\1', '

re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread Jon Clements
Hi All, (I reckon this is probably a question for MRAB and is not really Python specific, but anyhow...) Absolutely basic example: re.sub(r'(\d+)', r'\1', 'string1') I've been searching around and I'm sure it'll be obvious when it's pointed out, but how do I use the above to replace 1 with 11? O

Re: palindrome iteration

2010-08-28 Thread Jon Clements
On Aug 28, 11:55 am, Steven D'Aprano wrote: > On Sat, 28 Aug 2010 09:22:13 +0300, Jussi Piitulainen wrote: > > Terry Reedy writes: > >> On 8/27/2010 3:43 PM, Jussi Piitulainen wrote: > >> > Dave Angel writes: [snip] > Not everything needs to be a built-in method. There is already a standard > way

Re: Using String Methods In Jump Tables

2010-08-23 Thread Jon Clements
On 23 Aug, 16:57, Tim Daneliuk wrote: > On 8/23/2010 10:35 AM, Jon Clements wrote: > > > > > On 20 Aug, 01:51, Tim Daneliuk wrote: > >> On 8/19/2010 7:23 PM, Steven D'Aprano wrote: > > >>> On Thu, 19 Aug 2010 18:27:11 -0500, Tim Daneliuk wrote: &

Re: Using String Methods In Jump Tables

2010-08-23 Thread Jon Clements
On 20 Aug, 01:51, Tim Daneliuk wrote: > On 8/19/2010 7:23 PM, Steven D'Aprano wrote: > > > On Thu, 19 Aug 2010 18:27:11 -0500, Tim Daneliuk wrote: > > >> Problem: > > >>   Given tuples in the form (key, string), use 'key' to determine what > >>   string method to apply to the string: > > tabl

Re: new to python - trouble calling a function from another function

2010-08-06 Thread Jon Clements
On 5 Aug, 16:15, Brandon McCombs wrote: > Jon Clements wrote: > > On 5 Aug, 08:25, Brandon McCombs wrote: > >> Hello, > > >> I'm building an elevator simulator for a class assignment. I recently > >> ran into a roadblock and don't know how

Re: new to python - trouble calling a function from another function

2010-08-05 Thread Jon Clements
On 5 Aug, 08:25, Brandon McCombs wrote: > Hello, > > I'm building an elevator simulator for a class assignment. I recently > ran into a roadblock and don't know how to fix it. For some reason, in > my checkQueue function below, the call to self.goUp() is never executed. > It is on the last line of

Re: parsing a c project

2010-08-04 Thread Jon Clements
On 4 Aug, 12:33, Aitor Garcia wrote: > Hi, > > I need to know the memory locations of all variables in a C project including > variables allocated inside structs. Pray tell us why? > > What I want to do in to expand the structs into its basic elements (floats, > int16 and int8). > > In a  header

Re: let optionparse.Optionparser ignore unknown command line switches.

2010-08-01 Thread Jon Clements
On 1 Aug, 16:43, News123 wrote: > On 08/01/2010 05:34 PM, Steven W. Orr wrote: > > > > > On 08/01/10 07:27, quoth News123: > >> On 08/01/2010 01:08 PM, News123 wrote: > >>> I wondered, whether there's a simple/standard way to let > >>> the Optionparser just ignore unknown command line switches. >

Re: catching my own exception

2010-06-18 Thread Jon Clements
On 18 June, 18:08, nick wrote: > I have a problem with catching my own exception. Here is the > code:http://fly.srk.fer.hr/~nick/travapi/blame.php?repname=Travian+API&pat... > > Line 252 calls a method, which on line 207 raises a > SomethingBeingBuiltError exception. On line 253 I catch that > ex

Re: The inverse of .join

2010-06-18 Thread Jon Clements
On 17 June, 21:03, Neil Cerutti wrote: > On 2010-06-17, Robert Kern wrote: > > > On 6/17/10 2:08 PM, Neil Cerutti wrote: > >> On 2010-06-17, Ian Kelly  wrote: > >>> On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti > >>>  wrote: > What's the best way to do the inverse operation of the .join >

Re: regarding the dimensions in gui

2010-06-10 Thread Jon Clements
On 10 June, 10:40, Jean-Michel Pichavant wrote: > Chris Rebert wrote: > > On Thu, Jun 10, 2010 at 1:27 AM, Andreas Waldenburger > > wrote: > > >> On Thu, 10 Jun 2010 08:37:21 +0100 Simon Brunning > >> wrote: > > >>> On 10 June 2010 08:19, Shashwat Anand > >>> wrote: > > And please stop usi

  1   2   3   >