Q_CreationDate stringlengths 23 23 | Title stringlengths 11 149 | Question stringlengths 25 6.53k | Answer stringlengths 15 5.1k | Score float64 -1 1.2 | Is_accepted bool 2
classes | N_answers int64 1 17 | Q_Id int64 0 6.76k |
|---|---|---|---|---|---|---|---|
2013-09-30 03:07:40.610 | Call another module with passing its command line parameter from my module using argparse in python | I searched and tried following stuff but could not found any solution, please let me know if this is possible:
I am trying to develop a python module as wrapper where I call another 3rd party module with its .main() and provide the required parameter which I need to get from command line in my module. I need few parame... | Provided that you are calling third-party modules, a possible solution is to
change sys.argv and sys.argc at runtime to reflect the correct parameters for
the module you're calling, once you're done with your own parameters. | 0 | false | 1 | 2,804 |
2013-09-30 05:17:22.230 | How do I enforce unique user names in Flask? | I'm a complete beginner to Flask and I'm starting to play around with making web apps.
I have a hard figuring out how to enforce unique user names. I'm thinking about how to do this in SQL, maybe with something like user_name text unique on conflict fail, but then how to I catch the error back in Python?
Alternatively... | You can use SQLAlchemy.It's a plug-in | 0 | false | 1 | 2,805 |
2013-09-30 22:12:52.213 | Why I do not see realtime output in the output file? | I thought writing a file gives real-time output, since it is so when I use C/C++ to write files. But when I run python program it seems the output file is always 0 byte until the whole program finished running. Even for the nohup python xxx.py &, the print stuff in the file nohup.out isn't realtime, and can only be see... | There are two points at which your file can buffer - Python's internal buffers and the buffers on the operating system. This is a performance boost that avoids system calls and disk writes while the buffer is filling up.
Calling file.flush() will push the internal buffer to the operating system. You can additionally ca... | 1.2 | true | 1 | 2,806 |
2013-10-01 15:30:06.657 | Wing101 - Configure python 3.3.2 from 2.7.2 on a mac | I am relatively new to programming, and I am using Wing101 version: 5.0.0-b8 (rev 29847).
The Python Shell within Wing101, is version 2.7.2, how do I configure it to open python 3.3.2.
I have downloaded Python 3.3.2 and I need the custom Python Executable. I previously tried "/usr/bin/python" as my custom python execu... | The location of the python.exe for Python 3.3 can vary depending on how you installed it. Probably the best bet is to search w/ Spotlight for python.exe, press "Show All" in the drop down menu, change to "File Name" instead of "Contents" search and then click on results to see the full path at the bottom of the search... | 1.2 | true | 1 | 2,807 |
2013-10-02 00:31:14.027 | What is the android activity for opening sudoku and how do I find how to? | I am using appium and using Sudoku app for Android on a Windows 7 machine using Python. If someone can help me find out what the app activity is to opening this and how they were able to figure that out | You just need to run adb shell command in command prompt. After that , Open the Suduko app in your device(make sure your device is connected to your laptop/pc) and go back to the command prompt and run the below command :
dumpsys window windows | grep -E 'mCurrentFocus'
The Above command will give you the package name ... | 1.2 | true | 2 | 2,808 |
2013-10-02 00:31:14.027 | What is the android activity for opening sudoku and how do I find how to? | I am using appium and using Sudoku app for Android on a Windows 7 machine using Python. If someone can help me find out what the app activity is to opening this and how they were able to figure that out | A simple VM emulate an Android device. Not dificult. | 0 | false | 2 | 2,808 |
2013-10-02 05:40:24.123 | Truncate Django CMS Placeholder | I'm creating my own Django CMS blog plugin. I'm using a placeholder to hold the full content of the blog entry and I'm trying to figure out how to automatically create an excerpt from this placeholder.
If it were simply a text field I know I could use "|truncatechars:15" in the template, but I don't know how to do this... | As you've seen, you can't truncate a placeholder, as a placeholder's job is simply to render content plugins that are added to it.
Your only viable option is to truncate the field in the render template of the plugin, or to add a separate field on your model that can store the truncated text. Such a field could be popu... | 1.2 | true | 1 | 2,809 |
2013-10-04 22:04:32.450 | I need help on creating a name changing program | This question is for a school project so don't give my exact answer XD
But please tell me how I would start it. I have been trying it for a couple of hours but I just can't get it. Here is the question:
Create a function in python that accepts names in standard form and prints them in the form:
E.g. INPUT ... | Ok, then use String.Split() To change String into List , then use len() to count the elements. Use loop for and create new string . | 0 | false | 2 | 2,810 |
2013-10-04 22:04:32.450 | I need help on creating a name changing program | This question is for a school project so don't give my exact answer XD
But please tell me how I would start it. I have been trying it for a couple of hours but I just can't get it. Here is the question:
Create a function in python that accepts names in standard form and prints them in the form:
E.g. INPUT ... | You will need an algorithm, which separates your input string by whitespaces. Then you would take the last of those separated strings and add it to your output string. You will have to add a comma, if more names are following. After that, take the other strings, starting with the first one, and check if they are alread... | 0 | false | 2 | 2,810 |
2013-10-05 22:29:24.267 | Python social auth account association only | I'm currently trying to add an 'associate google account' button to my django 1.4.8 project. I've never worked with python-social-auth before, and I'm a bit confused about only associating accounts --as opposed to authenticating against--, and how to use credentials for accessing Google Drive services.
Thanks!
A. | If your user is already logged in with a username a password you simply need to allow them to follow the same steps they would when signing up with a social account and that social account will be automatically associated with their django account | 1.2 | true | 1 | 2,811 |
2013-10-06 08:44:30.647 | Interacting with program after execution | In PyCharm, after I run a script it automatically kills it:
C:\Users\Sean.virtualenvs\Stanley\Scripts\python.exe C:/Users/Sean/PycharmProjects/Stanley/Stanley.py
Process finished with exit code 0
How can I interact with the script after it starts? For lack of a better way to phrase it, how can I get the
>>>
prompt ... | Click Run -> Edit Configurations...,
Then check the box Run with Python console. | 0.99039 | false | 3 | 2,812 |
2013-10-06 08:44:30.647 | Interacting with program after execution | In PyCharm, after I run a script it automatically kills it:
C:\Users\Sean.virtualenvs\Stanley\Scripts\python.exe C:/Users/Sean/PycharmProjects/Stanley/Stanley.py
Process finished with exit code 0
How can I interact with the script after it starts? For lack of a better way to phrase it, how can I get the
>>>
prompt ... | in Pycharm, Run/Debug menu choose Edit Configuration, check the box before 'Show command line afterwards' | 1 | false | 3 | 2,812 |
2013-10-06 08:44:30.647 | Interacting with program after execution | In PyCharm, after I run a script it automatically kills it:
C:\Users\Sean.virtualenvs\Stanley\Scripts\python.exe C:/Users/Sean/PycharmProjects/Stanley/Stanley.py
Process finished with exit code 0
How can I interact with the script after it starts? For lack of a better way to phrase it, how can I get the
>>>
prompt ... | UPDATE
Starting with version 4.0 there's an option Show command line afterwards (renamed in later versions to Run with Python console) when editing run/debug configuration in Run|Edit Configurations....
From output of python --help:
-i : inspect interactively after running script; forces a prompt even
... | 1.2 | true | 3 | 2,812 |
2013-10-07 09:03:37.463 | pythonocc loading .3md format | In the pythonOCC examples CADViewerMDI.py the CAD format step, stp, iges, igs, and brep are suported.
Do pythonOCC support the format ".3dm" and if, how do I load it.
Supoptimal sulution:
Change the format in rhino to one of the other formats. | It looks like pythonOCC do not currently support .3dm files you can either output from Rhino in another format, (sub-optimal in your post), or find/write/sponsor the writing of a .3dm importer for pythonOCC. | 0.673066 | false | 1 | 2,813 |
2013-10-07 11:16:21.040 | How to load Cython compiled .so file on both Mac OS X and Linux? | I compiled a module.pyx file to module.so under Mac OS X, and now I can use it with:
from module import method1
However, the same .so file won't work on Linux, I have to compile a new module.so under Linux.
So the problem is, how can I write a cross platform(Mac and Linux) module with Cython? | You can't. You'll have to compile a different library for each platform you need to support. | 0.999909 | false | 1 | 2,814 |
2013-10-07 18:29:07.957 | How best to handle relative urls in scraped content? | What are some methods to make relative urls absolute in scraped content so that the scraped html appears like the original and css are not broken?
I found out <base> tag may help. But how can I find out what the original base of the URL is?
I don't care about interactions with the links, but do want them to appear corr... | Keep track of the url of each page you scraped. One way would be to save it with the full URL as a filename. Then, you can resolve relative urls as per the HTML spec. | 0 | false | 1 | 2,815 |
2013-10-07 19:37:25.363 | How to tell uWSGI to prefer processes to threads for load balancing | I've installed Nginx + uWSGI + Django on a VDS with 3 CPU cores. uWSGI is configured for 6 processes and 5 threads per process. Now I want to tell uWSGI to use processes for load balancing until all processes are busy, and then to use threads if needed. It seems uWSGI prefer threads, and I have not found any config opt... | So, the solution is:
Upgrade uWSGI to recent stable version (as roberto suggested).
Use --thunder-lock option.
Now I'm running with 50 threads per process and all requests are distributed between processes equally. | 1.2 | true | 2 | 2,816 |
2013-10-07 19:37:25.363 | How to tell uWSGI to prefer processes to threads for load balancing | I've installed Nginx + uWSGI + Django on a VDS with 3 CPU cores. uWSGI is configured for 6 processes and 5 threads per process. Now I want to tell uWSGI to use processes for load balancing until all processes are busy, and then to use threads if needed. It seems uWSGI prefer threads, and I have not found any config opt... | Every process is effectively a thread, as threads are execution contexts of the same process.
For such a reason there is nothing like "a process executes it instead of a thread". Even without threads your process has 1 execution context (a thread). What i would investigate is why you get (perceived) poor performances w... | 0.999753 | false | 2 | 2,816 |
2013-10-07 21:17:22.697 | Linked Matrix Implementation in Python? | I know in a linked list there are a head node and a tail node. Well, for my data structures assignment, we are suppose to create a linked matrix with references to a north, south, east, and west node. I am at a loss of how to implement this. A persistent problem that bothers me is the head node and tail node. The user ... | There's more than one way to interpret this, but one option is:
Have a single "head" node at the top-left corner and a "tail" node at the bottom-right. There will then be row-head, row-tail, column-head, and column-tail nodes, but these are all accessible from the overall head and tail, so you don't need to keep track ... | 0 | false | 2 | 2,817 |
2013-10-07 21:17:22.697 | Linked Matrix Implementation in Python? | I know in a linked list there are a head node and a tail node. Well, for my data structures assignment, we are suppose to create a linked matrix with references to a north, south, east, and west node. I am at a loss of how to implement this. A persistent problem that bothers me is the head node and tail node. The user ... | It really depends on what options you want/need to efficiently support.
For instance, a singly linked list with only a head pointer can be a stack (insert and remove at the head). If you add a tail pointer you can insert at either end, but only remove at the head (stack or queue). A doubly linked list can support ins... | 0 | false | 2 | 2,817 |
2013-10-08 02:53:15.040 | Access iOS Apps List in iTunes via Win32 COM? | I've been using Python to script Win32 iTunes, and it's been rocky but doable. However, I wanted to move beyond just media (songs, etc.) to analyze what apps were on my devices. Can anyone recommend how to use the iTunes Win32 COM interface to, say, get a list of apps that are currently on the phone?
I thought the ap... | Apple does not offer any APIs to achieve this. | 0 | false | 1 | 2,818 |
2013-10-08 18:31:39.667 | sorting dates in key of tuples in dictionary | I have a dictionary with entries that are of the format
a = dict({(2,2013):[], (2,2011):[], (7,2013):[] , (4,2013):[]})
i want my output to be like this:
{(2,2011):[], (2,2013):[], (4,2013):[] , (7,2013):[]}
By the way its supposed to be (month,year), how can i achieve that? | after a lot of trying i changed my approach and instead of tuples, i used datetime objects and then applied the:
months_sorted = sorted(months.iteritems(), key=operator.itemgetter(0)) | 1.2 | true | 1 | 2,819 |
2013-10-08 19:46:52.183 | Python - how to normalize time-series data | I have a dataset of time-series examples. I want to calculate the similarity between various time-series examples, however I do not want to take into account differences due to scaling (i.e. I want to look at similarities in the shape of the time-series, not their absolute value). So, to this end, I need a way of nor... | The solutions given are good for a series that aren’t incremental nor decremental(stationary). In financial time series( or any other series with a a bias) the formula given is not right. It should, first be detrended or perform a scaling based in the latest 100-200 samples.
And if the time series doesn't come from a n... | 0.715303 | false | 2 | 2,820 |
2013-10-08 19:46:52.183 | Python - how to normalize time-series data | I have a dataset of time-series examples. I want to calculate the similarity between various time-series examples, however I do not want to take into account differences due to scaling (i.e. I want to look at similarities in the shape of the time-series, not their absolute value). So, to this end, I need a way of nor... | I'm not going to give the Python code, but the definition of normalizing, is that for every value (datapoint) you calculate "(value-mean)/stdev". Your values will not fall between 0 and 1 (or 0 and 100) but I don't think that's what you want. You want to compare the variation. Which is what you are left with if you do ... | 0 | false | 2 | 2,820 |
2013-10-10 12:59:09.063 | Java Application Interacting with Flash on Web Application | Is there anyway I can make a Java application communicate with a Flash Player (application) that is on a website? The flash application is quite dynamic, meaning the data changes as i refresh and visit different pages. In fact the page itself is fully flash.
Where should i be looking at to get this working?
I'm thinki... | GraniteDS will allow you to access your java objects via the Flex framework. | 0 | false | 1 | 2,821 |
2013-10-11 04:25:55.210 | Using 2to3 python in windows | I am fairly new to programming and have been learning python on codecademy. I would like to convert a python 2x program to python 3x using 2to3 on the command line but have no idea how to do it. I have looked at various other questions and articles on how to do it but I still do not understand. I have python 3.3 instal... | You need to run Python, followed by the 2to3 script, followed by tags and arguments.
Running 2to3 on command line looks something like this:
[python] [2tp3.py] [tags] [files to be converted (can be 1+)]
C:\python33\python.exe C:\python33\Tools\Scripts\2to3.py -w C:\Users\watt\Documents\Tom's Stuff\Programs\Python\pyth... | 0.201295 | false | 1 | 2,822 |
2013-10-13 01:12:12.410 | How do I install simplejson 3.3.1 for a Python project in Netbeans IDE 7.3.1 | I am trying to install simplejson-3.3.1.tar.gz so it can be accessed by my Python project in netbeans IDE 7.3.1.
I installed json.py in my src as a quick fix, but need more functionality.
I am using linus mint 15 as an OS.
I am unsure how to get my modules in netbeans to "see" methors e.g. json.dumps.
I am new to netbe... | Install Python setuptools
sudo apt-get install python-setuptools
Now using pip install simplejson
sudo pip install simplejson
In general most Python packages can be installed this way. | 0 | false | 2 | 2,823 |
2013-10-13 01:12:12.410 | How do I install simplejson 3.3.1 for a Python project in Netbeans IDE 7.3.1 | I am trying to install simplejson-3.3.1.tar.gz so it can be accessed by my Python project in netbeans IDE 7.3.1.
I installed json.py in my src as a quick fix, but need more functionality.
I am using linus mint 15 as an OS.
I am unsure how to get my modules in netbeans to "see" methors e.g. json.dumps.
I am new to netbe... | I found the issue ...
netbeans defaults to jython. I had to save my project files to another directory, delete my project (changing to python 2.7. for current project had no effect) and create a new project with netbeans with python 2.7 as the default.
Thanks for helping me get simplejson into my python 2.7 Nipun! Chri... | 0 | false | 2 | 2,823 |
2013-10-14 13:46:33.090 | How to find orphan process's pid | How can I find child process pid after the parent process died.
I have program that creates child process that continues running after it (the parent) terminates.
i.e.,
I run a program from python script (PID = 2).
The script calls program P (PID = 3, PPID = 2)
P calls fork(), and now I have another instance of P named... | The information is lost when a process-in-the-middle terminates. So in your situation there is no way to find this out.
You can, of course, invent your own infrastructure to store this information at forking time. The middle process (PID 3 in your example) can of course save the information which child PIDs it create... | 0.673066 | false | 1 | 2,824 |
2013-10-14 22:54:55.903 | How do I load a single image with multiple images on it? | I have an image file that has multiple different images on it. I was wondering how to make it so that I can load the individual images from the single one instead of breaking each into its own thing. Sorry if I couldn't clarify what I am trying to ask. | You could load it all as one image and than draw the different segments onto the screen separately, or even define variables of the segments. This would effectively give you multiple images. | 0 | false | 1 | 2,825 |
2013-10-15 04:26:33.047 | How can I avoid "Warning: Field 'xxx' doesn't have a default value" in Storm? | I'm just curious if there's a way to make the no default value warning I get from Storm to go away. I have an insert trigger in MySQL that handles these fields and everything is functioning as expected so I just want to remove this unnecessary information. I tried setting the default value to None but that causes an er... | Is it not possible for you to remove the 'IsNull' constraint from your MySQL database? I'm not aware of any where it is not possible to do this. Otherwise you could set a default string which represents a null value. | 0 | false | 1 | 2,826 |
2013-10-16 03:19:49.500 | Python - PyMQI - Get a message from a queue MQ using parameter | Using the module pymqi how do you get a message in MQ queue using a parameter, for example "UserIdentifier"? So, I would only get messages from the queue that possess this parameter "UserIdentifier". Thank you for your attention. | You can only get messages by MsgID, CorrelID or GroupID. | 0 | false | 1 | 2,827 |
2013-10-16 18:34:37.360 | Python: Creating own Widget with scrollbars | I'm working on a X-plotter like widget that plots incomming data live.
I already searched for an solution to realize a scrolling along the x-axis if the widget has to much values and so they don't fit.
I had the folling approaches to realize it:
derive from a widget that supports scrolling and child widgets and add my... | Most widgets in Gtk do not have scrollbars.
If you want to scroll the entire widget, you have to implement the GtkScrollable interface. Then, you add the widget to a GtkScrolledWindow. The scrolled window has the scrollbars, those GtkScrollbars are linked with GtkAdjustments which are passed to your custom widget throu... | 1.2 | true | 1 | 2,828 |
2013-10-17 09:22:37.010 | how to draw a nonlinear function using matplotlib? | I would like to draw the curve a generic cubic function using matplotlib. I want to draw curves that are defined by functions such as: x^3 + y^3 + y^2 + 2xy^2 = 0. Is this possible to do? | my 2 cents:
x^3+y^3+y^2+2xy^2=0
y^2=-x^3-y^3-2xy^2
y^2>0 => -x^3-y^3-2xy^2>0 => x^3+y^3+2xy^2<0 =>
x(x^2+2y^2)+y^3<0 => x(x^2+2y^2)<-y^3 => (x^2+2y^2)<-y^3/x
0<(x^2+2y^2) => 0<-y^3/x => 0>y^3/x =>
(x>0 && y<0) || (x<0 && y>0)
your graph will span across the 2nd and 4th quadrants | 0 | false | 1 | 2,829 |
2013-10-18 09:10:59.060 | Find which part of a multiple regex gave a match | I have a multiple regex which combines thousands of different regexes e.g r"reg1|reg2|...".
I'd like to know which one of the regexes gave a match in re.search(r"reg1|reg2|...", text), and I cannot figure how to do it since `re.search(r"reg1|reg2|...", text).re.pattern gives the whole regex.
For example, if my regex i... | Wrap each sub-regexp in (). After the match, you can go through all the groups in the matcher (match.group(index)). The non-empty group will be the one that matched. | 1.2 | true | 1 | 2,830 |
2013-10-18 11:26:18.377 | IntelliJ IDEA - unix python virtualenv on WIndows | I have Python application and virtualenv for it. I run it on Debian virtual machine. Is it possible to configure IntelliJ to start application and use IntelliJ debug tools? The problem is how to use virtualenv for debian in Windows 7 system. | I solved it. If connect with my virtual machine by remote debug tool. I add one line with IntellJ/PyCharm generate to entry point of paster script. Before debug i run script (using IntelliJ remote tool) with run application on virtual machine. | 0 | false | 2 | 2,831 |
2013-10-18 11:26:18.377 | IntelliJ IDEA - unix python virtualenv on WIndows | I have Python application and virtualenv for it. I run it on Debian virtual machine. Is it possible to configure IntelliJ to start application and use IntelliJ debug tools? The problem is how to use virtualenv for debian in Windows 7 system. | Just install an appropriate python and virtualenv for that python directly on the windows 7 machine. | 0 | false | 2 | 2,831 |
2013-10-18 20:17:07.087 | Bigquery: how to preserve nested data in derived tables? | I have a few large hourly upload tables with RECORD fieldtypes. I want to pull select records out of those tables and put them in daily per-customer tables. The trouble I'm running into is that using QUERY to do this seems to flatten the data out.
Is there some way to preserve the nested RECORDs, or do I need to rethin... | Unfortunately, there isn't a way to do this right now, since, as you realized, all results are flattened. | 1.2 | true | 1 | 2,832 |
2013-10-20 12:21:52.883 | Python Program to tell amount of image files that will fit on a disk/flash drive | Someone on here asked a question similar to this, but it got quickly downvoted and closed due to the newbiness of it's nature. So I decided to answer it myself, and for others who want to know how to make this nifty program, because it isn't really such a bad idea. So here goes nothing! | I'm not going to tell you your code is horrendous. But you could simplify it.
Everything in the try routine could be replaced by a single line:
print 'Space for about', int(totstor*1048576/25), 'standard jpg image files available'
In other words you can print the result of the calculation directly. Let int() take care ... | 0.201295 | false | 1 | 2,833 |
2013-10-21 01:35:22.443 | Is there a formal way to state modifications of a program covered with GPL? | So I created my own modified version of a program with the GPLv3, and it's open source and everything.
My question is how am I supposed to state that I modified it?
Do I just put in a comment saying # Modified by yentup ?
I've tried researching about this topic but I haven't found any directions on how to do so. | You have no requirement to say that you modified it at all - your only obligation is to offer the source code to anyone who uses your version.
However the best solution for you, the original authors and future users is probably to have your changes put back into the main source tree, assuming that they would be useful ... | 1.2 | true | 1 | 2,834 |
2013-10-22 05:47:42.950 | how to make python script executable when click on the file | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | Add #!/usr/bin/env python at the very beginning of file.
Make chmod u+x filename.py
Change your extension from .py to .sh, so your linux distro's UI will recognize it as shell script and try to execute. | 0.116092 | false | 6 | 2,835 |
2013-10-22 05:47:42.950 | how to make python script executable when click on the file | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | Add #!/bin/python as the very first line of your file. Or, if you don't know where your python executable is, type which python in a terminal; then copy the result of that and put it after the #!.
Change the permissions of the file so that its executable chmod u+x test.py
i try but it still open back as gedit
Righ... | 0.283556 | false | 6 | 2,835 |
2013-10-22 05:47:42.950 | how to make python script executable when click on the file | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | Add #!/usr/bin/python as the first line of the file and set the permission to executable chmod 755 yourfile. | 0 | false | 6 | 2,835 |
2013-10-22 05:47:42.950 | how to make python script executable when click on the file | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | If you don't have any specific version requirement then using first line as #!/usr/bin/env python will be more efficient and give the execute permission chmod u+x test.py | 0 | false | 6 | 2,835 |
2013-10-22 05:47:42.950 | how to make python script executable when click on the file | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | It's Nautilus's fault. Open Nautilus (the file manager), go to Menu > Preferences.
Select the "Behaviour" section.
On the field titled "Executable text files", select the option "Execute executable text files when opened". | 0.058243 | false | 6 | 2,835 |
2013-10-22 05:47:42.950 | how to make python script executable when click on the file | I am trying to make my python script executable without going through the terminal typing like
python test.py
I want to make it able to run when i click on the file.
How i going to do this in my fedora machine. | I use raspibian os (Linux)
Add #!/usr/bin/python as the first line of the file.py
right click file >> open with >> chose customize >> custom command line >> type python3
execute file with double click is working | 0 | false | 6 | 2,835 |
2013-10-22 09:11:40.180 | Distribute a slideshow from IPython notebook | so I am adoring the new IPython notebook slideshow feature, however I could not figure out how to distribute such a slideshow in a userfriendly (I am no HTML/JS guy) way.
My usecase is:
I have a somewhat messy notebook which I want to filter by tagging cells as slides/skip/- etc.
In an optimal world there would be a fi... | You can print it as a pdf file from Chrome.
Add "?print-pdf" at the end of your URL.e.g: 127.0.0.1:8000/index.html?print-pdf
Select print menu from Chrome.
Select Save As pdf, then print it out. | 0.101688 | false | 2 | 2,836 |
2013-10-22 09:11:40.180 | Distribute a slideshow from IPython notebook | so I am adoring the new IPython notebook slideshow feature, however I could not figure out how to distribute such a slideshow in a userfriendly (I am no HTML/JS guy) way.
My usecase is:
I have a somewhat messy notebook which I want to filter by tagging cells as slides/skip/- etc.
In an optimal world there would be a fi... | $ ipython nbconvert ... --to slides (no serve option necessary) create a standalone html file you should be able to mail, or whatever.
The skip/- logic can be applied to pdf generation too, you just have to write your own extended template (which is not that hard, wild guess ~20 lines) | 0.101688 | false | 2 | 2,836 |
2013-10-22 19:54:48.560 | Does print statement will make performance issue for a website | We are using the python/Django for web development. While development phase wile coding i tends to put print statement a lot places to check the control flow of the code.
And same code with print statement is uploaded for server,
I know logging is a place to be more suitable but i find myself more comfortable with prin... | Yes, since the arguments will need to be converted to strings before outputting and that can be a costly operation.
However, using print causes another issue. Some WSGI containers, notably mod_wsgi among them, do not like anything sent to stdout by default and so will raise an exception whenever that happens. You can f... | 1.2 | true | 1 | 2,837 |
2013-10-24 03:38:14.903 | how to bind multiple specified ip address on BaseHTTPRequestHandler of python | My server has 3 ip addresses, 127.0.0.1, 192.168.0.100 and an internet ip address. I'm going to run a service written by python on this server, but I don't want it to expose on internet.
I'm using BaseHTTPRequestHandler class to implement this service, so how to bind only 127.0.0.1 and 192.168.0.100 but not the other o... | Generally, routers have an option where you can allow servers to be visible or not visible. If on the router you set you server to not be visible, then your server will not be accessible through the internet. | 0 | false | 2 | 2,838 |
2013-10-24 03:38:14.903 | how to bind multiple specified ip address on BaseHTTPRequestHandler of python | My server has 3 ip addresses, 127.0.0.1, 192.168.0.100 and an internet ip address. I'm going to run a service written by python on this server, but I don't want it to expose on internet.
I'm using BaseHTTPRequestHandler class to implement this service, so how to bind only 127.0.0.1 and 192.168.0.100 but not the other o... | I think you have two choices.
1) Listen to all interfaces, but override BaseHTTPRequestHandler.init to check the client address and drop the connection if it comes from an undesired interface
2) Create multiple sockets, one per address you want to listen on. SocketServer.serve_forever() is blocking, so you will either... | 0 | false | 2 | 2,838 |
2013-10-25 22:46:33.800 | What is the purpose of the environmental variable PYTHONPATH | On windows 7, I currently don't have a python path. Can I safely make one? If so, how do I do it?
Upon making this variable, I can no longer load Spyder (IDE) without it crashing. Does anyone know why?
I would like to edit my existing python path if possible, but just don't know why it isn't already there in environmen... | it has role similar to path. this variable tells the python interpreter where to
locate the module files imported into a program. it should include the python source library directory and the directories contain in python source code | 0 | false | 1 | 2,839 |
2013-10-26 11:43:03.783 | IPython: How to wipe IPython's history selectively & securely? | I have been learning how to use the paramiko package only to discover that all I stored passwords in plain text in IPython's %hist. Not so good.
I therefore need to get rid of particular parts of what is stored in %hist. Saying that, I do not want to wipe the whole history. - Only the parts where I have been careless e... | If you want completely from beginning, Just go and delete the following file manually(It worked for me)
/home/user/.ipython/profile_default/history.sqlite | 0 | false | 2 | 2,840 |
2013-10-26 11:43:03.783 | IPython: How to wipe IPython's history selectively & securely? | I have been learning how to use the paramiko package only to discover that all I stored passwords in plain text in IPython's %hist. Not so good.
I therefore need to get rid of particular parts of what is stored in %hist. Saying that, I do not want to wipe the whole history. - Only the parts where I have been careless e... | I couldn't find the way to wipe IPython's history selectively, but I found out how to wipe data by built-in func, non-sqlite way:
%clear out #it clears output history
by the way, you can also clear in history by %clear in | 0.067922 | false | 2 | 2,840 |
2013-10-26 21:42:54.527 | Python module will not run correctly from command prompt | This goes out to anyone who is well versed in the Eclipse IDE and or PyDev perspective plug-in who is willing to offer some technical support.
I am trying to write a python module that must take in arguments from the command prompt with sys.argv function calls. Rather than printing out the correct output when I enter E... | I answered my own question in the comment above. I just had to wait to post an answer due to the fact that I just created a stackoverflow account yesterday. | 0 | false | 1 | 2,841 |
2013-10-26 22:37:27.523 | Android Client and Google App Engine APIs | Am I confused as to what is possible between an Android Client and Google App Engine? I would like to be able to create a Python API that would handle requests between GAE services such as Datastore, and an Android Client.
I have found some examples that detail how to make a call from within an Android Client, but it d... | Yes, you can use Python to do what you want.
Google designs their services (such as GAE and endpoints) to be language agnostic, e.g. using JSON to serialize objects.
There are a few advantages to using Java on both, such as being able to share code between client and service projects, but Google does not promote such d... | 1.2 | true | 1 | 2,842 |
2013-10-27 19:34:59.097 | Binary to decimal conversion - formula explanation | can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ?
I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something.. | The general formula for base B is as follows:
(B^N + ... + B^1 + B^0)*(B-1) =
(B^(N+1) + ... + B^2 + B^1) - (B^N + ... + B^1 + B^0) =
B^(N+1) - B^0 = B^(N+1)-1
Examples:
B=2 and N=3 gives 2^4 - 1 = 1111 binary
B=10 and N=3 gives 10^3 - 1 = 999 decimal | 0 | false | 4 | 2,843 |
2013-10-27 19:34:59.097 | Binary to decimal conversion - formula explanation | can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ?
I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something.. | Add 1 to 111: the result is 1000.
It follows, therefore, that:
111 + 1 = 1000 → 1000 - 1 = 111
Now, 1000 is 23, hence:
23 - 1 = 111
Of course, you can say something similar about binary numbers with any number of 1s | 0.081452 | false | 4 | 2,843 |
2013-10-27 19:34:59.097 | Binary to decimal conversion - formula explanation | can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ?
I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something.. | It is a unique property of number 2 that the sum of it's previous powers is equal to the next power level subtracted by 1.
In other words:
2^n=2^0+2^1+2^2+...+2^(n-1)+1 for n in (1,2,3...)
If you need proof, use mathematical induction.
Base: n=1; 2^1=2=2^0+1=1+1
Suppose that for n=k the property 2^n=2^0+2^1+...+2^(n-... | 1.2 | true | 4 | 2,843 |
2013-10-27 19:34:59.097 | Binary to decimal conversion - formula explanation | can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ?
I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something.. | Think of it like this, 111 is 1 less than 1000 (8 in binary). | 0.081452 | false | 4 | 2,843 |
2013-10-27 23:30:41.163 | Closing a python program window leaves program still running in the background | I made a program, which uses tkinter to create a window where stuff happens. It contains images and loops to constantly shift and move the images.
Now, when I close the window, the scripts are still running and it creates error messages that it has nowhere to place the images with new coordinates.
I think that the loop... | I had the same issue caused by a top level window I had created and withdrawn but didn't destroy. Properly destroying it fixed my issue. | 0 | false | 1 | 2,844 |
2013-10-29 16:12:47.620 | how to disable WORD WRAP in python IDLE | I’m trying to print a string that is too long to be displayed on one line, so it automatically wraps to the next line. The problem is that I need it to all stay on one line and just go off the screen (where I can just scroll left to right to see it all).Is there a way to to disable word wrap in python IDLE
by changing ... | Text wrapping is a function of your terminal, not python. All that python does is send a string to the terminal - think about it, when you say print "abcdef\n", there's no character in there that tells the terminal to wrap-text!
You just need to configure the environment you're coding in. There should be a pretty easi... | 0.999988 | false | 1 | 2,845 |
2013-10-30 05:16:14.677 | In Python how to use variables in call function? | I am using Python on Ubuntu.
call(["xdotool", "mousemove", "500","600"])works fine.
But if x=500, y=600,
call(["xdotool", "mousemove", "x","y"])
does not work.
What should be the syntax of x and y? | Remove the quotes. If you keep quotes, it will treat as a string.
call(["xdotool", "mousemove", "500","600"]) | 0 | false | 1 | 2,846 |
2013-10-30 19:44:32.313 | syncronizing across machines for a python apscheduler and wmi based windows service | I am using apscheduler and wmi to create and install new python based windows services where the service determines the type of job to be run. The services are installed across all the machines on the same network. Given this scenario I want to make sure that these services run only on one machine and not all the machi... | I tried to include functionality like this in APScheduler 2.0 but it didn't pan out. Maybe The biggest issue is handling concurrent accesses to jobs and making sure jobs get run even if a particular node crashes. The nodes also need to communicate somehow.
Are you sure you don't want to use Celery instead? | 0 | false | 1 | 2,847 |
2013-10-31 01:40:59.723 | Ubuntu - PySide module not found for python2 but works fine for python3 | I had PyQt4 running fine with python2 on Ubuntu 12.04. I then installed python-PySide. But the installation test would give me a module not found error. Then I installed python3-PySide and it works fine. So obviously something to do with my environment paths, but I'm not sure what I need to do. I'm guessing PySide... | You have two independent Python 2.7 installations, one in /usr and one in /usr/local. (And that's on top of the Python 3.x installation you also have.)
This is bound to cause confusion, especially for novices. And it has caused exactly the kind of consuion it was bound to cause.
You've installed PySide into the /usr in... | 1.2 | true | 1 | 2,848 |
2013-10-31 03:00:11.287 | How can I make pip uninstall packages that are no longer required by other packages? | For example, I may have installed pkg1, which requires pkg2 and pkg3. No other packages I have installed require these two. So, during or after pip uninstall pkg1, how can I make pip uninstall pkg2 and pkg3? | I don't think pip can do this.
If you are in virtualenv you just delete it and reinstall into new one.
If you are in system, you should never use pip but the distribution package manager. | 0 | false | 1 | 2,849 |
2013-10-31 08:59:58.380 | Using GPIO in webpage | I am using Django 1.5.4 to design a web page in which i want to use GPIO, but i got following error:
"Noᅠaccessᅠtoᅠ/dev/mem. Tryᅠrunningᅠasᅠroot! "
in browser. Since web browser itself is an application, how can i assign "root" privileges to it when it tried to render a web page ? If it can be done without any need to ... | You don't have to run the webbrowser as root but your django app (the webserver).
Of course running a web application as root is an incredibly bad idea (even on a pi), so you might want to use a separate worker process (e.g. using celery) that runs as root and accesses the GPIOs. | 1.2 | true | 1 | 2,850 |
2013-10-31 17:35:06.513 | how to run python code on amazon ec2 webservice? | I have never used amazon web services so I apologize for the naive question. I am looking to run my code on a cluster as the quad-core architecture on my local machine doesn't seem to be doing the job. The documentation seems overwhelming and I don't even know which AWS services are going to be used for running my scri... | You do not need to use S3, you would likely want to use EBS for storing the code if you need it to be preserved between instance launches. When you launch an instance you have the option to add an ebs storage volume to the drive. That drive will automatically be mounted to the instance and you can access it just like y... | 0 | false | 1 | 2,851 |
2013-10-31 21:56:17.127 | What is the best way to archive a data CD/DVD in python? | I have to archive a large amount of data off of CDs and DVDs, and I thought it was an interesting problem that people might have useful input on. Here's the setup:
The script will be running on multiple boxes on multiple platforms, so I thought python would be the best language to use. If the logic creates a bottlenec... | Writing your own backup system is not fun. Have you considered looking at ready-to-use backup solutions? There are plenty, many free ones...
If you are still bound to write your own... Answering your specific questions:
With CD/DVD you first typically have to master the image (using a tool like mkisofs), then write im... | 0 | false | 2 | 2,852 |
2013-10-31 21:56:17.127 | What is the best way to archive a data CD/DVD in python? | I have to archive a large amount of data off of CDs and DVDs, and I thought it was an interesting problem that people might have useful input on. Here's the setup:
The script will be running on multiple boxes on multiple platforms, so I thought python would be the best language to use. If the logic creates a bottlenec... | When you read file by file, you're seeking randomly around the disc, which is a lot slower than a bulk transfer of contiguous data. And, since the fastest CD drives are several dozen times slower than the slowest hard drives (and that's not even counting the speed hit for doing multiple reads on each bad sector for err... | 1.2 | true | 2 | 2,852 |
2013-11-01 02:07:50.293 | How can one efficiently remove a range of rows from a large numpy array? | Given a large 2d numpy array, I would like to remove a range of rows, say rows 10000:10010 efficiently. I have to do this multiple times with different ranges, so I would like to also make it parallelizable.
Using something like numpy.delete() is not efficient, since it needs to copy the array, taking too much time and... | Because of the strided data structure that defines a numpy array, what you want will not be possible without using a masked array. Your best option might be to use a masked array (or perhaps your own boolean array) to mask the deleted the rows, and then do a single real delete operation of all the rows to be deleted b... | 1.2 | true | 1 | 2,853 |
2013-11-02 18:16:44.190 | How can I automate google docs with Google App Engine? | Listmates:
I am designing a google app engine (python) app to automate law office documents.
I plan on using GAE, google docs, and google drive to create and store the finished documents. My plan is to have case information (client name, case number, etc.) entered and retrieved using GAE web forms and the google data... | There is currently no API to create google docs directly except for:
1) make a google apps script service, which does have access to the docs api.
2) create a ".doc" then upload and convert to gdoc.
1 is best but a gas service has some limitations like quotas. If you are only creating dozens/hundreds per day you will b... | 1.2 | true | 1 | 2,854 |
2013-11-02 20:11:16.063 | How to change color in markdown cells ipython/jupyter notebook? | I'm only looking to format a specific string within a cell. I change that cell's format to "Markdown" but I'm not sure how to change text color of a single word.
I don't want to change the look of the whole notebook (via a CSS file). | This is a very simple and effective trick for google colab.
Use the (empty) link syntax of the markdown.
[your_message]()
Then you'll get the blue text (underline). | 0.040794 | false | 1 | 2,855 |
2013-11-02 22:45:37.127 | How to maintain a strict alternating pattern of item "types" in a list? | Given a list of strings, where each string is in the format "A - something" or "B - somethingelse", and list items mostly alternate between pieces of "A" data and "B" data, how can irregularities be removed?
Irregularities being any sequence that breaks the A B pattern.
If there are multiple A's, the next B should als... | I'd write it as a generator. Repeat:
read as many A's as possible,
read as many B's as possible,
if you've read exactly 1 A and 1 B, yield them; otherwise ignore and proceed.
Also this needs an additional special case in case you want to allow the input to end with an A. | 0.101688 | false | 1 | 2,856 |
2013-11-03 18:57:51.643 | Easiest way to implement paypal shopping for e-books | I have an existing django website, and I would like to sell some pdf files through it using paypal. The buyer needs to be able to select 1 or more books, get transferred to the paypal site to enter in payment info. Then after a successful payment, the buyer gets redirected back to my website and the books start downl... | With respect, the question is slightly naive, in that there is typically a separation between the shopping cart, and the payment processing. A payment returns a binary result - it either worked or it didn't. It is up to your application to recall what was being paid for.
The Paypal API returns the success or failure o... | 0 | false | 1 | 2,857 |
2013-11-03 22:42:41.857 | Validating data in wxPython | I'm trying to create Validators for inputs on forms. I learned already that in wxPython it is necessary to inherit from wx.Validator due to lack of support for standard wxTextValidator and others.
My question is:
how effectively check that string complies to simple rules (no regexp please)
acceptableChars = ['a', 'b',... | Validate() is called only when the dialog is about to close by default, but you may also call it yourself when the control loses focus. Finally, if your control doesn't accept some characters at all, you can also intercept wxEVT_CHAR events to prevent them from being entered. I do believe wxPython demo shows how to do ... | 1.2 | true | 1 | 2,858 |
2013-11-04 03:47:58.790 | Run Python file from matlab .m file | I am looking to run a file I created in python from a matlab script. I have checked that my python file works if I run it from the python interface. However I have not been able to get my python to run from matlab. The following is the code situation I am in.
In matlab., I have the following code:(My file name is pgcod... | Your $PATH should control where python comes from, but I don't believe it will control where your pgcode.py comes from - at least, not in the way you're using it now.
You might want to either use a #!/usr/bin/env python and make your script executable, or be very mindful of what directory you're in when you try to pyth... | 0.201295 | false | 1 | 2,859 |
2013-11-04 05:01:39.937 | Why does django stops loading a page after opening several pages? | I have several django projects and they work well on my desktop. But when I run them on my laptop, they run ok for sometime. Then on a random occasion, opening a page won't work. The browser keeps trying to load the page (title tab keeps spinning, URL changes to the page its trying to open, and the page turns blank), w... | It is hard to tell whether the issue is related to Windows specifically, rather than compatibility issues with images/CSS/Javascript/plugins such as Flash. Are you running the latest versions of those browsers (or at least the same versions as on your desktop)? Do you have different security software/firewalls? Do othe... | 0 | false | 1 | 2,860 |
2013-11-04 20:31:34.417 | Error: dlopen() Library not loaded Reason: image not found | I am a newbie in this field. My laptop is Macbook air, Software: OS X 10.8.5 (12F45). I am running a code which gives me the following error:
dlopen(/Users/ramesh/offline/build_icerec/lib/icecube/phys_services.so, 2): Library not loaded: /Users/ramesh/offline/build_icerec/lib/libphys-services.dylib
Referenced from... | Shared object location under OS X is sometimes tricky. When you directly call dlopen() you have the freedom of specifying an absolute path to the library, which works fine. However, if you load a library which in turn needs to load another (as appears to be your situation), you've lost control of specifying where the l... | 1.2 | true | 1 | 2,861 |
2013-11-04 23:36:34.603 | I can't locate correct Python script to update | I have a script that I am running at /var/scripts/SomeAppName/source/importer/processor.py
That script triggers an error that has a line that says:
File "build/bdist.linux-i686/egg/something/cms/browser.py", line 43, in GetBrowser
The problem I'm running into is that I'm unable to locate build/bdist.linux-i686/egg/som... | Closing the loop: bdist in the path is a sign that the package was installed with setup.py install and is running from the standard Python system path, not from wherever you have it checked out.
Easy fix is to setup.py install it again.
Harder fix is to uninstall it and fiddle with Apache's working directory, but that'... | 1.2 | true | 1 | 2,862 |
2013-11-05 10:55:55.107 | hide pygame window on OSX | Pressing command-H in OSX immediately hides the active window. How do I achieve the same effect, programmatically, from Python? Specifically, I'd like to find a particular window that my application creates and then be able to show & hide it programmatically.
I already know how to do this with pywin32 but I'm afraid my... | Well, this ended up working. When I want to hide the window, I do pygame.display.quit() and make my code properly handle not having a display. When I want to show it, I do pygame.display.set_mode(...) with the former resolution.
The net effect is that of hiding & showing the window. Unfortunately the window gets creat... | 0 | false | 1 | 2,863 |
2013-11-05 21:59:50.913 | Using Pandas to get the closest value to a timestamp | I'm using pandas to get hourly data from a dataset with fifteen minute sampling intervals. My problem using the resample('H', how='ohlc') method is that it provides values within that hour and I want the value closest to the hour. For instance, I would like to take a value sampled at 2:55 instead of one from 3:10, bu... | I suppose you could create another column that is the Hour and subtract the time in question and get the absolute (unsigned) value that you could then do the min function on.. It is not code but I think the logic is right (or at least close.. after you find the mins,, then you can select them and then do your resample.... | 0 | false | 1 | 2,864 |
2013-11-06 15:23:07.227 | How to set form field default value without showing the field in django forms? | I'm using a forms.ModelForm to set a model's attributes. For one of the attributes, I'd like to set a default value, and I want to handle it in the form, thus no default=value on the model attribute in the model class.
On the form, though, I don't want to show the user the value, not even a hidden value, therefore, I ... | if you just want to set an initial value in the form,
form = MyForm(initial={'field': field_var}) | 0 | false | 1 | 2,865 |
2013-11-07 06:39:47.483 | how to get python installed path from command line | I am trying to get the installed path of python?
Any idea how to get the python installed path from command line in windows. I don't want to set the environment variable?
Thanks, | You can check registry by:
HKLM SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\InstallPath
or HKCU | 0.265586 | false | 1 | 2,866 |
2013-11-08 08:47:59.487 | how to close remote desktop window using python | I want to automate closing the remote desktop application using python. I open the remote desktop using mstsc. When I do
os.system("TASKKILL /F /IM mstsc.exe")
It is killing all the remote desktop applications that are open. Is there a way I can specify through python which remote desktop it has to close.
I have 2 or m... | To close one of the mstsc, you should know the pid of it. If you are opening mstsc.exe from a python script itself, then you could capture the pid of that instance.
p = Popen('C:\Windows\System32\mstsc.exe "connection.rdp"')
print p.pid
Then kill the exe using pid. | 0 | false | 1 | 2,867 |
2013-11-08 16:55:32.783 | Clear previous screen to show next screen pygame | I am trying to develop GUI for a who wants to be a millionaire game using pygame. If the user is presented with the welcome screen and clicks new game, it should clear the welcome screen and bring up the main game screen.
I tried using os.system('xxx.py') but it doesnt stay on, it just flashes and goes off.
Any ideas ... | You probably shouldn't be trying to launch a new instance of your game. You should create a reset method which can be called to restart everything. It would clear all variables, set the game state back to the start, etc. | 0.995055 | false | 1 | 2,868 |
2013-11-09 21:15:03.340 | How can a django project detect if the system has django installed? | I've built a small project on my system.
After building the project, I put it on a USB drive, and copied to another system.
When I run the project, how can it detect if django is installed in the system or if the system has all of the the requirements for the project?
For example, I made a blog example project on a lap... | Simply the module won't be found when you try to run your project.
You can run 'python' in your command line and try to 'import django' if it returns an error then django isn't found it means that django isn't installed on the current machine. | 0.201295 | false | 1 | 2,869 |
2013-11-11 00:16:40.477 | wxPython - StyledTextCtrl get currently visible lines | I am still working on my text editor, and now I want to make it run faster. So I thought I may somehow get currently visible text, and parse it as I want. So is there a way to get currently visible lines?
P.S. Or maybe there is another way to increase StyledTextCtrl's performance? Thanks. | Use GetFirstVisibleLine() to determine the first visible line. Lines are numbered starting at zero.
Use LinesOnScreen() to determine how many lines are visible on the screen.
You can use GetLine(line) to get a string of an individual line. | 1.2 | true | 1 | 2,870 |
2013-11-11 04:42:12.157 | How to use WTForms in Ajax validation? | I accustomed of using WTForms by means of Flask-WTF in my flask application. Doing server side validation is trivial. But how do I leverage this server validation to become a field level, ajax, client side validation? So, when user tab to another input fields, my application can directly goes on validating it and give ... | A great question. This is what we do (flask backend, jquery frontend):
use jquery.forms plugin to ajax forms. Pretty solid mature code. Shortcoming, cannot send json encoded data, only form-urlencoded. Receives plain or json data.
use wtfroms for form validation. Very mature codebase.
tried to use wtforms-json for ac... | 0.545705 | false | 1 | 2,871 |
2013-11-11 18:17:47.267 | Simulate Raspberry Pi GPIO signal | I'm new on Raspberry Pi and I would to know how can we simulate/mock the sensors (or GPIO) so I can test just my python code, mocking the Highs and Lows of the pins?
Thanks in advance! | IF you just don't want to trust a software layer, you could try manually setting the pin high:
The GPIO pins on the Raspberry Pi work with a voltage of 3.3VDC.
Pins 1 & 17 on the P1-GPIO header outputs 3.3VDC.
You could CAREFULLY try to connect a jumper from Pin 1 or 17 to the GPIO input pin you want to test. Connect ... | 0.201295 | false | 1 | 2,872 |
2013-11-12 03:18:32.977 | Permanent timer on Python | I have been recently working with Python, and I wish to make a program that tells me how long was the last time I inputted something without it closing (e.g. The first thing I input is the word "foo". After 15 minutes, I input foo again, so the program prints that I last inputted the word foo 15 minutes ago).
Any ideas... | Do you mean to tell you the last time you entered anything or a specific word?
If it's a specific one, make a dictionary where you use words as keys, and then store the time there. | 0 | false | 1 | 2,873 |
2013-11-12 20:50:29.433 | Qt Creator: how to hide members? | I've created a form in Qt Creator 4 and 'compile' it to python module with pyuic4. Everything is ok but when I call the class represented my for it contains over 20 form elements as a public members (including Spacers etc.). But I need only 5 of them. It's not fatal but annoying... Is there a way to declare an element ... | The pyuic tool uses the objectName to generate the names of the top-level class and its members. So to make a member "private", just prepend some underscores to the objectName property in the designer component. | 0 | false | 1 | 2,874 |
2013-11-13 11:25:14.010 | Visual Studio file nesting aspx - aspx.py | Is it possible to have .aspx and .aspx.py (IronPython codefile) nested underneath aspx files in VS 2010 ? I've seen some people added Windows registry entries for Visual Studio so other files would show up as nested underneath aspx, but I've no idea how to do it for IronPython if possible | I found the solution just in case someone needs the same, for websites which is what I needed (for web applications is easier because there's an installable tool)
Add a registry entry key ".py" in
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Projects{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles.... | 1.2 | true | 1 | 2,875 |
2013-11-13 19:31:03.547 | Flask RESTful cross-domain issue with Angular: PUT, OPTIONS methods | I've developed a small write-only REST api with Flask Restful that accepts PUT request from a handful of clients that can potentially have changing IP addresses. My clients are embedded Chromium clients running an AngularJS front-end; they authenticate with my API with a simple magic key -- it's sufficient for my very ... | Just an update to this comment. Flask CORS is the way to go, but the flask.ext.cors is deprecated.
use:
from flask_cors import CORS | 0.222949 | false | 2 | 2,876 |
2013-11-13 19:31:03.547 | Flask RESTful cross-domain issue with Angular: PUT, OPTIONS methods | I've developed a small write-only REST api with Flask Restful that accepts PUT request from a handful of clients that can potentially have changing IP addresses. My clients are embedded Chromium clients running an AngularJS front-end; they authenticate with my API with a simple magic key -- it's sufficient for my very ... | You can use the after_request hook:
@app.after_request
def after_request(response):
response.headers.add('Access-Control-Allow-Origin', '*')
response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE')
ret... | 0.999329 | false | 2 | 2,876 |
2013-11-13 22:00:05.687 | Performance: Class Based Views VS Function Based Views | I'm curious about this, from a performance point of view only, how do their differ considering the proper use? | They don't differ in performance at all. | 0.386912 | false | 1 | 2,877 |
2013-11-14 10:28:33.510 | how to find python-mosquitto version | How do I see what is the version of the python-mosquitto package used by my program? How do I find an old version of python-mosquitto (version 0.15) and remove it?
I'm running on Raspberry Pi, raspian | If you are using pip, use pip freeze | grep 'python-mosquitto' to get the package version, and pip remove python-mosquitto to remove it. | 0.201295 | false | 1 | 2,878 |
2013-11-14 19:29:51.927 | HP Quality Center Python Tests not executing any lines of script | I am familiar with Selenium using C# and integrating it with TeamCity - as a background. I am at a new company now. We have HP Quality Center and I saw a few articles how to use QC, Selenium, and Python Script to automate tests. I am having a major issue even getting a basic TDOutput.Print("test") to show up in the ... | I found an article by fijiaaron that let me know even if you/I have a 64 bit machine, we need the 32 bit version of Python installed, as soon as I installed the 32 bit version, I was able to see the print lines. Now on to the selenium... | 0.386912 | false | 1 | 2,879 |
2013-11-14 19:45:01.717 | install new version of python | I have mac os x, recently I have install python version 3.2 before I had version 2.6.1. but when I type "python" in terminal it prints Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49). what does it mean? how can I use python 3.2 that have install this week? | instead of using python I typed python3 in terminal and it was the solution | 0 | false | 1 | 2,880 |
2013-11-15 05:08:21.513 | Django REST Framework, pre_save() and serializer.is_valid(), how do they work? | I need to attach a user to a request, this seems like a fairly common thing to need to do, but it's turning out to be damn near impossible.
The docs for the Django REST Framework suggest using the pre_save method of the serializer class, which I did, but it doesn't get called when serializer.is_valid() is called, which... | It turned out the problem was that I was using ListAPIView as the base class for my view class and it doesn't have the pre_save method defined. When I added some of the mixins which had it defined everything started working.
Seems weird that something used in a lot of the basic tutorials doesn't support such a basic fe... | 1.2 | true | 1 | 2,881 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.