Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8,379,740 | 2011-12-05T00:25:00.000 | 0 | 0 | 1 | 0 | python,import,set,intersection | 8,379,770 | 3 | false | 0 | 0 | I'm not sure I entirely understand what's going on (giving actual module names might help). But it's generally considered bad practice to do from ... import * at all, because then it's not obvious where particular things are coming from. Instead, do from ... import thingA, thingB, thingC.
You could also do import ... a... | 1 | 2 | 0 | Is it possible to import everything except one module from a package?
I need a lot of modules from a particular library that I use in my class, but it looks like it used the same module name for one of the modules that I need.
I need to use set operation and intersection, but when I import that library from my class, i... | Python: Import Exception | 0 | 0 | 0 | 3,666 |
8,382,893 | 2011-12-05T08:57:00.000 | 2 | 0 | 1 | 0 | python | 8,382,908 | 4 | false | 0 | 0 | Builtin function eval() will return a tuple, no splitting needed (as per your question).
eval('299, 255, 66')
will return
(229, 255, 66) | 1 | 2 | 0 | I want to do a simple conversion of u'229, 255, 66' to (229, 255, 66)
Is there a very simple way to do this? Or do I need to split, convert to int, etc... | Convert '229, 255, 66' to (229, 255, 66) in Python | 0.099668 | 0 | 0 | 103 |
8,383,452 | 2011-12-05T09:47:00.000 | 0 | 0 | 1 | 0 | python,image-processing,python-imaging-library | 8,383,772 | 3 | false | 0 | 0 | What about rescaling your image to lower resolution and finding edges there?
Then you would recompute position of the edges by scaling back to the original size. | 2 | 3 | 0 | I am using the Python image library for some basic image operations. I wish to do detect edges of an image, but only the thick ones.
How can I do this? | How do I filter the thick edges of an image? | 0 | 0 | 0 | 1,762 |
8,383,452 | 2011-12-05T09:47:00.000 | 0 | 0 | 1 | 0 | python,image-processing,python-imaging-library | 8,383,534 | 3 | false | 0 | 0 | I have a feeling thick edges will get detected as 2 edges - in which case you would have to do non-maximum suppression. Have you tried using a median filter or something which would throw out extremely thin edges? (Smoothing after median filter would suppress the thin edges quite a bit though I am a little unsure as to... | 2 | 3 | 0 | I am using the Python image library for some basic image operations. I wish to do detect edges of an image, but only the thick ones.
How can I do this? | How do I filter the thick edges of an image? | 0 | 0 | 0 | 1,762 |
8,384,052 | 2011-12-05T10:40:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,pywin32,dde | 8,405,511 | 1 | false | 1 | 0 | The problem was not on the GAE development server: I managed to uninstall the win32 python build 216 library and install a previous version. The problem was indeed with the manifest of the build 216 and not with the GAE development server. Now it works fine with build 214. | 1 | 1 | 0 | I'm trying to set up a little server through the App Engine Python development server:
GOAL:
On Windows I've got a DDE application.
I need to read data from this application and serve it over the Internet.
SITUATION:
The development server is working correctly on port 80, enabling me to store data and make it available... | Google App Engine and win32 DDE | 0.197375 | 0 | 0 | 367 |
8,385,602 | 2011-12-05T12:53:00.000 | 0 | 0 | 1 | 0 | python,arrays,numpy | 8,385,718 | 6 | false | 0 | 0 | Numpy arrays are extremily similar to 'normal' arrays such as those in c. Notice that every element has to be of the same type. The speedup is great because you can take advantage of prefetching and you can instantly access any element in array by it's index. | 1 | 84 | 1 | I just changed a program I am writing to hold my data as numpy arrays as I was having performance issues, and the difference was incredible. It originally took 30 minutes to run and now takes 2.5 seconds!
I was wondering how it does it. I assume it is that the because it removes the need for for loops but beyond that I... | Why are NumPy arrays so fast? | 0 | 0 | 0 | 47,312 |
8,386,715 | 2011-12-05T14:23:00.000 | 4 | 0 | 0 | 1 | python,linux,buildbot | 8,419,633 | 2 | true | 0 | 0 | When you add step to a factory (i.e. f.addStep(your_step)) you should specify haltOnFailure = True to make whole build fail whenever particular build step returns FAILURE. | 2 | 2 | 0 | I'm trying to fix a very complex buildbot base build system, which has the annoying habit of showing green bars with 'failed (1)' in them.
The problem is that we run several commands using the ShellCommand build step, which is not failing the whole build when it returns non zero.
We also have steps which do show up ... | Why is buildbot *NOT* failing when it should? | 1.2 | 0 | 0 | 484 |
8,386,715 | 2011-12-05T14:23:00.000 | 2 | 0 | 0 | 1 | python,linux,buildbot | 9,149,601 | 2 | false | 0 | 0 | The default for flunkOnFailure is False in BuildStep. Various subclasses override this default, in particular ShellCommand. I would guess that the particular steps that are red, with the final result of the build being green, don't have flunkOnFailure set.
On the other hand, it could be that haltOnFailure isn't set, so... | 2 | 2 | 0 | I'm trying to fix a very complex buildbot base build system, which has the annoying habit of showing green bars with 'failed (1)' in them.
The problem is that we run several commands using the ShellCommand build step, which is not failing the whole build when it returns non zero.
We also have steps which do show up ... | Why is buildbot *NOT* failing when it should? | 0.197375 | 0 | 0 | 484 |
8,388,659 | 2011-12-05T16:41:00.000 | 0 | 0 | 0 | 0 | python,pyqt | 8,539,266 | 1 | true | 0 | 1 | Here is the way I ended up solving this problem:
When row selections are made, put the unique IDs of each hidden row into a list, then hide all hidden rows
Use self.connect(self.myHorizontalHeader, SIGNAL("sectionClicked(int)"), self.keepSelectionValues) to catch the
event when a user clicks on a column header to sort... | 1 | 0 | 1 | I'm using QItemSelectionModel with QTableView to allow the users to select rows. The problem is that when the user then clicks on a column header to sort the rows, the selection disappears and all the sorted data is displayed. How can I keep the selection, and just sort that, rather than having all the rows appear?
Tha... | How can I keep row selections in QItemSelectionModel when columns are sorted? | 1.2 | 0 | 0 | 623 |
8,389,812 | 2011-12-05T18:10:00.000 | 21 | 0 | 1 | 0 | python,coroutine | 8,390,077 | 2 | true | 0 | 1 | The yield instruction takes the current executing context as a closure, and transforms it into an own living object. This object has a __iter__ method which will continue after this yield statement.
So the call stack gets transformed into a heap object. | 2 | 58 | 0 | I've read that in CPython, the interpreter stack (the list of Python functions called to reach this point) is mixed with the C stack (the list of C functions that were called in the interpreter's own code). If so, then how are generators and coroutines implemented? How do they remember their execution state? Does CPyth... | How are generators and coroutines implemented in CPython? | 1.2 | 0 | 0 | 6,580 |
8,389,812 | 2011-12-05T18:10:00.000 | 54 | 0 | 1 | 0 | python,coroutine | 8,391,403 | 2 | false | 0 | 1 | The notion that Python's stack and C stack in a running Python program are intermixed can be misleading.
The Python stack is something completely separated than the actual C stack used by the interpreter. The data structures on Python stack are actually full Python "frame" objects (that can even be introspected and hav... | 2 | 58 | 0 | I've read that in CPython, the interpreter stack (the list of Python functions called to reach this point) is mixed with the C stack (the list of C functions that were called in the interpreter's own code). If so, then how are generators and coroutines implemented? How do they remember their execution state? Does CPyth... | How are generators and coroutines implemented in CPython? | 1 | 0 | 0 | 6,580 |
8,390,626 | 2011-12-05T19:20:00.000 | 0 | 0 | 1 | 0 | python | 8,390,739 | 7 | false | 0 | 0 | (1) You can provide installers for Python code (which may install the Python environment). This doesn't prevent you from having commercial code. Note that you can also have Java (also "interpreted" or JIT-compiled) commercial or desktop code and require your users to install a JRE.
(2) Any language, even compiled and s... | 6 | 0 | 0 | What exactly is the sole purpose of python being an interpreter.
It doesn't provide executable files (how a commercial software developer use it?)
If any part of the code had bugs, it doesn't show up unless python
goes to that line at run it. In large projects, all parts of code
doesn't get interpreted every time, so,... | what is the sole purpose of python being an interpreter? | 0 | 0 | 0 | 233 |
8,390,626 | 2011-12-05T19:20:00.000 | 0 | 0 | 1 | 0 | python | 8,390,729 | 7 | false | 0 | 0 | Python is not an interpreter, but an interpreted language.
This question is more about interpreted language VS compiled languages which has actually no other answer that the usual "it depends of your need".
See Noufal Ibrahim for details, but I'm not sure this question is a good fit for SO. | 6 | 0 | 0 | What exactly is the sole purpose of python being an interpreter.
It doesn't provide executable files (how a commercial software developer use it?)
If any part of the code had bugs, it doesn't show up unless python
goes to that line at run it. In large projects, all parts of code
doesn't get interpreted every time, so,... | what is the sole purpose of python being an interpreter? | 0 | 0 | 0 | 233 |
8,390,626 | 2011-12-05T19:20:00.000 | 0 | 0 | 1 | 0 | python | 8,390,652 | 7 | false | 0 | 0 | A python .exe has to necessarily include a complete copy of the python interpreter. As you say, since it's interpreted it won't touch every line of code until that line is actually run. Some parts may actually invoke a python parse/compile sequence (e.g. eval(), some regexes, etc...). These would fail in a compiled .ex... | 6 | 0 | 0 | What exactly is the sole purpose of python being an interpreter.
It doesn't provide executable files (how a commercial software developer use it?)
If any part of the code had bugs, it doesn't show up unless python
goes to that line at run it. In large projects, all parts of code
doesn't get interpreted every time, so,... | what is the sole purpose of python being an interpreter? | 0 | 0 | 0 | 233 |
8,390,626 | 2011-12-05T19:20:00.000 | 0 | 0 | 1 | 0 | python | 8,390,685 | 7 | false | 0 | 0 | Interactivity is good. I find it encourages making small, easily testable functions that build together to make an application.
Unless you are writing simple, statically linked applications, you will usually have some run-time baggage that must be included or installed (mfc, dot net, etc.) for compiled languages. Look ... | 6 | 0 | 0 | What exactly is the sole purpose of python being an interpreter.
It doesn't provide executable files (how a commercial software developer use it?)
If any part of the code had bugs, it doesn't show up unless python
goes to that line at run it. In large projects, all parts of code
doesn't get interpreted every time, so,... | what is the sole purpose of python being an interpreter? | 0 | 0 | 0 | 233 |
8,390,626 | 2011-12-05T19:20:00.000 | 12 | 0 | 1 | 0 | python | 8,390,717 | 7 | false | 0 | 0 | First, answers to your questions.
They can use it for parts of their system for which they don't mind the source being visible (e.g. extensions) or they can Open Source their application. They can also use it to develop backend services for something which they're providing as a service (e.g. Youtube). They can also ... | 6 | 0 | 0 | What exactly is the sole purpose of python being an interpreter.
It doesn't provide executable files (how a commercial software developer use it?)
If any part of the code had bugs, it doesn't show up unless python
goes to that line at run it. In large projects, all parts of code
doesn't get interpreted every time, so,... | what is the sole purpose of python being an interpreter? | 1 | 0 | 0 | 233 |
8,390,626 | 2011-12-05T19:20:00.000 | 1 | 0 | 1 | 0 | python | 8,390,713 | 7 | false | 0 | 0 | Sole purpose of python is to provide a beautiful language to program in.
Your point #1 and #3 are similar and answer is that professional programmers use py2exe/pyinstaller etc to bundle their programs and distribute, in cases of frameworks/libraries they even don't need to do that.
Your point number #2 is also valid f... | 6 | 0 | 0 | What exactly is the sole purpose of python being an interpreter.
It doesn't provide executable files (how a commercial software developer use it?)
If any part of the code had bugs, it doesn't show up unless python
goes to that line at run it. In large projects, all parts of code
doesn't get interpreted every time, so,... | what is the sole purpose of python being an interpreter? | 0.028564 | 0 | 0 | 233 |
8,392,432 | 2011-12-05T21:55:00.000 | 1 | 0 | 1 | 0 | python,multiprocessing | 8,392,473 | 1 | true | 0 | 0 | Multiprocessing is a standard Python library.
If I had to guess, I'd say that Processing (which hasn't been updated since early 2008) became Multiprocessing — but don't quote me on that. | 1 | 0 | 0 | There are two modules for Python that have an almost identical layout in terms of methods and purpose. Is one preferred over the other or do they actually perform differently? | What is the difference between module Processing and Multiprocessing? | 1.2 | 0 | 0 | 112 |
8,392,640 | 2011-12-05T22:12:00.000 | 1 | 0 | 1 | 0 | python,multithreading,synchronization | 8,392,957 | 7 | false | 0 | 0 | I'm doubtful that this can be done.
If you want to implement this without any sort of polling, then you need the OS to know that the thread is blocked, and the OS needs to be aware of the timeout, in order to unblock the thread after a while. For that, support needs to already exist in the OS; you can't implement this ... | 1 | 24 | 0 | Is there a way to implement a lock in Python for multithreading purposes whose acquire method can have an arbitrary timeout? The only working solutions I found so far use polling, which
I find inelegant and inefficient
Doesn't preserve the bounded waiting / progress guarantee of the lock as a solution to the critical ... | How to implement a Lock with a timeout in Python 2.7 | 0.028564 | 0 | 0 | 18,780 |
8,394,076 | 2011-12-06T01:06:00.000 | 4 | 0 | 0 | 1 | python,publish-subscribe,zeromq,messagebroker | 8,394,573 | 2 | false | 0 | 0 | It seems like most of the complexity stems from trying to make the broker service persist in the event of a failure. Solving this at the application level gives you the highest degree of flexibility, but requires the most effort if you're starting from scratch.
Instead of handling this at the application level, you co... | 2 | 4 | 0 | I'm designin a pub/sub architecture using ZMQ. I need maximum reliability and scalability and am kind of lost in the hell of possibilities provided.
At the moment, I got a set a publishers and subscribers, linked by a broker. The broker is a simple forwarder device exposing a frontend for publishers, and a backend for ... | ZMQ pub/sub reliable/scalable design | 0.379949 | 0 | 0 | 1,589 |
8,394,076 | 2011-12-06T01:06:00.000 | 7 | 0 | 0 | 1 | python,publish-subscribe,zeromq,messagebroker | 8,400,389 | 2 | true | 0 | 0 | It's not possible to answer your question directly because it's predicated on so many assumptions, many of which are probably wrong.
You're getting lost because you're using the wrong approach. Consider 0MQ as a language, one that you don't know very well yet. If you start by trying to write "maximum reliability and sc... | 2 | 4 | 0 | I'm designin a pub/sub architecture using ZMQ. I need maximum reliability and scalability and am kind of lost in the hell of possibilities provided.
At the moment, I got a set a publishers and subscribers, linked by a broker. The broker is a simple forwarder device exposing a frontend for publishers, and a backend for ... | ZMQ pub/sub reliable/scalable design | 1.2 | 0 | 0 | 1,589 |
8,396,101 | 2011-12-06T06:20:00.000 | 221 | 0 | 0 | 0 | python,image,matplotlib | 8,396,124 | 4 | true | 0 | 0 | Specify the keyword argument origin='lower' or origin='upper' in your call to imshow. | 3 | 115 | 1 | I wanted the imshow() function in matplotlib.pyplot to display images the opposite way, i.e upside down. Is there a simple way to do this? | Invert image displayed by imshow in matplotlib | 1.2 | 0 | 0 | 82,762 |
8,396,101 | 2011-12-06T06:20:00.000 | 1 | 0 | 0 | 0 | python,image,matplotlib | 67,577,958 | 4 | false | 0 | 0 | You can use the extent argument. For example, if X values range from -10 and 10 and Y values range from -5 to 5, you should pass extent=(-10,10,-5,5) to imshow(). | 3 | 115 | 1 | I wanted the imshow() function in matplotlib.pyplot to display images the opposite way, i.e upside down. Is there a simple way to do this? | Invert image displayed by imshow in matplotlib | 0.049958 | 0 | 0 | 82,762 |
8,396,101 | 2011-12-06T06:20:00.000 | 0 | 0 | 0 | 0 | python,image,matplotlib | 68,682,366 | 4 | false | 0 | 0 | Use ax.invert_yaxis() to invert the y-axis, or ax.invert_xaxis() to invert the x-axis. | 3 | 115 | 1 | I wanted the imshow() function in matplotlib.pyplot to display images the opposite way, i.e upside down. Is there a simple way to do this? | Invert image displayed by imshow in matplotlib | 0 | 0 | 0 | 82,762 |
8,396,511 | 2011-12-06T07:20:00.000 | 1 | 0 | 0 | 0 | python,ruby,google-sheets | 8,778,840 | 1 | true | 1 | 0 | This is not currently possible, Google does not let python or ruby runs in the browser. Conditional formatting is currently limited to simple rules based on cell contents. Google has recently rolled macros ability in their spreadsheets but that is limited to JavaScript and does not support conditional formatting. | 1 | 0 | 0 | Does anybody know how to apply conditional formatting to a google spreadsheet document using ruby or python? | Conditional formatting using ruby or python | 1.2 | 0 | 0 | 428 |
8,396,569 | 2011-12-06T07:26:00.000 | 1 | 0 | 0 | 0 | python,qt,user-interface,pyqt,pyside | 8,396,619 | 3 | false | 0 | 1 | PySide and PyQt4 are almost identical. In fact, you can often replace PyQt4 with PySide (and vice versa) in your code's import declarations.
Python2 and Python3 are almost identical as well, with a few minor changes that a beginner won't notice for a while (aside from print being made a function).
Python2 has more supp... | 1 | 0 | 0 | I have been using REALbasic for a number of years to develop cross-platform apps. I have become frustrated developing with a proprietary language and so have decided to change languages and have settled on Python and QT.
Since I know no Python, would people recommend Python 2 or 3?
I think I will be using PyQt or PySi... | Best setup to develop cross-platform GUI-based apps using Python | 0.066568 | 0 | 0 | 567 |
8,397,667 | 2011-12-06T09:26:00.000 | 2 | 0 | 0 | 0 | python,command-line,download,progress-bar | 8,397,748 | 2 | true | 0 | 0 | Figure out the total size of the file you're downloading. This is often present in the HTTP header Content-Length (which is in bytes).
Keep count of the total data downloaded so far.
The amount of the progress bar that should be filled at any moment is given by the formula: (downloaded so far) / (total size) which is a... | 1 | 2 | 0 | I have made a simple command-line URL downloader in Python. When the user supplies a URL it reads the file from web and saves it in a string, then saves the string in a file on the computer.
I want to add a progress bar. How should I go about it? | How to add a progress bar in a Python command-line URL downloader? | 1.2 | 0 | 1 | 428 |
8,398,444 | 2011-12-06T10:33:00.000 | 3 | 0 | 1 | 1 | python,monitoring,infinite-loop | 8,398,787 | 3 | false | 0 | 0 | The only way to detect an infinite loop is to include in the loop itself a test for those conditions that would bring it to never end.
For example: if your loop is supposed to make a variable decrease until it reaches zero (var == 0 would be the exit condition), you should include a test for what I would call "proper w... | 2 | 1 | 0 | I'm using Python (winappdbg) to monitor a process (the main feature is to catch the exceptions).
But I would like also to detect infinite loops.
Do you know a way to do that with Python?
With or without winappdbg ... | How to detect an infinite loop in a monitored process | 0.197375 | 0 | 0 | 4,474 |
8,398,444 | 2011-12-06T10:33:00.000 | 1 | 0 | 1 | 1 | python,monitoring,infinite-loop | 8,399,080 | 3 | false | 0 | 0 | Infinite loops usually consume 100% CPU while well-behaving programs don't, so the first thing I'd do is check CPU usage. Unfortunately, this won't let you identify where the infinite loop is in your code.
To do that, you could use a profiler to record the number of times the code is being executed. If you find a reall... | 2 | 1 | 0 | I'm using Python (winappdbg) to monitor a process (the main feature is to catch the exceptions).
But I would like also to detect infinite loops.
Do you know a way to do that with Python?
With or without winappdbg ... | How to detect an infinite loop in a monitored process | 0.066568 | 0 | 0 | 4,474 |
8,401,085 | 2011-12-06T13:59:00.000 | 1 | 0 | 1 | 0 | python,django,macos,python-imaging-library,pip | 8,402,859 | 4 | false | 1 | 0 | My fix for this is to make sure you have packages libjpeg-dev and libpng-dev installed before doing the pip install of PIL.
sudo apt-get install libjpeg-dev libpng-dev
will probably do. Then pip gets PIL from source, compiles with jpeg and png support. | 1 | 3 | 0 | I installed PIL using PIP. However, using PIL on Django, when trying to upload a .jpg file, I get the error:
Upload a valid image. The file you uploaded was either not an image or a corrupted image.
I read on the Internet about this error and a solution was to delete the compiled files for the current OS, then use se... | Error in PIL installed with PIP - Django,Python | 0.049958 | 0 | 0 | 4,607 |
8,404,956 | 2011-12-06T18:34:00.000 | 3 | 0 | 1 | 0 | python,django,python-imaging-library,libjpeg | 8,409,103 | 7 | false | 1 | 0 | Worth noting and good information to have whenever working with Python and PIL: If you use virtualenv (and I think it's a very good idea), PIL may not correctly detect the image libraries on your system and install without JPEG/PNG support. Use the pillow package for a compatible PIL fork that finds them correctly. | 1 | 37 | 0 | I posted a question before regarding this subject, and read other ones posted before, but none has successfully solved my problem.
I am trying to install PIL on Mac OS X Lion, as I need it for a Django application. I also need JPEG support, so I need a JPEG decoder as well.
I have tried to download the libjpeg sources ... | Installing PIL with JPEG support on Mac OS X | 0.085505 | 0 | 0 | 36,574 |
8,405,855 | 2011-12-06T19:48:00.000 | 4 | 1 | 0 | 1 | python,import,path | 8,405,986 | 1 | true | 0 | 0 | It comes from the python-support package, specifically from the /usr/lib/python2.7/dist-packages/python-support.pth file that is installed.
There shouldn't be any modules installed to that directory manually and any package installing modules to that directory should have a dependency on the python-support package, so ... | 1 | 4 | 0 | I'm trying to figure out where does the initial sys.path value come from. One ubuntu system suddenly (by which I mean probably manually by someone doing something weird) lost entries at the end of the array.
All other hosts: ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr... | Where does the initial sys.path come from | 1.2 | 0 | 0 | 649 |
8,409,143 | 2011-12-07T01:00:00.000 | 4 | 0 | 1 | 0 | python,python-imaging-library,read-eval-print-loop | 8,409,182 | 3 | true | 0 | 0 | The Image class has a show(self, title=None, command=None) method, which you can use. | 1 | 9 | 0 | I'm now working with PIL images in Python. What's the quickest way to preview a PIL image in the Python shell? Saving to a file and then opening it in my OS is pretty cumbersome. | Quickest way to preview a PIL image | 1.2 | 0 | 0 | 5,226 |
8,409,372 | 2011-12-07T01:37:00.000 | 0 | 0 | 0 | 0 | python,windows,urllib | 8,409,568 | 2 | false | 0 | 0 | You should be able to read(bytes) instead of read(), this will read a number of bytes instead of all of it. Then append to already downloaded bytes, and see if it contains what you're looking for. Then you should be able to stop download with .close(). | 1 | 0 | 0 | I'm using urllib to open one site and get some information on it.
Is there a way to "open" this site only to the part I need and discard the rest (discard I mean don't open/load the rest)? | Is there a way to use urllib to open one site until a specified object in it? | 0 | 0 | 1 | 41 |
8,409,521 | 2011-12-07T02:02:00.000 | 5 | 0 | 0 | 0 | python,forms,pyramid | 8,409,714 | 1 | true | 1 | 0 | This is not a Pyramid-specific answer, but two common approaches to this problem are:
Store the data in a session.
Store the data as a hidden form on the confirmation page, and resubmit with "confirmed"
I like 2 much better because it's a stateless method. You can also use the exact same form processing logic, and j... | 1 | 2 | 0 | I am creating a form that requires user confirmation before submitting the data. I would like a seperate confirmation page because I need to display quite a bit information about how the form data will be processed. I was wondering if there was a pythonic way to pass data between forms in Pyramid.
Submitting the form ... | Passing form parameters between views in Pyramid | 1.2 | 0 | 0 | 921 |
8,410,260 | 2011-12-07T04:06:00.000 | 4 | 0 | 0 | 0 | python,image-processing,matplotlib,python-imaging-library | 8,410,307 | 1 | true | 0 | 0 | If you convert to binary PPM format, then there should be an easy way to seek to the appropriate offsets - it's not compressed, so there should be simple relationships.
So pick two random numbers between 0 and 100000-200-1, and go to town.
(I'm assuming you don't have a system with 10's of gigabytes of RAM) | 1 | 2 | 1 | I am using python to work on my project in image processing. Suppose I got a very large image ( 100000 x 100000), and I need to randomly select a 200 x 200 square from this large image. Are there any easy way to do this job? Please share some light with me. Thank you
----------------------------- EDIT -----------------... | randomly select a 200x200 square inside an image in python | 1.2 | 0 | 0 | 465 |
8,411,129 | 2011-12-07T06:11:00.000 | 0 | 0 | 0 | 0 | python,testing,selenium,grid | 8,411,384 | 2 | false | 0 | 0 | use selenium2(webdriver) python binding ,does it make sense than change the server address in for loop ?
then it run in sequence way. | 1 | 0 | 0 | I want to run a selenium tests using python against a server farm that has about 50 web servers. What I have been doing is changing my host file (@ /etc/hosts) to switch to the desired server and run my selenium tests. This manual process can be tedious. Is there a better way to test these individual servers faster?
I... | Running Selenium Tests Against Server Farm using Python | 0 | 0 | 1 | 618 |
8,411,476 | 2011-12-07T06:51:00.000 | 0 | 0 | 1 | 0 | python,memory,dictionary | 8,414,694 | 5 | false | 0 | 0 | Possibilities:
(1) Benchmark the csv.DictReader approach and see if it causes a problem. Note that the dicts contain POINTERS to the keys and values; the actual key strings are not copied into each dict.
(2) For each file, use csv.Reader, after the first row, build a class dynamically, instantiate it once per remaining... | 2 | 1 | 1 | I am using csv.DictReader to read some large files into memory to then do some analysis, so all objects from multiple CSV files need to be kept in memory. I need to read them as Dictionary to make analysis easier, and because the CSV files may be altered by adding new columns.
Yes SQL can be used, but I'd rather avoid... | Python: large number of dict like objects memory use | 0 | 0 | 0 | 490 |
8,411,476 | 2011-12-07T06:51:00.000 | 0 | 0 | 1 | 0 | python,memory,dictionary | 8,411,784 | 5 | false | 0 | 0 | If all the data in one column are the same type, you can use NumPy. NumPy's loadtxt and genfromtxt function can be used to read csv file. And because it returns an array, the memory usage is smaller then dict. | 2 | 1 | 1 | I am using csv.DictReader to read some large files into memory to then do some analysis, so all objects from multiple CSV files need to be kept in memory. I need to read them as Dictionary to make analysis easier, and because the CSV files may be altered by adding new columns.
Yes SQL can be used, but I'd rather avoid... | Python: large number of dict like objects memory use | 0 | 0 | 0 | 490 |
8,412,215 | 2011-12-07T08:17:00.000 | 1 | 1 | 0 | 0 | python,html,wysiwyg | 8,413,073 | 1 | false | 1 | 1 | Can i suggest a complete another approach ? Since your ebook is only <p></p>:
Split the text on <p></p> to get an indexed array of all your paragraphs
Make your own pagination system, and fill the screen with N paragraphs, that automatically get enough text to show from the indexed array
When you are doing selection, ... | 1 | 2 | 0 | Background:
I am writing an ebook editing program in python. Currently it utilizes a source-code view for editing, and I would like to port it over to a wysiwyg view for editing. The best (only?) html renderer I could find for python was webkit (I am using the PyQt version).
Question:
How do I accomplish wysiwyg editin... | Python/Javascript: WYSIWYG html editor - Handle large documents fast and/or design theory | 0.197375 | 0 | 0 | 1,587 |
8,412,636 | 2011-12-07T09:00:00.000 | 1 | 0 | 0 | 0 | c#,python,sql-server,stored-procedures,smo | 8,414,549 | 1 | false | 1 | 0 | There is no easy way to access SMO from Python (because there is no generic solution for accessing .NET from Python), so I would write a command-line tool in C# and call it from Python using the subprocess module. Perhaps you could do something with ctypes but I have no idea if that's feasible.
But, perhaps a more impo... | 1 | 0 | 0 | The idea is to make a script that would get stored procedure and udf contents (code) every hour (for example) and add it to SVN repo. As a result we have sql versioning control system.
Does anyone know how to backup stored procedure code using Python (sqlAlchemy, pyodbc or smth).
I'v done this via C# before using SQL ... | backup msSQL stored proc or UDF code via Python | 0.197375 | 1 | 0 | 244 |
8,413,242 | 2011-12-07T09:45:00.000 | 6 | 0 | 1 | 0 | python,plugins,netbeans,uninstallation,netbeans-7 | 32,083,470 | 3 | false | 0 | 0 | I had the same issue. Here is how I solved it in 8.0.2 (without losing all settings and modules).
Go to 'C:\Users\yourAccount\AppData\Roaming\NetBeans\8.0.2\config\Modules' and delete the faulty (last installed plugin).
If you have several installed versions, have a look in their '\config\Modules' as well.
Start the Ne... | 2 | 8 | 0 | Netbeans 7.0.1 on Vista doesn't start after installing python plugin.
How do I uninstall plugins manually?
Is there a command line argument to start netbeans without plugins? If not, this should be easy to add to netbeans :-) | Uninstall a netbeans 7.0.1 plugin, netbeans doesn't start | 1 | 0 | 0 | 5,598 |
8,413,242 | 2011-12-07T09:45:00.000 | 2 | 0 | 1 | 0 | python,plugins,netbeans,uninstallation,netbeans-7 | 27,270,598 | 3 | false | 0 | 0 | Open Net Beans Plugin Manager From Tools => Plugins
Now go to Installed Plugin and right click on user installed plugin and then deactivate it.
that's all. | 2 | 8 | 0 | Netbeans 7.0.1 on Vista doesn't start after installing python plugin.
How do I uninstall plugins manually?
Is there a command line argument to start netbeans without plugins? If not, this should be easy to add to netbeans :-) | Uninstall a netbeans 7.0.1 plugin, netbeans doesn't start | 0.132549 | 0 | 0 | 5,598 |
8,416,370 | 2011-12-07T13:50:00.000 | 3 | 0 | 1 | 0 | python,linux,multiprocessing,hyperthreading | 8,416,582 | 4 | true | 0 | 0 | Maybe the context switches produce more overhead, caused by 6 massivly calculating processes and only 4 real cores. If the processes compete for the cpu-ressources, they may use inefficient the cpu-caches.
If you only enable 4 instead of 6 core, what's the result? | 3 | 4 | 0 | I use a simulation written in python/numpy/cython.
Since i need to average over many simulation runs i use the multiprocessing module to run all the individual simulation runs in batches.
At the office i have an i7-920 workstation with HT. At home i have an i5-560 without.
I thought i could run twice as many instances... | Running simulation with hyperthreading doubles runtime | 1.2 | 0 | 0 | 3,604 |
8,416,370 | 2011-12-07T13:50:00.000 | 5 | 0 | 1 | 0 | python,linux,multiprocessing,hyperthreading | 8,417,088 | 4 | false | 0 | 0 | Hyperthreading may be good for some kinds of workload. Intense numeric computations is not one of these - when you want to do some number crunching you better turn off hyperthreading.
What hyperthreading gives one is "free context switching" between tasks, but the CPU has only so many execution units.
In this case, it... | 3 | 4 | 0 | I use a simulation written in python/numpy/cython.
Since i need to average over many simulation runs i use the multiprocessing module to run all the individual simulation runs in batches.
At the office i have an i7-920 workstation with HT. At home i have an i5-560 without.
I thought i could run twice as many instances... | Running simulation with hyperthreading doubles runtime | 0.244919 | 0 | 0 | 3,604 |
8,416,370 | 2011-12-07T13:50:00.000 | 0 | 0 | 1 | 0 | python,linux,multiprocessing,hyperthreading | 32,604,242 | 4 | false | 0 | 0 | with my HP workstation(16 cores/cpu,using hyper-threading comes to 32 processors), turning hyper-threading on even broke python when I run the numerical simulation,the error code is 0x000005
this puzzled me a long time until I turned HT off,and the simulation works well!
maybe you could check and compare the run-time f... | 3 | 4 | 0 | I use a simulation written in python/numpy/cython.
Since i need to average over many simulation runs i use the multiprocessing module to run all the individual simulation runs in batches.
At the office i have an i7-920 workstation with HT. At home i have an i5-560 without.
I thought i could run twice as many instances... | Running simulation with hyperthreading doubles runtime | 0 | 0 | 0 | 3,604 |
8,417,488 | 2011-12-07T15:05:00.000 | 9 | 0 | 1 | 0 | python | 8,417,575 | 5 | true | 0 | 0 | Yes, re.match seems like a good match (pardon the pun). As for the regular expression, how about something like this: '[A-Za-z0-9-_]*'? | 1 | 4 | 0 | I want to check if a string only contains A-Z and a-z and 0-9 and underscore and dash (_ -)
Any other special signs like !"#\% should not be contained
How can I write the regular expression?
and use match or ?
My strings look like these: QOIWU_W QWLJ2-1 | Checking whether a string contains some characters in python | 1.2 | 0 | 0 | 13,979 |
8,417,971 | 2011-12-07T15:36:00.000 | 1 | 0 | 0 | 0 | python,django,django-models | 8,418,076 | 2 | true | 1 | 0 | django takes care of safely storing strings in the database. html is a worry when displaying to the user, and django provides some help there as well, escaping html unless explicitly told not to | 1 | 0 | 0 | I have a view in django that is going to save HTML data to a model, and I'm wondering how I might go about filtering it before saving it to the model? Are there built in functions for it? I know there are template filters, but I don't think those help me in this case.
What I'll be doing is getting the content of a div ... | Filter POST data in Django | 1.2 | 0 | 0 | 688 |
8,418,295 | 2011-12-07T15:56:00.000 | 10 | 0 | 1 | 0 | python,logical-operators | 9,472,933 | 3 | false | 0 | 0 | Logical operators are used for booleans, since true equals 1 and false equals 0. If you use (binary) numbers other than 1 and 0, then any number that's not zero becomes a one. Ex: int x = 5; (101 in binary) int y = 0; (0 in binary) In this case, printing x && y would print 0, because 101 was changed to 1, and 0 was ke... | 1 | 19 | 0 | What the different between logical operators and, or and bitwise analogs &, | in usage? Is there any difference in efficiency in various solutions? | Logical vs bitwise | 1 | 0 | 0 | 26,611 |
8,419,558 | 2011-12-07T17:17:00.000 | 2 | 0 | 1 | 1 | python,subprocess,multiprocessing | 8,420,171 | 2 | false | 0 | 0 | You could look in os.setpgid(pid, pgrp) direction. | 1 | 1 | 0 | For a Linux system, I am writing a program in Python, who spawns child processes. I am using the "multiprocessing" library and I am wondering if there is a method to call sub-processes with a different user than the current one. I'd like to be able to run each subprocess with a different user (like Postfix, for example... | In Python how to call subprocesses under a different user? | 0.197375 | 0 | 0 | 2,331 |
8,419,669 | 2011-12-07T17:23:00.000 | 5 | 0 | 0 | 0 | python,django | 8,421,524 | 2 | true | 1 | 0 | Your question starts from a premise that most Django programmers wouldn't accept: that you can or should create URLs dynamically from the database. If you're doing that, you're doing it wrong.
Your URL patterns are part of the code, not the data. Obviously, the URLs themselves are formed by combining the patterns with ... | 1 | 3 | 0 | I have a django site. Like all standard sites, it uses URLConfs to associate URLs with views. However, in addition to that, I have some URL configs which I dynamically generate from data in the database. Everything works as I would like it.
Is it possible to reload all the URLConfs while the site is running, from code?... | Dynamically reload the URLConfs for a running site | 1.2 | 0 | 0 | 203 |
8,425,089 | 2011-12-08T01:35:00.000 | 0 | 1 | 0 | 1 | python,ssh,pexpect | 8,425,184 | 2 | false | 0 | 0 | If it's a short file you can get output of ssh command using subprocess.Popen
ssh root@ip_address_of_the_server 'cat /path/to/your/file'
Note: Password less setup using keys should be configured in order for it to work. | 1 | 1 | 0 | With Python, I need to read a file into a script similar to open(file,"rb"). However, the file is on a server that I can access through SSH. Any suggestions on how I can easily do this? I am trying to avoid paramiko and am using pexpect to log into the SSH server, so a method using pexpect would be ideal.
Thanks,
Eric | Python - Read in binary file over SSH | 0 | 0 | 0 | 1,242 |
8,425,371 | 2011-12-08T02:23:00.000 | 2 | 0 | 1 | 0 | python,types,abstract-syntax-tree | 8,425,468 | 3 | false | 0 | 0 | As other posters have noted, this isn't so easy in a dynamically typed language. You can't just trace the assignment back to a static type declaration, as you can in C or Java.
However, one can often make a reasonable determination of the type.
Presumably the scoping rules allow one to determine which i (or which set ... | 2 | 4 | 0 | Suppose I want to get the type of all variables from the AST tree that I have generated from some source code -- how would I go about doing that?
For example, suppose in my source code I have something like i = 5. How would I determine, from the abstract syntax tree, that the type of i is integer?
I tried the type() fu... | How to get a type of the variable from the Python's AST? | 0.132549 | 0 | 0 | 2,649 |
8,425,371 | 2011-12-08T02:23:00.000 | 1 | 0 | 1 | 0 | python,types,abstract-syntax-tree | 8,425,382 | 3 | false | 0 | 0 | You can't, because Python's variables don't have a type. Values have types.
That's how dynamic typing works. | 2 | 4 | 0 | Suppose I want to get the type of all variables from the AST tree that I have generated from some source code -- how would I go about doing that?
For example, suppose in my source code I have something like i = 5. How would I determine, from the abstract syntax tree, that the type of i is integer?
I tried the type() fu... | How to get a type of the variable from the Python's AST? | 0.066568 | 0 | 0 | 2,649 |
8,426,196 | 2011-12-08T04:32:00.000 | 0 | 0 | 1 | 0 | java,python | 8,426,447 | 3 | false | 0 | 0 | For Pythonistas who don't know, the behaviour of Java's Class.getResource is basically: the supplied file name is (unless it's already an absolute path) transformed into a relative path by using the class' package (since the directory path to the class file is expected to mirror the explicit "package" declaration for t... | 1 | 2 | 0 | In java if I want to read a file that contains resource data for my algorithms how do I do it so the path is correctly referenced.
Clarification
I am trying to understand how in the Python world one packages data along with code in a module.
For example I might be writing some code that looks at a string and tries to c... | What is the equivalent to python equivalent to using Class.getResource() | 0 | 0 | 0 | 1,032 |
8,426,999 | 2011-12-08T06:19:00.000 | 7 | 0 | 1 | 0 | python,import,ironpython,dynamic-language-runtime | 8,434,676 | 1 | true | 0 | 1 | Yes, IronPython recompiles the imported module on every run. Twice, actually.
It's complicated.
On the first pass, the Python code is parsed into an AST, the AST is converted into a DLR expression tree, and the expression tree is stored. When it is time to execute it, the expression tree is compiled into a set of instr... | 1 | 6 | 0 | In CPython, I think, import means compile the py file to a pyc file and execute the file in the current frame, and the next time CPython will load the pyc file directly without compiling again. What about import in ironpython? I guess ironpython don't have a pyc-like format. Does it compile every time when import? | What happens when import a module in ironpython? | 1.2 | 0 | 0 | 499 |
8,427,709 | 2011-12-08T07:39:00.000 | 20 | 0 | 1 | 1 | python,virtualenv | 21,462,720 | 2 | false | 0 | 0 | First the user creates a new virtualenv with the command virtualenv myenv. This creates a directory called myenv and copies the system python binary to myenv/bin. It also adds other necessary files and directories to myenv, including a setup script in bin/activate and a lib subdirectory for modules and packages.
Then t... | 1 | 62 | 0 | I checked the activate script and it looks to me all it does is:
set VIRTUAL_ENV env
append $VIRTUAL_ENV/bin in front of PATH
How does virtualenv provide that magical virtual environment by these? What do I miss? | How does virtualenv work? | 1 | 0 | 0 | 18,494 |
8,428,102 | 2011-12-08T08:23:00.000 | -2 | 0 | 0 | 0 | python,file-upload,selenium,attachment | 24,584,170 | 7 | false | 0 | 0 | it is quite simple, just record it using IDE. Upload command is working | 1 | 3 | 0 | Is it possible to upload file attachment with selenium in Python script? | Upload file with Selenium in Python | -0.057081 | 0 | 1 | 7,807 |
8,431,451 | 2011-12-08T13:07:00.000 | 4 | 0 | 0 | 0 | c++,python,sql,sqlite | 8,431,705 | 2 | false | 0 | 0 | Use the second (more normalized) approach.
You could even get away with fewer tables than you mentioned:
tblNutrients
-- NutrientID
-- NutrientName
-- NutrientUOM (unit of measure)
-- Otherstuff
tblFood
-- FoodId
-- FoodName
-- Otherstuff
tblFoodNutrients
-- FoodID (FK)
-- NutrientID (FK)
-- UOMCount
It will b... | 1 | 2 | 0 | I am parsing the USDA's food database and storing it in SQLite for query purposes. Each food has associated with it the quantities of the same 162 nutrients. It appears that the list of nutrients (name and units) has not changed in quite a while, and since this is a hobby project I don't expect to follow any sudden c... | How to store data with large number (constant) of properties in SQL | 0.379949 | 1 | 0 | 373 |
8,432,620 | 2011-12-08T14:35:00.000 | 0 | 0 | 0 | 0 | python,sqlite,pyqt,qtreewidget,qtreewidgetitem | 14,873,799 | 2 | false | 0 | 1 | I managed this by using the data property of the TreewidgetItem by setting a value in it. Using that value as a reference to find one or more or even all TreewidgetItem(s) makes it easy to save a complete tree. | 1 | 2 | 0 | I'm working on a project that contains a QTreeWidget. This widget will have Parent nodes with childs nodes and or other siblings nodes. Attached to each node will be a unique ID in the form of an integer as well as a name.
Now..... what methods can or should I use to save all the nodes in the QTreeWidget to disk and... | QTreeWidget and PyQt: Methods to save and read data back in from file | 0 | 0 | 0 | 2,266 |
8,433,881 | 2011-12-08T16:04:00.000 | 0 | 1 | 0 | 1 | python,ruby,rubygems,pip | 8,507,138 | 1 | false | 1 | 0 | I think you should raise your problem about gem/debian and what are you going to do with it specially.
I am using pip and debian now and still no problem by now. | 1 | 5 | 0 | I mostly do work in Python, but I have been using some of the Ruby stuff for Server Configuration Management (ie Puppet and Chef). I also use Ubuntu/Debian as my primary Linux distro for servers.
Why is there a weird Debian/Ruby conflict over Gems, and not a similar showdown between Debian/Python over Pip?
Personally,... | Python Pip vs Ruby Gems | 0 | 0 | 0 | 3,102 |
8,434,838 | 2011-12-08T17:11:00.000 | 0 | 0 | 1 | 0 | python,functional-programming,lambda | 8,434,991 | 7 | false | 0 | 0 | They are useful when you need a short function to compare two items or perform some other operation, and this will be passed as an argument, and there is no need for the function to have a name because it is only used as an argument.
They are useful when the function, written as a lambda, is shorter than the def line y... | 2 | 4 | 0 | I met lambda expressions in Python. I have seen already many easy examples (including examples on SE) where lambda expressions produce functions like adders of whatever but I can't see the real usefulness of them yet, e.g. some example where it would be pain to write the same peace of code without lambdas.
Could you sh... | Example where lambdas are very useful in Python | 0 | 0 | 0 | 420 |
8,434,838 | 2011-12-08T17:11:00.000 | 2 | 0 | 1 | 0 | python,functional-programming,lambda | 8,435,157 | 7 | false | 0 | 0 | Instead of suggesting anything out here I would recommend to visit the lib directory of your Python Installation and grep for lambda. You will get enough examples to satisfy your appetite. | 2 | 4 | 0 | I met lambda expressions in Python. I have seen already many easy examples (including examples on SE) where lambda expressions produce functions like adders of whatever but I can't see the real usefulness of them yet, e.g. some example where it would be pain to write the same peace of code without lambdas.
Could you sh... | Example where lambdas are very useful in Python | 0.057081 | 0 | 0 | 420 |
8,436,112 | 2011-12-08T18:54:00.000 | 2 | 0 | 0 | 0 | .net,python,windows-phone-7 | 8,436,266 | 1 | true | 0 | 1 | Only (some) mananged .net languages are supported on Windows Phone (note. this is not the same as Windows Mobile).
IronPython is the only option available to you when it comes to executing python code on the phone. | 1 | 0 | 0 | Can I execute Python on Windows Phone? I have heard about IronPython but is it the way to go when I need to compile to a lot of existing Python code for Windows Mobile? | Python on Windows Phone? | 1.2 | 0 | 0 | 967 |
8,437,213 | 2011-12-08T20:25:00.000 | 1 | 0 | 0 | 0 | mysql,mongodb,mysql-python | 8,437,321 | 3 | true | 0 | 0 | MySQL(SQL) or MongoDB(NoSQL), both can work for your needs. but idea behind using RDBMS/NoSQL is the requirement of your application
if your application care about speed and no relation between the data is necessary and your data schema changes very frequently, you can choose MongoDB, faster since no joins needed, e... | 2 | 1 | 0 | I have a question about making the decision whether to use MySQL database or Mongo database, the problem with my decision is that I am highly depending on these things:
I want to select records between two dates (period)
However is this possible?
My Application won't do any complex queries, just basic crud. It has Fa... | MongoDB or MySQL database | 1.2 | 1 | 0 | 295 |
8,437,213 | 2011-12-08T20:25:00.000 | 3 | 0 | 0 | 0 | mysql,mongodb,mysql-python | 8,437,280 | 3 | false | 0 | 0 | Either DB will allow you to filter between dates and I wouldn't use that requirement to make the decision. Some questions you should answer:
Do you need to store your data in a relational system, like MySQL? Relational databases are better at cross entity joining.
Will your data be very complicated, but you will only... | 2 | 1 | 0 | I have a question about making the decision whether to use MySQL database or Mongo database, the problem with my decision is that I am highly depending on these things:
I want to select records between two dates (period)
However is this possible?
My Application won't do any complex queries, just basic crud. It has Fa... | MongoDB or MySQL database | 0.197375 | 1 | 0 | 295 |
8,438,815 | 2011-12-08T22:48:00.000 | 1 | 0 | 1 | 0 | python,linux,multithreading | 8,439,255 | 2 | false | 0 | 0 | If you want multiple threads to read directly from the same folder several files in parallel, then I must disappoint you. Reading in parallel from a single disk is not a viable option. A single disk needs to spin and seek the next location to be read. If you're reading with multiple threads, you are just bouncing the d... | 1 | 0 | 0 | My projects needs multiple threads reading files from the same folder. This folder has incoming files and the file should only be processed by any one of those threads. Later, this file reading thread, deletes the file after processing it.
EDIT after the first answer: I don't want a single thread in charge of reading f... | Multiple threads reading from single folder on Linux | 0.099668 | 0 | 0 | 921 |
8,440,284 | 2011-12-09T02:21:00.000 | 13 | 0 | 0 | 0 | python,excel,xlsx,openpyxl | 25,555,701 | 9 | false | 0 | 0 | As of openpyxl 2.0, styles are immutable.
If you have a cell, you can (e.g.) set bold text by:
cell.style = cell.style.copy(font=cell.style.font.copy(bold=True))
Yes, this is annoying. | 1 | 46 | 0 | I need advice on setting styles in Openpyxl.
I see that the NumberFormat of a cell can be set, but I also require setting of font colors and attributes (bold etc). There is a style.py class but it seems I can't set the style attribute of a cell, and I don't really want to start tinkering with the openpyxl source code.
... | Setting styles in Openpyxl | 1 | 0 | 0 | 102,834 |
8,441,203 | 2011-12-09T04:49:00.000 | 4 | 0 | 1 | 0 | python,scipy | 8,444,068 | 1 | true | 0 | 0 | Some of the libraries that scipy links to are quite large, especially the linear algebra libraries. On slow disks or network file systems, simply loading these libraries into memory takes a long time. However, once they are read, they go into the filesystem cache so subsequent loads are pretty fast. You will have to do... | 1 | 2 | 0 | I am using scipy intensively for various purposes. I have noticed that the first time the python code is compiled, it starts very slow. later on, it is very fast.Is there any work around for this trouble? | scipy starts slow for the first time | 1.2 | 0 | 0 | 106 |
8,443,994 | 2011-12-09T10:14:00.000 | 3 | 1 | 0 | 1 | python,twisted | 8,445,796 | 1 | true | 0 | 0 | Serve all those services needed
Yes.
Do it in a non-blocking fashion (it should, according to docs, but if someone could elaborate, I'd be grateful)
Twisted's uses the common reactor model. I/O goes through your choice of poll, select, whatever to determine if data is available. It handles only what is available, an... | 1 | 1 | 0 | I have an interesting project going on at our workplace. The task, that stands before us, is such:
Build a custom server using Python
It has a web server part, serving REST
It has a FTP server part, serving files
It has a SMTP part, which receives mail only
and last but not least, a it has a background worker that man... | Compound custom service server using Twisted | 1.2 | 0 | 0 | 216 |
8,449,501 | 2011-12-09T17:39:00.000 | 0 | 0 | 0 | 0 | python,matlab,random,permutation | 8,450,596 | 3 | false | 0 | 0 | Both solutions above are great, and will work, but I believe both will involve making a completely new copy of the entire matrix in memory while doing the work. Since this is a huge matrix, that's pretty painful. In the case of the MATLAB solution, I think you'll be possibly creating two extra temporary copies, dependi... | 1 | 0 | 1 | I have a large matrix (approx. 80,000 X 60,000), and I basically want to scramble all the entries (that is, randomly permute both rows and columns independently).
I believe it'll work if I loop over the columns, and use randperm to randomly permute each column. (Or, I could equally well do rows.) Since this involves a... | matlab: randomly permuting rows and columns of a 2-D array | 0 | 0 | 0 | 2,124 |
8,451,426 | 2011-12-09T20:37:00.000 | 3 | 0 | 1 | 0 | python | 8,451,487 | 4 | false | 0 | 0 | Install pip and do pip freeze.
If you are using virtualenv, it is already installed in it. | 1 | 3 | 0 | For example, in rails you can do a 'gem list' and it will show all of the gems that you have installed.
Any clue how I can do this in python? Also, I am using virtualenv, not sure if that helps? | How do I list the libraries that exist in python? | 0.148885 | 0 | 0 | 881 |
8,453,362 | 2011-12-10T00:25:00.000 | 0 | 0 | 0 | 0 | python,interface,upload,web | 8,453,549 | 2 | false | 0 | 1 | I would recommend you look at something like Django and mod_wsgi.
Generally helps if you have shell access to the server. | 1 | 0 | 0 | I am a beginner in python. For practice reasons I want to learn how to upload a python code to a website.
I have a domain and web hosting service, however I'm really confused about how to integrate my code with a
web page on my website.
(I have a decent bit of knowledge with Tkinter)
Can anybody show me how to upload t... | Simple python code to website | 0 | 0 | 0 | 3,068 |
8,453,615 | 2011-12-10T01:15:00.000 | 31 | 0 | 1 | 0 | python,function,built-in | 8,453,620 | 1 | true | 0 | 0 | It's an abbreviation for "ordinal". Ordinal numbers are counting numbers -- i.e., 1, 2, 3. ord() converts the character into its (countable) position in the character set. | 1 | 16 | 0 | python has a built-in function ord(), I think it must be a anbbreviation. Just like another built-in function chr(), which is an abbreviation of the word "character". Does anyone know the word that built-in function ord() abbreviate for? | Does anyone know the word that built-in function ord() abbreviate for? | 1.2 | 0 | 0 | 2,646 |
8,453,871 | 2011-12-10T02:08:00.000 | 2 | 0 | 0 | 0 | python,tkinter | 8,458,598 | 2 | false | 0 | 1 | You could create one by drawing the individual parts of the widget on a canvas. It's pretty easy to add bindings for dragging things around. | 1 | 3 | 0 | How can I build a range slider from which I can get the range of two values, e.g., min and max? The scale widget seems not meet this requirement. I can only get one value from it and I don't want to use two scale to do this.
Thanks | How to build a range slider using tkinter? | 0.197375 | 0 | 0 | 1,222 |
8,454,339 | 2011-12-10T04:15:00.000 | 1 | 0 | 1 | 1 | python,ubuntu,module | 8,454,391 | 2 | false | 0 | 0 | python is gonna check if there is a $PYTHONPATH environment variable set. Use that for the path of your other modules.
use export PYTHONPATH="path:locations" | 1 | 0 | 0 | I have a system python installation and a personal python installation in my home directory. My personal python comes in ahead in my $PATH and I usually run that. But the system python installation has some modules that I want to use with my personal python installation.
So, basically, I want to append the sys.path of ... | Append system python installation's sys.path to my personal python installation | 0.099668 | 0 | 0 | 717 |
8,455,516 | 2011-12-10T09:11:00.000 | 2 | 0 | 0 | 0 | python,pygtk,glade | 8,456,076 | 1 | true | 0 | 1 | If you use a gtk.Table to display your widgets in your dialog. You can set the homogeneous property to False, so that cells in the table don't have the same dimensions.
After that, if the largest widget in the second column is wider than the largest widget in the first column (which I assume is your case), then the sec... | 1 | 2 | 0 | I'm building simple PyGTK app with Glade.
In one dialog I have table layout with labels in first column, and text entries in second column.
The problem is that two columns have always same width, and I want 2nd column to be wider then the first one.
How can I achieve that? | Setting separate GtkTable column width | 1.2 | 0 | 0 | 1,466 |
8,456,886 | 2011-12-10T13:38:00.000 | 4 | 0 | 0 | 0 | python,security,flask | 8,461,239 | 4 | false | 1 | 0 | If I can enter a username and email address, then I can get a reset token for any user of your service emailed to me. Maybe you should check that the email address is one that actually belongs to the user whose password is going to be reset. | 3 | 2 | 0 | Is there anything wrong with this procedure?
Enter in username and email in a reset form.
Flask creates a really long random string and stores it into the session under "reset_code". Session will also have a key for "reset_pw_username"
Flask sends an email with a link to the path /password_reset/reset_pw_username/res... | Is there anything wrong with this password reset procedure? | 0.197375 | 0 | 0 | 647 |
8,456,886 | 2011-12-10T13:38:00.000 | 1 | 0 | 0 | 0 | python,security,flask | 8,463,756 | 4 | false | 1 | 0 | As Jean-Paul pointed out, asking for both username and e-mail requires checking whether they both match the same user. Hence it is more common to ask for either username or e-mail, verifying they are in your database, and sending recovery link to appropriate address.
Storing the recovery token in session data will lik... | 3 | 2 | 0 | Is there anything wrong with this procedure?
Enter in username and email in a reset form.
Flask creates a really long random string and stores it into the session under "reset_code". Session will also have a key for "reset_pw_username"
Flask sends an email with a link to the path /password_reset/reset_pw_username/res... | Is there anything wrong with this password reset procedure? | 0.049958 | 0 | 0 | 647 |
8,456,886 | 2011-12-10T13:38:00.000 | 0 | 0 | 0 | 0 | python,security,flask | 10,258,232 | 4 | false | 1 | 0 | The best solution is use email address as username,then user just have to remember his email address.And you just only have to validate user's email address. | 3 | 2 | 0 | Is there anything wrong with this procedure?
Enter in username and email in a reset form.
Flask creates a really long random string and stores it into the session under "reset_code". Session will also have a key for "reset_pw_username"
Flask sends an email with a link to the path /password_reset/reset_pw_username/res... | Is there anything wrong with this password reset procedure? | 0 | 0 | 0 | 647 |
8,457,110 | 2011-12-10T14:15:00.000 | 1 | 0 | 0 | 0 | python,r,matlab,matrix,numpy | 8,458,779 | 3 | false | 0 | 0 | It's not entirely clear what you're trying to achieve, but in R, you use crossprod to form cross-products: given matrices X and Y with compatible dimensions, crossprod(X, Y) returns XTY. Similarly, matrix multiplication is achieved with the %*% operator: X %*% Y returns the product XY. So you can get XTAY as crossprod(... | 1 | 6 | 1 | Given any n x n matrix of real coefficients A, we can define a bilinear form bA : Rn x Rn → R by
bA(x, y) = xTAy ,
and a quadratic form qA : Rn → R by
qA(x) = bA(x, x) = xTAx .
(For most common applications of quadratic forms qA, the matrix A is symmetric, or even symmetric positive definite, so feel free to assume... | How to vectorize the evaluation of bilinear & quadratic forms? | 0.066568 | 0 | 0 | 3,364 |
8,460,135 | 2011-12-10T21:45:00.000 | 1 | 0 | 1 | 0 | python,binary,io,python-3.x | 8,460,302 | 3 | false | 0 | 0 | Once you created the binary data, you just write it to a file opened in binary mode. That's all there is to it. No compatibility problems between Python 2 and 3 there at all.
Subclassing BufferedWriter is completely unecessary.
How you create the data is a different question, but again there I don't see any obvious inc... | 1 | 0 | 0 | I am writing a program that needs to write a binary file. In contains a header of strings (key-value pairs) and numeric data (which can be little-endian or big-endian) and I am looking for a way to write a program that runs unchanged in Python 2.6+ and Python 3.2+.
Can anyone suggest some best practices? Additionally, ... | Writing binary files in Python 2.6+ and 3 | 0.066568 | 0 | 0 | 1,091 |
8,461,306 | 2011-12-11T01:36:00.000 | 0 | 1 | 0 | 1 | python,database,database-performance,pyinotify | 8,463,655 | 3 | false | 0 | 0 | You could try Redis. It is most certainly fast.
But really, since you're tracking a filesystem, and disks are slow as snails in comparison to even a medium-fast database, performance shouldn't be your primary concern. | 1 | 0 | 0 | I'm tracking a linux filesystem (that could be any type) with pyinotify module for python (which is actually the linux kernel behind doing the job). Many directories/folders/files (as much as the user want to) are being tracked with my application and now i would like track the md5sum of each file and store them on a d... | most performatic free database for file system tracking | 0 | 0 | 0 | 1,214 |
8,461,764 | 2011-12-11T03:28:00.000 | 0 | 0 | 0 | 0 | c#,javascript,python,scripting,browser | 8,461,984 | 2 | false | 1 | 0 | If you look at the HTTP request header you can determine the user-agent making the request. Based upon that information you can write logic from the server side as to respond with a unique page per detected user-agent string. Then you add any unique JavaScript you want as a static string to be executed by the user-ag... | 1 | 1 | 0 | Is there a way using either C# or a scripting language, such as Python, to load up a website in the user's default webbrowser and continue to interact it via code (e.g. invoke existing Javascript methods)? When using WinForms, you can host a Webbrowser control and invoke scripts from there, but only IE is supported. Is... | Invoke javascript methods on a page | 0 | 0 | 0 | 119 |
8,462,449 | 2011-12-11T06:57:00.000 | 7 | 0 | 1 | 0 | python,string,file,case-insensitive | 8,462,460 | 4 | true | 0 | 0 | You could list the directory the file's in (os.listdir), and see if there are matches for your filename. The matching can be done by lower-casing both filenames and comparing. | 2 | 10 | 0 | I need to load a file given it's name, but the name I get is case insensitive. "A.txt" could actually be "a.txt". How to do this the fast way (not generate all possible names and try each)? | Python case insensitive file name? | 1.2 | 0 | 0 | 17,560 |
8,462,449 | 2011-12-11T06:57:00.000 | 1 | 0 | 1 | 0 | python,string,file,case-insensitive | 8,462,612 | 4 | false | 0 | 0 | Make a directory listing; and create a dictionary containing a mapping of upper-case filenames to their actual-case filenames. Then, make your input upper-case, and look for it in the dictionary. | 2 | 10 | 0 | I need to load a file given it's name, but the name I get is case insensitive. "A.txt" could actually be "a.txt". How to do this the fast way (not generate all possible names and try each)? | Python case insensitive file name? | 0.049958 | 0 | 0 | 17,560 |
8,466,425 | 2011-12-11T18:38:00.000 | 0 | 0 | 0 | 0 | python,mysql,api,frameworks | 8,466,481 | 3 | false | 1 | 0 | Depends on what stage you are at, I would suggest to develop 2 systems because the load to pull data from 3rd party and the load to handle the API would be different. You can scale them into a different types of nodes if you want.
Django-Tastypie (https://github.com/toastdriven/django-tastypie) is not bad, it supports... | 2 | 3 | 0 | I am working on developing two systems:
A system that will constantly retrieve economic data from a 3rd party data feed and push it into a MySQL DB (using sqlalchemy)
A server that will allow anyone to query the data in the db over a JSON AJAX API (similar to Yelp or Yahoo API for example)
I have two main quest... | Best Python Web Framework for my API Server Needs | 0 | 0 | 0 | 1,477 |
8,466,425 | 2011-12-11T18:38:00.000 | 0 | 0 | 0 | 0 | python,mysql,api,frameworks | 13,210,600 | 3 | false | 1 | 0 | I agree with Anthony, you should look at Web2Py. It is very easy to get started, very low learning cure and easy to deploy on many systems including Linux, Windows and Amazon.
So far I have found nothing that Web2Py can not do. But more importantly it does things how you would think they should be done, so if you are n... | 2 | 3 | 0 | I am working on developing two systems:
A system that will constantly retrieve economic data from a 3rd party data feed and push it into a MySQL DB (using sqlalchemy)
A server that will allow anyone to query the data in the db over a JSON AJAX API (similar to Yelp or Yahoo API for example)
I have two main quest... | Best Python Web Framework for my API Server Needs | 0 | 0 | 0 | 1,477 |
8,466,460 | 2011-12-11T18:43:00.000 | 3 | 0 | 1 | 0 | python,unicode,utf-8,ansi | 8,466,564 | 2 | false | 0 | 0 | Notepad saves Unicode files with a byte order mark. This means that the first bytes of the file will be:
EF BB BF -- UTF-8
FF FE -- "Unicode" (actually UTF-16 little-endian, looks like)
FE FF -- "Unicode big-endian" (looks like UTF-16 big-endian)
Other text editors may or may not have the same behavior, but if you kn... | 1 | 2 | 0 | I have to write a script that support reading of a file which can be saved as either Unicode or Ansi (using MS's notepad).
I don't have any indication of the encoding format in the file, how can I support both encoding formats? (kind of a generic way of reading files with out knowing the format in advanced). | how to read a file that can be saved as either ansi or unicode in python? | 0.291313 | 0 | 0 | 21,589 |
8,466,851 | 2011-12-11T19:37:00.000 | 2 | 0 | 0 | 0 | python,django,forms,validation,authentication | 8,473,116 | 4 | true | 1 | 0 | I would definitely go with validating on the form. You could even go as far as having more form validation in the admin if you felt like it. | 1 | 11 | 0 | I'm trying to make sure that the first name and last name field are not optional for the auth User model but I'm not sure how to change it. I can't use a sub class as I have to use the authentication system.
Two solutions I can think of are:
to put the name in the user profile but it's a little silly to have a field t... | Making first name, last name a required attribute rather than an optional one in Django's auth User model | 1.2 | 0 | 0 | 5,078 |
8,467,700 | 2011-12-11T21:38:00.000 | 15 | 0 | 0 | 0 | python,web-scraping,scrapy | 8,468,824 | 4 | true | 1 | 0 | Partially fill your item on the first page, and the put it in your request's meta. When the callback for the next page is called, it can take the partially filled request, put more data into it, and then return it. | 1 | 21 | 0 | Need example in scrapy on how to get a link from one page, then follow this link, get more info from the linked page, and merge back with some data from first page. | How do I merge results from target page to current page in scrapy? | 1.2 | 0 | 0 | 10,013 |
8,468,427 | 2011-12-11T23:38:00.000 | 1 | 0 | 0 | 0 | python,ajax,django | 8,468,548 | 4 | false | 1 | 0 | User agent sniffing and the like is not seen as the best solution... if you can afford that, rather use projects like hasjs on client side to check what the user's browser really is capable and send the information to the server somehow (like, serving the checking page when there is no session, let it do the checks and... | 2 | 0 | 0 | In my Django application I would like to know if the browser the client is using has AJAX or not. This is because I have, for example, profile editing. I have a version that edits the user's profile in-place and another one that redirects you to an edit page.
I know that most browsers have AJAX nowadays, but just to ma... | How to know if browser has AJAX (Django) | 0.049958 | 0 | 0 | 476 |
8,468,427 | 2011-12-11T23:38:00.000 | 0 | 0 | 0 | 0 | python,ajax,django | 8,552,739 | 4 | false | 1 | 0 | I haven't foun a way to do this, therefore what I could do was prepare a JavaScript-free version and a JavaScript version of my template.
I load a .js file, and it replaces all the links to other pages with AJAX links. Therefore, if the user doesn't have JavaScript he will see all the original links and functionality, ... | 2 | 0 | 0 | In my Django application I would like to know if the browser the client is using has AJAX or not. This is because I have, for example, profile editing. I have a version that edits the user's profile in-place and another one that redirects you to an edit page.
I know that most browsers have AJAX nowadays, but just to ma... | How to know if browser has AJAX (Django) | 0 | 0 | 0 | 476 |
8,469,272 | 2011-12-12T02:24:00.000 | 1 | 0 | 1 | 0 | python,web,memory,python-internals | 8,469,523 | 3 | false | 0 | 0 | I would implement this as a C module that gets imported into each Python script. Then the interface to this large object would be implemented in C, or some combination of C and Python. | 2 | 14 | 0 | Here's the situation: I have a massive object that needs to be loaded into memory. So big that if it is loaded in twice it will go beyond the available memory on my machine (and no, I can't upgrade the memory). I also can't divide it up into any smaller pieces. For simplicity's sake, let's just say the object is 600 MB... | How do I store a Python object in memory for use by different processes? | 0.066568 | 0 | 0 | 11,973 |
8,469,272 | 2011-12-12T02:24:00.000 | 2 | 0 | 1 | 0 | python,web,memory,python-internals | 8,469,534 | 3 | false | 0 | 0 | There must be someway to store a Python object in memory (and not as a
file/string/serialized/pickled) and have it be accessible from any
process.
That isn't the way in works. Python object reference counting and an object's internal pointers do not make sense across multiple processes.
If the data doesn't have t... | 2 | 14 | 0 | Here's the situation: I have a massive object that needs to be loaded into memory. So big that if it is loaded in twice it will go beyond the available memory on my machine (and no, I can't upgrade the memory). I also can't divide it up into any smaller pieces. For simplicity's sake, let's just say the object is 600 MB... | How do I store a Python object in memory for use by different processes? | 0.132549 | 0 | 0 | 11,973 |
8,469,596 | 2011-12-12T03:18:00.000 | 2 | 0 | 0 | 0 | python,admin,web-frameworks,flask,wtforms | 8,481,615 | 3 | true | 1 | 0 | The short answer is no, as far as I know, there is no auto-generating ORM for redis or MongoDB.
Now for a more detailed explanation:
The reason why there exists CRUD generation for 'fixed' ORM's and not datastores based in free-form records is simple: the very nature of free-form records makes it difficult to create a ... | 1 | 5 | 0 | are there any generic CRUD admin for Flask based on WTForms?
Currently we are building a hybrid backend system where admin must CRUD lots of data from various source, MongoDB, Redis, ini file, ENVIRON, etc. Writing specific admin view for each of them seems a waste of time, but all Flask admin or WTForms admin solution... | Generic CRUD admin for Flask, with WTForms? | 1.2 | 0 | 0 | 6,567 |
8,472,282 | 2011-12-12T09:33:00.000 | 1 | 0 | 0 | 0 | python,django,user-interface,web | 8,474,771 | 1 | true | 1 | 0 | The only way to make something like that possible would be to load the application into memory, interact with it and render the presentation. Consider something like having a application that can parse a HTML document, instantiate and provides access to the DOM elements in memory so that you can modify their properties... | 1 | 1 | 0 | Is it possible to access a standalone GUI-based application over the Web? The concerned application is an event animator, which displays the animation based on custom textual inputs.
I don't wish to access that software through any remote desktop connection (or web meeting) like option. I actually intend to integrate t... | Access standalone GUI application through Web | 1.2 | 0 | 0 | 343 |
8,473,712 | 2011-12-12T11:38:00.000 | 2 | 0 | 0 | 0 | python,google-app-engine,webapp2 | 8,474,190 | 1 | true | 1 | 0 | Your approach is appropriate. According to the newest documentation you can even define post and get as functions outside request handler and just as other functions in your module and that's a way I would choose since it eliminates problems that can happen when instanciating request handlers.
If starting a new app fro... | 1 | 1 | 0 | I'm using python to develop a web app.
I defined both "get" and "post" method in the same request handler to serve different purpose. That is, I use "get" method to present a form to user, and "post" method to handle the submitted form.
It works fine, but is this approach appropriate? Or should I better define get and ... | Defining both post and get method under same request handler | 1.2 | 0 | 1 | 546 |
8,475,252 | 2011-12-12T13:43:00.000 | 2 | 0 | 1 | 0 | python | 8,475,344 | 2 | true | 0 | 0 | I can't think of anything appropriate. Reiterable sounds like a nice term, why not define it clearly in your documentation then use it? | 1 | 6 | 0 | I'm trying to improve my documentation. I want to say that this function accepts something that is a collections.Iterable, but the code will iterate over the iterable many times. A "list" is too specific, and an "iterable" doesn't work because some iterables can only be iterated once.
Is there a name for a thing? "R... | Python name of iterable that can be iterated many times | 1.2 | 0 | 0 | 167 |
8,477,860 | 2011-12-12T16:56:00.000 | 1 | 0 | 0 | 0 | python,django,forms,html-rendering | 8,477,897 | 2 | false | 1 | 0 | if you have foreign keys to tables with a large number of rows, it's worth remembering that the default widget for each is a dropdown (<select>) with each row ('s unicode) as a choice. these often get enormous and it's worth looking at options (like the admin's raw_id_field) | 1 | 0 | 0 | I have a ModelForm based on a gigantic 300 fields model. Actually one model with 150 fields inheriting from another one with 150 other.
I was expecting the model to cause some issues at syncdb or save(), but it works fine.
However, calling the form based on this model as_p() method just take forever. I can wait 10 minu... | Why does this Django form rendering taking forever? | 0.099668 | 0 | 0 | 105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.