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
8,177,403
2011-11-18T03:29:00.000
5
0
0
0
python,xmpp,google-talk
8,189,697
2
true
0
0
The answer is that you exposed a bug in SleekXMPP that I need to fix :) The changed_status event was firing for any presence stanza received, and not firing only when a resource's status or show value changed. The bug fix is now in the develop branch and it will be in the soon-to-be RC3 release.
2
2
0
I am using sleekxmpp to connect to Google Talk. I am trying to track when contacts change their status using the changed_status event. The issue I am having is that as I log a status change, the function associated with the changed_status event seems to be called multiple times. Why might this be? I am thinking it has ...
sleekxmpp changed_status event, firing multiple times
1.2
0
1
471
8,177,637
2011-11-18T04:05:00.000
3
0
1
0
python,python-sphinx,restructuredtext
8,229,489
2
false
0
0
The correct way would be Do not include copy.rst in any .. toctree:. This way this page will not come in next/previous. Write :orphan: to the first line of copy.rst. This way you will not see any compiler warning.
1
2
0
I have the confidentiality text in its own "copy.rst" document. How can I include it without it showing up in the toctree?
Including confidentiality information in Sphinx reST
0.291313
0
0
272
8,179,068
2011-11-18T07:24:00.000
1
0
0
0
python,sqlalchemy
8,179,370
2
false
0
0
I had a few situations where my sqlalchemy application would load multiple instances of the same object (multithreading/ different sqlalchemy sessions ...). It was absolutely necessary to override eq() for those objects or I would get various problems. This could be a problem in my application design, but it probably ...
1
11
0
I'm working with SQLAlchemy for the first time and was wondering...generally speaking is it enough to rely on python's default equality semantics when working with SQLAlchemy vs id (primary key) equality? In other projects I've worked on in the past using ORM technologies like Java's Hibernate, we'd always override .eq...
sqlalchemy id equality vs reference equality
0.099668
1
0
4,581
8,181,576
2011-11-18T11:21:00.000
6
0
1
0
java,python,interface,abstract-class
8,181,715
4
false
1
0
I'm not that familiar with Python, but I would hazard a guess that it doesn't. The reason why interfaces exist in Java is that they specify a contract. Something that implements java.util.List, for example, is guaranteed to have an add() method to conforms to the general behaviour as defined on the interface. You cou...
1
48
0
I have a number of classes which all share the same methods, only with different implementations. In Java, it would make sense to have each of these classes implement an interface or extend an abstract class. Does Python have anything similar to this, or should I be taking an alternative approach?
Java abstract/interface design in Python
1
0
0
23,337
8,183,670
2011-11-18T14:05:00.000
0
0
1
0
python,python-idle
8,302,914
1
true
0
0
It appears IDLE doesn't cope with paths that have spaces in them. I worked around the problem by choosing directory paths that don't have spaces.
1
0
0
I just downloaded the latest Python IDLE 3.2 for Windows 7 (64-bit). I can open, edit, and save existing .py files, but if I open a new document and try to save it, IDLE hangs. After a few attempts, I tried using a regular text editor to create a hello world program (plain ASCII). But I cannot even open that file: IDL...
Python IDLE hangs when opening/saving files
1.2
0
0
1,467
8,185,374
2011-11-18T16:10:00.000
1
1
0
0
python,nginx,php
10,713,125
4
false
1
0
You can try uwscgi. Easy to config and high performance.
1
1
0
We are currently using nginx as a web server along with PHP-FPM as the php application service. We have a small application which needs to be built but must use Python3. Is their a similar option to use for Python?
using python like php with nginx
0.049958
0
0
3,316
8,185,834
2011-11-18T16:45:00.000
3
0
0
1
python,google-app-engine,google-cloud-datastore
8,186,860
2
true
1
0
vacuum_indexes is only for indexes defined in index.yaml, for automatic index its enough to set indexed = False and uploaded a new version. You can see the impact of setting indexed to False in the development server datastore page in the write counts column.
2
2
0
So I have a live Python application on App Engine that has far too many automatic indexes. I noticed a high amount of datastore writes for my low entity count and I believe this is the cause. Each entity has many StringProperties and some even have StringListProperties. I added the indexed = False to all my object's pr...
How can I delete the automatic Indexes in App Engine?
1.2
0
0
185
8,185,834
2011-11-18T16:45:00.000
1
0
0
1
python,google-app-engine,google-cloud-datastore
8,189,761
2
false
1
0
To get rid of the existing automatic indices you will have to retrieve every single entity and re-put it with the indexed = False properties. If you don't do this, then the automatic indices will stick around. However, the new entities you create will not be added to those indices.
2
2
0
So I have a live Python application on App Engine that has far too many automatic indexes. I noticed a high amount of datastore writes for my low entity count and I believe this is the cause. Each entity has many StringProperties and some even have StringListProperties. I added the indexed = False to all my object's pr...
How can I delete the automatic Indexes in App Engine?
0.099668
0
0
185
8,187,104
2011-11-18T18:20:00.000
8
0
1
0
python,multithreading,queue
8,187,278
1
true
0
0
Queue objects do not provide random access. However, you can achieve the same goal by retaining references to the objects in the queue somewhere else and marking them stale. When the object is read from the queue, the consumer can check to see if the object is stale, and if it is, throw it away and read again. You ma...
1
9
0
Is it possible to remove an item and have the queue for multithreading reorder itself in Python? I have users queued up in a Queue, but when it's time to process the user and if the user disconnects, that will raise an issue. Is there a way to do this? Thanks
Remove an item from the middle of a Queue?
1.2
0
0
11,747
8,187,461
2011-11-18T18:43:00.000
6
0
1
1
python,batch-file
8,187,496
2
true
0
0
Refactor them into modules, then make a new script that imports the relevant functions from each module and runs those. The easiest way to do this is to write a main function per module and run all the main function serially.
1
2
0
I frequently find that I need to run a series of python scripts sequentially. The order and number of these scripts may vary, but instead of executing each script individually and sequentially, is there a preferred way of batch automating a series of Python scripts? My programs require multiple and complex file path an...
How to execute a series of Python scripts in batch?
1.2
0
0
2,093
8,187,959
2011-11-18T19:24:00.000
1
0
0
0
.net,python,xml
8,188,895
5
false
0
0
You'll find that the problem only occurs if you set the Indent property in the XmlWriterSettings to true. When Indent == false, there is no space inserted. But if you want indentation, you have to live with that space. So perhaps the solution to your program is to turn off indentation in both tools? This is unfortunate...
3
4
0
I have a situation where XML data is being processed by two different mechanisms. In one place it is being processed using Python's xml.dom.minidom library. In the other, similar processing is being performed in .NET, via an XmlTextWriter. In the output generated by the Python code, empty elements are written <ElementN...
Can I tell an XmlTextWriter to write instead of ?
0.039979
0
1
505
8,187,959
2011-11-18T19:24:00.000
0
0
0
0
.net,python,xml
8,188,391
5
false
0
0
If you're just looking for file integrity wouldn't a MD5 (or something similar) of the file be sufficient?
3
4
0
I have a situation where XML data is being processed by two different mechanisms. In one place it is being processed using Python's xml.dom.minidom library. In the other, similar processing is being performed in .NET, via an XmlTextWriter. In the output generated by the Python code, empty elements are written <ElementN...
Can I tell an XmlTextWriter to write instead of ?
0
0
1
505
8,187,959
2011-11-18T19:24:00.000
0
0
0
0
.net,python,xml
8,188,032
5
false
0
0
I would just post-process the output to do search/replace instead of trying to mess with the library
3
4
0
I have a situation where XML data is being processed by two different mechanisms. In one place it is being processed using Python's xml.dom.minidom library. In the other, similar processing is being performed in .NET, via an XmlTextWriter. In the output generated by the Python code, empty elements are written <ElementN...
Can I tell an XmlTextWriter to write instead of ?
0
0
1
505
8,188,805
2011-11-18T20:38:00.000
2
0
0
1
python,shell,python-idle
8,188,836
3
false
0
0
Restart Shell has a keyboard shortcut of ctrl+F6, you could always try that.
2
7
0
In IDLE on Windows, on the menu bar, there is a Shell menu. One of the items on the Shell menu is 'Restart Shell'. The Shell menu is not available in IDLE on Linux. The Restart Shell command is useful after you have made a change in a module and want to run the module again in the shell. In IDLE on Linux, I have to clo...
How do I restart the IDLE Python Shell in Linux?
0.132549
0
0
19,002
8,188,805
2011-11-18T20:38:00.000
1
0
0
1
python,shell,python-idle
12,849,592
3
false
0
0
IDLE have two modes of operation - with subprocess and without it. The 'restart shell' option is available only with subprocess. The default mode is with subprocess, but it can be changed using the argument '-n' when starting IDLE. Apparently, the menu item that starts IDLE on Linux does that with the '-n' argument. Op...
2
7
0
In IDLE on Windows, on the menu bar, there is a Shell menu. One of the items on the Shell menu is 'Restart Shell'. The Shell menu is not available in IDLE on Linux. The Restart Shell command is useful after you have made a change in a module and want to run the module again in the shell. In IDLE on Linux, I have to clo...
How do I restart the IDLE Python Shell in Linux?
0.066568
0
0
19,002
8,189,641
2011-11-18T21:54:00.000
0
1
0
0
python,filesystems,sshfs,mount-point
8,217,136
1
true
0
0
I found that there may be a bug in sshfs, such that if a user on a Linux system has the same user ID as another, i.e., 1002, but different usernames, this causes problems. The way I worked around this was to actually avoid sshfs for this case all together and mount the drives directly to a local system. I wanted to av...
1
0
0
I have a share (on Machine-A) mounted via sshfs on Machine-B. From Machine-C, I have this share mounted also via sshfs (double sshfs) like so: On Machine-C: /mnt/Machine-B/target_share On Machine-B: /mnt/Machine-A/target_share On Machine-A: /media/target_share Now I have a Python program that runs fine in all places t...
Running Python Program via sshfs-mounted Share
1.2
0
0
509
8,191,239
2011-11-19T01:49:00.000
0
1
0
1
python,deb
8,816,534
1
false
0
0
debian-installer doesn't generate repository metadata. For that, you want a tool like reprepro or mini-dinstall. They'll also handle the second point you raised.
1
1
0
I am planning on writing a small program that interacts with a debian based repository - namely doing a partial mirror**. I am planning to write it in python. What are some tips for working with the repository including already constructed 'wheels' (to save the invention of yet another one)? Some issues I have identifi...
Tips for interacting with debian based repositories
0
0
0
200
8,192,584
2011-11-19T07:24:00.000
5
0
1
0
python,amqp
8,193,456
5
true
0
0
There are two ways to get the queue size in the AMQP protocol. You can either use Queue.Declare or Basic.Get. If you are consuming messages as they arrive using Basic.Consume, then you can't get this info unless you disconnect (timeout) and redeclare the queue, or else get one message but don't ack it. In newer versio...
1
36
0
Simple question, but Google or the Pika open source code did not help. Is there a way to query the current queue size (item counter) in Pika?
Get Queue Size in Pika (AMQP Python)
1.2
0
0
25,979
8,193,563
2011-11-19T10:58:00.000
1
0
0
0
python,machine-learning,data-mining,k-means,prediction
8,194,069
4
false
0
0
If you are considering assigning a value based on the average value within the nearest cluster, you are talking about some form of "soft decoder", which estimates not only the correct value of the coordinate but your level of confidence in the estimate. The alternative would be a "hard decoder" where only values of 0 ...
1
9
1
I'm messing around with machine learning, and I've written a K Means algorithm implementation in Python. It takes a two dimensional data and organises them into clusters. Each data point also has a class value of either a 0 or a 1. What confuses me about the algorithm is how I can then use it to predict some values for...
Predicting Values with k-Means Clustering Algorithm
0.049958
0
0
14,656
8,195,016
2011-11-19T15:28:00.000
5
0
1
0
python
8,195,022
2
true
0
0
This square bracket notation is used to denote optional arguments. You can omit them if you wish and thus invoke default behaviour. The optional arguments will always be described in the documentation. Note that the square brackets used in the documentation are not part of Python itself. You can never write that in a P...
1
5
0
Can someone describe what's happening syntactically in functions like functions like str.find(sub[, start[, end]])? I don't understand what the function arguments are doing or supposed to be. For one thing, what is the [, x] construct?
Understanding Python function arg notation like this: str.find(sub[, start[, end]])
1.2
0
0
917
8,196,314
2011-11-19T18:39:00.000
0
0
0
0
python,cmd,windows-xp,file-association
27,906,678
3
false
0
0
Right-click on .py file and set default program as python.exe
1
10
0
When I type assoc .py I get .py=py_auto_file. When I type ftype py_auto_file I get py_auto_file="C:\Program Files\Adobe\Photoshop 7.0\Photoshop.exe" "%1" How do I make py_auto_file="C:\Python27"?
How do you change file association for .py Python files in XP?
0
0
0
15,336
8,196,386
2011-11-19T18:50:00.000
2
0
0
0
python,flickr
8,753,955
2
true
0
0
I could run Python Flickr API (http://stuvel.eu/flickrapi) on Python2.7. It's not possible to run it on Python3 (according to its author).
1
3
0
I tried a few python ports of flickr api and they didn't work on my Python here which is 3.2. I also have 2.7. Do you guys know any API that is compatible with the latest Flickr API as well latest update of Python?
How to access Flickr API using Python?
1.2
0
1
888
8,196,618
2011-11-19T19:24:00.000
0
0
0
0
c++,python,c,winapi,api
14,110,911
2
false
0
1
You can get DC of first window, and get DC of second window. And after this do BitBlt or StretchBlt. It has to work... But I don't know what about DirectX/Open-Gl... I think it has to work too. But anyway. It won't take much time to check it.
1
3
0
I want to create a simple project (the language doesn't really matter/but I prefer C++) which simply takes a window title as it's input and duplicate it's visual part, bit by bit, to a new window. just like a mirror better I'd say. As far as I remember there was a win32 API for this but I can't remember, so would you p...
How to duplicate a window's clientarea to another window?
0
0
0
226
8,197,345
2011-11-19T21:06:00.000
2
0
0
1
python,e-commerce,wsgi,flask,tornado
8,203,022
3
false
1
0
Not an answer but as an alternative way django with satchmo is very suitable for that sort of projects.
1
4
0
am trying to develop a e-commerce plateforme using python and nosql, as framework i'm between two: tornado and flask; so my question is simple: Which one is suited for e-commerce: WSGI-like application (using Flask) or a non-blocking application (using Tornado)? NB: the e-commerce will manage products, and users (with...
e-commerce in Tornado (non-blocking) VS Flask (WSGI)
0.132549
0
0
2,594
8,199,646
2011-11-20T05:25:00.000
2
0
1
1
python,input,command,prompt,cx-freeze
8,199,679
3
true
0
0
Here is what : This goes on the windows command prompt. You first need to cd to the directory where your setup.py is situated. For Eg: C:\folder\setup.py On the command prompt : C:\ cd folder python setup.py build Now, this will call python and pass the file setup.py and asks to build it.
2
0
0
When tools such as cx_freeze tell you to use a command such as "python setup.py build", where is this command issued? I have tried both the python command line and the Windows command prompt, but neither one worked with inputting that phrase.
Where do I issue commands?
1.2
0
0
69
8,199,646
2011-11-20T05:25:00.000
1
0
1
1
python,input,command,prompt,cx-freeze
8,199,676
3
false
0
0
You issue such commands from the command prompt. You should make sure that you've changed into the directory containing setup.py before typing the command.
2
0
0
When tools such as cx_freeze tell you to use a command such as "python setup.py build", where is this command issued? I have tried both the python command line and the Windows command prompt, but neither one worked with inputting that phrase.
Where do I issue commands?
0.066568
0
0
69
8,200,317
2011-11-20T08:24:00.000
1
0
0
0
android,python,c,platform
8,921,098
3
false
0
1
I installed sl4a which eventually gave me a sandboxed perl/python/tcl/lua enviroment. I then found their binaries in the shell and relocated them to my path so I could call them from cli. I also purchased c4droid and found that it had the tiny c binary in the shell.
1
2
0
I have this cellphone which runs Android OS 2.6. Due to some reasons, I want to write code directly on my cellphone just as what we do in front of our PC. So, Can we make the Android cellphone a develop-platform? I mean write/compile/run C code on Android cellphones? If we can, how?
Write C/C++/Python code on an Android cellphone
0.066568
0
0
4,409
8,201,185
2011-11-20T11:25:00.000
0
0
0
0
python,django,ldap,nginx
8,203,175
1
false
1
0
Active Directory does not allow anonymous binds for authorization; you can bind anonymously but you cannot do anything else. Check if the user that is being used to bind with AD has valid credentials (ie, the account hasn't expired). If it has, you'll get these strange errors.
1
0
0
I am hosting a django-based site on a local machine (I have full access/control to it). This site authenticates users against a remote active directory via the django ldap plugin. authenticating against LDAP server used to work! Now, when trying to authenticate against the LDAP server, the request just hangs until it t...
Django Ldap authentication timed out
0
0
0
1,269
8,201,189
2011-11-20T11:26:00.000
0
1
1
0
php,python,git,deployment,thrift
8,208,766
2
false
0
0
I think the #2 is way to go, if nothing else because you do not want git to auto merge generated files. In your php or python app initialization code, you could check timestamp on idl files and generated stubs, and issue warning and/or abort, or start thrift compiler if available.
1
4
0
How do you manage generated source code files in you repositories and deployment routines with Git (PHP, Python, etc)? For example, I have a repository named "interfaces" with Thrift definitions in it. They can be converted to Python, PHP, JS, etc skeletons/stubs. Other projects in different languages, each in its own ...
How to distribute Thrift-generated code in development and production environments with Git?
0
0
0
526
8,202,949
2011-11-20T16:35:00.000
8
1
1
0
python,class,inheritance,pydev,hierarchy
8,202,983
5
true
0
0
Hit f4 with class name highlighted to open hierarchy view.
1
10
0
Assuming I have a class X, how do I check which is the base class/classes, and their base class/classes etc? I'm using Eclipse with PyDev, and for Java for example you could type CTRL + T on a class' name and see the hierarchy, like: java.lang.Object java.lang.Number java.lang.Integer Is it possible for Pyt...
How do I inspect a Python's class hierarchy?
1.2
0
0
4,686
8,203,221
2011-11-20T17:20:00.000
5
0
1
0
python,compiler-construction,interpreter,bytecode
8,203,330
1
true
0
0
First off, "compiler" does not imply "outputs machine code". You can compile from any language to any other, be it a high-level programming language, some intermediate format, code for a virtual machine (bytecode) or code for a physical machine (machine code). Like a compiler, an interpreter needs to read and understa...
1
8
0
After viewing lots of posts about the difference between compilers and interpreters, I'm still not able to figure out the difference in their construction and internal mechanism. The most common difference I read was that a compiler produces a target program which is executable { means machine code as its output } whic...
compiler vs interpreter ( on basis of construction and design )
1.2
0
0
2,487
8,204,968
2011-11-20T21:40:00.000
1
0
1
0
python,nltk
9,797,554
1
false
0
0
I had a similar problem and after realizing that the regex pattern will only examine tags, I changed the tag on the the piece I was interested in. For example, I was trying to match product name and version and using a chunk rule like \NNP+\CD worked for "Internet Explorer 8.0" but failed on "Internet Explorer 8.0 SP2"...
1
7
0
NLTK's chunk parser's regular expressions can match POS tags, but can they also match specific words? So, suppose I want to chunk any structure with a noun followed by the verb "left" (call this pattern L). For example, the sentence "the\DT dog\NN left\VB" should be chunked as (S (DT the) (L (NN dog) (VB left))), but t...
Matching words with NLTK's chunk parser
0.197375
0
0
1,940
8,205,413
2011-11-20T22:49:00.000
4
0
1
1
python,console,terminal
8,205,492
1
true
0
0
I don't think there is a quick fix for this. You could start without a window, fire up a subprocess with a console, and terminate that process when you want the console to go away.
1
0
0
Hopefully a simple answer. I have a console python program compiled to exe writing information constantly to the terminal, but half way through the script I'd like the terminal to hide but for the program to continue on hidden. Is there a quick fix for this or is this more complicated then it seems? Any help is appreci...
Python - Hide Console Mid-Way Through Script
1.2
0
0
161
8,207,433
2011-11-21T04:52:00.000
0
0
0
0
python,database,couchdb
12,101,359
1
true
0
0
I had to re install couchdb and I am marking this question accepted.
1
0
0
I am using couchdb to store twitter data. I found that couchdb stops updating its data base though I keep getting the twitter data. I basically store the dictionary that contains twitter data by using the python couchdb save method, db.save(twitter_dic) where db is the database instance. I find that some times I get 3G...
python couchdb data collection stops
1.2
0
1
140
8,207,512
2011-11-21T05:05:00.000
1
0
1
0
python,storage,pickle
8,207,550
1
true
0
0
I think you can use pickle/cPickle module to save and load the date, which are built-in module and easy to use. I am not very sure the meaning of update import file, what about rewrite the content back to the file after updating in the program?
1
1
0
I'm working on a online server, and I need all my list and dict saved. What would be the best and quickest way to approach this? I tried importing the data, and it works to load the data. But how can I update the imported file?
Saving to external PY file?
1.2
0
1
98
8,207,755
2011-11-21T05:42:00.000
1
0
0
0
python,remote-desktop,rdp,pywinauto
8,264,720
1
false
0
0
After trying out various things I figured that the window which opens after pressing the "Connect" button on mstsc can be found by searching for the window with the title 'XYZ - Remote Desktop' where XYZ is the name of the remote server. I have tested this on the WinXP.
1
0
0
I have just started to use the pywinauto module to automate GUI tasks. One of them is to launch the remote desktop exe (mstsc.exe)->Login->Invoke another tool there. However, I manged to connect to the remote server but the control gets lost after that. I did not manage to login. So, the question is how to use the pywi...
pywinauto with Remote Desktop
0.197375
0
0
1,705
8,209,748
2011-11-21T09:34:00.000
0
0
0
0
python,packaging,cherrypy,flask
8,298,097
3
false
1
0
Well assuming you can make your friends install python on their computer, couldn't you just do a zip file with your own code with its dependencies bundled with it, similarly to how virtualenv isolates your project's dependencies from the global ones? If you use the builtin dev server, it would be as simple as them doub...
1
2
0
Lets say you have a friend who knows how to type python run.py according to your instructions (or double click it). Thats it. The friend doesnt know what apache or nginx is, but needs to server the web application for sharing movies/music with me and other friends. Now you want to make a package containing your script...
Is it possible to serve a dynamic (with static files) web app in python as a single package with no other dependencies?
0
0
0
623
8,211,890
2011-11-21T12:35:00.000
2
0
1
0
python,naming-conventions,command-query-separation
8,212,006
4
false
0
0
In the standard library, there are methods like list.sort() and list.reverse() which modify the list in place, and functions like sorted() and reversed() which return something new (reversed() returns an iterator rather than a new list). But if it makes more sense to have an instance method than a function, I wouldn't ...
1
6
0
What would be the naming conventions in Python for functions that can return a modified object or that just modifies the instance. Let's assume you want to implement both, how you should name the functions? Example: Let's assume that you want a crop() function for an Image object. I Ruby it was simple because you shoul...
Python naming conventions for functions that do modify the object or return a modified copy
0.099668
0
0
1,633
8,212,075
2011-11-21T12:50:00.000
1
0
0
1
python,zeromq
8,639,802
2
false
0
0
REQ-REP is when you want a round trip. Sounds like you want a PUB-SUB. Set up a SUB with a bind at a well-known port, then have the clients connect to that port and issue a PUB.
1
5
0
I'm implementing a messaging system where external programs called agents are able to communicate via ZeroMq producers. So, every time an event of interest occurs, agent sends a message to ZeroMq. I'm interested in implementing this using pipeline pattern. I found some examples (Ventilator-Worker-Results Manager), but...
ZeroMQ pipeline pattern
0.099668
0
0
1,777
8,214,312
2011-11-21T15:38:00.000
2
0
1
0
python,eclipse,tabs
8,298,568
2
true
0
0
It seems you're probably mixing spaces and tabs or you're currently editing a file with a different tab length from your current settings... It'd be nice if you can show a file where you're having those issues and what you were expecting. Note that if you do have such as issue i.e.: you configured it to have 4 whitespa...
2
0
0
It seems like no matter what settings I use for Python indentation, Eclipse is always causing its own problems. It keeps missing out entire areas of code, telling me there is an indentation error when there is no white space or incorrect tabs etc and sometimes I have to spend hours just going back over to delete lines ...
Indentation issues with Eclipse (using Python)
1.2
0
0
2,155
8,214,312
2011-11-21T15:38:00.000
0
0
1
0
python,eclipse,tabs
8,443,992
2
false
0
0
The general issue was indeed that there were spaces instead of tabs etc. Although I was aware of this and the issues it could cause and tried to use my settings to work around this, it still caused a lot of problems to no end. In the end, for me, Eclipse is not sufficient when writing Python, so I shelled out for PyCha...
2
0
0
It seems like no matter what settings I use for Python indentation, Eclipse is always causing its own problems. It keeps missing out entire areas of code, telling me there is an indentation error when there is no white space or incorrect tabs etc and sometimes I have to spend hours just going back over to delete lines ...
Indentation issues with Eclipse (using Python)
0
0
0
2,155
8,214,339
2011-11-21T15:41:00.000
1
1
0
0
python,audio,evolutionary-algorithm,csound
8,214,378
2
false
0
0
sending parameter values from python to csound could be done using the osc protocol sending audio from csound to python could be done by routing jack channels between the two applications
2
5
0
I am currently working on a specialization project on simulating guitar effects with Evolutionary Algorithms, and want to use Python and CSound to do this. The idea is to generate effect parameters in my algorithm in Python, send them to CSound and apply the filter to the audio file, then send the new audio file back t...
CSound and Python communication
0.099668
0
0
986
8,214,339
2011-11-21T15:41:00.000
1
1
0
0
python,audio,evolutionary-algorithm,csound
8,218,664
2
false
0
0
You can use Csound's python API, so you can run Csound within python and pass values using the software bus. See csound.h. You might also want to use the csPerfThread wrapper class which can schedule messages to and from Csound when it is running. All functionality is available from python.
2
5
0
I am currently working on a specialization project on simulating guitar effects with Evolutionary Algorithms, and want to use Python and CSound to do this. The idea is to generate effect parameters in my algorithm in Python, send them to CSound and apply the filter to the audio file, then send the new audio file back t...
CSound and Python communication
0.099668
0
0
986
8,216,088
2011-11-21T17:43:00.000
3
0
1
0
python,numpy
64,564,936
5
false
0
0
python -c "import sys,math; print(sys.float_info.mant_dig + math.ceil(math.log2(sys.float_info.max_10_exp - sys.float_info.min_10_exp)) + 1)" "+1" because one digit in the mantissa is stored implicitly.
1
41
0
I want to check whether a float is actually 32 or 64bits (and the number of bits of a numpy float array). There should be a built-in, but just didn't find out...
How to check the size of a float in python?
0.119427
0
0
71,955
8,217,798
2011-11-21T20:02:00.000
0
0
0
0
python,django,post,memcached
8,219,956
2
false
1
0
Short: Yes Not so short (but vague because of a vague question): First, find a way to build a cache key from the form values. Then on form submit, create the key and look in the cache and if there is no content with that key, create, store and return it. If there is content, return that. Maybe add and expiration time.
2
0
0
Is it possible to use django and memcached for dynamic page that are generated by POST form method? The reason I'd like to do this because some of my pages are taking long time for processing while the form input from users are occasionally simillar.
django memcahed for post form generated page
0
0
0
71
8,217,798
2011-11-21T20:02:00.000
0
0
0
0
python,django,post,memcached
8,220,837
2
false
1
0
Keep in mind, you also don't have to cache the entire page. One strategy we've tried at our shop is rendering expensive snippets of HTML and storing them in memcached so that they can be included dynamically. To do that, you wouldn't do render_to_response, but you would do manual rendering with Context and the templat...
2
0
0
Is it possible to use django and memcached for dynamic page that are generated by POST form method? The reason I'd like to do this because some of my pages are taking long time for processing while the form input from users are occasionally simillar.
django memcahed for post form generated page
0
0
0
71
8,219,355
2011-11-21T22:22:00.000
0
0
0
1
python,message-queue,rabbitmq,worker
8,220,985
1
false
1
0
How about using pyro? It gives you remote object capability and you just need a client script to coordinate the work.
1
0
0
I am looking for some advice/opinions of which Python Framework to use in an implementation of multiple 'Worker' PCs co-ordinated from a central Queue Manager. For completeness, the 'Worker' PCs will be running Audio Conversion routines (which I do not need advice on, and have standalone code that works). The Audio con...
Advice: Python Framework Server/Worker Queue management (not Website)
0
0
0
552
8,219,865
2011-11-21T23:11:00.000
1
0
0
0
python,sockets,socketserver
8,220,008
1
true
0
0
No. You would have to send that name over the communication channel.
1
1
0
I'm using a class RequestHandler(SocketServer.BaseRequestHandler)to handle incoming connections to a server. I am trying to get the name of the client which is stored as an attribute that sends data to this server, but right now I can only get it by asking for self.client_address which returns a tuple like Name of clie...
How can I get a client's Name attribute with SocketServer in python?
1.2
0
1
1,312
8,219,942
2011-11-21T23:19:00.000
0
0
0
0
python,apache,64-bit
8,220,038
2
false
0
0
You could always compile from source. Even if you do that you'll have to get 64 bit apache too, since ASF doesn't ditribute 64 bit windows binary. Are you sure you've got 64 bit one installed?
1
3
0
first, I'd like to say I've been lurking on this site for years and love it. For the first time, I feel like I've encountered a problem that hasn't been addressed on StackOverflow before, so here goes. I am trying to get python to work on my 64-bit Wampserver install on Windows 7. I have a 64-bit version of python 2.7...
Can I get mod_wsgi to work with a 64-bit Apache/Python install?
0
0
0
4,499
8,220,675
2011-11-22T00:57:00.000
3
0
1
0
c++,python
8,220,691
2
false
0
0
You can't save data to a program's own code without resorting to some dangerous, and frankly, pointless, hacks. So the short answer is "you can't do this." And why would you ever want to? An EXE is not an "archive." It's a set of machine code to be executed, meant to be read-only. It may contain data, but that data is ...
2
0
0
Since exe is an archive, I want my program to be able to save stuff to it's own exe file. Unfortunately, Windows keeps the file open while it's running. I'd like to find a way in Python and/or C++ to force the program to run from memory and have the file close.
Closing exe and running from memory
0.291313
0
0
216
8,220,675
2011-11-22T00:57:00.000
1
0
1
0
c++,python
8,220,719
2
false
0
0
While you are correct, that you can have embedded resources (like images, other files, etc) in an EXE (executable file) - these are placed there at compile time and the PE file is specially structured to allow this. However, it would be a very bad idea to try and do this at run time. I'm not saying it is impossible, ...
2
0
0
Since exe is an archive, I want my program to be able to save stuff to it's own exe file. Unfortunately, Windows keeps the file open while it's running. I'd like to find a way in Python and/or C++ to force the program to run from memory and have the file close.
Closing exe and running from memory
0.099668
0
0
216
8,221,077
2011-11-22T02:02:00.000
1
0
0
0
php,python,django,cakephp,frameworks
8,221,221
2
false
1
0
Well, here's some info that may help along the way: Don't categorize everything that has routes, controllers, views, etc as "MVC". Django, for example, is self-described as MTV. Django is a fantastic framework and does lots of things well. You will find that the Django and Python library and community is much more "ba...
2
1
0
As a student in web development, I work with PHP, mainly through CMSs. I already know the basic knowledge on the famous MVC design pattern, but now would like to work with a framework. I've just discovered RoR and Django (respectively Ruby & Python Frameworks) and my first experiments with these frameworks, coupled to ...
Average PHP developer wanting to move to Python+Django : Directly go with Django or learn the MVC Framework stuff in PHP first?
0.099668
0
0
789
8,221,077
2011-11-22T02:02:00.000
3
0
0
0
php,python,django,cakephp,frameworks
8,221,162
2
true
1
0
The shortest path to Python/Django is to learn Python/Django. If you invest time in learning something different, it will just create some preconceptions that may not hold in a Python/Django environment.
2
1
0
As a student in web development, I work with PHP, mainly through CMSs. I already know the basic knowledge on the famous MVC design pattern, but now would like to work with a framework. I've just discovered RoR and Django (respectively Ruby & Python Frameworks) and my first experiments with these frameworks, coupled to ...
Average PHP developer wanting to move to Python+Django : Directly go with Django or learn the MVC Framework stuff in PHP first?
1.2
0
0
789
8,221,114
2011-11-22T02:08:00.000
0
1
0
1
python,packages,redhat
8,221,263
3
true
0
0
I found out that WSGI is included in Python 2.5 and above, so you don't need to do any installs. Just say things like from wsgiref import make_server.
2
1
0
I wanted to install WSGI on a RedHat linux box in order to make a Python server interface, but the only way I could find to do that was to use modwsgi, which is an Apache module. The whole reason I'm using WSGI is that I don't want to use Apache, so this kinda defeats the purpose. Does anyone know of actual WSGI packa...
Using WSGI on Redhat Linux
1.2
0
0
591
8,221,114
2011-11-22T02:08:00.000
0
1
0
1
python,packages,redhat
8,221,832
3
false
0
0
WSGI is a protocol. In order to use it you need a WSGI container such as mod_wsgi, Paste Deploy, CherryPy, or wsgiref.
2
1
0
I wanted to install WSGI on a RedHat linux box in order to make a Python server interface, but the only way I could find to do that was to use modwsgi, which is an Apache module. The whole reason I'm using WSGI is that I don't want to use Apache, so this kinda defeats the purpose. Does anyone know of actual WSGI packa...
Using WSGI on Redhat Linux
0
0
0
591
8,221,586
2011-11-22T03:22:00.000
3
0
0
0
python,wxpython
8,234,755
2
true
0
1
The X,Y position in a sizer is exactly the same as the window that the sizer belongs to, assuming that the sizer is the sizer assigned to that window. If you've got nested sizers then you can use sizer.GetPosition and sizer.GetSize to figure out if the position is inside that nested sizer. However I would guess that...
2
1
0
that it is possible to get the mouse position in wxpython using event.GetPosition() however, is it possible to get the position of a mouse in a sizer? Would this work even in an expanding sizer? Thanks.
Get mouse position in sizer? wxpython
1.2
0
0
852
8,221,586
2011-11-22T03:22:00.000
0
0
0
0
python,wxpython
8,234,664
2
false
0
1
Sizers don't work with absolute positioning. They're for relative positioning. Sizers are the best at making your layout look right across multiple platforms and themes. If you really want to be able to insert stuff at specific x-y coordinates, then don't use a sizer.
2
1
0
that it is possible to get the mouse position in wxpython using event.GetPosition() however, is it possible to get the position of a mouse in a sizer? Would this work even in an expanding sizer? Thanks.
Get mouse position in sizer? wxpython
0
0
0
852
8,223,029
2011-11-22T06:49:00.000
2
0
1
1
python,python-3.x,setuptools,easy-install
8,225,167
2
false
0
0
You use the easy_install that is for the installation of Python where you want to install it. In most cases, both easy_install and easy_install-3.2 will be the same program and install to the same installation of Python. You can install the same version of Python in different places, then you need to run the easy_insta...
2
1
0
For Python 3.2, What is recommended: easy_install-3.2 or easy_install? Why two execs? What's the difference? One more question: distribute or setuptools? setuptools is obviously not working on Intel Win64/python3.2 (or not available as of writing this post).
easy_install-3.2.exe vs easy_install.exe?
0.197375
0
0
466
8,223,029
2011-11-22T06:49:00.000
3
0
1
1
python,python-3.x,setuptools,easy-install
8,223,191
2
false
0
0
Answering just to the first question. Regarding easy_install, since you might have multiple python versions installed, you might have also different easy_install versions installed (one for each python version). In that case, easy_install will be the default version and easy_install-X.Y will be the version to install n...
2
1
0
For Python 3.2, What is recommended: easy_install-3.2 or easy_install? Why two execs? What's the difference? One more question: distribute or setuptools? setuptools is obviously not working on Intel Win64/python3.2 (or not available as of writing this post).
easy_install-3.2.exe vs easy_install.exe?
0.291313
0
0
466
8,224,592
2011-11-22T09:33:00.000
5
0
0
1
python,debugging,google-app-engine,pydev
8,224,704
1
true
1
0
The way the debug works is not by executing the source line-by-line. The debug "compiles" your source to bytecode (the .pyc files) and execute those, not your source. The debug only keeps track of what piece of the .pyc files correspond to what line of your .py ones and display that information for your convenience, bu...
1
5
0
I often doing such steps and want to optimize debug speed: I am setting some breakpoints. I am running Google Appengine Application (Python 2.5.2+). When breakpoint occur I often change code to fix bugs. After code change want to test again but there is problem if I changed code in breakpoint/suspend mode the applica...
Debug PyDev+Eclipse - Code not reloads after code change in breakpoint/suspend mode
1.2
0
0
886
8,225,460
2011-11-22T10:41:00.000
0
0
0
0
python,matplotlib
8,232,587
2
false
0
0
Have you tried to call plt.figure(fig.number) before plotting on figure fig and plt.show() after plotting a figure? It should update all the figures.
1
6
1
I am using matplotlib with interactive mode on and am performing a computation, say an optimization with many steps where I plot the intermediate results at each step for debugging purposes. These plots often fill the screen and overlap to a large extent. My problem is that during the calculation, figures that are part...
Getting matplotlib plots to refresh on mouse focus
0
0
0
2,049
8,226,006
2011-11-22T11:25:00.000
11
0
1
0
python
8,226,050
1
true
0
0
I think your list has duplicate elements which are removed in set. Sets include unique elements only.
1
4
0
I have a list with 7,200,000 elements in it. When I try to convert it with set() it cuts out to 4,500,000 elements. What can I do to bypass this problem? I'm using Python 3.2.2 x86 on Windows.
python - Size limit of set data type
1.2
0
0
4,177
8,226,638
2011-11-22T12:15:00.000
-1
0
1
0
python,cython,modulo
12,583,531
3
false
0
0
I use % operator everywhere, and I don't think it slows the code. In fact, % is really fast! Are you declaring your variables with cdef? Maybe you are adding too much python overhead just because of that.
1
4
0
What is the easiest and fastest way to do a modulo operation (5 % 2) in Cython code? It seems that using % slows down the code a lot, so is a better way to do this?
Modulo in Cython
-0.066568
0
0
2,084
8,227,308
2011-11-22T13:07:00.000
0
1
0
1
python,linux,logging
8,227,859
3
false
0
0
If you do it yourself, you might do something like this: If you detect file modification, get the size of the file. If it's larger than last time you can seek to the previous "last" position (i.e. the previous size) and read from there.
2
5
0
I'm trying to monitor log files that some process are running on linux(to create a joint log file where log entries are grouped together by when they happen). Currently I'm thinking of opening the files being logged, polling with inotify(or wrapper) and then checking if I can read any more of the file. Is there any be...
Is there a better way to monitor log files?(linux/python)
0
0
0
3,207
8,227,308
2011-11-22T13:07:00.000
3
1
0
1
python,linux,logging
8,235,200
3
false
0
0
Why won't a "tail -f" be sufficient? You could use popen and pipes to handle this from Python.
2
5
0
I'm trying to monitor log files that some process are running on linux(to create a joint log file where log entries are grouped together by when they happen). Currently I'm thinking of opening the files being logged, polling with inotify(or wrapper) and then checking if I can read any more of the file. Is there any be...
Is there a better way to monitor log files?(linux/python)
0.197375
0
0
3,207
8,230,617
2011-11-22T16:56:00.000
2
0
0
1
python,mysql,celery
8,230,713
1
true
0
0
No, there wouldn't be any problem multiple worker computers searching and writing to the same database since MySQL is designed to be able to handle this. Your approach is good.
1
2
0
Essentially I have a large database of transactions and I am writing a script that will take some personal information and match a person to all of their past transactions. So I feed the script a name and it returns all of the transactions that it has decided belong to that customer. The issue is that I have to do thi...
relatively new programmer interested in using Celery, is this the right approach
1.2
1
0
107
8,232,218
2011-11-22T18:56:00.000
2
0
1
0
python
8,232,320
4
false
0
0
It looks like you'll have to trust the code's developers on this one: if they did a good job, the method/class documentation should list all the exceptions that could be raised.
3
0
0
Is there any way to programmatically determine which exceptions an object or method might raise? Like dir(obj) lists available methods, I'm looking for the equivalent dir_exceptions(obj). As far as I know, the only way to achieve this would be to parse the source.
listing exceptions programmatically - Python
0.099668
0
0
175
8,232,218
2011-11-22T18:56:00.000
-1
0
1
0
python
8,232,365
4
false
0
0
I don't think this is possible either, but if you trust that the programmer has named their exceptions with "Exception" or "Error" in the name, then you could do a dir on the class and search for elements that end with "Exception" or "Error". Aside from that (which is pretty hacky in itself), I don't see a straightforw...
3
0
0
Is there any way to programmatically determine which exceptions an object or method might raise? Like dir(obj) lists available methods, I'm looking for the equivalent dir_exceptions(obj). As far as I know, the only way to achieve this would be to parse the source.
listing exceptions programmatically - Python
-0.049958
0
0
175
8,232,218
2011-11-22T18:56:00.000
2
0
1
0
python
8,232,250
4
true
0
0
I don't think this is possible. An exception is a runtime phenomenon and you'll know what it possible (or what happens) only while running. Why would you want to do this though?
3
0
0
Is there any way to programmatically determine which exceptions an object or method might raise? Like dir(obj) lists available methods, I'm looking for the equivalent dir_exceptions(obj). As far as I know, the only way to achieve this would be to parse the source.
listing exceptions programmatically - Python
1.2
0
0
175
8,232,708
2011-11-22T19:38:00.000
3
1
1
0
python,c,python-c-api,python-c-extension,python-embedding
8,233,228
2
true
0
0
I had to muck about a bit with the PATH env-var as well as PYTHONPATH to make things work better when embedding. Py_SetProgramName is not important, it's mostly for internal reference etc... So, I suggest you find where python is installed locally (this is available in the registry on Windows machines) and use setenv t...
2
2
0
when im running C code to call python functions, there's error on Py_Initialize() The error is ImportError: No module named site. Ive tried to put Py_SetProgramName(argv[0]) but it doesnt work. The cmd call is cInterfacePython Test.py multiply 3 2 (exe is cInterfacePython)
embedding python error on initialization
1.2
0
0
2,355
8,232,708
2011-11-22T19:38:00.000
1
1
1
0
python,c,python-c-api,python-c-extension,python-embedding
14,369,084
2
false
0
0
I was having the same problem (Windows, both with Visual Studio and MinGW/g++), and I solved it by adding to PYTHONPATH the path to site.py. For some reason, launching python.exe was possible even without it, and sys.path did contain that path (even when PYTHONPATH did not), and I could "import site", but Py_Initialize...
2
2
0
when im running C code to call python functions, there's error on Py_Initialize() The error is ImportError: No module named site. Ive tried to put Py_SetProgramName(argv[0]) but it doesnt work. The cmd call is cInterfacePython Test.py multiply 3 2 (exe is cInterfacePython)
embedding python error on initialization
0.099668
0
0
2,355
8,236,823
2011-11-23T03:02:00.000
1
0
1
0
python,list
8,236,857
5
false
0
0
What's wrong with itemgetter? lst.sort(key=lambda l: list(reversed(l)) should do the trick
1
0
1
Given: lst = [['John',3],['Blake',4],['Ted',3]] Result: lst = [['John',3],['Ted',3],['Blake',4]] I'm looking for a way to sort lists in lists first numerically then alphabetically without the use of the "itemgetter" syntax.
Python Sorting Lists in Lists
0.039979
0
0
1,274
8,236,963
2011-11-23T03:28:00.000
1
0
0
1
python,mysql,django,mysql-python
8,260,644
2
true
0
0
Make sure that gcc-4.0 is in your PATH. Also, you can create an alias from gcc to gcc-4.0. Take care about 32b and 64b versions. Mac OS X is a 64b operating system and you should right flags to make sure you're compiling for 64b architecture.
1
4
0
I'm currently trying to build and install the mySQLdb module for Python, but the command python setup.py build gives me the following error running build running build_py copying MySQLdb/release.py -> build/lib.macosx-10.3-intel-2.7/MySQLdb error: could not delete 'build/lib.macosx-10.3-intel-2.7/MySQLdb/release.py':...
Errors When Installing MySQL-python module for Python 2.7
1.2
1
0
912
8,240,444
2011-11-23T10:15:00.000
0
1
1
0
python,unit-testing,tdd,python-unittest
8,240,560
2
false
0
0
How about using the constructor of your test class?
1
6
0
Im using PyUnit to write unit tests for my code. The setup method is called everytime before any test is run. Is there a way i can define a method that will be run just once at the beginning before any tests are run ? Please Help Thank You
Running a method just once at the beginning before any tests are run in PyUnit
0
0
0
449
8,242,209
2011-11-23T12:29:00.000
1
1
1
0
python,nose,nosetests
8,242,339
1
false
0
0
I think your problem is dependent from how you implemented the timing. The solution I would personally adopt would be to set an environment variable that controls the behaviour of the tests. Candidates could be: if WITH_TIMING == False [turn off timing altogether] TIME_STRETCH_FACTOR = ... [apply a time-stretching mul...
1
0
0
I have some unit tests that are timing sensitive: an action is timed and an error is triggered if it takes too long. When run individually, these tests pass, but when running nosetest recursively on my modules, they often fail. I run concurrent tests, which likely is one reason why the timing is off. Is there any way t...
Timing issues in Python nose test
0.197375
0
0
163
8,244,887
2011-11-23T15:35:00.000
0
1
0
1
python,usb
8,245,298
2
false
0
0
According to the documentation, ioctl() in the fcntl module is unix specific, so it will not work in Windows. There seems to be a Windows variant named DeviceIoControl() that works similarly. IOCTLs are declared by the device driver or operating system, so I very much doubt that there are IOCTL operations that have th...
1
2
0
Using Python, I am trying to write to a USB sensor using ioctl. I have loads of examples of reading from devices either directly or via pyusb, or simple file writes, but anything more complicated disappears off the radar. I need to use a control_transfer to write Feature Report message The command is ioctl(devicehandl...
Writing to USB device with Python using ioctl
0
0
0
5,132
8,246,822
2011-11-23T17:53:00.000
2
0
1
0
python,argv,raw-input
9,525,328
2
false
0
0
As part of command line argument input, a user can submit system calls and that could crash your program. E.g. a user can issue an ls command. The system executes that command regardless of what your program is supposed to do.
1
1
0
I know that when using argv I have to type the file as an argument (ex: python ex15.py ex15_sample.txt) and when using raw_input I enter the filename as an input. But I can't seem to find out why one way of getting the filename would be better than another. Can someone explain why?
argv vs. raw_input
0.197375
0
0
5,205
8,248,397
2011-11-23T20:06:00.000
3
0
1
1
python,windows,python-3.x,python-3.2
8,248,427
7
false
0
0
If you import os you can use os.getcwd to get the current working directory, and you can use os.chdir to change your directory
1
255
0
I am using Python 3.2 on Windows 7. When I open the Python shell, how can I know what the current directory is and how can I change it to another directory where my modules are?
How to know/change current directory in Python shell?
0.085505
0
0
539,479
8,248,622
2011-11-23T20:28:00.000
0
1
1
0
python,pdf
8,249,589
2
false
0
0
PDFMiner is not for altering existing PDF files, but for extracting text and metadata from them. The closest solution to what you're looking for using PDFMiner would probably be to use the included pdf2txt.py tool to extract the text and then mark that up to highlight your keywords. There's also the simple option of j...
1
1
0
I was wondering if it's possible to édit an existing pdf file with Pdfminer. It seens to be a powerful tool, but the documentation is poor/inexisting. I found some exemples, but they don't match with my goal. I want to make a search engine which changes the color of my keywords in the pdf file.
Edit pdf file with PDFMiner
0
0
0
2,097
8,250,625
2011-11-23T23:42:00.000
1
0
1
0
python,memory,memory-address
8,251,373
5
false
0
0
Are you trying to "reverse" id to get the Python object thing from the result of id(thing)? I don't even know if that can be done, and it definitely shouldn't be done; it would defeat garbage collection and lead to a lack of memory safety. If your program does that it means you effectively have references to things (th...
1
39
0
My question is: How can I read the content of a memory address in python? example: ptr = id(7) I want to read the content of memory pointed by ptr. Thanks.
Access memory address in python
0.039979
0
0
59,146
8,250,936
2011-11-24T00:27:00.000
0
0
0
0
python,django,django-admin,timeout,shared-hosting
8,252,044
4
false
1
0
First, a webserver typically has at least two "interfaces", each with one or more IPs. The "loopback" interface will have the IP 127.0.0.1, and is ONLY accessible from the machine running the server. So, running on 127.0.0.1:8000 means that you are telling runserver to be accessible ONLY from that server itself, on po...
2
3
0
I'm developing a Django application on a shared hosting service (hostmonster) and am, of course, unable to access the runserver on the default localhost ip of 127.0.0.1:8000 over Firefox. The Django Project site's documentation details how to set up remote access to the run-server, but I'm not having any success with t...
Accessing Django Runserver on Shared Hosting
0
0
0
5,897
8,250,936
2011-11-24T00:27:00.000
0
0
0
0
python,django,django-admin,timeout,shared-hosting
8,252,018
4
false
1
0
I'm betting that port 8000 is blocked. That explains the timeouts you mention in the last couple sentences: the firewall is set to simply drop the packets and not return any connection refusal responses. You're going to have to ask your hosting company if there's a way around this, but there might not be one. At the le...
2
3
0
I'm developing a Django application on a shared hosting service (hostmonster) and am, of course, unable to access the runserver on the default localhost ip of 127.0.0.1:8000 over Firefox. The Django Project site's documentation details how to set up remote access to the run-server, but I'm not having any success with t...
Accessing Django Runserver on Shared Hosting
0
0
0
5,897
8,253,475
2011-11-24T07:24:00.000
2
0
1
0
python,debugging
8,253,521
4
false
0
0
If you are running on Pydev (python extension for eclipse), you can easily watch your variables, however you'll need to set a breakpoint initially, then only step into/over your code.
1
5
0
Is there a way to view a list of all of my variables in python while the program is running without setting breakpoints? Printing is too messy because I have a lot of variables that are constantly changing. Thanks
View Variables in Python
0.099668
0
0
6,091
8,256,113
2011-11-24T11:11:00.000
0
0
0
0
python,websphere,jndi
8,489,052
1
true
0
0
Well, I found a solution. I added spring context to store my values and to enhance architecture.
1
2
0
I would like to ask a question. Any help will be highly appreciated. I have a pair, let's say [key1][value1] and I would like to put them in a JNDI of WebSphere server using administrative script. What command in Python would do that? Thank you in advance.
Put JNDI parameter in WebSphere
1.2
0
0
371
8,257,686
2011-11-24T13:16:00.000
1
1
1
0
c#,memory-management,ironpython
8,257,843
2
true
0
1
Finding out how much memory an object takes in .NET is a pretty difficult task. I've hit the same problem several times. There are some imperfect methods, but none are very precise. My suggestion is to get some estimate of how much a path will take, and then pass a bunch of them leaving a good margin of safety. Even if...
1
3
0
I'm working on a monte carol pricer and I need to improve the efficiency of the engine. MonteCarlo path are created by a third party library (in c++) Pricing is done in IronPython (script created by the end user) Everything else is driven by a c# application the pricing process is as follow: C# application request t...
Virtual memory address management in c#
1.2
0
0
871
8,260,863
2011-11-24T17:39:00.000
1
0
1
0
naming-conventions,python
8,260,938
3
false
0
0
In the specific example you list above, everyone knows these things are fruits, so I think it is unnecessary to include Fruit in the subclass names. More generally, whatever you chose is fine as long as it is consistent. I tend to like the French way of naming the object first and descriptors (adjectives) afterwards, ...
2
3
0
I can't figure out what is the more acceptable naming convention for derived classes. Let's say we have a base class Fruit, from which we derive, classes for apple, orange and passion fruit. It is a concensus that the name of the base class should appear in the derived ones, but should it appear in the beginning of ...
Pythonic way to name derived classes
0.066568
0
0
179
8,260,863
2011-11-24T17:39:00.000
5
0
1
0
naming-conventions,python
8,261,110
3
true
0
0
Use common sense. In your example, as others have discussed, the Fruit part is obviously redundant. Use just Apple, Orange, etc. Let's consider use another example instead. If I had a base class called Plugin, I would name the derived class FormattingPlugin, which I read as “plugin that does formatting”. The alternati...
2
3
0
I can't figure out what is the more acceptable naming convention for derived classes. Let's say we have a base class Fruit, from which we derive, classes for apple, orange and passion fruit. It is a concensus that the name of the base class should appear in the derived ones, but should it appear in the beginning of ...
Pythonic way to name derived classes
1.2
0
0
179
8,261,046
2011-11-24T18:02:00.000
0
0
0
1
c++,python,linux,windows-xp,labview
8,277,033
2
false
0
0
In LabVIEW/Windows you'll need to create a TCP-listen function on a specific port (server). From the linux box you'll start a connection as a client.
1
1
0
I need to know if I can connect 2 PCs over Ethernet connection (point to point connection). I have 2 machines (one of them runs on Windows XP and the other runs on Ubuntu Linux 10.10) and I need to have connection between them. Will be possible to have connection between them ? The suggested language is either Python o...
Windows XP to Ubuntu Linux point-to-point communication using Python or C/C++
0
0
0
1,063
8,261,526
2011-11-24T19:04:00.000
6
0
1
0
python,warnings,abstract-class,pylint
8,261,585
2
false
0
0
Pylint considers each file "self-contained", so when checking the file where you defined your abstract class, but no subclasses, it complains with R0921 (http://www.logilab.org/card/pylintfeatures). In fact, the message type is "R", which stands for "refactor" (http://www.logilab.org/card/pylint_manual#pylint-output): ...
1
17
0
I have a Python class that raises "NotImplementedError" for a couple of methods and the class is inherited by a few other classes which are defined in their own files. When I run Pylint on the file that has the abstract class, it always complains "Abstract class not referenced". I was wondering is it just Pylint being ...
How to fix pylint warning "Abstract class not referenced"?
1
0
0
5,322
8,262,017
2011-11-24T20:06:00.000
2
0
1
0
python,class,vector,initialization
8,262,970
5
false
0
0
Your instructor seems not to "speak Python as a native language". ;) The entire concept for the class is pretty silly; real Python programmers just use the built-in sequence types directly. But then, this sort of thing is normal for academic exercises, sadly... Add a constructor to the Vector class. In Python, the co...
2
1
0
I'm working on this project which deals with vectors in python. But I'm new to python and don't really know how to crack it. Here's the instruction: "Add a constructor to the Vector class. The constructor should take a single argument. If this argument is either an int or a long or an instance of a class derived from o...
Vector in python
0.07983
0
0
8,979
8,262,017
2011-11-24T20:06:00.000
0
0
1
0
python,class,vector,initialization
8,263,003
5
false
0
0
This may or may not be appropriate depending on the homework, but in Python programming it's not very usual to explicitly check the type of an argument and change the behaviour based on that. It's more normal to just try to use the features you expect it to have (possibly catching exceptions if necessary to fall back t...
2
1
0
I'm working on this project which deals with vectors in python. But I'm new to python and don't really know how to crack it. Here's the instruction: "Add a constructor to the Vector class. The constructor should take a single argument. If this argument is either an int or a long or an instance of a class derived from o...
Vector in python
0
0
0
8,979
8,264,192
2011-11-25T02:08:00.000
1
0
0
0
windows-7,python-2.7,cocos2d-python
9,655,468
1
false
0
1
I try to rollback the graphics driver to the old version, the issue is resolved.
1
1
0
I've tested pyglet and I'm sure pyglet works well. But when I ran the script in samples/hello_world_actions.py , or anything with color, only thing in the Scene is Label. Could anyone tell me what has happend? PS:my env : Python2.7 cocos2d 0.5.0 pyglet 1.1.4 Windows7
The Sprites and ColorLayers in cocos2d-python doesn't work
0.197375
0
0
172
8,265,608
2011-11-25T06:47:00.000
5
0
1
0
c++,python,map,hashtable
8,266,577
4
false
0
0
It's a more or less arbitrary choice of the language designers. In the case of C++, I suspect (but don't know for sure) that the motivation was the desire to define strict upper limits to complexity: designing a good hash function isn't trivial, and a hash table with a poor hash function performs very poorly. Another...
3
17
0
Why one languages uses tree and another uses hash table for seemingly similar data structure? c++'s map vs python's dict A related question is about performance of hash table. Please comment on my understanding of hash table below. A tree is guaranteed to have O(log n). Whereas hash table has no guarantee unless inpu...
Why is python's dict implemented as hash table whereas std::map is tree-based?
0.244919
0
0
6,388
8,265,608
2011-11-25T06:47:00.000
4
0
1
0
c++,python,map,hashtable
8,265,741
4
false
0
0
Python hash tables are never more than 2/3 full. The resize as they grow (starting at size 8, then quadrupling in size to until 50000, and doubling thereafter). This gives them amortized O(1) insertion, deletion, and lookup. Excess collisions are possible but are rare.
3
17
0
Why one languages uses tree and another uses hash table for seemingly similar data structure? c++'s map vs python's dict A related question is about performance of hash table. Please comment on my understanding of hash table below. A tree is guaranteed to have O(log n). Whereas hash table has no guarantee unless inpu...
Why is python's dict implemented as hash table whereas std::map is tree-based?
0.197375
0
0
6,388
8,265,608
2011-11-25T06:47:00.000
13
0
1
0
c++,python,map,hashtable
8,266,263
4
false
0
0
Your understanding of hash tables (and who use them) is flawed. The problem is, hash table is a rather vague term. Under the hood there are many implementations... but first let's talk about the use of BST (Binary Search Trees). Why does C++ uses a Binary Search Tree ? C++ is designed by commitee, there are many pos...
3
17
0
Why one languages uses tree and another uses hash table for seemingly similar data structure? c++'s map vs python's dict A related question is about performance of hash table. Please comment on my understanding of hash table below. A tree is guaranteed to have O(log n). Whereas hash table has no guarantee unless inpu...
Why is python's dict implemented as hash table whereas std::map is tree-based?
1
0
0
6,388
8,269,722
2011-11-25T13:17:00.000
0
0
1
0
python,list,text-files,anagram
8,269,802
6
false
0
0
load all words (lines) into list, while words are in separate lines this can be done via readlines() (you will have to use strip() to remove line ends): words = [s.strip() for s in f.readlines()] for each word create anagram use word list in operator for that anagram to check if anagram exists if exists then print
1
2
0
I have text files with a few thousands words in them (one word in a line). I've written a function which take two words (strings), and checks if one word is an Anagram of the other (that means if the two words contains the same letters, even if in different order). Now I want to go over my huge text file and search for...
how do i go over lines in an open text file on Python (2.72)
0
0
0
3,485
8,271,629
2011-11-25T16:09:00.000
6
0
0
1
python,unix,command-line
8,271,703
5
true
0
0
The simplest way to do this is to rename your file from filename.py to filename and add this line to the top of the file. #!/usr/bin/env python You may also need to set the executable bit on the file, which may be set using chmod +x on the command line.
2
7
0
I am not sure if I searched for the wrong terms, but I could not find much on this subject. I am on osx and I'd like to compile a commandline python script into a small commandline app, that I can put into usr/local/bin so I can call it from anywhere. Is there a straighforward way to do that? Thanks
Python: compile into an Unix commandline app
1.2
0
0
6,014
8,271,629
2011-11-25T16:09:00.000
4
0
0
1
python,unix,command-line
8,271,713
5
false
0
0
On Unix it works usually in the following way: Put #!/usr/bin/env python in the first line of your .py script. Add execution permissions to the file (using chmod). Execute the script from command line, eg. by providing ./my_script.py when in the same directory. What else do you need?
2
7
0
I am not sure if I searched for the wrong terms, but I could not find much on this subject. I am on osx and I'd like to compile a commandline python script into a small commandline app, that I can put into usr/local/bin so I can call it from anywhere. Is there a straighforward way to do that? Thanks
Python: compile into an Unix commandline app
0.158649
0
0
6,014
8,274,664
2011-11-25T22:07:00.000
0
0
0
0
python,django,django-models
8,515,995
2
false
1
0
I think its perfectly reasonable to create a "through" table such as location, which associates an asset, a content (foreign key) and a content_type (warehouse or shipment) . And you could set a unique constraint on the asset_fk so thatt it can only exist in one location at a time
2
0
0
I'm working through the design of a Django inventory tracking application, and have hit a snag in the model layout. I have a list of inventoried objects (Assets), which can either exist in a Warehouse or in a Shipment. I want to store different lists of attributes for the two types of locations, e.g.: For Warehouses, ...
Django design patterns - models with ForeignKey references to multiple classes
0
0
0
235
8,274,664
2011-11-25T22:07:00.000
1
0
0
0
python,django,django-models
8,515,865
2
true
1
0
what about having a generic foreign key on Assets?
2
0
0
I'm working through the design of a Django inventory tracking application, and have hit a snag in the model layout. I have a list of inventoried objects (Assets), which can either exist in a Warehouse or in a Shipment. I want to store different lists of attributes for the two types of locations, e.g.: For Warehouses, ...
Django design patterns - models with ForeignKey references to multiple classes
1.2
0
0
235