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
3,881,364
2010-10-07T11:56:00.000
1
0
0
0
python,sqlalchemy,entity
3,896,280
1
true
1
0
You can expunge it from session before modifying object, then this changes won't be accounted on next commits unless you add the object back to session. Just call session.expunge(obj).
1
0
0
i just want to use an entity modify it to show something,but don't want to change to the db, but after i use it ,and in some other place do the session.commit() it will add this entity to db,i don't want this happen, any one could help me?
use sqlalchemy entity isolately
1.2
1
0
85
3,881,534
2010-10-07T12:19:00.000
18
0
1
1
python,vim,virtualenv,macvim
3,881,570
6
false
0
0
Activate your virtualenv before starting vim. You will automatically get the corresponding interpreter instance.
1
18
0
I use vim for coding and for python coding in particular. Often I want to execute the current buffer with python interpreter. (for example to run unittests), usually I do this with :!python % <Enter> This scenatio will work works fine with global python, but I want to run virtualenv python instead. How do I enable vir...
Set python virtualenv in vim
1
0
0
20,646
3,881,951
2010-10-07T13:10:00.000
0
0
0
0
python
3,882,193
2
false
0
0
The IP addresses are assigned to your VPSes, no possibility to change them on the fly. You have to open a SSH tunnel to or install a proxy on your VPSes. I think a SSH tunnel would be the best way how to do it, and then use it as SOCKS5 proxy from Python.
1
1
0
I am running my code on multiple VPSes (with more than one IP, which are set up as aliases to the network interfaces) and I am trying to figure out a way such that my code acquires the IP addresses from the network interfaces on the fly and bind to it. Any ideas on how to do it in python without adding a 3rd party libr...
figuring out how to get all of the public ips of a machine
0
0
1
118
3,882,249
2010-10-07T13:45:00.000
0
0
0
0
java,c++,python,powerpoint,google-docs
3,899,697
3
true
1
0
Now i found a solution to showing .ppt file on my website without using the flash the solution is: just convert the .ppt file to .pdf files using any language or using software(e.g. open office) and then use Imagemagick to convert that .pdf into image and show to your web page once again thanks to you all for answeri...
1
2
0
I want to show .ppt (PowerPoint) files uploaded by my user on my website. I could do this by converting them into Flash files, then showing the Flash files on the web page. But I don't want to use Flash to do this. I want to show it, like google docs shows, without using Flash. I've already solved the problem for .pdf ...
How google docs shows my .PPT files without using a flash viewer?
1.2
0
1
1,773
3,882,750
2010-10-07T14:35:00.000
0
1
1
0
python,ironpython,pickle
3,927,390
2
false
0
0
It will work because when you unpickle objects during load() it will use the current definitions of whatever classes you have defined now, not back when the objects were pickled. IronPython is simply Python with the standard library implemented in C# so that everything emits IL. Both the CPython and the IronPython pic...
2
5
0
I was wondering whether objects serialized using CPython's cPickle are readable by using IronPython's cPickle; the objects in question do not require any modules outside of the built-ins that both Cpython and IronPython include. Thank you!
compatibility between CPython and IronPython cPickle
0
0
0
871
3,882,750
2010-10-07T14:35:00.000
2
1
1
0
python,ironpython,pickle
3,883,735
2
false
0
0
If you use the default protocol (0) which is text based, then things should work. I'm not sure what will happen if you use a higher protocol. It's very easy to test this ...
2
5
0
I was wondering whether objects serialized using CPython's cPickle are readable by using IronPython's cPickle; the objects in question do not require any modules outside of the built-ins that both Cpython and IronPython include. Thank you!
compatibility between CPython and IronPython cPickle
0.197375
0
0
871
3,882,921
2010-10-07T14:53:00.000
4
0
1
0
python,nlp,stemming,stop-words
3,883,529
2
false
0
0
If for some reason you don't want to use NLTK, you can try PyStemmer. For stop words just download a list (google it) and filter them out.
1
4
0
I have a somewhat large document and want to do stop-word elimination and stemming on the words of this document with Python. Does anyone know an of the shelf package for these? If not a code which is fast enough for large documents is also welcome. Thanks
Stop-word elimination and stemmer in python
0.379949
0
0
2,262
3,883,484
2010-10-07T15:56:00.000
9
1
1
0
python,code-coverage,reverse-engineering,code-analysis
3,886,403
3
true
0
0
What you want isn't "test coverage", it is the transitive closure of "can call" from the root of the computation. (In threaded applications, you have to include "can fork"). You want to designate some small set (perhaps only 1) of functions that make up the entry points of your application, and want to trace through a...
3
8
0
My project targets a low-cost and low-resource embedded device. I am dependent on a relatively large and sprawling Python code base, of which my use of its APIs is quite specific. I am keen to prune the code of this library back to its bare minimum, by executing my test suite within a coverage tools like Ned Batchelde...
Using Python code coverage tool for understanding and pruning back source code of a large library
1.2
0
0
2,137
3,883,484
2010-10-07T15:56:00.000
0
1
1
0
python,code-coverage,reverse-engineering,code-analysis
3,883,765
3
false
0
0
I haven't used coverage for pruning out, but it seems like it should do well. I've used the combination of nosetests + coverage, and it worked better for me than figleaf. In particular, I found the html report from nosetests+coverage to be helpful -- this should be helpful to you in understanding where the unused porti...
3
8
0
My project targets a low-cost and low-resource embedded device. I am dependent on a relatively large and sprawling Python code base, of which my use of its APIs is quite specific. I am keen to prune the code of this library back to its bare minimum, by executing my test suite within a coverage tools like Ned Batchelde...
Using Python code coverage tool for understanding and pruning back source code of a large library
0
0
0
2,137
3,883,484
2010-10-07T15:56:00.000
2
1
1
0
python,code-coverage,reverse-engineering,code-analysis
3,890,093
3
false
0
0
As others have pointed out, coverage can tell you what code has been executed. The trick for you is to be sure that your test suite truly exercises the code fully. The failure case here is over-pruning because your tests skipped some code that will really be needed in production. Be sure to get the latest version of ...
3
8
0
My project targets a low-cost and low-resource embedded device. I am dependent on a relatively large and sprawling Python code base, of which my use of its APIs is quite specific. I am keen to prune the code of this library back to its bare minimum, by executing my test suite within a coverage tools like Ned Batchelde...
Using Python code coverage tool for understanding and pruning back source code of a large library
0.132549
0
0
2,137
3,883,497
2010-10-07T15:57:00.000
18
0
0
0
python,django
3,883,556
3
true
1
0
Just run two instances of ./manage.py runserver. You can set a port by simply specifying it directly: ./manage.py runserver 8002 to listen on port 8002. Edit I don't really understand why you want to do this. If you want two servers serving different parts of your site, then you have in effect two sites, which will nee...
2
8
0
Could someone tell me how I can run Django on two ports simultaneously? The default Django configuration only listens on port 8000. I'd like to run another instance on port xxxx as well. I'd like to redirect all requests to this second port to a particular app in my Django application. I need to accomplish this with t...
Run Django on multiple ports
1.2
0
0
14,240
3,883,497
2010-10-07T15:57:00.000
2
0
0
0
python,django
3,883,557
3
false
1
0
The built-in web-server is intended for development only, so you should really be using apache or similar in an situation where you need to run on multiple ports. On the other hand you should be able to start up multiple servers just by starting multiple instances of runserver. As long as you are using a separate datab...
2
8
0
Could someone tell me how I can run Django on two ports simultaneously? The default Django configuration only listens on port 8000. I'd like to run another instance on port xxxx as well. I'd like to redirect all requests to this second port to a particular app in my Django application. I need to accomplish this with t...
Run Django on multiple ports
0.132549
0
0
14,240
3,883,619
2010-10-07T16:12:00.000
0
0
1
0
python,django,shell,ipython
34,309,424
5
false
1
0
The easiest solution I've found is combination of shell_plus and iPython which automatically reloads functions. pip install ipython pip install django-extensions add 'django_extensions' to your INSTALLED_APPS python manage.py shell_plus
1
6
0
I work in the django IPython-shell, which can be started with manage.py shell. When i load an extern function in the shell for testing, everything is alright. But when i make changes to the function, the shell still has the old version of the function. Even if i make a new import. Does anyone know how to reload the act...
django, python: reload function in shell
0
0
0
8,233
3,883,724
2010-10-07T16:26:00.000
1
1
0
0
python,c,embedded-language
3,884,055
1
false
0
1
This may not be the answer you want, but there are ways of working with C and Python other than embedding an interpreter inside a C application. Namely, why don't you do the opposite? Create C libraries for Python? You can control the general flow of your application in Python, which is much more comfortable, and call ...
1
0
0
Due to refactoring/reworking on a controller I've had to embed a Python Interpreter inside a C application. I can now call python functions and pass/get Objects into Python fine. The python code is a controller for a robot (currently simulated), this now needs make use of some C code for comparisons I'm making. Previ...
Maintaining a Python Object when embedding in C
0.197375
0
0
102
3,884,405
2010-10-07T17:56:00.000
2
0
1
0
c#,python,vb.net,user-interface
3,884,537
4
false
0
0
For programming on Windows you want to go with .NET and probably WPF for the presentation layer if you can wrap your head around MVVM as it gives you much more scope for delivering flexible UIs than forms. For cross platform utility - probably python, but I'm not sure I'd want it to be my principal development tool (i...
3
0
0
I am hired by my local company here which makes small accounting/billing/payroll softwares to manage its clients' companies. Most of them use windows platform and the softwares themselves will not be too complex ones. I want to ask which language should i opt for? Python, C#, VB.net or something else which will make th...
Windows platform programming
0.099668
0
0
147
3,884,405
2010-10-07T17:56:00.000
2
0
1
0
c#,python,vb.net,user-interface
3,885,769
4
false
0
0
The advice to build upon what you already know is very good advice. As you are thinking of Python, I feel i should warn you off Iron Python. I found it very very slow and WPF confused the heck out of me. The designer is nice. The error messages you get when importing the wrong namespaces are cryptic and comfusing (Exa...
3
0
0
I am hired by my local company here which makes small accounting/billing/payroll softwares to manage its clients' companies. Most of them use windows platform and the softwares themselves will not be too complex ones. I want to ask which language should i opt for? Python, C#, VB.net or something else which will make th...
Windows platform programming
0.099668
0
0
147
3,884,405
2010-10-07T17:56:00.000
0
0
1
0
c#,python,vb.net,user-interface
3,884,449
4
false
0
0
My personal preference is WPF/C#. I say go with the latest technology (whichever YOU find easiest), it will be good for your career.
3
0
0
I am hired by my local company here which makes small accounting/billing/payroll softwares to manage its clients' companies. Most of them use windows platform and the softwares themselves will not be too complex ones. I want to ask which language should i opt for? Python, C#, VB.net or something else which will make th...
Windows platform programming
0
0
0
147
3,884,795
2010-10-07T18:44:00.000
2
0
1
0
python,pdf,gis,geospatial
3,885,385
3
true
0
0
One option is to use GDAL... The latest version (i.e. the current svn trunk, not any released version) of gdal should support geoPDF's. You'll need to compile it with the option --with-poppler=yes and have the poppler pdf library installed. (Compiling gdal can be a bit of a pain, just to warn you ahead of time...) G...
1
2
0
I want to organize lots of geoPDF files so they can easily viewed overlayed onto Google Maps and Google Earth. My 1st step, I think, is to convert the geoPDF to a jpg type image which then needs matching lat,long information. Is there python code to parse a geoPDF file to get the projection and image data? A geoPDF2KML...
Is there python code to parse a geoPDF file to get the projection and image data? a geoPDF2KML tool?
1.2
0
0
2,683
3,884,881
2010-10-07T18:53:00.000
0
0
1
1
python,windows-xp
3,884,931
3
false
0
0
You need to map it as a drive.
1
2
0
How can I open a Python interpreter at a specific network path in Windows? In the Explorer address bar the path is in UNC form: \\myhost\myshare\.... I can't work out how to change to this directory from the Windows command line, nor in what format I could pass it as an argument to os.chdir. I'm running Python 2.5 on W...
How can I open a Python shell at a network path in Windows?
0
0
0
2,258
3,885,160
2010-10-07T19:24:00.000
0
0
0
1
python,linux,networking,ip-address
3,885,255
2
false
0
0
If the default gateway for the system is reliable, then grab that from the output from route -n the line that contains " UG " (note the spaces) will also contain the IP of the gateway and interface name of the active interface.
1
1
0
On my linux machine, 1 of 3 network interfaces may be actually connected to the internet. I need to get the IP address of the currently connected interface, keeping in mind that my other 2 interfaces may be assigned IP addresses, just not be connected. I can just ping a website through each of my interfaces to determin...
Determine IP address of CONNECTED interface (linux) in python
0
0
1
2,443
3,885,489
2010-10-07T20:09:00.000
5
1
0
0
python,unit-testing,testing
3,885,518
5
false
0
0
Or would such an approach be antithetical to unit testing's underlying philosophy? Yep...if it is a unit test, it should be able to run on its own. Anytime I have found someone wanting to create dependencies on tests was due to the code being structured in a poor manner. I am not saying this is the instance in you...
4
6
0
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
Test framework allowing tests to depend on other tests
0.197375
0
0
1,809
3,885,489
2010-10-07T20:09:00.000
0
1
0
0
python,unit-testing,testing
3,891,628
5
false
0
0
It looks like what you need is not to prevent the execution of your dependent tests but to report the results of your unit test in a more structured way that allows you to identify when an error in a test cascades onto other failed tests.
4
6
0
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
Test framework allowing tests to depend on other tests
0
0
0
1,809
3,885,489
2010-10-07T20:09:00.000
1
1
0
0
python,unit-testing,testing
3,895,868
5
false
0
0
This seems to be a recurring question - e.g. #3396055 It most probably isn't a unit-test, because they should be fast (and independent). So running them all isn't a big drag. I can see where this might help in short-circuiting integration/regression runs to save time. If this is a major need for you, I'd tag the setup ...
4
6
0
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
Test framework allowing tests to depend on other tests
0.039979
0
0
1,809
3,885,489
2010-10-07T20:09:00.000
0
1
0
0
python,unit-testing,testing
3,897,462
5
false
0
0
The test runners py.test, Nosetests and unit2/unittest2 all support the notion of "exiting after the first failure". py.test more generally allows to specify "--maxfail=NUM" to stop running and reporting after NUM failures. This may already help your case especially since maintaining and updating dependencies for test...
4
6
0
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root ...
Test framework allowing tests to depend on other tests
0
0
0
1,809
3,885,519
2010-10-07T20:13:00.000
0
0
0
0
python,web-services,usb
3,885,544
2
false
0
0
This doesn't seem much different then serving files from a local hard drive. You could map the thumbdrive to always be something not currently used on your machine (like U:).
1
0
0
Using just python, is it possible to possible to use a USB flash drive to serve files locally to a browser, and save information off the online web? Ideally I would only need python. Where would I start?
Is it possible to use a USB flash drive to serve files locally to a browser?
0
0
1
195
3,886,281
2010-10-07T22:19:00.000
3
0
1
0
python,image,image-processing,numpy
25,062,330
3
false
0
0
Quick addition: for displaying with matplotlib, if you want the image to appear "raster", i.e., pixelized without smoothing, then you should include the option interpolation='nearest' in the call to imshow.
1
23
1
I've got a numpy array in Python and I'd like to display it on-screen as a raster image. What is the simplest way to do this? It doesn't need to be particularly fancy or have a nice interface, all I need to do is to display the contents of the array as a greyscale raster image. I'm trying to transition some of my IDL c...
Display array as raster image in python
0.197375
0
0
41,992
3,886,402
2010-10-07T22:38:00.000
7
0
1
0
python,floating-point,decimal
66,605,212
36
false
0
0
To make it work with both positive and negative numbers: try abs(x)%1. For negative numbers, without with abs, it will go wrong. 5.55 % 1 output 0.5499999999999998 -5.55 % 1 output 0.4500000000000002
1
164
0
How do I get the numbers after a decimal point? For example, if I have 5.55, how do i get .55?
How to get numbers after decimal point?
1
0
0
285,621
3,886,500
2010-10-07T22:56:00.000
0
0
0
0
python,multithreading,pyqt,copy-paste
3,886,510
1
false
0
1
In Qt you would overload the OnClose method for the widget/frame or hook the lastwindowsdclosed signal to do whatever you need to shut down the app - don't know if it's diiferent from python
1
0
0
I have a programs that runs several threads (on a while loop until Ctrl C is pressed). The app also has a GUI that I developed in PyQt. However, I am facing the following problem: If I press Ctrl C on the console, and then close the GUI, the program exits fine. However, if I close the GUI first, the other threads wo...
PyQT4 and Ctrl C
0
0
0
722
3,887,017
2010-10-08T01:09:00.000
0
0
0
0
python,django-models,input,field
3,887,176
1
false
1
0
How about creating a separate model for each type of field you want to support, and then another model consisting of a list of (table_name, entry_id) pairs, which could be customized to use any combination of fields?
1
0
0
This is my first post here, and I'd like to describe what I want to do as specific as possible. I'd like to make a model that is 'selectable.' for example, class SimpleModel(models.Model): property = models.CharField(max_length=255) value = GeneralField() GeneralField can be "CharField", "URLField", "TextFiel...
Letting users to choose what type of content they want to input
0
0
0
63
3,887,675
2010-10-08T04:20:00.000
1
0
0
0
python,openerp
10,221,855
4
false
1
0
related fields leads the control to another table the parent table wil have a onetomany relation with the child table and the child table have a manytoone relation towards the parent table. eg: the account.invoice to account.invoice.line with the following field 'invoice_line': fields.one2many('account.invoice.line', ...
1
10
0
Can someone explain to me something about related fields. For example - How it was used How it can be helped For which kind of scenario I should use fields.related If anybody can provide a small example for real use of fields.related I would appreciate it.
What is the use of related fields in OpenERP?
0.049958
0
0
11,804
3,888,125
2010-10-08T06:17:00.000
0
0
0
0
python,qr-code
5,047,781
5
false
0
1
pyqrnative is working pretty well for me. I wish I could find some documentation in English for it. Would like to know the relationship between data content size and the first "typeNumber" argument.
1
5
0
I am looking for qrcode generator for python window version. Can anyone help me to find out. I didn't get anywhere. Please help me. Thanks, manu
qrcode generator using python for windows
0
0
0
8,188
3,888,812
2010-10-08T08:20:00.000
0
0
0
1
python,urllib2,urllib,buffering,urlopen
3,888,827
2
true
0
0
A quick hack that has occurred to me is to use urllib.urlopen() with threading.Timer() to emulate timeout. But that's only quick and dirty hack.
1
1
0
I have client for web interface to long running process. I'd like to have output from that process to be displayed as it comes. Works great with urllib.urlopen(), but it doesn't have timeout parameter. On the other hand with urllib2.urlopen() the output is buffered. Is there a easy way to disable that buffer?
unbuffered urllib2.urlopen
1.2
0
1
1,600
3,889,769
2010-10-08T10:47:00.000
6
0
0
0
python,django,http-headers,httprequest
46,259,055
10
false
1
0
request.META.get('HTTP_AUTHORIZATION') /python3.6/site-packages/rest_framework/authentication.py you can get that from this file though...
1
131
0
I need to get all the Django request headers. From what I've read, Django simply dumps everything into the request.META variable along with a lot of other data. What would be the best way to get all the headers that the client sent to my Django application? I'm going use these to build a httplib request.
How can I get all the request headers in Django?
1
0
0
150,515
3,890,271
2010-10-08T12:03:00.000
1
0
0
0
python,webcam
3,890,377
2
false
0
0
You could do it with some kind of java applet or flash/silverlight application, just look at sites like "chat roulette"
1
0
0
Is it possible to stream my webcam form my local machine that's connected to the internet to show up on my website without using any media server or something similar?
How to stream my webcam through my site?
0.099668
0
1
807
3,890,321
2010-10-08T12:11:00.000
8
0
1
0
python,grammar
3,890,344
2
true
0
0
Grammars are generally of the same form: Backus-Naur Form (BNF) is typical. Lexer/parsers can take very different forms. The lexer breaks up the input file into tokens. The parser uses the grammar to see if the stream of tokens is "valid" according to its rules. Usually the outcome is an abstract syntax tree (AST) t...
1
4
0
I wonder how is generated the grammar of the Python language and how it is understood by the interpreter. In python, the file graminit.c seems to implement the grammar, but i don't clearly understand it. More broadly, what are the different ways to generate a grammar and are there differences between how the grammar is...
How is generated the python grammar and how the interpreter understand it
1.2
0
0
841
3,890,390
2010-10-08T12:22:00.000
7
0
1
0
javascript,python,sockets,encoding
3,890,407
2
false
1
0
JSON is definitely the way to go. It has a very small overhead and is capable of storing almost any kind of data. I am not a python expert, but i am sure that there is some kind of en/decoder available.
1
1
0
OK so im using websockets to let javascript talk to python and that works very well BUT the data i need to send often has several parts like an array, (username,time,text) but how could i send it ? I originally though to encode each one in base64 or urlencode then use a character like | which those encoding methods wil...
Python to javascript communication
1
0
1
1,908
3,891,180
2010-10-08T13:48:00.000
1
0
0
0
python,random,numpy,shuffle,sampling
18,177,268
6
false
0
0
people using numpy version 1.7 or later there can also use the builtin function numpy.random.choice
1
13
1
I'm writing some modelling routines in NumPy that need to select cells randomly from a NumPy array and do some processing on them. All cells must be selected without replacement (as in, once a cell has been selected it can't be selected again, but all cells must be selected by the end). I'm transitioning from IDL where...
Select cells randomly from NumPy array - without replacement
0.033321
0
0
15,426
3,891,645
2010-10-08T14:40:00.000
0
0
0
0
python,algorithm,cluster-analysis,classification,nearest-neighbor
3,893,461
3
false
0
0
If your number of clusters is fixed and you only want to maximize the number of points that are in these clusters then I think a greedy solution would be good : find the rectangle that can contains the maximum number of points, remove these points, find the next rectangle ... So how to find the rectangle of maximum ...
1
4
1
I've been tasked to find N clusters containing the most points for a certain data set given that the clusters are bounded by a certain size. Currently, I am attempting to do this by plugging in my data into a kd-tree, iterating over the data and finding its nearest neighbor, and then merging the points if the cluster t...
Clustering problem
0
0
0
1,423
3,893,885
2010-10-08T19:56:00.000
2
0
1
0
python
3,893,929
9
false
0
0
If there is no way to tell where the string will be (first half, second half, etc) then there is really no optimized way to do the search other than the builtin "find" function. You could reduce the I/O time and memory consumption by not reading the file all in one shot, but at 4kb blocks (which is usually the size of ...
1
41
0
I need to search a pretty large text file for a particular string. Its a build log with about 5000 lines of text. Whats the best way to go about doing that? Using regex shouldn't cause any problems should it? I'll go ahead and read blocks of lines, and use the simple find.
Cheap way to search a large text file for a string
0.044415
0
0
134,926
3,894,278
2010-10-08T21:00:00.000
0
0
0
0
python,twisted
8,505,450
3
false
1
0
use defer.inlineCallbacks can make your codes easiler to read.. and it somehow like corountine style: you neither block the call nor use chain of callbacks to build the whole logic. It is intuitive.
2
11
0
Is there any reason to use one over the other? Do they have the same performance?
Twisted Deferred.addCallBack() vs. yield and @inlineDeferred
0
0
0
5,275
3,894,278
2010-10-08T21:00:00.000
2
0
0
0
python,twisted
3,894,412
3
false
1
0
The differences should really be subtle. If this code really does run that often that it matters, perhaps you should look into your application design. Otherwise, take the variant which is more easy to read, you will have to make heads and tails out of it a couple of months or years down the road. EDIT: If you really w...
2
11
0
Is there any reason to use one over the other? Do they have the same performance?
Twisted Deferred.addCallBack() vs. yield and @inlineDeferred
0.132549
0
0
5,275
3,895,359
2010-10-09T01:48:00.000
0
1
1
0
python,design-patterns,global-variables,class-design
3,895,385
2
false
0
0
There is no problem with using properties on classes. Classes are just objects, too. In your case, with this little information available, I would go for a class property, too, because not creating dependencies ist great and will be one worry less sometimes later.
1
4
0
Little question concerning app architecture: I have a python script, running as a daemon. Inside i have many objects, all inheriting from one class (let's name it 'entity') I have also one main object, let it be 'topsys' Entities are identified by pair (id, type (= class, roughly)), and they are connected in many wicke...
python global object cache
0
0
0
3,257
3,896,087
2010-10-09T15:11:00.000
4
0
0
0
python,blender,panda3d
3,896,157
2
true
1
0
From a python automation point of view, blender itself is written largely in python, and the source is available which allows a level of automation not possible if you can't change the source. To me, having the source available in that situation is more of a benefit than the price tag. If you do go with blender, defin...
1
2
0
I am getting started with the development of 3d environments for using in panda3d. As I am new to this, I need to choose a modelling software to create basic geometries, etc. Therefore, which one is better suited for automation through python? 3DS Max or Blender3D? I would like to automate generating basic geometries, ...
Blender3d vs 3DS max; which one is better suited for automation in python?
1.2
0
0
1,647
3,896,313
2010-10-09T16:04:00.000
1
0
0
1
c++,python,scripting,lua
3,897,041
4
false
0
1
Guile is easy to embed and extend, and scheme if powerfull programming language. You can compile libguile and add it to the repository in lib directory or add source for guile and compile it when user compile the project. But I don't try to use guile on Windows.
3
3
0
I need a simple interpreter which will do execution (evaluation) of simple expressions/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later. It should also be strait-forward for other team members to pull my application from ...
Simple interpreter to embed and extend inside an C++ Windows application
0.049958
0
0
739
3,896,313
2010-10-09T16:04:00.000
4
0
0
1
c++,python,scripting,lua
3,897,270
4
true
0
1
Two great options you've already listed are Python and Lua. Here are some of the tradeoffs for your consideration: Python A much more complete and powerful language (IMHO!) with libraries for anything and tons of support and communities everywhere you look. Syntax is not entirely C-like Although Python wasn't designed...
3
3
0
I need a simple interpreter which will do execution (evaluation) of simple expressions/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later. It should also be strait-forward for other team members to pull my application from ...
Simple interpreter to embed and extend inside an C++ Windows application
1.2
0
0
739
3,896,313
2010-10-09T16:04:00.000
2
0
0
1
c++,python,scripting,lua
3,898,118
4
false
0
1
No matter which scripting language you choose (and I would probably vote for Python), you might consider using SWIG (www.swig.org) to ease the burden of interfacing to C++. While normally used to build C++ extensions for python (or ruby, lua, guile, any many others), it can be used to aid in embedding too. You had ment...
3
3
0
I need a simple interpreter which will do execution (evaluation) of simple expressions/statements and also call functions from main C++ applications. At the moment I do not need scripting of the application, but it may be useful later. It should also be strait-forward for other team members to pull my application from ...
Simple interpreter to embed and extend inside an C++ Windows application
0.099668
0
0
739
3,896,741
2010-10-09T09:24:00.000
0
0
0
0
python,django,cloud
3,896,820
3
false
1
0
If you're going to use a web framework on the server, it makes sense to use an HTTP-based protocol. The downside is that only the client can initiate a connection (e.g., the client needs to first ask for the "dump" file), but a simple GET request will suffice (remember, the server can send anything in the HTTP response...
2
1
0
For my final year project I plan to code a cloud in Python. The client will be written in Java by the other member of my team. The client will have a tabbed interface and it will provide a text editor, a media player, a couple of small Java based games and a maybe a few more services. The server will work like this: ...
How to do cloud computing with Python and Java? Final Year project
0
0
0
2,332
3,896,741
2010-10-09T09:24:00.000
0
0
0
0
python,django,cloud
3,896,834
3
false
1
0
Stick to Django. It's really productive. I would use JSON instead of XML. More convenient. import json. This should help you in communicating between client-server. Also cloud computing is just a recent word that's just thrown around for (client+server+some services). Oh by the way all that you want to do can be comple...
2
1
0
For my final year project I plan to code a cloud in Python. The client will be written in Java by the other member of my team. The client will have a tabbed interface and it will provide a text editor, a media player, a couple of small Java based games and a maybe a few more services. The server will work like this: ...
How to do cloud computing with Python and Java? Final Year project
0
0
0
2,332
3,897,040
2010-10-09T17:07:00.000
1
0
1
0
python,dictionary,iteration,average
3,897,064
3
false
0
0
Inherit from dict and calculate the average value each time __setitem__ is called. Since you can store the previous average in your dictionary class and only average this and the new value that is added, that should be pretty fast - the first time a new item is added, the average value is simply that of this value.
1
4
0
I'm trying to find the fastest/most efficient way to extract the average value from a dict. The task I'm working on requires that it do this thousands of times, so simply iterating over all the values in the dict each time to find the average would be entirely inefficient. Hundreds and hundreds of new key,value pairs g...
Python - Fastest way to find the average value over entire dict each time it gets modified?
0.066568
0
0
4,313
3,897,101
2010-10-09T17:20:00.000
3
0
1
1
python,linux,user-interface
3,897,118
2
true
0
0
There are numerous decent GUI toolkits, the most popular being PyQt, PyGTK, wxPython and Tkinter. Personally, I prefer Qt, but that's really subjective.
2
0
0
I am new to GUI development. What is the best GUI development package for python on linux (ubuntu being more specific)?
GUI development package
1.2
0
0
238
3,897,101
2010-10-09T17:20:00.000
1
0
1
1
python,linux,user-interface
3,897,128
2
false
0
0
This is much more a matter of personal taste. I use GTK+ with Glade.
2
0
0
I am new to GUI development. What is the best GUI development package for python on linux (ubuntu being more specific)?
GUI development package
0.099668
0
0
238
3,897,140
2010-10-09T17:31:00.000
0
1
0
1
python,apache
3,898,807
2
false
1
0
You'd need to show your apache configuration to say for certain, but it seems that Apache isn't actually using mod_cgi to serve the index.cgi script. In your configuration there should be something like 'LoadModule mod_cgi'. It should be uncommented (i.e., it shouldn't have a '#' at the beginning of the line). If you ...
2
0
0
I have a CGI script (pwyky) that I called index.cgi, put in directory wiki/, and setup Apache to call localhost/wiki/index.cgi when I access localhost/wiki. I'm getting errors when I'm trying to use this application -- it creates a page with links like "http://localhost/wiki/@edit/index", but when I click that link, Ap...
URL rewriting question
0
0
0
762
3,897,140
2010-10-09T17:31:00.000
0
1
0
1
python,apache
3,908,016
2
true
1
0
I found the problem, it turned out this is done through RewriteEngine. Pwyky puts .htaccess file in the directory with all the settings for RewriteEngine, but because AllowOverride is "None" by default on MacOS, they were ignored. The solution was to change all "AllowOverride" directives to "All"
2
0
0
I have a CGI script (pwyky) that I called index.cgi, put in directory wiki/, and setup Apache to call localhost/wiki/index.cgi when I access localhost/wiki. I'm getting errors when I'm trying to use this application -- it creates a page with links like "http://localhost/wiki/@edit/index", but when I click that link, Ap...
URL rewriting question
1.2
0
0
762
3,897,650
2010-10-09T20:02:00.000
1
0
0
0
python,django,search,full-text-search,django-sphinx
4,121,651
1
true
1
0
Here's a shot in the dark - Try to get the name of your index in sphinx.conf same as the table_name you are trying to index. This is a quirk which is missed by lot of people.
1
0
0
I am trying out Sphinx search in my Django project. All setup done & it works but need some clarification from someone who has actually used this setup. In my Sphinx search while indexing, I have used 'name' as the field in my MySQL to be searchable & all other fields in sql_query to be as attributes (according to Sphi...
Django Sphinx Text Search
1.2
1
0
395
3,898,411
2010-10-10T00:07:00.000
0
0
1
0
python
3,898,509
5
false
0
0
I've always used v3 primarily. "Hacking 3rd party libraries" to me is just like importing any other module. The only thing is since most stuff still uses v2 you have to know both versions and keep them straight when looking at others code.
5
2
0
Is 2.x still the norm or would you recommend just coding in v3 at this point?
Is it time to cut over to Python 3.x now or not?
0
0
0
219
3,898,411
2010-10-10T00:07:00.000
0
0
1
0
python
3,898,448
5
false
0
0
My main use of Python is Django. Support for 3.x for this framework still lies in the future, unfortunately, and who knows about any related modules - so no, it's not quite time for many people. I actually bought Python 3 books last year when I started learning Python, thinking "I'll just start with 3 from the beginnin...
5
2
0
Is 2.x still the norm or would you recommend just coding in v3 at this point?
Is it time to cut over to Python 3.x now or not?
0
0
0
219
3,898,411
2010-10-10T00:07:00.000
0
0
1
0
python
3,898,444
5
false
0
0
Do the frameworks and libraries you use have Python 3 versions? Libraries you use for development, and does your deploy stack support Python 3? Many Python projects have a lot of dependancies, especially web based projects, most of which aren't Py3K ready yet. If your stack is good, sure - Python 3 is the future, migh...
5
2
0
Is 2.x still the norm or would you recommend just coding in v3 at this point?
Is it time to cut over to Python 3.x now or not?
0
0
0
219
3,898,411
2010-10-10T00:07:00.000
0
0
1
0
python
3,898,418
5
false
0
0
Google App Engine documentation states it uses Python 2.5 Today I happened to notice that Python Imaging Library is till not released for 3.x. So, if you need those libraries or services, I guess you should wait.
5
2
0
Is 2.x still the norm or would you recommend just coding in v3 at this point?
Is it time to cut over to Python 3.x now or not?
0
0
0
219
3,898,411
2010-10-10T00:07:00.000
3
0
1
0
python
3,898,422
5
true
0
0
Python 3 is still a long way off having universal support from tools, libraries and distros, so its use in production would depend very much on whether the bits you need (or are likely to need in the near future) have been ported. For exploratory, educational and other uses, it depends very much on your own proclivity ...
5
2
0
Is 2.x still the norm or would you recommend just coding in v3 at this point?
Is it time to cut over to Python 3.x now or not?
1.2
0
0
219
3,898,740
2010-10-10T02:20:00.000
3
0
1
0
python,timer
3,898,829
2
true
0
0
I think its a bad idea to use Timers in your case. Using the delayed threads in python will result in more complex code, less accuracy, and quite possible worse performance. Basically, the rule is that if you think you need threads, you don't. Very few programs benefit from the use of threads. I don't know what you are...
2
4
0
I am working on a text-based game in Python 3.1 that would use timing as it's major source of game play. In order to do this effectively (rather than check the time every mainloop, my current method, which can be inaccurate, and slow if multiple people are playing the game at once) I was thinking about using the Thread...
Is using multiple Timers in Python dangerous?
1.2
0
0
2,394
3,898,740
2010-10-10T02:20:00.000
1
0
1
0
python,timer
3,898,754
2
false
0
0
It should be perfectly safe to have multiple timers going at the same time. Beware that it may not give much of a performance boost, as the CPython interpreter (the standard Python interpreter) uses a GIL (Global Interpreter Lock) which makes threading stuff a bit.... slow.
2
4
0
I am working on a text-based game in Python 3.1 that would use timing as it's major source of game play. In order to do this effectively (rather than check the time every mainloop, my current method, which can be inaccurate, and slow if multiple people are playing the game at once) I was thinking about using the Thread...
Is using multiple Timers in Python dangerous?
0.099668
0
0
2,394
3,898,988
2010-10-10T04:11:00.000
1
0
0
0
python,wxpython,frame,send
3,906,746
2
false
0
1
I'd definitely use PubSub as it's probably the cleanest way I can think of to do it. You can also do it with wx.PostEvent or use a modal frame.
1
1
0
I'm writing a small app which has 2 separate frames. The first frame is like a video player controller. It has Play/Stop/Pause buttons etc. It's named controller.py. The second frame contains OpenGL rendering and many things inside it, but everything is wrapped inside a Frame() class as the above. It's named model.py. ...
How to control a frame from another frame?
0.099668
0
0
669
3,900,403
2010-10-10T13:03:00.000
1
0
0
0
python,sockets,serial-port
3,900,446
2
false
0
0
The simplest way is to simply accept a connection, handle the request, and close the connection. This way, your program handles only one request at a time. An alternative is to use locking or semaphores, to prevent multiple clients accessing the RS232 port simultaneously.
1
1
0
I need to expose an RS232 connection to clients via a network socket. I plan to write in python a TCP socket server which will listen on some port, allow client to connect and handle outgoing and manage and control requests and replies to from the R2232 port. My question is, how do I synchronize the clients, each clie...
Writing a TCP to RS232 driver
0.099668
0
1
1,048
3,901,144
2010-10-10T16:33:00.000
37
0
1
0
python,boolean
3,901,151
5
false
0
0
The former tests trueness, whereas the latter tests for identity with None. Lots of values are false, such as False, 0, '', and None, but only None is None.
1
49
0
It appears that "if x" is almost like short-hand for the longer "if x is not None" syntax. Are they functionally identical or are there cases where for a given value of x the two would evaluate differently? I would assume the behavior should also be identical across Python implementations - but if there are subtle diff...
Difference between "if x" and "if x is not None"
1
0
0
21,281
3,901,444
2010-10-10T17:58:00.000
2
0
1
0
python
3,901,628
5
false
0
0
You might want to rethink how you're representing your numbers. It might be best to represent all values as integers and then format them later when you need to print or display your output. This will give you the freedom of not worrying about floating-point errors and additionally will let you use math.ceil.
1
0
0
I just started programming in python not long ago, and I'm having trouble figuring out the rounding issue when it comes to tax and money. I can't seem to get decimals to always round up to the nearest hundredths place. for instance, in our state, sales takes is 9.5%, so a purchase of 5 dollars would make tax $.48, bu...
I'm new to python, and trying to program a sales tax button for a calculator
0.07983
0
0
1,968
3,901,961
2010-10-10T19:59:00.000
0
0
0
0
python,orm,metaprogramming,introspection,relationships
3,902,410
3
true
0
0
So far, I see the only one technique covering more than two tables in relation. A table X is assumed related to table Y, if and only if X is referenced to Y no more than one table away. That is: "Zero tables away" means X contains the foreign key to Y. No big deal, that's how we detect many-to-ones. "One table away" me...
3
2
0
I'm currently busy making a Python ORM which gets all of its information from a RDBMS via introspection (I would go with XRecord if I was happy with it in other respects) — meaning, the end-user only tells which tables/views to look at, and the ORM does everything else automatically (if it makes you actually write some...
What are methods of programmatically detecting many-to-many relationships in a RDMBS?
1.2
1
0
241
3,901,961
2010-10-10T19:59:00.000
1
0
0
0
python,orm,metaprogramming,introspection,relationships
3,902,041
3
false
0
0
If you have to ask, you shouldn't be doing this. I'm not saying that to be cruel, but Python already has several excellent ORMs that are well-tested and widely used. For example, SQLAlchemy supports the autoload=True attribute when defining tables that makes it read the table definition - including all the stuff you're...
3
2
0
I'm currently busy making a Python ORM which gets all of its information from a RDBMS via introspection (I would go with XRecord if I was happy with it in other respects) — meaning, the end-user only tells which tables/views to look at, and the ORM does everything else automatically (if it makes you actually write some...
What are methods of programmatically detecting many-to-many relationships in a RDMBS?
0.066568
1
0
241
3,901,961
2010-10-10T19:59:00.000
0
0
0
0
python,orm,metaprogramming,introspection,relationships
3,902,030
3
false
0
0
Theoretically, any table with multiple foreign keys is in essence a many-to-many relation, which makes your question trivial. I suspect that what you need is a heuristic of when to use MTM patterns (rather than standard classes) in the object model. In that case, examine what are the limitations of the patterns you cho...
3
2
0
I'm currently busy making a Python ORM which gets all of its information from a RDBMS via introspection (I would go with XRecord if I was happy with it in other respects) — meaning, the end-user only tells which tables/views to look at, and the ORM does everything else automatically (if it makes you actually write some...
What are methods of programmatically detecting many-to-many relationships in a RDMBS?
0
1
0
241
3,902,008
2010-10-10T20:17:00.000
5
0
0
0
python,latex,pyqt,sympy
6,916,267
2
false
0
1
If you just need simple rendering using python, how about trying ipython 0.11 with qtconsole using sympy profile(ipython qtconsole --profile=sympy). It did implement matplotlib, but I consider it quite clean considering mathematical expressions can be rendered directly on the qtconsole. Need to install pyzmq module.
1
5
0
I am hoping to use PyQt to produce an application that will display an equation entered by the user. I had considered matplotlib, but this seems like overkill as I would only be using it to render the latex. I need to use SymPy anyway, so I was hoping there would be a way to use it to do the rendering also, preferably ...
Is it possible for SymPy to render LaTeX for use in a GUI?
0.462117
0
0
2,067
3,902,032
2010-10-10T20:22:00.000
1
0
0
0
mono,ironpython
3,911,162
1
false
0
0
Did you build IronPython yourself? Signing is kind of a PITA and you'll need to provide your own full key to get a real signature. We do include the MS public key in the distribution but this can only be used for delay signing. We do have delay signing turned on in the build which might result in a delay signed buil...
1
1
0
I tried to use gacutil (mono) for IronPython, but I got the following error. sudo gacutil -i IronPython.dll Password: Failure adding assembly IronPython.dll to the cache: Strong name cannot be verified for delay-signed assembly What does this mean? Any solution to this problem?
GAC (gacutil) not working with IronPython.dll on Mono
0.197375
0
0
597
3,902,996
2010-10-11T01:28:00.000
-2
0
1
0
python,debugging,ide
3,903,016
6
false
0
0
To start coding in a file, just open a new file and start typing.
4
3
0
This obviously an extremely novice question, but I've installed Python 2.7 and started reading the manual. However I looked and looked, and couldn't understand how to start programming a file rather than writing in interactive mode. One book that was online suggested quit(), which surprise -- quit the program. Should c...
How to get out of interactive mode in Python
-0.066568
0
0
7,387
3,902,996
2010-10-11T01:28:00.000
0
0
1
0
python,debugging,ide
16,851,751
6
false
0
0
use new window tool in the file icon,in the python idle itself to write a program
4
3
0
This obviously an extremely novice question, but I've installed Python 2.7 and started reading the manual. However I looked and looked, and couldn't understand how to start programming a file rather than writing in interactive mode. One book that was online suggested quit(), which surprise -- quit the program. Should c...
How to get out of interactive mode in Python
0
0
0
7,387
3,902,996
2010-10-11T01:28:00.000
0
0
1
0
python,debugging,ide
3,903,066
6
false
0
0
Push new to start making your own script file. Then when you are ready to test click run and then you can watch the results in the interactive mode, and even try new things as if you were adding code to the end of your script file, its a very useful app for debugging, testing and trying new things. Also in the options...
4
3
0
This obviously an extremely novice question, but I've installed Python 2.7 and started reading the manual. However I looked and looked, and couldn't understand how to start programming a file rather than writing in interactive mode. One book that was online suggested quit(), which surprise -- quit the program. Should c...
How to get out of interactive mode in Python
0
0
0
7,387
3,902,996
2010-10-11T01:28:00.000
2
0
1
0
python,debugging,ide
3,903,006
6
false
0
0
Yes, coding should be done in a different program. The interactive shell is very useful but it's not an editor.
4
3
0
This obviously an extremely novice question, but I've installed Python 2.7 and started reading the manual. However I looked and looked, and couldn't understand how to start programming a file rather than writing in interactive mode. One book that was online suggested quit(), which surprise -- quit the program. Should c...
How to get out of interactive mode in Python
0.066568
0
0
7,387
3,904,809
2010-10-11T09:00:00.000
1
0
0
0
python,django,django-forms
3,910,066
1
false
1
0
You can either make the form have an additional form field for the checkbox. And override it's save method to fill the model fields accordingly. Or you can make a custom form field widget that would hold both HTML input fields and produce the appropriate python value from the inputs and vice versa. The first option bei...
1
2
0
I am making a form in Django. The field to display is a numeric field representing some limit. It's possible for there to be no limit. Rather than force the user to enter some strange number to mean unlimited (e.g. -1), I'd like there to be a radio button, with 2 options: "Unlimited" and the second option being a text ...
Django - Form widget with a checkbox to choose between unlimited or a textbox for a number
0.197375
0
0
734
3,905,509
2010-10-11T10:51:00.000
0
0
1
0
python,regex
3,905,595
2
false
0
0
If you absolutly want regexes you can use (?<=\\autocite)(.*?)\\autocite(.*) and replace with \1\2. But @Ignacio Vazquez-Abrams answer is way better an efficient.
1
0
0
Given lines that look like the following: Blah \cite[9.1173]{Joyce:1986aa}\autocite[42]{Kenner:1970ab}\autocite[108]{Hall:1960aa} bbb.\n I’d like to remove the second (and any subsequent) occurrence of \autocite, resulting in the following: Blah \autocite[9.1173]{Joyce:1986aa}[42]{Kenner:1970ab}[108]{Hall:1960aa} bbb.\...
How to remove repeating non-adjacent string
0
0
0
146
3,905,791
2010-10-11T11:33:00.000
1
0
0
1
python,twisted,factory
3,906,174
1
false
1
0
No. Write a class that does the interaction with one user. In connectionMade you check if a instance of this class already exists, if not you make a new one and store it on the factory, ie in a { addr : handler } dict. If the connection exists alreay you get the old handler from the factory.
1
0
0
Hey, I got a ReconnectingClientFactory and I wonder if I can somehow define protocol-instance-based connectionMade/connectionLost callbacks so that i can use the factory to connect to different hosts ans distinguish between each connection. Thanks in advance.
Twisted factory protocol instance based callback
0.197375
0
0
499
3,905,883
2010-10-11T11:48:00.000
2
1
0
0
python,multithreading,debugging,deadlock,futex
4,533,967
2
false
1
0
Dear Helmut, I've the same problem with one thread hanging on FUTEXT_WAIT_PRIVATE. It seems you have solved the issue. Can you share more information about the solution? UPD: The reason for the lock was finally found (at least for my case): it was due to import lock in Python. Consider following situation: file1.py: i...
2
2
0
I have a Python daemon running in production. It employs between 7 and 120 threads. Recently the smallest instance (7 threads) started to show hangs while all other instances never showed this kind of problem. Attaching strace to the python process shows that all threads are calling futex FUTEX_WAIT_PRIVATE, so they ar...
Python hangs in futex calls
0.197375
0
0
7,410
3,905,883
2010-10-11T11:48:00.000
4
1
0
0
python,multithreading,debugging,deadlock,futex
3,913,056
2
true
1
0
The observation was slightly incorrect. One thread wasn't calling futex, but instead swapping while holding the gil. Since the machine in question is low hardware this swapping took very long and seemed to be a deadlock. The underlying problem is a memory leak. :-(
2
2
0
I have a Python daemon running in production. It employs between 7 and 120 threads. Recently the smallest instance (7 threads) started to show hangs while all other instances never showed this kind of problem. Attaching strace to the python process shows that all threads are calling futex FUTEX_WAIT_PRIVATE, so they ar...
Python hangs in futex calls
1.2
0
0
7,410
3,906,903
2010-10-11T14:00:00.000
9
0
1
0
python,networking,character,bits
3,906,938
3
false
0
0
\r is a carriage return (0x0d), the t is a t.
1
0
0
maybe this is a noob question, but I'm receiving some data over TCP and when I look at the string I get the following: \x00\r\xeb\x00\x00\x00\x00\x01t\x00 What is that \r character, and what does the t in \x01t mean? I've tried Googling, but I'm not sure what to Google for... thanks.
Non-binary(hex) characters in string received over TCP with Python
1
0
1
819
3,908,062
2010-10-11T16:23:00.000
3
0
0
0
python,user-interface,google-app-engine,ironpython
3,908,074
1
false
1
1
Google's Google App Engine can only run pure python code, and not even all Python is supported. No, you can't do things like IronPython. If you want to use Python, I'd learn Django. If you want something closer to .NET, I'd go with Java.
1
3
0
I'm developing a simple Python program with a (dynamic) form interface, but it needs to run on Google App Engine. I understand that IronPython lets one use Visual Studio's drag-and-drop interface builder and classes while programming with Python, but will this be compatible with Google App Engine?
Can I use IronPython to develop GUIs for Google App Engine?
0.53705
0
0
651
3,910,223
2010-10-11T21:53:00.000
2
0
0
0
python,trusted-vs-untrusted
3,910,435
7
false
0
0
It's impossible to provide an absolute solution for this because the definition of 'bad' is pretty hard to nail down. Is opening and writing to a file bad or good? What if that file is /dev/ram? You can profile signatures of behavior, or you can try to block anything that might be bad, but you'll never win. Javascript ...
4
8
0
Let's say there is a server on the internet that one can send a piece of code to for evaluation. At some point server takes all code that has been submitted, and starts running and evaluating it. However, at some point it will definitely bump into "os.system('rm -rf *')" sent by some evil programmer. Apart from "rm -rf...
sandbox to execute possibly unfriendly python code
0.057081
0
1
5,900
3,910,223
2010-10-11T21:53:00.000
0
0
0
0
python,trusted-vs-untrusted
3,910,850
7
false
0
0
I think a fix like this is going to be really hard and it reminds me of a lecture I attended about the benefits of programming in a virtual environment. If you're doing it virtually its cool if they bugger it. It wont solve a while True: pass but rm -rf / won't matter.
4
8
0
Let's say there is a server on the internet that one can send a piece of code to for evaluation. At some point server takes all code that has been submitted, and starts running and evaluating it. However, at some point it will definitely bump into "os.system('rm -rf *')" sent by some evil programmer. Apart from "rm -rf...
sandbox to execute possibly unfriendly python code
0
0
1
5,900
3,910,223
2010-10-11T21:53:00.000
2
0
0
0
python,trusted-vs-untrusted
3,910,730
7
false
0
0
I would seriously consider virtualizing the environment to run this stuff, so that exploits in whatever mechanism you implement can be firewalled one more time by the configuration of the virtual machine. Number of users and what kind of code you expect to test/run would have considerable influence on choices btw. If t...
4
8
0
Let's say there is a server on the internet that one can send a piece of code to for evaluation. At some point server takes all code that has been submitted, and starts running and evaluating it. However, at some point it will definitely bump into "os.system('rm -rf *')" sent by some evil programmer. Apart from "rm -rf...
sandbox to execute possibly unfriendly python code
0.057081
0
1
5,900
3,910,223
2010-10-11T21:53:00.000
0
0
0
0
python,trusted-vs-untrusted
3,910,895
7
false
0
0
Unless I'm mistaken (and I very well might be), this is much of the reason behind the way Google changed Python for the App Engine. You run Python code on their server, but they've removed the ability to write to files. All data is saved in the "nosql" database. It's not a direct answer to your question, but an exa...
4
8
0
Let's say there is a server on the internet that one can send a piece of code to for evaluation. At some point server takes all code that has been submitted, and starts running and evaluating it. However, at some point it will definitely bump into "os.system('rm -rf *')" sent by some evil programmer. Apart from "rm -rf...
sandbox to execute possibly unfriendly python code
0
0
1
5,900
3,911,319
2010-10-12T02:41:00.000
2
0
1
0
python,list,formatting
3,911,330
4
false
0
0
Step 1. Convert the list to a dictionary. Each element is a list of values with a common key. (Hint: The key is the first value of each pair) Step 2. Now format each dictionary as key, space, value list.
1
1
0
I've got a list like [(1, 2), (1, 8), (2, 3), (2, 7), (2, 8), (2, 9), (3, 1), (3, 2), (3, 5), (3, 6), (3, 7), (3, 7), (3, 9)] I want to make it looks like [('1',' ', '2', '8'), ('2', ' ', '3', '7', '8', '9'), ('3', " ", '2', '5', '6', '7', '7', '9')] How can I code this loop? Really tried times, and nothing came up. Pl...
Python, format this list
0.099668
0
0
1,143
3,911,494
2010-10-12T03:31:00.000
0
0
1
1
python,google-app-engine,dictionary,python-2.5
3,911,537
3
false
0
0
you can sort a dict.items() list (of tuples) .. can't?
2
1
0
I'm new to Python, and using Google App Engine, which is currently running only Python 2.5. Are there any built-in ways of doing an ordered dictionary, or do I have to implement something custom?
Possible to do ordered dictionary in python 2.5 (due to GAE)?
0
0
0
673
3,911,494
2010-10-12T03:31:00.000
0
0
1
1
python,google-app-engine,dictionary,python-2.5
3,912,743
3
false
0
0
OrderedDict is new in 2.7, so no, there's no built-in way to do this - you'll have to implement your own. Usually, an ordered dictionary is implemented as a dictionary of linked list nodes, linked in traversal order. This should be fairly straightforward to implement yourself.
2
1
0
I'm new to Python, and using Google App Engine, which is currently running only Python 2.5. Are there any built-in ways of doing an ordered dictionary, or do I have to implement something custom?
Possible to do ordered dictionary in python 2.5 (due to GAE)?
0
0
0
673
3,911,519
2010-10-12T03:38:00.000
3
0
1
0
python,string-concatenation
3,911,527
1
false
0
0
Homework? Did you submit the result of the expression, or the expression itself? ",".join([name1, name2, name3]) Or whatever you used? Edit: You mention that you submitted ("name1", "name2", "name3") - which would not return the concatenated names - but rather those stings. If you wanted to do it like this (a little l...
1
1
0
The question i'm working on asks me to "write an expression whose value is the concatenation of the three str values associated with name1 , name2 , and name3" , separated by commas." "So if name1 , name2 , and name3 , were (respectively) "Neville", "Dean", and "Seamus", your expression's value would be "Neville...
What have i done wrong? (python help)
0.53705
0
0
2,802
3,911,897
2010-10-12T05:26:00.000
1
1
1
0
python,multithreading,multiprocessing,concurrency
3,913,601
8
false
0
0
Take the hint. CPU intensive programs can also be made into multiple processes. Multiple processes and a pipeline to pass status around can often have outstanding performance. Rather than fish around randomly for other languages, do this. Decompose the problem into a pipeline of steps that can be done concurrently. ...
2
3
0
I now primarily write in python, however I am looking for a language that is more thread friendly (not JAVA,C#,C or C++). Python's threads are good when they are IO bound but it's coming up short when I am doing something CPU intensive. Any ideas? Thanks, James
"Pythonic" multithreaded (Concurrent) language
0.024995
0
0
457
3,911,897
2010-10-12T05:26:00.000
1
1
1
0
python,multithreading,multiprocessing,concurrency
3,911,913
8
false
0
0
to overcome GIL, you can try interpreting python language with jython instead of cpython
2
3
0
I now primarily write in python, however I am looking for a language that is more thread friendly (not JAVA,C#,C or C++). Python's threads are good when they are IO bound but it's coming up short when I am doing something CPU intensive. Any ideas? Thanks, James
"Pythonic" multithreaded (Concurrent) language
0.024995
0
0
457
3,912,579
2010-10-12T07:53:00.000
2
0
0
0
python,django,installation
3,912,677
1
true
1
0
It is very likely that the py extension is linked with the editor rather than the Python interpreter. Right-click on a py file and click "Open with" then select the default program and choose 'C:...\Python2x\python.exe' That should fix the pb
1
1
0
I've got an issue when installing Django. The official guide says open cmd with administrator privileges and run "setup.py install" I did this but then the system default python editor came out, I don't know how to do anymore, please help me~
Issue happens when installing Django on Windows 7
1.2
0
0
494
3,912,910
2010-10-12T08:49:00.000
1
0
0
0
python,urllib,urlopen
3,912,922
1
true
0
0
It's an optional header, so no. See if it exists, and if not then fall back to checking the URL.
1
1
0
I'm using urllib.urlopen to read a file from a URL. What is the best way to get the filename? Do servers always return the Content-Disposition header? Thanks.
Get filename when using urllib.urlopen
1.2
0
1
575
3,913,217
2010-10-12T09:30:00.000
-1
1
1
0
python,programming-languages,namespaces
3,913,281
6
false
0
0
If you make a big program with someone else, you could write your own part of the program as you want. All variables in the file will be private, there will be no collisions. When you write PHP programs, it is easy to rewrite global variables by mistake. In python you can import other modules variables if you want, and...
2
47
0
I have just started learning Python & have come across "namespaces" concept in Python. While I got the jist of what it is, but am unable to appreciate the gravity of this concept. Some browsing on the net revealed that one of the reasons going against PHP is that it has no native support for namespaces. Could someone ...
What are Python namespaces all about
-0.033321
0
0
29,735
3,913,217
2010-10-12T09:30:00.000
49
1
1
0
python,programming-languages,namespaces
3,913,488
6
true
0
0
Namespace is a way to implement scope. In Java (or C) the compiler determines where a variable is visible through static scope analysis. In C, scope is either the body of a function or it's global or it's external. The compiler reasons this out for you and resolves each variable name based on scope rules. External...
2
47
0
I have just started learning Python & have come across "namespaces" concept in Python. While I got the jist of what it is, but am unable to appreciate the gravity of this concept. Some browsing on the net revealed that one of the reasons going against PHP is that it has no native support for namespaces. Could someone ...
What are Python namespaces all about
1.2
0
0
29,735
3,914,289
2010-10-12T11:47:00.000
0
1
1
0
python,module,packaging,pythonpath
3,914,361
3
false
0
0
You could set the PYTHONPATH as a global environment variable pointing to your Production code, and then in any shell in which you want to use the Development code, change the PYTHONPATH to point to that code. (Is that too simplistic? Have I missed something?)
1
2
0
I'm developing a Python utility module to help with file downloads, archives, etc. I have a project set up in a virtual environment along with my unit tests. When I want to use this module on the same computer (essentially as "Production"), I move the files to the mymodule directory in the ~/dev/modules/mymodule I keep...
Developing and using the same Python on the same computer
0
0
0
209
3,914,370
2010-10-12T11:56:00.000
0
0
0
0
python,pygtk
3,917,071
1
true
0
1
Checking gtk.gdk.screen_get_default() does it, however there seems no way to suppress the GTK warnings.
1
1
0
I have a pygtk application and would like to provide a text-based fallback mode for it. When mporting gtk without a X display available I see only a GtkWarning on stderr but no exception I could take advantage of and checking for DISPLAY seems like an ugly hack. How can I implement this?
Implementing a text-based fallback for pygtk applications
1.2
0
0
46
3,914,409
2010-10-12T12:01:00.000
2
0
1
0
python,windows,file
3,914,630
5
true
0
0
Notepad has no facilities for doing such from an external source. Short of hooking into the Windows windowing API, finding the text area, and populating it yourself.
2
1
0
I have a string called 's' and I want to open it in notepad at runtime without saving it in/as a file. Is there any way to achieve this in python?
open a string in notepad at runtime in python
1.2
0
0
2,872
3,914,409
2010-10-12T12:01:00.000
0
0
1
0
python,windows,file
3,914,473
5
false
0
0
No. Notepad does not read data from stdin, so passing it a file or OS-level file-like is the only way for it to display text.
2
1
0
I have a string called 's' and I want to open it in notepad at runtime without saving it in/as a file. Is there any way to achieve this in python?
open a string in notepad at runtime in python
0
0
0
2,872
3,914,725
2010-10-12T12:35:00.000
5
0
1
0
python,number-formatting
3,914,765
8
false
0
0
x = round(293.4662543, 2)
1
32
0
How to shorten the float result I got? I only need 2 digits after the dot. Sorry I really don't know how to explain this better in English... Thanks
How to turn a float number like 293.4662543 into 293.47 in python?
0.124353
0
0
103,306