Re: To thread or not to thread

2005-07-30 Thread snacktime
On 28 Jul 2005 12:10:12 -0700, Sidd <[EMAIL PROTECTED]> wrote: > Hello, > I was recently reading an article on threading in python and I > came across Global Interpreter Lock,now as a novince in python I was > cusrious about > > 1.Is writing a threaded code in python going to perform well th

python2.4 generator expression > python2.3 list expression

2005-02-20 Thread snacktime
I need to convert a generator expression to a list expression so it will work under python 2.3. I rewrote this: for c in range(128): even_odd = (sum(bool(c & 1

Re: regular expression question

2005-02-14 Thread snacktime
> You may want something like: > if re.search('%s(.*)%s' % (STX, ETX), data): > Ah I didn't even think about that... Chris -- http://mail.python.org/mailman/listinfo/python-list

regular expression question

2005-02-14 Thread snacktime
The primary question is how do I perform a match when the regular expression contains string variables? For example, in the following code I want to match a line that starts with STX, then has any number of characters, then ends with STX. Example 2 I'm pretty sure works as I expect, but I'm not su

Freebsd thread/signal problem

2005-02-09 Thread snacktime
I have a client/server application written in python/twisted and on freebsd the server won't shut down correctly with SIGINT or SIGTERM, instead requiring a SIGKILL. The twist is that if I send the server a signal, it will shut down on the next request from the client. In that case it shuts down

Re: Problems with python and threads under Freebsd

2005-02-07 Thread snacktime
After debugging this some more I narrowed it down to an encryption function in pycrypto that is triggering the segfault. I posted a bug report. Don't really know enough about threading to know whether it's a python bug or a pycrypto bug, but I'll let someone else sort that out now.. Chris -- ht

Re: Problems with python and threads under Freebsd

2005-02-07 Thread snacktime
This is a followup with some more information. The program is written in twisted and I posted this to twisted-python also. The freebsd list wants a more detailed backtrace, which even with python compiled with OPT -g and --with-pydebug isn't happening for some reason. The script below calls a bl

Problems with python and threads under Freebsd

2005-02-07 Thread snacktime
I posted this to freebsd-questions, but though I would put it here also in case anyone has any ideas. I am consistantly getting seg faults and bus errors when running a multi threaded python application under 5.3-release-p2. Python was built from the port(python 2.4) with threading enabled. Rebu

Re: Python versus Perl ?

2005-02-06 Thread snacktime
I just recently picked up Python after using perl almost exclusively for the last 8 years, and the above mentioned article by Eric Raymond echos my feelings almost exactly. The one drawback coming from the perl world is that you don't have as many options when it comes stuff like application frame

Re: bytecode obfuscation

2005-02-03 Thread snacktime
On Thu, 3 Feb 2005 17:28:50 -0500, Daniel Bickett <[EMAIL PROTECTED]> wrote: > snacktime wrote: > > How difficult is it to turn python bytecode into it's original source? > > Is it that much different than java (this is what they will probably > > compare it t

Re: bytecode obfuscation

2005-02-03 Thread snacktime
> > > Everything except the libraries that actually connect to the > > bank networks would be open source, and those libraries aren't > > something that you would even want to touch anyways. > > This sounds suspicious to me. Really. Normal payment clearance programs > have open-spec API's. > I

bytecode obfuscation

2005-02-03 Thread snacktime
I am attempting to put together and open source project, but some of the libraries cannot be open source due to non disclosure agreements. The non disclosures specifically specify that the implementation of their api's can only be distributed as object code. I might be able to get them to agree t

Re: XOR on string

2005-01-26 Thread snacktime
> lrc == Linear Redundancy Check? or Longitudinal? Note that > such terms are not precisely defined... generally just acronyms > people make up and stick in their user manuals for stuff. :-) > Longitudinal > import operator > lrc = reduce(operator.xor, [ord(c) for c in string]) That's better t

Re: Set parity of a string

2005-01-26 Thread snacktime
Argh, never mind my mistake. I wasn't logging the data correctly the parity conversion works fine. Chris -- http://mail.python.org/mailman/listinfo/python-list

XOR on string

2005-01-26 Thread snacktime
I need to calculate the lrc of a string using an exclusive or on each byte in the string. How would I do this in python? Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Set parity of a string

2005-01-26 Thread snacktime
Correction on this, ETX is ok, it seems to be just STX with the data I am using. Chris On Wed, 26 Jan 2005 11:50:46 -0800, snacktime <[EMAIL PROTECTED]> wrote: > I'm trying to figure out why the following code transforms ascii STX > (control-b) into "\x82". The

Re: Set parity of a string

2005-01-26 Thread snacktime
I'm trying to figure out why the following code transforms ascii STX (control-b) into "\x82". The perl module I use returns a value of "^B", and that is also what the application I am communicating with expects to see. Some ascii characters such as FS and GS come through fine, but STX and ETX get

alternatives to mod python

2005-01-25 Thread snacktime
I'm looking for a simple async ssl http server that can accept http POST requests. Performance is an issue, which is why I'm currently using mod python. I don't really want to require installing apache and mod python though if I can help it, since this is software that will be distributed to end

Re: Quoting sql queries with the DB-API

2005-01-23 Thread snacktime
> > Also, is this a good way to use variables in an insert/update > > statement, or is there a better way? > > > > sql = "insert into test(a,b) values('%s','%s')" % (a,b) > > cursor.execute(sql) > > If you do it like this: > > sql = "INSERT INTO test(a, b) VALUES(%s, %s)" # no quotes around the %

Re: Set parity of a string

2005-01-23 Thread snacktime
On Sun, 23 Jan 2005 21:00:25 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > Peter Hansen wrote: > > snacktime wrote: > >> Is there a module that sets the parity of a string? > > > > As to the specific question: a module is not really required. > > Bu

Quoting sql queries with the DB-API

2005-01-23 Thread snacktime
I'm used to using the perl DBI and not very familiar with the python DB-API. I am using PyGreSQL. My question is what is the standard way to quote strings in sql queries? I didn't see any quoting functions in the DB-API docs. Is quoting handled internally by the PyGreSQL module? Also, is this

Re: Set parity of a string

2005-01-23 Thread snacktime
On Sun, 23 Jan 2005 23:52:29 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > "snacktime" wrote: > > > Is there a module that sets the parity of a string? I have an > > application that needs to communicate with a host using even parity > > So what I nee

Set parity of a string

2005-01-23 Thread snacktime
Is there a module that sets the parity of a string? I have an application that needs to communicate with a host using even parity So what I need is before sending the message, convert it from space to even parity. And when I get the response I need to convert that from even to space parity. The