Re: Dumping all the sql statements as backup

2012-07-25 Thread Jack
On 07/25/2012 09:56 AM, andrea crotti wrote:
> I have some long running processes that do very long simulations which
> at the end need to write things on a database.
>
> At the moment sometimes there are network problems and we end up with
> half the data on the database.
>
> The half-data problem is probably solved easily with sessions and
> sqlalchemy (a db-transaction), but still we would like to be able to
> keep a backup SQL file in case something goes badly wrong and we want to
> re-run it manually..
>
> This might also be useful if we have to rollback the db for some reasons
> to a previous day and we don't want to re-run the simulations..
>
> Anyone did something similar?
> It would be nice to do something like:
>
> with CachedDatabase('backup.sql'):
> # do all your things
>   
Since you know the content of what the sql code is, why not just build
the sql file(s) needed and store them so that in case of a burp you can
just execute the code file. If you don't know the exact sql code, dump
it to a file as the statements are constructed... The only problem you
would run into in this scenario is duplicate data, which is also easily
solvable by using transaction-level commits to the db.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pythonic way

2012-11-02 Thread jack
Sometimes, I need to alter the element as traverse a list like this 
(it's a sample):

c = range(10)
i = 0
for ele in c:
# do something
# branch:
c[i] = # value
i += 1

How to be pythonic?

 2012/11/2 0:54, Zero Piraeus :

:

On 1 November 2012 11:32, inshu chauhan  wrote:

  what is the most pythonic way to do this :

if 0 < ix < 10 and 0 < iy < 10 ???

As everyone else has said, it's perfectly pythonic once you stick the
colon on the end. You might find it more instantly readable with some
extra parentheses:

 if (0 < ix < 10) and (0 < iy < 10):
 # do something

... but that's really just down to taste.

  -[]z.


--
http://mail.python.org/mailman/listinfo/python-list


Re: pythonic way

2012-11-02 Thread jack

thanks,but I don't think enumerate() is my want
Have some ways to operate the reference of element,not a copy when I 
tried to traverse a list?


I'm so sorry about my poor English, hope you don't mind it.

On 2012/11/2 15:56, Chris Angelico wrote:

On Fri, Nov 2, 2012 at 6:14 PM, jack  wrote:

Sometimes, I need to alter the element as traverse a list like this (it's a
sample):
 c = range(10)
 i = 0
 for ele in c:
 # do something
 # branch:
 c[i] = # value
 i += 1

How to be pythonic?

Check out the enumerate() function.

ChrisA


--
http://mail.python.org/mailman/listinfo/python-list


How to specify a field name dynamically

2012-11-06 Thread jack

I have three tables:
table1
|———|
|  id  |  f1   |
|———|

table2
|———|
|  id  |  f2   |
|———|

table3
|———|
|  id  |  f3   |
|———|


I want define a function to insert records to someone,but I don't know 
how to specify a field name dynamically.

I had a try like this

/def insert_record(table, field, goods)://
//return db.insert(table, field=goods//)/
or
/def insert_record(table, **kv)://
//return db.insert(table, **kv)/

but it does not works
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to specify a field name dynamically

2012-11-06 Thread jack

On 2012/11/7 11:36, Dave Angel wrote:

On 11/06/2012 10:14 PM, jack wrote:

I have three tables:

What's a table? I'll assume you're using Python, but what version, and
what extra libraries do you have installed ? At least show your import
statements, so we might have a chance at guessing. I'll assume the db
stands for database, but what database, or what library??? if it really
is a database question, and you specify what library you're using, then
maybe somebody who uses that will jump in.
yeah, I'm sorry for that I didn't offer enough information about my 
question.

table1
|———|
| id | f1 |
|———|

table2
|———|
| id | f2 |
|———|

table3
|———|
| id | f3 |
|———|


I want define a function to insert records to someone,but I don't know
how to specify a field name dynamically.
I had a try like this

/ def insert_record(table, field, goods)://
// return db.insert(table, field=goods//)/
or
/ def insert_record(table, **kv)://
// return db.insert(table, **kv)/

but it does not works


That's not much of a clue. Do you mean you get an exception? If so,
paste it into a message, the full traceback. Or you mean it returns the
wrong data? Or it crashes your OS?

My first guess would be that those slashes are causing syntax errors.
But if that's a bug in your OS's copy/paste, then I'd say you have
indentation problems. Or maybe these are not just functions, but methods
inside a class. And in that case, I might guess that you're missing the
self argument, and therefore getting an exception of wrong number of
arguments.


# I want to insert something to a database using web.py-0.37 & mysql.
/import web//
//db = web.database(dbn='mysql', user='username', passwd='password', 
db='test'//)/


# I found the tables I created have  similar structure,so I wanted 
define one function to serve all tables
/  create table if not exists table1(id integer auto_increment primary 
key, num integer, table1_cxt text);//
//create table if not exists table2(id integer auto_increment 
primary key, num integer, table2_cxt text);//
//create table if not exists table3(id integer auto_increment 
primary key, num integer, table3_cxt text);/


# I known that:
/def insert_record(num=None, table1_cxt=None)://
//db.insert('table1', num=num, table1_cxt=table1_cxt ) /

so I think have some way to pass args instead of the hard code('table1', 
table1_cxt).

///def insert_record(table, num, field, goods): //
return db.insert(table, num=num, field=goods)/
this is my way.I do a experiment:
///>>> def func(arg1 = 'None', arg2 = 'None')://
//... print arg1//
//... print arg2//
//...//
//>>> def func1(a1, a2, v1, v2)://
//... func(a1=v1, a2=v2)//
//...
//>>> func1('arg1', 'arg2', 3, 4)//
//Traceback (most recent call last)://
//  File "", line 1, in //
//  File "", line 2, in func1//
//TypeError: func() got an unexpected keyword argument 'a1'
/obviously, it's wrong.
**kv works for me:
/>>> def func1(**kv)://
//... func(**kv)//
>>> func1(arg1='123', arg2='456')//
//123//
//456/

Maybe it's right, so I should change before saying
-- 
http://mail.python.org/mailman/listinfo/python-list


Does python(django) have an official database driver to access SQLFire?

2012-01-28 Thread Jack
Does python(django) have an official database driver to access
SQLFire? Or is there any roadmap to deliver an official database
driver?

Anyone know about this?
-- 
http://mail.python.org/mailman/listinfo/python-list


Why __slots__ slows down attribute access?

2011-08-23 Thread Jack
People have illusion that it is faster to visit the attribute defined
by __slots__ .
http://groups.google.com/group/comp.lang.python/msg/c4e413c3d86d80be

That is wrong. The following tests show it is slower.
__slots__ are implemented at the class level by creating descriptors
(Implementing Descriptors) for each variable name. It makes a little
bit slower.

So __slots__ just saves memory space by preventing creation of
__dict__ and __weakref__ on each instance, while sacrifice performance
and inheritance flexibility.
http://groups.google.com/group/comp.lang.python/msg/6623e8b94b6d6934


D:\>d:\python-v3.1.2\python  -mtimeit -s "class A(object): __slots__ =
('a', 'b', 'c')" -s "inst = A()" "inst.a=5; inst.b=6; inst.c=7"
100 loops, best of 3: 0.237 usec per loop

D:\>d:\python-v3.1.2\python  -mtimeit -s "class A(object): pass" -s
"inst = A()" "inst.a=5 inst.b=6; inst.c=7"
100 loops, best of 3: 0.214 usec per loop

D:\>d:\python-v2.6.4\python  -mtimeit -s "class A(object): __slots__ =
('a', 'b', 'c')" -s "inst = A()" "inst.a=5; inst.b=6; inst.c=7"
100 loops, best of 3: 0.26 usec per loop

D:\>d:\python-v2.6.4\python  -mtimeit -s "class A(object): pass" -s
"inst = A()" "inst.a=5; inst.b=6; inst.c=7"
100 loops, best of 3: 0.217 usec per loop
-- 
http://mail.python.org/mailman/listinfo/python-list


Zope - Restrict Acquisition Question

2005-03-02 Thread Jack
I have the following requirement for Zope:
I need to use Zope as a web cloning tool.

The directory structure is as follows:
->>Core Folder
->>Client 1
->>Client 2
...
->>Client n

1] Client 1 and Client 2 need to acquire from the Core Folder.
2] Client 2 must not acquire from Client 1.
3] Client 1 must not acquire from Client 2.

Note: I know that creating a Zope object named Client 2 and putting it
into Client 1's folder will work but there will be about 50+ clients.
So that would require 50+ objects in each client folder.

There's got to be a better way ... Any Ideas?

Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: In pyqt, some signals seems not work well

2013-08-04 Thread Jack

On 2013/8/5 2:20, Vincent Vande Vyvre wrote:

Le 04/08/2013 18:06, Jacknaruto a écrit :

Hi, Guys!

I created a thread class based QThread, and defined some signals to 
update UI through main thread.


the UI used a stackedWidget,someone page named 'progressPage' have a 
progressBar and a Label, the next page named 'resultsPage' shows 
results(some Labels).


When the window showed progressPage, my code that updates progressBar 
was well, but the updating resultsPage's labels signals seems ignored 
by main thread.(I guess, because I added some prints in the slot, it 
wasn't printed)


the code like this:

 1. class worker(QtCore.QThread):
 2. sig_jump_finish_page = QtCore.pyqtSignal()
 3. sig_set_label_text = QtCore.pyqtSignal(str, str)
 4. sig_set_progress_value = QtCore.pyqtSignal(int)
5.

 6. for dirpath, dirnames, filenames in os.walk(self.root):
 7. for filename in filenames:
 8. self.sig_set_label_text.emit('current', self.current()) # work well
 9. # so something
10.

11. #self.dialog.set_found(str(self.found())) # work well
12. #self.dialog.set_all(str(self.total())) # work well
13. self.sig_set_label_text.emit('found', str(self.found())) # :(
14. self.sig_set_label_text.emit('all', str(self.total())) # :(
15.

16. self.sig_jump_finish_page.emit()


So I have to update UI directly in the thread(comments Line 11-12 
shows), it looks work well.


I found the difference between line 8 and line 13-14 is line 8 
manipulates current page -progressPage, line 13-14 manipulates next 
page -resultsPage.


Is some wrongs in there?






Have a look at my comments:

class worker(QtCore.QThread):
sig_jump_finish_page = QtCore.pyqtSignal()
sig_set_label_text = QtCore.pyqtSignal(str, str)
sig_set_progress_value = QtCore.pyqtSignal(int)


I'm sorry.
In run() function the code below
for dirpath, dirnames, filenames in os.walk(self.root): # What is 
'self' here ?
self is current object, isn't it? self.root is a path which the 
user will specify.

for filename in filenames:
self.sig_set_label_text.emit('current', self.current()) # where is 
'current' ?

# so something
self.current() is a getter, it just returns a member that shows the 
path of the current work.


#self.dialog.set_found(str(self.found())) # What is self, and dialog, 
and found ?

the main thread is a dialog object.
self.dialog was assigned the dialog object in the __init__ of 
worker class.
self.found() is a getter also, it returns the number of meeting the 
conditions. self.total() means like this.

#self.dialog.set_all(str(self.total())) # ...
self.sig_set_label_text.emit('found', str(self.found())) # again ?
self.sig_set_label_text.emit('all', str(self.total())) # etc

self.sig_jump_finish_page.emit()


dialog.set_all() and so on just sets the widget's text.

My English is poor, I hopeyou will excuse me.

--
http://mail.python.org/mailman/listinfo/python-list


My script use paramiko module, it will be blocked at compute_hmac

2013-02-22 Thread Jack
Hello
one problem, thanks for help

My script like this:
/hostname = xxx//
//username = xxx//
//password = xxx//
//t = paramiko.Transport((hostname, 22))//
//t.connect(username=username, password=password)//# here will be blocked
//sftp = paramiko.SFTPClient.from_transport(t)/

I used gdb attach the python process, found that:
/(gdb) py-bt
#2 
#4 file '/usr/lib64/python2.6/threading.py', in 'wait'
#8 file '/usr/lib64/python2.6/threading.py', in 'wait'
#12 file
'/usr/lib/python2.6/site-packages/paramiko-1.9.0-py2.6.egg/paramiko/auth_handler.py',
in 'wait_for_response'
#15 file
'/usr/lib/python2.6/site-packages/paramiko-1.9.0-py2.6.egg/paramiko/transport.py',
in 'auth_password'
#19 file
'/usr/lib/python2.6/site-packages/paramiko-1.9.0-py2.6.egg/paramiko/transport.py',
in 'connect'
#23 file 'plugins.py', in ''
#35 file '', in ''
(gdb) info threads
2 Thread 0x7fe956708700 (LWP 25635) 0x003806e0d720 in sem_wait ()
from /lib64/libpthread.so.0
* 1 Thread 0x7fe96163b700 (LWP 25615) 0x0038066e0d03 in select ()
from /lib64/libc.so.6
(gdb) thread 2
[Switching to thread 2 (Thread 0x7fe956708700 (LWP 25635))]#0
0x003806e0d720 in sem_wait () from /lib64/libpthread.so.0
(gdb) py-bt
#1 Waiting for a lock (e.g. GIL)
#7 file
'/usr/lib/python2.6/site-packages/paramiko-1.9.0-py2.6.egg/paramiko/packet.py',
in 'compute_hmac'
#10 file
'/usr/lib/python2.6/site-packages/paramiko-1.9.0-py2.6.egg/paramiko/packet.py',
in 'read_message'
#13 file
'/usr/lib/python2.6/site-packages/paramiko-1.9.0-py2.6.egg/paramiko/transport.py',
in 'run'
#16 file '/usr/lib64/python2.6/threading.py', in '__bootstrap_inner'
#19 file '/usr/lib64/python2.6/threading.py', in '__bootstrap'
/
*but it is strange that when I use python interactive shell, the code
works well*

Regards,
Jack
-- 
http://mail.python.org/mailman/listinfo/python-list


How to delete a Python package

2006-07-12 Thread Jack
Installing a Python package is easy, most of time just
"Setup.py install" However, setup.py doesn't seem to support
an uninstall command. If I want to delete a package that I
do not use any more, should I just manually delete the
corresponding sub directory under Lib\site-packages? 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to delete a Python package

2006-07-12 Thread Jack
I'd second Skip's point. Now that setup.py does install, and it knows what 
to
uninstall (because it copied the files in the first place) I think it's a 
good idea
to have "setup.py uninstall" support. :)

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
>Nick> Uninstall support is hard, you would turn distutils (setup.py)
>Nick> into a package management system, but wait...!  there are already
>Nick> package managers that do exactly that (rpm, deb, Windows
>Nick> Installer).
>
> Note that I don't really care about uninstall support, certainly not 
> enough
> to go through the pain of editing distutils.  I'd be happy if the 
> installer
> wrote a MANIFEST file that tells me what files and directories it did
> install.  I'm not as worried about dependencies or overlaps between 
> packages
> as much as making sure that when I want to get rid of package X I can
> actually delete all of its files.  I also realize that's not truly package
> management in the rpm/deb sense, but that would be good enough for me.
>
> My message was simply pointing out that telling people "use RPM or DEB" is
> not really acceptable.  Not everyone uses Linux.  Or Windows.  Or Macs.
> Python is a cross-platform language.  Through distutils it includes a 
> basic
> cross-platform installation facility.  It probably ought to also have a
> corresponding basic cross-platform uninstall facility.
>
> Skip 


-- 
http://mail.python.org/mailman/listinfo/python-list


Python for Embedded Systems?

2006-07-14 Thread Jack
Is there a Python packaging that is specifically for
embedded systems? ie, very small and configurable so the
user gets to select what modules to install?

For Linux-based embedded systems in particular?

I'm thinking of running it on the Linksys's Linux-based open
source router WRT54G. It has 4MB flash and 16MB RAM. I think
another model has 16MB flash. Any possibilities of running
Python on these systems?

If Python is not the best candidate for embedded systems because
of the size, what (scripting) language would you recommend?

PHP may fit but I don't quite like the language. Anything else?
Loa is small but it does not seem to be powerful enough. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python for Embedded Systems?

2006-07-15 Thread Jack
Yes, I mean Lua, not Loa  :-p

Lua is a nice language. Like you said, it doesn't have many libraries
as Python does. Plus, it's still evolving and the libraries are changing.
I found a few functions not working last time I tried kepler libraries.
It's good for embedded systems though because of its small footprint.
Extensions implemented in C makes it possible that the installation size
doesn't blow up when new stuff is added, like in Python.

But I still like Python better for its power and for the style of the 
language
itself. And I was hoping to find a Python implementation that bears the
principles of Lua to make it suitable for embedded systems :)

>> PHP may fit but I don't quite like the language. Anything else?
>> Loa is small but it does not seem to be powerful enough.

>You mean Lua ? Not powerful enough ? What do you mean by
>that ? Lua is great IMHO. Sure it does not come with thousands
>of libraries, but the language design is extremely clean, the
>language constructs powerful and the footprint very small.

>16kloc of C code can't hurt your embedded device can they ? ;)

>Please tell us what kind of limitation you find in Lua ...

>Cheers,

>SB


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: micro authoritative dns server

2006-07-26 Thread Jack
I was looking for something like that. I came across this:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491264
It's not ready to use but you can modify it.


<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> I'm new in python. I know that there are several classes for writing
> dns servers, but I don't understand it
>
> I just want to know if anyone could help me in writing a code for
> minimal authoritative dns server. I would like that anyone show me the
> code, minimal, for learn how expand it.
>
> The code I desireed should do the following:
>
> 1) It has an hash:
> hosts = { "myhost"   => 84.34.56.67
>"localhost" => 127.0.0.1,
>"blue"  => fe80::20f:b0ff:fef2:f106
> }
> 2) If any application asks if know any hosts, say nothing if this host
> is not in the hash (hosts). If this host is in the hash, return the ip
> 3) And not do anything more
>
> So if we put this server in /etc/resolv.conf then the browsers only
> recognize the hosts we want
>
> Thanks in advance,
> Xan.
>
> PS: For personal communication, DXpublica @ telefonica.net
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: micro authoritative dns server

2006-07-27 Thread Jack
No, it's very low level :)
Please post back if you find a good solution (or have built something that 
you want to
open source :)

> Well, thanks, but I think it's so few for beginning. ,-(
> Is it not any high-level DNS class? E!!!
>
> Regards,
> Xan.
>
> Jack wrote:
>> I was looking for something like that. I came across this:
>> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491264
>> It's not ready to use but you can modify it.


-- 
http://mail.python.org/mailman/listinfo/python-list


Looking for a text file based wiki system written in Python

2006-08-12 Thread Jack
I'd like to set up a wiki system for a project I'm working on.
Since I'm not good at databases, and there's really not much
stuff to put into the wiki, I hope it is text file-based.
I used DokuWiki before, which is very nice but it's written
in PHP. Is there a similar system that's written in Python?
I found pwyky but it's functionality is a bit too simple. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a text file based wiki system written in Python

2006-08-12 Thread Jack
Thanks! Because it was so well known, I thought it was database-based  :)
> http://moinmoin.wikiwikiweb.de/

Any good and simple text file-based blog system in Python? 


-- 
http://mail.python.org/mailman/listinfo/python-list


https on ActiveState Python 2.4?

2006-08-21 Thread Jack
I'm trying to use urllib to retrieve an https page but I am
getting an "unknown url type: https"

It seems that ActiveState Python doesn't have SSL support.
Any advice? 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: https on ActiveState Python 2.4?

2006-08-22 Thread Jack
Thanks for the reply.

I found some openSSL patches for earlier versions of ActiveState Python.
It involves .pyd files and they look for earlier versions of Python DLLs and 
don't
run on ActiveState Python 2.4. I suspect the regular Python solution would
have the same problem or even more problems because it's not a pure .py
patch.

"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Mon, 21 Aug 2006 15:31:20 -0700, "Jack" <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>> I'm trying to use urllib to retrieve an https page but I am
>> getting an "unknown url type: https"
>>
>> It seems that ActiveState Python doesn't have SSL support.
>> Any advice?
>>
>
> I've not tried, but it may be that the "regular" Python (of the same
> language level) may have SSL as a DLL/PYD & .py set and you could just
> copy them into the ActiveState install directory...
> -- 
> Wulfraed Dennis Lee Bieber KD6MOG
> [EMAIL PROTECTED] [EMAIL PROTECTED]
> HTTP://wlfraed.home.netcom.com/
> (Bestiaria Support Staff: [EMAIL PROTECTED])
> HTTP://www.bestiaria.com/ 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: https on ActiveState Python 2.4?

2006-08-22 Thread Jack
Thanks Dennis and Fredrik. This actualy works! I just copyed _socket.pyd and 
_ssl.pyd
from regular Python 2.4.3 into the DLLs directory of the ActiveState Python 
installation.
urllib2.urlopen() starts working for https links :)

I copied ssleay32.dll and libeay32.dll earlier.

"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Jack wrote:
>> Thanks for the reply.
>>
>> I found some openSSL patches for earlier versions of ActiveState Python.
>> It involves .pyd files and they look for earlier versions of Python DLLs 
>> and don't run on ActiveState Python 2.4. I suspect the regular Python 
>> solution would
>> have the same problem or even more problems because it's not a pure .py
>> patch.
>
> huh?  the "regular Python solution" ships with a perfectly working SSL 
> library (in DLLs/_ssl.pyd), which look for the appropriate version of the 
> Python DLL:
>
> > dumpbin /imports "\python24\DLLs\_ssl.pyd"
> Microsoft (R) COFF Binary File Dumper Version 6.00.8168
> Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
>
> Dump of file \python24\DLLs\_ssl.pyd
>
> File Type: DLL
>
>   Section contains the following imports:
>
> WSOCK32.dll
> ...
> python24.dll
> ...
>
> (what's the point in using ActiveState's crippled distribution if you need 
> stuff that's shipped with the standard distro, btw?  why not just use the 
> standard version, and install win32all on top of that?)
>
> 
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Python SOAP and XML-RPC performance extremely low?

2006-07-06 Thread Jack
When I try TooFPy with the SOAP and XML-RPC sample client code
provided in TooFPy tutorials, a log entry shows up quickly on web server
log window, but it takes a long time (5 seconds or longer) for the client
to output a "Hello you." It seems like the web server is fast because the 
log
entry shows immieidately on web server console. But it takes Python XML/SOAP 
parser a long time to parse the extremely simple result. If so, wouldn't 
this
render Python SOAP and XMP-RPC implementation useless in real life? 


-- 
http://mail.python.org/mailman/listinfo/python-list


Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-06 Thread Jack
Basically I am trying to find a high performance web server. Since
Python is installed on all of the servers, It'll be great if the web
server is written in Python as well. Otherwise, I will have to install
lighttpd or other web servers.

Then the largest issue with Python-based web servers is performance.
That's why I start to look into medusa or twisted-based servers. Twisted
seems too big and complicated for what I really want to do and the
original medusa web server only has very basic functionality.

And I'd like the web server to have CGI/FastCGI and possible SCGI
support for flexibility in application development. My applications
here are really internal testing or data provider tools. Am I asking
a lot? I think this is basic requirement for a web server these days :D

What it looks like is that, although there seem to be many Python http
servers available, there isn't really one that's simple, fast and
feature-rich (cgi/fcgi/scgi) - I guess I am asking too much ;-p
It seems that the only candidate that meetings the requirements but
"written in Python" is lighttpd.

Any recommendations? 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-06 Thread Jack
To be honest, I'm not sure what kind of performance I can get even
with medusa or twisted. I assume it won't be as fast as servers
written in C/C++ and use async sockets, but should be much better than
multi-processed or multi-threaded servers in written in Python.

Not sure if anyone else has an idea about medusa or twisted performance.
Any chance that it's close to Apache?

But even so, I guess I may still have to go with lighttpd for FastCGI/
CGI/SCGI support.

> You haven't really said much about your requirements though.  Perhaps
> if you describe them in more detail (for example, what does "high
> performance" mean to you?) someone can make a more useful recommendation.
>
> Jean-Paul 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-06 Thread Jack
>> I will have to install lighttpd or other web servers.
>
> do that.
>
> If all you need is a webserver there's little reason to have it in
> python. Just use one of the several high quality open source webservers.

lighttpd is a great web server. I just didn't want to bother download the 
source,
configure, make and make install, and have a bunch of files installed into 
the system
(The binaries are mostly not the latest version.)  If a server can be set up 
with a few
python files, it sounds like a cleaner approach :)

lighttpd does have an option to make a monilithic build that has everything 
in
one file but somehow I couldn't make the scons-based build work. (Any tips?) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python SOAP and XML-RPC performance extremely low?

2006-07-06 Thread Jack
No, I'm not using any accelerator. The code is extremely simple (from 
toofpy):

# XML-RPC test
import xmlrpclib
srv = xmlrpclib.Server('http://localhost:4334/RPC2/greeting')
print srv.greeting('you', 5)

# SOAP test
import SOAPpy
srv = SOAPpy.SOAPProxy('http://localhost:4334/SOAP/greeting')
print srv.greeting('you', 5)

It really surprised me that they were so slow to execute.

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
>Jack> When I try TooFPy with the SOAP and XML-RPC sample client code
>Jack> provided in TooFPy tutorials, a log entry shows up quickly on web
>Jack> server log window, but it takes a long time (5 seconds or longer)
>Jack> for the client to output a "Hello you."
>
> For XML-RPC are you using sgmlop or some other accelerator?  If not, you
> might want to consider it.
>
> Skip 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-06 Thread Jack

>> I will have to install lighttpd or other web servers.
>
> do that.
>
> If all you need is a webserver there's little reason to have it in
> python. Just use one of the several high quality open source webservers.

If it is a Python web server, it would be nice to extend it by putting code
right into the web server. The performance should be better than FastCGI
because it removes the cost to send the requests/replies back and forth. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python SOAP and XML-RPC performance extremely low?

2006-07-07 Thread Jack
Ha! Thanks Fredrik for the big hint :) I wasn't careful when reading that 
page.
Was in too much of a hurry to try the code :)

> and a "5" as the second argument in the greeting call.  I wonder what that 
> does ? ;-)
>
> (if you need a hint, look for "waits the given number of seconds" on this 
> page:
>
> http://pyds.muensterland.org/wiki/toolserverframeworkforpythonquickstartguide.html
>
> )
>
> 
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Jack
I just did some testing between CherryPy's web server and lighttpd.
My test was very simple and I used ab.exe for this purpose.
CherryPy web server can serve about 140 simple request / second, while
lighttpd can handle around 400 concurrent requests.

> You haven't really said much about your requirements though.  Perhaps
> if you describe them in more detail (for example, what does "high
> performance" mean to you?) someone can make a more useful recommendation.
>
> Jean-Paul 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Jack
I wrote the last posting at late late night and I didn't know what I was
typing at that time ;-p

I didn't mean the test with CherryPy was not concurrent
connections, or the test with lighttpd was all concurrent
connections. I actually tried both concurrent (-c in ab command line)
and non-concurrent (without -c in ab command line) and I tried
the threading and threadpooling in CherryPy. The result did not
vary much.

This article http://www.cherrypy.org/wiki/CherryPySpeed says CherryPy
can process around 400-500 requests/second. It's set up is:

  Pentium M 1.6, 1G RAM, Windows XP2 laptop, test done with apache 2.0.41 
ab.

I have a slightly better hardware set up:

  Pentium M 1.7MHz, 1.5G RAM on Windows XP2 laptop, test done with Apache 
2.2 ab

However, I don't get even close. The best I get is around 140
requests/second. I'm using the same test script as the CherryPy test
with slight modification just to make it run. As a matter of fact,
the Cygwin build of lighttpd only gets around 430 requests/second for
a 2-byte static file. I disabled firewall and antivirus on the box when
tests were done. Any idea about the huge difference? It would be very
interesting if some CherryPy (or python) users can post their performance
benchmarks.

Jack

"Jack" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I just did some testing between CherryPy's web server and lighttpd.
> My test was very simple and I used ab.exe for this purpose.
> CherryPy web server can serve about 140 simple request / second, while
> lighttpd can handle around 400 concurrent requests.
>
>> You haven't really said much about your requirements though.  Perhaps
>> if you describe them in more detail (for example, what does "high
>> performance" mean to you?) someone can make a more useful recommendation.
>>
>> Jean-Paul
>
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Jack
You are right. Load test can be complicated because of the various patterns
of web applications and usages. The simple tests I mentioned and conducted 
just
give myself some idea about the performance. Given the same set up, some
numbers should be comparable and reveal some aspects on web servers'
performance. They are by no means formal load tests, but they are helpful to 
me :-)

"Istvan Albert" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>> >> I will have to install lighttpd or other web servers.
>
>> If it is a Python web server, it would be nice to extend it by putting 
>> code
>> right into the web server. The performance should be better than FastCGI
>> because it removes the cost to send the requests/replies back and forth.
>
> you'll need to make a distinction between a webserver written in python
> (primary purpose to serve data) and a web framework that integrates
> python and allows you to generate said data with python
>
> as for the so called load test that you mention above, those "tests"
> are pointless and provide no insight whatsoever to the realistic
> behavior of the server ... unless of course all your users are expected
> to connect from the same machine while asking for the same 2 byte file
> at the maximum speed the system allows them to.
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Jack
I'm using CherryPy 2.2.1.
I just ran benchmark.py multiple times. The fastest it got is 195 req/sec, 
with
50 threads. Python was taking 50+% CPU when the test was running.

> It would be good to know which version of CherryPy you are using. That
> wiki page is talking about the CP 2.0 branch; 2.1 and later are quite
> different. If you have a later version, try using
> cherrypy/test/benchmark.py
>
> Note also that you can use lighttpd as an HTTP server for CherryPy apps
> via FCGI/SCGI.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Jack
Thanks Tim and Gerard for recommending karrigell.

I just checked it out. It is indeed a nice package. However, I didn't find 
it
easier to learn or use than CherryPy though. I read through CherryPy 
tutorials
and have got a good idea how to use it. I also read Karrigell docs. The way
Karrigell uses subpath behind CGI file name is a little strange to me. 
Nonetheless,
Karrigell looks very nice to me but I may start with CherryPy.

What's missing (according to my requirement/wishlist) is, as a web server, 
the
build-in web server does not handle CGI or FastCGI apps, making python
the only way to write apps...



"Tim Williams" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On 07/07/06, Jack <[EMAIL PROTECTED]> wrote:
>> I just did some testing between CherryPy's web server and lighttpd.
>> My test was very simple and I used ab.exe for this purpose.
>> CherryPy web server can serve about 140 simple request / second, while
>> lighttpd can handle around 400 concurrent requests.
>>
>> > You haven't really said much about your requirements though.  Perhaps
>> > if you describe them in more detail (for example, what does "high
>> > performance" mean to you?) someone can make a more useful 
>> > recommendation.
>> >
>
> Karrigell has an async server, in standalone mode it won't be as fast
> as lighttpd but its simpler to use and code in than cherrypy.
> However, it can also work behind lighttpd,  so you might get a good
> mix of server speed and fast development time.
>
> http://www.karrigell.com
>
> HTH :) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help a newbie with a IDE/book combination

2006-07-10 Thread Jack
I use PyScripter. http://www.mmm-experts.com/ I find it easy to use.
It runs on Windows and it does have a good help file.

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> I already have a couple of newbie books on Python itself, but would
> rather get started with a nice to use IDE and I am therefore looking
> for a good IDE to learn Python.  On my computer I have installed eric
> (http://ericide.python-hosting.com/) but it lacks any kind of useful
> documentation on its use.
>
> Is there a good IDE which would be well documented out there?
>
> Many thanks
>
> Mamadu
>
> PS: I use Debian GNU/Linux on all my computers, a 500MHz proc, 256MB
> RAM.
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


python port for iPod

2006-02-04 Thread jack
Hi,
  Since May 2005 there is a port of python (v2.4.1) for Apple iPod.
  Porting was an 'easy' job, the only consideration was how you can
write with a
  iPod, ipodlinux [1] people did an interface called iPodRead that
allows you
  type into iPod scrolling left or right on the wheel. (This affects to
the file
  Parser/myreadline.c, line 47).
  Furthermore, is necessary run configure with options: --without-threads,
  --without-shared and --with-cxx and build it in a cross-compile
environment
  for ARM architecture.

  Running make the only problem was the function hypot (umm, like ipod
:)  in the math
  module (I don't remember the problem) but i had to change hypot(x,y) to
  sqrt(x*x+y*y).

  You can see the differences between python original and python ported
source
  in [2].

  First announce about the port can be found in [3].
  More info about this port, cool pictures and binaries & source code in
[4].

 [1] http://ipodlinux.org
 [2] http://www.ciberjacobo.com/en/diffs.html
 [3] http://ipodlinux.org/forums/viewtopic.php?t=1945
 [4] http://www.ciberjacobo.com/en/linux_on_ipod.html#python


-- 
Jacobo Avariento Gimeno
http://ciberjacobo.com
OpenPGP key: http://ciberjacobo.com/key.pem
-- 
http://mail.python.org/mailman/listinfo/python-list


MS SQL Server Extension?

2007-04-24 Thread Jack
Hi all, in my next project, my Python code needs to talk to an MS SQL
2000 Server. Internet search gives me http://pymssql.sourceforge.net/
I wonder what module(s) people are using. My code runs on a Linux
box so the module has to build on Linux. Any hints/pointers are welcome. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MS SQL Server Extension?

2007-04-25 Thread Jack
Thanks Tim for the reply. Good info.

I just set up pymssql. Setting it up was fairly straightforward. What kind 
of problems
does it have with unicode?

"Tim Golden" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Jack wrote:
>> Hi all, in my next project, my Python code needs to talk to an MS SQL
>> 2000 Server. Internet search gives me http://pymssql.sourceforge.net/
>> I wonder what module(s) people are using. My code runs on a Linux
>> box so the module has to build on Linux. Any hints/pointers are welcome.
>
> There are several modules around which will cover this.
> One of these days I'll take the post I'm about to write
> and stick it on a Wiki or something because I seem to
> write it about once every six months :)
>
> In no particular order:
>
> adodbapi - recently resurrected from moribundity (if
> that's a word); search the list archives because I
> can't remember who's working on it.
>
> + Win32 only (afaik)
> + Covers all sorts of things as well as MSSQL
> + Allows for passthrough authentication
>
> - Used to have some slight flakiness in it. Bloke
> who's taken over maintenance says he's patched and
> simplified things. Haven't tried it since.
>
> pymssql - http://pymssql.sf.net
>
> + Win32 & Linux (via FreeTDS)
>
> - Doesn't allow passthrough authentication
> - Has some issues with Unicode
>
> pyodbc - http://pyodbc.sf.net
> (a recent runner)
>
> + Win32 & Linux (via whatever *nix ODBC package)
> + Apparently more actively maintained than pymssql
> + (Is currently the favoured front-runner among the sqlalchemy devs)
>
> - Lacks .nextset (in case that's important to you)
>
> Other contenders:
>
> mxODBC - Commercial License but a very strong
> and long-standing candidate. Lacks .nextset
> support. Works on *nix via iODBC etc.
>
> Object Craft MSSQL - Worked well for me for years
> but they seemed to have abandoned it of late.
> Still there. Still works. But no binaries beyond
> Python 2.3. (I did try to recompile using MingW
> but couldn't get it to work). Works on *nix via
> FreeTDS.
>
> TJG 


-- 
http://mail.python.org/mailman/listinfo/python-list


Large Amount of Data

2007-05-25 Thread Jack
I need to process large amount of data. The data structure fits well
in a dictionary but the amount is large - close to or more than the size
of physical memory. I wonder what will happen if I try to load the data
into a dictionary. Will Python use swap memory or will it fail?

Thanks. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Large Amount of Data

2007-05-25 Thread Jack
Thanks for the replies!

Database will be too slow for what I want to do.

"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> In <[EMAIL PROTECTED]>, Jack wrote:
>
>> I need to process large amount of data. The data structure fits well
>> in a dictionary but the amount is large - close to or more than the size
>> of physical memory. I wonder what will happen if I try to load the data
>> into a dictionary. Will Python use swap memory or will it fail?
>
> What about putting the data into a database?  If the keys are strings the
> `shelve` module might be a solution.
>
> Ciao,
> Marc 'BlackJack' Rintsch 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Large Amount of Data

2007-05-26 Thread Jack
I have tens of millions (could be more) of document in files. Each of them 
has other
properties in separate files. I need to check if they exist, update and 
merge properties, etc.
And this is not a one time job. Because of the quantity of the files, I 
think querying and
updating a database will take a long time...

Let's say, I want to do something a search engine needs to do in terms of 
the amount of
data to be processed on a server. I doubt any serious search engine would 
use a database
for indexing and searching. A hash table is what I need, not powerful 
queries.

"John Nagle" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Jack wrote:
>> I need to process large amount of data. The data structure fits well
>> in a dictionary but the amount is large - close to or more than the size
>> of physical memory. I wonder what will happen if I try to load the data
>> into a dictionary. Will Python use swap memory or will it fail?
>>
>> Thanks.
>
> What are you trying to do?  At one extreme, you're implementing 
> something
> like a search engine that needs gigabytes of bitmaps to do joins fast as
> hundreds of thousands of users hit the server, and need to talk seriously
> about 64-bit address space machines.  At the other, you have no idea how
> to either use a database or do sequential processing.  Tell us more.
>
> John Nagle 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Large Amount of Data

2007-05-26 Thread Jack
I suppose I can but it won't be very efficient. I can have a smaller 
hashtable,
and process those that are in the hashtable and save the ones that are not
in the hash table for another round of processing. But chunked hashtable
won't work that well because you don't know if they exist in other chunks.
In order to do this, I'll need to have a rule to partition the data into 
chunks.
So this is more work in general.

"kaens" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On 5/25/07, Jack <[EMAIL PROTECTED]> wrote:
>> I need to process large amount of data. The data structure fits well
>> in a dictionary but the amount is large - close to or more than the size
>> of physical memory. I wonder what will happen if I try to load the data
>> into a dictionary. Will Python use swap memory or will it fail?
>>
>> Thanks.
>>
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
> Could you process it in chunks, instead of reading in all the data at 
> once? 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Large Amount of Data

2007-05-26 Thread Jack
If swap memery can not handle this efficiently, I may need to partition
data to multiple servers and use RPC to communicate.

"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Fri, 25 May 2007 11:11:28 -0700, "Jack" <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>> Thanks for the replies!
>>
>> Database will be too slow for what I want to do.
>>
> Slower than having every process on the computer potentially slowed
> down due to page swapping (and, for really huge data, still running the
> risk of exceeding the single-process address space)?
> -- 
> Wulfraed Dennis Lee Bieber KD6MOG
> [EMAIL PROTECTED] [EMAIL PROTECTED]
> HTTP://wlfraed.home.netcom.com/
> (Bestiaria Support Staff: [EMAIL PROTECTED])
> HTTP://www.bestiaria.com/ 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Large Amount of Data

2007-05-26 Thread Jack
I'll save them in a file for further processing.

"John Machin" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On May 26, 6:17 pm, "Jack" <[EMAIL PROTECTED]> wrote:
>> I have tens of millions (could be more) of document in files. Each of 
>> them
>> has other
>> properties in separate files. I need to check if they exist, update and
>> merge properties, etc.
>
> And then save the results where?
> Option (0) retain it in memory
> Option (1) a file
> Option (2) a database
>
> And why are you doing this agglomeration of information? Presumably so
> that it can be queried. Do you plan to load the whole file into memory
> in order to satisfy a simple query?


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Large Amount of Data

2007-05-27 Thread Jack
John, thanks for your reply. I will then use the files as input to generate 
an index. So the
files are temporary, and provide some attributes in the index. So I do this 
multiple times
to gather different attributes, merge, etc.

"John Machin" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On May 27, 11:24 am, "Jack" <[EMAIL PROTECTED]> wrote:
>> I'll save them in a file for further processing.
>
> Further processing would be what?
> Did you read the remainder of what I wrote?
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


What's the best way to iniatilize a function

2007-05-27 Thread Jack
I have a set of functions to wrap a library. For example,

mylib_init()
mylib_func()
mylib_exit()

or

handle = mylib_init()
mylib_func(handle)
mylib_exit(handle)

In order to call mylib_func(), mylib_init() has to be called once.
When it's done, or when program exits, mylib_exit() should
be called once to free resources.

I can list all three functions in a module and let the
application manage the init call and exit call. Or, better,
to have the wrapper function manage these calls. I'm currently
using a singleton class (see below.) It seems to work fine.

My questions here are:

1. every time I call the function:

MyLib().func()

part of the object creation code is called, at least to check if
there is an existing instance of the class, then return it. So it
may not be very efficient. Is there a better way?

2. what's the right way to call mylib_exit()? I put it in __del__(self)
but it is not being called in my simple test.


STATUS_UNINITIALIZED = 0
STATUS_INITIALIZED = 1
STATUS_ERROR = 2

class MyLib (object):
instance = None
status = STATUS_UNINITIALIZED

def __new__(cls, *args, **kargs):
if cls.instance is None:
cls.instance = object.__new__(cls, *args, **kargs)
return cls.instance

def __init__(self):
if self.status == STATUS_UNINITIALIZED:
mylib_init()
self.status = STATUS_INITIALIZED

def func(self):
return mylib_func()

def __del__(self):
mylib_exit() 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the best way to iniatilize a function

2007-05-27 Thread Jack
Thanks Steven, for the reply. Very helpful. I've got a lot to learn in 
Python :)

Some questions:

> (1) Python can automatically free most data structures and close open
> files, but if your needs are more sophisticated, this approach may not be
> suitable.

Since it's a wrapper of a DLL or .so file, I actually need to call 
mylib_exit()
to do whatever cleanup the library needs to do.

>> 2. what's the right way to call mylib_exit()? I put it in __del__(self)
>> but it is not being called in my simple test.
>
> instance.__del__ is only called when there are no references to the
> instance.

I didn't call del explicitly. I'm expecting Python to call it when
the program exits. I put a logging line in __del__() but I never
see that line printed. It seems that __del__() is not being called
even when the program exits. Any idea why?


-- 
http://mail.python.org/mailman/listinfo/python-list


Parser Generator?

2007-08-18 Thread Jack
Hi all, I need to do syntax parsing of simple naturual languages,
for example, "weather of London" or "what is the time", simple
things like these, with Unicode support in the syntax.

In Java, there are JavaCC, Antlr, etc. I wonder what people use
in Python? Antlr also has Python support but I'm not sure how good
it is. Comments/hints are welcome. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parser Generator?

2007-08-18 Thread Jack
Thanks for all the replies!

SPARK looks promising. Its doc doesn't say if it handles unicode
(CJK in particular) encoding though.

Yapps also looks powerful: http://theory.stanford.edu/~amitp/yapps/

There's also PyGgy http://lava.net/~newsham/pyggy/

I may also give Antlr a try.

If anyone has experiences using any of the parser generators with CJK
languages, I'd be very interested in hearing that.

Jack


"Jack" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi all, I need to do syntax parsing of simple naturual languages,
> for example, "weather of London" or "what is the time", simple
> things like these, with Unicode support in the syntax.
>
> In Java, there are JavaCC, Antlr, etc. I wonder what people use
> in Python? Antlr also has Python support but I'm not sure how good
> it is. Comments/hints are welcome.
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parser Generator?

2007-08-19 Thread Jack
Thanks for the suggestion. I understand that more work is needed for natural 
language
understanding. What I want to do is actually very simple - I pre-screen the 
user
typed text. If it's a simple syntax my code understands, like, Weather in 
London, I'll
redirect it to a weather site. Or, if it's "What is ... " I'll probably 
redirect it to wikipedia.
Otherwise, I'll throw it to a search engine. So, extremelyl simple stuff ...

"samwyse" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Jack wrote:
>> Thanks for all the replies!
>>
>> SPARK looks promising. Its doc doesn't say if it handles unicode
>> (CJK in particular) encoding though.
>>
>> Yapps also looks powerful: http://theory.stanford.edu/~amitp/yapps/
>>
>> There's also PyGgy http://lava.net/~newsham/pyggy/
>>
>> I may also give Antlr a try.
>>
>> If anyone has experiences using any of the parser generators with CJK
>> languages, I'd be very interested in hearing that.
>
> I'm going to echo Tommy's reply.  If you want to parse natural language, 
> conventional parsers are going to be worse than useless (because you'll 
> keep thinking, "Just one more tweak and this time it'll work for sure!"). 
> Instead, go look at what the interactive fiction community uses.  They 
> analyse the statement in multiple passes, first picking out the verbs, 
> then the noun phrases.  Some of their parsers can do on-the-fly 
> domain-specific spelling correction, etc, and all of them can ask the user 
> for clarification.  (I'm currently cobbling together something similar for 
> pre-teen users.) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parser Generator?

2007-08-19 Thread Jack
Very interesting work. Thanks for the link!

"Alex Martelli" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

> 
>
> """
> NLTK ¡ª the Natural Language Toolkit ¡ª is a suite of open source Python
> modules, data sets and tutorials supporting research and development in
> natural language processing.
> """
>
>
> Alex 


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Parser Generator?

2007-08-24 Thread Jack
Thanks Jason. Does Parsing.py support Unicode characters (especially CJK)?
I'll take a look.

"Jason Evans" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Aug 18, 3:22 pm, "Jack" <[EMAIL PROTECTED]> wrote:
>> Hi all, I need to do syntax parsing of simple naturual languages,
>> for example, "weather of London" or "what is the time", simple
>> things like these, with Unicode support in the syntax.
>>
>> In Java, there are JavaCC, Antlr, etc. I wonder what people use
>> in Python? Antlr also has Python support but I'm not sure how good
>> it is. Comments/hints are welcome.
>
> I use Parsing.py.  I like it a lot, probably because I wrote it.
>
>http://www.canonware.com/Parsing/
>
> Jason
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parser Generator?

2007-08-26 Thread Jack
Good to know, thanks Paul.
!
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message

> Pyparsing was already mentioned once on this thread.  Here is an
> application using pyparsing that parses Chinese characters to convert
> to English Python.
>
> http://pypi.python.org/pypi/zhpy/0.5
>
> -- Paul 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parser Generator?

2007-08-26 Thread Jack
Thanks Json. There seem to be a few options that I can pursue. Having a hard 
time
chooing one now :)

"Jason Evans" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Aug 24, 1:21 pm, "Jack" <[EMAIL PROTECTED]> wrote:
>> "Jason Evans" <[EMAIL PROTECTED]> wrote in message
>> >http://www.canonware.com/Parsing/
>>
>> Thanks Jason. Does Parsing.py support Unicode characters (especially 
>> CJK)?
>> I'll take a look.
>
> Parsers typically deal with tokens rather than individual characters,
> so the scanner that creates the tokens is the main thing that Unicode
> matters to.  I have written Unicode-aware scanners for use with
> Parsing-based parsers, with no problems.  This is pretty easy to do,
> since Python has built-in support for Unicode strings.
>
> Jason
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


unsigned integer?

2007-03-10 Thread Jack
This is a naive question:

"%u" % -3

I expect it to print 3. But it still print -3.

Also, if I have an int, I can convert it to unsigned int in C:
   int i = -3;
   int ui = (unsigned int)i;

Is there a way to do this in Python? 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: unsigned integer?

2007-03-10 Thread Jack
Thanks for all the replies. Because I want to convert an int,
Dan's function actually does it well.

"Jack" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> This is a naive question:
>
> "%u" % -3
>
> I expect it to print 3. But it still print -3.
>
> Also, if I have an int, I can convert it to unsigned int in C:
>   int i = -3;
>   int ui = (unsigned int)i;
>
> Is there a way to do this in Python?
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Where to find pywin32/win32all for Python 1.5.2?

2007-04-03 Thread Jack
I searched around but could not find win32all source or binaries for earlier 
versions of Python. Don't ask me why but I have to use Python 1.5.2 in this 
project :) The sourceforget page only has latest versions. ActiveState does 
not even have 1.5.2 for download. Is it still available somewhere? Thanks! 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Where to find pywin32/win32all for Python 1.5.2?

2007-04-03 Thread Jack
Thanks Jay. When I searched the net, I also found mentioning of 
win32all-125.exe
but I couldn't find a download link. Does anyone still have it in the HD?

"jay graves" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Apr 3, 7:52 pm, "Jack" <[EMAIL PROTECTED]> wrote:
>> I searched around but could not find win32all source or binaries for 
>> earlier
>> versions of Python. Don't ask me why but I have to use Python 1.5.2 in 
>> this
>> project :) The sourceforget page only has latest versions. ActiveState 
>> does
>> not even have 1.5.2 for download. Is it still available somewhere? 
>> Thanks!
>
> I looked through my stash of old versions but I couldn't find it.
>
> I believe the filename you are looking for is 'win32all-128.exe' and
> Google has some references to it but the download links don't respond.
>
> Someone else has it stashed somewhere, hopefully having the filename
> will help.
>
> ...
> Jay Graves
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Custom Python Runtime

2007-04-06 Thread Jack
Since the full installation of Python (from either the standard installer or 
ActiveState installer) is too big for my intended use, I'd like to build a 
custom distribution of Python for Windows platform, omitting some lib files, 
such as audio, tk, printing, testing units, etc.

Is there a way to customize the Windows build? In my case, there is no need 
to build an installer. The best way is to have everything in a directory, as 
long as I know where to find Python and Python knows where to find the 
necessary libs. Any online docs describing this? Thanks! 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Custom Python Runtime

2007-04-09 Thread Jack
Thanks for all the replies. It would be great to have all customization
related information on one doc page.

A few more questions:

1. One Windows, it's possible to zip all files in a Python24.zip. I'm not
very clear if it's used in the stardard distribution. What can,
and what can not be put into this file? I suppose zip file will help
reduce the distribution size.

2. I remember trying the compiler option to strip doc strings didn't
help but maybe I didn't do it right. I had to write some code to compile
selected py files. Is there a way to compile a stripped Python with
compile time options?

3. Some files go to the Windows\system32 directory, including some win32all
files. Can they be in the current directory as python.exe?

4. Are the registry entries necessary?

Thanks

"Jack" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Since the full installation of Python (from either the standard installer 
> or ActiveState installer) is too big for my intended use, I'd like to 
> build a custom distribution of Python for Windows platform, omitting some 
> lib files, such as audio, tk, printing, testing units, etc.
>
> Is there a way to customize the Windows build? In my case, there is no 
> need to build an installer. The best way is to have everything in a 
> directory, as long as I know where to find Python and Python knows where 
> to find the necessary libs. Any online docs describing this? Thanks!
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Custom Python Runtime

2007-04-12 Thread Jack
It seems that pywintypes24.dll and pythoncom24.dll have to be in
C:\Windows\System32 directory. Otherwise I get an error.
 Any way to get around that?

>> 3. Some files go to the Windows\system32 directory, including some 
>> win32all
>> files. Can they be in the current directory as python.exe?
>
> .dll files? Sure.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Custom Python Runtime

2007-04-12 Thread Jack
Gabriel, thanks for the reply. The error is that the DLL can not be found. I 
think the reason is that the pyd files from pywin32 do not use the 
python.exe directory. Instead, they expect pywintypes24.dll on the path.

"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> En Thu, 12 Apr 2007 19:02:53 -0300, Jack <[EMAIL PROTECTED]> escribió:
>
>> It seems that pywintypes24.dll and pythoncom24.dll have to be in
>> C:\Windows\System32 directory. Otherwise I get an error.
>>  Any way to get around that?
>
> Both are part of the pywin32 extensions, better ask on the python-win32 
> list:
> http://mail.python.org/mailman/listinfo/python-win32
>
> You don't say which error you got, but abusing again my crystall ball, try 
> this:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsetup/html/dlldanger1.asp
>
> -- 
> Gabriel Genellina
> 


-- 
http://mail.python.org/mailman/listinfo/python-list

Python editor/IDE on Linux?

2007-04-13 Thread Jack
I wonder what everybody uses for Python editor/IDE on Linux?
I use PyScripter on Windows, which is very good. Not sure if
there's something handy like that on Linux. I need to do some
development work on Linux and the distro I am using is Xubuntu. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python editor/IDE on Linux?

2007-04-13 Thread Jack
Thanks but...I'm looking for something free :)

> try wing ide. i tried it and i love it. it's available for windows as
> well for linux


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python editor/IDE on Linux?

2007-04-13 Thread Jack

> We should do a weekly poll. :) Seriously - this question is coming up
> very frequently and everybody has their preference.

Maybe a web page, something like pythonidepoll.com :)

I apologize for bringing up this FAQ once again ;-p

> My (current) favorite:
> pida (exists as a ready package on Debian as derivates like Xubuntu)
>
> pida because it embeds the 'vim' editor which I love and adds useful
> features without really getting in my way. And it's the only IDE I found
> that supports bazaar-ng (bzr) repositories.

pida screenshots look neat. It's not in xubuntu's repository though. Not 
even in universe.
I installed from the source. When running it, I get an error "Service not 
found. Tried to
access non-existing service filemanager" 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python editor/IDE on Linux?

2007-04-13 Thread Jack
That's a good one. I got to find out what's special with Emacs :)

> I'll let you in on a little secret. We all use Emacs. Those who claim to 
> use vim are just trying to prevent you from ever becoming a successful 
> Python programmer, and therefore reduce competition.
> -- 
> Michael Hoffman 


-- 
http://mail.python.org/mailman/listinfo/python-list


Check it out:Very good online resources, tons of cool men and beautiful women eager for lovers....:

2007-10-04 Thread jack
Check it out:Very good online resources,tons of cool men and beautiful
women eager for lovers:

1.Buy tickets online:
http://groups.google.com/group/all-good-things/web/want-to-buy-tickets-online-come-here

2.No 1 social network:
http://groups.google.com/group/all-good-things/web/1-social-network

3.Very good online resources:
http://groups.google.com/group/all-good-things/web/very-useful-websites

4.cool men and beautiful women eager for lovers
http://groups.google.com/group/all-good-things/web/tons-of-men-and-women-are-looking-lovers

5.Best affiliate programs:
http://www.apsense.com/abc/ymapsense/business.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Simple HTML template engine?

2007-10-16 Thread Jack
This one is really small and simple (one small file):

http://davidbau.com/archives/2007/02/18/python_templates.html

"allen.fowler" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello,
>
> Can anyone recommend a simple python template engine for generating
> HTML that relies only on the Pyhon Core modules?
>
> No need for caching, template compilation, etc.
>
> Speed is not a major issue.
>
> I just need looping and conditionals. Template inheritance would be a
> bonus.
>
> I've seen Genshi and Cheetah, but they seem way too complex.
>
> Any ideas?
>
> I'm sure I could build something myself, but I'm sure this has already
> been done quite a few times.  Why re-invent the wheel, right?
>
>
> Thank you,
> Allen
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


More friends more money,get friends while get paid

2007-10-23 Thread jack
More friends more money,get friends while get paid
http://groups.google.com/group/all-good-things/web/get-friends-while-get-paid
Get 1 Million Guaranteed Real Visitors, FREE!
http://www.t2000ultra.com/?rid=12740

-- 
http://mail.python.org/mailman/listinfo/python-list


Trying to build cjson on Widnows, getting errors

2007-11-28 Thread Jack
Since I don't have VS2003, I'm trying to build cjson with MingW and Cygwin 
but I'm getting lots of errors like these:

build\temp.win32-2.5\Release\cjson.o(.text+0x8e):cjson.c: undefined 
reference to
 `_imp___Py_NoneStruct'
build\temp.win32-2.5\Release\cjson.o(.text+0x95):cjson.c: undefined 
reference to
 `_imp___Py_NoneStruct'
build\temp.win32-2.5\Release\cjson.o(.text+0x122):cjson.c: undefined 
reference t
o `_imp___Py_TrueStruct'
build\temp.win32-2.5\Release\cjson.o(.text+0x129):cjson.c: undefined 
reference t
o `_imp___Py_TrueStruct'
build\temp.win32-2.5\Release\cjson.o(.text+0x15d):cjson.c: undefined 
reference t
o `_imp___Py_ZeroStruct'

Any idea what I'm missing? Thanks. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Is a "real" C-Python possible?

2007-12-09 Thread Jack
I understand that the standard Python distribution is considered
the C-Python. Howerver, the current C-Python is really a combination
of C and Python implementation. There are about 2000 Python files
included in the Windows version of Python distribution. I'm not sure
how much of the C-Python is implemented in C but I think the more
modules implemented in C, the better performance and lower memory
footprint it will get.

I wonder if it's possible to have a Python that's completely (or at
least for the most part) implemented in C, just like PHP - I think
this is where PHP gets its performance advantage. Or maybe I'm wrong
because the core modules that matter are already in C and those Python
files are really a think wrapper. Anyhow, if would be ideal if Python
has performance similar to Java, with both being interpreted languages.

Jack


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is a "real" C-Python possible?

2007-12-09 Thread Jack

>> I'm not sure
>>how much of the C-Python is implemented in C but I think the more
>>modules implemented in C, the better performance and lower memory
>>footprint it will get.
>
> Prove it.  ;-)

I guess this is subjective :) - that's what I felt in my experience
with web applications developed in Python and PHP. I wasn't able to
find a direct comparison online.

> Seriously, switching to more C code will cause development to bog down
> because Python is so much easier to write than C.

I understand. Python modules implemented in Python - this is how
Python gets its really rich library.

>>I wonder if it's possible to have a Python that's completely (or at
>>least for the most part) implemented in C, just like PHP - I think
>>this is where PHP gets its performance advantage. Or maybe I'm wrong
>>because the core modules that matter are already in C and those Python
>>files are really a thin wrapper. Anyhow, it would be ideal if Python
>>has performance similar to Java, with both being interpreted languages.
>
> Could you provide some evidence that Python is slower than Java or PHP?

I think most Java-Python benchmarks you can find online will indicate
that Java is a 3-10 times faster. A few here:
http://mail.python.org/pipermail/python-list/2002-January/125789.html
http://blog.snaplogic.org/?p=55

Here's an article that shows the new version of Ruby is
faster than Python in some aspects (they are catching up :)
http://antoniocangiano.com/2007/11/28/holy-shmoly-ruby-19-smokes-python-away/ 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is a "real" C-Python possible?

2007-12-09 Thread Jack

>> I think most Java-Python benchmarks you can find online will indicate
>> that Java is a 3-10 times faster. A few here:
>> http://mail.python.org/pipermail/python-list/2002-January/125789.html
>> http://blog.snaplogic.org/?p=55
>
> There are lies, damn lies and benchmarks. :)
>
> Pure Python code is not going to beat Java code until the Python core
> gets a  JIT compiler. If you want fair results you have to either
> disable the JIT in Java or use Psyco for Python. Otherwise you are
> comparing the quality of one language implementation to the quality of a
> JIT compiler.

The second articple does have a column for Psyco. It helps in some areas
but still not good enough to stand up against Java. Plus, Psyco is not the
main stream and has stopped development.

I'm also wondering, if Psyco is the right way to do, any reason it's not
being integrated into standard Python? 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help needed with python unicode cgi-bin script

2007-12-09 Thread Jack
You probably need to set stdout mode to binary. They are not by default on 
Windows.


"weheh" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Dear web gods:
>
> After much, much, much struggle with unicode, many an hour reading all the 
> examples online, coding them, testing them, ripping them apart and putting 
> them back together, I am humbled. Therefore, I humble myself before you to 
> seek guidance on a simple python unicode cgi-bin scripting problem.
>
> My problem is more complex than this, but how about I boil down one 
> sticking point for starters. I have a file with a Spanish word in it, "años", 
> which I wish to read with:
>
>
> #!C:/Program Files/Python23/python.exe
>
> STARTHTML= u'''Content-Type: text/html
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en">
> 
> 
> 
> '''
> ENDHTML = u'''
> 
> 
> '''
> print STARTHTML
> print open('c:/test/spanish.txt','r').read()
> print ENDHTML
>
>
> Instead of seeing "año" I see "a?o". BAD BAD BAD
> Yet, if I open the file with the browser (IE/Mozilla), I see "año." THIS 
> IS WHAT I WANT
>
> WHAT GIVES?
>
> Next, I'll get into codecs and stuff, but how about starting with this?
>
> The general question is, does anybody have a complete working example of a 
> cgi-bin script that does the above properly that they'd be willing to 
> share? I've tried various examples online but haven't been able to get any 
> to work. I end up seeing hex code for the non-ascii characters u'a\xf1o', 
> and later on 'a\xc3\xb1o', which are also BAD BAD BAD.
>
> Thanks -- your humble supplicant.
> 


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Help needed with python unicode cgi-bin script

2007-12-10 Thread Jack
Just want to make sure, how exactly are you doing that?

> Thanks for the reply, Jack. I tried setting mode to binary but it had no
> affect.


-- 
http://mail.python.org/mailman/listinfo/python-list


Strict mode?

2007-12-18 Thread Jack
While enjoying the dynamic feature of Python I find it difficult to refactor 
code without breaking it. For example, if I modify a function to take more 
arguments, or arguments of different types, I'll need to manually find out 
all places where the function is called and make sure I modify them all, 
unlike in C/Java, where the compiler will do the work of checking function 
signatures, etc. I suppose there isn't a strict mode in Python. It would be 
helpful though, when I don't need things to be so dynamic, and this is often 
the case, when it comes to function arguments and return values, for 
example. Even a module level or function level flag would be very helpful to 
find broken code. Or, are there any third party tools that do this? 


-- 
http://mail.python.org/mailman/listinfo/python-list


IronPython faster than CPython?

2007-12-18 Thread Jack
I learned a lot from the other thread 'Is a "real" C-Python possible?' about 
Python performance and optimization. I'm almost convinced that Python's 
performance is pretty good for this dynamic language although there are 
areas to improve, until I read some articles that say IronPython is a few 
times faster. I find it amazing that something that's written in C and runs 
on hardware is slower than a .NET app that runs on CLR as managed code:

http://www.python.org/~jeremy/weblog/031209a.html
http://blogs.msdn.com/jasonmatusow/archive/2005/03/28/402940.aspx 


-- 
http://mail.python.org/mailman/listinfo/python-list


Binary File Reading : Metastock

2006-05-02 Thread Jack
Hi

I am having a little trouble trying to read a binary file, I would like
to write an ascii to Metastock converter in python but am not having a
lot of success.

The file formats are

http://sf.gds.tuwien.ac.at/00-pdf/m/mstockfl/MetaStock.pdf


If any one can point me in the right direction it would be much
appreciated.

So far I have tried opening file "rb" then trying to use struct and
then binascii but I am not too sure what I should be doing and fuction
I should be using in binascii ?



TIA

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python editor recommendation.

2006-05-09 Thread Jack
PyScripter, a nativen Windows application, free.

>
> Can any one please recommend me an editor for coding Python. Thank u.
> I have Komodo (www.activestate.com) in my mind. Is the editor any good?
>
> regards. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Can Python installation be as clean as PHP?

2006-05-09 Thread Jack
I like Python but I don't really like Python's installation.
With PHP, I only need one file (on Linux) and maybe two files
on Windows then I can run my PHP script. This means no installation
is required in most cases. I just copy the file and I get PHP.
Extending PHP is fairly easy, too, just by copying a few DLLs
and modifying the php.ini a bit.

With Python, things are really messy. I have to run the installer
to install dozens of directories and hundreds of files, and I don't
really know if  all of them are necessary. Plus, lots of libraries
are in .py, which is of course not as efficient/clean as having all
of the core functions built-in in the C/C++ core, like in PHP.

Then again, I do like the Python language. It would be great if
Python (or a variation of Python) can be made the PHP way, one
executable file, and you get everything. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Using a proxy with urllib2

2008-01-10 Thread Jack
I'm trying to use a proxy server with urllib2.
So I have managed to get it to work by setting the environment
variable:
export HTTP_PROXY=127.0.0.1:8081

But I wanted to set it from the code. However, this does not set the proxy:
httpproxy = '127.0.0.1:3129'
proxy_support = urllib2.ProxyHandler({"http":"http://"; + httpproxy})
opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
urllib2.install_opener(opener)
I'm using it from a web.py URL handler file, not sure if it matters.

I have another question though. It seems that using either of the
methods above, the proxy will be global. What if I want to use
a proxy with one site, but not with another site? Or even use a
proxy for some URLs but not others? The proxy having to be global
is really not convenient. Is there any way to do per-fetch proxy? 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using a proxy with urllib2

2008-01-11 Thread Jack
Rob,

I tried your code snippet and it worked great. I'm just wondering if 
getopener( ) call
is lightweight so I can just call it in every call to fetchurl( )? Or I 
should try to share
the opener object among fetchurl( ) calls?

Thanks,
Jack


"Rob Wolfe" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Try this:
>
> 
> import urllib2
>
> def getopener(proxy=None):
>opener = urllib2.build_opener(urllib2.HTTPHandler)
>if proxy:
>proxy_support = urllib2.ProxyHandler({"http": "http://"; + proxy})
>opener.add_handler(proxy_support)
>return opener
>
> def fetchurl(url, opener):
>f = opener.open(url)
>data = f.read()
>f.close()
>return data
>
> print fetchurl('http://www.python.org', getopener('127.0.0.1:8081'))
> 
>
> HTH,
> Rob 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using a proxy with urllib2

2008-01-11 Thread Jack

> Works for me.
> How do you know that the proxy is not set?

The proxy drops some URLs and the URLs were not being dropped when I did 
this :)

> Try this:

Thank you. I'll give it a try. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using a proxy with urllib2

2008-01-11 Thread Jack

>> I'm trying to use a proxy server with urllib2.
>> So I have managed to get it to work by setting the environment
>> variable:
>> export HTTP_PROXY=127.0.0.1:8081
>>
>> But I wanted to set it from the code. However, this does not set the 
>> proxy:
>> httpproxy = '127.0.0.1:3129'
>> proxy_support = urllib2.ProxyHandler({"http":"http://"; + httpproxy})
>> opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
>> urllib2.install_opener(opener)

I find out why it doesn't work in my code but I don't have a solution - 
somewhere
else in the code calls these two lines:

opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)

and they override the proxy opener. Could anyone tell me how to use both 
openers?


-- 
http://mail.python.org/mailman/listinfo/python-list


UR SCHOOL AND COLLEGE'S, PLEASE REGISTER UR SCHOOL AND COLLEGE NAME'S IN THIS SITE. "" IF U HAVE TIME THEN DO IT. PLEASE I REQUEST. """

2008-06-06 Thread jack
IF you want to meet your old school mate's & college mate's of your
life there is a chance, just enter school or college details in the
below site

http://www.batchmates.com/institution/regform.asp?refid=1529710&reflink=31481

please forward to ur friend's
tell to them forward this message to there friend's
--
http://mail.python.org/mailman/listinfo/python-list


benchmark

2008-08-06 Thread Jack
I know one benchmark doesn't mean much but it's still disappointing to see 
Python as one of the slowest languages in the test:

http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/
 


--
http://mail.python.org/mailman/listinfo/python-list


swig and DWMAPI.dll

2008-08-09 Thread Jack
Hello,

When I try and compile a C++ project into a _mystuff.pyd file using
swig with wxDev-C++ it works. I can import, run and everything else in
python.

When I try to compile with g++ command line or code::blocks, compiles
just fine but when I try to import it I get this error:

File "", line 1, in 
  File "D:\python\spinmobules\speedy.py", line 7, in 
import _speedy
ImportError: DLL load failed: A dynamic link library (DLL)
initialization routine failed.

Running "dependency walker" tells me that DWMAPI.dll is missing. This
is a file that apparently is only on windows vista.

Has anyone run into this problem? Is there an easy solution?

Thanks,
Jack
--
http://mail.python.org/mailman/listinfo/python-list


Re: swig and DWMAPI.dll

2008-08-09 Thread Jack
Or, an equally excellent answer would be "you still use swig? That's
so outdated. Try Awesome McAwesomestein's Awesome C++ to Python
Autowrap"
--
http://mail.python.org/mailman/listinfo/python-list


Re: 有中国人乎?

2008-04-22 Thread Jack

Jeroen Ruigrok van der Werven 写道:

(My Mandarin is not very good.)

-On [20080413 09:24], [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:

Python这种语言有前途吗?在下想学他一学.


Python indeed does have a good future.
I am not quite sure with 在下想学他一学 if you are asking for someone to
teach to you or if you want to teach others.



不错的语言啊,可惜一直用C++
begin:vcard
fn:Jack Liu
n:Liu;Jack
email;internet:[EMAIL PROTECTED]
x-mozilla-html:TRUE
version:2.1
end:vcard

--
http://mail.python.org/mailman/listinfo/python-list

ctypes: return a pointer to a struct

2008-04-24 Thread Jack
I'm not able to build IP2Location's Python interface so I'm
trying to use ctypes to call its C interface. The functions
return a pointer to the struct below. I haven't been able to
figure out how I should declare the return type of the functions
and read the fields. Any hint is appreciated.

typedef struct
{
 char *country_short;
 char *country_long;
 char *region;
 char *city;
 char *isp;
 float latitude;
 float longitude;
 char *domain;
 char *zipcode;
 char *timezone;
 char *netspeed;
} IP2LocationRecord; 


--
http://mail.python.org/mailman/listinfo/python-list


Re: ctypes: return a pointer to a struct

2008-04-24 Thread Jack
Thanks for the prompt and detailed reply. I tried that but was getting this 
error:

AttributeError: 'LP_IP2LocationRecord' object has no attribute 
'country_short'

Here's my version, which I think is equivalent to yours:
(as a matter of fact, I also tried yours and got the same error.)

class IP2LocationRecord(Structure):
_fields_ = [("country_short", c_char_p),
("country_long", c_char_p),
("region", c_char_p),
("city", c_char_p),
("isp", c_char_p),
("latitude", c_float),
("longitude", c_float),
("domain", c_char_p),
("zipcode", c_char_p),
("timezone", c_char_p),
("netspeed", c_char_p)]

IP2Location_get_all.restype = POINTER(IP2LocationRecord)
IP2LocationObj = IP2Location_open(thisdir + '/IP-COUNTRY-SAMPLE.BIN')
rec = IP2Location_get_all(IP2LocationObj, '64.233.167.99')
print rec.country_short
IP2Location_close(IP2LocationObj)


"sturlamolden" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Apr 25, 5:15 am, sturlamolden <[EMAIL PROTECTED]> wrote:
>
>> First define a struct type IP2LocationRecord by subclassing from
>> ctypes.Structure. Then define a pointer type as
>> ctypes.POINTER(IP2LocationRecord) and set that as the function's
>> restype attribute. See the ctypes tutorial or reference for details.
>
> Which is to say:
>
> import ctypes
>
> class IP2LocationRecord(ctypes.Structure):
> _fields_ = [
> ('country_short', ctypes.c_char_p),
> ('country_long', ctypes.c_char_p),
> ('region', ctypes.c_char_p),
> ('city', ctypes.c_char_p),
> ('isp', ctypes.c_char_p),
> ('latitude', ctypes.c_float),
> ('longitude', ctypes.c_float),
> ('domain', ctypes.c_char_p),
> ('zipcode', ctypes.c_char_p),
> ('timezone', ctypes.c_char_p),
> ('netspeed', ctypes.c_char_p),
>   ]
>
> IP2LocationRecord_Ptr_t = ctypes.POINTER(IP2LocationRecord)
>
> function.restype = IP2LocationRecord_Ptr_t
>
> 


--
http://mail.python.org/mailman/listinfo/python-list


Re: ctypes: return a pointer to a struct

2008-04-24 Thread Jack
That worked. Thank you!

>> AttributeError: 'LP_IP2LocationRecord' object has no attribute
>> 'country_short'
>
> As it says, LP_IP2LocationRecord has no attribute called
> 'country_short'. IP2LocationRecord does.
>
> Use the 'contents' attribute to dereference the pointer. That is:
>
> yourstruct.contents.country_short


--
http://mail.python.org/mailman/listinfo/python-list


best way to index numerical data ?

2006-03-31 Thread Jack
Hi I have a lot of data that is in a TEXT file which are numbers does
anyone have a good suggestion for indexing TEXT numbers (zip codes,
other codes, dollar amounts, quantities, etc). since Lucene and other
indexers are really optimized for Alpha character indexing. What
approaches are typically taken in computer science for example to index
text numbers..hash maps or something else ??

Thanks,

Jack

-- 
http://mail.python.org/mailman/listinfo/python-list


15541 - Best, Cheapest Web-Hosting, Domain at $1.99!

2010-03-04 Thread jack
World's Cheapest Rate Hosting, 99.9% Uptime
US Based Dedicated Server, Fast Customer Service
Register Domain only at $1.99 per Year
3 Month Hosting Free with 1 year Package
http://hostwebspaces.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: External Hashing [was Re: matching strings in a large set of strings]

2010-05-01 Thread Jack
http://www.swizwatch.com/
All Cartier replica watches sold at Hotwristwatch.com are brand-new and high
quality. Each Cartier Replica Watch produced is examined carefully by our
quality test department and each watch is inspected again before being sent
to our customer. It is our desire that you do experience the joy of shopping
when buying one of our Cartier Replica Watches at our site. Some Cartier
Watches may need to be special ordered, please call for availability on
Cartier watches. Best service you will receive from us.

"Helmut Jarausch"  
??:840jkofai...@mid.dfncis.de...
>I think one could apply an external hashing technique which would require 
>only
> very few disk accesses per lookup.
> Unfortunately, I'm now aware of an implementation in Python.
> Does anybody know about a Python implementation of external hashing?
>
> Thanks,
> Helmut.
>
> -- 
> Helmut Jarausch
>
> Lehrstuhl fuer Numerische Mathematik
> RWTH - Aachen University
> D 52056 Aachen, Germany 


-- 
http://mail.python.org/mailman/listinfo/python-list


Need webFOCUS Business Intelligence Developer

2017-04-11 Thread Jack
Hi ,
 
Greetings from Niche software solutions .
 
​We have a new job opening for the following position, please find the job​ 
​description below.Please share your most recent updated resume to move forward 
into the process, If you are not interested please let me know if you have any 
friends or colleagues that who would be interested in this position

Job Title: webFOCUS Business Intelligence Developer
Location : Pittsburgh, PA
Duration : 6 Months 



Interview Mode – Phone interview is a must & Skype or face to face interview 
possible to follow
 
 Need  3 to 5 years' experience in the design, administration, programming, 
and support of an enterprise reporting environment using the WebFOCUS business 
intelligence platform

Job Description:

.Bachelor's degree in Computer Science, Information Systems, or related 
discipline preferred; equivalent experience is acceptable
.Develop and maintain reporting modules utilizing the developer and reporting 
tool kits within WebFOCUS
.Oracle SQL coding skills with particular attention given to detail and accuracy
.Experience in Java, JavaScript, jQuery, AJAX, HTML, XML, JSON, CSS and Visual 
Basic is preferred
.Utilize the administrative tools within WebFOCUS to provide end users with ad 
hoc and personalized reporting while maintaining a secure and cohesive 
environment.
.Thorough understanding of the WebFOCUS product architecture

Best Regards,

Jack Stutter
Niche Soft Solutions INC.
Direct: +1503-536-2043 
Email id: j...@nichesoftsolutions.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Need webFOCUS Business Intelligence Developer

2017-04-11 Thread Jack
Hi ,
 
Greetings from Niche software solutions .
 
​We have a new job opening for the following position, please find the job​ 
​description below.Please share your most recent updated resume to move forward 
into the process, If you are not interested please let me know if you have any 
friends or colleagues that who would be interested in this position

Job Title: webFOCUS Business Intelligence Developer
Location : Pittsburgh, PA
Duration : 6 Months 



Interview Mode – Phone interview is a must & Skype or face to face interview 
possible to follow
 
 Need  3 to 5 years' experience in the design, administration, programming, 
and support of an enterprise reporting environment using the WebFOCUS business 
intelligence platform

Job Description:

.Bachelor's degree in Computer Science, Information Systems, or related 
discipline preferred; equivalent experience is acceptable
.Develop and maintain reporting modules utilizing the developer and reporting 
tool kits within WebFOCUS
.Oracle SQL coding skills with particular attention given to detail and accuracy
.Experience in Java, JavaScript, jQuery, AJAX, HTML, XML, JSON, CSS and Visual 
Basic is preferred
.Utilize the administrative tools within WebFOCUS to provide end users with ad 
hoc and personalized reporting while maintaining a secure and cohesive 
environment.
.Thorough understanding of the WebFOCUS product architecture

Best Regards,

Jack Stutter
Niche Soft Solutions INC.
Direct: +1503-536-2043
Email id: j...@nichesoftsolutions.com
-- 
https://mail.python.org/mailman/listinfo/python-list


HOT LIST

2017-04-12 Thread Jack
Hi  

Hope you doing great!
Greeting from Niche Soft Solutions.
 
I would like to present our topnotch consultants currently available.
Please have a look at the below hot list of Niche Soft Solutions and mail your 
Direct Client requirements to j...@nichesoftsolutions.com
 
Please add my Email ID to your mailing list and send the requirements on daily 
basis
You can reach me at 503-536-2043
 
 
 
Name
Technology
Experience
Visa status
Current Location
Relocation
Tapasya
.Net & Data Analyst
10+
H1B
CO
OPEN
Malika
Java
9+
H1B
CA
OPEN
Vinoth
Data Stage Developer
7+
H1B
MI
OPEN
Sumathi
QA Tester
8+
H1B
CT
OPEN
Rahul
People Soft
8+
H1B
CA
OPEN
Laxman
Java
10+
H1B
VA
VA
Pooja Gosh
WebMethod Developer
7+
H1B
CA
OPEN
Rashi
Guidewire Developer
8+
H1B
TX
OPEN
Shabeer
WebMethod Developer
7+
H1B
NC
OPEN
-- 
https://mail.python.org/mailman/listinfo/python-list


HOT LIST

2017-04-13 Thread Jack
Hi  

Hope you doing great!
Greeting from Niche Soft Solutions.
 
I would like to present our topnotch consultants currently available.
Please have a look at the below hot list of Niche Soft Solutions and mail your 
Direct Client requirements to j...@nichesoftsolutions.com
 
Please add my Email ID to your mailing list and send the requirements on daily 
basis
You can reach me at 503-536-2043
 
 
 
Name
Technology
Experience
Visa status
Current Location
Relocation
Tapasya
.Net & Data Analyst
10+
H1B
CO
OPEN
Malika
Java
9+
H1B
CA
OPEN
Vinoth
Data Stage Developer
7+
H1B
MI
OPEN
Sumathi
QA Tester
8+
H1B
CT
OPEN
Rahul
People Soft
8+
H1B
CA
OPEN
Laxman
Java
10+
H1B
VA
VA
Pooja Gosh
WebMethod Developer
7+
H1B
CA
OPEN
Rashi
Guidewire Developer
8+
H1B
TX
OPEN
Shabeer
WebMethod Developer
7+
H1B
NC
OPEN



With Regards
   Jack
-- 
https://mail.python.org/mailman/listinfo/python-list


HOT LIST

2017-04-18 Thread Jack
Hi  

Hope you doing great!
Greeting from Niche Soft Solutions.
 
I would like to present our topnotch consultants currently available.
Please have a look at the below hot list of Niche Soft Solutions and mail your 
Direct Client requirements to j...@nichesoftsolutions.com
 
Please add my Email ID to your mailing list and send the requirements on daily 
basis
You can reach me at 503-536-2043
 
 
 
Name
Technology
Experience
Visa status
Current Location
Relocation
Tapasya
.Net & Data Analyst
10+
H1B
CO
OPEN
Malika
Java
9+
H1B
CA
OPEN
Vinoth
Data Stage Developer
7+
H1B
MI
OPEN
Sumathi
QA Tester
8+
H1B
CT
OPEN
Rahul
People Soft
8+
H1B
CA
OPEN
Laxman
Java
10+
H1B
VA
VA
Pooja Gosh
WebMethod Developer
7+
H1B
CA
OPEN
Rashi
Guidewire Developer
8+
H1B
TX
OPEN
Shabeer
WebMethod Developer
7+
H1B
NC
OPEN


Regards
 Jack
Email ID: j...@nichesoftsolutions.com
Phone NO:5035362043
-- 
https://mail.python.org/mailman/listinfo/python-list


HOTLIST

2017-07-17 Thread Jack

Hello Professionals,
Greetings from NICHE SOFTWARE SOLUTIONS,
Thank you for taking time to look over my Mail, 
This is Jack Stutter from Niche Software Solutions Inc working as Sr Bench 
sales recruiter, We have very strong bench consultants. I would highly 
appreciate if you can add me j...@nichesoftsolutions.com in your daily 
requirement mailing list and keep me posted with your daily C2C requirements or 
you can directly reach me at 5035362757. 




NameTechnology  Experience  VisaLocationRelocate
Manoj Kumar VM WARE 14+ H1B NC  OPEN
Rahul Chandran  Business Intelligence   7+  H1B TX  OPEN
Soumith Reddy   SQL/ PLSQL Developer6+  H1B OH  OPEN
Sayed Abualia   Technical support/Analyst   6+  H1B WA  OPEN
ShriSalesforce Developer5+  H1B CO  OPEN
Vishnu KumarQA Analyst (Automation and Manual)  13+ H1B WI  
OPEN
Mahesh  QA Analyst(Automation and Manual)   15+ H1B WI  OPEN
Meenakshi Mahapatra Teradata Developer  7+  L2-EAD  NJ  NJ
Rashi Choudary  Guidewire Developer 8+  H1B TX  OPEN
Sanjay  Automation Tester   8+  H1B CA  OPEN
Rahul  Bhardwaj SAP  APO10+ H1B CO  OPEN
Nisha Rani  .Net Developer  6+  H1B MA  OPEN
Swapna Kanikea  Java Developer  11+ H1B VA  OPEN
Vidur   Network 7+  H1B TX  OPEN
Gnana  SelvaInfirmatic  6+  H1B TX  OPEN
Fakrudhin   Storage Engineer10+ H1B TX  OPEN
Akshay  Sourcing Lead   5+  H1B MA  OPEN
Ramya   UI Developer4+  H4EAD   OH  OPEN
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   >