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
6,375,769
2011-06-16T17:02:00.000
6
0
1
0
python,import,package
6,375,785
1
true
0
0
You can't. But prefixing the "implementation" modules with a single underscore will act as an indicator that they should not be used directly.
1
0
0
I have four packages in my program, among them i would like one and only one, to be accessible from the outside, by a user of my program. Brievly, my programm, should be like a black box with only one entry(one of the package).
Python : How to choose modules that can be import from a package?
1.2
0
0
79
6,380,623
2011-06-17T01:55:00.000
0
0
0
0
python,git,mercurial,rdbms,audit-trail
6,380,661
3
false
0
0
If the database is not write-heavy (as you say), why not just implement the actual database tables in a way that achieves your goal? For example, add a "version" column. Then never update or delete rows, except for this special column, which you can set to NULL to mean "current," 1 to mean "the oldest known", and go ...
2
2
0
I'm looking to implement an audit trail for a reasonably complicated relational database, whose schema is prone to change. One avenue I'm thinking of is using a DVCS to track changes. (The benefits I can imagine are: schemaless history, snapshots of entire system's state, standard tools for analysis, playback and migra...
Using DVCS for an RDBMS audit trail
0
1
0
386
6,380,623
2011-06-17T01:55:00.000
2
0
0
0
python,git,mercurial,rdbms,audit-trail
6,396,514
3
false
0
0
I've looked into this a little on my own, and here are some comments to share. Although I had thought using mercurial from python would make things easier, there's a lot of functionality that the DVCS's have that aren't necessary (esp branching, merging). I think it would be easier to simply steal some design decisions...
2
2
0
I'm looking to implement an audit trail for a reasonably complicated relational database, whose schema is prone to change. One avenue I'm thinking of is using a DVCS to track changes. (The benefits I can imagine are: schemaless history, snapshots of entire system's state, standard tools for analysis, playback and migra...
Using DVCS for an RDBMS audit trail
0.132549
1
0
386
6,389,629
2011-06-17T17:42:00.000
0
0
1
0
python,numpy,warnings
6,389,670
3
false
0
0
EDIT: Arg! I inexplicably got the name wrong. Use the pychecker module. If you have distutils installed, then just type: easy_install pychecker on the command line to get the newest version. By default in generates warnings, and lists the line numbers for them.
1
1
0
Is it possible to display line number along with warnings? I'm getting some warnings, possibly from numpy, but I have no idea where they come from. I don't want my code to aboard or to raise an exception, but I'd like to get more information from the origin of the warnings. Is it something possible?
How to know where warning come from in Python
0
0
0
580
6,390,066
2011-06-17T18:21:00.000
2
0
0
0
python,layout,pyqt4,qt-designer,groupbox
6,390,326
1
true
0
1
Insert a vertical spacer below the bottom-most radio button.
1
2
0
I am using Qt Designer to set up a simple gui for a program I am writing in which I need to display a column of radio buttons. I want to hide some of the radio buttons (not just disable them) based on whether or not their corresponding port is currently available. The radio buttons are in a group box with a vertical ...
PyQt4 Vertical Layout Autospacing
1.2
0
0
437
6,390,393
2011-06-17T18:49:00.000
23
0
0
0
python,matplotlib
34,919,615
10
false
0
0
In current versions of Matplotlib, you can do axis.set_xticklabels(labels, fontsize='small').
2
421
1
In a matplotlib figure, how can I make the font size for the tick labels using ax1.set_xticklabels() smaller? Further, how can one rotate it from horizontal to vertical?
Matplotlib make tick labels font size smaller
1
0
0
870,128
6,390,393
2011-06-17T18:49:00.000
16
0
0
0
python,matplotlib
37,869,225
10
false
0
0
For smaller font, I use ax1.set_xticklabels(xticklabels, fontsize=7) and it works!
2
421
1
In a matplotlib figure, how can I make the font size for the tick labels using ax1.set_xticklabels() smaller? Further, how can one rotate it from horizontal to vertical?
Matplotlib make tick labels font size smaller
1
0
0
870,128
6,391,388
2011-06-17T20:23:00.000
2
0
0
0
python,django,browser
6,391,503
2
false
1
0
The Django development server only does 1 request at a time. I believe that's why you have the issue.
1
2
0
I've made a django app, running it w/ the built-in server for now (just for testing). I have programs which access urls multiple times per second on the app without any issues. However, when I view an admin page, or one of those URLs that the program visits, in a web browser, the server freezes for many seconds. Why mi...
django: why does accessing a page from web browser freeze the server?
0.197375
0
0
256
6,392,739
2011-06-17T23:19:00.000
3
0
1
0
python,syntax,python-decorators
21,637,034
15
false
0
0
To say what others have in a different way: yes, it is a decorator. In Python, it's like: Creating a function (follows under the @ call) Calling another function to operate on your created function. This returns a new function. The function that you call is the argument of the @. Replacing the function defined with...
1
821
0
What does the @ symbol do in Python?
What does the "at" (@) symbol do in Python?
0.039979
0
0
555,833
6,393,073
2011-06-18T00:27:00.000
16
0
1
0
python,multithreading,locking,thread-safety
6,393,126
2
false
0
0
A lock allows you to force multiple threads to access a resource one at a time, rather than all of them trying to access the resource simultaneously. As you note, usually you do want threads to execute simultaneously. However, imagine that you have two threads and they are both writing to the same file. If they try to ...
1
8
0
I've read a lot of examples on locking threads.. but why should you lock them? From my understanding, when you initiate threads without joining them, they will compete with the main thread and all other threads for resources and then execute, sometimes simultaneously, sometimes not. Does locking ensure that threads DON...
Why should you lock threads?
1
0
0
6,176
6,393,620
2011-06-18T03:13:00.000
0
0
1
0
python,regex,text,split
6,393,773
5
false
0
0
It's also possible that your file is using a format that's compatible with the csv module, you could also look into that, especially if the format allows quoting, because then line.split would break. If the format doesn't use quoting and it's just delimiters and text, line.split is probably the best. Also, for the re m...
1
0
0
I have a huge text file, each line seems like this: Some sort of general menu^a_sub_menu_title^^pagNumber Notice that the first "general menu" has white spaces, the second part (a subtitle) each word is separate with "_" character and finally a number (a pag number). I want to split each line in 3 (obvious) parts, be...
Split string with caret character in python
0
0
0
2,372
6,394,305
2011-06-18T06:26:00.000
0
0
0
1
python,mechanize,easy-install
6,395,374
1
true
1
0
What's your Python installation location? How did you run easy_install? easy_install probably uses the default user account permissions and you need to manually change file permissions / ownership so that non-admins can see the files. Generally, easy_install is designed for single user installations (development use) ...
1
0
0
I've installed mechanize using easy_install on Windows 7 Admin account. However, when I try to setup/run another program that needs mechanize on a different account, it doesn't find it. Any solutions?
Installing Mechanize using easy_install
1.2
0
0
248
6,395,185
2011-06-18T09:51:00.000
1
0
0
0
python,pygtk
6,395,227
1
true
0
1
Something like: file:///usr/bin/ is generally used for local URI. But maybe just /usr/bin/ works too. Have you tried it?
1
0
0
I need to create a link button (gtk.LinkButton) with an URI to a local file. Does anyone know what is a valid URI format for a local file ? I want to specify a relative folder example: ../some_folder/file_i_need_to_open.txt If this is can't be done, I don't mind putting the file in the same folder as the python source ...
How to Specify URI to a local File in PyGtk LinkButton
1.2
0
0
396
6,395,657
2011-06-18T11:28:00.000
0
0
1
1
python,linux,packaging
6,396,113
4
false
0
0
If you know a little of C/C++, you could make a tiny C/C++ program which kinda Glues all your python scripts together and packs the Python interpreter with it making a pretty presentable executable. Google "Embedding python scripts into a C/C++ application" and look for the CPython Api reference in your python docs.
1
2
0
I want to give my python program to some people, and they will run this in Linux. What is the best way to do this ? Is it better to give them every script - I have 5 of them, or make it into an installer like *.deb Thank you.
What is the best way to give people your python program
0
0
0
176
6,395,923
2011-06-18T12:15:00.000
0
0
0
0
python,performance,pygame,frame-rate
6,396,048
6
false
0
1
You could try using Psyco (http://psyco.sourceforge.net/introduction.html). It often makes quite a bit of difference.
1
15
0
I am writing a simple top down rpg in Pygame, and I have found that it is quite slow.... Although I am not expecting python or pygame to match the FPS of games made with compiled languages like C/C++ or event Byte Compiled ones like Java, But still the current FPS of pygame is like 15. I tried rendering 16-color Bitmap...
Any way to speed up Python and Pygame?
0
0
0
29,233
6,397,495
2011-06-18T16:54:00.000
15
0
0
0
python,numpy,mmap
6,398,543
1
true
0
0
Yes, it's only closed when the object is garbage-collected; memmap.close method does nothing. You can call x._mmap.close(), but keep in mind that any further access to the x object will crash python.
1
15
1
I can't find any documentation on how numpy handles unmapping of previously memory mapped regions: munmap for numpy.memmap() and numpy.load(mmap_mode). My guess is it's done only at garbage collection time, is that correct?
Unmap of NumPy memmap
1.2
0
0
2,924
6,399,028
2011-06-18T21:34:00.000
1
0
1
0
python,eclipse,pydev
8,835,123
2
false
0
0
To check if you really have installed PyDev, go to Help->Install New Software. Click "What is already installed?" If you can see something like this "Pydev for Eclipse", then PyDev is already installed.
2
1
0
I've installed eclipse and now I'm trying to integrate pydev. In the eclipse SDK, I clicked on "Help", than "Install new software", and then "Add". Then the Add Repository box pops up and under "name" I type in "pydev" and under "location", I type in "http://pydev.org/updates/". It should accept that input but I get an...
Trouble installing pydev for Eclipse
0.099668
0
0
2,077
6,399,028
2011-06-18T21:34:00.000
2
0
1
0
python,eclipse,pydev
6,399,309
2
false
0
0
It sounds like you already have PyDev set up as a location. Go to Help/Install new software, but instead of clicking Add, click on the drop down box just to the left. That will show you all of the locations which are already set up. If the Pydev update URL is already there, just select it and then PyDev should show ...
2
1
0
I've installed eclipse and now I'm trying to integrate pydev. In the eclipse SDK, I clicked on "Help", than "Install new software", and then "Add". Then the Add Repository box pops up and under "name" I type in "pydev" and under "location", I type in "http://pydev.org/updates/". It should accept that input but I get an...
Trouble installing pydev for Eclipse
0.197375
0
0
2,077
6,399,975
2011-06-19T01:22:00.000
1
0
0
0
python,html,forms
6,400,025
3
false
1
0
If the POST values are stored in a dict you could turn this around and instead of looking for something that looks like a remove-# you generate all remove-# and try to use them to index the dict. That would limit the search to O(m) where m is the number of elements that can be removed.
2
0
0
I've got a form with a bunch of items. Beside each item is a "Remove" button. When one of buttons is pressed, I need to know which one so that I know which item to remove. The way I have it now, each button is named remove-# where # is the index of the item. In order to grab the # though I have to loop over every POST ...
Fastest way to handle a submit button with a variable in it?
0.066568
0
0
75
6,399,975
2011-06-19T01:22:00.000
1
0
0
0
python,html,forms
6,399,995
3
false
1
0
An option would be to put each remove button in a separate form, with a hidden value with a constant name and the value indicating which item to remove.
2
0
0
I've got a form with a bunch of items. Beside each item is a "Remove" button. When one of buttons is pressed, I need to know which one so that I know which item to remove. The way I have it now, each button is named remove-# where # is the index of the item. In order to grab the # though I have to loop over every POST ...
Fastest way to handle a submit button with a variable in it?
0.066568
0
0
75
6,400,416
2011-06-19T03:52:00.000
1
0
1
0
python,normalization,matching,similarity,edit-distance
51,191,970
10
false
0
0
The algorithms that are based on the Levenshtein distance are good (not perfect) but their main disadvantage is that they are very slow for each comparison and concerning the fact that you would have to compare every possible combination. Another way of working out the problem would be, to use embedding or bag of wor...
2
46
0
I'm working with a large database of businesses. I'd like to be able to compare two business names for similarity to see if they possibly might be duplicates. Below is a list of business names that should test as having a high probability of being duplicates, what is a good way to go about this? George Washington Midd...
Figure out if a business name is very similar to another one - Python
0.019997
0
0
28,431
6,400,416
2011-06-19T03:52:00.000
1
0
1
0
python,normalization,matching,similarity,edit-distance
6,400,464
10
false
0
0
What you can do is separate the words by whitespaces, commas, etc. and then you you count the number of words it have in common with another name and you add a number of words thresold before it is considered "similar". The other way is to do the same thing, but take the words and splice them for each caracters. Then f...
2
46
0
I'm working with a large database of businesses. I'd like to be able to compare two business names for similarity to see if they possibly might be duplicates. Below is a list of business names that should test as having a high probability of being duplicates, what is a good way to go about this? George Washington Midd...
Figure out if a business name is very similar to another one - Python
0.019997
0
0
28,431
6,400,986
2011-06-19T06:33:00.000
3
0
1
0
python,video,pygame
6,426,612
1
true
0
0
(I decided to risk posting this as an answer rather than a comment.) The three "hopeful" candidates for video editing/processing in Python that I have found are PyMedia (which I gave up on), PyGame (which may meet your needs but did not meet mine) and pyffmpeg (which is very promising but depends on Cython, and I could...
1
4
0
I am trying to make Pygame run some mpg vids for the intro of my rpg. But it isnt working. I have read the pygame docs and it says that video support is currently unstable and that i should use pymedia instead. I personally cannot make heads nor tails of pymedia. So is there ANY way to play videos with pygame?
How to play videos with pygame?
1.2
0
0
2,814
6,401,232
2011-06-19T07:53:00.000
1
0
0
0
python,http
6,401,242
2
false
0
0
Try parsing it as a HTTP request and catch dpkt.UnpackError so your program doesn't die if it's not a HTTP request. If no exception was thrown, you can use .method of the Request object to get the method that was used.
1
1
0
I'm using the function dpkt.http.Request(), but sometimes the http flow is not a request. Is there a quick way in python or dpkt to know if my request is GET or POST?
Best way to know if http request is GET or POST with DPKT?
0.099668
0
1
901
6,401,415
2011-06-19T08:44:00.000
1
0
0
0
java,python,applet
6,401,478
1
false
1
0
The universal API for browser addons is javascript. It is well supported in Firefox, Chromium/Chrome, and Opera at least; it is the only extension API available on the last two. Intersting API subsets are firefox's Fuel, Chromium's trimmed down extension api, and the very portable GreaseMonkey functions. A second runti...
1
0
0
We're writing a platform for building apps that are able to run on any browser and we were thinking, is there a way to do this with Python? Or should we better go with Java and Java Applets? I was also wondering, how hard is it to write a custom browser plugin? How long would it take e.g. in man-hours? Thank you!
Java applet or a custom browser plugin?
0.197375
0
0
550
6,403,429
2011-06-19T15:49:00.000
1
0
1
0
python,video,encoding,ffmpeg,mpeg-4
6,403,708
3
false
0
0
With OpenCV and the corresponding Python binding, you could use something like the function cv.WriteFrame. You could also use pyffmpeg, but that is geared more towards accessing individual frames from a video file.
1
3
0
I have a raw video frame source which I can access in Python. I'd like to create a MPEG4 video out of this, with MP3 background music. What kind of tools and libraries are available in Python for such a task? Preferably I'd like to have an API for which I can feed output filename and then individual frames as 24 bit ra...
Creating MPEG4 video file with Python from raw frames
0.066568
0
0
4,071
6,404,872
2011-06-19T20:13:00.000
2
0
1
1
python,concurrency,multiprocessing
6,404,965
3
true
0
0
Delegate the retrieval to a separate process which queues the requests until it is their turn.
2
13
0
I'm currently learning Python (from a Java background), and I have a question about something I would have used threads for in Java. My program will use workers to read from some web-service some data periodically. Each worker will call on the web-service at various times periodically. From what I have read, it's prefe...
What's the pythonic way to deal with worker processes that must coordinate their tasks?
1.2
0
0
526
6,404,872
2011-06-19T20:13:00.000
2
0
1
1
python,concurrency,multiprocessing
6,405,185
3
false
0
0
I think that you'll find that the multiprocessing module will provide you with some fairly familiar constructs. You might find that multiprocessing.Queue is useful for connecting your worker threads back to a managing thread that could provide monitoring or throttling.
2
13
0
I'm currently learning Python (from a Java background), and I have a question about something I would have used threads for in Java. My program will use workers to read from some web-service some data periodically. Each worker will call on the web-service at various times periodically. From what I have read, it's prefe...
What's the pythonic way to deal with worker processes that must coordinate their tasks?
0.132549
0
0
526
6,406,081
2011-06-20T01:10:00.000
1
0
0
1
python,c,unix,posix,system-calls
6,407,237
2
false
0
0
dup()'d file descriptors are not affected by close() calls of other instances; however, it's possible libvte may be calling some other shutdown methods which do change its state. Use strace to investigate in more detail. Apart from that, there are a few things you can do, but none of them are very pretty. One option wo...
1
3
0
There is a library (libvte, a terminal emulation library) that uses a pair of file descriptors for a pty master/slave pair. I need to be able to "steal" the master fd from the library for my own use (in order to implement support for ZMODEM for the very rare occasion when the only link I have to the 'net is via a term...
Prevent a file descriptor's closure on POSIX systems
0.099668
0
0
244
6,407,620
2011-06-20T06:35:00.000
0
0
1
0
python
6,407,643
4
false
0
0
Not sure if this is your question, but can't you just pass it as parameter to the constructor?
1
1
0
Before I used C, now I want to learn Python. I have a question, I have two class, how can I pass a variable address when I call the constructor, because I want to share a Queue between this two class( each class has a thread). Or does it have any other options to share a queue between two class.
Python pointers or queue share
0
0
0
1,027
6,408,665
2011-06-20T08:39:00.000
0
0
1
0
python,multithreading
6,408,691
2
false
0
0
The easiest solution is to use a mutex(lock) which will protect ALL accesses to the queue. Just make pop and push use it. A possible performance wise better solution might be to use more fine grain locking.
1
2
0
I have a queue in which i have to use it in several threads, so is it necessary to acquire the thread lock to avoid conflicts while processing this single queue, because i know it is necessary to acquire thread lock for variables or other resources, but little confused for queues. thanks
thread lock necessary for processing queues + Python
0
0
0
4,042
6,409,306
2011-06-20T09:35:00.000
7
0
0
0
javascript,python,ruby-on-rails,node.js,model-view-controller
6,409,663
3
false
1
0
Node.js is beating other platforms, sure. But it's not it's raw speed (V8), it's the sophisticated event-driven model which powers the node.js platform ;)
1
20
0
I find myself often needing performance & speed references for friends who still don't believe a Node.js or other Javascript-derived implementation or application can compete with those powered by Rails, Pure Ruby, .NET, Python and similar setups. I have seen very impressive reports on this, with graphs and eyecandy, b...
`Node.js` and/or other Javascript offshoots' performance, stability and speed relative to non-JS frameworks (Rails, Django...)
1
0
0
6,136
6,409,935
2011-06-20T10:39:00.000
2
1
1
0
python,module
6,409,965
3
false
0
0
It's in Python/Python/sysmodule.c.
2
9
0
I have found most python modules in python source directory, under Python/Lib or Python/Modules ,but where is the sys (import sys) module ? I didn't find it .
where is the sys module in python source code?
0.132549
0
0
18,447
6,409,935
2011-06-20T10:39:00.000
11
1
1
0
python,module
6,409,975
3
true
0
0
The Answer I find it here: ./Python/sysmodule.c If you're on Linux or Mac OS X, and in doubt, just try find . -name 'sysmodule.c' in the Python directory. Other Stuff The way I found it was by searching for the string "platform" throughout the Python directory (using TextMate), as I've used e.g. sys.platform before fro...
2
9
0
I have found most python modules in python source directory, under Python/Lib or Python/Modules ,but where is the sys (import sys) module ? I didn't find it .
where is the sys module in python source code?
1.2
0
0
18,447
6,415,316
2011-06-20T17:53:00.000
2
0
0
1
python,google-app-engine
6,418,275
1
true
1
0
each script entry in your app.yaml will be executed as a __main__ module. If you only want a single __main__ then you need to run everything through a single entry-point and map everything via a single WSGIApplication instance.
1
1
0
I'm building a data seeder module that looks for all models using introspection and the inspect module. I index the models I found by a string looking like module.model_name because there might be more modules with the same name in different modules. The problem is that module sometimes is indeed the right module name,...
Google App Engine __main__ module
1.2
0
0
332
6,415,651
2011-06-20T18:20:00.000
0
0
0
1
python,subprocess,portability,popen
6,419,758
3
false
0
0
Can 'cmd /c cmdstr' run correctly on windows?
3
0
0
I am using python and the codes are all worked well with non-portable version. Since I need to run the program on some computer that does not belong to me, which does not have installed python or such option available. I use portable python instead. However the codes previously works well now report error"WindowsError:...
Python (Portable 2.5) subprocess report problem "WindowsError: [Error 3] The system cannot find the path specified"
0
0
0
1,217
6,415,651
2011-06-20T18:20:00.000
1
0
0
1
python,subprocess,portability,popen
6,415,696
3
false
0
0
Ah, the problem is in the cmdStr variable. You must use absolute paths, or else have the user the process is running under have an appropriately setup PATH system variable. That or you have shell=False, which can cause problems in the subprocess module. Check the documentation for issues concerning paths etc.
3
0
0
I am using python and the codes are all worked well with non-portable version. Since I need to run the program on some computer that does not belong to me, which does not have installed python or such option available. I use portable python instead. However the codes previously works well now report error"WindowsError:...
Python (Portable 2.5) subprocess report problem "WindowsError: [Error 3] The system cannot find the path specified"
0.066568
0
0
1,217
6,415,651
2011-06-20T18:20:00.000
0
0
0
1
python,subprocess,portability,popen
6,419,798
3
false
0
0
subprocess.Popen(r"C:\Python27\python.exe",shell=True) can work correctly.
3
0
0
I am using python and the codes are all worked well with non-portable version. Since I need to run the program on some computer that does not belong to me, which does not have installed python or such option available. I use portable python instead. However the codes previously works well now report error"WindowsError:...
Python (Portable 2.5) subprocess report problem "WindowsError: [Error 3] The system cannot find the path specified"
0
0
0
1,217
6,416,782
2011-06-20T20:03:00.000
9
0
1
1
python,windows
6,416,978
4
true
0
0
It states that accessing it a second time while it is still open. You can still use the name otherwise, just be sure to pass delete=False when creating the NamedTemporaryFile so that it persists after it is closed.
3
3
0
The Python module tempfile contains both NamedTemporaryFile and TemporaryFile. The documentation for the former says Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later) What is ...
What is NamedTemporaryFile useful for on Windows?
1.2
0
0
2,825
6,416,782
2011-06-20T20:03:00.000
1
0
1
1
python,windows
6,416,972
4
false
0
0
You don't want to "rip out all the bits...". It's coded like that for a reason. It says you can't open it a SECOND time while it's still open. Don't. Just use it once, and throw it away (after all, it is a temporary file). If you want a permanent file, create your own. "Surely this is useful for something, since i...
3
3
0
The Python module tempfile contains both NamedTemporaryFile and TemporaryFile. The documentation for the former says Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later) What is ...
What is NamedTemporaryFile useful for on Windows?
0.049958
0
0
2,825
6,416,782
2011-06-20T20:03:00.000
0
0
1
1
python,windows
6,421,756
4
false
0
0
I'm pretty sure the Python library writers didn't just decide to make NamedTemporaryFile behave differently on Windows for laughs. All those _os.name == 'nt' tests will be there because of platform differences between Windows and Unix. So my inference from that documentation is that on Windows a file opened the way Nam...
3
3
0
The Python module tempfile contains both NamedTemporaryFile and TemporaryFile. The documentation for the former says Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later) What is ...
What is NamedTemporaryFile useful for on Windows?
0
0
0
2,825
6,417,942
2011-06-20T21:44:00.000
1
0
1
0
python,trace32
6,444,208
2
true
0
0
Use OS.Screen to make a command prompt session.
1
1
0
Is it possible to dispatch an external (python) script from Trace32 using its PRACTICE II scripting language?
Dispatching an external script from Trace32's PRACTICE II script?
1.2
0
0
2,288
6,417,986
2011-06-20T21:49:00.000
2
0
0
0
python,django,apache-flex,pyamf
6,418,097
1
false
1
0
If your Python/DJango app uses cookies for tracking sessions; then you just have to make sure that your SWF is served off the same domain that the Python app is served from. The Flash Player will pass the appropriate cookies to the remote server whenever it makes a call to that server. As long as your "Flash Call" e...
1
0
0
I have a simple site made with python (django). User registers, inputs some basic info and it stores it to mysql. User then is able to log in with his username/password which he created... Now i want to add a flex application which will run once the user is logged in, but i dont want the user to have to log in twice ...
Passing session info from python to flex
0.379949
0
0
213
6,420,088
2011-06-21T03:40:00.000
6
0
0
1
python,signals,extend
6,420,224
2
true
0
0
If you set a Python code signal handler using the signal module the interpreter will only run it when it re-enters the byte-code interpreter. The handler is not run right away. It is placed in a queue when the signal occurs. If the code path is currently in C code, built-in or extension module, the handler is deferred ...
1
6
0
What is the workflow of processing a signal in python ? I set a signal handler, when the signal occur ,how does python invoke my function? Does the OS invoke it just like C program? If I am in a C extend of python ,is it interrupted immediately ? Now it's clear to me how does python process handle a signal . When you ...
How does python process a signal?
1.2
0
0
1,742
6,421,356
2011-06-21T06:41:00.000
1
0
0
0
python,contrast,screen-brightness
6,421,386
3
false
0
0
This is something that is OS-specific and probably not doable without system-specific bindings.
1
1
0
I want to adjust screen brightness and contrast using Python. Does anyone know a library that can do this? How can the script be triggered using a keyboard shortcut?
Adjust screen brightness and contrast using Python?
0.066568
0
0
9,406
6,422,187
2011-06-21T08:09:00.000
7
0
1
1
python,multithreading,subprocess
6,422,313
1
true
0
0
Python (or rather CPython, the c-based implementation that is commonly used) has a Global Intepreter Lock (a.k.a. the GIL). Some kind of locking is necessary to synchronize memory access when several threads are accessing the same memory, which is what happens inside a process. Memory is not shared by between process...
1
4
0
In my application, I have tried python threading and subprocess module to open firefox, and I have noticed that subprocess is faster than threading. what could be the reason behind this? when to use them in place of each other?
Why thread is slower than subprocess ? when should I use subprocess in place of thread and vise versa
1.2
0
0
363
6,422,189
2011-06-21T08:09:00.000
3
0
1
0
python,ruby,development-environment,env
6,422,391
2
false
1
0
pip is 'the' tool for Python packages, replacing easy_install. Most people are using virtualenv for multiple python environments.
2
10
0
I'm just moving over from Ruby/Rails development to Python/Django and i'm trying to find the best replacements for RVM/Bundler/Capistrano but it seems to be a total mess? I've found these so far: pythonbrew virtualenv envwrapper pip easyinstall setuptools For capistrano I've found Fabric which seems to fit fairly we...
Python replacements for RVM/Bundler/Capistrano
0.291313
0
0
1,832
6,422,189
2011-06-21T08:09:00.000
3
0
1
0
python,ruby,development-environment,env
6,422,481
2
true
1
0
I have used pip/virtualenv/fabric extensively and am happy with it. You can't go wrong with this choice. I haven't used pythonbrew however, so I can't do any relative comparison.
2
10
0
I'm just moving over from Ruby/Rails development to Python/Django and i'm trying to find the best replacements for RVM/Bundler/Capistrano but it seems to be a total mess? I've found these so far: pythonbrew virtualenv envwrapper pip easyinstall setuptools For capistrano I've found Fabric which seems to fit fairly we...
Python replacements for RVM/Bundler/Capistrano
1.2
0
0
1,832
6,424,975
2011-06-21T12:08:00.000
5
0
0
0
python,python-2.7,selenium-webdriver,selenium-rc
7,946,600
2
false
0
0
I know this was already answered but it may help someone else. Another way to get your selenium server's version is right click the selenium-server.jar, and open it was any file archiver software such as 7zip or winrar. There you should find a file called VERSION.txt which will tell you your servers version
1
2
0
I am using selenium2 RC with the python client (selenium.py) and I need to get the version of the selenium on the server. (for example "2rc2","2rc3" etc.) is there any command i can send to the server to get its version?
how to get the version of Selenium RC server
0.462117
0
1
10,529
6,425,535
2011-06-21T12:54:00.000
4
0
0
0
python,django,model
6,426,206
4
false
1
0
Can you seriously envisage a possibility that you're going to just ditch the Django ORM, but keep everything else? Or that if you ditched Django totally, any of your code is still going to be applicable? You don't complain that if you ditched Django, you'll have to rewrite all your templates. Of course you will, that's...
4
15
0
So I have completed my OO analysis and design of a web application that I am building and am now getting into implementation. Design decisions have been made to implement the system using Python and the web development framework Django. I want to start implementing some of my domain entity classes which need persistenc...
Decoupling Domain classes from Django Model Classes
0.197375
0
0
2,441
6,425,535
2011-06-21T12:54:00.000
0
0
0
0
python,django,model
6,426,280
4
false
1
0
You would not have to "rewrite your models from scratch" if you wanted a different persistence mechanism. The whole point of an activerecord-style persistence system is that it imposes minimal constraints on the model classes, and acts largely transparently. If you're really worried, abstract out any code that relies o...
4
15
0
So I have completed my OO analysis and design of a web application that I am building and am now getting into implementation. Design decisions have been made to implement the system using Python and the web development framework Django. I want to start implementing some of my domain entity classes which need persistenc...
Decoupling Domain classes from Django Model Classes
0
0
0
2,441
6,425,535
2011-06-21T12:54:00.000
0
0
0
0
python,django,model
20,776,976
4
false
1
0
I think that there's no implemented solution for decoupling Django models and the domain classes, at least I haven't found any. In fact, the only ORM with such decoupling that I know exists only in Smalltalk world and it's called GLORP. It allows you to persist your domain model in a relational DB without having to mod...
4
15
0
So I have completed my OO analysis and design of a web application that I am building and am now getting into implementation. Design decisions have been made to implement the system using Python and the web development framework Django. I want to start implementing some of my domain entity classes which need persistenc...
Decoupling Domain classes from Django Model Classes
0
0
0
2,441
6,425,535
2011-06-21T12:54:00.000
3
0
0
0
python,django,model
6,426,080
4
false
1
0
Well, the way to go with Django is to inherit from Django's base model classes. This is the 'active record' pattern. Your django models will have all CRUD and query methods along with you business logic (if you decide to add it of course). This is seen as an anti-pattern in the java world, but the cool thing about it i...
4
15
0
So I have completed my OO analysis and design of a web application that I am building and am now getting into implementation. Design decisions have been made to implement the system using Python and the web development framework Django. I want to start implementing some of my domain entity classes which need persistenc...
Decoupling Domain classes from Django Model Classes
0.148885
0
0
2,441
6,429,397
2011-06-21T17:25:00.000
1
0
1
0
python,debugging,import,tkinter,importerror
6,440,612
2
true
0
1
This happens when you most likely have more than one Python installed on your system and you're running the program from a version different from the one you programmed it in. By default, a Python program on your PC will usually be opened in the latest edition of Python.
2
3
0
I'm getting a Tkinter error even though it was imported and used yesterday. I have a Windows 7 OS and am running Python 2, so I'm not sure what I'm supposed to do at this point. My google-fu is weak today, I can't seem to bring up anything relevant. Any input would be greatly appreciated.
"ImportError: No module named Tkinter" even though I've used Tkinter programs as recent as yesterday and no substantial changes were made?
1.2
0
0
4,656
6,429,397
2011-06-21T17:25:00.000
4
0
1
0
python,debugging,import,tkinter,importerror
12,694,818
2
false
0
1
You may want to check if the version of the Python interpreter used to run the script got changed somehow. import tkinter works in python 3 (instead of Tkinter).
2
3
0
I'm getting a Tkinter error even though it was imported and used yesterday. I have a Windows 7 OS and am running Python 2, so I'm not sure what I'm supposed to do at this point. My google-fu is weak today, I can't seem to bring up anything relevant. Any input would be greatly appreciated.
"ImportError: No module named Tkinter" even though I've used Tkinter programs as recent as yesterday and no substantial changes were made?
0.379949
0
0
4,656
6,429,772
2011-06-21T17:54:00.000
0
0
0
0
java,python,hadoop,machine-learning,bigdata
44,827,155
5
false
0
0
Python is gaining in popularity, has a lot of libraries, and is very useful for prototyping. I find that due to the many versions of python and its dependencies on C libs to be difficult to deploy though. R is also very popular, has a lot of libraries, and was designed for data science. However, the underlying language...
2
2
1
I am not sure if this question is correct, but I am asking to resolve the doubts I have. For Machine Learning/Data Mining, we need to learn about data, which means you need to learn Hadoop, which has implementation in Java for MapReduce(correct me if I am wrong). Hadoop also provides streaming api to support other...
ML/Data Mining/Big Data : Popular language for programming and community support
0
0
0
1,400
6,429,772
2011-06-21T17:54:00.000
0
0
0
0
java,python,hadoop,machine-learning,bigdata
6,436,938
5
false
0
0
I think in this field most popular combination is Java/Hadoop. When vacancies requires also python/perl/ruby it usually means that they are migrating from those script languages(usually main languages till that time) to java due to moving from startup code base to enterprise. Also in real world data mining application...
2
2
1
I am not sure if this question is correct, but I am asking to resolve the doubts I have. For Machine Learning/Data Mining, we need to learn about data, which means you need to learn Hadoop, which has implementation in Java for MapReduce(correct me if I am wrong). Hadoop also provides streaming api to support other...
ML/Data Mining/Big Data : Popular language for programming and community support
0
0
0
1,400
6,431,022
2011-06-21T19:38:00.000
1
0
0
1
python,windows-7
29,738,627
2
false
0
0
In the Task Scheduler, click Action tag, and then click Edit, by adding the directory of your program in the "Start in (optional):" you get rid of the message ".. is not recognized as an internal or external command, operable program or batch file.'
2
1
0
We have phone recording software running on a windows 7 box. We run a python script that tells a audio converter program sox, to convert the calls to mp3 format. When we run the script by double clicking it, it works fine. But when we run it through the windows task scheduler, we get the error message. 'Sox is not rec...
Program not running correctly from task scheduler
0.099668
0
0
566
6,431,022
2011-06-21T19:38:00.000
1
0
0
1
python,windows-7
6,431,263
2
false
0
0
You should add the program's full path or add the proper directory to your environment's PATH variable.
2
1
0
We have phone recording software running on a windows 7 box. We run a python script that tells a audio converter program sox, to convert the calls to mp3 format. When we run the script by double clicking it, it works fine. But when we run it through the windows task scheduler, we get the error message. 'Sox is not rec...
Program not running correctly from task scheduler
0.099668
0
0
566
6,431,487
2011-06-21T20:20:00.000
2
0
0
0
python,performance,grid,tkinter
6,432,380
2
true
0
1
I wrote a test program to display the data two ways, once using a frame and grid and once drawing text directly on the canvas. Using the frame+grid technique, the performance of 100 rows times 10 columns was quite acceptable. When I bumped that up to 200 rows the performance was more than 2x worse, and by the time I go...
1
0
0
I'm writing a Python application to parse a list of binary files, aggregate statistics on the data in them, and output results. I can easily output these results as a .tsv file, but this program is being written for the convenience of my coworkers, so I'm trying to have it display the results in a new window to sometim...
Size limitations of Tkinter grid manager
1.2
0
0
2,573
6,432,377
2011-06-21T21:46:00.000
4
1
1
0
python,environment,overhead
6,432,467
1
false
0
0
of course it adds a lot of overhead, and it would be (however negligibly) more eco-friendly to use a built-in poll or select(); but then you'd have to have a watchdog to see if it crashed, or use respawn from inittab. as long as the server load is fine, it might not be worth the effort. forgot to mention, memory leaks...
1
3
0
I have a background python script that gets ran several thousand times a day. I'm simply running it with python foo.py. The script itself does some imports (a parsing library and sqlalchemy) and then makes a database connection, makes the parsing and saves the data to db. I'm wondering if it adds a lot of overhead to l...
How expensive it is to load the environment to run a Python script?
0.664037
0
0
112
6,432,499
2011-06-21T21:56:00.000
1
0
0
0
python,statistics,numpy,probability,random-sample
6,432,586
9
false
0
0
Howabout creating 3 "a", 4 "b" and 3 "c" in a list an then just randomly select one. With enough iterations you will get the desired probability.
2
29
1
Given a list of tuples where each tuple consists of a probability and an item I'd like to sample an item according to its probability. For example, give the list [ (.3, 'a'), (.4, 'b'), (.3, 'c')] I'd like to sample 'b' 40% of the time. What's the canonical way of doing this in python? I've looked at the random module...
How to do weighted random sample of categories in python
0.022219
0
0
12,259
6,432,499
2011-06-21T21:56:00.000
0
0
0
0
python,statistics,numpy,probability,random-sample
6,432,588
9
false
0
0
I'm not sure if this is the pythonic way of doing what you ask, but you could use random.sample(['a','a','a','b','b','b','b','c','c','c'],k) where k is the number of samples you want. For a more robust method, bisect the unit interval into sections based on the cumulative probability and draw from the uniform dist...
2
29
1
Given a list of tuples where each tuple consists of a probability and an item I'd like to sample an item according to its probability. For example, give the list [ (.3, 'a'), (.4, 'b'), (.3, 'c')] I'd like to sample 'b' 40% of the time. What's the canonical way of doing this in python? I've looked at the random module...
How to do weighted random sample of categories in python
0
0
0
12,259
6,432,826
2011-06-21T22:34:00.000
0
0
0
0
python,xml
6,433,113
4
false
0
0
I can vouch for ElementTree - it's not a particularly complete XML implementation. It's main strength is simplicity of use of the DOM tree objects. They behave like regular pythonic objects (sequences and dicts) even though their actual implementation is somewhat more complex than appearances might suggest. Of all the ...
1
3
0
What is the preferred XML processor to use with Python? Some choices are minidom PyXML ElementTree ... EDIT: I will need to be able to read in documents and manipulate them. I also require pretty print functionality.
Preferred Python XML processor
0
0
1
404
6,433,574
2011-06-22T00:29:00.000
1
0
0
0
python,windows,filesystems,icons,wxpython
6,433,722
2
false
0
1
I think there's not only one portable way to accomplish this ... on windows platforms, default icons for file types associations are stored on the system registry (except for executables where the icon is in the exe resources) and on linux platforms it depends on the desktop environment, each one has its own standards ...
1
1
0
I would like to write a Python/wxPython app that implements wx.FileDropTarget. This part is easy. I would also like to show the file icon as it is dragged over the app window and then display a proxy with file icon (and other meta-data, perhaps, like size) within the app window. I would like to implement this on Window...
Accessing file meta-data within Python/wxPython
0.099668
0
0
600
6,434,530
2011-06-22T03:17:00.000
-1
0
0
0
python,google-app-engine,svg
6,434,768
2
true
1
0
If you manage to find (or write) a pure Python library to do this, it is likely to be prohibitive to run it on GAE due to the amount of computation required and the request time restrictions. I would consider hosting the image conversion service elsewhere and have the GAE fetch the PNGs from there
1
3
0
How to convert SVG to PNG or JPG image with Python on Google Application Engine? Any idea? Google Application Engine has PIL support. However, PIL doesn't support SVG.
Sever Side convert SVG to PNG or JPG image with Python on Google Application Engine
1.2
0
0
2,517
6,435,000
2011-06-22T04:45:00.000
6
1
0
0
python,django,ide
6,714,141
3
true
1
0
I have Pycharm setup on a Ubuntu 10.10. The key is to use "sshfs" - it maps to my web-host - via ssh. Those are the pre-reqs : ssh access, sshfs. (unless you can figure out a way to map ssh to a windows shared drive). So once ssh, sshfs are setup, I create a linux mount locally - so my webhost's directory appears loca...
1
8
0
I'm looking for an IDE that will allow me to edit remote Python projects and also has decent Django support, remote command execution, and maybe remote debugging. I've tried PyCharm and Aptana with PyDev but I'm not having much luck configuring them for remote editing. Thanks for your help!
Python and Django IDE with remote editing?
1.2
0
0
5,204
6,435,319
2011-06-22T05:29:00.000
10
0
1
0
python,keyword-argument
6,435,667
3
false
0
0
The key is consistency. In your personal code and in the project on which you're working. If I'm reading your code and see you using **kwarguments in all functions, I can calibrate myself to read it fine. If you use **k in one place and **kargs in another, that's a different story. As for conventions in Python code ge...
3
24
0
Is there a python naming convention for key word arguments?
What is the Python convention **kwargs vs **kwds vs **kw?
1
0
0
11,502
6,435,319
2011-06-22T05:29:00.000
17
0
1
0
python,keyword-argument
6,435,329
3
true
0
0
Nope, but normally it is named as **kwargs, but you can name it anything you want. Only thing is it should come at the last following any position args and named args.
3
24
0
Is there a python naming convention for key word arguments?
What is the Python convention **kwargs vs **kwds vs **kw?
1.2
0
0
11,502
6,435,319
2011-06-22T05:29:00.000
11
0
1
0
python,keyword-argument
6,435,330
3
false
0
0
The convention is **kwargs, as seen in documentation and PEPs.
3
24
0
Is there a python naming convention for key word arguments?
What is the Python convention **kwargs vs **kwds vs **kw?
1
0
0
11,502
6,436,935
2011-06-22T08:23:00.000
0
0
0
1
python,twisted,reactor
6,436,989
2
false
0
0
Call the Qt message checking/handling functions in the idle event of the Win32 reactor.
1
4
0
I am running a Qt application on Linux using the qt4reactor The application sends and receives bytes on the serial port. This works very well on Linux with the QtReactor However when I port the application to windows then I have a problem. On windows I use the SerialPort class from _win32SerialPort. The doc string in _...
How to get around the need for multiple reactors in twisted
0
0
0
600
6,436,979
2011-06-22T08:26:00.000
2
0
0
0
python,django,apache
6,436,999
1
true
1
0
HTTPd using a different version/install of Python than your REPL.
1
1
0
I have a problem with python and Django. I have the error "Error was: No module named httplib2", so i installed httplib2. When i go on my console and type "import httplib2" it works! But when i try to do that on my web page, it fails. Any idea? Thank you!
Why python module not found on apache
1.2
0
0
581
6,439,790
2011-06-22T12:26:00.000
2
0
0
0
python,sockets,networking,reset
6,440,026
3
false
0
0
To send an RST on a TCP connection, set the SO_LINGER option to true with a zero timeout, then close the socket. This resets the connection. I have no idea how to do that in Python, or indeed whether you can even do it.
1
25
0
I am using python’s socket.py to create a connection to an ftp-server. Now I want to reset the connection (send a RST Flag) and listen to the response of the ftp-server. (FYI using socket.send('','R') does not work as the OS sends FIN flag instead of RST.)
Sending a reset in TCP/IP Socket connection
0.132549
0
1
25,931
6,440,474
2011-06-22T13:15:00.000
0
0
1
1
python,multicore,multiprocessing
6,440,883
3
false
0
0
Sounds like a good strategy, but you don't need the multiprocessing module for it, but rather the subprocess module. subprocess is for running child processes from a Python program and interacting with them (stdio, stdout, pipes, etc.), while multiprocessing is more about distributing Python code to run in multiple pro...
1
5
0
This question is more fact finding and thought process than code oriented. I have many compiled C++ programs that I need to run at different times and with different parameters. I'm looking at using Python multiprocessing to read a job from job queue (rabbitmq) and then feed that job to a C++ program to run (maybe subp...
Python multiprocessing
0
0
0
2,456
6,442,959
2011-06-22T16:01:00.000
0
0
1
0
python,syntax,import
6,443,008
2
false
1
0
You would have to import the class to get access to the instance method you've defined on the class.
1
2
0
models.py def operation(argument): #Operation return variable class X(models.Model) a = models ... b = models ... I am trying to import operation in my views.py .. When I try using from project.models import operation But then I get the following error ImportError: cannot im...
Python - How to import functions?
0
0
0
1,269
6,444,458
2011-06-22T18:08:00.000
-2
0
1
0
jquery,python
6,444,570
4
false
1
0
Why would you say "without using JSON"? That's exactly what JSON is for.
1
1
0
I've a python script that returns something. In a html page, I use jQuery to send a GET request to this script (with $.get()). I want the "return" of python script in a jQuery/javascript var. Is it possible with jQuery function? Without use JSON or other.
Python function return to jQuery var
-0.099668
0
0
1,309
6,444,548
2011-06-22T18:17:00.000
8
0
1
0
python,python-imaging-library,image
47,486,856
7
false
0
0
Since scipy's imread is deprecated, use imageio.imread. Install - pip install imageio Use height, width, channels = imageio.imread(filepath).shape
1
386
0
How do I get a size of a pictures sides with PIL or any other Python library?
How do I get the picture size with PIL?
1
0
0
486,777
6,445,620
2011-06-22T19:48:00.000
0
0
1
0
python,python-2.7,winapi
6,448,014
1
false
0
0
One approach that might work would be to do something like so: get the window handle (FindWindow() or something similar, there are a few ways to do this) get the window dimensions (GetClientRect() or GetWindowRect()) get the device context for the window (GetWindowDC()) get the image data from the window (BitBlt() or ...
1
1
0
I am a new programmer with little experience but I am in the process of learning Python 2.7. I use Python(x,y) or Spydar as the programs are called on Windows 7. The main packages I'm using are numpy, pil and potentially win32gui. I am currently trying to write a program to mine information from a 3rd-party software....
Hijacking, redirecting, display output with Python 2.7
0
0
0
287
6,446,385
2011-06-22T20:50:00.000
2
1
0
0
java,python,ruby,lamp
6,446,503
4
false
1
0
I think you're trying to read too much into what it means. The acronym became popular because they were often used together and it was easy to pronounce. It doesn't have any meaning or implication beyond the literal one. There's also WAMP (Windows), LAPP (PostgreSql) and whatever else you want to make up.
4
3
0
I'm a Java web developer that knows a bit of Python (but haven't done any Python web development), and I am curious what exactly is meant by a LAMP stack. I understand this to be Linux-Apache-MySQL-(PHP, Perl, or Python), but I don't understand what unites these three languages other than the letter P. Is a LAMP stack ...
What is the significance of the 'P' in LAMP? Why is it PHP, Perl, or Python?
0.099668
0
0
6,337
6,446,385
2011-06-22T20:50:00.000
1
1
0
0
java,python,ruby,lamp
6,447,007
4
false
1
0
Besides being popular Web development languages, Perl, PHP, and Python share something else: They are all dynamically typed languages, and notoriously fast to develop in. I believe this is part of the "spirit" of LAMP. So, while it's true you could substitute any other language in for the 'P', some languages fit the ...
4
3
0
I'm a Java web developer that knows a bit of Python (but haven't done any Python web development), and I am curious what exactly is meant by a LAMP stack. I understand this to be Linux-Apache-MySQL-(PHP, Perl, or Python), but I don't understand what unites these three languages other than the letter P. Is a LAMP stack ...
What is the significance of the 'P' in LAMP? Why is it PHP, Perl, or Python?
0.049958
0
0
6,337
6,446,385
2011-06-22T20:50:00.000
8
1
0
0
java,python,ruby,lamp
6,446,413
4
true
1
0
It's just so happens that the most commonly used components in that part of the stack all happened to begin with a P. It's nothing more than a coincidence. The LAMP acronym was coined before Ruby gained its current popularity levels and there's no reason why you couldn't stick Ruby in the P slot.
4
3
0
I'm a Java web developer that knows a bit of Python (but haven't done any Python web development), and I am curious what exactly is meant by a LAMP stack. I understand this to be Linux-Apache-MySQL-(PHP, Perl, or Python), but I don't understand what unites these three languages other than the letter P. Is a LAMP stack ...
What is the significance of the 'P' in LAMP? Why is it PHP, Perl, or Python?
1.2
0
0
6,337
6,446,385
2011-06-22T20:50:00.000
7
1
0
0
java,python,ruby,lamp
6,446,566
4
false
1
0
I believe the P originally stood mainly for PHP, as that particular combination was extremely widely used. It got expanded to include Python and Perl as non-PHP languages became more popular for web development, and never expanded further because it would have broken the acronym. LAMP is a de facto standard way of doin...
4
3
0
I'm a Java web developer that knows a bit of Python (but haven't done any Python web development), and I am curious what exactly is meant by a LAMP stack. I understand this to be Linux-Apache-MySQL-(PHP, Perl, or Python), but I don't understand what unites these three languages other than the letter P. Is a LAMP stack ...
What is the significance of the 'P' in LAMP? Why is it PHP, Perl, or Python?
1
0
0
6,337
6,447,015
2011-06-22T21:54:00.000
1
0
1
0
python,cpu,mpi,cluster-computing,cpu-usage
6,447,050
2
true
0
0
Run time your-command, which includes a cpu time column and accounts for children.
1
1
0
In order to run a python script on a large deployment, I need to find out the "total CPU hours" that my script uses. The script executes a separate program (a simulation that, notably, uses MPI), which needs to be included in the count. What is the best, and most precise, way of doing this? To be more specific, the tot...
Total "CPU hours" in Python
1.2
0
0
298
6,447,048
2011-06-22T21:57:00.000
2
0
1
0
python
6,447,191
3
false
0
0
It's largely a matter of personal taste. As a rule of thumb, you don't want any single function to be "too long", say, not so long that you can't see it all on one screen. If you have dozens of command line options, you might move the arg parsing out of main(). If you have dozens of lines of code that sets up logging,...
2
2
0
I am an intermediate level Python Programmer and I have written a Python program that scrapes Mutual Fun NAV data from a web site and inserts those into a database. The code is around 176 lines long and has logic related to command line option processing using the argparse module and logging logic using the logger modu...
Should command line option processing logic and logging logic be a separate function or part of the main loop in a Python program
0.132549
0
0
193
6,447,048
2011-06-22T21:57:00.000
2
0
1
0
python
6,447,094
3
false
0
0
Proper design principles require the code to be readable and easy t maintain. If there are functions, they should be self-contained and (at least theoretically) re-usable, otherwise there's little sense in them. Command line processing usually takes place at the very beginning of the program execution, I'd consider pl...
2
2
0
I am an intermediate level Python Programmer and I have written a Python program that scrapes Mutual Fun NAV data from a web site and inserts those into a database. The code is around 176 lines long and has logic related to command line option processing using the argparse module and logging logic using the logger modu...
Should command line option processing logic and logging logic be a separate function or part of the main loop in a Python program
0.132549
0
0
193
6,447,388
2011-06-22T22:38:00.000
2
0
1
0
python,arrays,list,iterable
6,447,394
5
false
0
0
What about [e for e in iterable]? And, to satisfy the extra requirement: iterable if isinstance(iterable,list) else [e for e in iterable]
1
5
0
This just has to be a dupe, but I just didn't find any existing instance of this question... What is the easiest way to convert any iterable to an array in Python (ideally, without importing anything)? Note: Ideally, if the input is an array then it shouldn't duplicate it (but this isn't required).
Convert Any Iterable to Array in Python
0.07983
0
0
12,955
6,448,742
2011-06-23T02:35:00.000
1
1
1
0
python,memory-management,memory-leaks,garbage-collection,cython
6,448,987
6
false
0
0
CPython (the original and most used Python) uses a ref counting approach for garbage collection: objects which are no longer referenced are immediately freed. Therefore if you don't create any cycles then the garbage collector, which only exists to detect cycles, shouldn't be getting invoked much.
6
7
0
OK, so we are developing an network related application where the user can upload their own python scripts to decide for an algorithm. Our code contains c and cython and python modules. Since avoiding latency, memory footprint and minimal processing is critical for us, we were wondering if it's a wise and effective (p...
Does garbage collection make python slower?
0.033321
0
0
2,303
6,448,742
2011-06-23T02:35:00.000
18
1
1
0
python,memory-management,memory-leaks,garbage-collection,cython
6,448,754
6
false
0
0
Just let the language do what it wants to do, and if you find you have an actual problem, come on back and post about it. Otherwise it's premature optimization.
6
7
0
OK, so we are developing an network related application where the user can upload their own python scripts to decide for an algorithm. Our code contains c and cython and python modules. Since avoiding latency, memory footprint and minimal processing is critical for us, we were wondering if it's a wise and effective (p...
Does garbage collection make python slower?
1
0
0
2,303
6,448,742
2011-06-23T02:35:00.000
11
1
1
0
python,memory-management,memory-leaks,garbage-collection,cython
6,448,994
6
true
0
0
gc.disable only turns off the cyclic garbage collector. Objects will still be collected when the refcount drops to zero anyway. So unless you have a lot of cyclic references, it will make no difference. Are you are talking about doing a customised Python build and disabling the ref counting GC?
6
7
0
OK, so we are developing an network related application where the user can upload their own python scripts to decide for an algorithm. Our code contains c and cython and python modules. Since avoiding latency, memory footprint and minimal processing is critical for us, we were wondering if it's a wise and effective (p...
Does garbage collection make python slower?
1.2
0
0
2,303
6,448,742
2011-06-23T02:35:00.000
5
1
1
0
python,memory-management,memory-leaks,garbage-collection,cython
6,448,778
6
false
0
0
Just develop the application so that it is functionally correct. Once you've got a correct application fire up the profiler and determine where the slow bits are. If you're worried about user script performance, you're probably focussing on the wrong thing. A shorter answer is that it is probably unwise and ineffective...
6
7
0
OK, so we are developing an network related application where the user can upload their own python scripts to decide for an algorithm. Our code contains c and cython and python modules. Since avoiding latency, memory footprint and minimal processing is critical for us, we were wondering if it's a wise and effective (p...
Does garbage collection make python slower?
0.16514
0
0
2,303
6,448,742
2011-06-23T02:35:00.000
4
1
1
0
python,memory-management,memory-leaks,garbage-collection,cython
6,448,786
6
false
0
0
Garbage collection makes everything slower. It also makes everything much less error-prone. Especially if the point is to run user-uploaded scripts, I have a hard time believing the trade-off will work out well; if you have any leaks or double frees, you now have a DoS vulnerability if someone can figure out how to tri...
6
7
0
OK, so we are developing an network related application where the user can upload their own python scripts to decide for an algorithm. Our code contains c and cython and python modules. Since avoiding latency, memory footprint and minimal processing is critical for us, we were wondering if it's a wise and effective (p...
Does garbage collection make python slower?
0.132549
0
0
2,303
6,448,742
2011-06-23T02:35:00.000
2
1
1
0
python,memory-management,memory-leaks,garbage-collection,cython
6,449,666
6
false
0
0
I've spent quite a bit of time working in languages with automatic garbage collection and I can say almost unilaterally that trusting the native garbage collection will be faster and more reliable than a custom solution.
6
7
0
OK, so we are developing an network related application where the user can upload their own python scripts to decide for an algorithm. Our code contains c and cython and python modules. Since avoiding latency, memory footprint and minimal processing is critical for us, we were wondering if it's a wise and effective (p...
Does garbage collection make python slower?
0.066568
0
0
2,303
6,448,814
2011-06-23T02:48:00.000
3
0
0
0
python,web-services,web-applications
6,448,835
3
true
1
0
Go check out Google App Engine. There's a Python API. It works well with other Google services, like Calendar. Probably the fastest way to get where you want to go.
1
2
0
I have a Python script that can run in command line/console which works with the Google Calendar Data API to do some tasks like retrieve calendars and modify or update events. I want to turn it into a web application/interface, but was not sure what would be the optimal or simplest way going about it. Some precursor in...
Python - from Script to Web App?
1.2
0
1
947
6,450,283
2011-06-23T06:45:00.000
1
0
0
0
direct3d,python-idle,vertical-sync
6,458,750
1
true
0
1
You don't specify which version of Direct3D you're using. With D3D9 you can pass D3DPRESENT_DONOTWAIT to your Present() call and it will return D3DERR_WASSTILLDRAWING if the hardware is busy processing or waiting for a vertical sync interval. This means if you have vsync enabled, in your main loop you can just call Pre...
1
0
0
I want to be able to load/download a bunch of resources and notify the user of the file that's currently being loaded, but I can't just draw a frame after each file starts loading because v-sync will wait until it can draw a frame before it continues (bottle-necking the loads to less than 60/second). Is there a way to ...
How can I perform actions while waiting for vertical sync?
1.2
0
0
1,246
6,451,692
2011-06-23T09:06:00.000
11
0
1
0
python,python-3.x
6,452,301
3
false
0
0
It is the job of the operating system to schedule CPU time. Use your operating system's built-in process-limits mechanisms (hopefully they exist on Windows) to restrict your process to <1% CPU. This style of sprinkling unnecessary sleeps every few lines in the code will make the code terrible to create and extend and m...
1
1
0
I am developing some Python code for Windows. A criteria is that it will use less than 1% of CPU. I understand that it is impossible to guarantee this all the time due to things like garbage collection, but what would be the best practice to get as close as possible. My current solution is to spread a lot of time.sleep...
How to run Python code using less than 1% of CPU?
1
0
0
1,264
6,451,919
2011-06-23T09:25:00.000
2
0
0
0
silverlight,python-idle,dispatchertimer
9,692,923
2
false
1
1
Handled events will not bubble up to root control. Instead you should use the AddHandler method with handledEventsToo = true.
1
6
0
What's the best way to detect idle state for a silverlight application? I have read quite a few articles on the net by now and usually they are either for wpf/mobile apps etc. I have created a DispatcherTimer which locks the screen after 5 minutes and it seems that I will have to go to every widget in every screen(my ...
idle state detection silverlight 4 application
0.197375
0
0
1,573
6,453,067
2011-06-23T11:08:00.000
2
0
0
0
python,cursor,mysql-python
6,453,159
1
true
0
0
Should I close properly my cursor? Yes, you should. Explicit is better than implicit. Should I create new cursors for every query, or one cursor is enough for multiple different queries in the same DB? This depends on how you use this cursor. For simple tasks it is enough to use one cursor. For some complex...
1
2
0
I'm trying to figure out how to use python's mysqldb. I can do my job with my current knownledge, but I want to use the best practices. Should I close properly my cursor? Exiting the program isn't close it autmatically? (Shouldn't I expect the object destructor to do it anyway?) Should I create new cursors for every qu...
How to properly use mysqldb in python
1.2
1
0
742
6,455,046
2011-06-23T13:45:00.000
0
0
0
1
python,celery,celerybeat
6,455,760
4
false
1
0
You can try adding a classfield to the object that holds the function that youre making run and use that field as a "some other guy is working or not" control
1
4
0
I have a task which I execute once a minute using celerybeat. It works fine. Sometimes though, the task takes a few seconds more than a minute to run because of which two instances of the task run. This leads to some race conditions that mess things up. I can (and probably should) fix my task to work properly but I wan...
Making only one task run at a time in celerybeat
0
0
0
3,061
6,456,627
2011-06-23T15:28:00.000
3
0
0
0
python,django,performance,django-templates
6,457,582
3
false
1
0
This is like the argument about the most efficient way to append strings (virtually every programming language has that argument). This is 2011, not 1970. Even consumer level computers have processing power and memory reserves to match the supercomputers of the last decade. Network server-class machines have much more....
3
4
0
Which is more efficient in Django: to render an object using the template language? or to push the code to render the object via a templatetag function using the python language?
django templates performance
0.197375
0
0
673
6,456,627
2011-06-23T15:28:00.000
3
0
0
0
python,django,performance,django-templates
6,456,742
3
false
1
0
The question is sort-of nonsensical. Templates are always going to be slower than a hand-tuned rendering solution, but template tags still need to run through the Template machinery, so you lose out any advantage there. If you want ultra-high efficiency, consider writing all of the HTML as an array of Python strings,...
3
4
0
Which is more efficient in Django: to render an object using the template language? or to push the code to render the object via a templatetag function using the python language?
django templates performance
0.197375
0
0
673