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
7,376,479
2011-09-11T05:30:00.000
9
0
0
0
python,pygame
9,288,321
2
false
0
1
Depends on what you mean. If you mean making multiple windows at the same time, no, you can't do that--it's a limitation of SDL (although you CAN fake it by using multiprocessing (not multithreading)). If you mean changing one screen around, yes, you can do that, with multiple calls to pygame.display.set_mode(...). Yo...
2
2
0
Is there any way way to create multiple screens in Pygame without redrawing to the screen every time. For example, if we want to create a splash screen, then a main menu with buttons. On clicking the 'Start Game' button, it would go to a new screen which is the actual game. What I mean is anything similar to the 'Form'...
Creating multiple screens in pygame
1
0
0
6,820
7,377,983
2011-09-11T11:48:00.000
2
1
0
0
python,console,midi,adventure
7,538,486
4
false
0
0
As @Jakob Bowyer noted, pygame is really the way to go. I just wanted to add that if you are concerned about pygame because of its size, then you can selectively enable which modules you want at runtime. In this case, just using the MIDI playback features of pygame won't consume too much system resources.
2
3
0
I'm making a simple text adventure with Python and thought that background MIDI music would make it a little less boring. Is there a simple, light-weight, MIDI player / API for Python? Or do I need to use a full game library like Pygame? (Because if so, I'd rather pass, as I want to make it as lightweight as possible.)
Light-weight MIDI playback for a Text Adventure?
0.099668
0
0
392
7,377,983
2011-09-11T11:48:00.000
4
1
0
0
python,console,midi,adventure
7,378,115
4
false
0
0
Yes, you will be wanting pygame for this. It's a nice idea to keep something light, but on the other hand, why re-invent the wheel? If someone has already written the code for you to play .midi files, then use their code! The only other option I can think of is searching for a MIDI playing library for Python (I can't f...
2
3
0
I'm making a simple text adventure with Python and thought that background MIDI music would make it a little less boring. Is there a simple, light-weight, MIDI player / API for Python? Or do I need to use a full game library like Pygame? (Because if so, I'd rather pass, as I want to make it as lightweight as possible.)
Light-weight MIDI playback for a Text Adventure?
0.197375
0
0
392
7,378,398
2011-09-11T13:11:00.000
1
0
0
0
python,django
7,378,820
4
false
1
0
I would also browse the documentation for Paste and read a bit from Ian Bicking.. He lays out the conceptual blocks so to speak, quite well and has bloggedthe lessons learned as it was developed. Web2py doco also but yes as UKU said: WSGI is a modern requirement.
1
14
0
I'm just wondering what knowledge or techniques are needed to make a web framework like django. so the webframework is able to serve as a cloud computing (a website can be scaled horizontally by sending some stuffs that must be solved to other server.) when needed, and can be used to build a website fast like django i...
how to make web framework based on Python like django?
0.049958
0
0
12,556
7,379,439
2011-09-06T09:50:00.000
1
1
0
0
macos,audio,python
8,441,627
1
false
1
0
A couple shots in the dark - Verify if you're opening the device correctly - looks like the Fireface can be both half or full duplex (pref pane configurable?), and pyaudio apparently cares (i.e. you can't specify an output if you specify an input or vise versa.) Another thing to check out is the audio routing - under /...
1
3
0
Using Python and PyAudio, I can't seem to record sound to a wav file from an external audio interface (RME Fireface), but i am able to do so with the in built mic on my iMac. I set the default device to Fireface in System preferences, and when i run the code, the wav file is created but no sound comes out when i play i...
Pyaudio for external interfaces (Mac OSX)
0.197375
0
0
629
7,380,328
2011-09-11T18:22:00.000
3
0
0
0
python,pydoc
7,380,925
2
false
0
0
pydoc -w ... Write out the HTML documentation for a module to a file in the current directory. If contains a '/', it is treated as a filename; if it names a directory, documentation is written for all the contents.
1
6
0
PyDoc creates HTML documentation in current directory when generating documentation of modules. I really need to specify another directory which will be a placeholder for generated documentation instead the directory from which PyDoc is called. I am using python -m pydoc -w <MODULES_DIR> to generate documentation. Is t...
How to tell PyDoc to generate documentation to user defined directory
0.291313
0
0
12,236
7,381,258
2011-09-11T21:08:00.000
2
0
0
0
python,memory,io
7,381,424
11
false
0
0
Two ideas: Use numpy arrays to represent vectors. They are much more memory-efficient, at the cost that they will force elements of the vector to be of the same type (all ints or all doubles...). Do multiple passes, each with a different set of vectors. That is, choose first 1M vectors and do only the calculations inv...
4
17
1
Background I am working on a fairly computationally intensive project for a computational linguistics project, but the problem I have is quite general and hence I expect that a solution would be interesting to others as well. Requirements The key aspect of this particular program I must write is that it must: Read th...
Minimising reading from and writing to disk in Python for a memory-heavy operation
0.036348
0
0
3,167
7,381,258
2011-09-11T21:08:00.000
1
0
0
0
python,memory,io
7,381,462
11
false
0
0
Use a database. That problem seems large enough that language choice (Python, Perl, Java, etc) won't make a difference. If each dimension of the vector is a column in the table, adding some indexes is probably a good idea. In any case this is a lot of data and won't process terribly quickly.
4
17
1
Background I am working on a fairly computationally intensive project for a computational linguistics project, but the problem I have is quite general and hence I expect that a solution would be interesting to others as well. Requirements The key aspect of this particular program I must write is that it must: Read th...
Minimising reading from and writing to disk in Python for a memory-heavy operation
0.01818
0
0
3,167
7,381,258
2011-09-11T21:08:00.000
0
0
0
0
python,memory,io
7,433,853
11
false
0
0
Split the corpus evenly in size between parallel jobs (one per core) - process in parallel, ignoring any incomplete line (or if you cannot tell if it is incomplete, ignore the first and last line of that each job processes). That's the map part. Use one job to merge the 20+ sets of vectors from each of the earlier jobs...
4
17
1
Background I am working on a fairly computationally intensive project for a computational linguistics project, but the problem I have is quite general and hence I expect that a solution would be interesting to others as well. Requirements The key aspect of this particular program I must write is that it must: Read th...
Minimising reading from and writing to disk in Python for a memory-heavy operation
0
0
0
3,167
7,381,258
2011-09-11T21:08:00.000
0
0
0
0
python,memory,io
7,381,527
11
false
0
0
From another comment I infer that your corpus fits into the memory, and you have some cores to throw at the problem, so I would try this: Find a method to have your corpus in memory. This might be a sort of ram disk with file system, or a database. No idea, which one is best for you. Have a smallish shell script moni...
4
17
1
Background I am working on a fairly computationally intensive project for a computational linguistics project, but the problem I have is quite general and hence I expect that a solution would be interesting to others as well. Requirements The key aspect of this particular program I must write is that it must: Read th...
Minimising reading from and writing to disk in Python for a memory-heavy operation
0
0
0
3,167
7,383,464
2011-09-12T04:59:00.000
1
0
1
1
python,file-io
7,383,480
2
true
0
0
On CPython, it will always return the number of bytes requested, unless EOF is reached.
2
2
0
Does the Python read() method behave like C's read? Might it return less than the requested number of bytes before the last chunk of the file is reached? Or does it guarantee to always return the full amount of bytes when those bytes exist to be read?
Does Python's read() always return requested size except at EOF?
1.2
0
0
974
7,383,464
2011-09-12T04:59:00.000
3
0
1
1
python,file-io
7,384,163
2
false
0
0
Well, the Python Standard library says this about file.read([size]): Read at most size bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. ... An empty string is returned when EOF is encountered immediately. ... Al...
2
2
0
Does the Python read() method behave like C's read? Might it return less than the requested number of bytes before the last chunk of the file is reached? Or does it guarantee to always return the full amount of bytes when those bytes exist to be read?
Does Python's read() always return requested size except at EOF?
0.291313
0
0
974
7,384,150
2011-09-12T06:41:00.000
0
1
1
0
python,pylons,pyramid
7,384,274
3
false
0
0
Take a look at http://docs.python.org/dev/whatsnew/2.7.html You'll find what all you'll ever need to know.
1
2
0
What problems can I have if I will use python 2.7 instead python 2.6 for my pylons/pyramid projects? Before I use python 2.6 on my ubuntu 10.04 but now I have ubuntu 11.04 on my laptop with python 2.7.
python 2.6 vs 2.7, for pylons/pyramid projects
0
0
0
3,369
7,385,037
2011-09-12T08:18:00.000
0
0
1
0
python,class,logging
7,389,220
5
false
0
0
I personally just tend to name my loggers after classes, as it makes it much easier to track down where a particular message came from. So you can have a root logger named "top", and for the module "a" and class "testclass", I name my logger "top.a.testclass". I don't see the need to otherwise retrieve the classname, ...
1
24
0
If I want the function name I can simply include %(funcName)s in the Formatter. But how do I get the name of the class containing the logging call instead? I've gone through the documentation for logging, but I can't find any mentioning of it.
How do I get the name of the class containing a logging call in Python?
0
0
0
30,677
7,387,190
2011-09-12T11:31:00.000
0
0
0
0
python,http,connect
7,387,467
2
false
0
0
I assume that you have multiple network connections on the same computer (i.e. a wired and wireless connection) and you want to make sure that your connect goes over a specific interface. In general you cannot do this. How your traffic is sent to a specific ip address, and therefore what source ip address it shows, is ...
2
0
0
conn=httlib.HTTPConnection(self.proxy) Self.proxy has destination ip and port. I want to do multiple connection from multiple IP addresses to destination How to specify the source IP while connect request.Please help me out. Thanks in Advance.
Http connect request from multiple IP address to destination in python
0
0
1
2,170
7,387,190
2011-09-12T11:31:00.000
0
0
0
0
python,http,connect
7,399,178
2
false
0
0
I got the solution but not 100% Requirement: Has to send request from 10 Ip address to one destination. Achieved the same through the following API class httplib.HTTPConnection(host[, port[, strict[, timeout[, source_address]]]]) here, we can mention the last parameter source IP Like, httlib.HTTPConnection(dest_ip, d...
2
0
0
conn=httlib.HTTPConnection(self.proxy) Self.proxy has destination ip and port. I want to do multiple connection from multiple IP addresses to destination How to specify the source IP while connect request.Please help me out. Thanks in Advance.
Http connect request from multiple IP address to destination in python
0
0
1
2,170
7,387,453
2011-09-12T11:58:00.000
0
0
1
0
python,windows
7,387,968
3
false
0
0
Does a simple rm -rf * in the site-packages directory do what you want, or do you want to leave some packages untouched?
1
5
0
Is there a way to "reset" C:\Python26\Lib\site-packages? i.e. to remove all packages and modules installed either by setup.py install or using easy_install? Motivation: something went wrong with all the package versions and dependencies and I rather reset and reinstall everything than spend the time in figuring out wha...
How to reset site-packages
0
0
0
13,912
7,389,388
2011-09-12T14:22:00.000
0
0
1
0
python,pylons,ipython
7,391,420
6
false
0
0
Ipython updated to version .11 just recently. Some of the components no longer work correctly, especially with 3rd party libraries. Check the mailing lists for pylons, and you may want to consider a bug report.
2
2
0
I install ipython, and then i run ./paster shell dev.ini command, paster open standard python console. How can I make it run ipython?
Pylons paster shell does not run in ipython
0
0
0
1,287
7,389,388
2011-09-12T14:22:00.000
1
0
1
0
python,pylons,ipython
7,402,948
6
true
0
0
I solved this problem downgrading ipython to version 0.10
2
2
0
I install ipython, and then i run ./paster shell dev.ini command, paster open standard python console. How can I make it run ipython?
Pylons paster shell does not run in ipython
1.2
0
0
1,287
7,389,417
2011-09-12T14:25:00.000
0
0
0
0
python,user-interface,wxpython,wxwidgets
7,389,557
1
false
0
1
I susggest that you create three panels, side by side. When one of the panels is resized by the user, you will have to adjust the size of the other panels to compensate - so that there are no gaps or overlaps. You can do this by handling the resize event, probably in the parent windows of the three panels. Another wa...
1
0
0
I'm trying to figure out how i can have a 3 column layout where the (smaller) left and right columns are resizable with a draggable separator on each side of the center/main area. I've tried using splitwindow but that seems to only split in two parts. Hope someone can give me pointers on how it can be done.
WxWidget/WxPython; 3 column resizable layout
0
0
0
383
7,390,016
2011-09-12T15:08:00.000
2
0
1
0
python
7,390,053
4
false
0
0
Don't you have readline enabled? You can look through your interpreter history to find what you want. I think it's easier than digging through globals() or dir().
2
3
0
I work in a python shell and some weeks ago I have defined a variable which refers to a very important list. The shell stays always open, but I have forgotten this name. How to get a list of all global names I have ever defined?
Python - how to get a list of all global names I have ever defined?
0.099668
0
0
1,597
7,390,016
2011-09-12T15:08:00.000
2
0
1
0
python
7,390,036
4
false
0
0
You can examine globals(), which shows all the module-level variables, or locals(), which is the local scope. In the prompt, these are the same. Also, vars() shows all the names available to you, no matter where you are.
2
3
0
I work in a python shell and some weeks ago I have defined a variable which refers to a very important list. The shell stays always open, but I have forgotten this name. How to get a list of all global names I have ever defined?
Python - how to get a list of all global names I have ever defined?
0.099668
0
0
1,597
7,391,148
2011-09-12T16:40:00.000
0
0
0
0
python,xml,sanitization
7,392,402
2
false
0
0
Unless this data has already been sanitised against the PAF (UK Post office Address file - every address in UK basically) then you will have addresses in there that are the same actual house, but spelt differently, wrong postcode, postcode in wrong field etc. This will completely change your approach. Check out if thi...
1
0
0
I have a large amount of data that I am pulling from an xml file that all needs to be validated against each other (in excess of 500,000 records). It is location data, so it has information such as: county, street prefix, street suffix, street name, starting house number, ending number. There are duplicates, house numb...
Large temporary database to sanitize data in Python
0
1
0
1,110
7,391,427
2011-09-12T17:10:00.000
4
0
0
0
python,multithreading,parallel-processing,machine-learning,scikit-learn
20,999,120
2
false
0
0
Some sklearn Cython classes do release the GIL internally on performance critical sections, for instance the decision trees (used in random forests for instance) as of 0.15 (to be released early 2014) and the libsvm wrappers do. This is not the general rule though. If you identify performance critical cython code in sk...
1
5
1
I would like to train multiple one class SVMs in different threads. Does anybody know if scikit's SVM releases the GIL? I did not find any answers online. Thanks
Does Scikit-learn release the python GIL?
0.379949
0
0
1,679
7,392,172
2011-09-12T18:24:00.000
4
0
1
0
python,pip,distribute,automatic-updates
7,394,324
4
false
0
0
If pip install already works for you, why can't you just do os.system("pip install -U myscript") at script startup? This is kinda dirty, but so is distributing via pip for non-developers.
3
11
0
TL;DR I need a module which will automatically update my script in the background, silently. I'm have a Python script which I distribute to users. I frequently update this, and then ask them to update it (via PIP). Obviously, this isn't a high priority for users, who just want to use the app, not think about updating i...
automatically update python script
0.197375
0
0
4,198
7,392,172
2011-09-12T18:24:00.000
0
0
1
0
python,pip,distribute,automatic-updates
71,777,430
4
false
0
0
Another easy way is to update the script using cronjobs. For example, you want to update the module once a week on Sunday. So for this purpose, write the following command in the terminal crontab -e Then write the following line at the end of this file. 00 00 * * SUN python3 -m pip install <module_name> The above l...
3
11
0
TL;DR I need a module which will automatically update my script in the background, silently. I'm have a Python script which I distribute to users. I frequently update this, and then ask them to update it (via PIP). Obviously, this isn't a high priority for users, who just want to use the app, not think about updating i...
automatically update python script
0
0
0
4,198
7,392,172
2011-09-12T18:24:00.000
1
0
1
0
python,pip,distribute,automatic-updates
7,392,316
4
false
0
0
The easiest way to do this is to set up a web service which the script pings when it is run. The web service can return a version number, which the script can check against its own version number. If the version number is higher, it can update itself and re-run.
3
11
0
TL;DR I need a module which will automatically update my script in the background, silently. I'm have a Python script which I distribute to users. I frequently update this, and then ask them to update it (via PIP). Obviously, this isn't a high priority for users, who just want to use the app, not think about updating i...
automatically update python script
0.049958
0
0
4,198
7,392,676
2011-09-12T19:05:00.000
0
1
0
0
c#,python,web-services,rpc
7,392,759
1
false
0
0
As John wrote, you're quite late if it's urgent and your description is quite vague. There are 1001 RPC techniques and the choice depends on details. But taking into account that you seem just to exchange some xml data, you probably don't need a full RPC implementation. You can write a HTTP server in python with just a...
1
0
0
I am basically new to this kind of work.I am programming my application in C# in VS2010.I have a crystal report that is working fine and it basically gets populated with some xml data. That XMl data is coming from other application that is written in Python on another machine. That Python script generates some data an...
Remote procedure call in C#
0
0
1
779
7,392,848
2011-09-12T19:20:00.000
2
0
1
0
python,linux
7,392,879
3
false
0
0
All you are doing is making a system call to a file in a temp directory. When the system call returns, read the file.
1
2
0
For example, if you have ever used git, when you do a commit it will open vi to add or edit some text, and when you exit it is able to intercept this and use that text. What is this called so I can lookup some docs on it? Any other information, especially performing this using python, would be very helpful.
How do you use vi (or another editor) as part of another command to edit something and return it to that command?
0.132549
0
0
97
7,393,005
2011-09-12T19:36:00.000
2
0
1
0
python,compilation
7,393,082
2
false
0
1
You can emulate Apple OS and any other OS on VMWare.
1
0
0
I need to compile my application for both PC and Mac, but I don't have access to Mac in my area (very rare, mostly PC). My application written in Python with 2 C++ modules, I used pyInstaller for Python and MinGW for C++ in PC, but question is for Mac? What can I do? is there any OS emulator or something helpful out th...
How to compile executable for Mac, but from a PC?
0.197375
0
0
391
7,393,672
2011-09-12T20:34:00.000
1
1
0
0
c++,python,dll,shared-libraries
7,400,723
4
false
0
1
SWIG, Boost.Python, SIP, Shiboken, PyBindgen, ... SWIG and Boost.Python are most popular, i.e. they have the largest user base and the most active development teams. Which of these two to use is largely a matter of taste. So if you don't want to use Boost.Python, then SWIG is the obvious choice.
1
1
0
There is a library for Python that enables the calling ability (can call functions in C++ format without extern "C". Please, could you remind me the name of the library? I forgot it's name and can't find it. It's not Boost.Python. Thank you very much. Your answer will be rewarded.
Library for Python: How to call C++ functions from Python program?
0.049958
0
0
496
7,396,170
2011-09-13T02:26:00.000
1
0
0
0
python,django,web-applications
7,396,202
2
true
1
0
A website is usually a project. In that website, you may have multiple features (a blog, a wiki, etc.). Each of those features should be an application in the project.
1
2
0
I just finished doing the tutorial django app. I now want to build my own app. Should I just create a new app within the tutorial project folder or should I create a new project folder with a new app? I am unsure in which cases it makes sense to re-use a project and create multiple apps under that project vs. making ne...
In which cases can I reuse a django project for multiple applications?
1.2
0
0
95
7,396,803
2011-09-13T04:27:00.000
0
0
1
0
python,stack,depth-first-search
7,400,370
2
true
0
0
Whenever you pop a node from the stack, you need a way of retrieving the path that led to that node. One solution is push tuples of (node, path) on the stack instead of just node values. If path is a purely functional list like in Haskell, this is a good solution, but in Python it may not be as idiomatic. Also while th...
1
1
0
I'd like to use a stack and return a path, but I'm thinking it's not possible. A node must be called directly by its parent so that it can receive the path behind it, whereas when this node is pushed onto a stack, it loses the path so far. Using a stack would result in a node being evaluated in isolation, and I couldn...
Can a depth-first search using a stack return a path to the goal?
1.2
0
0
3,579
7,398,343
2011-09-13T07:34:00.000
0
1
0
0
python,automation,citrix,packet-injection
10,010,649
1
false
0
0
after a lot of research, it cant be done. some manipulation like change window focus with the ICA COM object.
1
0
0
most of my job is on a citrix ICA app. i work in a winsows enviroment. among other things, i have to print 300 reports from my app weekly. i am trying to automate this task. i was using a screenshot automation tool called sikuli, but it is not portable form station to station. i thought i might be able to inject packe...
citrix GUI automation or packet injection?
0
0
1
978
7,399,965
2011-09-13T09:58:00.000
6
0
0
1
python,performance,google-app-engine
7,400,621
1
true
1
0
If they are just few kbytes I would load them on the instance memory; amongst the storage choices (Memcache, Datastore, Blobstore and so on) on Google App Engine , instance memory option shoud be the fastest.
1
5
0
I have a couple of smaller asset files (text templates typically 100 - a few K bytes) in my app that I'm considering caching using memcached. But does anyone here know if loading a local file or requesting it from memcache is the fastest/most resource efficient? (I'll be using the Python version of App Engine)
Fastest/most efficient in App Engine, local file read or memcache hit?
1.2
0
0
478
7,400,099
2011-09-13T10:08:00.000
1
1
0
1
python,rpm,distutils
7,531,272
1
false
0
0
If your software does not contain extension modules (modules written in C/C++), distutils will make the RPM noarch. I don’t think there’s a way to explicitly control it.
1
0
0
I am creating rpm's for my project which is in pure python. I am running the command python setup.py bdist_rpm to build the rpm. This is creating architechture specific rpm's (x86 or x86-64). What I would like is to have a no-arch rpm. Can any of python guru's help me with creating a no-arch rpm. Any help would be ap...
Python command to create no-arch rpm's
0.197375
0
0
116
7,400,156
2011-09-13T10:12:00.000
1
0
0
0
python,django,django-flatpages
7,405,517
1
true
1
0
When debug is set to False django renders the 500.html template instead of the debug stack-trace thing. It might be that on a http 404 (not found) exception it tries to render the 404.html template and if it's not found than tries with the 500.html (internal error). It is not a problem in itself but just a configuratio...
1
0
0
I can see that django looks for 500.html when DEBUG is False. What could be the problem?
django flatpages works with DEBUG=True, doesn't work with DEBUG=False
1.2
0
0
474
7,400,601
2011-09-13T10:47:00.000
2
0
0
0
python,cherrypy
7,401,164
3
true
1
0
Add 'Content-Disposition: attachment; filename="<file>"' header to response
1
1
0
I'm trying to use CherryPy for a simple website, having never done Python web programming before. I'm stuck trying to allow the download of a file that is dynamically created. I can create a file and return it from the handler, or call serve_fileobj() on the file, but in either case the contents of the file are simply ...
How to allow dynamically created file to be downloaded in CherryPy?
1.2
0
1
1,404
7,402,516
2011-09-13T13:17:00.000
5
0
0
0
python,tkinter,bind,case-sensitive
7,403,049
2
true
0
1
Yes, you have to make two bindings.
1
4
0
I've noticed that when you bind keys in tkinter (python3.2 winxp), the binds are case sensitive with the letter characters. In other words binding <Control-o> does not work if you press Control+o if caps lock is active. Does it mean I need to write two bindings for each case insensitive key combination with letter char...
tkinter case insensitive bind
1.2
0
0
1,371
7,402,597
2011-09-13T13:22:00.000
0
0
1
0
python,text,file-io
7,402,632
3
false
0
0
You will want to open the file then fileobj.seek(beginPos) and then fileobj.read(endPos-beginPos)
1
3
0
I have a huge text file from which i want to selectively read a few lines. Using tell() i know the positions i want to read between. Is there a way i can read all the text in the file between the two positions? like file.read(beginPos, endPos) or maybe, read all text between line number containing beginPos and line num...
Read a text file between user given starting and ending position in python
0
0
0
2,566
7,403,585
2011-09-13T14:32:00.000
0
0
0
1
python,design-patterns,rabbitmq,amqp,pika
10,063,487
3
false
0
0
Your setup sounds good to me. And you are right, you can simply set the callback to start a thread and chain that to a separate callback when the thread finishes to queue the response back over Channel B. Basically, your consumers should have a queue of their own (size of N, amount of parallelism they support). When a ...
2
9
0
The producer module of my application is run by users who want to submit work to be done on a small cluster. It sends the subscriptions in JSON form through the RabbitMQ message broker. I have tried several strategies, and the best so far is the following, which is still not fully working: Each cluster machine runs a c...
What's the best pattern to design an asynchronous RPC application using Python, Pika and AMQP?
0
0
0
5,996
7,403,585
2011-09-13T14:32:00.000
0
0
0
1
python,design-patterns,rabbitmq,amqp,pika
15,245,534
3
false
0
0
Being unexperienced in threading, my setup would run multiple consumer processes (the number of which basically being your prefetch count). Each would connect to the two queues and they would process jobs happily, unknowning of eachother's existence.
2
9
0
The producer module of my application is run by users who want to submit work to be done on a small cluster. It sends the subscriptions in JSON form through the RabbitMQ message broker. I have tried several strategies, and the best so far is the following, which is still not fully working: Each cluster machine runs a c...
What's the best pattern to design an asynchronous RPC application using Python, Pika and AMQP?
0
0
0
5,996
7,403,836
2011-09-13T14:48:00.000
1
0
0
0
python,django,django-templates
7,403,926
1
true
1
0
The best way that does is casting the number to a string before I send it to the template, which works perfectly every time. I'd like to know if there's a better way to do it. Nope.
1
0
0
I've got an issue with the Django template localisation. In the German locale, it forces decimals to use a comma as the separator, which is fine for display. However I also need to modify some JS tracking to send a price to the reporting engine. Django is also localising that value (It's inline with the HTML, bad I kno...
Force Django to use a period for specific decimals
1.2
0
0
123
7,406,102
2011-09-13T17:40:00.000
0
0
1
0
python,cocoa,filenames,pyobjc
71,761,675
13
false
0
0
Extra note for all other answers Add hash of original string to the end of filename. It will prevent conflicts in case your conversion makes same filename from different strings.
1
64
0
I want to create a sane/safe filename (i.e. somewhat readable, no "strange" characters, etc.) from some random Unicode string (which might contain just anything). (It doesn't matter for me whether the function is Cocoa, ObjC, Python, etc.) Of course, there might be infinite many characters which might be strange. Thus...
Create (sane/safe) filename from any (unsafe) string
0
0
0
48,106
7,408,089
2011-09-13T20:30:00.000
0
0
1
0
python,binary
7,408,259
4
false
0
0
Use open with 'rb' as flags. That would read the file in binary mode
1
0
0
I seem to be able to find information on how to do this in C#, but not on how to perform the same operation in Python. Any advice or suggestions would be appreciated. Thank you very much.
In Python, how do I convert a .exe file to a string of 1s and 0s?
0
0
0
1,453
7,409,666
2011-09-13T23:23:00.000
0
0
0
0
python,django
7,409,817
3
false
1
0
For example, Apache has mod_rewrite that you can use to rewrite URLs: RewriteCond %{HTTP_REFERER} ^www.domain1.com$ [NC] RewriteRule /static/[^/]+ /static/domain1/$1 [L] RewriteCond %{HTTP_REFERER} ^www.domain2.com$ [NC] RewriteRule /static/[^/]+ /static/domain2/$1 [L] (this is untested) other servers also have simil...
1
1
0
I'm writing a web application in Django that is accessed from multiple domains to the same IP address. The idea is that each domain the application is accessed from will receive unique branding. So for example, if there were two domains, reseller.com and oem.com, and you went to oem.com, it would take you to to the sam...
Dynamically serve static content based on server name in Django
0
0
0
417
7,410,458
2011-09-14T01:56:00.000
1
0
1
0
python,database,ms-access
7,410,499
2
true
0
0
Yes, you can talk to any ODBC database from Python, and that should include Access. You'll want the "windows" version of Python (which includes stuff like ODBC) from ActiveState. I'd be more worried about the "millions of rows" in Access, it can get a bit slow on retrieval if you're actually using it for relational t...
1
1
0
Well, I might be doing some work in Python that would end up with hundreds of thousands, maybe millions of rows of data, each with entries in maybe 50 or more columns. I want a way to keep track of this data and work with it. Since I also want to learn Microsoft Access, I suggest putting the data in there. Is there ...
Is it possible to store data from Python in Access file?
1.2
1
0
323
7,412,941
2011-09-14T07:51:00.000
0
0
1
0
python
7,414,084
3
false
0
0
It might be a good idea to use a cron job. you can edit the cron table with : crontab -e and add a line like this (called every 20 minutes) */20 * * * * /usr/bin/python /home/toto/my_script.py
3
0
0
What is a good way to call a function at datetime in Python? There 3 ways that I know of: "Are we there yet?!" (check at if date has passed at interval (time.sleep(interval))) This is obviously bad. It can only be precise if interval is low, which becomes inefficient. Sleep off the difference (time.sleep(timedelta.sec...
Calling a function at datetime in Python
0
0
0
199
7,412,941
2011-09-14T07:51:00.000
0
0
1
0
python
7,413,538
3
false
0
0
I use the gobject main loop, but any library with an event loop should have this ability.
3
0
0
What is a good way to call a function at datetime in Python? There 3 ways that I know of: "Are we there yet?!" (check at if date has passed at interval (time.sleep(interval))) This is obviously bad. It can only be precise if interval is low, which becomes inefficient. Sleep off the difference (time.sleep(timedelta.sec...
Calling a function at datetime in Python
0
0
0
199
7,412,941
2011-09-14T07:51:00.000
1
0
1
0
python
7,413,202
3
false
0
0
If this is something that might be six months out like you said, a chron job is probably more suitable than keeping a python program running the whole time.
3
0
0
What is a good way to call a function at datetime in Python? There 3 ways that I know of: "Are we there yet?!" (check at if date has passed at interval (time.sleep(interval))) This is obviously bad. It can only be precise if interval is low, which becomes inefficient. Sleep off the difference (time.sleep(timedelta.sec...
Calling a function at datetime in Python
0.066568
0
0
199
7,413,619
2011-09-14T08:49:00.000
0
0
0
0
python,mysql,geolocation,latitude-longitude
7,420,726
6
false
0
0
To be performant, you don't want to do a complete scan through the database and compute distances for each row, you want conditions that can be indexed. The simplest way to do this is to compute a box with a minimum/maximum latitude and minimum/maximum longitude, and use BETWEEN to exclude everything outside of those r...
1
3
0
I'm working on an application where a user can search for items near his location. When a user registers for my service, their long/lat coordinates are taken (this is actually grabbed from a zip/postcode and then gets looked up via Google for the long/lats). This also happens when a user adds an item, they are asked fo...
Find long/lat's within 20 miles of user's long/lat
0
1
0
4,012
7,417,518
2011-09-14T13:56:00.000
0
1
0
0
python,continuous-integration,buildbot
7,442,406
1
true
0
0
I'm find answer: inheritance from BuildStep and use self.build.allChanges() and for set property: self.setProperty()
1
1
0
I am using buildbot (system for CI) and have one problem. How can I send parameters of Change to all builders? I want to use the properties comments and who of Changes object. Thx
Buildbot properties from changes to all build
1.2
0
1
587
7,417,964
2011-09-14T14:24:00.000
0
0
0
0
python,turbogears,turbogears2
7,521,808
1
false
1
0
the more simple I know : jest get the diname of base of the project filename = os.path.join(os.path.dirname(myproject.__file__), 'public', 'xml', 'file.xml')
1
0
0
I have an XML file in /my_project/public/xml/file.xml, that I want to read and parse it in one method in controller. The file can be easily accessed through a template, but I have no experience with accessing files in controller.
How to access a static file in controller in turbogears
0
0
0
249
7,420,907
2011-09-14T18:06:00.000
2
0
0
0
python,session,extjs
7,421,372
2
false
0
0
You don't do "session management in Python". You do "session management in a framework, which may be implemented in Python". A session can be implemented in many ways, but normally is implemented via Cookies. For example, Django (a Python framework), writes a cookie with a value called session containing a given string...
1
0
0
I have created an application in python. And I am using extjs for the front-end. Once a valid user logs in, I want to use the username of the logged in user for further transactions. I wanted urgent help on how session management is to be done in python. Thanks in advance.
Performing session management in python
0.197375
0
0
1,687
7,421,082
2011-09-14T18:20:00.000
3
0
1
0
python,pyramid,paster
7,421,270
2
false
0
0
It is confusing at first but your code really doesn't need to be in your virtual environment directory at all. Actually it's better not to put your code inside your environment, as you might want to use different environments with the same code, for example to test your code with different versions of Python or differe...
1
0
0
I'm new to pyramid and paster, just reading the docs for now. I use virtualenv and inside the virtualenv dir I want to start a pyramid project. The problem is that I would like for paster to not create a dir with the project name, and instead put all the scaffold files on the current dir (the venv root). I thought abou...
How do I create a project without the project folder?
0.291313
0
0
286
7,421,351
2011-09-14T18:42:00.000
0
0
0
0
python
7,421,454
2
false
1
0
As getElementsByTagName returns a DOMElement list you could just simply concatenate the two lists. Alternatively XPath supports and/or operators, so you could use that. That would require using the elementTree or lxml modules instead.
1
0
0
I'm trying to parse a ODF-document with xml.dom.minidom. I would like to get all elements that are text:p OR text:h. Seems like there would be a way to add a wildcard in the getElementsByTagName method. Or is it? Is there a better way to parse a odf-document without uno?
Wildcards in getElementsByTagName (xml.dom.minidom)
0
0
1
897
7,422,099
2011-09-14T19:45:00.000
1
1
1
0
python,hex,byte,ascii
7,422,175
5
false
0
0
ord('A') returns the ASCII value as an integer (65 in the case of 'A'). You can think of an integer in any base you want. hex(ord('A')) gives you a nice string ("0x41" in this case), as does print "%x" % ord('A').
1
0
0
I want to generate a list of the hex values of all 256 byte-combinations. Basically, I want for example 'A' => '\x41'. I've only found modules capable of converting 'A' => '41', and this is not what I want. How am I to solve this problem? Does anybody know an appropriate module or algorithm (as I'd like to avoid hardco...
Generate a list of hex bytes in Python
0.039979
0
0
6,934
7,424,349
2011-09-14T23:54:00.000
2
0
0
1
python,http,tcp,network-programming,scapy
7,424,772
1
true
0
0
Unless your application is actually responding to and generating its own IP packets (which would be incredibly silly), you probably don't need to do testing at that layer. Simply testing at the TCP layer (e.g, connect(), send(), recv(), shutdown()) will probably be sufficient, as those events are the only ones which yo...
1
3
0
I'm working with mobile, so I expect network loss to be common. I'm doing payments, so each request matters. I would like to be able to test my server to see precisely how it will behave with client network loss at different points in the request cycle -- specifically between any given packet send/receive during the en...
How to test server behavior under network loss at every possible packet
1.2
0
1
435
7,424,590
2011-09-15T00:29:00.000
13
0
1
0
python,multithreading,concurrency,condition-variable
52,578,425
2
false
0
0
Another subtle difference is that Event's set() affects future calls of wait() (that is, subsequent calls of wait() will return True and won't block until clear() is called), whereas Condition's notify() (or notify_all()) doesn't (subsequent calls of wait() will block till next call of notify()).
2
59
0
I have yet to find a clear explanation of the differences between Condition and Event classes in the threading module. Is there a clear use case where one would be more helpful than the other? All the examples I can find use a producer-consumer model as an example, where queue.Queue would be the more straightforward ...
threading.Condition vs threading.Event
1
0
0
15,199
7,424,590
2011-09-15T00:29:00.000
84
0
1
0
python,multithreading,concurrency,condition-variable
7,424,818
2
true
0
0
Simply put, you use a Condition when threads are interested in waiting for something to become true, and once its true, to have exclusive access to some shared resource. Whereas you use an Event when threads are just interested in waiting for something to become true. In essence, Condition is an abstracted Event + Lock...
2
59
0
I have yet to find a clear explanation of the differences between Condition and Event classes in the threading module. Is there a clear use case where one would be more helpful than the other? All the examples I can find use a producer-consumer model as an example, where queue.Queue would be the more straightforward ...
threading.Condition vs threading.Event
1.2
0
0
15,199
7,426,564
2011-09-15T06:12:00.000
2
0
0
0
python,sql,orm,sqlalchemy
7,429,664
1
false
0
0
I don't think an ORM is the solution to your problem of performance. By default ORMs tend to be less efficient than row SQL because they might fetch data that you're not going to use (eg. doing a SELECT * when you need only one field), although SQLAlchemy allows fine-grained control over the SQL generated. Now to imple...
1
1
0
I have an application that needs to interface with another app's database. I have read access but not write. Currently I'm using sql statements via pyodbc to grab the rows and using python manipulate the data. Since I don't cache anything this can be quite costly. I'm thinking of using an ORM to solve my problem. The q...
How to interface with another database effectively using python
0.379949
1
0
122
7,426,677
2011-09-15T06:23:00.000
24
1
1
1
python,python-module
7,429,157
2
true
0
0
Most installation requires: sudo python setup.py install Otherwise, you won't be able to write to the installation directories. I'm pretty sure that (unless you were root), you got an error when you did python2.7 setup.py install
1
14
0
I just wrote a function on Python. Then, I wanted to make it module and install on my Ubuntu 11.04. Here is what I did. Created setup.py along with function.py file. Built distribution file using $Python2.7 setup.py sdist Then installed it $Python2.7 setup.py install All was going fine. But, later I wanted to use the...
How to install Python module on Ubuntu
1.2
0
0
44,972
7,428,741
2011-09-15T09:33:00.000
2
0
1
0
python,machine-learning
7,437,989
4
false
0
0
That's a pretty broad question. Among sparse coding, dictionary learning, and nonnegative factorization, there are plenty of methods, many of which are still so new that there does not yet exist a dominant piece of Python software that is universally accepted. These research areas have been my recent focus, and I prima...
1
5
0
I'm looking for a library which implements the most common sparse coding and dictionary learning algorithms with a python interface, any suggestion?
Sparse coding in Python
0.099668
0
0
6,779
7,432,317
2011-09-15T14:15:00.000
1
1
0
0
python,plone,portlet
7,435,407
2
false
1
0
Do the assignment to your portaltype live on a site via Sitesetup (controlpanel) -> Types -> "Manage portlets assigned to this content type". Then export the configuration via ZMI -> portal_setup -> Export-Tab -> select 'Portlets' -> click 'export' on bottom. Extract the types/YourType.xml-file and copy the relevant ...
1
5
0
I'm developing a content type for Plone 4, and I'd like to block all user, group, and context portlets it may inherit from its parent object. I'm thoroughly confused by the documentation at this point–in portlets.xml, <blacklist/> only seems to address path-specific blocking. <assignment/> seems like what I want, but i...
Plone Content Type-Specific Portlet Assignment
0.099668
0
0
911
7,433,963
2011-09-15T16:06:00.000
10
0
1
0
python,pickle
7,434,285
2
false
0
0
As @aix points out, pickle understands multiple references to the same object, but only within a single pickling. That is, pickle always pickles a single object. If that object has references within it, those references will be properly shared in the unpickled object. But if you call pickle twice, to pickle two objec...
1
14
0
If I have objects a and b and both reference object obj, what happens when I Pickle and then restore the objects? Will the pickled data 'know' that a and b both referenced the same object and restore everything accordingly, or will the two get two different — and initially equal — objects?
Can Pickle handle multiple object references
1
0
0
2,462
7,434,578
2011-09-15T16:53:00.000
0
0
0
0
python,soap,jira,soappy
7,438,706
1
true
1
0
I changed the JIRA Python CLI code to use suds instead of SOAPpy a while ago and haven't looked back. SOAPpy is pretty old and seems unsupported now.
1
1
0
here is the sample code : #!/usr/bin/env python # Sample Python client accessing JIRA via SOAP. By default, accesses # http://jira.atlassian.com with a public account. Methods requiring # more than basic user-level access are commented out. Change the URL # and project/issue details for local testing. # # Note: This ...
i am getting error "no schemaLocation attribute in import" when using Python client accessing JIRA via SOAP
1.2
0
1
549
7,434,837
2011-09-15T17:12:00.000
0
1
1
0
python,packaging,setup.py
7,435,249
2
false
0
0
I may not have understood the problem correctly. For any additional dependencies, you mention them in setup.py as install_requires=['module1 >= 1.3', 'module2 >=1.8.2'] When you use setuptools, easy_install oo pip, these external dependencies will get installed during setup, if required. These should also be availabl...
1
0
0
I am about to build a new python lib and I was seeking information concerning packaging in Python. I understand that "setup.py" is the script that controls everything. I wonder how to deal with it when there are external libraries in svn for instance. How to download automatically a given version from the repository u...
setup.py and source control repository
0
0
0
742
7,435,366
2011-09-15T17:59:00.000
0
0
0
1
c++,python,emacs,gdb
7,438,162
1
false
0
0
If all you're looking for is source code line tracking, my emacs does pdb source line tracking in M-x shell buffers just fine. No need to enable any other mode.
1
3
0
Let's say I have an open gdb or pdb session in an emacs shell. So the major mode is "Shell:run" Now I want to convert that buffer to gdb or pdb (python debugger) major mode. I tried M-X gud-mode and that switched the mode to "Debugger:run". But it does not actually work; for example when I type "up", "down", or "n" ...
emacs switch from Shell to gdb or pdb mode
0
0
0
453
7,435,419
2011-09-15T18:04:00.000
0
0
1
0
python,pygtk
7,566,631
3
false
0
1
Avoid threads, they don't work well at all with PyGTK. Some alternatives: For IO/networking operations where you read from a file descriptor, use glib.io_add_watch() Move the operations to a separate process and communicate with it using glib.spawn_async() Twisted is a great library for doing networking, which is co...
1
1
0
Is there a way to not block PyGTK while performing some expensive operation? I know threading would work but it would take a lot of code and setup. Thanks,
PyGTK nonblocking
0
0
0
734
7,437,147
2011-09-15T20:36:00.000
2
0
0
0
python,http-headers
7,437,186
1
true
0
0
In the past to accomplish this, I will read a portion of the socket data into memory, and then read from that buffer until a "\r\n\r\n" sequence is encountered (you could use a state machine to do this or simply use the string.find() function. Once you reach that sequence you know all of the headers have been read and...
1
0
0
I'm trying to code my own Python 3 http library to learn more about sockets and the Http protocol. My question is, if a do a recv(bytesToRead) using my socket, how can I get only the header and then with the Content-Length information, continue recieving the page content? Isn't that the purpose of the Content-Length he...
Http protocol, Content-Length, get page content Python
1.2
0
1
739
7,438,681
2011-09-15T23:43:00.000
0
0
1
0
python,django,virtualenv
7,441,158
8
false
1
0
Can you not simply: Copy the existing virtual env directory to a new one Update to the new Django?
2
162
0
I have an existing virtualenv with a lot of packages but an old version of Django. What I want to do is duplicate this environment so I have another environment with the exact same packages but a newer version of Django. How can I do this?
How to duplicate virtualenv
0
0
0
113,368
7,438,681
2011-09-15T23:43:00.000
1
0
1
0
python,django,virtualenv
66,396,104
8
false
1
0
In case you use pip "venv". I copy pasted the folder holding the virtual environment and manually changed the files in the bin folder of the copied folder. I don't know if its efficient,but it works!
2
162
0
I have an existing virtualenv with a lot of packages but an old version of Django. What I want to do is duplicate this environment so I have another environment with the exact same packages but a newer version of Django. How can I do this?
How to duplicate virtualenv
0.024995
0
0
113,368
7,439,023
2011-09-16T00:41:00.000
6
0
1
0
python
7,439,165
3
false
0
0
In Python, functions created using def and lambda have a __dict__ attribute so you can dynamically add attributes to them. Well, yes; they're objects, after all. Having a __dict__ for every function has a memory cost. An empty dict uses 140 bytes in CPython 2.6. It's 124 bytes for me. Not that it really matters for ...
1
9
0
In Python, functions created using def and lambda have a __dict__ attribute so you can dynamically add attributes to them. Having a __dict__ for every function has a memory cost. An empty dict uses 140 bytes in CPython 2.6. Adding attributes to a function isn't a particularly common thing to do, and you can use a cus...
Why do python functions have a __dict__?
1
0
0
5,040
7,441,726
2011-09-16T07:57:00.000
1
1
0
0
python,module,loadmodule
7,442,171
5
false
0
0
Just an idea and I'm not sure that it will work: You could write a module that contains a wrapper for __builtin__.__import__. This wrapper would save a reference to the old __import__and then assign a function to __builtin__.__import__ that does the following: whenever called, get the current stacktrace and work out ...
1
2
0
How does one get (finds the location of) the dynamically imported modules from a python script ? so, python from my understanding can dynamically (at run time) load modules. Be it using _import_(module_name), or using the exec "from x import y", either using imp.find_module("module_name") and then imp.load_module(param...
how do you statically find dynamically loaded modules
0.039979
0
0
303
7,442,826
2011-09-16T09:43:00.000
3
0
1
0
python,python-3.x,multiprocessing
7,443,204
1
true
0
0
I was thinking to leave the parent process parsing the file containing directories and use child processes to fetch the other files. A directory is a name. The parent parses a list and provides the directory name to each child. Right? The child then reads the files inside the directory. Since the parent would nee...
1
1
0
I have a script that parses a file containing directories to other file, that have to be opened and read searching for a keyword. Since the number of file is growing I'd like to enable multiprocessing to reduce the amount of time requested to complete the job. I was thinking to leave the parent process parsing the file...
Python3 parallelize jobs with multiprocessing
1.2
0
0
468
7,442,956
2011-09-16T09:53:00.000
2
0
1
0
python,multithreading,logging,python-multithreading
7,443,010
1
true
0
0
Both options are perfectly fine. Note that writing a single-threaded program is way easier, so unless you have tight performance requirements or timing constraints, you should forgo threads in favor of faster development and less bugs.
1
0
0
I am working on a program which logs memory usage on a server. The server has multiple instances running, and the program is logging all. I am trying to figure out what would be more optimal. Options: (Assuming two instances) 1. Single Thread Program, which handles each instance, one by one. Time delay 0.5 seconds. 2....
Threading on Python
1.2
0
0
149
7,443,076
2011-09-16T10:04:00.000
0
0
0
0
python,wxpython
7,446,240
2
false
0
1
There isn't a built-in file explorer. The GenericDirCtrl or one of the other tree controls is a good place to start for the tree. Then use a ListCtrl (or ObjectListView) for the other panel. Something like that should give you the functionality you need.
2
1
0
I'm looking to create a window with two panels, with a collapsible folder browser in the left panel and a list of files in the right panel that are contained in the selected folder on the left (similar to nautilus or an older windows explorer). Both the folders on the left and files on the right need a check box beside...
Best starting point for multiple selection in file/folder tree structure wxPython
0
0
0
432
7,443,076
2011-09-16T10:04:00.000
1
0
0
0
python,wxpython
7,485,064
2
true
0
1
I've got it all working now. I used CustomTreeCtrl for the tree and a list control that has multi inheritance from ListCtrl and CheckListCtrlMixin for the report like list with check boxes. I can share the code if anyone's interested
2
1
0
I'm looking to create a window with two panels, with a collapsible folder browser in the left panel and a list of files in the right panel that are contained in the selected folder on the left (similar to nautilus or an older windows explorer). Both the folders on the left and files on the right need a check box beside...
Best starting point for multiple selection in file/folder tree structure wxPython
1.2
0
0
432
7,443,286
2011-09-16T10:22:00.000
0
0
1
0
python,list
7,443,328
1
false
0
0
You could read in each file using the "csv" module, then write a conversion dictionary {'Bobb':'Bob',...} and run through the rows checking to see if the name is in the dict.
1
0
0
I have two files containing records of this form 'Date',"points','Name', but there are differences between the two files regarding the name,for example Bob in one file and Bobb in another.I am trying to have Bob in all the files.Any tips ?Thanks.
How can I format the items of file to comply with the items in another file in python?
0
0
0
30
7,447,112
2011-09-16T13:02:00.000
0
0
1
0
python,module,import,initialization
7,447,349
2
false
0
0
Sounds like you specifically want to write a module.init() method and a module.stop() method I personally HATE things being executed in the module when I import it, at least give me a choice when I want to execute it.
1
1
0
In Python, whever a module needs some kind of initialization, in order for it to be done automatically, you can just place the code in the module (with zero indent) to be executed on the first import (right?). Is there any way to do automatic deinitialization when the application closes and the modules get collected?
Automatic (de)initialization on module import
0
0
0
1,080
7,449,756
2011-09-16T19:59:00.000
0
0
0
1
python,input,streaming,hadoop,filesplitting
24,434,211
3
false
0
0
The new ENV_VARIABLE for Hadoop 2.x is MAPREDUCE_MAP_INPUT_FILE
2
7
0
I am able to find the name if the input file in a mapper class using FileSplit when writing the program in Java. Is there a corresponding way to do this when I write a program in Python (using streaming?) I found the following in the hadoop streaming document on apache: See Configured Parameters. During the execution ...
Get input file name in streaming hadoop program
0
0
0
9,150
7,449,756
2011-09-16T19:59:00.000
6
0
0
1
python,input,streaming,hadoop,filesplitting
24,906,345
3
false
0
0
By parsing the mapreduce_map_input_file(new) or map_input_file(deprecated) environment variable, you will get the map input file name. Notice: The two environment variables are case-sensitive, all letters are lower-case.
2
7
0
I am able to find the name if the input file in a mapper class using FileSplit when writing the program in Java. Is there a corresponding way to do this when I write a program in Python (using streaming?) I found the following in the hadoop streaming document on apache: See Configured Parameters. During the execution ...
Get input file name in streaming hadoop program
1
0
0
9,150
7,450,835
2011-09-16T22:01:00.000
3
0
1
1
python,django,linux,macos,virtualenv
7,450,904
2
true
1
0
You can just recreate the virtual environment on Ubuntu. The virtual env will have the python binary which will be different on a different system.
1
2
0
I recently made a django project using virtualenv on my mac. That mac broke, but I saved the files and now I want to work on my project using my linux computer. I am now having some difficulty running the virtual environment in Ubuntu. Does it even make sense to try and use a virtual env made in Mac OS on Ubuntu? Than...
virtual environment from Mac to Linux
1.2
0
0
2,982
7,451,163
2011-09-16T22:55:00.000
1
0
0
1
python,google-app-engine,transactions,google-cloud-datastore,entity-groups
7,466,485
2
true
1
0
If you can, try and fit the data into instance memory. If it won't fit in instance memory, you have a few options available to you. You can store the data in a resource file that you upload with the app, if it only changes infrequently, and access it off disk. This assumes you can build a data structure that permits ea...
2
0
0
My Python High Replication Datastore application requires a large lookup table of between 100,000 and 1,000,000 entries. I need to be able to supply a code to some method that will return the value associated with that code (or None if there is no association). For example, if my table held acceptable English words the...
GAE Lookup Table Incompatible with Transactions?
1.2
1
0
143
7,451,163
2011-09-16T22:55:00.000
1
0
0
1
python,google-app-engine,transactions,google-cloud-datastore,entity-groups
7,452,303
2
false
1
0
First, if you're under the belief that a namespace is going to help avoid key collisions, it's time to take a step back. A key consists of an entity kind, a namespace, a name or id, and any parents that the entity might have. It's perfectly valid for two different entity kinds to have the same name or id. So if you hav...
2
0
0
My Python High Replication Datastore application requires a large lookup table of between 100,000 and 1,000,000 entries. I need to be able to supply a code to some method that will return the value associated with that code (or None if there is no association). For example, if my table held acceptable English words the...
GAE Lookup Table Incompatible with Transactions?
0.099668
1
0
143
7,451,619
2011-09-17T00:25:00.000
2
0
1
0
javascript,python,interpreter,vm-implementation
7,531,060
6
false
1
0
I would recommend that you just stick to node.js on your local development box, translate your CoffeeScript files over to JavaScript, and deploy the translated scripts with your apps. I get that you want to avoid having node.js on your servers, that's all fair and good. Jumping through hoops with Python invoking JavaS...
1
18
0
Are there any JavaScript (ECMAScript) implementations written in pure Python? It is okay even if its implementation is very slow.
Is there a JavaScript (ECMAScript) implementation written in Python?
0.066568
0
0
2,858
7,452,917
2011-09-17T06:22:00.000
0
0
0
0
python,data-structures,machine-learning,spam-prevention
7,453,107
4
false
0
0
If you assume you didn't care about multiple occurrences of each word in an email, then all you really need to know is (that is, your features are booleans): For each feature, what is the count of positive associations and negative associations? You can do this online very easily in one pass, keeping track of just thos...
1
1
1
I am going to implement Naive Bayes classifier with Python and classify e-mails as Spam or Not spam. I have a very sparse and long dataset with many entries. Each entry is like the following: 1 9:3 94:1 109:1 163:1 405:1 406:1 415:2 416:1 435:3 436:3 437:4 ... Where 1 is label (spam, not spam), and each pair correspond...
I need a neat data structure suggestion to store a very large dataset (to train Naive Bayes in Python)
0
0
0
381
7,455,325
2011-09-17T14:03:00.000
2
0
0
0
python,django,caching,memcached
7,455,582
2
true
1
0
It's generally difficult to delete large categories of keys. A better approach is for each site to have a generation number associated with it. Start the generation at 1. Use the generation number in the cache keys for that site. When you make a fundamental change, or any other time you want to invalidate the entir...
1
1
0
One common pattern when caching with Django is to use the current site's ID in each cache key, in order to, in essence, namespace your keys. The problem I have is that I'd love to be able to delete all values in cache under a namespace (e.g. Delete all cache values for site 45 because they've made some fundamental chan...
Django / general caching question
1.2
0
0
728
7,455,371
2011-09-17T14:12:00.000
1
1
0
0
python,encoding,character
7,455,417
3
false
0
0
When you serve the content to a web browser, you need to tell it what encoding the file is in. Ideally, you should send a Content-type: HTTP header in the response with something like text/plain; charset=utf-8, where "utf-8" is replaced by whatever encoding you're actually using if it's not utf-8. Your browser may also...
1
0
0
I have some .txt files which included Turkish characters. I prepared a HTML code and wanna include texts which are in my txt files. The processes are successful but the html files which are made by python have character problems(special characters seems like this: �) I have tried add u before strings in python code but...
Special characters in output are like �
0.066568
0
0
171
7,455,843
2011-09-17T15:30:00.000
2
0
0
0
python,email,login,flask
7,456,386
1
true
1
0
You can use the Flask's flaskr example (exists in Flask git repo under examples) and rename the username there to email.
1
0
0
I want users to login with their email address, not with a username. How easy is it to do that with Flask ? Where can I find an example ?
Python Flask - login with email address, not username
1.2
0
0
573
7,456,638
2011-09-17T17:39:00.000
4
0
1
0
python,private
7,456,669
3
true
0
0
No, nothing is truly private in Python. If you know the method name, you can get it. I think you might come up with a clever hack, but it would be just that - a hack. No such functionality exists in the language.
2
2
0
PEP 8 states that (emphasis mine): We don't use the term "private" here, since no attribute is really private in Python (without a generally unnecessary amount of work). I guess it refers to defining the actual class in some other language and then exposing only the public members to the interpreter. Is there some ot...
True privateness in Python
1.2
0
0
435
7,456,638
2011-09-17T17:39:00.000
0
0
1
0
python,private
7,456,695
3
false
0
0
There is no true privateness. The best you could do is obfuscate the variable name and then create getters/setters or properties. The only way to achieve this that I can think of this is to read/write a file every time you need to have access to that variable. You could also write a program in another language that wil...
2
2
0
PEP 8 states that (emphasis mine): We don't use the term "private" here, since no attribute is really private in Python (without a generally unnecessary amount of work). I guess it refers to defining the actual class in some other language and then exposing only the public members to the interpreter. Is there some ot...
True privateness in Python
0
0
0
435
7,458,227
2011-09-17T22:21:00.000
0
0
1
0
python,api,google-maps,google-maps-api-3
7,459,980
5
false
0
0
The Google Maps API key is only for version 2, which has been officially deprecated since May 2010. Strongly suggest you use Version 3 of the API instead, which is much better, and has no need for an API key.
4
4
0
I am using an API key in some Python code which I am looking to distribute. This API key is for Google Maps. Are there any security issues with regards to distributing this API key and if so, how is it best to hide this?
Hiding API key in code (Python)
0
0
1
3,290
7,458,227
2011-09-17T22:21:00.000
0
0
1
0
python,api,google-maps,google-maps-api-3
7,458,255
5
false
0
0
if you're providing a tool for "power users" to use google maps, then it's reasonable to expect them to supply their own Google API key. If that's not an option for your users, you will need to have a web-service that your application accesses to act as a deputy so that your private key is not exposed. You will still...
4
4
0
I am using an API key in some Python code which I am looking to distribute. This API key is for Google Maps. Are there any security issues with regards to distributing this API key and if so, how is it best to hide this?
Hiding API key in code (Python)
0
0
1
3,290
7,458,227
2011-09-17T22:21:00.000
1
0
1
0
python,api,google-maps,google-maps-api-3
7,458,232
5
false
0
0
You cannot hide this. Your program needs to access it and a hacker will simply use a tool like a debugger, a virtual machine or a modified Python implementation if he/she really wants to know the API key. I don't think it's necessary to hide a Google Maps API key anyway, as a web page will also have this in its source ...
4
4
0
I am using an API key in some Python code which I am looking to distribute. This API key is for Google Maps. Are there any security issues with regards to distributing this API key and if so, how is it best to hide this?
Hiding API key in code (Python)
0.039979
0
1
3,290
7,458,227
2011-09-17T22:21:00.000
0
0
1
0
python,api,google-maps,google-maps-api-3
7,458,257
5
false
0
0
You could obfuscate the key in various ways, but it's not worth the effort. Obfuscation is a weak way to protect information, and in this case your information's security isn't especially critical anyway. The point of the API key is largely so that the API vendor (Google, here) can monitor, throttle, and revoke your a...
4
4
0
I am using an API key in some Python code which I am looking to distribute. This API key is for Google Maps. Are there any security issues with regards to distributing this API key and if so, how is it best to hide this?
Hiding API key in code (Python)
0
0
1
3,290
7,459,408
2011-09-18T04:06:00.000
12
0
0
0
python,multithreading,sockets,polling,epoll
7,460,395
3
true
0
0
If you do read or recv, you're waiting on only one connection. If you have multiple connections, you will have to create multiple processes or threads, a waste of system resource. With select or poll or epoll, you can monitor multiple connections with only one thread, and get notified when any of them has data availabl...
1
13
0
I'm doing some threaded asynchronous networking experiment in python, using UDP. I'd like to understand polling and the select python module, I've never used them in C/C++. What are those for ? I kind of understand a little select, but does it block while watching a resource ? What is the purpose of polling ?
I can't understand polling/select in python
1.2
0
1
13,909
7,460,592
2011-09-18T09:24:00.000
0
0
0
1
python,windows,linux,macos,permissions
7,466,568
3
false
0
0
You can run untrusted apps in chroot and block them from using network with an iptables rule (for example, owner --uid-owner match) But really, virtual machine is more reliable and on modern hardware performance impact is negligible.
1
0
0
I would like to launch an untrusted application programmatically, so I want to remove the program's ability to access files, network, etc. Essentially, I want to restrict it so its only interface to the rest of the computer is stdin and stdout. Can I do that? Preferably in a cross-platform way but I sort of expect to h...
Lock down a program so it has no access to outside files, like a virus scanner does
0
0
0
189
7,461,111
2011-09-18T11:18:00.000
4
0
0
1
python,google-app-engine,hosting
7,461,775
2
true
1
0
GAE has a BlobStore API, which can work pretty much as a file storage, but probably it's not what you whant. Actually, the right answer depends on what kind of API you're using - it may support file-like objects, so you could pass urllib response object, or accept URLs, or tons of other interesting features
2
2
0
I'm writing an app with Python, which will check for updates on a website(let's call it A) every 2 hours, if there are new posts, it will download the images in the post and post them to another website(call it B), then delete those images. Site B provide API for upload images with description, which is like: upload(im...
Store images temporary in Google App Engine?
1.2
0
0
424
7,461,111
2011-09-18T11:18:00.000
1
0
0
1
python,google-app-engine,hosting
7,465,743
2
false
1
0
You shouldn't need to use temporary storage at all - just download the image with urlfetch into memory, then use another urlfetch to upload it to the destination site.
2
2
0
I'm writing an app with Python, which will check for updates on a website(let's call it A) every 2 hours, if there are new posts, it will download the images in the post and post them to another website(call it B), then delete those images. Site B provide API for upload images with description, which is like: upload(im...
Store images temporary in Google App Engine?
0.099668
0
0
424