Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
1,957,787
2009-12-24T10:37:00.000
2
0
1
0
php,phpdoc,docbook,restructuredtext,python-sphinx
2,035,342
2
true
0
0
You can convert ReST to DocBook using pandoc.
1
0
0
I need a documentation system for a PHP project and I wanted it to be able to integrate external documentation (use cases, project scope etc.) with the documentation generated from code comments. It seems that phpDocumentor has exactly the right feature set, but external documentation must be written in DocBook which i...
External documentation for PHP, no DocBook
1.2
1
0
853
1,959,811
2009-12-24T21:26:00.000
1
0
1
1
python,windows,py2exe
1,962,069
4
true
0
0
I did not find the cause to the problem, but using python 2.5 with py2exe on the same script worked fine on the server. I guess there is something wrong with py2exe under 2.6.
1
5
0
A simple python script needs to run on a windows server with no python installed. I used py2exe, which generated a healthy dist subdirectory, with script.exe that runs fine on the local machine. However, when I run it on the server (Windows Server 2003 R2), it produces this: The system cannot execute the specified prog...
Windows Server cannot execute a py2exe-generated app
1.2
0
0
3,390
1,960,155
2009-12-25T00:25:00.000
0
1
0
0
python,mysql,unit-testing,ubuntu
1,960,164
2
false
0
0
You can try the Blackhole and Memory table types in MySQL.
2
2
0
If I want to be able to test my application against a empty MySQL database each time my application's testsuite is run, how can I start up a server as a non-root user which refers to a empty (not saved anywhere, or in saved to /tmp) MySQL database? My application is in Python, and I'm using unittest on Ubuntu 9.10.
Start a "throwaway" MySQL session for testing code?
0
1
0
287
1,960,155
2009-12-25T00:25:00.000
1
1
0
0
python,mysql,unit-testing,ubuntu
1,960,160
2
true
0
0
--datadir for just the data or --basedir
2
2
0
If I want to be able to test my application against a empty MySQL database each time my application's testsuite is run, how can I start up a server as a non-root user which refers to a empty (not saved anywhere, or in saved to /tmp) MySQL database? My application is in Python, and I'm using unittest on Ubuntu 9.10.
Start a "throwaway" MySQL session for testing code?
1.2
1
0
287
1,960,516
2009-12-25T05:00:00.000
1
0
1
0
python,json,floating-point,decimal
69,778,023
18
false
0
0
If someone is still looking for the answer, it is most probably you have a 'NaN' in your data that you are trying to encode. Because NaN is considered as float by Python.
1
310
0
I have a Decimal('3.9') as part of an object, and wish to encode this to a JSON string which should look like {'x': 3.9}. I don't care about precision on the client side, so a float is fine. Is there a good way to serialize this? JSONDecoder doesn't accept Decimal objects, and converting to a float beforehand yields {'...
Python JSON serialize a Decimal object
0.011111
0
0
309,796
1,961,013
2009-12-25T11:23:00.000
19
0
0
0
python,mongodb,couchdb,database,nosql
3,007,620
4
true
0
0
Since a nosql database can contain huge amounts of data you can not migrate it in the regular rdbms sence. Actually you can't do it for rdbms as well as soon as your data passes some size threshold. It is impractical to bring your site down for a day to add a field to an existing table, and so with rdbms you end up doi...
4
27
0
I'm looking a way to automate schema migration for such databases like MongoDB or CouchDB. Preferably, this instument should be written in python, but any other language is ok.
Are there any tools for schema migration for NoSQL databases?
1.2
1
0
5,990
1,961,013
2009-12-25T11:23:00.000
2
0
0
0
python,mongodb,couchdb,database,nosql
1,961,090
4
false
0
0
One of the supposed benefits of these databases is that they are schemaless, and therefore don't need schema migration tools. Instead, you write your data handling code to deal with the variety of data stored in the db.
4
27
0
I'm looking a way to automate schema migration for such databases like MongoDB or CouchDB. Preferably, this instument should be written in python, but any other language is ok.
Are there any tools for schema migration for NoSQL databases?
0.099668
1
0
5,990
1,961,013
2009-12-25T11:23:00.000
2
0
0
0
python,mongodb,couchdb,database,nosql
1,966,375
4
false
0
0
If your data are sufficiently big, you will probably find that you cannot EVER migrate the data, or that it is not beneficial to do so. This means that when you do a schema change, the code needs to continue to be backwards compatible with the old formats forever. Of course if your data "age" and eventually expire anyw...
4
27
0
I'm looking a way to automate schema migration for such databases like MongoDB or CouchDB. Preferably, this instument should be written in python, but any other language is ok.
Are there any tools for schema migration for NoSQL databases?
0.099668
1
0
5,990
1,961,013
2009-12-25T11:23:00.000
1
0
0
0
python,mongodb,couchdb,database,nosql
3,007,685
4
false
0
0
When a project has a need for a schema migration in regards to a NoSQL database makes me think that you are still thinking in a Relational database manner, but using a NoSQL database. If anybody is going to start working with NoSQL databases, you need to realize that most of the 'rules' for a RDBMS (i.e. MySQL) need to...
4
27
0
I'm looking a way to automate schema migration for such databases like MongoDB or CouchDB. Preferably, this instument should be written in python, but any other language is ok.
Are there any tools for schema migration for NoSQL databases?
0.049958
1
0
5,990
1,961,158
2009-12-25T13:20:00.000
2
0
1
0
c++,python,exception
1,961,310
5
false
0
0
I don't have my copy of Bjarne Stroustrup's "Design & Evolution" handy, but I believe he wrote in there about some experience with resumable exceptions. They found that they made things considerably harder to get correct. After all, if an unexpected error happens in some line, your exception handler then has to patch...
5
5
0
In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?
Where does execution resume following an exception?
0.07983
0
0
7,214
1,961,158
2009-12-25T13:20:00.000
4
0
1
0
c++,python,exception
1,961,180
5
true
0
0
the execution resumes where the exception is caught, that is at the beginning of the catch block which specifically address the current exception type. the catch block is executed, the other catch blocks are ignored (think of multiple catch block as a switch statement). in some languages, a finally block may also be ex...
5
5
0
In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?
Where does execution resume following an exception?
1.2
0
0
7,214
1,961,158
2009-12-25T13:20:00.000
2
0
1
0
c++,python,exception
1,961,177
5
false
0
0
Execution continues in the catch block (where the exception was caught). This is consistent across languages that uses exceptions. The important point to note (especially in C++) Between the throw and the catch point the stack is unwound in an orderly manor so that all objects created on the stack are correctly destroy...
5
5
0
In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?
Where does execution resume following an exception?
0.07983
0
0
7,214
1,961,158
2009-12-25T13:20:00.000
1
0
1
0
c++,python,exception
1,961,165
5
false
0
0
It resumes where the exception is caught. Otherwise, what would be the point of writing the exception clause?
5
5
0
In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?
Where does execution resume following an exception?
0.039979
0
0
7,214
1,961,158
2009-12-25T13:20:00.000
7
0
1
0
c++,python,exception
1,961,176
5
false
0
0
The code inside the catch block is executed and the original execution continues right after the catch block.
5
5
0
In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?
Where does execution resume following an exception?
1
0
0
7,214
1,961,394
2009-12-25T15:59:00.000
2
0
1
0
python,floating-point
1,961,401
5
false
0
0
Because you're doing an integer division. If you do -22.0/10 instead, you'll get the correct result.
2
3
0
Why Does -22/10 return -3 in python. Any pointers regarding this will be helpful for me.
Floating Point Concepts in Python
0.07983
0
0
1,143
1,961,394
2009-12-25T15:59:00.000
2
0
1
0
python,floating-point
1,961,702
5
false
0
0
This happens because the operation of integer division returns the number, which when multiplied by the divisor gives the largest possible integer that is no larger than the number you divided. This is exactly why 22/10 gives 2: 10*2=20, which is the largest integer multiple of 10 not bigger than 20. When this goes to ...
2
3
0
Why Does -22/10 return -3 in python. Any pointers regarding this will be helpful for me.
Floating Point Concepts in Python
0.07983
0
0
1,143
1,962,130
2009-12-25T22:47:00.000
1
0
0
0
asp.net,python,sqlite,networking,udp
1,977,499
5
true
0
0
This sounds like a premature optimization (apologizes if you've already done the profiling). What I would suggest is go ahead and write the system in the simplest, cleanest way, but put a bit of abstraction around the database bits so they can easily by swapped out. Then profile it and find your bottleneck. If it tur...
2
0
0
Python --> SQLite --> ASP.NET C# I am looking for an in memory database application that does not have to write the data it receives to disc. Basically, I'll be having a Python server which receives gaming UDP data and translates the data and stores it in the memory database engine. I want to stay away from writing to ...
In memory database with socket capability
1.2
1
0
309
1,962,130
2009-12-25T22:47:00.000
0
0
0
0
asp.net,python,sqlite,networking,udp
1,962,162
5
false
0
0
The application of SQlite depends on your data complexity. If you need to perform complex queries on relational data, then it might be a viable option. If your data is flat (i.e. not relational) and processed as a whole, then some python-internal data structures might be applicable.
2
0
0
Python --> SQLite --> ASP.NET C# I am looking for an in memory database application that does not have to write the data it receives to disc. Basically, I'll be having a Python server which receives gaming UDP data and translates the data and stores it in the memory database engine. I want to stay away from writing to ...
In memory database with socket capability
0
1
0
309
1,962,273
2009-12-25T23:56:00.000
1
0
0
0
python,qt,pyqt
1,966,523
5
true
0
1
The PyQt documentation is exactly as provided on the website, and as included in the installer. It is not integrated with Assistant (it will be in a future version). If you want to use Assistant then you can use the Qt documentation instead (a lot of people do) and translate between C++ and Python as you read it.
2
7
0
I have installed PyQt GPL v4.6.2 for Python v3.1 and Qt by Nokia v4.6.0 (OpenSource), but the documentation in PyQt is not coming up. Example docs are all blank, too. Would anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get text to come up for the PyQt d...
PyQt documentation
1.2
0
0
16,124
1,962,273
2009-12-25T23:56:00.000
1
0
0
0
python,qt,pyqt
8,174,151
5
false
0
1
If you installed the Qt documentation, you should have an app named Assistant. This is a simple-minded browser for a local copy of the Qt doc as found at doc.qt.nokia.com. It is written for C++ but the mental translation to Python is not difficult, and it is nicely formatted and richly cross-linked. I keep Assistant ru...
2
7
0
I have installed PyQt GPL v4.6.2 for Python v3.1 and Qt by Nokia v4.6.0 (OpenSource), but the documentation in PyQt is not coming up. Example docs are all blank, too. Would anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get text to come up for the PyQt d...
PyQt documentation
0.039979
0
0
16,124
1,962,447
2009-12-26T02:05:00.000
4
0
0
0
python
1,964,328
4
false
1
0
File / New Project / enter your project name. In the Project Browser, create a package named "source" Right-click the source package, "Code Engineering", "Import Source Directory". Pick the directory containing your module(s) as the "Root Directory" Set "Source Type" to Python Enable "Recursively Process Subdirectories...
2
2
0
Please let me know how to create a uml diagram along with its equivalent documentation for the source code(.py format) using enterprise architecture 7.5 Please help me find the solution, I have read the solution for the question on this website related to my topic but in vain
python source code conversion to uml diagram with Sparx Systems Enterprise Architect
0.197375
0
0
4,824
1,962,447
2009-12-26T02:05:00.000
1
0
0
0
python
45,345,997
4
false
1
0
Go to project browser Create a model Right-click model > Add > Add View > Class Right-click class > Code Engineering > Import Source Directory... Check "one package per folder" The last one ensures you'll have an interesting diagram full of classes.
2
2
0
Please let me know how to create a uml diagram along with its equivalent documentation for the source code(.py format) using enterprise architecture 7.5 Please help me find the solution, I have read the solution for the question on this website related to my topic but in vain
python source code conversion to uml diagram with Sparx Systems Enterprise Architect
0.049958
0
0
4,824
1,962,592
2009-12-26T04:02:00.000
1
0
0
0
python,wxpython
1,962,595
3
false
0
1
You can take a look at the wxPython examples, they also include code samples for almost all of the widgets supported by wxPython. If you use Windows they can be found in the Start Menu folder of WxPython.
1
4
0
I'm starting to learn both Python and wxPython and as part of the app I'm doing, I need to have a simple browser on the left pane of my app. I'm wondering how do I do it? Or at least point me to the right direction that'll help me more on how to do one. Thanks in advance! EDIT: a sort of side question, how much of wxPy...
How do I make a simple file browser in wxPython?
0.066568
0
0
6,299
1,963,353
2009-12-26T13:15:00.000
0
0
1
0
python,unicode,encoding,utf-8
1,963,489
6
false
0
0
Have you thought about writing your own converter? It wouldn't be hard to write something that would go through a file and replace \N{A umlaut} with \N{LATIN SMALL LETTER A WITH DIAERESIS} and all the rest.
1
4
0
Are there short Unicode u"\N{...}" names for Latin1 characters in Python ? \N{A umlaut} etc. would be nice, \N{LATIN SMALL LETTER A WITH DIAERESIS} etc. is just too long to type every time. (Added:) I use an English keyboard, but occasionally need German letters, as in "Löwenbräu Weißbier". Yes one can cut-paste them s...
short Unicode \N{} names for Latin-1 characters in Python?
0
0
0
2,649
1,963,453
2009-12-26T14:05:00.000
3
1
0
0
python,c,import,python-c-api,python-embedding
1,963,510
5
false
0
1
Even if you implement a module in Python, the user would have to import it. This is the way Python works, and it's actually a good thing - it's one of the great pluses of Python - the namespace/module system is robust, easy to use and simple to understand. For academic exercises only, you could of course add your new f...
2
1
0
I'm trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions. Is it possible to load pre-load or pre-import via C API the module so that the user doesn't have to type import <mymodule>? Or even better, from...
Extending Python: pre-load my C module
0.119427
0
0
697
1,963,453
2009-12-26T14:05:00.000
0
1
0
0
python,c,import,python-c-api,python-embedding
1,963,505
5
false
0
1
Nope. You could add it to the Python interpreter itself, but that would mean creating a custom Python version, which, I guess, is not what you want. That import <mymodule> is not just for loading the module, it's also for making this module visible in the (main|current) namespace. Being able to do that, w/o hacking the...
2
1
0
I'm trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions. Is it possible to load pre-load or pre-import via C API the module so that the user doesn't have to type import <mymodule>? Or even better, from...
Extending Python: pre-load my C module
0
0
0
697
1,964,126
2009-12-26T19:23:00.000
3
0
1
0
python,exception
1,964,131
6
false
0
0
I would make a specific one. You can catch it and deal with that specific exception since it is a special circumstance that you created :)
2
12
0
Suppose in python you have a routine that accepts three named parameters (as **kwargs), but any two out of these three must be filled in. If only one is filled in, it's an error. If all three are, it's an error. What kind of error would you raise? RuntimeError, a specifically created exception, or other?
What exception to raise if wrong number of arguments passed in to **kwargs?
0.099668
0
0
10,631
1,964,126
2009-12-26T19:23:00.000
0
0
1
0
python,exception
1,964,172
6
false
0
0
I would use a ValueError, or a subclass thereof: "Raised when a built-in operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError." Passing 3 or 1 values when exactly 2 are required would technically ...
2
12
0
Suppose in python you have a routine that accepts three named parameters (as **kwargs), but any two out of these three must be filled in. If only one is filled in, it's an error. If all three are, it's an error. What kind of error would you raise? RuntimeError, a specifically created exception, or other?
What exception to raise if wrong number of arguments passed in to **kwargs?
0
0
0
10,631
1,964,583
2009-12-26T23:08:00.000
1
0
0
0
python,xpath
1,964,631
2
false
0
0
Using XML to store data is probably not optimal, as you experience here. Editing XML is extremely costly. One way of doing the editing is parsing the xml into a tree, and then inserting stuff into that three, and then rebuilding the xml file. Editing an xml file in place is also possible, but then you need some kind o...
1
2
0
Is it possible to do in place edit of XML document using xpath ? I'd prefer any python solution but Java would be fine too.
edit in place using xpath
0.099668
0
1
375
1,965,213
2009-12-27T04:56:00.000
1
0
1
0
python,multithreading
1,965,219
4
false
0
0
You need to fetch completely separate parts of the file on each thread. Calculate the chunk start and end positions based on the number of threads. Each chunk must have no overlap obviously. For example, if target file was 3000 bytes long and you want to fetch using three thread: Thread 1: fetches bytes 1 to 1000 Thre...
1
0
0
I'm creating a python script which accepts a path to a remote file and an n number of threads. The file's size will be divided by the number of threads, when each thread completes I want them to append the fetch data to a local file. How do I manage it so that the order in which the threads where generated will append ...
File downloading using python with threads
0.049958
0
1
3,862
1,966,591
2009-12-27T18:04:00.000
7
0
1
0
python,iterator
1,967,844
17
false
0
0
You can tee the iterator using, itertools.tee, and check for StopIteration on the teed iterator.
1
216
0
Haven't Python iterators got a has_next method?
has_next in Python iterators?
1
0
0
192,536
1,967,040
2009-12-27T21:04:00.000
2
0
1
0
python,audio
1,967,145
4
false
0
0
you could use any library that produces MIDI output, in case of .net I'd recommend the one created by Stephen Toub from Microsoft(can't find from where i got it, but google for it.)
1
7
0
I am confused because there are a lot of programms. But i am looking something like this. I will type a melody like "a4 c3 h3 a2" etc. and then i want to hear this. Does anybody know what i am looking for? thanks in advance
How can i create a melody? Is there any sound-module?
0.099668
0
0
6,317
1,967,888
2009-12-28T03:53:00.000
-1
0
0
0
python,wxpython
1,967,976
7
false
0
1
If you're used to a more command line approach, this would be a bad idea. Responding to user input is a completely different paradigm, and you're not likely to get it right the first time. If you're just talking about the difference between wxPython and another GUI, don't worry about it.
7
12
0
Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?
Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?
-0.028564
0
0
724
1,967,888
2009-12-28T03:53:00.000
0
0
0
0
python,wxpython
1,970,144
7
false
0
1
Since you are new to GUI programming, your approach is perfectly valid. It will likely result in a less than optimal UI, but that's OK for now. And in fact, there are some very successful multi-million dollar commercial projects that are built this way. Arguably a better approach is to first design the UI since that is...
7
12
0
Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?
Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?
0
0
0
724
1,967,888
2009-12-28T03:53:00.000
-1
0
0
0
python,wxpython
1,967,968
7
false
0
1
What level of interactivity do you need? If you need rich feedback and interaction, then you need an OO program model, then you can ad the GUI on top of the objects. If you just have filters and functions (no real feedback, or just a results window) than a library or component model would be better. Either way, you are...
7
12
0
Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?
Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?
-0.028564
0
0
724
1,967,888
2009-12-28T03:53:00.000
1
0
0
0
python,wxpython
1,968,045
7
false
0
1
Separation of the user interface from the engine code is the unixy way to do it and there's a lot of merit to doing it that way. It results in modular re-usable programs and code that can play nicely with other programs and fit into a larger tool chain. Having said that, such an approach tends to discount the value of ...
7
12
0
Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?
Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?
0.028564
0
0
724
1,967,888
2009-12-28T03:53:00.000
2
0
0
0
python,wxpython
1,967,904
7
false
0
1
That depends on the problem domain. An image processing tool would be rather difficult to implement without reference to a GUI. For most apps, though, I would argue strongly in favour of separating the two parts. It is much, much easier to develop, test and evolve a UI-free back-end. The gains will vastly outweigh the ...
7
12
0
Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?
Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?
0.057081
0
0
724
1,967,888
2009-12-28T03:53:00.000
0
0
0
0
python,wxpython
1,967,905
7
false
0
1
IMHO, that would rather be a better idea. To keep the underlying business logic not tied down to the UI is a better approach that we can worry more about the underlying logic than bogging down too much about the interface. At the same time, it is also important to have some basic design for your interface so that it h...
7
12
0
Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?
Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?
0
0
0
724
1,967,888
2009-12-28T03:53:00.000
16
0
0
0
python,wxpython
1,967,900
7
true
0
1
This is a viable approach. In fact, some programmers use it for the advantages it brings: Modular non-GUI code can then be tied in with different GUIs, not just a single library It can also be used for a command-line application (or a batch interface to a GUI one) It can be reused for a web application And most import...
7
12
0
Is it better to do it all at once? I'm very new to wxPython and I'm thinking it would be better to write the program in a way familiar to me, then apply the wxPython gui to it after I'm satisfied with the overall design of the app. Any advice?
Is it a bad idea to design and develop a python applications backend and then once finished try to apply a GUI to it?
1.2
0
0
724
1,968,343
2009-12-28T07:16:00.000
1
0
0
0
python,plone,zope,archetypes
1,977,227
2
true
1
0
Yes, IObjectEditedEvent (a direct subclass of IObjectModifiedEvent) is emitted when an Archetypes content object is being changed. However, the event itself will not tell you if a new file was uploaded. It should be possible however, to obtain the request (context.REQUEST should give you the current request through acq...
1
2
0
I have an AT content type in Plone. It has a number of fields, including a file field. When the user edits an object of this type, how can I tell if a new file was uploaded? For that matter, how can I tell if any of the fields have been changed? I am currently using subscribers to hook into the IObjectEditedEvent to d...
How can I tell if a field has changed value in an AT object in plone?
1.2
0
0
231
1,969,472
2009-12-28T13:30:00.000
6
1
0
0
.net,performance,ironpython,ironruby
1,972,630
1
true
0
0
IronPython has had more time to focus on performance improvements, but IronRuby has made significant performance improvements as of late. However, we rarely pin IronRuby up against IronPython. While people may comment here that one or the other is faster, and certain special cases/examples may even be uses to prove thi...
1
4
0
We're aiming to implement a scripting mechanism, using DLR's Microsoft.Scripting and hosting assembly. Now, someone knows about any performance difference between IronRuby 1.0 and IronPython 2.6? To my understanding they have different compilers, but IronPython seems more mature and tested, but if anyone has documentat...
Performance comparison between IronRuby and IronPython
1.2
0
0
753
1,969,490
2009-12-28T13:33:00.000
1
0
1
0
algorithm,python
1,969,504
5
false
0
0
if string in [x.name for x in list_of_x]
1
1
0
I have a list with objects of x type. Those objects have an attribute name. I want to find if a string matchs any of those object names. If I would have a list with the object names I just would do if string in list, so I was wondering given the current situation if there is a way to do it without having to loop over...
Shortest way to find if a string matchs an object's attribute value in a list of objects of that type in Python
0.039979
0
0
167
1,972,172
2009-12-28T23:46:00.000
1
0
0
0
python,algorithm,interpolation
1,972,198
3
false
0
0
Why not try quadlinear interpolation? extend Trilinear interpolation by another dimension. As long as a linear interpolation model fits your data, it should work.
2
8
1
I have a 3D space (x, y, z) with an additional parameter at each point (energy), giving 4 dimensions of data in total. I would like to find a set of x, y, z points which correspond to an iso-energy surface found by interpolating between the known points. The spacial mesh has constant spacing and surrounds the iso-energ...
Interpolating a scalar field in a 3D space
0.066568
0
0
5,443
1,972,172
2009-12-28T23:46:00.000
2
0
0
0
python,algorithm,interpolation
1,973,347
3
false
0
0
Since you have a spatial mesh with constant spacing, you can identify all neighbors on opposite sides of the isosurface. Choose some form of interpolation (q.v. Reed Copsey's answer) and do root-finding along the line between each such neighbor.
2
8
1
I have a 3D space (x, y, z) with an additional parameter at each point (energy), giving 4 dimensions of data in total. I would like to find a set of x, y, z points which correspond to an iso-energy surface found by interpolating between the known points. The spacial mesh has constant spacing and surrounds the iso-energ...
Interpolating a scalar field in a 3D space
0.132549
0
0
5,443
1,972,672
2009-12-29T02:49:00.000
3
0
1
0
python,python-3.x,sorting,key,python-2.x
1,972,691
3
false
0
0
Besides key=, the sort method of lists in Python 2.x could alternatively take a cmp= argument (not a good idea, it's been removed in Python 3); with either or none of these two, you can always pass reverse=True to have the sort go downwards (instead of upwards as is the default, and which you can also request explicitl...
1
16
0
Is there any other argument than key, for example: value?
What arguments does Python sort() function have?
0.197375
0
0
35,819
1,975,769
2009-12-29T17:19:00.000
0
0
0
0
python,django
1,976,174
3
false
1
0
Your question is little too generic. The general way of doing it involves: Extend templates of the reusable apps Pass the new template name to the view (Reusable apps should accepts that argument) Also pass extra_context to the reusable-generic-view Use your own view to create an extra_context and return the reuse-abl...
1
1
0
Is it good practice to treat individual app views as a blocks of HTML that can be pieced together to form a larger site? If not, what is the best way to reuse app views from project to project, assuming each one uses a different set of templates?
Piecing together Django views
0
0
0
141
1,977,521
2009-12-29T23:15:00.000
1
0
0
0
python,audio,pyglet
1,980,577
2
true
1
0
It doesn't appear that pyglet has support for setting a stop time. Your options are: Poll the current time and stop playback when you've reached your desired endpoint. This may not be precise enough for you. Or, use a sound file library to extract the portion you want into a temporary sound file, then use pyglet to ...
1
1
0
How can I use the pyglet API for sound to play subsets of a sound file e.g. from 1 second in to 3.5seconds of a 6 second sound clip? I can load a sound file and play it, and can seek to the start of the interval desired, but am wondering how to stop playback at the point indicated?
Play Subset of audio file using Pyglet
1.2
0
0
1,156
1,977,571
2009-12-29T23:30:00.000
7
1
0
0
python,paramiko
1,978,007
1
true
0
0
No, paramiko has no support for telnet or ftp -- you're indeed better off using a higher-level abstraction and implementing it twice, with paramiko and without it (with the ftplib and telnetlib modules of the Python standard library).
1
6
0
I'm looking at existing python code that heavily uses Paramiko to do SSH and FTP. I need to allow the same code to work with some hosts that do not support a secure connection and over which I have no control. Is there a quick and easy way to do it via Paramiko, or do I need to step back, create some abstraction that ...
Does Paramiko support non-secure telnet and ftp instead of just SSH and SFTP?
1.2
0
1
7,051
1,978,139
2009-12-30T02:44:00.000
0
1
1
0
java,python,optimization,jython
6,481,974
3
false
0
0
I know this is an old question, but I'm just putting this for completeness. You can use:-J-server flag to launch Jython in the Java server mode, which can help speed up the hot loops. (JVM will look to aggressively optimize, but might slow up the start up time)
3
2
0
Are their any ways to optimize Jython without resorting to profiling or significantly changing the code? Specifically are there any flags that can be passed to the compiler, or code hints in tight loops.
Jython Optimizations
0
0
0
707
1,978,139
2009-12-30T02:44:00.000
1
1
1
0
java,python,optimization,jython
1,990,415
3
true
0
0
Jython compiler does not offer lots of optimization choices. However, since the Java virtual machine (java) and perhaps compiler (javac) are getting invoked in the back end or at runtime, you should take a look at them. Java has different runtime switches to use depending on whether you are going to launch it as a serv...
3
2
0
Are their any ways to optimize Jython without resorting to profiling or significantly changing the code? Specifically are there any flags that can be passed to the compiler, or code hints in tight loops.
Jython Optimizations
1.2
0
0
707
1,978,139
2009-12-30T02:44:00.000
6
1
1
0
java,python,optimization,jython
1,978,207
3
false
0
0
No flags, no code hints. You can optimize by tweaking your code much as you would for any other Python implementation (hoisting, etc), but profiling helps by telling you where it's worth your while to expend such effort -- so, sure, you can optimize "without resorting to profiling" (and the code changes to do so may we...
3
2
0
Are their any ways to optimize Jython without resorting to profiling or significantly changing the code? Specifically are there any flags that can be passed to the compiler, or code hints in tight loops.
Jython Optimizations
1
0
0
707
1,978,188
2009-12-30T03:01:00.000
5
0
0
0
python,directory,web2py
1,987,564
3
false
1
0
In any multi-threaded Python program (and not only Python) you should not use os.chdir and you should not change sys.path when you have more than one thread running. It is not safe because it affects other threads. Moreover you should not sys.path.append() in a loop because it may explode. All web frameworks are multi-...
1
3
0
Well I want to use WEb2Py because it's pretty nice.. I just need to change the working directory to the directory where all my modules/libraries/apps are so i can use them. I want to be able to import my real program when I use the web2py interface/applications. I need to do this instead of putting all my apps and stu...
Web2Py Working Directory
0.321513
0
0
1,740
1,978,426
2009-12-30T04:27:00.000
6
0
0
0
python,web2py
1,980,510
1
false
1
0
In web2py your models and controllers are executed, not imported. They are executed every time a request arrives. If you press the button [compile] in admin, they will be bytecode compiled and some other optimizations are performs. If your app (in models and controllers) does "import somemodule", then the import statem...
1
4
0
I'm using Web2Py and i want to import my program simply once per session... not everytime the page is loaded. is this possible ? such as "import Client" being used on the page but only import it once per session..
Web2py Import Once per Session
1
0
1
953
1,978,791
2009-12-30T06:56:00.000
0
0
0
0
python,cherrypy
1,978,818
5
false
0
0
Why dont you use open source build tools (continuous integration tools) like Cruise. Most of them come with a web server/xml interface and sometimes with fancy reports as well.
4
0
0
I want to develop a tool for my project using python. The requirements are: Embed a web server to let the user get some static files, but the traffic is not very high. User can configure the tool using http, I don't want a GUI page, I just need a RPC interface, like XML-RPC? or others? Besides the web server, the too...
Python web server?
0
0
1
1,002
1,978,791
2009-12-30T06:56:00.000
-3
0
0
0
python,cherrypy
1,979,792
5
false
0
0
This sounds like a fun project. So, why don't write your own HTTP server? Its not so complicated after all, HTTP is a well-known and easy to implement protocol and you'll gain a lot of new knowledge! Check documentation or manual pages (whatever you prefer) of socket(), bind(), listen(), accept() and so on.
4
0
0
I want to develop a tool for my project using python. The requirements are: Embed a web server to let the user get some static files, but the traffic is not very high. User can configure the tool using http, I don't want a GUI page, I just need a RPC interface, like XML-RPC? or others? Besides the web server, the too...
Python web server?
-0.119427
0
1
1,002
1,978,791
2009-12-30T06:56:00.000
1
0
0
0
python,cherrypy
1,979,714
5
false
0
0
Use the WSGI Reference Implementation wsgiref already provided with Python Use REST protocols with JSON (not XML-RPC). It's simpler and faster than XML. Background jobs are started with subprocess.
4
0
0
I want to develop a tool for my project using python. The requirements are: Embed a web server to let the user get some static files, but the traffic is not very high. User can configure the tool using http, I don't want a GUI page, I just need a RPC interface, like XML-RPC? or others? Besides the web server, the too...
Python web server?
0.039979
0
1
1,002
1,978,791
2009-12-30T06:56:00.000
3
0
0
0
python,cherrypy
1,979,101
5
true
0
0
what about the internal python webserver ? just type "python web server" in google, and host the 1st result...
4
0
0
I want to develop a tool for my project using python. The requirements are: Embed a web server to let the user get some static files, but the traffic is not very high. User can configure the tool using http, I don't want a GUI page, I just need a RPC interface, like XML-RPC? or others? Besides the web server, the too...
Python web server?
1.2
0
1
1,002
1,980,454
2009-12-30T14:24:00.000
0
0
1
1
python,windows-installer,mysql
2,179,175
1
false
0
0
did you use an egg? if so, python might not be able to find it. import os,sys os.environ['PYTHON_EGG_CACHE'] = 'C:/temp' sys.path.append('C:/path/to/MySQLdb.egg')
1
0
0
I'm trying to install the module mySQLdb on a windows vista 64 (amd) machine. I've installed python on a different folder other than suggested by Python installer. When I try to install the .exe mySQLdb installer, it can't find python 2.5 and it halts the installation. Is there anyway to supply the installer with the c...
Problem installing MySQLdb on windows - Can't find python
0
1
0
431
1,980,479
2009-12-30T14:33:00.000
2
0
1
0
python,multithreading,process,locking,multiprocessing
1,980,508
3
false
0
0
multiprocessing and threading packages have slightly different aims, though both are concurrency related. threading coordinates threads within one process, while multiprocessing provide thread-like interface for coordinating multiple processes. If your application doesn't spawn new processes which require data synchro...
3
15
0
If a software project supports a version of Python that multiprocessing has been backported to, is there any reason to use threading.Lock over multiprocessing.Lock? Would a multiprocessing lock not be thread safe as well? For that matter, is there a reason to use any synchronization primitives from threading that are ...
Is there any reason to use threading.Lock over multiprocessing.Lock?
0.132549
0
0
5,708
1,980,479
2009-12-30T14:33:00.000
20
0
1
0
python,multithreading,process,locking,multiprocessing
1,980,929
3
true
0
0
The threading module's synchronization primitive are lighter and faster than multiprocessing, due to the lack of dealing with shared semaphores, etc. If you are using threads; use threading's locks. Processes should use multiprocessing's locks.
3
15
0
If a software project supports a version of Python that multiprocessing has been backported to, is there any reason to use threading.Lock over multiprocessing.Lock? Would a multiprocessing lock not be thread safe as well? For that matter, is there a reason to use any synchronization primitives from threading that are ...
Is there any reason to use threading.Lock over multiprocessing.Lock?
1.2
0
0
5,708
1,980,479
2009-12-30T14:33:00.000
3
0
1
0
python,multithreading,process,locking,multiprocessing
1,980,503
3
false
0
0
I would expect the multi-threading synchronization primitives to be quite faster as they can use shared memory area easily. But I suppose you will have to perform speed test to be sure of it. Also, you might have side-effects that are quite unwanted (and unspecified in the doc). For example, a process-wise lock could v...
3
15
0
If a software project supports a version of Python that multiprocessing has been backported to, is there any reason to use threading.Lock over multiprocessing.Lock? Would a multiprocessing lock not be thread safe as well? For that matter, is there a reason to use any synchronization primitives from threading that are ...
Is there any reason to use threading.Lock over multiprocessing.Lock?
0.197375
0
0
5,708
1,981,208
2009-12-30T16:59:00.000
1
1
1
0
python,attributes
1,981,378
8
false
0
0
I think your friend has misplaced his frustration in the language. His real problem is lack of debugging techniques. teach him how to break down a program into small pieces to examine the output. like a manual unit test, this way any inconsistency is found and any assumptions are proven or discarded.
5
4
0
A friend was "burned" when starting to learn Python, and now sees the language as perhaps fatally flawed. He was using a library and changed the value of an object's attribute (the class being in the library), but he used the wrong abbreviation for the attribute name. It took him "forever" to figure out what was wrong...
Protection from accidentally misnaming object attributes in Python?
0.024995
0
0
521
1,981,208
2009-12-30T16:59:00.000
0
1
1
0
python,attributes
1,981,269
8
false
0
0
I had a similar bad experience with Python when I first started ... took me 3 months to get over it. Having a tool which warns would be nice back then ...
5
4
0
A friend was "burned" when starting to learn Python, and now sees the language as perhaps fatally flawed. He was using a library and changed the value of an object's attribute (the class being in the library), but he used the wrong abbreviation for the attribute name. It took him "forever" to figure out what was wrong...
Protection from accidentally misnaming object attributes in Python?
0
0
0
521
1,981,208
2009-12-30T16:59:00.000
5
1
1
0
python,attributes
1,981,255
8
false
0
0
If the possibility to make mistakes is enough for him to consider a language "fatally flawed", I don't think you can convince him otherwise. The more you can do with a language, the more you can do wrong with the language. It's a caveat of flexibility—but that's true for any language.
5
4
0
A friend was "burned" when starting to learn Python, and now sees the language as perhaps fatally flawed. He was using a library and changed the value of an object's attribute (the class being in the library), but he used the wrong abbreviation for the attribute name. It took him "forever" to figure out what was wrong...
Protection from accidentally misnaming object attributes in Python?
0.124353
0
0
521
1,981,208
2009-12-30T16:59:00.000
12
1
1
0
python,attributes
1,981,279
8
true
0
0
"changed the value of an object's attribute" Can lead to problems. This is pretty well known. You know it, now, also. That doesn't indict the language. It simply says that you've learned an important lesson in dynamic language programming. Unit testing absolutely discovers this. You are not forced to mock all li...
5
4
0
A friend was "burned" when starting to learn Python, and now sees the language as perhaps fatally flawed. He was using a library and changed the value of an object's attribute (the class being in the library), but he used the wrong abbreviation for the attribute name. It took him "forever" to figure out what was wrong...
Protection from accidentally misnaming object attributes in Python?
1.2
0
0
521
1,981,208
2009-12-30T16:59:00.000
1
1
1
0
python,attributes
1,981,288
8
false
0
0
He's effectively ruling out an entire class of programming languages -- dynamically-typed languages -- because of one hard lesson learned. He can use only statically-typed languages if he wishes and still have a very productive career as a programmer, but he is certainly going to have deep frustrations with them as wel...
5
4
0
A friend was "burned" when starting to learn Python, and now sees the language as perhaps fatally flawed. He was using a library and changed the value of an object's attribute (the class being in the library), but he used the wrong abbreviation for the attribute name. It took him "forever" to figure out what was wrong...
Protection from accidentally misnaming object attributes in Python?
0.024995
0
0
521
1,982,277
2009-12-30T20:24:00.000
1
0
0
0
python,django,spam-prevention
1,983,179
2
false
1
0
I can't think of any critically sensitive data that could be submitted by anonymous users. If the data is really sensitive (like you mentioned patient records), it is probably submitted by known and registered user so you should do manual approval of new users and protect the registration part from spammers.
1
4
0
I'm curious if anyone out there knows of something perhaps like Akismet, but where content doesn't have to go off to a 3rd party server. In a situation with critically sensitive data (patient records for instance) I wouldn't necessarily want that information sent off to another server I don't have control over. I reall...
Spam Filtering Forms Without Akismet
0.099668
0
0
394
1,982,442
2009-12-30T20:56:00.000
-3
0
0
0
python,ldap,python-3.x
1,982,479
4
true
0
0
This answer is no longer accurate; see below for other answers. Sorry to break this on you, but I don't think there is a python-ldap for Python 3 (yet)... That's the reason why we should keep active development at Python 2.6 for now (as long as most crucial dependencies (libs) are not ported to 3.0).
1
12
0
I am porting some Java code to Python and we would like to use Python 3 but I can't find LDAP module for Python 3 in Windows. This is forcing us to use 2.6 version and it is bothersome as rest of the code is already in 3.0 format.
Does Python 3 have LDAP module?
1.2
0
1
16,151
1,982,788
2009-12-30T22:06:00.000
2
1
0
1
c++,python,linux,pexpect
1,982,873
2
true
0
0
You could just use "expect". It is very light weight and is made to do what youre describing.
1
0
0
Is there any way of writing pexpect like small program which can launch a process and pass the password to that process? I don't want to install and use pexpect python library but want to know the logic behind it so that using linux system apis I can build something similar.
writing pexpect like program in c++ on Linux
1.2
0
0
639
1,983,126
2009-12-30T23:42:00.000
1
0
1
0
python,regex
1,983,142
6
false
0
0
The regex below captures everything between the $ characters non-greedily \$(.*?)\$
1
2
0
The problem: I need to extract strings that are between $ characters from a block of text, but i'm a total n00b when it comes to regular expressions. For instance from this text: Li Europan lingues $es membres$ del sam familie. Lor $separat existentie es un$ myth. i would like to get an array consisting of: {'es membre...
Regex for getting content between $ chars from a text
0.033321
0
0
1,555
1,983,177
2009-12-30T23:55:00.000
5
1
1
0
python,comments,memory-management,docstring
1,983,193
5
false
0
0
They are getting read from the file (when the file is compiled to pyc or when the pyc is loaded -- they must be available under object.__doc__) but no --> this will not significantly impact performance under any reasonable circumstances, or are you really writing multi-megabyte doc-strings?
3
15
0
Are Python docstrings and comments stored in memory when a module is loaded? I've wondered if this is true, because I usually document my code well; may this affect memory usage? Usually every Python object has a __doc__ method. Are those docstrings read from the file, or processed otherwise? I've done searches here i...
Are Python docstrings and comments stored in memory when a module is loaded?
0.197375
0
0
3,713
1,983,177
2009-12-30T23:55:00.000
12
1
1
0
python,comments,memory-management,docstring
1,983,203
5
false
0
0
Yes the docstrings are read from the file, but that shouldn't stop you writing them. Never ever compromise readability of code for performance until you have done a performance test and found that the thing you are worried about is in fact the bottleneck in your program that is causing a problem. I would think that it ...
3
15
0
Are Python docstrings and comments stored in memory when a module is loaded? I've wondered if this is true, because I usually document my code well; may this affect memory usage? Usually every Python object has a __doc__ method. Are those docstrings read from the file, or processed otherwise? I've done searches here i...
Are Python docstrings and comments stored in memory when a module is loaded?
1
0
0
3,713
1,983,177
2009-12-30T23:55:00.000
1
1
1
0
python,comments,memory-management,docstring
1,983,288
5
false
0
0
Do Python docstrings and comments are stored in memory when module is loaded? Docstrings are compiled into the .pyc file, and are loaded into memory. Comments are discarded during compilation and have no impact on anything except the insignificant extra time taken to ignore them during compilation (which happens ...
3
15
0
Are Python docstrings and comments stored in memory when a module is loaded? I've wondered if this is true, because I usually document my code well; may this affect memory usage? Usually every Python object has a __doc__ method. Are those docstrings read from the file, or processed otherwise? I've done searches here i...
Are Python docstrings and comments stored in memory when a module is loaded?
0.039979
0
0
3,713
1,983,282
2009-12-31T00:21:00.000
1
0
0
0
java,.net,python,portlet
1,985,241
3
false
1
0
Why would I want to use java portlets above tomcat and gwt? These technologies are not directly comparable. Coming from regular web page development, Portlets seem like a very restrictive technology. But then the value of Portal servers is largely the control they give to administrators and users - the fact that this ...
1
2
0
Why would I want to use java portlets above tomcat and gwt? Would portlets make it less- or un- necessary for me to use jsp and jsf? Has Jboss been part of the portlet evolution culture? Does Jboss satisfy the portlet jsrs? What portlet implementation/brand would run on gae java and gae python? Are portlet specs due to...
Please discuss what are and why use portlets
0.066568
0
0
4,765
1,984,445
2009-12-31T07:52:00.000
0
0
0
1
java,python,interface,interaction
1,984,457
6
false
1
0
Expose one of the two as a service of some kind, web service maybe. Another option is to port the python code to Jython
2
3
0
I have a python application which I cant edit its a black box from my point of view. The python application knows how to process text and return processed text. I have another application written in Java which knows how to collect non processed texts. Current state, the python app works in batch mode every x minutes. I...
Interaction between Java App and Python App
0
0
0
6,004
1,984,445
2009-12-31T07:52:00.000
0
0
0
1
java,python,interface,interaction
1,984,650
6
false
1
0
An option is making the python application work as a server, listens for request via sockets (TCP).
2
3
0
I have a python application which I cant edit its a black box from my point of view. The python application knows how to process text and return processed text. I have another application written in Java which knows how to collect non processed texts. Current state, the python app works in batch mode every x minutes. I...
Interaction between Java App and Python App
0
0
0
6,004
1,985,383
2009-12-31T13:23:00.000
2
0
0
0
python,django,django-models
1,985,415
8
false
1
0
You need to drop your tables before you can recreate them with syncdb. If you want to preserve your existing data, then you need to unload your database, drop your tables, run syncdb to build a new database, then reload your old data into your new tables. There are tools that help with this. However, in many cases, it...
1
70
0
I've already defined a model and created its associated database via manager.py syncdb. Now that I've added some fields to the model, I tried syncdb again, but no output appears. Upon trying to access these new fields from my templates, I get a "No Such Column" exception, leading me to believe that syncdb didn't actual...
update django database to reflect changes in existing models
0.049958
0
0
85,597
1,986,060
2009-12-31T16:38:00.000
0
0
0
0
python,django
1,986,323
4
false
1
0
__init__.py will be called every time the app is imported. So if you're using mod_wsgi with Apache for instance with the prefork method, then every new process created is effectively 'starting' the project thus importing __init__.py. It sounds like your best method would be to create a new management command, and then ...
2
3
0
I want to perform some one-time operations such as to start a background thread and populate a cache every 30 minutes as initialize action when the Django server is started, so it will not block user from visiting the website. Where should I place all this code in Django? Put them into the setting.py file does not wor...
Where should I place the one-time operation operation in the Django framework?
0
0
0
781
1,986,060
2009-12-31T16:38:00.000
4
0
0
0
python,django
1,986,926
4
false
1
0
We put one-time startup scripts in the top-level urls.py. This is often where your admin bindings go -- they're one-time startup, also. Some folks like to put these things in settings.py but that seems to conflate settings (which don't do much) with the rest of the site's code (which does stuff).
2
3
0
I want to perform some one-time operations such as to start a background thread and populate a cache every 30 minutes as initialize action when the Django server is started, so it will not block user from visiting the website. Where should I place all this code in Django? Put them into the setting.py file does not wor...
Where should I place the one-time operation operation in the Django framework?
0.197375
0
0
781
1,986,712
2009-12-31T19:10:00.000
14
1
1
0
python,data-structures
1,986,739
6
false
0
0
For some simple data structures (eg. a stack), you can just use the builtin list to get your job done. With more complex structures (eg. a bloom filter), you'll have to implement them yourself using the primitives the language supports. You should use the builtins if they serve your purpose really since they're debugg...
4
16
0
All the books I've read on data structures so far seem to use C/C++, and make heavy use of the "manual" pointer control that they offer. Since Python hides that sort of memory management and garbage collection from the user is it even possible to implement efficient data structures in this language, and is there any re...
Data Structures in Python
1
0
0
22,283
1,986,712
2009-12-31T19:10:00.000
2
1
1
0
python,data-structures
1,987,211
6
false
0
0
With Python you have access to a vast assortment of library modules written and debugged by other people. Odds are very good that somewhere out there, there is a module that does at least part of what you want, and odds are even good that it might be implemented in C for performance. For example, if you need to do mat...
4
16
0
All the books I've read on data structures so far seem to use C/C++, and make heavy use of the "manual" pointer control that they offer. Since Python hides that sort of memory management and garbage collection from the user is it even possible to implement efficient data structures in this language, and is there any re...
Data Structures in Python
0.066568
0
0
22,283
1,986,712
2009-12-31T19:10:00.000
0
1
1
0
python,data-structures
1,986,761
6
false
0
0
It's not possible to implement something like a C++ vector in Python, since you don't have array primitives the way C/C++ do. However, anything more complicated can be implemented (efficiently) on top of it, including, but not limited to: linked lists, hash tables, multisets, bloom filters, etc.
4
16
0
All the books I've read on data structures so far seem to use C/C++, and make heavy use of the "manual" pointer control that they offer. Since Python hides that sort of memory management and garbage collection from the user is it even possible to implement efficient data structures in this language, and is there any re...
Data Structures in Python
0
0
0
22,283
1,986,712
2009-12-31T19:10:00.000
10
1
1
0
python,data-structures
1,986,749
6
false
0
0
C/C++ data structure books are only attempting to teach you the underlying principles behind the various structures - they are generally not advising you to actually go out and re-invent the wheel by building your own library of stacks and lists. Whether you're using Python, C++, C#, Java, whatever, you should always l...
4
16
0
All the books I've read on data structures so far seem to use C/C++, and make heavy use of the "manual" pointer control that they offer. Since Python hides that sort of memory management and garbage collection from the user is it even possible to implement efficient data structures in this language, and is there any re...
Data Structures in Python
1
0
0
22,283
1,989,251
2010-01-01T18:31:00.000
1
0
1
0
python,file,list,memory-management,32bit-64bit
1,989,320
9
false
0
0
You might want to consider a different kind of structure: not a list, but figuring out how to do (your task) with a generator or a custom iterator.
3
13
0
If I have a list(or array, dictionary....) in python that could exceed the available memory address space, (32 bit python) what are the options and there relative speeds? (other than not making a list that large) The list could exceed the memory but I have no way of knowing before hand. Once it starts exceeding 75% I w...
Alternatives to keeping large lists in memory (python)
0.022219
0
0
21,695
1,989,251
2010-01-01T18:31:00.000
8
0
1
0
python,file,list,memory-management,32bit-64bit
1,989,278
9
false
0
0
There are probably dozens of ways to store your list data in a file instead of in memory. How you choose to do it will depend entirely on what sort of operations you need to perform on the data. Do you need random access to the Nth element? Do you need to iterate over all elements? Will you be searching for element...
3
13
0
If I have a list(or array, dictionary....) in python that could exceed the available memory address space, (32 bit python) what are the options and there relative speeds? (other than not making a list that large) The list could exceed the memory but I have no way of knowing before hand. Once it starts exceeding 75% I w...
Alternatives to keeping large lists in memory (python)
1
0
0
21,695
1,989,251
2010-01-01T18:31:00.000
6
0
1
0
python,file,list,memory-management,32bit-64bit
1,989,292
9
false
0
0
The answer is very much "it depends". What are you storing in the lists? Strings? integers? Objects? How often is the list written to compared with being read? Are items only appended on the end, or can entries be modified or inserted in the middle? If you are only appending to the end then writing to a flat file may...
3
13
0
If I have a list(or array, dictionary....) in python that could exceed the available memory address space, (32 bit python) what are the options and there relative speeds? (other than not making a list that large) The list could exceed the memory but I have no way of knowing before hand. Once it starts exceeding 75% I w...
Alternatives to keeping large lists in memory (python)
1
0
0
21,695
1,990,502
2010-01-02T03:19:00.000
0
0
0
0
python,django,login,signals
1,991,497
7
false
1
0
Rough idea - you could use middleware for this. This middleware could process requests and fire signal when relevant URL is requested. It could also process responses and fire signal when given action actually succeded.
2
84
0
In my Django app, I need to start running a few periodic background jobs when a user logs in and stop running them when the user logs out, so I am looking for an elegant way to get notified of a user login/logout query user login status From my perspective, the ideal solution would be a signal sent by each django.co...
Django: signal when user logs in?
0
0
0
38,642
1,990,502
2010-01-02T03:19:00.000
1
0
0
0
python,django,login,signals
1,991,512
7
false
1
0
The only reliable way (that also detects when the user has closed the browser) is to update some last_request field every time the user loads a page. You could also have a periodic AJAX request that pings the server every x minutes if the user has a page open. Then have a single background job that gets a list of recen...
2
84
0
In my Django app, I need to start running a few periodic background jobs when a user logs in and stop running them when the user logs out, so I am looking for an elegant way to get notified of a user login/logout query user login status From my perspective, the ideal solution would be a signal sent by each django.co...
Django: signal when user logs in?
0.028564
0
0
38,642
1,991,065
2010-01-02T09:14:00.000
10
1
0
0
c++,python,c,perl
1,991,076
4
true
1
0
All languages can all do basically any task any other one of them can do, as they are all Turing complete. PHP works as a server-side scripting language, but you can also use Perl, Python, Ruby, Haskell, Lisp, Java, C, C++, assembly, or pretty much any other language that can access standard input and standard output f...
1
0
0
Please bear with me experts i'm a newbie in web dev. With html,css can take care of webpages.. javascript,ajax for some dynamic content.. php for server side scripting,accessing databases,sending emails,doing all other stuf... What role do these programming languages play? Can they do any other important task which can...
Role of C,C++,python,perl in Web development
1.2
0
0
719
1,991,743
2010-01-02T14:29:00.000
2
1
0
0
python,django,apache,mod-wsgi
1,991,778
1
true
1
0
I think the problem is related with the permissions of that file. Check that the user running wsgi (apache user, usually) is capable of reading and writing the everything in the libs folder and specially capable of reading the file pywapi.py.
1
1
0
I have a simple setup with my python libraries in /domains/somedomain.com/libs/ and all my tests run fine. I start WSGI with DJANGO_SETTINGS_MODULE to "somedomain.settings" where somedomain is a package in libs/ Suddenly, when adding pywapi.py into libs/ I can't import it when hitting the site. But, if I add 'import py...
How does Django + mod_wsgi affect the python path?
1.2
0
0
927
1,993,060
2010-01-02T22:14:00.000
0
1
0
0
python,authentication,file-upload,automation
1,993,139
3
false
0
0
You mention they do not offer FTP, but I went to their site and found the following: How to upload with FTP? ftp.hotfile.com user: your hotfile username pass: your hotfile password You can upload and make folders, but cant rename,move files Try it. If it works, using FTP from within Python will be a very simp...
1
2
0
I want to upload a file from my computer to a file hoster like hotfile.com via a Python script. Because Hotfile is only offering a web-based upload service (no ftp). I need Python first to login with my username and password and after that to upload the file. When the file transfer is over, I need the Download and Dele...
Upload file to a website via Python script
0
0
1
7,457
1,993,079
2010-01-02T22:19:00.000
4
0
1
0
python,multithreading
1,993,105
11
false
0
0
I've run into this situation before. Just make a pool of Tasks, and spawn a fixed number of threads that run an endless loop which grabs a Task from the pool, run it, and repeat. Essentially you're implementing your own thread abstraction and using the OS threads to implement it. This does have drawbacks, the major o...
6
3
0
The scenario: We have a python script that checks thousands of proxys simultaneously. The program uses threads, 1 per proxy, to speed the process. When it reaches the 1007 thread, the script crashes because of the thread limit. My solution is: A global variable that gets incremented when a thread spawns and decrements ...
A programming strategy to bypass the os thread limit?
0.072599
0
0
2,695
1,993,079
2010-01-02T22:19:00.000
1
0
1
0
python,multithreading
1,993,107
11
false
0
0
Be careful to minimize the default thread stack size. At least on Linux, the default limit puts severe restrictions on the number of created threads. Linux allocates a chunk of the process virtual address space to the stack (usually 10MB). 300 threads x 10MB stack allocation = 3GB of virtual address space dedicated to ...
6
3
0
The scenario: We have a python script that checks thousands of proxys simultaneously. The program uses threads, 1 per proxy, to speed the process. When it reaches the 1007 thread, the script crashes because of the thread limit. My solution is: A global variable that gets incremented when a thread spawns and decrements ...
A programming strategy to bypass the os thread limit?
0.01818
0
0
2,695
1,993,079
2010-01-02T22:19:00.000
1
0
1
0
python,multithreading
1,993,311
11
false
0
0
As mentioned in another thread, why do you spawn off a new thread for each single operation? This is a classical producer - consumer problem, isn't it? Depending a bit on how you look at it, the proxy checkers might be comsumers or producers. Anyway, the solution is to make a "queue" of "tasks" to process, and make the...
6
3
0
The scenario: We have a python script that checks thousands of proxys simultaneously. The program uses threads, 1 per proxy, to speed the process. When it reaches the 1007 thread, the script crashes because of the thread limit. My solution is: A global variable that gets incremented when a thread spawns and decrements ...
A programming strategy to bypass the os thread limit?
0.01818
0
0
2,695
1,993,079
2010-01-02T22:19:00.000
2
0
1
0
python,multithreading
1,993,114
11
false
0
0
My solution is: A global variable that gets incremented when a thread spawns and decrements when a thread finishes. The function which spawns the threads monitors the variable so that the limit is not reached. The standard way is to have each thread get next tasks in a loop instead of dying after processing just one....
6
3
0
The scenario: We have a python script that checks thousands of proxys simultaneously. The program uses threads, 1 per proxy, to speed the process. When it reaches the 1007 thread, the script crashes because of the thread limit. My solution is: A global variable that gets incremented when a thread spawns and decrements ...
A programming strategy to bypass the os thread limit?
0.036348
0
0
2,695
1,993,079
2010-01-02T22:19:00.000
2
0
1
0
python,multithreading
1,993,101
11
false
0
0
Using different processes, and pipes to transfer data. Using threads in python is pretty lame. From what I heard, they don't actually run in parallel, even if you have a multi-core processor... But maybe it was fixed in python3.
6
3
0
The scenario: We have a python script that checks thousands of proxys simultaneously. The program uses threads, 1 per proxy, to speed the process. When it reaches the 1007 thread, the script crashes because of the thread limit. My solution is: A global variable that gets incremented when a thread spawns and decrements ...
A programming strategy to bypass the os thread limit?
0.036348
0
0
2,695
1,993,079
2010-01-02T22:19:00.000
3
0
1
0
python,multithreading
1,993,093
11
false
0
0
Does Python have any sort of asynchronous IO functionality? That would be the preferred answer IMO - spawning an extra thread for each outbound connection isn't as neat as having a single thread which is effectively event-driven.
6
3
0
The scenario: We have a python script that checks thousands of proxys simultaneously. The program uses threads, 1 per proxy, to speed the process. When it reaches the 1007 thread, the script crashes because of the thread limit. My solution is: A global variable that gets incremented when a thread spawns and decrements ...
A programming strategy to bypass the os thread limit?
0.054491
0
0
2,695
1,993,238
2010-01-02T23:21:00.000
2
0
1
0
python,function,recover
1,996,024
1
true
0
0
Er, trying to "recover" from a segfault or access violation is quite dangerous. There is a reason you get these in the first place, and it's that your program has tried to do something which it shouldn't have tried to do; therefore it has hit a bug or an unforeseen condition. There is no provision in the Python interpr...
1
1
0
I have a C++ app that embeds the Python interpreter. There are points in the code where the interpreter may get interrupted and I need to make sure the interpreter is in a 'safe' state to execute new code. I would just call Py_Finalize and re-initialize everything except I have a bunch of PyObject * references that I n...
How to reset Python interpreter to a 'safe' state?
1.2
0
0
1,091
1,994,355
2010-01-03T08:45:00.000
11
0
1
1
python,perl,parsing
1,994,373
9
false
0
0
In the end, it really depends on how much semantics you want to identify, whether your logs fit common patterns, and what you want to do with the parsed data. If you can use regular expressions to find what you need, you have tons of options. Perl is a popular language and has very convenient native RE facilities. I pe...
2
16
0
I use grep to parse through my trading apps logs, but it's limited in the sense that I need to visually trawl through the output to see what happened etc. I'm wondering if Perl is a better option? Any good resources to learn log and string parsing with Perl? I'd also believe that Python would be good for this. Perl vs ...
What's the best tool to parse log files?
1
0
0
32,524
1,994,355
2010-01-03T08:45:00.000
1
0
1
1
python,perl,parsing
1,995,141
9
false
0
0
on linux, you can use just the shell(bash,ksh etc) to parse log files if they are not too big in size. The other tools to go for are usually grep and awk. However, for more programming power, awk is usually used. If you have big files to parse, try awk. Of course, Perl or Python or practically any other languages with ...
2
16
0
I use grep to parse through my trading apps logs, but it's limited in the sense that I need to visually trawl through the output to see what happened etc. I'm wondering if Perl is a better option? Any good resources to learn log and string parsing with Perl? I'd also believe that Python would be good for this. Perl vs ...
What's the best tool to parse log files?
0.022219
0
0
32,524