Available Count
int64 1
31
| AnswerCount
int64 1
35
| GUI and Desktop Applications
int64 0
1
| Users Score
int64 -17
588
| Q_Score
int64 0
6.79k
| Python Basics and Environment
int64 0
1
| Score
float64 -1
1.2
| Networking and APIs
int64 0
1
| Question
stringlengths 15
7.24k
| Database and SQL
int64 0
1
| Tags
stringlengths 6
76
| CreationDate
stringlengths 23
23
| System Administration and DevOps
int64 0
1
| Q_Id
int64 469
38.2M
| Answer
stringlengths 15
7k
| Data Science and Machine Learning
int64 0
1
| ViewCount
int64 13
1.88M
| is_accepted
bool 2
classes | Web Development
int64 0
1
| Other
int64 1
1
| Title
stringlengths 15
142
| A_Id
int64 518
72.2M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 2 | 0 | 2 | 3 | 0 | 1.2 | 0 | I'm trying to solve the following problem: Say I have a Python script (let's call it Test.py) which uses a C++ extension module (made via SWIG, let's call the module "Example"). I have Test.py, Example.py, and _Example.so in the same directory.
Now, in the middle of running Test.py, I want to make a change to my Example module, recompile (which will overwrite the existing .so), and use a command to gracefully stop Test.py which is still using the old version of the module (Test.py has some cleaning up to do, which uses some stuff which is defined in the Example module), then start it up again, using the new version of the module. Gracefully stopping Test.py and THEN recompiling the module is not an option in my case.
The problem is, as soon as _Example.so is overwritten and Test.py tries to access anything defined in the Example module (while gracefully stopping), I get a segmentation fault. One solution to this is to explicitly name the Example module by appending a version number at the end, but I was wondering if there was a better solution (I don't want to be importing Example_1_0)? | 0 | python,swig,segmentation-fault | 2010-06-10T20:14:00.000 | 0 | 3,018,122 | You could, on starting Test.py, copy the Example.* files to a temp folder unique for that instance (take a look at tempfile.mkdtemp, it can create safe, unique folders), add that to sys.path and then import Example; and on Test.py shutdown remove that folder (shutils.rmtree) at the cleanup stage.
This would mean that each instance of Test.py would run on its own copy of the Example module, not interfering with the others, and would update to the new one only upon relaunch.
You would need the Example.* files not to be on the same folder as Test.py for this, otherwise the import would get those first. Just storing them on a subfolder should be fine. | 0 | 133 | true | 0 | 1 | Problems replacing a Python extension module while Python script is executing | 3,018,504 |
1 | 1 | 0 | 0 | 2 | 0 | 0 | 0 | im trying to build android from source on ubuntu 10.04. when i enter the repo command:
repo init -u git://android.git.kernel.org/platform/manifest.git -b eclair
it get this error back
exec: 23: python: not found
any ideas. | 0 | python,android | 2010-06-11T01:59:00.000 | 1 | 3,019,742 | You should check your python instalation as the repo command is an python script made by Google to interact with git repositories.
If you do have python installed it is possible that it is not in your shell path or you are using a diferent version than required by repo, ie. you have version 3 while repo requires version 2.5 (just an example, I'm not sure what version repo uses). | 0 | 3,027 | false | 0 | 1 | exec: 23: python: not found error? | 3,019,817 |
2 | 7 | 0 | 4 | 13 | 1 | 0.113791 | 0 | I need to optimize the RAM usage of my application.
PLEASE spare me the lectures telling me I shouldn't care about memory when coding Python. I have a memory problem because I use very large default-dictionaries (yes, I also want to be fast). My current memory consumption is 350MB and growing. I already cannot use shared hosting and if my Apache opens more processes the memory doubles and triples... and it is expensive.
I have done extensive profiling and I know exactly where my problems are.
I have several large (>100K entries) dictionaries with Unicode keys. A dictionary starts at 140 bytes and grows fast, but the bigger problem is the keys. Python optimizes strings in memory (or so I've read) so that lookups can be ID comparisons ('interning' them). Not sure this is also true for unicode strings (I was not able to 'intern' them).
The objects stored in the dictionary are lists of tuples (an_object, an int, an int).
my_big_dict[some_unicode_string].append((my_object, an_int, another_int))
I already found that it is worth while to split to several dictionaries because the tuples take a lot of space...
I found that I could save RAM by hashing the strings before using them as keys!
But then, sadly, I ran into birthday collisions on my 32 bit system. (side question: is there a 64-bit key dictionary I can use on a 32-bit system?)
Python 2.6.5 on both Linux(production) and Windows.
Any tips on optimizing memory usage of dictionaries / lists / tuples?
I even thought of using C - I don't care if this very small piece of code is ugly. It is just a singular location.
Thanks in advance! | 0 | python,optimization,memory-management | 2010-06-11T08:22:00.000 | 0 | 3,021,264 | For a web application you should use a database, the way you're doing it you are creating one copy of your dict for each apache process, which is extremely wasteful. If you have enough memory on the server the database table will be cached in memory (if you don't have enough for one copy of your table, put more RAM into the server). Just remember to put correct indices on your database table or you will get bad performance. | 0 | 12,150 | false | 0 | 1 | Python tips for memory optimization | 3,021,350 |
2 | 7 | 0 | 2 | 13 | 1 | 0.057081 | 0 | I need to optimize the RAM usage of my application.
PLEASE spare me the lectures telling me I shouldn't care about memory when coding Python. I have a memory problem because I use very large default-dictionaries (yes, I also want to be fast). My current memory consumption is 350MB and growing. I already cannot use shared hosting and if my Apache opens more processes the memory doubles and triples... and it is expensive.
I have done extensive profiling and I know exactly where my problems are.
I have several large (>100K entries) dictionaries with Unicode keys. A dictionary starts at 140 bytes and grows fast, but the bigger problem is the keys. Python optimizes strings in memory (or so I've read) so that lookups can be ID comparisons ('interning' them). Not sure this is also true for unicode strings (I was not able to 'intern' them).
The objects stored in the dictionary are lists of tuples (an_object, an int, an int).
my_big_dict[some_unicode_string].append((my_object, an_int, another_int))
I already found that it is worth while to split to several dictionaries because the tuples take a lot of space...
I found that I could save RAM by hashing the strings before using them as keys!
But then, sadly, I ran into birthday collisions on my 32 bit system. (side question: is there a 64-bit key dictionary I can use on a 32-bit system?)
Python 2.6.5 on both Linux(production) and Windows.
Any tips on optimizing memory usage of dictionaries / lists / tuples?
I even thought of using C - I don't care if this very small piece of code is ugly. It is just a singular location.
Thanks in advance! | 0 | python,optimization,memory-management | 2010-06-11T08:22:00.000 | 0 | 3,021,264 | I've had situations where I've had a collection of large objects that I've needed to sort and filter by different methods based on several metadata properties. I didn't need the larger parts of them so I dumped them to disk.
As you data is so simple in type, a quick SQLite database might solve all your problems, even speed things up a little. | 0 | 12,150 | false | 0 | 1 | Python tips for memory optimization | 3,021,346 |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | Ideally I'd like to find a library for Python.
All I need is the caller number, I do not need to answer the call. | 0 | python,call,modem,gsm | 2010-06-11T16:06:00.000 | 0 | 3,024,344 | i don't know for this specific model, but GSM modem are generally handled as a communication port. they are mapped as a communication port (COMXX under windows, don't know for linux).
the documentation of the modem will give you a set of AT command which will allow you to configure the modem so that it notifies incoming calls to the port. just open the port, send the configuration commands and listen for incoming events. (you should also be able to receive SMS this way). | 0 | 1,371 | false | 0 | 1 | Is it possible to detect an incoming call to a GSM modem (HUAWEI E160) plugged into the USB port? | 3,028,528 |
2 | 2 | 0 | 1 | 2 | 0 | 0.099668 | 0 | I have a variable in init of a module which get loaded from the database and takes about 15 seconds.
For django development server everything is working fine but looks like with apache2 and mod_wsgi the module is loaded with every request (taking 15 seconds).
Any idea about this behavior?
Update: I have enabled daemon mode in mod wsgi, looks like its not reloading the modules now! needs more testing and I will update. | 0 | python,django,apache,mod-wsgi | 2010-06-11T18:46:00.000 | 0 | 3,025,378 | I guess, you had a value of 1 for MaxClients / MaxRequestsPerChild and/or ThreadsPerChild in your Apache settings. So Apache had to startup Django for every mod_python call. That's why it took so long. If you have a wsgi-daemon, then a restart takes only place if you "touch" the wsgi script. | 0 | 629 | false | 1 | 1 | Python module being reloaded for each request with django and mod_wsgi | 3,027,902 |
2 | 2 | 0 | 3 | 2 | 0 | 1.2 | 0 | I have a variable in init of a module which get loaded from the database and takes about 15 seconds.
For django development server everything is working fine but looks like with apache2 and mod_wsgi the module is loaded with every request (taking 15 seconds).
Any idea about this behavior?
Update: I have enabled daemon mode in mod wsgi, looks like its not reloading the modules now! needs more testing and I will update. | 0 | python,django,apache,mod-wsgi | 2010-06-11T18:46:00.000 | 0 | 3,025,378 | You were likely ignoring the fact that in embedded mode of mod_wsgi or with mod_python, the application is multiprocess. Thus requests may go to different processes and you will see a delay the first time a process which hasn't been hit before is encountered. In mod_wsgi daemon mode the default has only a single process. That or as someone else mentioned you had MaxRequestsPerChild set to 1, which is a really bad idea. | 0 | 629 | true | 1 | 1 | Python module being reloaded for each request with django and mod_wsgi | 3,032,332 |
1 | 2 | 0 | 0 | 0 | 1 | 0 | 0 | Hey as a project to improve my programing skills I've begun programing a nice code editor in python to teach myself project management, version control, and gui programming. I was wanting to utilize syntax files made for other programs so I could have a large collection already. I was wondering if there was any kind of universal syntax file format much in the same sense as .odt files. I heard of one once in a forum, it had a website, but I can't remember it now. If not I may just try to use gedit syntax files or geany.
thanks | 0 | python,syntax,editor,text-editor | 2010-06-11T23:02:00.000 | 0 | 3,026,786 | Not sure what .odt has to do with any of this.
I could see some sort of BNF being able to describe (almost) any syntax: Just run the text and the BNF through a parser, and apply a color scheme to the terminals. You could even get a bit more fancy, since you'd have the syntax tree.
In reality, I think most syntax files take an easier approach, such as regular expressions. This would put then somewhere above regular expressions but not really quite context-free in terms of power.
As for file formats, if you re-use something that exists, then you can just loot and pillage (subject to license agreements) their syntax file data. | 0 | 252 | false | 0 | 1 | Universal syntax file format? | 3,026,797 |
1 | 2 | 0 | -2 | 0 | 0 | -0.197375 | 1 | Is there a way I can programmatically determine the status of a download in Chrome or Mozilla Firefox? I would like to know if the download was aborted or completed successfully.
For writing the code I'd be using either Perl, PHP or Python.
Please help.
Thank You. | 0 | php,python,perl,download | 2010-06-12T19:18:00.000 | 0 | 3,029,824 | There are scripts out there that output the file in chunks, recording how many bytes they've echoed out, but those are completely unreliable and you can't accurately ascertain whether or not the user successfully received the complete file.
The short answer is no, really, unless you write your own download manager (in Java) that runs a callback to your server when the download completes. | 0 | 676 | false | 0 | 1 | Programmatically determining the status of a file download | 3,029,877 |
1 | 7 | 0 | 2 | 7 | 0 | 1.2 | 0 | I utilize the standard python logging module. When I call python manage.py test I'd like to disable logging before all the tests are ran. Is there a signal or some other kind of hook I could use to call logging.disable? Or is there some other way to disable logging when python manage.py test is ran? | 0 | python,django,logging | 2010-06-12T22:11:00.000 | 0 | 3,030,277 | The only way I know of is to edit manage.py itself... not very elegant, of course, but at least it should get you to where you need to be. | 0 | 5,944 | true | 0 | 1 | Disable logging during manage.py test? | 3,031,000 |
1 | 3 | 0 | 1 | 2 | 0 | 0.066568 | 0 | Has anyone tried using uWSGI with Cherokee? Can you share your experiences and what documents you relied upon the most? I am trying to get started from the documentation on both (uWSGI and Cherokee) websites. Nothing works yet. I am using Ubuntu 10.04.
Edit: To clarify, Cherokee has been working fine. I am getting the error message:
uWSGI Error, wsgi application not found
So something must be wrong with my configurations. Or maybe my application. | 0 | python,wsgi,cherokee,uwsgi | 2010-06-13T03:16:00.000 | 1 | 3,030,936 | There seems to be an issue with the 'make' method of installation on the uwsgi docs. Use 'python uwsgiconfig.py --build' instead. That worked for me. Cherokee, Django running on Ubuntu 10.10. | 0 | 2,309 | false | 1 | 1 | uWSGI with Cherokee: first steps | 5,033,390 |
6 | 7 | 0 | 5 | 5 | 0 | 0.141893 | 0 | I am building a trading portfolio management system that is responsible for production, optimization, and simulation of non-high frequency trading portfolios (dealing with 1min or 3min bars of data, not tick data).
I plan on employing Amazon web services to take on the entire load of the application.
I have four choices that I am considering as language.
Java
C++
C#
Python
Here is the scope of the extremes of the project scope. This isn't how it will be, maybe ever, but it's within the scope of the requirements:
Weekly simulation of 10,000,000 trading systems.
(Each trading system is expected to have its own data mining methods, including feature selection algorithms which are extremely computationally-expensive. Imagine 500-5000 features using wrappers. These are not run often by any means, but it's still a consideration)
Real-time production of portfolio w/ 100,000 trading strategies
Taking in 1 min or 3 min data from every stock/futures market around the globe (approx 100,000)
Portfolio optimization of portfolios with up to 100,000 strategies. (rather intensive algorithm)
Speed is a concern, but I believe that Java can handle the load.
I just want to make sure that Java CAN handle the above requirements comfortably. I don't want to do the project in C++, but I will if it's required.
The reason C# is on there is because I thought it was a good alternative to Java, even though I don't like Windows at all and would prefer Java if all things are the same.
Python - I've read somethings on PyPy and pyscho that claim python can be optimized with JIT compiling to run at near C-like speeds... That's pretty much the only reason it is on this list, besides that fact that Python is a great language and would probably be the most enjoyable language to code in, which is not a factor at all for this project, but a perk.
To sum up:
real time production
weekly simulations of a large number of systems
weekly/monthly optimizations of portfolios
large numbers of connections to collect data from
There is no dealing with millisecond or even second based trades. The only consideration is if Java can possibly deal with this kind of load when spread out of a necessary amount of EC2 servers.
Thank you guys so much for your wisdom. | 0 | java,python,trading | 2010-06-13T05:45:00.000 | 0 | 3,031,225 | Pick the language you are most familiar with. If you know them all equally and speed is a real concern, pick C. | 0 | 995 | false | 1 | 1 | Which programming language for compute-intensive trading portfolio simulation? | 3,031,234 |
6 | 7 | 0 | 4 | 5 | 0 | 0.113791 | 0 | I am building a trading portfolio management system that is responsible for production, optimization, and simulation of non-high frequency trading portfolios (dealing with 1min or 3min bars of data, not tick data).
I plan on employing Amazon web services to take on the entire load of the application.
I have four choices that I am considering as language.
Java
C++
C#
Python
Here is the scope of the extremes of the project scope. This isn't how it will be, maybe ever, but it's within the scope of the requirements:
Weekly simulation of 10,000,000 trading systems.
(Each trading system is expected to have its own data mining methods, including feature selection algorithms which are extremely computationally-expensive. Imagine 500-5000 features using wrappers. These are not run often by any means, but it's still a consideration)
Real-time production of portfolio w/ 100,000 trading strategies
Taking in 1 min or 3 min data from every stock/futures market around the globe (approx 100,000)
Portfolio optimization of portfolios with up to 100,000 strategies. (rather intensive algorithm)
Speed is a concern, but I believe that Java can handle the load.
I just want to make sure that Java CAN handle the above requirements comfortably. I don't want to do the project in C++, but I will if it's required.
The reason C# is on there is because I thought it was a good alternative to Java, even though I don't like Windows at all and would prefer Java if all things are the same.
Python - I've read somethings on PyPy and pyscho that claim python can be optimized with JIT compiling to run at near C-like speeds... That's pretty much the only reason it is on this list, besides that fact that Python is a great language and would probably be the most enjoyable language to code in, which is not a factor at all for this project, but a perk.
To sum up:
real time production
weekly simulations of a large number of systems
weekly/monthly optimizations of portfolios
large numbers of connections to collect data from
There is no dealing with millisecond or even second based trades. The only consideration is if Java can possibly deal with this kind of load when spread out of a necessary amount of EC2 servers.
Thank you guys so much for your wisdom. | 0 | java,python,trading | 2010-06-13T05:45:00.000 | 0 | 3,031,225 | Write it in your preferred language. To me that sounds like python. When you start running the system you can profile it and see where the bottlenecks are. Once you do some basic optimisations if it's still not acceptable you can rewrite portions in C.
A consideration could be writing this in iron python to take advantage of the clr and dlr in .net. Then you can leverage .net 4 and parallel extensions. If anything will give you performance increases it'll be some flavour of threading which .net does extremely well.
Edit:
Just wanted to make this part clear. From the description, it sounds like parallel processing / multithreading is where the majority of the performance gains are going to come from. | 0 | 995 | false | 1 | 1 | Which programming language for compute-intensive trading portfolio simulation? | 3,031,266 |
6 | 7 | 0 | 4 | 5 | 0 | 1.2 | 0 | I am building a trading portfolio management system that is responsible for production, optimization, and simulation of non-high frequency trading portfolios (dealing with 1min or 3min bars of data, not tick data).
I plan on employing Amazon web services to take on the entire load of the application.
I have four choices that I am considering as language.
Java
C++
C#
Python
Here is the scope of the extremes of the project scope. This isn't how it will be, maybe ever, but it's within the scope of the requirements:
Weekly simulation of 10,000,000 trading systems.
(Each trading system is expected to have its own data mining methods, including feature selection algorithms which are extremely computationally-expensive. Imagine 500-5000 features using wrappers. These are not run often by any means, but it's still a consideration)
Real-time production of portfolio w/ 100,000 trading strategies
Taking in 1 min or 3 min data from every stock/futures market around the globe (approx 100,000)
Portfolio optimization of portfolios with up to 100,000 strategies. (rather intensive algorithm)
Speed is a concern, but I believe that Java can handle the load.
I just want to make sure that Java CAN handle the above requirements comfortably. I don't want to do the project in C++, but I will if it's required.
The reason C# is on there is because I thought it was a good alternative to Java, even though I don't like Windows at all and would prefer Java if all things are the same.
Python - I've read somethings on PyPy and pyscho that claim python can be optimized with JIT compiling to run at near C-like speeds... That's pretty much the only reason it is on this list, besides that fact that Python is a great language and would probably be the most enjoyable language to code in, which is not a factor at all for this project, but a perk.
To sum up:
real time production
weekly simulations of a large number of systems
weekly/monthly optimizations of portfolios
large numbers of connections to collect data from
There is no dealing with millisecond or even second based trades. The only consideration is if Java can possibly deal with this kind of load when spread out of a necessary amount of EC2 servers.
Thank you guys so much for your wisdom. | 0 | java,python,trading | 2010-06-13T05:45:00.000 | 0 | 3,031,225 | I would pick Java for this task. In terms of RAM, the difference between Java and C++ is that in Java, each Object has an overhead of 8 Bytes (using the Sun 32-bit JVM or the Sun 64-bit JVM with compressed pointers). So if you have millions of objects flying around, this can make a difference. In terms of speed, Java and C++ are almost equal at that scale.
So the more important thing for me is the development time. If you make a mistake in C++, you get a segmentation fault (and sometimes you don't even get that), while in Java you get a nice Exception with a stack trace. I have always preferred this.
In C++ you can have collections of primitive types, which Java hasn't. You would have to use external libraries to get them.
If you have real-time requirements, the Java garbage collector may be a nuisance, since it takes some minutes to collect a 20 GB heap, even on machines with 24 cores. But if you don't create too many temporary objects during runtime, that should be fine, too. It's just that your program can make that garbage collection pause whenever you don't expect it. | 0 | 995 | true | 1 | 1 | Which programming language for compute-intensive trading portfolio simulation? | 3,031,544 |
6 | 7 | 0 | 3 | 5 | 0 | 0.085505 | 0 | I am building a trading portfolio management system that is responsible for production, optimization, and simulation of non-high frequency trading portfolios (dealing with 1min or 3min bars of data, not tick data).
I plan on employing Amazon web services to take on the entire load of the application.
I have four choices that I am considering as language.
Java
C++
C#
Python
Here is the scope of the extremes of the project scope. This isn't how it will be, maybe ever, but it's within the scope of the requirements:
Weekly simulation of 10,000,000 trading systems.
(Each trading system is expected to have its own data mining methods, including feature selection algorithms which are extremely computationally-expensive. Imagine 500-5000 features using wrappers. These are not run often by any means, but it's still a consideration)
Real-time production of portfolio w/ 100,000 trading strategies
Taking in 1 min or 3 min data from every stock/futures market around the globe (approx 100,000)
Portfolio optimization of portfolios with up to 100,000 strategies. (rather intensive algorithm)
Speed is a concern, but I believe that Java can handle the load.
I just want to make sure that Java CAN handle the above requirements comfortably. I don't want to do the project in C++, but I will if it's required.
The reason C# is on there is because I thought it was a good alternative to Java, even though I don't like Windows at all and would prefer Java if all things are the same.
Python - I've read somethings on PyPy and pyscho that claim python can be optimized with JIT compiling to run at near C-like speeds... That's pretty much the only reason it is on this list, besides that fact that Python is a great language and would probably be the most enjoyable language to code in, which is not a factor at all for this project, but a perk.
To sum up:
real time production
weekly simulations of a large number of systems
weekly/monthly optimizations of portfolios
large numbers of connections to collect data from
There is no dealing with millisecond or even second based trades. The only consideration is if Java can possibly deal with this kind of load when spread out of a necessary amount of EC2 servers.
Thank you guys so much for your wisdom. | 0 | java,python,trading | 2010-06-13T05:45:00.000 | 0 | 3,031,225 | Why only one language for your system? If I were you, I will build the entire system in Python, but C or C++ will be used for performance-critical components. In this way, you will have a very flexible and extendable system with fast-enough performance. You can find even tools to generate wrappers automatically (e.g. SWIG, Cython). Python and C/C++/Java/Fortran are not competing each other; they are complementing. | 0 | 995 | false | 1 | 1 | Which programming language for compute-intensive trading portfolio simulation? | 3,031,844 |
6 | 7 | 0 | 5 | 5 | 0 | 0.141893 | 0 | I am building a trading portfolio management system that is responsible for production, optimization, and simulation of non-high frequency trading portfolios (dealing with 1min or 3min bars of data, not tick data).
I plan on employing Amazon web services to take on the entire load of the application.
I have four choices that I am considering as language.
Java
C++
C#
Python
Here is the scope of the extremes of the project scope. This isn't how it will be, maybe ever, but it's within the scope of the requirements:
Weekly simulation of 10,000,000 trading systems.
(Each trading system is expected to have its own data mining methods, including feature selection algorithms which are extremely computationally-expensive. Imagine 500-5000 features using wrappers. These are not run often by any means, but it's still a consideration)
Real-time production of portfolio w/ 100,000 trading strategies
Taking in 1 min or 3 min data from every stock/futures market around the globe (approx 100,000)
Portfolio optimization of portfolios with up to 100,000 strategies. (rather intensive algorithm)
Speed is a concern, but I believe that Java can handle the load.
I just want to make sure that Java CAN handle the above requirements comfortably. I don't want to do the project in C++, but I will if it's required.
The reason C# is on there is because I thought it was a good alternative to Java, even though I don't like Windows at all and would prefer Java if all things are the same.
Python - I've read somethings on PyPy and pyscho that claim python can be optimized with JIT compiling to run at near C-like speeds... That's pretty much the only reason it is on this list, besides that fact that Python is a great language and would probably be the most enjoyable language to code in, which is not a factor at all for this project, but a perk.
To sum up:
real time production
weekly simulations of a large number of systems
weekly/monthly optimizations of portfolios
large numbers of connections to collect data from
There is no dealing with millisecond or even second based trades. The only consideration is if Java can possibly deal with this kind of load when spread out of a necessary amount of EC2 servers.
Thank you guys so much for your wisdom. | 0 | java,python,trading | 2010-06-13T05:45:00.000 | 0 | 3,031,225 | While I am a huge fan of Python and personaly I'm not a great lover of Java, in this case I have to concede that Java is the right way to go.
For many projects Python's performance just isn't a problem, but in your case even minor performance penalties will add up extremely quickly. I know this isn't a real-time simulation, but even for batch processing it's still a factor to take into consideration. If it turns out the load is too big for one virtual server, an implementation that's twice as fast will halve your virtual server costs.
For many projects I'd also argue that Python will allow you to develop a solution faster, but here I'm not sure that would be the case. Java has world-class development tools and top-drawer enterprise grade frameworks for parallell processing and cross-server deployment and while Python has solutions in this area, Java clearly has the edge. You also have architectural options with Java that Python can't match, such as Javaspaces.
I would argue that C and C++ impose too much of a development overhead for a project like this. They're viable inthat if you are very familiar with those languages I'm sure it would be doable, but other than the potential for higher performance, they have nothing else to bring to the table.
C# is just a rewrite of Java. That's not a bad thing if you're a Windows developer and if you prefer Windows I'd use C# rather than Java, but if you don't care about Windows there's no reason to care about C#. | 0 | 995 | false | 1 | 1 | Which programming language for compute-intensive trading portfolio simulation? | 3,035,998 |
6 | 7 | 0 | 0 | 5 | 0 | 0 | 0 | I am building a trading portfolio management system that is responsible for production, optimization, and simulation of non-high frequency trading portfolios (dealing with 1min or 3min bars of data, not tick data).
I plan on employing Amazon web services to take on the entire load of the application.
I have four choices that I am considering as language.
Java
C++
C#
Python
Here is the scope of the extremes of the project scope. This isn't how it will be, maybe ever, but it's within the scope of the requirements:
Weekly simulation of 10,000,000 trading systems.
(Each trading system is expected to have its own data mining methods, including feature selection algorithms which are extremely computationally-expensive. Imagine 500-5000 features using wrappers. These are not run often by any means, but it's still a consideration)
Real-time production of portfolio w/ 100,000 trading strategies
Taking in 1 min or 3 min data from every stock/futures market around the globe (approx 100,000)
Portfolio optimization of portfolios with up to 100,000 strategies. (rather intensive algorithm)
Speed is a concern, but I believe that Java can handle the load.
I just want to make sure that Java CAN handle the above requirements comfortably. I don't want to do the project in C++, but I will if it's required.
The reason C# is on there is because I thought it was a good alternative to Java, even though I don't like Windows at all and would prefer Java if all things are the same.
Python - I've read somethings on PyPy and pyscho that claim python can be optimized with JIT compiling to run at near C-like speeds... That's pretty much the only reason it is on this list, besides that fact that Python is a great language and would probably be the most enjoyable language to code in, which is not a factor at all for this project, but a perk.
To sum up:
real time production
weekly simulations of a large number of systems
weekly/monthly optimizations of portfolios
large numbers of connections to collect data from
There is no dealing with millisecond or even second based trades. The only consideration is if Java can possibly deal with this kind of load when spread out of a necessary amount of EC2 servers.
Thank you guys so much for your wisdom. | 0 | java,python,trading | 2010-06-13T05:45:00.000 | 0 | 3,031,225 | It is useful to look at the inner loop of your numerical code. After all you will spend most of your CPU-time inside this loop.
If the inner loop is a matrix operation, then I suggest python and scipy, but of the inner loop if not a matrix operation, then I would worry about python being slow. (Or maybe I would wrap c++ in python using swig or boost::python)
The benefit of python is that it is easy to debug, and you save a lot of time by not having to compile all the time. This is especially useful for a project where you spend a lot of time programming deep internals. | 0 | 995 | false | 1 | 1 | Which programming language for compute-intensive trading portfolio simulation? | 3,036,242 |
1 | 3 | 0 | 1 | 0 | 0 | 0.066568 | 0 | Looking for good source code either in C or C++ or Python to understand how a hash function is implemented and also how a hash table is implemented using it.
Very good material on how hash fn and hash table implementation works.
Thanks in advance. | 0 | c++,python,c,hashtable,hash | 2010-06-13T07:02:00.000 | 0 | 3,031,358 | When you want to learn, I suggest you look at the Java implementation of java.util.HashMap. It's clear code, well-documented and comparably short. Admitted, it's neither C, nor C++, nor Python, but you probably don't want to read the GNU libc++'s upcoming implementation of a hashtable, which above all consists of the complexity of the C++ standard template library.
To begin with, you should read the definition of the java.util.Map interface. Then you can jump directly into the details of the java.util.HashMap. And everything that's missing you will find in java.util.AbstractMap.
The implementation of a good hash function is independent of the programming language. The basic task of it is to map an arbitrarily large value set onto a small value set (usually some kind of integer type), so that the resulting values are evenly distributed. | 0 | 571 | false | 0 | 1 | Looking for production quality Hash table/ unordered map implementation to learn? | 3,031,578 |
1 | 1 | 0 | 2 | 2 | 0 | 0.379949 | 0 | Whenever I change my python source files in my Django project, the .pyc files become out of date. Of course that's because I need to recompile them in order to test them through my local Apache web server. I would like to get around this manual process by employing some automatic means of compiling them on save, or on build through Eclipse, or something like that. What's the best and proper way to do this? | 0 | python,django,build-process,build,bytecode | 2010-06-13T07:09:00.000 | 0 | 3,031,383 | You shouldn't ever need to 'compile' your .pyc files manually. This is always done automatically at runtime by the Python interpreter.
In rare instances, such as when you delete an entire .py module, you may need to manually delete the corresponding .pyc. But there's no need to do any other manual compiling.
What makes you think you need to do this? | 0 | 463 | false | 1 | 1 | Eclipse + Django: How to get bytecode output when python source files change? | 3,031,660 |
3 | 11 | 0 | 2 | 86 | 1 | 0.036348 | 0 | Why does Python seem slower, on average, than C/C++? I learned Python as my first programming language, but I've only just started with C and already I feel I can see a clear difference. | 0 | c++,python,c,performance,programming-languages | 2010-06-13T18:09:00.000 | 0 | 3,033,329 | C and C++ compile to native code- that is, they run directly on the CPU. Python is an interpreted language, which means that the Python code you write must go through many, many stages of abstraction before it can become executable machine code. | 0 | 44,926 | false | 0 | 1 | Why are Python Programs often slower than the Equivalent Program Written in C or C++? | 3,033,341 |
3 | 11 | 0 | 8 | 86 | 1 | 1 | 0 | Why does Python seem slower, on average, than C/C++? I learned Python as my first programming language, but I've only just started with C and already I feel I can see a clear difference. | 0 | c++,python,c,performance,programming-languages | 2010-06-13T18:09:00.000 | 0 | 3,033,329 | The difference between python and C is the usual difference between an interpreted (bytecode) and compiled (to native) language. Personally, I don't really see python as slow, it manages just fine. If you try to use it outside of its realm, of course, it will be slower. But for that, you can write C extensions for python, which puts time-critical algorithms in native code, making it way faster. | 0 | 44,926 | false | 0 | 1 | Why are Python Programs often slower than the Equivalent Program Written in C or C++? | 3,033,355 |
3 | 11 | 0 | 25 | 86 | 1 | 1 | 0 | Why does Python seem slower, on average, than C/C++? I learned Python as my first programming language, but I've only just started with C and already I feel I can see a clear difference. | 0 | c++,python,c,performance,programming-languages | 2010-06-13T18:09:00.000 | 0 | 3,033,329 | Compilation vs interpretation isn't important here: Python is compiled, and it's a tiny part of the runtime cost for any non-trivial program.
The primary costs are: the lack of an integer type which corresponds to native integers (making all integer operations vastly more expensive), the lack of static typing (which makes resolution of methods more difficult, and means that the types of values must be checked at runtime), and the lack of unboxed values (which reduce memory usage, and can avoid a level of indirection).
Not that any of these things aren't possible or can't be made more efficient in Python, but the choice has been made to favor programmer convenience and flexibility, and language cleanness over runtime speed. Some of these costs may be overcome by clever JIT compilation, but the benefits Python provides will always come at some cost. | 0 | 44,926 | false | 0 | 1 | Why are Python Programs often slower than the Equivalent Program Written in C or C++? | 3,033,545 |
1 | 2 | 0 | 2 | 2 | 0 | 0.197375 | 0 | I'm using textmate for the first time basically, and I am lost as to what keys map to these funny symbols.
using python bundles, what keys do I press for:
run
run with tests
run project unit tests
Also, with textmate, do I actually define a project in textmate or do I just work on the files and textmate doesn't create its own .project type file ? | 0 | python,textmate | 2010-06-14T01:51:00.000 | 0 | 3,034,640 | Also, with textmate, do I actually define a project in textmate or do I just work on the files and textmate doesn't create its own .project type file ?
You can do both. You can create a new project in TextMate by going to File -> New Project and add your files manually, or you can drag a folder into TextMate and it will create a project from those files (you can add other files later). Note that the second method will not create a .tmproj file, though, so if you want to "keep" that project, you'll have to save it (File -> Save Project). | 0 | 527 | false | 0 | 1 | new to mac and textmate, can someone explain these shortcuts? | 3,069,494 |
1 | 2 | 0 | 4 | 4 | 0 | 1.2 | 1 | I have to send F2 key to telnet host. How do I send it using python...using getch() I found that the character < used for the F2 key but when sending >, its not working. I think there is a way to send special function keys but I am not able to find it. If somebody knows please help me. Thanks in advance | 0 | python,telnet | 2010-06-14T06:40:00.000 | 0 | 3,035,390 | Extended keys (non-alphanumeric or symbol) are composed of a sequence of single characters, with the sequence depending on the terminal you have told the telnet server you are using. You will need to send all characters in the sequence in order to make it work. Here, using od -c <<< 'CtrlVF2' I was able to see a sequence of \x1b0Q with the xterm terminal. | 0 | 2,908 | true | 0 | 1 | how to send F2 key to remote host using python | 3,035,415 |
1 | 4 | 0 | 2 | 9 | 1 | 0.099668 | 0 | I once read about minimal python installation without a lot of the libraries that come with the python default installation but could not find it on the web...
What I want to do is to just pack a script with the python stuff required to execute it and make portable.
Does any one know about something like that?
Thanks | 0 | python | 2010-06-14T07:25:00.000 | 0 | 3,035,572 | You can also look for already installed instances.
OpenOffice / LibreOffice
Look at the environment variable UNO_PATH or into the default install directories, for example for Windows and LO5
%ProgramFiles(x86)%\LibreOffice 5\program\python.exe
Gimp
look into the default install directories, for example for Windows
C:\Program Files\GIMP 2\Python
and so on... | 0 | 14,823 | false | 0 | 1 | Micropython or minimal python installation | 43,765,592 |
1 | 3 | 0 | 1 | 31 | 0 | 0.066568 | 0 | I have a CGI script that is getting an "IOError: [Errno 13] Permission denied" error in the stack trace in the web server's error log.
As part of debugging this problem, I'd like to add a little bit of code to the script to print the user and (especially) group that the script is running as, into the error log (presumably STDERR).
I know I can just print the values to sys.stderr, but how do I figure out what user and group the script is running as?
(I'm particularly interested in the group, so the $USER environment variable won't help; the CGI script has the setgid bit set so it should be running as group "list" instead of the web server's "www-data" - but I need code to see if that's actually happening.) | 0 | python,unix,permissions | 2010-06-15T03:15:00.000 | 1 | 3,042,304 | os.getgid() and os.getuid() can be useful. For other environment variables, look into os.getenv. For example, os.getenv('USER') on my Mac OS X returns the username. os.getenv('USERNAME') would return the username on Windows machines. | 0 | 29,300 | false | 0 | 1 | How to determine what user and group a Python script is running as? | 3,042,340 |
1 | 11 | 0 | 5 | 17 | 1 | 0.090659 | 0 | I want to find the square root of a number without using the math module,as i need to call the function some 20k times and dont want to slow down the execution by linking to the math module each time the function is called
Is there any faster and easier way for finding square root? | 0 | python | 2010-06-15T16:19:00.000 | 0 | 3,047,012 | In some special cases you can trade program size for blistering speed. Create a large array and store the pre-calculated result for every square root operation (using the input value as the index). It's pretty limited but you won't get anything faster.
(That's how quake did it) | 0 | 60,866 | false | 0 | 1 | How to perform square root without using math module? | 3,047,546 |
2 | 4 | 0 | 2 | 11 | 0 | 0.099668 | 1 | Does anyone know of a memory efficient way to generate very large xml files (e.g. 100-500 MiB) in Python?
I've been utilizing lxml, but memory usage is through the roof. | 0 | python,xml,lxml | 2010-06-15T21:27:00.000 | 0 | 3,049,188 | The only sane way to generate so large an XML file is line by line, which means printing while running a state machine, and lots of testing. | 0 | 4,751 | false | 0 | 1 | Generating very large XML files in Python? | 3,049,245 |
2 | 4 | 0 | 2 | 11 | 0 | 0.099668 | 1 | Does anyone know of a memory efficient way to generate very large xml files (e.g. 100-500 MiB) in Python?
I've been utilizing lxml, but memory usage is through the roof. | 0 | python,xml,lxml | 2010-06-15T21:27:00.000 | 0 | 3,049,188 | Obviously, you've got to avoid having to build the entire tree ( whether DOM or etree or whatever ) in memory. But the best way depends on the source of your data and how complicated and interlinked the structure of your output is.
If it's big because it's got thousands of instances of fairly independent items, then you can generate the outer wrapper, and then build trees for each item and then serialize each fragment to the output.
If the fragments aren't so independent, then you'll need to do some extra bookkeeping -- like maybe manage a database of generated ids & idrefs.
I would break it into 2 or 3 parts: a sax event producer, an output serializer
eating sax events, and optionally, if it seems easier to work with some independent pieces as objects or trees, something to build those objects and then turn them into sax events for the serializer.
Maybe you could just manage it all as direct text output, instead of dealing with sax events: that depends on how complicated it is.
This may also be a good place to use python generators as a way of streaming the output without having to build large structures in memory. | 0 | 4,751 | false | 0 | 1 | Generating very large XML files in Python? | 3,050,007 |
7 | 9 | 0 | 0 | 6 | 0 | 0 | 0 | I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods.
I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP.
There are some books on AI on internet but they use Java , Python.
Now I have to apply AI techniques on web application.
Which language should i choose java or python.
I searhed on internet that I can call java classes inside my php so that can help as as I am very good at php
I have also seen that python can also be used with php as well
So which way should I go and roughly how much it will take me to learn java
I have done java basics but that was 6 years ago | 0 | java,php,python,artificial-intelligence | 2010-06-16T02:59:00.000 | 0 | 3,050,450 | Never use PHP for AI. Java or C/C++ is the best, but Python for fast development. | 0 | 10,608 | false | 1 | 1 | Which language should I use for Artificial intelligence on web projects | 3,050,643 |
7 | 9 | 0 | 6 | 6 | 0 | 1 | 0 | I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods.
I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP.
There are some books on AI on internet but they use Java , Python.
Now I have to apply AI techniques on web application.
Which language should i choose java or python.
I searhed on internet that I can call java classes inside my php so that can help as as I am very good at php
I have also seen that python can also be used with php as well
So which way should I go and roughly how much it will take me to learn java
I have done java basics but that was 6 years ago | 0 | java,php,python,artificial-intelligence | 2010-06-16T02:59:00.000 | 0 | 3,050,450 | Does it really matter which language your books use? I mean, you're not gonna copy-paste those examples. And you'll learn to recognize basic constructs (functions, loops, etc) pretty fast. It's not like learning to read Chinese.
Talking about learning time, there's probably no definite answer to this question. I think the best is to look at examples of code both in java and python and see which seems 'nicer', easier and more familiar to you.
Good luck! | 0 | 10,608 | false | 1 | 1 | Which language should I use for Artificial intelligence on web projects | 3,050,476 |
7 | 9 | 0 | 3 | 6 | 0 | 0.066568 | 0 | I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods.
I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP.
There are some books on AI on internet but they use Java , Python.
Now I have to apply AI techniques on web application.
Which language should i choose java or python.
I searhed on internet that I can call java classes inside my php so that can help as as I am very good at php
I have also seen that python can also be used with php as well
So which way should I go and roughly how much it will take me to learn java
I have done java basics but that was 6 years ago | 0 | java,php,python,artificial-intelligence | 2010-06-16T02:59:00.000 | 0 | 3,050,450 | Which language should i choose java or python.
Here are a few things to consider:
java is more widely used (presumably more mature code "out there" to look at - but I haven't tested that out)
python is more prolific (you write faster in python than in java), and from learning the language to writing the code that you want takes less in python than in java
python is multi-paradigm, java is (almost) strictly OOP
java is compiled (whereas python is scripted); this means that java finds your errors at compilation; python at execution - this can make a big difference, depending on your development style/practices
java is more strictly defined and much more verbose than python. Where in java you have to formalize your contracts, in python you use duck-typing.
In the end, the best you could do is set up a small project, write it in both languages and see what you end up preferring. You may also find some restrictions that you can't get around for one of the languages.
In the end it's up to you :)
Edit: that was not an exhaustive list and I tried to be as impartial as I could (but that ends here: I'd go with python :D) | 0 | 10,608 | false | 1 | 1 | Which language should I use for Artificial intelligence on web projects | 3,051,952 |
7 | 9 | 0 | 2 | 6 | 0 | 0.044415 | 0 | I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods.
I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP.
There are some books on AI on internet but they use Java , Python.
Now I have to apply AI techniques on web application.
Which language should i choose java or python.
I searhed on internet that I can call java classes inside my php so that can help as as I am very good at php
I have also seen that python can also be used with php as well
So which way should I go and roughly how much it will take me to learn java
I have done java basics but that was 6 years ago | 0 | java,php,python,artificial-intelligence | 2010-06-16T02:59:00.000 | 0 | 3,050,450 | You can use any language you like, as long as the server it's hosted on supports it. You can use HTML/JS as the user interface, and request results from the server with AJAX requests.
What answers those requests would be your AI code, and that can be anything you want. PHP makes it really simple to answer AJAX requests. Since you are already familiar with it I would recommend that, although if your AI is very sophisticated you may want to go with something a little more efficient, like C/C++. | 0 | 10,608 | false | 1 | 1 | Which language should I use for Artificial intelligence on web projects | 3,050,709 |
7 | 9 | 0 | 0 | 6 | 0 | 0 | 0 | I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods.
I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP.
There are some books on AI on internet but they use Java , Python.
Now I have to apply AI techniques on web application.
Which language should i choose java or python.
I searhed on internet that I can call java classes inside my php so that can help as as I am very good at php
I have also seen that python can also be used with php as well
So which way should I go and roughly how much it will take me to learn java
I have done java basics but that was 6 years ago | 0 | java,php,python,artificial-intelligence | 2010-06-16T02:59:00.000 | 0 | 3,050,450 | I believe Python is nice for this sort of tasks because of it's flexibility. Using the numpy/scipy libraries together with a nice plotting lib (chaco or matplotlib for instance) makes the workflow of working with the data and algorithms easy and you can lab around with the code in the live interpreter in an almost matlab-like manner. Change a line of code here, cleanse the data there and watch the whole thing live in a graph window without having to bother with recompilation etc.
Once you settled on the algorithms it is fairly easy to profile the code and move hotspots into C/C++ or Fortran for instance if you are worried about performance.
(you could even write the stuff in Jython and drop down into java for the performance-heavy bits of the code if you really like to be on the JVM platform) | 0 | 10,608 | false | 1 | 1 | Which language should I use for Artificial intelligence on web projects | 3,264,444 |
7 | 9 | 0 | 0 | 6 | 0 | 0 | 0 | I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods.
I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP.
There are some books on AI on internet but they use Java , Python.
Now I have to apply AI techniques on web application.
Which language should i choose java or python.
I searhed on internet that I can call java classes inside my php so that can help as as I am very good at php
I have also seen that python can also be used with php as well
So which way should I go and roughly how much it will take me to learn java
I have done java basics but that was 6 years ago | 0 | java,php,python,artificial-intelligence | 2010-06-16T02:59:00.000 | 0 | 3,050,450 | AI is not a language or a specific problem like summation or finding an average of some numbers. It's the intelligence which is going to be developed artificially. And to make a system intelligent especially a computer you can use any language that computer can understand and you are comfortable with (C, Java, Python, C++). A very simple AI example could be tic-tac-toe. This game could be made by using any language you would like to. The important thing is the algorithm that needs to be developed. AI is a vast area and it comprises of many things like Image processing, NLP, Machine learning, Psychology and more. And most importantly one has to be very strong in Mathematics, which is the most important and integral part of softcomputing. So again AI is not a language rather intelligent algorithm based on pure mathematics. | 0 | 10,608 | false | 1 | 1 | Which language should I use for Artificial intelligence on web projects | 47,068,977 |
7 | 9 | 0 | 0 | 6 | 0 | 0 | 0 | I have to do one project for my thesis involving Artificial intelligence, collaborative filtering and machine learning methods.
I only know PHP/mysq/JS, and there is not much AI stuff examples in PHP.
There are some books on AI on internet but they use Java , Python.
Now I have to apply AI techniques on web application.
Which language should i choose java or python.
I searhed on internet that I can call java classes inside my php so that can help as as I am very good at php
I have also seen that python can also be used with php as well
So which way should I go and roughly how much it will take me to learn java
I have done java basics but that was 6 years ago | 0 | java,php,python,artificial-intelligence | 2010-06-16T02:59:00.000 | 0 | 3,050,450 | Pretty much any language can be used to code pretty much anything - given the effort and will. But Python has more functional programming constructs which may be more useful when you are coding AI. | 0 | 10,608 | false | 1 | 1 | Which language should I use for Artificial intelligence on web projects | 3,051,880 |
1 | 1 | 0 | 3 | 1 | 1 | 0.53705 | 0 | Is there any way to read metadata - watermarks from image files with Python? | 0 | python,watermark | 2010-06-16T13:09:00.000 | 0 | 3,053,480 | If by watermark you mean some "signature" image content added to an image in order to mark it, then no. Such a watermark is merged with the original image and thus an integral part of it. If you mean meta-data info then yes, this can be read: but you don't specify whether you mean programmatically, or what language or stack you're using or would like to use. | 0 | 546 | false | 0 | 1 | How to read watermarks with Python? | 3,053,551 |
4 | 9 | 0 | 1 | 18 | 1 | 0.022219 | 0 | Is it just because of dynamic typing we don't require a concept of interfaces(like in Java and C#) in python? | 0 | c#,java,python,dynamic-languages | 2010-06-17T14:44:00.000 | 0 | 3,062,701 | Interfaces are used in statically typed languages to describe that two otherwise independent objects "implement the same behaviour". In dynamically typed languages one implicitly assumes that when two objects have a method with the same name/params it does the same thing, so interfaces are of no use. | 0 | 3,173 | false | 0 | 1 | Why don't we require interfaces in dynamic languages? | 3,062,743 |
4 | 9 | 0 | 1 | 18 | 1 | 0.022219 | 0 | Is it just because of dynamic typing we don't require a concept of interfaces(like in Java and C#) in python? | 0 | c#,java,python,dynamic-languages | 2010-06-17T14:44:00.000 | 0 | 3,062,701 | Interface constructs are used in statically typed languages to teach the type system which objects are substitutable for each other in a particular method-calling context. If two objects implement the same method but aren't related through inheritance from a common base class or implementation of a common interface, the type system will raise an error at compile time if you substitute one for the other.
Dynamic languages use "duck typing", which means the method is simply looked up at runtime and if it exists with the right signature, it's used; otherwise a runtime error results. If two objects both "quack like a duck" by implementing the same method, they are substitutable. Thus, there's no explicit need for the language to relate them via base class or interface.
That being said, interfaces as a concept are still very important in the dynamic world, but they're often just defined in documentation and not enforced by the language. Occasionally, I see programmers actually make a base class that sketches out the interface for this purpose as well; this helps formalize the documentation, and is of particular use if part of the interface can be implemented in terms of the rest of the interface. | 0 | 3,173 | false | 0 | 1 | Why don't we require interfaces in dynamic languages? | 3,062,895 |
4 | 9 | 0 | 1 | 18 | 1 | 0.022219 | 0 | Is it just because of dynamic typing we don't require a concept of interfaces(like in Java and C#) in python? | 0 | c#,java,python,dynamic-languages | 2010-06-17T14:44:00.000 | 0 | 3,062,701 | One key thing about at least some dynamic languages that makes explicit interfaces more than a little awkward is that dynamic languages can often respond to messages (err, “method calls”) that they don't know about beforehand, even doing things like creating methods on the fly. The only real way to know whether an object will respond to a message correctly is by sending it the message. That's OK, because dynamic languages consider it better to be able to support that sort of thing rather than static type checking; an object is considered to be usable in a particular protocol because it is “known” to be able to participate in that protocol (e.g., by virtue of being given by another message). | 0 | 3,173 | false | 0 | 1 | Why don't we require interfaces in dynamic languages? | 3,063,282 |
4 | 9 | 0 | 2 | 18 | 1 | 0.044415 | 0 | Is it just because of dynamic typing we don't require a concept of interfaces(like in Java and C#) in python? | 0 | c#,java,python,dynamic-languages | 2010-06-17T14:44:00.000 | 0 | 3,062,701 | It's worth noting that, contrary to what many people will say as a first response, interfaces can be used to do more than document "what methods a class supports". Grzenio touches on this with his wording on "implement the same behaviour". As a specific example of this, look at the Java interface Serializable. It doesn't implement any methods; rather it's used as a "marker" to indicate that the class can be serialized safely.
When considered this way, it could be reasonable to have a dynamic language that uses interfaces. That being said, something akin to annotations might be a more reasonable approach. | 0 | 3,173 | false | 0 | 1 | Why don't we require interfaces in dynamic languages? | 3,063,169 |
1 | 1 | 0 | 3 | 1 | 0 | 1.2 | 0 | Is there an easy way to disable Python egg caching? We have the situation where a system account needs to run a python program which imports a module.
Since this is a non-login robot account, it does not have a home directory, and dies trying to create the directory /.python-eggs.
What's the best way to fix this? Can I convert my eggs in site-files to something which will not be cached in .python-eggs? | 0 | python,egg | 2010-06-17T18:19:00.000 | 1 | 3,064,405 | The best way to fix it is by creating a directory where it can write it's egg cache. You can specify the directory with the PYTHON_EGG_CACHE variable.
[edit]
And yes, you can convert your apps so they won't need an egg-cache. If you install the python packages with easy_install you can use easy_install -Z so it won't zip the eggs and it won't need to extract them. You should be able to unzip the current eggs to make sure you won't need them.
But personally I would just create the egg cache directory. | 0 | 719 | true | 0 | 1 | Python: disabling $HOME/.python-eggs? | 3,064,433 |
1 | 1 | 0 | 0 | 0 | 0 | 1.2 | 1 | I'm using PAMIE to control IE to automatically browse to a list of URLs. I want to find which URLs return IE's malware warning and which ones don't. I'm new to PAMIE, and PAMIE's documentation is non-existent or cryptic at best. How can I get a page's content from PAMIE so I can work with it in Python? | 0 | python,pamie | 2010-06-18T21:17:00.000 | 0 | 3,073,151 | Browsing the CPamie.py file did the trick. Turns out, I didn't even need the page content - PAMIE's findText method lets you match any string on the page. Works great! | 0 | 256 | true | 0 | 1 | How do I get the page content from PAMIE? | 3,098,190 |
4 | 6 | 0 | 0 | 6 | 0 | 0 | 0 | I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases.
Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I already have some games ideas. It would be simple 2d plataform games, and I would like to know what is the best way to start.
I don't want to start with Flash. I'm looking for working with other stuff. I already started to look around for the Unity 3D framework and UDK, but I just don't know how to get started.
So, any hints, tips or sugestions to make? | 0 | php,javascript,python | 2010-06-19T02:38:00.000 | 0 | 3,074,103 | Looking at your tags, web games are mostly client side, and since you aren't going to use flash, i would say JavaScript would work for 2D. With all the libraries and plug-ins out there, JavaScript can actually handle it. | 0 | 471 | false | 1 | 1 | From the web to games | 3,074,113 |
4 | 6 | 0 | 0 | 6 | 0 | 0 | 0 | I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases.
Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I already have some games ideas. It would be simple 2d plataform games, and I would like to know what is the best way to start.
I don't want to start with Flash. I'm looking for working with other stuff. I already started to look around for the Unity 3D framework and UDK, but I just don't know how to get started.
So, any hints, tips or sugestions to make? | 0 | php,javascript,python | 2010-06-19T02:38:00.000 | 0 | 3,074,103 | Taking a look at OpenGL may not be a terrible idea. You can use the library in many languages, and is supported with in HTML5 (WebGL). There are several excellent tutorials out there. | 0 | 471 | false | 1 | 1 | From the web to games | 3,074,138 |
4 | 6 | 0 | 0 | 6 | 0 | 0 | 0 | I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases.
Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I already have some games ideas. It would be simple 2d plataform games, and I would like to know what is the best way to start.
I don't want to start with Flash. I'm looking for working with other stuff. I already started to look around for the Unity 3D framework and UDK, but I just don't know how to get started.
So, any hints, tips or sugestions to make? | 0 | php,javascript,python | 2010-06-19T02:38:00.000 | 0 | 3,074,103 | If you want to learn more Python while doing so, you may want to take PyGame or an equivalent program. PHP, Ruby and JavaScript aren't going to help you in the video game section, though. They're all related to the internet.
If you want to start of real easy, try out Genesis3D. you can make awesome 3D FPS games, and its quite easy to get the hang of too. Took me only 5 days :D
Unity made me sick to my stomach, and so did Blender3D's game engine, so I personally say not to use those. It intimidated me. | 0 | 471 | false | 1 | 1 | From the web to games | 3,074,736 |
4 | 6 | 0 | 3 | 6 | 0 | 0.099668 | 0 | I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases.
Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I already have some games ideas. It would be simple 2d plataform games, and I would like to know what is the best way to start.
I don't want to start with Flash. I'm looking for working with other stuff. I already started to look around for the Unity 3D framework and UDK, but I just don't know how to get started.
So, any hints, tips or sugestions to make? | 0 | php,javascript,python | 2010-06-19T02:38:00.000 | 0 | 3,074,103 | Python's Pygame is certainly a good choice as others have said. If you want to get in to deep video game programming though.. move on to something like C++ or another lower level language.. from experience, most higher level languages tend to put artificial hurdles up in regards to decent video games. Though for a simple 2d game you cant go wrong with python.
another decent environment to use is Ogre3d, but you would need C++ or the PyOgre bindings (which are not up to date, but I hear they do work okay).
Going from web to game design really is a decent step, as long as you have a good sense of design. the physics and game logic can be learned, but ive yet to see anyone who could properly learn how to write a decent GUI.. as is seen in most cases these days, the final GUI lay out tends to be a process of elimination or beta with trial and error.
Only suggestion i have left is keep your game logic as far away as possible from your graphics. Be Modular.
-edit-
oh and a note.. stay away from Tkinter in python for anything more than a simple tool.. I have found it most frustrating to use. there is wxPython, GTK, pygame, and PyQT.. and all of them (in my opinion) are far better graphic frameworks. | 0 | 471 | false | 1 | 1 | From the web to games | 3,075,334 |
1 | 3 | 0 | 2 | 2 | 0 | 0.132549 | 1 | Is there a free open-source solution taking raw e-mail message (as a piece of text) and returning each header field, each attachment and the message body as separate fields? | 0 | java,php,python,email,parsing | 2010-06-20T04:15:00.000 | 0 | 3,078,189 | Yes... For each language you pointed out, I've used the one in Python myself. Try perusing the library documentation for your chosen library.
(Note: You may be expecting a "nice", high-level library for this parsing... That's a tricky area, email has evolved and grown without much design, there are a lot of dark corners, and API's reflect that). | 0 | 873 | false | 0 | 1 | Is there an open-source eMail message (headers, attachments, etc.) parser? | 3,078,197 |
2 | 2 | 0 | 1 | 3 | 0 | 0.099668 | 0 | Portal Technology Assessment in which we will be creating a placement portal for the campuses and industry to help place students. The portal will handle large volumes of data and people logging in, approximately 1000 users/day in a concurrent mode.
What technology should i use? PHP with CakePHP as a framework, Ruby on Rails, ASP.NET, Python, or should I opt for cloud computing? Which of those are the most cost beneficial? | 0 | python,lamp | 2010-06-20T05:58:00.000 | 0 | 3,078,364 | Language choice is important as you must choose language that you and your team feel the most comfortable with as you must develop mid-large size application. Of course use framework with Python it must be Django, with ASP.NET .NET or MVC.NET whatever you feel better with with Ruby ROR and with PHP there are too large amount of frameworks.
1000 concurrent users is not that much, especially it depends what users will do. Places where users will get large amount of data are better to Cache with with any caching engine you want. You need to design application this what so you can easily swap between real DB calls and calls to cache. For that use Data Objects like for Logins create an Object array of course if you need it. Save some information in cookies when user logins for example his last login, password in case he wants to change it, email and such so you will make less calls to DB in read mode ( select queries ).
use cookie less domain for static content like images, js and css files. setup on this domain the fastest system you can with simplest server you can, probably something based on Linux.
For servers, best advice is to either get large machine and set Virtual Boxes on it with vmware or other Linux based solution or to get few servers which is better because if on big server down you lost everything if one of 1 is down you still can do some stuff. Especially if you set railroad mode. Railroad mode is simple you set up Application server (IIS or Apache) on one server and make it master while you set up SQL on the same server and make it slave. On other server you set up SQL as master and Application server as slave. So server one serves IIS/Apache and Other one SQL, if one down you just need to change line in host.etc in order to set something somewhere else ( i don't know how to do that in Linux ).
last server for static content.
Cloud Computing, you will use if you want it or not. You will share resources with some applications as Google API for jquery and jqueryUI for instance but you create unique application and i don't believe making core of application based on cloud computing will do any good. Use large site's CDNs for good. | 0 | 182 | false | 0 | 1 | How to make a cost effective but scalable site? | 3,078,415 |
2 | 2 | 0 | 2 | 3 | 0 | 1.2 | 0 | Portal Technology Assessment in which we will be creating a placement portal for the campuses and industry to help place students. The portal will handle large volumes of data and people logging in, approximately 1000 users/day in a concurrent mode.
What technology should i use? PHP with CakePHP as a framework, Ruby on Rails, ASP.NET, Python, or should I opt for cloud computing? Which of those are the most cost beneficial? | 0 | python,lamp | 2010-06-20T05:58:00.000 | 0 | 3,078,364 | Any of those will do, it really depends on what you know. If you're comfortable with Python, use Django. If you like Ruby go with ROR. These modern frameworks are built to scale, assuming you're not going to be developing something on the scale of facebook then they should suffice.
I personally recommend nginx as your main server to host static content and possibly reverse-proxy to Django/mod_wsgi/Apache2.
Another important aspect is caching, make sure to use something like memcached and make sure the framework has some sort of plugin or it's easily attachable. | 0 | 182 | true | 0 | 1 | How to make a cost effective but scalable site? | 3,078,371 |
2 | 3 | 0 | 0 | 2 | 0 | 0 | 1 | How can I check if a specific ip address or proxy is alive or dead | 0 | python,sockets,proxy | 2010-06-20T09:03:00.000 | 0 | 3,078,704 | An IP address corresponds to a device. You can't "connect" to a device in the general sense. You can connect to services on the device identified by ports. So, you find the ip address and port of the proxy server you're interested in and then try connecting to it using a simple socket.connect. If it connects fine, you can alteast be sure that something is running on that port of that ip address. Then you go ahead and use it and if things are not as you expect, you can make further decisions. | 0 | 4,148 | false | 0 | 1 | how to check if an ip address or proxy is working or not | 3,078,730 |
2 | 3 | 0 | 3 | 2 | 0 | 1.2 | 1 | How can I check if a specific ip address or proxy is alive or dead | 0 | python,sockets,proxy | 2010-06-20T09:03:00.000 | 0 | 3,078,704 | Because there may be any level of filtering or translation between you and the remote host, the only way to determine whether you can connect to a specific host is to actually try to connect. If the connection succeeds, then you can, else you can't.
Pinging isn't sufficient because ICMP ECHO requests may be blocked yet TCP connections might go through fine. | 0 | 4,148 | true | 0 | 1 | how to check if an ip address or proxy is working or not | 3,078,719 |
1 | 2 | 0 | 17 | 9 | 1 | 1.2 | 0 | I have a C++ project which is using boost. The whole project is built using scons + Visual Studio 2008. We've installed Visual Studio 2010 and it turned out scons was attempting to use the later compiler instead of the old one - and failed to build the project as boost and visual studio 2010 don't like each other very much - yet. We'd like to suppress this and force scons to use the 2008 version. Is this possible? How do we do this? | 0 | python,scons | 2010-06-20T13:16:00.000 | 0 | 3,079,344 | You can modify the scons Environment() by just choosing
the version you want:
env = Environment(MSVC_VERSION=<someversion>)
From the scons manpage:
MSVC_VERSION Sets the preferred
version of Microsoft Visual C/C++ to
use.
If $MSVC_VERSION is not set, SCons
will (by default) select the latest
version of Visual C/C++ installed on
your system. If the specified version
isn't installed, tool initialization
will fail. This variable must be
passed as an argument to the
Environment() constructor; setting it
later has no effect. Set it to an
unexpected value (e.g. "XXX") to see
the valid values on your system. | 0 | 2,641 | true | 0 | 1 | Forcing scons to use older compiler? | 3,083,882 |
1 | 4 | 0 | 8 | 8 | 0 | 1.2 | 0 | Is there something like JRuby but for Ruby and Python?
Not that it would actually be useful to me, but just wondering. | 0 | python,ruby | 2010-06-20T14:15:00.000 | 0 | 3,079,531 | If you develop for the .NET Framework Version 4.0, you can write code in IronRuby that calls methods that were written in IronPython and vice versa. | 0 | 662 | true | 1 | 1 | Can I use Ruby and Python together? | 3,079,547 |
1 | 2 | 0 | 0 | 5 | 1 | 0 | 0 | I have wondered about this on and off but I never really got a definite answer. Is it possible within the boost.python framework to link against another boost.python module.
For example I have exported class A within boost_python_module(libA) and function B(A a) within boost_python_module(libB). Is it possible to specify in libB to link to A of libA.
The other way of looking at this problem would be that right now I have to generate all my bindings in one shot within one module. Is it possible to generate bindings incrementally over several boost_python_module. | 0 | c++,boost,boost-python | 2010-06-20T17:19:00.000 | 0 | 3,080,185 | I don't know well shared library, but what works for me is to import all my modules, which can reference with each others, within python: import libA; import libB.
It is of course possible to put these imports in an __init__.py file, so that whitin python you just have to do: import myLib. | 0 | 1,552 | false | 0 | 1 | How to link to existing boost python module | 3,139,385 |
1 | 4 | 1 | -2 | 7 | 1 | -0.099668 | 0 | Am trying to provide a response from a Managers perspective to the question: What overall performance penalty will we incur if we write the application in IronPython instead of C#?
This question is directed at those who might have already undertaken some testing, benchmarking or have completed a migration from C# to IronPython, in order to quantify the penalty. | 0 | ironpython | 2010-06-21T01:27:00.000 | 0 | 3,081,661 | Based on my understanding both languages will be compiled into MSIL so theoretically the performance of the application should be identical or very close, but there is a lot more to it, the human factor.
I can assure you that a program I write in C# could be a lot faster that the same program in iron-python not because C# is faster but because I'm more familiar with C# and I know what choices to make, so if your team is more familiar with C# your application has a better chance at performance if it is written in C# or the other way around.
This is just a personal theory so take it with a grain of salt. | 0 | 8,794 | false | 0 | 1 | Speed of code execution: IronPython vs C#? | 3,082,237 |
1 | 3 | 0 | 1 | 3 | 0 | 0.066568 | 0 | I was wondering if it was possible to pull a private mercurial repo to a server without access to hg. I have SSH access, but do not have the ability to install HG. I was thinking some kind of Python script that used http access or something, but I wasn't sure. I was also thinking this might only be possible with public repos. I am currently hosting the projet on BitBucket. Thanks for any input! | 0 | python,mercurial,bitbucket | 2010-06-21T04:25:00.000 | 0 | 3,082,107 | If you don't have mercurial available locally then you may as well pull the tarball instead, available behind the "get source" option towards the top-right corner of various pages, underneath "Forks/Queues". | 0 | 3,457 | false | 0 | 1 | How to pull a BitBucket repository without access to hg | 3,082,132 |
1 | 1 | 1 | 0 | 0 | 1 | 1.2 | 0 | If it doesn't use ironpython, how C# use cpython program(py file)?
Because there are some bugs that ironpython load cpython code. | 0 | c#,python,cpython | 2010-06-21T08:47:00.000 | 0 | 3,083,167 | If you need strict CPython behavior and do not want to change Python program I am afraid that in this case you should spawn separate CPython process and interact with it via some RPC protocol (there are plenty to choose from) via pipe or network connection to localhost.
As alternative to "serialized" RPC you might use system's facilities e.g. COM if you're on Windows or D-Bus on Linux - but this would make code platform dependent and not necessarily simpler. | 0 | 189 | true | 0 | 1 | How C# use python program? | 3,083,261 |
1 | 5 | 0 | -1 | 14 | 0 | -0.039979 | 0 | I have a VPS Linux webserver with PHP installed.
I want to code some search engine or data mining stuff in one application which I am thinking of building in python.
I want to know if it is possible to use python and php together like calling functions of python in php and vice versa.
As it is my VPS server, I can install anything on that.
Has anyone tried using python in php? Are there any performance issues in real time?? | 0 | php,python | 2010-06-21T11:41:00.000 | 0 | 3,084,303 | Better you have to do, use api, different application like one application on python server having python application and one server having php application with api. Like you store or delete data by using api in android or ios. | 0 | 31,647 | false | 0 | 1 | Is it possible to use Python with php | 69,296,576 |
1 | 6 | 0 | 0 | 2 | 0 | 0 | 0 | I have read in the documentation that there are 4 or 5 ways in which i can python for web pages. Like
With CGI
Mod_python : mod_python does have some problems. Unlike the PHP interpreter, the Python interpreter uses caching when executing files, so changes to a file will require the web server to be restarted
FastCGI and SCGI
mod_wsgi
SO which way should i go . does it means that python is not for webistes if there are too many problems while using it
I have to build the live business website with thousands of users so i should not use it if that has many probelms | 0 | python | 2010-06-22T00:41:00.000 | 0 | 3,089,450 | You could also use Google App Engine with Python and Django | 0 | 825 | false | 0 | 1 | How to use python on webserver for web pages | 3,089,472 |
2 | 2 | 0 | 1 | 0 | 0 | 1.2 | 0 | Buildbots Periodic scheduler triggers builds at fixed intervals (e.g. every 30 minutes). But there are certain times (e.g. at night, during the weekend or while regular maintenance is performed) where I'd like it to relax.
Is there a way to have a more fine-grained description for the Periodic scheduler? Or should I rather use the Nightly scheduler and explicitly list all build trigger times I need for the whole week? | 0 | python,continuous-integration,build-automation,buildbot,nightly-build | 2010-06-22T13:36:00.000 | 0 | 3,093,598 | If you use Nightly, then you can specify that the scheduler only trigger if there are interesting changes to build. Presumably, you won't have commits during that period either, so it will not trigger builds then. | 0 | 56 | true | 0 | 1 | Exceptions from Buildbots PeriodicScheduler intervals? | 12,307,055 |
2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | Buildbots Periodic scheduler triggers builds at fixed intervals (e.g. every 30 minutes). But there are certain times (e.g. at night, during the weekend or while regular maintenance is performed) where I'd like it to relax.
Is there a way to have a more fine-grained description for the Periodic scheduler? Or should I rather use the Nightly scheduler and explicitly list all build trigger times I need for the whole week? | 0 | python,continuous-integration,build-automation,buildbot,nightly-build | 2010-06-22T13:36:00.000 | 0 | 3,093,598 | One way to solve this would of course be to write a piece of python code that generates the build times for up the nightly scheduler according to some rules. | 0 | 56 | false | 0 | 1 | Exceptions from Buildbots PeriodicScheduler intervals? | 6,169,869 |
2 | 2 | 0 | 0 | 2 | 1 | 0 | 0 | I'm working on an IronPython project on VS2010 and I've notice that for the python project (which is setup as a Console project, but really just contains a number of scripts that are hosted in a C# app), everything that is in the project directory will show up in the VS solution explorer under that project. So, for example, the .svn folder shows up. Which I obviously don't want or need to be there.
Is there any way to tell it to hide specific items? I sure can't find one. | 0 | visual-studio-2010,ironpython | 2010-06-22T15:37:00.000 | 0 | 3,094,693 | You should be able to just right click the folder, choose "Exclude from Project"
Then, make sure "Show all files" is NOT on at the top, by the solution. | 0 | 284 | false | 0 | 1 | Hide .svn folders in a VS2010 IronPython project | 3,094,718 |
2 | 2 | 0 | 2 | 2 | 1 | 1.2 | 0 | I'm working on an IronPython project on VS2010 and I've notice that for the python project (which is setup as a Console project, but really just contains a number of scripts that are hosted in a C# app), everything that is in the project directory will show up in the VS solution explorer under that project. So, for example, the .svn folder shows up. Which I obviously don't want or need to be there.
Is there any way to tell it to hide specific items? I sure can't find one. | 0 | visual-studio-2010,ironpython | 2010-06-22T15:37:00.000 | 0 | 3,094,693 | Currently we have a directory based project system - which as you have seen includes all of the files in the project dir. We were planning on having an exclude option but the feedback we've been hearing so far is that we should move to a normal VS project model where you need to explicitly add the files. The next CTP release (which should be out in a week or so) will change to a normal project model.
There does still seem to be some interest in the directory based model so we may bring it back via an option in a future version. | 0 | 284 | true | 0 | 1 | Hide .svn folders in a VS2010 IronPython project | 3,098,784 |
2 | 5 | 0 | 0 | 4 | 0 | 0 | 0 | somewhat open ended question here as I am mostly looking for opinions. I am grabbing some data from craigslist for apt ads in my area since I am looking to move. My goal is to be able to compare items to see when something is a duplicate so that I don't spend all day looking at the same 3 ads. The problem is that they change things around a little to get past CL's filters.
I already have some regex to look for address and phone numbers to compare, but that isn't the most reliable. Is anyone familiar with an easy-ish method to compare the whole document and maybe show something simple like "80% similar"? I can't think of anything offhand, so I suspect I'll have to start from scratch on my own solution, but figured it would be worth asking the collective genius of stackoverflow :)
Preferred languages/methods would be python/php/perl, but if it's a great solution I'm pretty open.
Update: one thing worth noting is that since I will be storing the scraped data of the rss feed for apts in my area (los angeles) in a local DB, the preferred method would include a way to compare it to everything I currently know. This could be a bit of a showstopper since that could become a very long process as the post counts grow. | 0 | php,python,sql,regex,perl | 2010-06-22T16:23:00.000 | 0 | 3,095,057 | If you wanted to do this a lot and with some reliability, you might want to use a semi-advanced approach like a "bag of words" technique. I actually sat down and wrote a sketch of a more-or-less working (if horribly unoptimized) algorithm to do it, but I'm not sure if it would really be appropriate to include here. There are pre-made libraries that you can use for text classification instead. | 0 | 387 | false | 0 | 1 | What is the easiest method to compare large amounts of similar text? | 3,209,792 |
2 | 5 | 0 | 2 | 4 | 0 | 1.2 | 0 | somewhat open ended question here as I am mostly looking for opinions. I am grabbing some data from craigslist for apt ads in my area since I am looking to move. My goal is to be able to compare items to see when something is a duplicate so that I don't spend all day looking at the same 3 ads. The problem is that they change things around a little to get past CL's filters.
I already have some regex to look for address and phone numbers to compare, but that isn't the most reliable. Is anyone familiar with an easy-ish method to compare the whole document and maybe show something simple like "80% similar"? I can't think of anything offhand, so I suspect I'll have to start from scratch on my own solution, but figured it would be worth asking the collective genius of stackoverflow :)
Preferred languages/methods would be python/php/perl, but if it's a great solution I'm pretty open.
Update: one thing worth noting is that since I will be storing the scraped data of the rss feed for apts in my area (los angeles) in a local DB, the preferred method would include a way to compare it to everything I currently know. This could be a bit of a showstopper since that could become a very long process as the post counts grow. | 0 | php,python,sql,regex,perl | 2010-06-22T16:23:00.000 | 0 | 3,095,057 | You could calculate the Levenshtein difference between both strings - after some sane normalizing like minimizing duplicate whitespace and what not. After you run through enough "duplicates" you should get an idea of what your threshold is - then you can run Levenshtein on all new incoming data and if its less-than-equal to your threshold than you can consider it a duplicate. | 0 | 387 | true | 0 | 1 | What is the easiest method to compare large amounts of similar text? | 3,209,571 |
5 | 6 | 0 | 7 | 222 | 1 | 1 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | 0 | python,python-import | 2010-06-22T16:24:00.000 | 0 | 3,095,071 | Importing inside a function will effectively import the module once.. the first time the function is run.
It ought to import just as fast whether you import it at the top, or when the function is run. This isn't generally a good reason to import in a def. Pros? It won't be imported if the function isn't called.. This is actually a reasonable reason if your module only requires the user to have a certain module installed if they use specific functions of yours...
If that's not he reason you're doing this, it's almost certainly a yucky idea. | 0 | 145,145 | false | 0 | 1 | In Python, what happens when you import inside of a function? | 3,095,108 |
5 | 6 | 0 | 8 | 222 | 1 | 1 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | 0 | python,python-import | 2010-06-22T16:24:00.000 | 0 | 3,095,071 | Might I suggest in general that instead of asking, "Will X improve my performance?" you use profiling to determine where your program is actually spending its time and then apply optimizations according to where you'll get the most benefit?
And then you can use profiling to assure that your optimizations have actually benefited you, too. | 0 | 145,145 | false | 0 | 1 | In Python, what happens when you import inside of a function? | 3,096,179 |
5 | 6 | 0 | 3 | 222 | 1 | 0.099668 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | 0 | python,python-import | 2010-06-22T16:24:00.000 | 0 | 3,095,071 | It imports once when the function is called for the first time.
I could imagine doing it this way if I had a function in an imported module that is used very seldomly and is the only one requiring the import. Looks rather far-fetched, though... | 0 | 145,145 | false | 0 | 1 | In Python, what happens when you import inside of a function? | 3,095,106 |
5 | 6 | 0 | 20 | 222 | 1 | 1 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | 0 | python,python-import | 2010-06-22T16:24:00.000 | 0 | 3,095,071 | It imports once when the function executes first time.
Pros:
imports related to the function they're used in
easy to move functions around the package
Cons:
couldn't see what modules this module might depend on | 0 | 145,145 | false | 0 | 1 | In Python, what happens when you import inside of a function? | 3,095,095 |
5 | 6 | 0 | 55 | 222 | 1 | 1 | 0 | What are the pros and cons of importing a Python module and/or function inside of a function, with respect to efficiency of speed and of memory?
Does it re-import every time the function is run, or perhaps just once at the beginning whether or not the function is run? | 0 | python,python-import | 2010-06-22T16:24:00.000 | 0 | 3,095,071 | The very first time you import goo from anywhere (inside or outside a function), goo.py (or other importable form) is loaded and sys.modules['goo'] is set to the module object thus built. Any future import within the same run of the program (again, whether inside or outside a function) just look up sys.modules['goo'] and bind it to barename goo in the appropriate scope. The dict lookup and name binding are very fast operations.
Assuming the very first import gets totally amortized over the program's run anyway, having the "appropriate scope" be module-level means each use of goo.this, goo.that, etc, is two dict lookups -- one for goo and one for the attribute name. Having it be "function level" pays one extra local-variable setting per run of the function (even faster than the dictionary lookup part!) but saves one dict lookup (exchanging it for a local-variable lookup, blazingly fast) for each goo.this (etc) access, basically halving the time such lookups take.
We're talking about a few nanoseconds one way or another, so it's hardly a worthwhile optimization. The one potentially substantial advantage of having the import within a function is when that function may well not be needed at all in a given run of the program, e.g., that function deals with errors, anomalies, and rare situations in general; if that's the case, any run that does not need the functionality will not even perform the import (and that's a saving of microseconds, not just nanoseconds), only runs that do need the functionality will pay the (modest but measurable) price.
It's still an optimization that's only worthwhile in pretty extreme situations, and there are many others I would consider before trying to squeeze out microseconds in this way. | 0 | 145,145 | false | 0 | 1 | In Python, what happens when you import inside of a function? | 3,095,167 |
1 | 1 | 0 | 0 | 0 | 1 | 1.2 | 0 | Short of essentially rewriting copytree to accept an ignore callback, what is a simple way to achieve this in versions prior to python 2.6? (I don't want to stray from my debian packages) | 0 | python,python-2.5,shutil,copytree | 2010-06-23T21:37:00.000 | 0 | 3,105,747 | You can copy the source for copytree from the 2.6 tree, and put it into your project's source tree. | 0 | 456 | true | 0 | 1 | Python: shutil.copytree , lack of ignore arg in python 2.5 | 3,105,771 |
1 | 5 | 0 | 6 | 6 | 0 | 1.2 | 0 | My test framework is currently based on a test-runner utility which itself is derived from the Eclipse pydev python test-runner. I'm switching to use Nose, which has many of the features of my custom test-runner but seems to be better quality code.
My test suite includes a number of abstract test-classes which previously never ran. The standard python testrunner (and my custom one) only ran instances of unittest.TestCase and unittest.TestSuite.
I've noticed that since I switched to Nose it's running just about anything which starts withthe name "test" which is annoying... because the naming convention we used for the test-mixins also looks like a test class to Nose. Previously these never ran as tests because they were not instances of TestCase or TestSuite.
Obviously I could re-name the methods to exclude the word "test" from their names... that would take a while because the test framework is very big and has a lot of inheritance. On the other hand it would be neat if there was a way to make Nose only see TestCases and TestSuites as being runnable... and nothing else.
Can this be done? | 0 | python,unit-testing,nose | 2010-06-24T14:37:00.000 | 0 | 3,110,967 | You could try to play with -m option for nosetests. From documentation:
A test class is a class defined in a
test module that matches testMatch or
is a subclass of unittest.TestCase
-m sets that testMatch, this way you can disable testing anything starting with test.
Another thing is that you can add __test__ = False to your test case class declaration, to mark it “not a test”. | 0 | 2,498 | true | 0 | 1 | Is it possible to make Nose only run tests which are sub-classes of TestCase or TestSuite (like unittest.main()) | 3,118,573 |
2 | 3 | 0 | 10 | 3 | 0 | 1.2 | 0 | I'm beginning to learn some Hadoop/MapReduce, coming mostly from a PHP background, with a little bit of Java and Python.
But, it seems like most implementations of MapReduce out there are in Java, Ruby, C++ or Python.
I've looked, and it looks like there are some Hadoop/MapReduce in PHP, but the overwhelming body of the literature seems to be dedicated to those 4 languages.
Is there a good reason why PHP is a 2nd class language in cloud computing projects like those that involve Hadoop/MapReduce? This is particularly surprising, considering that, outside of cloud computing world, PHP seems like its the most commonly supported language, to the detriment of the 3 above (sans C++) languages.
If this is arbitrary--if PHP is just as good at handling these operations as, say, Python, what libraries/projects should I look into? | 0 | java,php,python,hadoop,mapreduce | 2010-06-24T20:18:00.000 | 1 | 3,113,573 | PHP is designed primarily as a language for displaying output to a browser. Most jobs being run on MapReduce/Hadoop clusters have nothing to do with displaying output.
They instead tend to lean much more heavily towards data processing. PHP is not the most commonly supported language for data processing, by far. Thus, it's logical that the most common supported languages for data processing-related technologies don't include PHP. | 0 | 906 | true | 1 | 1 | PHP vs. Other Languages in Hadoop/MapReduce implementations, and in the Cloud generally | 3,113,643 |
2 | 3 | 0 | 1 | 3 | 0 | 0.066568 | 0 | I'm beginning to learn some Hadoop/MapReduce, coming mostly from a PHP background, with a little bit of Java and Python.
But, it seems like most implementations of MapReduce out there are in Java, Ruby, C++ or Python.
I've looked, and it looks like there are some Hadoop/MapReduce in PHP, but the overwhelming body of the literature seems to be dedicated to those 4 languages.
Is there a good reason why PHP is a 2nd class language in cloud computing projects like those that involve Hadoop/MapReduce? This is particularly surprising, considering that, outside of cloud computing world, PHP seems like its the most commonly supported language, to the detriment of the 3 above (sans C++) languages.
If this is arbitrary--if PHP is just as good at handling these operations as, say, Python, what libraries/projects should I look into? | 0 | java,php,python,hadoop,mapreduce | 2010-06-24T20:18:00.000 | 1 | 3,113,573 | The reason is PHP lack of support for multi-threading and process communication. | 0 | 906 | false | 1 | 1 | PHP vs. Other Languages in Hadoop/MapReduce implementations, and in the Cloud generally | 3,113,644 |
2 | 4 | 0 | 1 | 2 | 1 | 0.049958 | 0 | With Python, I could get the name of the exception easily as follows.
run the code, i.e. x = 3/0 to get the exception from python
"ZeroDivisionError: integer division or modulo by zero" tells me this is ZeroDivisionError
Modify the code i.e. try: x=3/0 except ZeroDivisionError: DO something
Is there any similar way to find the exception name with C++?
When I run the x = 3/0, the compiled binary just throws 'Floating point exception', which is not so useful compared to python. | 0 | c++,python,exception-handling | 2010-06-24T21:15:00.000 | 0 | 3,113,929 | If you want to know the name of the exception class, you could use RTTI. However, the vast majority of C++ code will throw an exception derived from std::exception.
However, all you get is the exception data contained in std::exception::what, and you can get the name of the exception class from RTTI and catch that explicitly if you need more information (and it contains more information). | 0 | 940 | false | 0 | 1 | How can I know the name of the exception in C++? | 3,113,950 |
2 | 4 | 0 | 1 | 2 | 1 | 0.049958 | 0 | With Python, I could get the name of the exception easily as follows.
run the code, i.e. x = 3/0 to get the exception from python
"ZeroDivisionError: integer division or modulo by zero" tells me this is ZeroDivisionError
Modify the code i.e. try: x=3/0 except ZeroDivisionError: DO something
Is there any similar way to find the exception name with C++?
When I run the x = 3/0, the compiled binary just throws 'Floating point exception', which is not so useful compared to python. | 0 | c++,python,exception-handling | 2010-06-24T21:15:00.000 | 0 | 3,113,929 | If this is a debugging issue, you may be able to set your compiler to break when it hits an exception, which can be infinitely useful. | 0 | 940 | false | 0 | 1 | How can I know the name of the exception in C++? | 3,114,002 |
1 | 1 | 0 | 3 | 3 | 0 | 1.2 | 0 | Has anyone ever worked with MIL-STD-1553 in Python? How did you do it? | 0 | python | 2010-06-25T14:59:00.000 | 0 | 3,119,027 | If the 1553 interface has a Windows DLL, you can use the ctypes library to access it. I've done this for Python and my organization's 1553 products.
To start, I would write a quick test that accesses a DLL function that doesn't access the 1553 hardware, or accesses the hardware in a very simple manner. If that succeeds, then you know that you can access the DLL. Once you know you can access the DLL then you can work on getting the rest of the DLL functions to work in Python. | 0 | 1,487 | true | 0 | 1 | Tips on Python MIL-STD-1553 | 3,120,074 |
1 | 2 | 0 | 1 | 0 | 0 | 1.2 | 1 | Are there any equivalents in objective-c to the following python urllib2 functions?
Request, urlopen, HTTPError, HTTPCookieProRequest, urlopen, HTTPError, HTTPCookieProcessor
Also, how would I able to to this and change the method from "get" to "post"? | 0 | python,objective-c | 2010-06-25T18:23:00.000 | 0 | 3,120,430 | NSMutableHTTPURLRequest, a category of NSMutableURLRequest, is how you set up an HTTP request. Using that class you will specify a method (GET or POST), headers and a url.
NSURLConnection is how you open the connection. You will pass in a request and delegate, and the delegate will receive data, errors and messages related to the connection as they become available.
NSHTTPCookieStorage is how you manage existing cookies. There are a number of related classes in the NSHTTPCookie family.
With urlopen, you open a connection and read from it. There is no direct equivalent to that unless you use something lower level like CFReadStreamCreateForHTTPRequest. In Objective-C everything is passive, where you are notified when events occur on the stream. | 0 | 632 | true | 0 | 1 | Is there an Objective-C equivalent to Python urllib and urllib2? | 3,120,602 |
3 | 6 | 1 | 1 | 1 | 0 | 0.033321 | 0 | I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.
I want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Python programming for S60 3.1 platform? | 0 | c++,python,symbian,pys60 | 2010-06-26T09:15:00.000 | 0 | 3,123,340 | C++ is very, very fast, and the Qt library is for C++. If you're programming on a mobile phone, Python will be very slow and you'll have to spend ages writing bindings for it. | 0 | 1,021 | false | 0 | 1 | PyS60 vs Symbian C++ | 3,123,427 |
3 | 6 | 1 | 1 | 1 | 0 | 0.033321 | 0 | I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.
I want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Python programming for S60 3.1 platform? | 0 | c++,python,symbian,pys60 | 2010-06-26T09:15:00.000 | 0 | 3,123,340 | I answer this as a user.
PyS60 is slow and not so much app and sample to start with.
C++ is good, native, fast, but if you mind deevelop app for most device (current N-series), you will not want to go with Qt, I have a N78 and tested Qt in N82 too, it's slow (more than Python, sadly but true) | 0 | 1,021 | false | 0 | 1 | PyS60 vs Symbian C++ | 3,124,371 |
3 | 6 | 1 | 0 | 1 | 0 | 0 | 0 | I'm planning some Symbian related development on S60 3.1 platform. It seems like generally available language options are Python and C++. However Nokia's official forum seems very much tilted towards C++.
I want to know what are the advantages and disadvantages of using Python for S60 over Symbian C++? And is it even possible to do Python programming for S60 3.1 platform? | 0 | c++,python,symbian,pys60 | 2010-06-26T09:15:00.000 | 0 | 3,123,340 | What is the purpose of your programming? Are you planning distribute your app through Ovi Store? If so, you should use a tool that could be tested and signed by Symbian Signed.
What does it mean? As far as I know, they don't provide such functionality for Python. So you have to choose native Symbian C++ or Qt.
By the way, Qt signing procedure is not quite clear for now. It seems Ovi Store and Symbian Signed are only allow Qt apps for a certain devices (Nokia X6, Nokia N97 mini, maybe some other). I suppose it is a subject for a change, and quite fast change, but you should consider this too. | 0 | 1,021 | false | 0 | 1 | PyS60 vs Symbian C++ | 3,131,900 |
2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | I have a somewhat unique request. What I am looking to do is listen on a specific port for all traffic coming through via IRC protocol. I then want to log all of those messages/commands/ect. I do not, however, want to join the channel. I just want to listen and log. Is there an easy built in way to do this? I have been looking at the irc.IRC and irc.IRCClient classes in twisted but they both seem too high level to do this. Is the only way to do this to simply descend to the base Server class, or can I still leverage some of the higher level functionality of twisted? | 0 | python,twisted,logging,irc | 2010-06-27T16:41:00.000 | 1 | 3,128,025 | I don't think you can do this if you just connect to a server... the servers don't send you messages for channels you haven't joined. Or are you the host of the server? | 0 | 617 | false | 0 | 1 | How to Log All IRC data on Channel Using Twisted? | 3,128,285 |
2 | 2 | 0 | 1 | 0 | 0 | 1.2 | 0 | I have a somewhat unique request. What I am looking to do is listen on a specific port for all traffic coming through via IRC protocol. I then want to log all of those messages/commands/ect. I do not, however, want to join the channel. I just want to listen and log. Is there an easy built in way to do this? I have been looking at the irc.IRC and irc.IRCClient classes in twisted but they both seem too high level to do this. Is the only way to do this to simply descend to the base Server class, or can I still leverage some of the higher level functionality of twisted? | 0 | python,twisted,logging,irc | 2010-06-27T16:41:00.000 | 1 | 3,128,025 | We addressed this issue in a somewhat round about way. We worked off a generic hexdumping proxy server constructed in twisted and then created finer detail parsing algorithms off of that. | 0 | 617 | true | 0 | 1 | How to Log All IRC data on Channel Using Twisted? | 5,207,277 |
2 | 2 | 1 | 7 | 2 | 1 | 1 | 0 | We all knows that C# is a static language while Python is a dynamic language. But I want to know what are the features that Python has and c# does not. Also, is it advisable/beneficial to use IronPython with c# in the same application?
Also what points I should focus to learn before I try to convince my boss to use IronPython? | 0 | c#,architecture,ironpython | 2010-06-28T10:46:00.000 | 0 | 3,131,703 | One of IronPython's key advantages is in its function as an extensibility layer to application frameworks written in a .NET language. It is relatively simple to integrate an IronPython interpreter into an existing .NET application framework. Once in place, downstream developers can use scripts written in IronPython that interact with .NET objects in the framework, thereby extending the functionality in the framework's interface, without having to change any of the framework's code base.
IronPython makes extensive use of reflection. When passed in a reference to a .NET object, it will automatically import the types and methods available to that object. This results in a highly intuitive experience when working with .NET objects from within an IronPython script.
Source - Wikipedia | 0 | 995 | false | 0 | 1 | Why should C# developer learn IronPython? | 3,131,716 |
2 | 2 | 1 | 7 | 2 | 1 | 1.2 | 0 | We all knows that C# is a static language while Python is a dynamic language. But I want to know what are the features that Python has and c# does not. Also, is it advisable/beneficial to use IronPython with c# in the same application?
Also what points I should focus to learn before I try to convince my boss to use IronPython? | 0 | c#,architecture,ironpython | 2010-06-28T10:46:00.000 | 0 | 3,131,703 | In other words, what points I can give to my boss to convince him to use IronPython?
Don't. If you don't know why you should use a new tool and for what, don't try to convice anybody to use it. At work, you should try to solve problems with the best tools for the task, not throw the fanciest tools avaiable at your problems just because they're fancy.
Learn IronPython, maybe make a small side project in it, find out what the strenghts are. Then if you think these strengths are useful for the project you're working on (e.g. for "glue code", plugins, macros etc.), convice your boss to use them. | 0 | 995 | true | 0 | 1 | Why should C# developer learn IronPython? | 3,131,741 |
3 | 9 | 0 | 13 | 9 | 1 | 1 | 0 | I've been playing mostly with PHP and Python.
I've been reading about Interfaces in OO programming and can't see an advantage in using it.
Multiple objects can implement the same interface, but multiple inheritance doesn't provide this as well?
Why do I need to create an Interface "with no implementation" - mainly a "contract" - if I can just check if a method exists in an object in Python, that inherits from multiple classes?
Do Interfaces were created in another languages because they don't provide multiple inheritance? Or am I missing something more important here? | 0 | php,python,oop,interface | 2010-06-28T17:12:00.000 | 0 | 3,134,531 | First, and foremost, try not to compare and contrast between Python and Java. They are different languages, with different semantics. Compare and contrast will only lead to confusing questions like this where you're trying to compare something Python doesn't use with something Java requires.
It's a lot like comparing the number 7 and the color green. They're both nouns. Beyond that, you're going to have trouble comparing the two.
Here's the bottom line.
Python does not need interfaces.
Java requires them.
Multiple objects can implement the same interface, but multiple inheritance doesn't provide this as well?
The two concepts have almost nothing to do with each other.
I can define a large number of classes which share a common interface. In Python, because of "duck typing", I don't have to carefully be sure they all have a common superclass.
An interface is a declaration of "intent" for disjoint class hierarchies. It provides a common specification (that can be checked by the compiler) that is not part of the simple class hierarchy. It allows multiple class hierarchies to implement some common features and be polymorphic with respect to those features.
In Python you can use multiple inheritance with our without interfaces. Multiple inheritance can include interface classes or not include interface classes.
Java doesn't even have multiple inheritance. Instead it uses a completely different technique called "mixins".
Why do I need to create an Interface "with no implementation" - mainly a "contract" - if I can just check if a method exists in an object in Python, that inherits from multiple classes?
If you create an interface in Python, it can be a kind of formal contract. A claim that all subclasses will absolutely do what the interface claims.
Of course, a numbskull is perfectly free to lie. They can inherit from an interface and mis-implement everything. Nothing prevents bad behavior from sociopaths.
You create an interface in Java to allow multiple classes of objects to have a common behavior. Since you don't tell the compiler much in Python, the concept doesn't even apply.
Do Interfaces were created in another languages because they don't provide multiple inheritance?
Since the concepts aren't related, it's hard to answer this.
In Java, they do use "mixin" instead of multiple inheritance. The "interface" allows some mixing-in of additional functionality. That's one use for an interface.
Another use of an Interface to separate "is" from "does". The class hierarchy defines what an objects IS. The interface hierarchy defines what a class DOES.
In most cases, IS and DOES are isomorphic, so there's no distinction.
In some cases, what an object IS and what an object DOES are different. | 0 | 1,276 | false | 0 | 1 | Are Interfaces just "Syntactic Sugar"? | 3,134,623 |
3 | 9 | 0 | 5 | 9 | 1 | 0.110656 | 0 | I've been playing mostly with PHP and Python.
I've been reading about Interfaces in OO programming and can't see an advantage in using it.
Multiple objects can implement the same interface, but multiple inheritance doesn't provide this as well?
Why do I need to create an Interface "with no implementation" - mainly a "contract" - if I can just check if a method exists in an object in Python, that inherits from multiple classes?
Do Interfaces were created in another languages because they don't provide multiple inheritance? Or am I missing something more important here? | 0 | php,python,oop,interface | 2010-06-28T17:12:00.000 | 0 | 3,134,531 | Even in duck-typed languages like Python, an interface can be a clearer statement of your intent. If you have a number of implementations, and they share a set of methods, an interface can be a good way to document the external behavior of those methods, give the concept a name, and make the concept concrete.
Without the explicit interface, there's an important concept in your system that has no physical representation. This doesn't mean you have to use interfaces, but interfaces provide that concreteness. | 0 | 1,276 | false | 0 | 1 | Are Interfaces just "Syntactic Sugar"? | 3,134,569 |
3 | 9 | 0 | 0 | 9 | 1 | 0 | 0 | I've been playing mostly with PHP and Python.
I've been reading about Interfaces in OO programming and can't see an advantage in using it.
Multiple objects can implement the same interface, but multiple inheritance doesn't provide this as well?
Why do I need to create an Interface "with no implementation" - mainly a "contract" - if I can just check if a method exists in an object in Python, that inherits from multiple classes?
Do Interfaces were created in another languages because they don't provide multiple inheritance? Or am I missing something more important here? | 0 | php,python,oop,interface | 2010-06-28T17:12:00.000 | 0 | 3,134,531 | It's generally implemented to replace multiple inheritance (C#).
I think some languages/programmers use them as a way of enforcing requirements for object structure as well. | 0 | 1,276 | false | 0 | 1 | Are Interfaces just "Syntactic Sugar"? | 3,134,554 |
1 | 2 | 0 | 1 | 4 | 0 | 0.099668 | 0 | I'm looking for a way to implement SSH Dynamic Port Forwarding ('ssh -D') under Python. The problem is that it has to work under Windows, i.e., running SSH with popen/pexec/etc. won't work. Any ideas?
cheers,
Bruno Nery. | 0 | python,windows,ssh,tunneling,ssh-tunnel | 2010-06-29T13:28:00.000 | 1 | 3,141,063 | There are ssh executables for Windows, so you can uses the subprocess.Popen approach. This is not exactly elegant, a pure Python approach would be better. | 0 | 1,634 | false | 0 | 1 | SSH Dynamic Port Forwarding ('ssh -D') in Python | 3,141,104 |
1 | 4 | 0 | 4 | 20 | 0 | 0.197375 | 0 | I'm lucky enough to have full control over the architecture of my company's app, and I've decided to scrap our prototype written in Ruby/Rails and start afresh in Python. This is for a few reasons: I want to learn Python, I prefer the syntax and I've basically said "F**k it, let's do it."
So, baring in mind this is going to be a pretty intensive app, I'd like to hear your opinions on the following:
Generic web frameworks
ORM/Database Layer (perhaps to work with MongoDB)
RESTful API w/ oAuth/xAuth authentication
Testing/BDD support
Message queue (I'd like to keep this in Python if possible)
The API is going to need to interface with a Clojure app to handle some internal data stuff, and interface with the message queue, so if it's not Python it'd be great to have some libraries to it.
TDD/BDD is very important to me, so the more tested, the better!
It'll be really interesting to read your thoughts on this. Much appreciated.
My best,
Jamie | 0 | python,orm,rest,frameworks | 2010-06-29T17:18:00.000 | 0 | 3,143,115 | I'm new to python myself, and plan to get more in depth with it this year. I've had a few false starts at this, but always professional needs bring me back to PHP. The few times I've done some development, I've had really good experiences with web2py as a python framework. It's quite well done, and complete in features, while still being extremely lightweight. The database layer seems to be very flexible and mature.
As for TDD/BDD and the rest of your questions, I don't have any experience with python options, but would be interested to hear what others say. | 0 | 4,392 | false | 1 | 1 | Architecting from scratch in Python: what to use? | 3,143,591 |
1 | 4 | 0 | 0 | 3 | 0 | 1.2 | 0 | sometime due to wrong input from user side, mail bounce and did not reach the recipient. ( sent from google app engine.)
How to detect such email ?
edit:
may be i was not clear in my question :
I want to know to which mail i have sent the mail which was return ( so that i may alert the user or delete the email id ). this is more related to how email bounce works. normally the bounce mail does not come exactly same as sent but with different information, is there any particular header or something there to know which email id was that ? ... i think i have figure out while writing these, i am keeping this question so it might help somebody.
i will simply mail from [email protected] and create a mail receive handler. :)
so one more question : what is the maximum length does app-engine ( or any mail server ) allows for email address ? | 0 | python,google-app-engine,email | 2010-06-30T07:38:00.000 | 1 | 3,147,267 | easiest is to encode an email address via base64 or simiar encoding and prefixed it to from address.
all address from [email protected] are valid email address for from in gae.
simply create a mail receive handler. decode the from string and get the email address to whom you send the email originally.
sad thing is maximum 64 character length allowed for local part. in that case storing email address in datastore and using its key as a local part to email can be a option. | 0 | 1,227 | true | 1 | 1 | how to detect bounce mail in google app engine? | 3,194,130 |
2 | 3 | 0 | 0 | 1 | 0 | 0 | 0 | Is it possible to use Python (specifically Pygments) with PHP? Currently, I have a phpBB forum that I'm developing for and JS Syntax Highlighters just haven't been working for me. There's already a GeSHI mod, but I want to develop something myself just for experience.
Also, would there be performance issues? | 0 | php,python,phpbb,pygments | 2010-06-30T22:46:00.000 | 0 | 3,153,961 | If you're interested in diving into Python, you could write an external script or server application to update new posts with syntax-highlighted code. If it were me, I'd retain the original code in one database column and place the syntax-highlighted version in another.
A simple script to update new posts in batches could run as a cron job at whatever interval you find ideal.
To support a near real-time scenario, you could write a server application that sits and waits to be notified of new posts one at a time. For example, upon processing a new post, the PHP application could send the highlighting application a message through an AMQP queue. | 0 | 2,098 | false | 0 | 1 | Using Pygments with PHP (Python in PHP) | 5,054,521 |
2 | 3 | 0 | 1 | 1 | 0 | 1.2 | 0 | Is it possible to use Python (specifically Pygments) with PHP? Currently, I have a phpBB forum that I'm developing for and JS Syntax Highlighters just haven't been working for me. There's already a GeSHI mod, but I want to develop something myself just for experience.
Also, would there be performance issues? | 0 | php,python,phpbb,pygments | 2010-06-30T22:46:00.000 | 0 | 3,153,961 | Pretty much the only way to perform that integration (with PHP as the dominant language) is to shell out. This means starting python manually every time you need it.
That can be a little slow if you need to do it a lot. You can mitigate this by creating the syntax hilite when posts are created or edited, not when viewing. | 0 | 2,098 | true | 0 | 1 | Using Pygments with PHP (Python in PHP) | 3,154,550 |
1 | 1 | 0 | 2 | 0 | 0 | 1.2 | 0 | I wrote a function that copies the /etc/skel directory on a linux machine during a "create new user" RPC call. Now, there is quite a few things about this I want to test, for example the files in /etc/skel and the targets of symlinks should not have changed permissions afterwards, whereas the copied files including the actual symlinks should have a changed owner. Now, i can create my test directory and files using mkdtemp and stuff, but I can't chown those to another user without root privileges. How would you write a test for this? | 0 | python,linux,testing | 2010-07-01T07:17:00.000 | 1 | 3,155,748 | You could make an object which does the chmod, and inject a mock when testing. This mock would not really do the chmod, but make it possible to test if it was called with the right parameters. | 0 | 177 | true | 0 | 1 | How to test a function that deals with setting file ownership without being root | 3,155,835 |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | hi all, how you must configure Apache 2.2 or mod_python?, to avoid the following error:
MOD_PYTHON ERROR
ProcessId: 5399
Interpreter: '127.0.1.1'
ServerName: '127.0.1.1'
DocumentRoot: '/var/www'
URI: '/cgi-bin/wps/'
Location: None
Directory: '/usr/lib/cgi-bin/'
Filename: '/usr/lib/cgi-bin/wps/'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'pywps'
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line 1206, in _process_target
object = apache.resolve_object(module, object_str, arg, silent=silent)
File "/usr/lib/python2.6/dist-packages/mod_python/apache.py", line 696, in resolve_object
raise AttributeError, s
AttributeError: module '/usr/local/lib/python2.6/dist-packages/pywps/init.pyc' contains no 'handler'
this is for a configuration (ubuntu (10.4)) for AMD64.
thanks for your answers | 0 | python,apache2,mod-python,ubuntu-10.04 | 2010-07-02T20:34:00.000 | 1 | 3,168,963 | In my case, changing
PythonHandler pywps
to
PythonHandler wps
in the .htaccess (or the apache configuration file) fixed the problem.
I think that the file pywps.py has been renamed to wps.py, and this gives problems, since the sample configuration file has been left with the old name. | 0 | 1,196 | false | 0 | 1 | correct configuration for apache and mod_python | 11,032,693 |
1 | 6 | 0 | 3 | 5 | 0 | 0.099668 | 0 | I have to develop an application where I need to send SMS to the users on a particular action by the users.
I have heard of kannel with PHP, is there some help for the same in Python as well or is there any other better open source sms gateway which I can use with my application?
Please suggest.
Thanks in advance. | 0 | python,django,sms | 2010-07-03T17:47:00.000 | 0 | 3,172,291 | Typically you would use normal HTTP GET or POST requests against an SMS Gateway, such as Clickatell and many many others. | 0 | 4,227 | false | 1 | 1 | How to send SMS using Python/Django application? | 3,172,331 |
1 | 4 | 0 | 0 | 4 | 0 | 0 | 0 | What would be the best way to execute shell commands on remote servers and get output without actually logging in.
Maybe with shh keys. Preferably with python. | 0 | python | 2010-07-04T07:02:00.000 | 1 | 3,173,977 | Paramiko is really good and convenient for transferring files and executing commands in remote server.
But, the problem is that we won't be able to catch the output of the command. It will be difficult to understand whether the command executed properly or not. | 0 | 15,038 | false | 0 | 1 | Remote server command execute | 17,816,896 |
2 | 2 | 0 | 2 | 2 | 0 | 1.2 | 1 | I want my Python script to access a URL through an IP specified in the script instead of through the default DNS for the domain. Basically I want the equivalent of adding an entry to my /etc/hosts file, but I want the change to apply only to my script instead of globally on the whole server. Any ideas? | 0 | python,dns,urllib,hosts | 2010-07-06T05:08:00.000 | 0 | 3,183,617 | Whether this works or not will depend on whether the far end site is using HTTP/1.1 named-based virtual hosting or not.
If they're not, you can simply replace the hostname part of the URL with their IP address, per @Greg's answer.
If they are, however, you have to ensure that the correct Host: header is sent as part of the HTTP request. Without that, a virtual hosting web server won't know which site's content to give you. Refer to your HTTP client API (Curl?) to see if you can add or change default request headers. | 0 | 911 | true | 0 | 1 | Alternate host/IP for python script | 3,184,895 |
2 | 2 | 0 | 0 | 2 | 0 | 0 | 1 | I want my Python script to access a URL through an IP specified in the script instead of through the default DNS for the domain. Basically I want the equivalent of adding an entry to my /etc/hosts file, but I want the change to apply only to my script instead of globally on the whole server. Any ideas? | 0 | python,dns,urllib,hosts | 2010-07-06T05:08:00.000 | 0 | 3,183,617 | You can use an explicit IP number to connect to a specific machine by embedding that into the URL: http://127.0.0.1/index.html is equivalent to http://localhost/index.html
That said, it isn't a good idea to use IP numbers instead of DNS entries. IPs change a lot more often than DNS entries, meaning your script has a greater chance of breaking if you hard-code the address instead of letting it resolve normally. | 0 | 911 | false | 0 | 1 | Alternate host/IP for python script | 3,183,666 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.