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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
20,539,915 | 2013-12-12T09:44:00.000 | 0 | 0 | 1 | 0 | python,numpy,spyder | 54,549,756 | 2 | false | 0 | 0 | This Spyder looks wery nice IDE, but I'd prefer real gray dashed indent lines.
I saw these were already done for a dev version, are there some issues why not to add this feature also to the offical version? | 1 | 3 | 0 | I am using Spyder for some Numpy work currently and python's indentation mechaninc is confusing me a little. It would be really helpful if I could have some color coding for each indentation level or some dotted lines (like in notepad++). Is there a way to turn such a feature on, or any plugins I can use? | Colorcode the indents level / visual indication in Spyder | 0 | 0 | 0 | 800 |
20,543,708 | 2013-12-12T12:34:00.000 | 0 | 0 | 1 | 0 | python,security,token,m2crypto,pkcs#11 | 41,831,467 | 1 | false | 0 | 0 | using PKCS#11, the only way to store 'home made' data, it through the use of a CKO_DATA object type. Like any object, it can be persistent on the token (not lost when the token is powered off) or it can be a memory object (lost when the session to the token is closed).
To create a CKO_DATA object is similar to any othe... | 1 | 2 | 0 | Is it possible to save a value in a security token memory by using PyKCS11 and M2Crypto?
I need to save an integer to token memory, so that the value can be carried out with the token
I know how to create objects, but is it possible to create attributes in a token, so whenever I read that attribute I will know the stat... | How to save a temporary value in a security token? | 0 | 0 | 0 | 203 |
20,544,190 | 2013-12-12T12:55:00.000 | 1 | 0 | 0 | 0 | python,user-interface,pyqt4 | 20,544,425 | 2 | false | 0 | 1 | You could have two TextEdit's, one that is set to readonly that displays the full text and a smaller one below it for entering text to append to the one above. | 2 | 1 | 0 | I am working on a personal project in Python that involves creating a user-interface. For that purpose, I have chosen to go with PyQt4.
As part of the GUI code, I need a widget in which we can append text but the requirement is that it should not allow to be edited. A QtGui.QTextEdit would solve the purpose of appendin... | What is the ideal widget in PyQt4 in which we can append text but cannot edit it after the text gets populated? | 0.099668 | 0 | 0 | 69 |
20,544,190 | 2013-12-12T12:55:00.000 | 1 | 0 | 0 | 0 | python,user-interface,pyqt4 | 20,544,331 | 2 | true | 0 | 1 | Edited by who ?
If you don't want that a user can edit it, I think you just need to set the QTextEdit as readonly with QTextEdit.setReadOnly(True)
If you don't want to edit again from the code, I think you just need to check if the control has some text in it: if no, add the text otherwise return an error (or whatever ... | 2 | 1 | 0 | I am working on a personal project in Python that involves creating a user-interface. For that purpose, I have chosen to go with PyQt4.
As part of the GUI code, I need a widget in which we can append text but the requirement is that it should not allow to be edited. A QtGui.QTextEdit would solve the purpose of appendin... | What is the ideal widget in PyQt4 in which we can append text but cannot edit it after the text gets populated? | 1.2 | 0 | 0 | 69 |
20,546,307 | 2013-12-12T14:34:00.000 | 2 | 0 | 0 | 0 | python,ios,push-notification,apple-push-notifications | 20,547,161 | 1 | false | 0 | 0 | First you should realize there's a difference between invalid tokens (tokens that were never valid in the current push environment) and tokens belonging to devices from which your app was uninstalled.
If all the device tokens in your DB were received from the APN service and you didn't mix production and sandbox tokens... | 1 | 3 | 0 | I have 10,000,000 device tokens for APNs.
But the token where collected from 2011, and some people probably deleted the app since then.
Therefore many tokens may have become invalid.
I want to filter these invalid tokens. How can I do that?
I tried the pyapns==0.4.0 , but check is slow, maybe there's a bug.
I use the
... | How to quickly test the validity of device token for APNs? | 0.379949 | 0 | 0 | 2,388 |
20,547,049 | 2013-12-12T15:08:00.000 | 0 | 0 | 1 | 0 | python,debugging,console,interactive | 34,922,501 | 6 | true | 0 | 0 | You can do all this in the iPython Notebook. Use the magic command %pdb to stop on error. | 1 | 9 | 0 | I've recently moved from Matlab to Python. Python is a much better language (from the point of view of a computer scientist), but Python IDEs all seem to lack one important thing:
A proper interactive debugger.
I'm looking for:
The ability to set breakpoints graphically by clicking next to a line of code in the editor... | In Python, how do I debug with an interactive command line (and visual breakpoints?) | 1.2 | 0 | 0 | 4,947 |
20,552,495 | 2013-12-12T19:30:00.000 | 6 | 0 | 1 | 0 | python,math,floating-point | 20,552,706 | 4 | true | 0 | 0 | A correctly implemented ceil returns the exact mathematical value of ceil(x), with no error. When IEEE 754, or any reasonable floating-point system, is in use, ceil is not subject to rounding errors.
This does not prevent adverse effects from sources other than the ceil function. For example, ceil(1.0000000000000000000... | 3 | 3 | 0 | If I have a floating point number x, which is within the range of [0, 106], is it guaranteed in Python that int(ceil(x)) will be rounded up correctly?
It seems possible from what little I know that ceil may be rounded down leading to an incorrect result. Something like: x = 7.6, ceil(x)=7.999.., int(ceil(x))=7. Can tha... | Is int(ceil(x)) well-behaved? | 1.2 | 0 | 0 | 337 |
20,552,495 | 2013-12-12T19:30:00.000 | 0 | 0 | 1 | 0 | python,math,floating-point | 20,552,779 | 4 | false | 0 | 0 | It's often the case that there's rounding errors in floating point numbers, but that's only because not all numbers that are reprensentable in decimal are perfectly represented in binary. Those numbers that can be represented exactly won't have any rounding applied. That is the case for integer values up to 2**53, so w... | 3 | 3 | 0 | If I have a floating point number x, which is within the range of [0, 106], is it guaranteed in Python that int(ceil(x)) will be rounded up correctly?
It seems possible from what little I know that ceil may be rounded down leading to an incorrect result. Something like: x = 7.6, ceil(x)=7.999.., int(ceil(x))=7. Can tha... | Is int(ceil(x)) well-behaved? | 0 | 0 | 0 | 337 |
20,552,495 | 2013-12-12T19:30:00.000 | 3 | 0 | 1 | 0 | python,math,floating-point | 20,552,869 | 4 | false | 0 | 0 | Python's guarantee about the floating-point format for float isn't very strict. I think all it says is that it uses double, and in the case of CPython that's whatever the C compiler calls double.
For numbers up to a million you're fine. No floating-point format in practical use loses precision for integers that small. ... | 3 | 3 | 0 | If I have a floating point number x, which is within the range of [0, 106], is it guaranteed in Python that int(ceil(x)) will be rounded up correctly?
It seems possible from what little I know that ceil may be rounded down leading to an incorrect result. Something like: x = 7.6, ceil(x)=7.999.., int(ceil(x))=7. Can tha... | Is int(ceil(x)) well-behaved? | 0.148885 | 0 | 0 | 337 |
20,557,627 | 2013-12-13T01:36:00.000 | -1 | 0 | 1 | 0 | python | 20,557,641 | 2 | false | 0 | 0 | I don't recommend trying this in batch file. Learning the basics of a scripting language such as Python or Perl is much better for this type of work. | 1 | 0 | 0 | I have a list of fruits
example:
"banana",
"apple",
"grape",
"strawberry"
and I want to create files
with the text:
"This fruit is %fruit name%, its delicious"
and save as %fruit name%.fruits
how i do that? cam be in any language | create files, with a template and a list of name and save on files | -0.099668 | 0 | 0 | 41 |
20,557,751 | 2013-12-13T01:51:00.000 | 2 | 0 | 1 | 0 | python,amazon-web-services,amazon-ec2 | 20,612,680 | 1 | false | 0 | 0 | You should consider an EC2 instance as you would any other virtual machine- Multi-threaded processes are limited by the number of CPUs that the operating system can use.
Autoscaling allows you to spin up more instances on AWS based on certain parameters. It is not intended to increase the capacity of an existing one. | 1 | 2 | 0 | I have a Python app that creates threads via a for loop and I have a few questions regarding multithreading on EC2:
I would like to know if there is a limit on the number of concurrent
threads on an EC2 instance?
What would happen if the maximum number of threads is reached or
exceded? Is there a way to limit the numb... | Python multithreading on EC2? | 0.379949 | 0 | 0 | 532 |
20,561,820 | 2013-12-13T08:08:00.000 | 0 | 0 | 0 | 0 | python,wxpython,wxwidgets | 20,561,947 | 1 | false | 0 | 1 | I need to set wx.TAB_TRAVERSAL as a style on the ScrolledWindow. Apparently it's not set by default. | 1 | 0 | 0 | I had a page that was working fine with respect to tab order, but since I added a scrolled panel to the page, you can only tab between the first control in the ScrolledPanel and the navigation buttons outside the ScrolledPanel. | wxWidgets ScrolledPanel tab order doesn't work | 0 | 0 | 0 | 119 |
20,571,568 | 2013-12-13T16:41:00.000 | 0 | 0 | 1 | 0 | python,python-2.7,windows-server-2008-r2 | 20,571,773 | 2 | true | 1 | 0 | Yes, this is possible. However, you need to decouple execution of your programme from your web interface.
Probably the simplest setup is to use supervisor to run both your program and your web interface. How your program and your web interface interact is up to you. You could even have your web interface control super... | 1 | 0 | 0 | I have made this python (2.7) program that takes a few hours to complete, looping through stuff all the time. I also have a windows 2008 server which I want to use to run this program, I can run it just fine on its own and leave it alone for a while, but I want to use a web interface to achieve the same effect.
I curre... | Run python program on windows 2008 server with web gui | 1.2 | 0 | 0 | 143 |
20,572,706 | 2013-12-13T17:41:00.000 | 7 | 0 | 0 | 0 | python,statsmodels | 20,573,996 | 1 | false | 0 | 0 | There should be a variation on this in any textbook, without the weights.
For OLS, Greene (5th edition, which I used) has
se = s^2 (1 + x (X'X)^{-1} x')
where s^2 is the estimate of the residual variance, x is vector or explanatory variables for which we want to predict and X are the explanatory variables used in the e... | 1 | 5 | 1 | wls_prediction_std returns standard deviation and confidence interval of my fitted model data. I would need to know the way the confidence intervals are calculated from the covariance matrix. (I already tried to figure it out by looking at the source code but wasn't able to) I was hoping some of you guys could help me ... | Mathematical background of statsmodels wls_prediction_std | 1 | 0 | 0 | 2,096 |
20,574,073 | 2013-12-13T19:04:00.000 | 0 | 0 | 1 | 0 | python,django,debian-packaging | 20,574,224 | 1 | false | 1 | 0 | How to install not only Django project, but also Python and Django with it? What and where and how should I write the script?
If you created a deb file, as it gets interpreted, you should write the python dependency in the debian/control file.
This project demand diffrent additions, such as grappelli, tinymce, filebr... | 1 | 0 | 0 | I have a Django project needed to be installed in Debian. I make packages via stdeb. I do not understand two things, on which I can`t find answers:
How to install not only Django project, but also Python and Django with it? What and where and how should I write the script?
This project demand different additions, such... | Distribution Python package to Debian package with installing additional things | 0 | 0 | 0 | 98 |
20,576,166 | 2013-12-13T21:17:00.000 | 0 | 0 | 1 | 0 | python,setup.py | 20,603,812 | 3 | false | 0 | 0 | Do you have default options in ~/.pydistutils.cfg? | 1 | 1 | 0 | I have a python project using setuptools via setup.py for installation. When I provide no arguments to python setup.py install things install into the standard --user directory in ~/.local. However, when I provide --prefix ~/opt/myproject, that gets ignored by the install command and things still get pushed into ~/.loc... | Why would python setup.py ignore --prefix? | 0 | 0 | 0 | 864 |
20,577,682 | 2013-12-13T23:23:00.000 | 2 | 1 | 0 | 0 | php,python,curl,cross-language | 20,577,730 | 3 | false | 0 | 0 | If you need to be able to distribute the PHP code and the Python code independently, deploy them on separate servers, etc., then this is reasonable—you make the Python code a web service, make the PHP code call that web service, and you're done.
But if the Python script is always going to be running locally, it's usua... | 1 | 0 | 0 | Im writing a program in php which does almost everything it needs to do, but at one point i need to use a function that is written in python using the mechanize library, both these scripts will be hosted on the same server.
My initial thoughts are to make a CURL call containing any arguments from the php script to the ... | Calling a function in another lagnauge | 0.132549 | 0 | 0 | 46 |
20,578,757 | 2013-12-14T01:42:00.000 | 9 | 0 | 0 | 1 | python,google-app-engine,localhost,google-cloud-datastore | 20,578,822 | 4 | false | 1 | 0 | This can happen if you're running multiple instances of dev_appserver without giving them distinct datastore files/directories. If you need to be running multiple instances, see dev_appserver.py --help and look at the options for specifying paths/files. | 2 | 7 | 0 | Right now I get a blank page when localhost runs, but the deployed app is fine. The logs show the "database is locked". How do I "unlock" the database for localhost? | How do I unlock the app engine database when localhost runs? | 1 | 0 | 0 | 3,369 |
20,578,757 | 2013-12-14T01:42:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,localhost,google-cloud-datastore | 59,824,595 | 4 | false | 1 | 0 | So with your command to start the server which should be
start_in_shell.sh -f -p 8xxx -a 8xxx
do include a -s flag after the -f as below:
start_in_shell.sh -f -s -p 8xxx -a 8xxx
Sometimes some unanticipated error somewhere causes this issue. Remember to keep only one of the instances with this flag(-s) and others sho... | 2 | 7 | 0 | Right now I get a blank page when localhost runs, but the deployed app is fine. The logs show the "database is locked". How do I "unlock" the database for localhost? | How do I unlock the app engine database when localhost runs? | 0 | 0 | 0 | 3,369 |
20,579,140 | 2013-12-14T02:48:00.000 | 0 | 0 | 1 | 0 | python,windows | 20,579,158 | 3 | false | 0 | 0 | Right click on the title bar of the command prompt. Go to properties. You can change all you want from Font & Color tabs there? | 1 | 0 | 0 | I am a beginner from a non programming background. I am using windows OS. Whenever I write a program in Python and run it, it opens in MS Dos with a black colored screen. I just want to change the background and the font color. How can I do that? | Python Beginner - How to customize the output window | 0 | 0 | 0 | 521 |
20,579,179 | 2013-12-14T02:55:00.000 | 0 | 0 | 0 | 0 | python,neural-network,normalization | 20,579,228 | 1 | false | 0 | 0 | One way to do this is to bit-encode your input; have one neuron per bit of the maximal length input string; and feed 0 as -1, and 1 as 1. If you desire a bit-string as output, then interpret positive outputs as 1 and negative outputs as 0. | 1 | 3 | 1 | I am having problem to understand normalization concept in artificial neural networks. If you could explain how it works. For example if I want input basketball score 58-72 or if I want input word “cat” (as a natural language word). How it works if the range is [-1,1]. Be aware that I am very new with ANN and normaliza... | Normalization in the artificial neural network | 0 | 0 | 0 | 756 |
20,582,543 | 2013-12-14T11:12:00.000 | 2 | 0 | 1 | 0 | python,sha | 20,582,584 | 1 | true | 0 | 0 | How do I select proper data-types to do this in Python ?
You could use Python strings (str) for both the input and the output.
If you do, you'll be able to use hashlib.sha1() directly, without needing any datatype conversions. | 1 | 2 | 0 | I am working on a project related to Data deduplication. I need to design a fingerprint calculation module (to calculate the fingerprint of file chunk) which will take two inputs and give an output.
Input : some_module(unsigned char*buffer, uint32 buffer_length)
output: unsigned char* fingerprint
I have been asked to d... | Calculate SHA1 fingerprint of (unsigned char *) in python | 1.2 | 0 | 0 | 331 |
20,587,888 | 2013-12-14T20:26:00.000 | 0 | 0 | 0 | 0 | python,sql,postgresql,sqlalchemy | 20,589,295 | 1 | true | 0 | 0 | You could use a schema change management tool like liquibase. Normally this is used to keep your database schema in source control, and apply patches to update your schema.
You can also use liquibase to load data from CSV files. So you could add a startup.csv file in liquibase that would be run the first time you run l... | 1 | 1 | 0 | I tend to start projects that are far beyond what I am capable of doing, bad habit or a good way to force myself to learn, I don't know. Anyway, this project uses a postgresql database, python and sqlalchemy. I am slowly learning everything from sql to sqlalchemy and python. I have started to figure out models and the ... | Sqlalchemy, python, easiest way to populate database with data | 1.2 | 1 | 0 | 995 |
20,588,259 | 2013-12-14T21:04:00.000 | 0 | 0 | 0 | 0 | python,qt,user-interface,pyside | 23,973,285 | 2 | false | 0 | 1 | My solution to nearly the same exact problem was simply that it needed to be installed with admin privileges, so that might be your issue also. | 1 | 2 | 0 | I have a 32-bit Windows 7 OS. Today, I tried downloading the PySide setup program. However, after I try running the downloaded file, I get the following error: "PySide Setup program invalid or damaged."
Why am I getting this? I have recently started a course on building GUI applications with Python using the Qt framewo... | Pyside Installation Error | 0 | 0 | 0 | 1,660 |
20,590,704 | 2013-12-15T02:53:00.000 | 10 | 0 | 1 | 1 | python,linux,bash | 20,590,779 | 1 | true | 0 | 0 | Just add them manually to os.listdir() result. result = [os.curdir, os.pardir] + os.listdir(path).
Most modern filesystems no longer create the actual hardlinks but all APIs include the names explicitly anyway. | 1 | 9 | 0 | I am new to python and am working on writing bash ls command in python, I am stuck on ls -a option which (according to the manpage):
Include directory entries whose names begin with a dot (`.')
I am aware of os.listdir() but it does not list special entries '.' and '..'
From the docs: os.listdir(path):
Return a list... | Use python to reproduce bash command 'ls -a' output | 1.2 | 0 | 0 | 17,199 |
20,595,525 | 2013-12-15T14:20:00.000 | 0 | 1 | 0 | 0 | python,http | 20,595,734 | 3 | false | 0 | 0 | Sending HTTP request is pretty simple, I don't think it could be a block issue for most real world applications.
If you really want to send request very fast, you can consider to use multi processes, not waste your time on choosing a faster library(Which likely to be helpless). | 2 | 0 | 0 | As the title says, I'm looking for information about the best library to send HTTP requests in Python really fast.
Do you know which one is the fastest and/or consume less CPU time/memory ?
urllib2
httplib2
requests
Thanks | Best performance HTTP library in Python | 0 | 0 | 1 | 1,475 |
20,595,525 | 2013-12-15T14:20:00.000 | 2 | 1 | 0 | 0 | python,http | 20,595,601 | 3 | false | 0 | 0 | urllib2 might be better for performance, but requests is much simpler to use. | 2 | 0 | 0 | As the title says, I'm looking for information about the best library to send HTTP requests in Python really fast.
Do you know which one is the fastest and/or consume less CPU time/memory ?
urllib2
httplib2
requests
Thanks | Best performance HTTP library in Python | 0.132549 | 0 | 1 | 1,475 |
20,597,590 | 2013-12-15T17:37:00.000 | 14 | 0 | 0 | 0 | python,sql,database,nosql,rethinkdb | 20,600,546 | 1 | true | 1 | 0 | I'm working at RethinkDB, but that's my unbiased answer as a web developer (at least as unbiased as I can).
Flexible schema are nice from a developer point of view (and in your case). Like you said, with something like PostgreSQL you would have to format all the data you pull from third parties (SoundCloud, Facebook e... | 1 | 11 | 0 | I am building the back-end for my web app; it would act as an API for the front-end and it will be written in Python (Flask, to be precise).
After taking some decisions regarding design and implementation, I got to the database part. And I started thinking whether NoSQL data storage may be more appropriate for my proje... | How suitable is opting for RethinkDB instead of traditional SQL for a JSON API? | 1.2 | 1 | 0 | 2,835 |
20,598,229 | 2013-12-15T18:43:00.000 | 1 | 0 | 0 | 0 | python,doxygen | 20,598,413 | 1 | true | 0 | 0 | Found a simple fix:
\htmlonly
\endhtmlonly
Seem to to the job of inserting a single blank line in doxygen generated page. | 1 | 1 | 0 | In the fragment
@code
some code
@endcode
How do I get a closing blank line in the output? | Insert blank line in doxygen code fragment | 1.2 | 0 | 0 | 234 |
20,601,473 | 2013-12-15T23:57:00.000 | 1 | 0 | 0 | 0 | python,line,pygame,placement | 20,601,985 | 1 | true | 0 | 1 | There is no way using pygame that I know of that will allow you to do this. You will instead have to use plain old-fashioned algebra.
You are going to be using the equation of the line that the squares are on. Ax, Ay, Bx, and By will be representing the coordinates of the different squares. All you have to do is get... | 1 | 0 | 0 | I have a program that generates a game board in Pygame. It draws the background, then randomly assigns Start and End squares, then randomly places three squares in between them. I need to fill in the space in between the five placed squares with other squares on a line. How would I go about doing this? I need the lengt... | How to get a list of all points in a line in Pygame | 1.2 | 0 | 0 | 1,185 |
20,601,898 | 2013-12-16T00:55:00.000 | 0 | 0 | 0 | 0 | python,web,wsgi | 20,601,999 | 2 | false | 1 | 0 | It will be hard, between python2 and python3 there is a lot of incompatibility, and somehow the developers of the most python frameworks somehow won't understand, why they should port their software to the newer version of the language.
The simplest way if you use python 2.
The best way were to start an independent, py... | 1 | 2 | 0 | I am going through a tutorial on building a website with django. It suggests using mod_python but I have heard to stay away from that and use wsgi instead. Problem is I am running python 3.3 (and apache 2.4.2 for that matter, everything seems to be compatible with apache 2.2). Is there any way to get all of this workin... | Web page building with python 3.3? | 0 | 0 | 0 | 104 |
20,601,977 | 2013-12-16T01:09:00.000 | 0 | 0 | 1 | 0 | python,class | 20,614,034 | 3 | false | 0 | 0 | I know, this is not an answer to your question, but you should really consider rethinking your object structure since you are violating the common principles of object oriented programming. | 1 | 2 | 0 | I remember that there is some sort of syntax that will make a function of a class only callable by that class and not by any subclasses that inherit the functions of that class, but I can't recall exactly what it is and google has been of no help to me. Can anyone remind me how I would go about doing this? | How to make a function usable by a class but not by it's subclasses in python | 0 | 0 | 0 | 141 |
20,603,994 | 2013-12-16T05:22:00.000 | 1 | 0 | 1 | 1 | python,linux,macos,tornado | 20,604,080 | 2 | false | 0 | 0 | It's safe to set it quite high. Usually the default for desktop OS is quite low. The main disadvantage is the extra memory that is allocated | 1 | 2 | 0 | I use Tornado(a python framework) to develope websites, but it often pops me the OSError - too many open files error during high concurrency tests.
One way to solve this is to set the FD limit to a higher number.
What are the cons, or disadvantages of setting a high FD limit? Can I set it arbitrarily to, like 99999999? | What are the cons if I set the file descriptor limit to a huge number? | 0.099668 | 0 | 0 | 1,001 |
20,605,161 | 2013-12-16T07:03:00.000 | 1 | 0 | 1 | 0 | python,beanstalkd,beanstalkc | 20,633,227 | 1 | true | 0 | 0 | No, you can't search a queue (Beanstalkd calls them 'tubes'), only get a job (though you can PEEK, to see what the next job would be).
Since you can watch more than one tube at a time though (and get a job from any one of them, depending on priority and age), you could create a tube that would only every contain a typ... | 1 | 0 | 0 | I have a use case which requires placing two different types of jobs in a beanstalk queue, say type a and type b. I put type a job whenever a new one arrives, but for type b I want that there should be a single job of type b in a queue at a time (there should never be two or more jobs of type b in queue). When I go fo... | Search in beanstalk queue | 1.2 | 0 | 0 | 416 |
20,605,189 | 2013-12-16T07:05:00.000 | 0 | 0 | 1 | 1 | ubuntu,desktop,ipython-notebook | 20,605,837 | 1 | false | 0 | 0 | There is no reason for a website (here in particular IPython slideshow) to be able to have any effect on the OS. If this happens, then it is probably due to en error somewhere else (wild guess error in graphic card that both crashed the slideshow and gnome). So more a hidden common denominator than cause/effect.
Also ... | 1 | 0 | 0 | I had an ugly experience when I tried to launch the ipython-nb presentation in ubuntu 10.04.
I could managed to see the presentation under chrome but with errors (slides where one over the other). But the worst thing was that once I restarted my pc, the genome(?) desktop was gone. I had to reinstall the entire linux.
I... | danger to crash desktop by using ipython-nb slides in ubuntu 12.04 | 0 | 0 | 0 | 42 |
20,605,544 | 2013-12-16T07:31:00.000 | 2 | 1 | 1 | 0 | python,amazon-web-services,amazon-elastic-beanstalk | 20,607,574 | 1 | true | 0 | 0 | by including it in the requirements.txt, you can include only the packages you are calling. Pip then takes care of installing the dependencies and checking the versions.
This has the additional advantage of when you are changing or upgrading your project, you can specify a new version of the library you are using and ... | 1 | 1 | 0 | I was wanting to use some non-standard python packages in my project and was wondering how to add them. What is the benefit of using the AWS eb config files (.ebextensions and requirements.txt) rather than just downloading and including the package in my actual project under a lib directory like you would with a java a... | Adding external packages to elastic beanstalk python app | 1.2 | 0 | 0 | 289 |
20,611,656 | 2013-12-16T13:04:00.000 | 1 | 0 | 0 | 0 | python,django | 20,622,467 | 2 | true | 1 | 0 | Errors are shown for the "data" parameter ( or instance if it's a modelform ), not "initial". You need to pass the original values as the data parameter if you want to display errors.
And then just use the usual validation methods ( raising ValidationError in clean_* methods , field specific validation, etc. ). I would... | 1 | 0 | 0 | When editing an already existing element in Django, I would like to show ValidationErrors for fields that are not good (because somewhere else something changed). I've tried to overload the __init__ of the form and set form_obj.errors['__all__']="something" but it doesn't display any errors. How should I approach this? | Validation when displaying already existing element | 1.2 | 0 | 0 | 31 |
20,614,349 | 2013-12-16T15:20:00.000 | 2 | 0 | 1 | 0 | c++,python,parallel-processing,scheduling,directed-acyclic-graphs | 20,619,386 | 1 | true | 0 | 0 | This is a pretty common problem. It also shows up in hardware design.
There has been a lot of work on algorithms to solve it.
If you are going to write something yourself, start by checking out "Hu's Algorithm".
If you just want a solution, these functions are built into architectural synthesis programs.
Look at ... | 1 | 4 | 0 | I have a graph of the dependencies of all tasks, and the costs of each task. Now I want to calculate a scheduling for a given amount of CPUs. I've found many papers on scheduling algorithms, optimal schedulers seem to be too expensive for my problem size (around 100 nodes) as it's an NP-hard problem. I'd settle for a h... | finding static scheduling of DAG for multiprocessors - library? | 1.2 | 0 | 0 | 606 |
20,617,337 | 2013-12-16T17:48:00.000 | 1 | 1 | 0 | 0 | python | 20,617,564 | 1 | true | 0 | 0 | Well, you're in for a learning curve here, but multiprocessing.Pool() will create a pool of any number of processes you specify. Use the initializer= argument to specify a function each process will run at the start. Then there are several methods you can use to submit work items to the processes in the pool - read t... | 1 | 0 | 0 | My application polls an API repeatedly and spawns processes to parse any new data resulting from these calls, conditionally making an API request based on those data. The speed of that turnaround time is critical.
A large bottleneck seems to be related to the setup of the actual spawned processes themselves -- a few mo... | Pool of warm, reusable Python processes | 1.2 | 0 | 0 | 442 |
20,617,587 | 2013-12-16T17:58:00.000 | 8 | 0 | 0 | 0 | python,random,numpy | 20,617,702 | 1 | false | 0 | 0 | If they were indistinguishable from to true random begin with, they will be indistinguishable from true random afterwards.
The reason is that any correlation or bias that exists among the remaining numbers would also constitute a correlation or bias among the complete set. Therefore if the complete set is good then the... | 1 | 1 | 1 | I am currently using numpy.random.random_sample to compute a large set of random numbers. If I delete, say, every 10th of these numbers, is the result still going to be as random as before? Or would I introduce some sort of skew by doing this?
EDIT: As pointed out this boils down to how good my RNG is. How can I find o... | Will random numbers still be random if I systematically delete every nth one? | 1 | 0 | 0 | 101 |
20,618,523 | 2013-12-16T18:50:00.000 | 0 | 0 | 0 | 0 | python,pandas,hdf5,pytables | 29,225,626 | 2 | false | 0 | 0 | Okay, so I don't have much experience with oracle databases, but here's some thoughts:
Your access time for any particular records from oracle are slow, because of a lack of indexing, and the fact you want data in timestamp order.
Firstly, you can't enable indexing for the database?
If you can't manipulate the databas... | 1 | 12 | 1 | I am working with an Oracle database with millions of rows and 100+ columns. I am attempting to store this data in an HDF5 file using pytables with certain columns indexed. I will be reading subsets of these data in a pandas DataFrame and performing computations.
I have attempted the following:
Download the the table, ... | Reading a large table with millions of rows from Oracle and writing to HDF5 | 0 | 1 | 0 | 5,171 |
20,619,533 | 2013-12-16T19:44:00.000 | 1 | 0 | 0 | 0 | python,html,google-app-engine,geolocation,gps | 20,619,667 | 1 | false | 1 | 0 | How precise HTML5 geolocation is depends entirely on what the user's browser supports.
On a phone, it may have access to the phone's idea of the user's location (based on GPS plus cell and WiFi triangulation); on a desktop machine, there's little to go on besides IPs, so it can't do any better than you could do yoursel... | 1 | 0 | 0 | I'm building a web app with google app engine and python. I've read that html5 geolocation is much more precise than IP geolocation, but is that precise enough to pinpoint buildings? Or is building my own map with customized coordinates a better option? | I want to locate the specific building the user is in. Should I use html5 geolocation or build my own custom map? | 0.197375 | 0 | 1 | 213 |
20,620,109 | 2013-12-16T20:19:00.000 | 2 | 0 | 0 | 0 | python,pygame | 68,090,814 | 3 | false | 0 | 1 | You can change the transparency of the entire surface using a individual alpha value.
Use surf=pygame.Surface((size,pygame.SRCALPHA). Now if you change the alpha value by setting surf.set_alpha(alpha) of the screen, the surface around the text wont be black anymore. | 1 | 7 | 0 | I am using pygame.font.Font.render() to render some text. I'd like the text to be translucent, ie have an alpha value other than 255, so I tried passing a color argument with an alpha value (eg (255, 0, 0, 150)) as the color argument for pygame.font.Font.render() but it didn't have any effect. I also tried using pygame... | How to render transparent text with alpha channel in PyGame? | 0.132549 | 0 | 0 | 6,139 |
20,623,847 | 2013-12-17T00:43:00.000 | 0 | 0 | 1 | 0 | python,arrays,multidimensional-array,indexing,tuples | 20,623,886 | 4 | false | 0 | 0 | If you have a 1 dimensional array, that is simply an array of values like you mentioned where the array could equal [2013, 12, 16, 1, 10]. You access individual items in the array by using array[index]. However, there are actually 3 parameters used for getting array values:
array[start:end:step]
array[0, 1] is invalid,... | 1 | 2 | 1 | I have a 1D array. each element holds a unique value IE [2013 12 16 1 10] so array[0,0] would be [2013] array[0,1] would be [12]. array[0,0:2] would be [2013 12].
When I try array.index(array[0,0:5]). It creates error and says that list indicies must be integers, not tuple. find the index of a specific element if the e... | Python, find the index of 1D array that is filled with arrays of tuple | 0 | 0 | 0 | 979 |
20,624,211 | 2013-12-17T01:18:00.000 | 3 | 1 | 1 | 0 | python,data-structures,import | 20,624,583 | 3 | true | 0 | 0 | If your util.py file contains functions you're using in a lot of different projects, then it's actually a library, and you should package it as such so you can install it in any Python environment with a single line (python setup.py install), and update it if required (Python's packaging ecosystem has several features ... | 1 | 4 | 0 | This might be a more broad question, and more related to understanding Python's nature and probably good programming practices in general.
I have a file, called util.py. It has a lot of different small functions I've collected over the past few months that are useful when doing various machine learning tasks.
My think... | What is the argument for Python to seemingly frown on importing from different directories? | 1.2 | 0 | 0 | 83 |
20,625,440 | 2013-12-17T03:34:00.000 | 1 | 1 | 1 | 0 | python,unit-testing,runtime | 20,625,573 | 1 | false | 0 | 0 | I agree with all the comments.
Don't do this.
Your function/class/component should NOT behave differently under testing. | 1 | 2 | 0 | Does anyone know the least hacky way of determining if Python code is being run by a unit test?
Thanks! | How to tell at runtime if you're inside of a unit test in Python? | 0.197375 | 0 | 0 | 42 |
20,625,621 | 2013-12-16T20:26:00.000 | 5 | 0 | 1 | 0 | python,eclipse,pycharm | 20,626,531 | 1 | true | 0 | 0 | Ctrl-Tab switches in most-recently-used order (like Alt-Tab for the desktop). Ctrl-E will show recent files.
You should look at Help > Default Keymap Reference, under the navigation heading, for more helpful shortcuts. | 1 | 4 | 0 | I'm coming to PyCharm from Eclipse, and something that is annoying me is how I switch between open files in the editor.
In Eclipse, I had a hotkey set up to open the previous editor. A menu would appear with the files in order of most-to-least recently viewed. If I hit the key once quickly, it would switch to the last... | Optimal switching between file editors in PyCharm | 1.2 | 0 | 0 | 805 |
20,628,825 | 2013-12-17T07:58:00.000 | 0 | 0 | 0 | 0 | python,html | 20,629,430 | 2 | false | 1 | 0 | What is a valid character in HTML depends on your definition for “HTML” and “valid”. Different HTML versions have different rules for formally valid characters, and they may have characters that are valid but not recommended. Moreover, there are general policies such as favoring Normalization Form C; though not part of... | 1 | 1 | 0 | Some characters, such as ordinal 22 or 8, don't display in html (using chrome, for example when copy-and-pasting them into this 'Ask question' editor; I am assuming utf-8). How do I determine which characters are valid html, and of the valid, which are rendered?
A table/reference would be helpful (I couldn't find one b... | How to I determine whether a character is valid-for/rendered-in html? | 0 | 0 | 1 | 120 |
20,629,734 | 2013-12-17T08:55:00.000 | 3 | 0 | 1 | 0 | python,perforce | 20,630,214 | 1 | true | 0 | 0 | You can safely delete the .pyc files and then ignore them from here on. Python will automatically generate new .pyc files when the modules are imported/updated.
Generating the .pyc files is quite fast too, so there's no real noticeable performance difference even when python generates new files. | 1 | 1 | 0 | I've started working on a Python project using Perforce for VCS that previously only had a single developer.
Currently all the pyc files are in source control which is making merges a pain.
I've seen I can add P4ignore files to keep pyc files out of VCS as carry on working but I need a way to remove them from perforce ... | How to remove existing files from Perforce and ignore them (without deleting them) | 1.2 | 0 | 0 | 316 |
20,634,301 | 2013-12-17T12:35:00.000 | 1 | 0 | 1 | 0 | python,blender-2.67 | 20,701,809 | 1 | true | 0 | 0 | I finally got the solution to the problem.
1. Invoke blender through command line
blender.exe --background --python yourFile.py
2. In your python file, you could use the modules provided by blender such as import_ply
(....Blender/2.68/scripts/addons/import_ply), etc. Just go through the module and you will be able to ... | 1 | 2 | 0 | I want to apply a modifier to large number of meshes stored in different .ply files.
I wish to do this through command line so that the process can be automated. I know the basic of blender python API like how to write the modifier in python. But that required me to first import .ply file in blender using UI and then r... | How can I load a .ply file in blender-2.68 and apply modifier to it through command line/script? | 1.2 | 0 | 0 | 1,414 |
20,637,439 | 2013-12-17T14:59:00.000 | -2 | 0 | 0 | 0 | python,pandas,csv,readfile | 55,944,660 | 6 | false | 0 | 0 | skip[1] will skip second line, not the first one. | 1 | 121 | 1 | I'm trying to import a .csv file using pandas.read_csv(), however, I don't want to import the 2nd row of the data file (the row with index = 1 for 0-indexing).
I can't see how not to import it because the arguments used with the command seem ambiguous:
From the pandas website:
skiprows : list-like or integer
Row numbe... | Skip rows during csv import pandas | -0.066568 | 0 | 0 | 269,629 |
20,646,723 | 2013-12-17T23:22:00.000 | 1 | 0 | 1 | 0 | python,python4delphi | 20,648,897 | 1 | true | 0 | 1 | You don't need to include the pyc files, no. Assuming, that is, you are adding your zip file to sys.path and importing from that (the question could use more details along those lines), the Python zipimporter will gladly compile the bytecode for you on the fly.
You should have a little faster startup time if you inclu... | 1 | 0 | 0 | I make Python3+Delphi app. I packed all files+dirs from Libs folder into python32.zip. It works.
Do I need PYC files (and __pycache__ dirs) in that zip?
If I pack PYC files, will Py3k work fasteer? | PythonNN.zip: are PYC files needed | 1.2 | 0 | 0 | 284 |
20,646,758 | 2013-12-17T23:25:00.000 | 3 | 0 | 0 | 0 | python,database,django,model-view-controller,analytics | 20,646,874 | 1 | true | 1 | 0 | There isn't a right answer to this question. Different programmers use different structures. We can, however, provide advice.
Your project will definitely have a core application, in charge of users and account management. All common functionality should be provided by this app. Login/logout/recovery functions fall int... | 1 | 2 | 0 | I'm looking to make an analytics fantasy sports site and I need a little help thinking how to structure the site as a whole. It's most definitely been done before but I'm doing this for educational purposes and because this is a hobby of mine!
The idea for the site is:
Users can create an account
It'll use the Yahoo/E... | How to structure backend of a fantasy sports analytics website on Django? | 1.2 | 0 | 0 | 1,392 |
20,647,274 | 2013-12-18T00:10:00.000 | 2 | 0 | 1 | 0 | python,size,queue | 47,827,360 | 2 | false | 0 | 0 | queue.qsize() doesn't return the number of bytes in the queue. It returns the number of "things" placed in the queue.
If you put 5 byte-arrays of 100 bytes in the queue, the qsize() will be 5, not 500. | 2 | 17 | 0 | I've seen instances where qsize() and len() has been used to compute the size of the queue. What is the distinction between the two? | python queue get size, use qsize() or len()? | 0.197375 | 0 | 0 | 19,413 |
20,647,274 | 2013-12-18T00:10:00.000 | 19 | 0 | 1 | 0 | python,size,queue | 20,647,322 | 2 | true | 0 | 0 | For most containers, you'll want len, but Queue.Queue doesn't actually support len. This may be because it's old or because getting the length of a queue in a multithreaded environment isn't particularly useful. In any case, if you want the (approximate) size of a Queue, you want qsize. | 2 | 17 | 0 | I've seen instances where qsize() and len() has been used to compute the size of the queue. What is the distinction between the two? | python queue get size, use qsize() or len()? | 1.2 | 0 | 0 | 19,413 |
20,648,128 | 2013-12-18T01:34:00.000 | 0 | 0 | 0 | 0 | python,django,usergroups | 20,653,824 | 1 | false | 1 | 0 | You can make an many-to-many relationship between users, groups and classrooms (additional model that will point to these three models, giving group for user in specified classroom) | 1 | 2 | 0 | A little background: I am building a discussion board app aimed at educators. It's essentially a reddit-style discussion board where responses to a prompt are 'up-voted' or 'down-voted'. The content creators are anonymous to everyone except an admin/teacher user.
So far it works for a single "classroom"; i.e., there ca... | Is using django auth Group the right way to solve this? | 0 | 0 | 0 | 144 |
20,651,529 | 2013-12-18T06:55:00.000 | 0 | 0 | 1 | 0 | python,scrapy,python-2.6 | 22,181,034 | 2 | false | 1 | 0 | easy_install Scrapy==0.18.4 worked for me | 1 | 2 | 0 | I am using CentOS and my default Python version is 2.6. I installed Scrapy using pip install Scrapy and I executed the code below
from scrapy.selector import Selector
And I got this message: Scrapy 0.20.2 requires Python 2.7. I can't just upgrade my current version of Python because I have lots of programs that depends... | Install Scrapy for Python 2.6 | 0 | 0 | 0 | 1,711 |
20,654,812 | 2013-12-18T09:55:00.000 | 1 | 0 | 1 | 1 | python,python-2.7,canopy,python-venv | 20,655,950 | 1 | true | 0 | 0 | Well, I found it, canopy_cli.exe exactly at the specified location, so the directory is correct.
So... Maybe you try to reinstall the software?
Btw, what version you are using? How about updating as the same time? | 1 | 0 | 0 | I am working with Canopy for Python, which is a software bundle of Python 2.7 and the most important data analysis packages. It also includes IPython and makes working in a live console very easy.
Instead of using virtualenv, Canopy makes use of a Python-2.7-backported version of "venv". To initially setup a new enviro... | Using Canopy as a Python distribution, where is "canopy_cli.exe" located? | 1.2 | 0 | 0 | 147 |
20,656,322 | 2013-12-18T11:01:00.000 | 1 | 1 | 0 | 0 | c++,python,profiling,swig | 20,661,702 | 1 | false | 0 | 0 | It's been a while since I've built anything on Linux, but from memory you can build your C++ lib with the profiling switches on, run the script via the profiler on python.exe, and the profile data will be captured for your lib only, not for the whole process. You can then view your profile data just as you would any ot... | 1 | 4 | 0 | I'm writing Python code and use a library that provides a Python interface through SWIG; the library itself is written in C++, and everything is run in Linux.
I would now like to profile my code and not only get information about which if my library calls are taking the most time, but also what the situation is inside ... | Profiling SWIG Python code | 0.197375 | 0 | 0 | 257 |
20,660,579 | 2013-12-18T14:17:00.000 | 0 | 0 | 1 | 0 | python,regex,pyqt4,qregexp | 32,671,451 | 2 | false | 0 | 0 | Just to post an answer on this side of things...
In most cases I've played with, the DOTALL "(.*?)" approach doesn't seem to match anything when it comes to QRegExp().
However, here's something I use that works in almost all my cases for matching triple-quoted strings:
single: "[^#][uUbB]?[rR]?(''')[^']*(''')"
double: ... | 1 | 1 | 0 | Recently I've been working on a PyQt program. In the beginning I used python re module to process the regex, but the transformation between python string and QString makes me confused. So I tried to change QRegExp.
However, I want to use the IGNORECASE, MULTILINE, DOTALL of the python re. I've found the QRegExp.setCase... | Can QRegExp do MULTILINE and DOTALL match? | 0 | 0 | 0 | 607 |
20,661,142 | 2013-12-18T14:44:00.000 | 7 | 0 | 0 | 0 | python,machine-learning,scipy,k-means | 20,661,301 | 1 | false | 0 | 0 | Based on the documentation, it seems kmeans2 is the standard k-means algorithm and runs until converging to a local optimum - and allows you to change the seed initialization.
The kmeans function will terminate early based on a lack of change, so it may not even reach a local optimum. Further, the goal of it is to gen... | 1 | 10 | 1 | I am new to machine learning and wondering the difference between kmeans and kmeans2 in scipy. According to the doc both of them are using the 'k-means' algorithm, but how to choose them? | What's the difference between kmeans and kmeans2 in scipy? | 1 | 0 | 0 | 3,357 |
20,666,947 | 2013-12-18T19:40:00.000 | 1 | 0 | 0 | 0 | android,python-2.7,kivy | 22,365,294 | 1 | true | 0 | 1 | There is no way to do it from the build.py. However, you can change manually the templates/AndroidManifest.xml.tmpl and adapt it for your needs. | 1 | 1 | 0 | Is there a way to establish a "supports-screens" kind of configuration to make my application available only for normal and large screens android devices.is there a way to do this with the build.py script?(i have bets on --intent-filters option but not sure how it might be used) | screen support in kivy set to normal and large screens | 1.2 | 0 | 0 | 84 |
20,668,574 | 2013-12-18T21:16:00.000 | 1 | 0 | 0 | 1 | python | 20,669,260 | 1 | true | 0 | 0 | The only problems I would expect would be in:
print
stdin
stdout
raw_input | 1 | 0 | 0 | Easy quesiton here. I have a GUI which I run using a batch file. I want it to be displayed with out the terminal in the background, so I use the pythonw executable. However, I am not using the corresponding .pyw file, but a regular .py file instead.
Are there any differences between python and pythonw that might ca... | Can errors result from using .py files with pythonw? | 1.2 | 0 | 0 | 121 |
20,669,240 | 2013-12-18T21:54:00.000 | 1 | 0 | 0 | 0 | python,authentication | 20,670,147 | 3 | false | 1 | 0 | If you're using Unix, rely on the fact that it's a multi user system. That is, the user has already logged in using his own credentials, so you don't need to do anything, just use its home directory to store the data, taking care to block other users from accessing it by using permissions. You can improve this to provi... | 3 | 1 | 0 | I will keep it short.
Can someone please point me in the right direction in:
How to authenticate users in native applications written in Python?
I know in web there are sessions, but I can't think of a way to implement authentication, that will 'live' for some time and on expiry I can logout the user?
EDIT:
I am ref... | Implementing session-like storage in python application | 0.066568 | 0 | 0 | 375 |
20,669,240 | 2013-12-18T21:54:00.000 | 1 | 0 | 0 | 0 | python,authentication | 20,669,715 | 3 | false | 1 | 0 | You seem to be very confused and fixated on "sessions" for some reasons, maybe because your background is in the web apps?
Any-who you don't need "sessions" because with desktop application you have no trouble telling who is using the software without needing some elaborate tools. You don't need server, you don't need ... | 3 | 1 | 0 | I will keep it short.
Can someone please point me in the right direction in:
How to authenticate users in native applications written in Python?
I know in web there are sessions, but I can't think of a way to implement authentication, that will 'live' for some time and on expiry I can logout the user?
EDIT:
I am ref... | Implementing session-like storage in python application | 0.066568 | 0 | 0 | 375 |
20,669,240 | 2013-12-18T21:54:00.000 | 1 | 0 | 0 | 0 | python,authentication | 20,669,948 | 3 | true | 1 | 0 | It’s not entirely clear what kind of security you are expecting.
In general, if the end user has physical access to the machine and a screwdriver, you’re pretty much screwed—they can do whatever they want on that machine.
If you take hardware security as a given, but want to ensure software security, then you’re going... | 3 | 1 | 0 | I will keep it short.
Can someone please point me in the right direction in:
How to authenticate users in native applications written in Python?
I know in web there are sessions, but I can't think of a way to implement authentication, that will 'live' for some time and on expiry I can logout the user?
EDIT:
I am ref... | Implementing session-like storage in python application | 1.2 | 0 | 0 | 375 |
20,671,719 | 2013-12-19T01:07:00.000 | 1 | 0 | 1 | 1 | python,ubuntu,service,setuptools,upstart | 20,672,084 | 1 | true | 0 | 0 | Should setuputils even be responsible for creating the service on the machine, or rather should this be handled by an external package manager like dpkg/apt/rpm
Almost certainly the latter.
distutils/setuptools is not designed to handle things like this.
There's some configuration information that's sufficient for ins... | 1 | 0 | 0 | I'm attempting to create a python package that when installed also creates an upstart service. Currently, my options are symlinking the service from the package directory to /etc/init, or copying the file to /etc/init. Either one works fine so long as I can unlink/delete the file upon uninstallation of the package. I s... | Installing a Python package with an Upstart service using setuputils | 1.2 | 0 | 0 | 411 |
20,673,260 | 2013-12-19T04:07:00.000 | 0 | 0 | 0 | 0 | python,python-2.7,web.py | 20,676,165 | 2 | false | 1 | 0 | Assuming your application is served by a long running process (as opposed to something like plain CGI), AND your database is never updated, you always have the option to instantiate your Object_X at the module's top-level (making it a global), so it will only be created once per process. Now it means that you'll have s... | 1 | 3 | 0 | I have an object which loads all the data from DB Object_X.
This object has a few methods defined. I pass some parameter and based on parameter I call one of the functions in Object_X, it uses pre-populated data in object and parameter to get some result.
I have created a web service which invokes any method defined i... | Prevent creating of expensive object on each request | 0 | 0 | 1 | 56 |
20,682,797 | 2013-12-19T13:16:00.000 | 0 | 0 | 0 | 0 | python-2.7,image-processing | 20,689,518 | 1 | false | 0 | 1 | You can use segmentation technique(seed based approach) in first image and then OpenCV library to place it onto another image by creating a mask. | 1 | 0 | 0 | I there any library in Python so that you can cut a certain part of an image (like a person) and paste it in other image? | Cut a certain part of an image and paste it in other image | 0 | 0 | 0 | 266 |
20,684,509 | 2013-12-19T14:40:00.000 | 1 | 0 | 0 | 0 | python,python-3.x | 20,714,626 | 1 | false | 0 | 0 | OK, after numerous hours on google I found out that .scd's are basically .zip's with a 0% compression rate. Try using the built in zipfile module on your file as though it were a .zip. | 1 | 2 | 0 | I am trying to make a program with python that downloads a large .scd file, unpacks it, and then installs it. It is not at all difficult for me to download it or install it, (which is pretty much just using urllib and moving a few files around) but unpacking it seems to be a problem. After a couple hours of Googling I ... | Open .scd files in python? | 0.197375 | 0 | 0 | 459 |
20,689,760 | 2013-12-19T19:08:00.000 | 1 | 0 | 0 | 0 | python,user-interface,canvas,tkinter,tcl | 20,692,285 | 1 | false | 0 | 1 | It's normal, even if not entirely what you want. The scale method just changes the coordinate lists, but text items only have one of those so they just get (optionally) translated.
This also applies to image and bitmap items. And features of other items like the line width; they're not scaled. | 1 | 0 | 0 | Is it normal that Tkinter's Canvas' create_text 's font size doesn't change when I change the Canvas' scale with canvas.scale ?
I thought that, as it is a high level GUI management system, I wouldn't have to resize manually the text done with create_text after a zooming. Isn't this strange, or am I wrong ? | Tkinter, canvas, create_text and zooming | 0.197375 | 0 | 0 | 500 |
20,690,850 | 2013-12-19T20:16:00.000 | -6 | 0 | 1 | 0 | python,python-3.3 | 20,691,247 | 2 | true | 0 | 0 | python3 is a symbolic link to python3.3
python3.3 is a hard link to python3.3m
And as @nneonneo 's answer indicating, The m suffix means specifically a "pymalloc" build of Python. Then the links do what they do. | 1 | 35 | 0 | What's the difference between python 3.3 and 3.3m
I'm using Ubuntu 13.04 Raring and on my system I have python2.7 and python3.3 (I know the differences between 2 and 3)
But I also have installed python3.3m (and it's not a symlink to 3.3). So what does the m stand for? | whats the difference between python 3.3 and 3.3m | 1.2 | 0 | 0 | 9,494 |
20,691,258 | 2013-12-19T20:40:00.000 | 1 | 1 | 0 | 1 | python,python-2.7 | 20,691,487 | 7 | false | 0 | 0 | First of all, processes don't run on ports - processes can bind to specific ports. A specific port/IP combination can only be bound to by a single process at a given point in time.
As Toote says, psutil gives you the netstat functionality. You can also use os.kill to send the kill signal (or do it Toote's way). | 1 | 13 | 0 | Is it possible in python to kill a process that is listening on a specific port, say for example 8080?
I can do netstat -ltnp | grep 8080 and kill -9 <pid> OR execute a shell command from python but I wonder if there is already some module that contains API to kill process by port or name? | Is it possible in python to kill process that is listening on specific port, for example 8080? | 0.028564 | 0 | 0 | 19,468 |
20,692,146 | 2013-12-19T21:35:00.000 | 0 | 0 | 0 | 0 | python,sphero-api | 21,339,422 | 1 | false | 0 | 0 | User3120784, in certain cases when you are using Sphero with the leveling system enabled, this can be seen. I personally just had an issue where the ball would do the brightness discrepancy that you are describing here, and the solution was to just check and then uncheck "Level up" in the advanced settings in the Spher... | 1 | 1 | 0 | I am just curious as I notice when the sphero is blinking while it is idling waiting for a connection, it is much brighter than when I set the colour using the setRGB functionality. Am I missing something to adjust the brightness as well. I can't seem to find anything in the documentation. | How to control LED max brightness using Sphero API | 0 | 0 | 1 | 354 |
20,693,168 | 2013-12-19T22:45:00.000 | 0 | 0 | 0 | 0 | python,google-sheets | 50,629,830 | 3 | false | 1 | 0 | Yes, it is possible and this is how I am personally doing it so.
search for "doGet" and "doPost(e) | 1 | 0 | 0 | I dont even know if this is possible. But if it is, can someone give me the broadstrokes on how I can use a Python script to populate a Google spreadsheet?
I want to scrape data from a web site and dump it into a google spreadsheet. I can imagine what the Python looks like (scrapy, etc). But does the language support w... | Is this possible - Python script to fill a Google spreadsheet? | 0 | 1 | 0 | 3,149 |
20,693,528 | 2013-12-19T23:13:00.000 | 0 | 0 | 1 | 0 | c++,python,input,keyboard,background-process | 20,693,595 | 1 | true | 0 | 0 | You need to search for Keyboard Hooks.
Most systems provide a away for you to ask to see any events that go by, either all events, or a subset (keyboard/mouse/etc). This can then be used to respond to them. Its used by Macro software such as AutoHotKey, and by Keyloggers, that try to capture peoples passwords and such... | 1 | 0 | 0 | I want to make a program where when you press a keyboard key it plays the next sound in a list of sounds (preferably using C++ or python), but I want this to work in any program (Microsoft Word etc.) and just be running in the background. I have no idea how to do this or even where to look.
Also, if anyone knows a good... | How do I run a keyboard program in the background? | 1.2 | 0 | 0 | 231 |
20,694,492 | 2013-12-20T00:48:00.000 | 7 | 1 | 1 | 0 | python,hashtable,binary-search-tree | 20,694,525 | 3 | true | 0 | 0 | A hash table takes O(1) time to look up any given entry (i.e. to check whether or not it is in the data structure), whereas a binary search tree takes O(logn) time. Therefore, a hash table will be a more efficient option in terms of response speed.
Binary search trees are more useful in scenarios where you need to di... | 1 | 5 | 0 | I am attempting to write a program that determines whether a specific license plate is one of 10,000 that I have stored. I want to write a fast response algorithm first and foremost, with memory usage as a secondary objective. Would a balanced binary search tree or a hash table be more sufficient in storing the 10,000 ... | Best Data Structure for storing license plates and searching if a given license plate exists | 1.2 | 0 | 0 | 1,592 |
20,695,601 | 2013-12-20T03:00:00.000 | 1 | 1 | 1 | 0 | python,unit-testing,python-imaging-library,pillow | 23,596,144 | 1 | false | 0 | 0 | Does it have to be exactly 150kb, or just somewhere comfortably over 100kb?
One approach would be to create a JPEG at 100% quality, and insert lots of (random) text into all the available EXIF and IPTC headers. Including a large thumbnail image will also push the size up.
(And like Bo102010 suggested, you could also ... | 1 | 5 | 0 | I'm trying to work out a method for dynamically generating image files with PIL/Pillow that are a certain file size in order to better exercise certain code paths in my unit tests.
For example, I have some image validation code that limits the file size to 100kb. I'd like to generate an image dynamically that is 150kb... | Dynamically generate valid image of a certain filesize for testing | 0.197375 | 0 | 0 | 652 |
20,699,380 | 2013-12-20T08:36:00.000 | 2 | 0 | 1 | 0 | python,function,input,output,terminology | 20,737,400 | 1 | false | 0 | 0 | I remember reading back in the day that subroutines which return values were referred to as functions (from the mathematical term) and those that don't were called subroutines or procedures. Arguments or parameters are the things passed into a function. What it returns is called a return value or simply the value of th... | 1 | 0 | 0 | Very simple question but always wondered what the answer was;
In the same way that we have that the terminology for the input into a function being the argument, what is the terminology for the output received???
Also, if a function simply performs a process without directly passing data back out, such as arranging a f... | Python Terminology Regarding Function Input and Output | 0.379949 | 0 | 0 | 52 |
20,700,738 | 2013-12-20T09:50:00.000 | 0 | 1 | 0 | 0 | python,http,webserver,cgi | 20,701,061 | 1 | true | 1 | 0 | To use it as CGI you must move your script into cgi-bin or similar directory of HTTP server. Then point your browser into http://127.0.0.1/cgi-bin/my_scipt.py and see results. In case of problems see at HTTP server error log.
In case of strange errors show us what HTTP server and OS you use, example "Apache 2.2 on WinX... | 1 | 0 | 0 | Am using python2.7. My task is to create a web page say login screen in browser using python. I tried CGI. My code is showing HTML file(all the html code from to ) in CMD screen. Whereas i want them in browser as web page. Any help?. | CGI with Python2.7 | 1.2 | 0 | 0 | 326 |
20,701,971 | 2013-12-20T10:52:00.000 | 4 | 1 | 0 | 0 | c++,python,protocol-buffers | 20,713,817 | 1 | true | 0 | 1 | Yes, I believe this is expected. The pure-Python implementation stores all the fields in a dict. To construct a new message, it essentially just creates an empty dict, which is very fast. The C++ implementation actually initializes a C++ DynamicMessage object under the hood and then wraps it. DynamicMessage actuall... | 1 | 2 | 0 | I am using Google Protobuf in my Python application. Experimenting with the protobufs I found that Protobuf Message Creation is much slower in CPP based python implementation as compared to Python based Python implementation.
Message creation with PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp was upto 2-3 times slower as... | Performance of C++ based python implementation of Google Protobuf | 1.2 | 0 | 0 | 4,148 |
20,711,941 | 2013-12-20T21:06:00.000 | 1 | 0 | 1 | 0 | python,cython,hdf5,pytables | 20,714,204 | 1 | true | 0 | 0 | If you use the h5py package, you can use numpy.asarray() on the datasets it gives you, then you have a more familiar NumPy array that you already know how to deal with.
Please note that h5py had a bug related to this until a couple years ago which caused disastrously slow performance when doing asarray() but this was s... | 1 | 3 | 1 | I develop a library that uses Cython at a low level to solve flow problems across 2D arrays. If these arrays are numpy arrays I can statically type them thus avoiding the Python interpreter overhead of random access into those arrays. To handle arrays of sizes so big they don't fit in memory, I plan to use hd5file Ar... | Can I statically type a h5file array in Cython? | 1.2 | 0 | 0 | 100 |
20,712,174 | 2013-12-20T21:24:00.000 | 1 | 0 | 0 | 0 | python,mysql,database,django,amazon-ec2 | 20,712,349 | 2 | true | 1 | 0 | Your column is only 2 chars wide, but you are trying to store the strings 'HIGH', 'MEDIUM', 'LOW' from your TEMP choices (the first value of each tuple is saved in the database). Increase max_length or choose different values for choices, e.g. TEMP = ( ('H', 'High'), ('M', 'Medium'), ('L', 'Low'), ).
It worked fine in... | 1 | 0 | 0 | i have deployed a simple Django application on AWS. The database i use is MySQL. Most parts of this application runs well. But there happens to be a problem when i submitted a form and store data from the form into a model. The error page presents Data truncated for column 'temp' at row 1. temp is a ChoiceField like th... | Data truncated for column 'temp' at row 1 | 1.2 | 1 | 0 | 2,106 |
20,721,145 | 2013-12-21T16:35:00.000 | 1 | 0 | 0 | 0 | python,scrapy | 20,721,196 | 1 | true | 1 | 0 | Use str.format to insert variable value into xpath expression:
sel.select('//a[contains(@href, "{0}")]/@href'.format(url_type)).extract() | 1 | 0 | 0 | Instead of "rss", I want to add a global variable to it. So that I don't have to change it again and again.
sel.select('//a[contains(@href, "rss")]/@href').extract() to something like this:
sel.select('//a[contains(@href, url_type)]/@href').extract() | Add variable in HtmlXPathSelector select function | 1.2 | 0 | 1 | 145 |
20,723,009 | 2013-12-21T20:01:00.000 | 1 | 0 | 1 | 0 | python | 20,723,423 | 3 | false | 0 | 0 | Epydoc:
--parse-only, --introspect-only By default, epydoc will gather information about each Python object using two methods: parsing the
object's source code; and importing the object and directly
introspecting it. Epydoc combines the information obtained from these
two methods to provide more complete and a... | 1 | 2 | 0 | I have a pretty large project with lot of packages, modules and dependencies. I want to generate the API doc of a few modules in the project. The documentation is already added as doc-strings.
I tried using sphinx but I am plagued with import errors. And the configuration required to avoid these import errors is just ... | Any simple python module documentation generator that does not try to run/import code? | 0.066568 | 0 | 0 | 492 |
20,723,086 | 2013-12-21T20:10:00.000 | 1 | 0 | 1 | 0 | python,ipython | 20,723,262 | 2 | false | 0 | 0 | I had to apt-get install ipython3, on Linux Mint, which is similar to Debian and Ubuntu.
If you're on a Redhat-like OS, you may have something similar for yum. | 1 | 9 | 0 | I have python 2.7 and python3 installed on my machine along with ipython. I wanna use Ipython with python3 by default its taking python 2.7. Whats the Process to use ipython with python 3. | Switching to ipython for python3? | 0.099668 | 0 | 0 | 3,389 |
20,727,189 | 2013-12-22T07:21:00.000 | 0 | 1 | 0 | 1 | python,linux,raspberry-pi,raspbian | 20,727,288 | 1 | false | 0 | 0 | Don't try to open a terminal window from python. Just use the os.system() command to run the three commands you show, if you insist on using python. Even easier would be a bash script into which you can write the three commands just as you have written them above.
Even better, and to get rid of the need to somewhere ty... | 1 | 1 | 0 | The following commands (to get a small screen working) execute just fine if I type them in from the LXTerminal window while running Raspian on a raspberry Pi once my desktop is loaded:
sudo modprobe spi-bcm2708
sudo modprobe fbtft_device name=adafruitts rotate=90
export FRAMEBUFFER=/dev/fb1
startx
I'm new to Pi and P... | Raspbian Run 4 commands from terminal window after desktop loads Python script? | 0 | 0 | 0 | 1,022 |
20,728,436 | 2013-12-22T10:32:00.000 | 0 | 0 | 0 | 1 | google-app-engine,python-2.7,ubuntu | 22,313,654 | 1 | false | 1 | 0 | reset your proxy environment variables (http_proxy and https_proxy) while running the app server locally. You need them only when you are deploying your app to actual google servers. | 1 | 1 | 0 | I have been trying to run a small app using google app engine (python) on 8080. I am behind my college proxy which requires a username and password to login
here is what i get
INFO 2013-12-22 10:16:19,516 sdk_update_checker.py:245] Checking for updates to the SDK.
INFO 2013-12-22 10:16:19,518 init.py:94] Con... | Running google app engine locally tbehind a proxy | 0 | 0 | 0 | 426 |
20,728,942 | 2013-12-22T11:34:00.000 | 1 | 0 | 0 | 0 | python,imshow | 20,729,020 | 1 | true | 0 | 0 | try setting those values to np.nan ( or float('nan')); you may also want to pass interpolation='nearest' to imshow as an argument. | 1 | 1 | 1 | I am producing an imshow plot in Python.
In the final plot, I have strips/columns of data, between which there is no data at all - kind of like a barcode.
At the moment, where I have no data, I have just set all values to zero. The color of these regions of no data is therefore whatever colour represents zero in my col... | highlight regions of no data in a Python imshow plot | 1.2 | 0 | 0 | 622 |
20,740,602 | 2013-12-23T09:32:00.000 | 2 | 0 | 1 | 0 | python,ipython,ipython-notebook | 20,749,381 | 1 | true | 0 | 0 | Start another server if you are using 1.0/1.1. this will be solved in 2.0 that allow you to browse your hard-drive. | 1 | 0 | 0 | I know that the IPython Notebook expects to have a notebook directory and that this can be set at startup with --notebook-dir. But is it possible to run a notebook stored at any location without first importing/copying it to this directory? | How to run IPython Notebooks stored at any location | 1.2 | 0 | 0 | 142 |
20,744,160 | 2013-12-23T13:01:00.000 | 0 | 0 | 1 | 1 | python,windows,file,concurrency | 20,744,641 | 1 | false | 0 | 0 | You can open the file in 'r+b' mode. You would then have a single file object which could be accessed by the two different processes.
Doing so requires some communication between processes (or careful handling of the processes) to about the current state of the file.
Overall, this seems a better approach then over-ridi... | 1 | 3 | 0 | I have a Python script, which appends content to a large file a few times a second. I also need a second process, which occasionally opens that large file, and reads from it.
How do I do that in Windows? In C++ I could simply open a file with _SH_DENYNO, but what is the equivalent in Python? | Concurrent file access in Python | 0 | 0 | 0 | 686 |
20,748,526 | 2013-12-23T17:43:00.000 | 1 | 0 | 1 | 0 | python,square-bracket | 20,748,576 | 2 | false | 0 | 0 | Square brackets are just a convention used to indicate optional arguments. | 1 | 1 | 0 | I have not understood why they write round(x[,n]) in syntax, but in codes they write round(10.6987,12) without square brackets before comma i.e, round(10.6987[,12]) | In Python, why round(x[,n]) is written instead of round(x,n)? | 0.099668 | 0 | 0 | 151 |
20,748,906 | 2013-12-23T18:10:00.000 | 1 | 0 | 1 | 0 | image,matplotlib,inline,ipython | 20,749,407 | 1 | false | 0 | 0 | No it is not possible without saving the image. Using slide mode you can exclude some cells. is is also possible to use slide-mode and not to show the code if you are using custom templates. | 1 | 2 | 0 | Is it possible to create an inline png image, e.g. using matplotlib, and re-using it in a markdown cell (via html) without saving it on hard disk first?
IPython notebook saves inline images in the ipynb file, so the data is available, I wonder if it is also accessible?
One idea is to generate images for pretty slides (... | Reuse inline image in IPython notebook | 0.197375 | 0 | 0 | 156 |
20,749,102 | 2013-12-23T18:25:00.000 | 1 | 0 | 0 | 0 | python,selenium,automation,web-scraping,capybara | 20,749,267 | 3 | true | 1 | 0 | You may want to check out CasperJS. I use Python to fire CasperJS scripts to do web scraping and return data to Python to parse further or store to a database etc...
Python itself has BeautifulSoup and Mechanize but the combination is not great with Ajax based sites.
Python and CasperJS is perfect. | 1 | 2 | 0 | I play on chess.com and I'd like to download a history of my games. Unfortunately, they don't make it easy: I can access 100 pages of 50 games one at a time, click "Select All" and "Download" and then they e-mail it to me.
Is there a way to write a script, in python or another language, that helps me automate any part... | Automating web tasks? | 1.2 | 0 | 1 | 406 |
20,749,341 | 2013-12-23T18:41:00.000 | 0 | 0 | 1 | 0 | python,pycharm | 20,749,817 | 1 | false | 0 | 0 | I'm using PyCharm 3.0.2 and Ctrl+Click works for links that starts with http://. But for the links that don't start with http://(i.e. www.example.com), I had to keep the cursor on the link(you don't have to highlight) and the context menu had an option called Open in Browser using which you can navigate to that link in... | 1 | 2 | 0 | I'm working with project, where previous developer leave many comments with the links on documentation. It's would be very useful, if PyCharm may to follow the links directly from source code. I know that in Visual Studio this feature exist, the links open by CTRL+Click over them. What about PyCharm? I'm using PyCharm ... | Can PyCharm follow the link from source editor? | 0 | 0 | 0 | 655 |
20,749,840 | 2013-12-23T19:21:00.000 | 0 | 1 | 0 | 0 | python,imap | 20,751,370 | 1 | false | 0 | 0 | SEARCH SINCE. Only works at day resolution though. | 1 | 2 | 0 | How do I write an IMAP query to get all messages with INTERNALDATE higher than a given datetime? | IMAP query to get messages with `INTERNALDATE` higher than given datetime | 0 | 0 | 0 | 620 |
20,750,119 | 2013-12-23T19:42:00.000 | 1 | 0 | 0 | 0 | jquery,python,ajax,django | 20,750,187 | 2 | false | 1 | 0 | This is a frequent mistake when writing JavaScript. You haven't disabled the default actions on click or submit. This means that the JS execute, calling the ajax, but then immediately the normal browser submit is also executed, causing a refresh.
voteBehavior should accept an event parameter, and you should call event.... | 1 | 0 | 0 | I'm a newbie here, and much of what I have learned about django and python have come from this website. Thank you all for being so helpful! This is my first question post.
I've got 2 problems as I try to extend what I've learned from the Django tutorial (1.6) and try to get the Polls app to load via AJAX. I want to ... | AJAX and Django using the polls app from the tutorial: 2 problems | 0.099668 | 0 | 0 | 356 |
20,753,215 | 2013-12-24T00:24:00.000 | 0 | 0 | 1 | 0 | python,32bit-64bit,py2exe | 53,809,976 | 2 | false | 0 | 0 | You can install Python 32 bit and 64 bit on your 64 bit system.you need to install needed packages and py2exe for both 32 and 64 bit version of python separately. after you installed 32 bit, you must change Windows path of python to 32 bit to use it..after success 32 bit compile you can change windows path to 64 bit ag... | 2 | 5 | 0 | I've been researching a bit, but need a bit of advice specifically for Py2exe apps. I'm on a 64 bit machine, but from what I understand I can compile in 32 bit format, and run on both 32 and 64 bit.
Now my question. To make an exe, I'm using py2exe. So from what I understand, you don't need a 32 bit environment, just a... | Py2exe - Compile exe for 32 bit and 64 bit | 0 | 0 | 0 | 6,865 |
20,753,215 | 2013-12-24T00:24:00.000 | 7 | 0 | 1 | 0 | python,32bit-64bit,py2exe | 20,756,528 | 2 | true | 0 | 0 | Technically 32x/86x can be used on 64x, but when I used to fiddle around with running 64x on 32x/86x, it crashed the computer, so nothing really just use the 32x/86x compiler. So, 64x programs are one way but 32x/86x are not:
64x program -> 64x computer
32x/86x program -> 32x/86x computer
32x/86x program -> 64x comput... | 2 | 5 | 0 | I've been researching a bit, but need a bit of advice specifically for Py2exe apps. I'm on a 64 bit machine, but from what I understand I can compile in 32 bit format, and run on both 32 and 64 bit.
Now my question. To make an exe, I'm using py2exe. So from what I understand, you don't need a 32 bit environment, just a... | Py2exe - Compile exe for 32 bit and 64 bit | 1.2 | 0 | 0 | 6,865 |
20,756,069 | 2013-12-24T06:34:00.000 | 3 | 0 | 1 | 0 | python,import | 20,756,104 | 1 | true | 0 | 0 | It is only bad to multiply import module M from modules N1, N2, N3 etc if M holds some global state that is then modified by some of the N* modules. Then, side effects occur depending on import order.
Usually in clean code, this is not the case, and if you only hold class definitions and functions, as well as global va... | 1 | 1 | 0 | I know this question has been asked/answered a lot, but I'm curious about my specific case -- and I haven't seen an answer that I fully understand.
Is it bad to have several modules that import the same module? So, say I have some generic utilities module that I reuse a lot, and modulex.py and moduley.py both import it... | Python 2 or 3 circular import clarification | 1.2 | 0 | 0 | 72 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.