On Sun, Nov 25, 2001 at 09:15:30PM +0800, Calvin (Hoi Wai) wrote:
| Greetings,
| I had written a python class which use Numeric Python module. Now, I
| wish to write an applet to act as a interface for this class. But I
| don't know how to put the Python Numeric modules into the applet. Did
| anyone try it and solve it? Please feel free to discuss the suggestion.
Your choices are :
o don't use Numeric
o rewrite Numeric in Java (or python) instead of C
o rewrite the C sources to use JNI instead of Python's C API
o build a distributed system where the Numeric-dependent stuff
runs in CPython on a server and the applet invokes remote
methods on it
The problem is that Numeric is written in C using CPython's C
Extension API. Since Jython is pure java code, it has no access to
stuff written in C, unless you make it use JNI so that the JVM can
access it. Of course, that defeats the purpose of an applet because
you would need to compile it specifically for each system (OS/hardware
combination, maybe even JVM version) that you want it to run on.
Depending on your requirements and goals, I think either rewriting
your stuff to not depend on any C modules, or building a distributed
system (in python) will be the best routes. If you go with the
distributed system, be aware that applets can only make connections
back to the server they were downloaded from. That means your numeric
server would need to be on that machine, or you would need a proxy
server on that machine. Come to think of it, the main purpose (I
think) of numeric is its performance with number crunching, and using
a distributed system would kill that.
-D
|