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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
17,718,449 | 2013-07-18T08:33:00.000 | 7 | 0 | 1 | 0 | python,memory-management | 17,718,746 | 5 | true | 0 | 0 | You could just read out /proc/meminfo. Be aware that the "free memory" is usually quite low, as the OS heavily uses free, unused memory for caching.
Also, it's best if you don't try to outsmart your OS's memory management. That usually just ends in tears (or slower programs). Better just take the RAM you need. If you w... | 1 | 18 | 0 | I would like my python script to use all the free RAM available but no more (for efficiency reasons). I can control this by reading in only a limited amount of data but I need to know how much RAM is free at run-time to get this right. It will be run on a variety of Linux systems. Is it possible to determine the free... | Determine free RAM in Python | 1.2 | 0 | 0 | 20,527 |
17,719,300 | 2013-07-18T09:16:00.000 | 1 | 1 | 0 | 0 | php,python,rest | 17,719,764 | 2 | false | 1 | 0 | So basically you can query your server from client in some interval (interval ~ 0 == realtime) and ask, if it has some news.
Normally apache can't deal with long waiting connection, because of its thread/fork request processing model.
You can try switch to nginx, because it is using socket multiplexing (select/epoll/kq... | 1 | 1 | 0 | Currently I am using Web Application(LAMP stack) with REST API to communicate with clients(Python Desktop Application).
Clients can register with server and send states to server through REST API.
Now I need to push notifications to selected clients from web application(server).
My question is how can I send push notif... | Push Notifications server to selected clients | 0.099668 | 0 | 1 | 1,317 |
17,721,796 | 2013-07-18T11:09:00.000 | 6 | 0 | 0 | 0 | android,python,tkinter | 54,502,540 | 1 | false | 0 | 1 | Even for native purposes, most developers would advise you keep away from Tkinter. It's a dated and unintuitive library that often makes GUI creation and maintenance harder than it needs to be.
The main advantage of developing apps using a Python library and embedding in Android is cross-platform support.
These librari... | 1 | 12 | 0 | I have a relatively simple tkinter program that just uses Event, Button and Label objects. I would like to translate this to be usable on an android platform.
1) What python for android should I use? QPython, py4a?
2) And on that platform, what GUI module should I use?
I'd like a little bit of detail for why you think ... | Tkinter to android translation | 1 | 0 | 0 | 16,370 |
17,730,406 | 2013-07-18T17:38:00.000 | 0 | 0 | 0 | 0 | python,report,openerp | 17,739,668 | 2 | false | 1 | 0 | I hope you can use webkit reporting. Any other openerp reporting tools have its limitations for creating dynamic columns. | 1 | 1 | 0 | I need to understand if it is possible to create reports with X number of columns. X will come from the amenities a hotel have for example. So it will change depending on the hotel selected from a wizard before generating the report.
Lets say Hotel XYZ has 5 amenities I need a report with 5 columns where I will show th... | Is it possible to generate reports with dynamic columns in OpenERP? | 0 | 0 | 0 | 582 |
17,731,701 | 2013-07-18T18:55:00.000 | 6 | 0 | 1 | 0 | ipython-notebook | 17,732,561 | 1 | true | 0 | 1 | You have to select and copy code using normal Ctrl-C Ctrl-V. 'Edit/Copy Cell' is a specific action in javascript that does a little more and that browser security policy prevent us to bind with clipboard. | 1 | 6 | 0 | I'm new to Ipython Notebook. I can cut and paste from other apps into my notebooks, but how do I copy/paste code out of notebook into a different app?
I'm accessing a Linux VNC session via Chicken. I can cut/paste with wild abandon between OSX/Linux using both command X/C/V and/or middle mouse button. I can also cop... | Possible to copy/paste from IPython Notebook to other apps? | 1.2 | 0 | 0 | 12,168 |
17,732,025 | 2013-07-18T19:13:00.000 | 0 | 0 | 1 | 0 | python,twisted | 17,734,005 | 1 | false | 0 | 0 | Ok I figured it out. Yes the LineReceiver class does indeed have class variables _buffer and line_mode. However, what it actually uses inside the LineReceiver methods are instance variables with the same name. When python creates an instance of any class that has class variables, it also creates instance variables of t... | 1 | 2 | 0 | I'm using the LineReceiver class in the python Twisted library. I see from the LineReceiver source code that the mdethods setLineMode and setRawMode set the class variable line_mode to 1 or 0. Also there is another class variable called _buffer which I assume stores data sent over the connection.
But why are line_mode ... | Python Twisted LineReceiver class variables? | 0 | 0 | 0 | 350 |
17,739,981 | 2013-07-19T07:04:00.000 | 0 | 0 | 1 | 0 | python,path,python-idle,komodo,command-line-interface | 19,372,045 | 2 | false | 0 | 0 | Is Python on your PATH? That is, if you open a command prompt and type python by itself, does it run? In Komodo, look under Edit/Preferences/Languages/Python3 and check the configuration. If python.exe is not on your PATH you can provide the full path to it there | 1 | 1 | 0 | Sorry I am a Python beginner and after several months with Python(GUI) I now want to move to Komodo IDE 8.5 (Suggested by posts on this forum), but I had trouble on configuring it to proper use. The main issue is how I can run a Python program in Komodo like in IDLE(Python GUI) using Run Module (pressing F5) feature?
W... | How can I run a python program in Komodo IDE like in IDLE(Python GUI) using Run Module feature? | 0 | 0 | 0 | 6,022 |
17,740,281 | 2013-07-19T07:21:00.000 | 0 | 0 | 0 | 0 | python,c,statistics,mcmc | 19,030,208 | 2 | false | 0 | 0 | The simplest way to explore the distribution of A is to generate samples based on the samples of B, C, and D, using your rule. That is, for each iteration, draw one value of B, C, and D from their respective sample sets, independently, with repetition, and calculate A = B*C/D.
If the sample sets for B, C, and D have th... | 1 | 1 | 1 | I have the following problem:
There are 12 samples around 20000 elements each from unknown distributions (sometimes the distributions are not uni-modal so it's hard to automatically estimate an analytical family of the distributions).
Based on these distributions I compute different quantities. How can I explore the di... | MCMC implementation in Python | 0 | 0 | 0 | 838 |
17,747,053 | 2013-07-19T13:15:00.000 | 0 | 0 | 0 | 0 | python,python-2.7,io,client-server,communication | 17,747,132 | 4 | false | 0 | 0 | If you use sockets, you can use ssh and then do scp (secured copies). If you are moving files back and forth, that would probably be the easiest way. | 1 | 0 | 0 | I am quite new to Python and recently I wanted to send some files using Python. I quickly found out about sockets. But I searched for ready-made solution, because I thought client-server communication is such a common use, there must exist some kind of library (or maybe it's just because of my Java background and I got... | Sending files in Python | 0 | 0 | 1 | 170 |
17,749,059 | 2013-07-19T14:46:00.000 | 0 | 0 | 1 | 0 | python | 17,749,113 | 4 | false | 0 | 0 | You can simply include .pyc files for the libraries required, but no - .pyc cannot work as a container for multiple files (unless you will collect all the source into one .py file and then compile it). | 1 | 3 | 0 | I am writing a program in python to be sent to other people, who are running the same python version, however these some 3rd party modules that need to be installed to use it.
Is there a way to compile into a .pyc (I only say pyc because its a python compiled file) that has the all the dependant modules inside it as we... | Python compile all modules into a single python file | 0 | 0 | 0 | 4,543 |
17,750,340 | 2013-07-19T15:50:00.000 | 1 | 0 | 0 | 0 | python,xml,postgresql,xsd,sqlalchemy | 34,734,878 | 2 | false | 0 | 0 | Not sure if there is a way directly, but you could indirectly go from XSD to a SQL Server DB, and then import the DB from SQLAlchemy | 1 | 2 | 0 | I have some very complex XSD schemas to work with. By complex I mean that each of these XSD would correspont to about 20 classes / tables in a database, with each table having approximately 40 fields. And I have 18 different XSD like that to program.
What I'm trying to achieve is: Get a XML file defined by the XSD and ... | Generate Python Class and SQLAlchemy code from XSD to store XML on Postgres | 0.099668 | 1 | 0 | 2,179 |
17,750,765 | 2013-07-19T16:11:00.000 | 1 | 0 | 1 | 0 | python,file,xlrd | 17,750,849 | 1 | true | 0 | 0 | If the processing time of the input is really small you do not need to detect this before processing the file. You can easily catch the error that you describe with "I get errors that stop the program saying cant save the file as it is already open" and provide a meaningful error message to the user. | 1 | 0 | 0 | Trying to determine if a certain excel file is already open. I have a script that opens up a template excel file and writes data to the file and then saves it as a specific formatted name. Now if the person runs the script again and forgets to close out of the excel file I get errors that stop the program saying cant s... | python xlrd check if file is already open | 1.2 | 0 | 0 | 730 |
17,752,078 | 2013-07-19T17:26:00.000 | 0 | 0 | 1 | 0 | python,file,directory | 68,172,951 | 3 | false | 0 | 0 | os.path.exists returns if it is a valid path(check for directory or file, both) whereas os.path.isfile(checks for only file, not directory) | 3 | 52 | 0 | I'm curious when these two functions will return different values. Also if you could clarify the difference between a path/directory/file that would be appreciated. | Difference between os.path.exists and os.path.isfile? | 0 | 0 | 0 | 42,796 |
17,752,078 | 2013-07-19T17:26:00.000 | 3 | 0 | 1 | 0 | python,file,directory | 17,752,144 | 3 | false | 0 | 0 | A directory tests true for exists, but false for isfile. There are a few different types of filesystem objects for which that is also true.
isfile means that it is a regular file. It is more specific than exists. | 3 | 52 | 0 | I'm curious when these two functions will return different values. Also if you could clarify the difference between a path/directory/file that would be appreciated. | Difference between os.path.exists and os.path.isfile? | 0.197375 | 0 | 0 | 42,796 |
17,752,078 | 2013-07-19T17:26:00.000 | 43 | 0 | 1 | 0 | python,file,directory | 17,752,147 | 3 | false | 0 | 0 | As you have already found out, the difference between exists and isfile is the fact that the former returns True in case the given path is a directory or a file, while the latter only returns True if the path points to a file.
Directories and files are quite similar from the technical point of view. A file can contain ... | 3 | 52 | 0 | I'm curious when these two functions will return different values. Also if you could clarify the difference between a path/directory/file that would be appreciated. | Difference between os.path.exists and os.path.isfile? | 1 | 0 | 0 | 42,796 |
17,752,417 | 2013-07-19T17:47:00.000 | 5 | 0 | 1 | 0 | python | 17,752,452 | 3 | false | 0 | 0 | It means that the argument so bracketed is optional. | 2 | 6 | 0 | I was reading the python documentation where I came across elem [,n] this notation for arguments. I have seen such notations in past. Don't just know what they mean. Also, google doesn't support searching brackets. | What does [, element] mean? | 0.321513 | 0 | 0 | 1,114 |
17,752,417 | 2013-07-19T17:47:00.000 | 0 | 0 | 1 | 0 | python | 17,752,476 | 3 | false | 0 | 0 | Generally this means that the parameter within the square brackets is optional; however, without a link to the specific documentation it's hard to say. | 2 | 6 | 0 | I was reading the python documentation where I came across elem [,n] this notation for arguments. I have seen such notations in past. Don't just know what they mean. Also, google doesn't support searching brackets. | What does [, element] mean? | 0 | 0 | 0 | 1,114 |
17,752,880 | 2013-07-19T18:16:00.000 | 1 | 0 | 1 | 0 | python,virtualenv | 17,752,935 | 1 | true | 0 | 0 | If you have activated the virtualenv in your shell, there is no difference. The obvious difference is that using the explicit path means you'll definitely get the version you expect. | 1 | 1 | 0 | This is a silly question but here it goes.
Usually, when I need to install a package in a virtual environment that for some reason is not playing nice with PIP , I activate such environment and then run /path/to/env/bin/python setup.py. This works fine but I have seen that some people just run python setup.py. Is it an... | Difference between /path/to/env/bin/python setup.py and python setup.py in virtualenv | 1.2 | 0 | 0 | 76 |
17,753,739 | 2013-07-19T19:10:00.000 | 0 | 0 | 0 | 0 | python,kerberos | 17,765,644 | 1 | false | 0 | 0 | Python obviously uses C GSS-API in the backend. You have to tweak that. MIT Kerberos or Heimdal. | 1 | 0 | 0 | Python kerberos module seems to resolve the spn to the hostname. I want to provide an explicit SPN sch as 'SERVICE/DOMAIN'. However, when I enabled the KRB5_TRACE, it showed that it was trying to get the tickets for the principal 'SERVICE/\DOMAIN/LOCAL_MACHINE_NAME@DOMAIN.COM'.
Is there a way to tell python kerberos mo... | Can I provide explicit SPN for kerberos authentication in python? | 0 | 0 | 0 | 287 |
17,754,016 | 2013-07-19T19:27:00.000 | 1 | 0 | 1 | 0 | python,macos,virtualenv,swig,m2crypto | 17,813,956 | 1 | true | 0 | 0 | So in the end I got this to work by letting buildout handle downloading and installing swig and M2Crypto and then just moving the built M2Crypto and EGG-INFO directories from where buildout put them to where virtualenv wanted them...this might not be the optimal solution, but hey, it worked. | 1 | 1 | 0 | I am working in a virtual environment and when I pip install M2Crypto on a machine that happens to have swig installed (system-wide) then it installs fine. I need to get M2Crypto to install when swig may not be available system wide though. Is there a way to install M2Crypto in the virtual environment using a local swi... | Installing M2Crypto inside of virtualenv without installing swig to the system | 1.2 | 0 | 0 | 600 |
17,754,093 | 2013-07-19T19:32:00.000 | 0 | 1 | 1 | 0 | python,git,github,git-commit | 17,754,166 | 3 | false | 0 | 0 | I'm going to go out on a limb here and say that if the new files aren't showing up in git, then they are in fact not in the right directory. Make sure the directory your files are being created in has a .git directory.
If that is already the case, you want to look at the output of git status on your local repo to see t... | 1 | 3 | 0 | I created an executable of my Python Software via Py2Exe, which creates two new directories and multiple files in them. I also created a new Python File for doing this, called setup.py.
Whenever I open up Git GUI it shows the only uncommitted changes are in my .idea\workspace.xml file (this comes up with every commit),... | Git not commiting files | 0 | 0 | 0 | 148 |
17,755,621 | 2013-07-19T21:15:00.000 | 0 | 0 | 1 | 1 | python,macos,memory,permissions | 17,755,743 | 2 | false | 0 | 0 | import os
stats = os.stat('possibly_big_file.txt')
if (stats.st_size > TOOBIG):
print "Oh no....." | 1 | 0 | 0 | I am writing code with python that might run wild and do unexpected things. These might include trying to save very large arrays to disk and trying to allocate huge amounts of memory for arrays (more than is physically available on the system).
I want to run the code in a constrained environment in Mac OSX 10.7.5 with ... | Can I limit write access of a program to a certain directory in osx? Also set maximum size of the directory and memory allocated | 0 | 0 | 0 | 139 |
17,756,791 | 2013-07-19T23:01:00.000 | 2 | 0 | 0 | 0 | python,numpy,ubuntu-12.04,32-bit | 17,756,813 | 1 | false | 0 | 0 | A 32-bit OS can only address up to aroung 4gb of ram, while a 64-bit OS can take advantage of a lot more ram (theoretically 16.8 million terabytes). Since your OS is 32-bit, your OS can only take advantage of 4gb, so your other 4gb isn't used.
The other 64-bit machine doesn't have the 4gb ram limit, so it can take ad... | 1 | 2 | 1 | I have a program for learning Artificial Neural Network and it takes a 2-d numpy array as training data. The size of the data array I want to use is around 300,000 x 400 floats. I can't use chunking here because the library I am using (DeepLearningTutorials) takes a single numpy array as training data.
The code shows M... | Python Process using only 1.6 GB RAM Ubuntu 32 bit in Numpy Array | 0.379949 | 0 | 0 | 452 |
17,757,031 | 2013-07-19T23:33:00.000 | 0 | 0 | 0 | 0 | python,sql-server-2008,map,bigdata | 17,757,423 | 1 | false | 0 | 0 | If you have bandwidth to burn, and prefer Python to SQL, go ahead and do one big query and filter in Python.
Otherwise, you're probably better off with multiple queries.
Sorry, no references here. ^_^ | 1 | 1 | 0 | I am working with Python, fetching huge amounts of data from MS SQL Server Database and processing those for making graphs.
The real issue is that I wanted to know whether it would be a good idea to repeatedly perform queries to filter the data (using pyodbc for SQL queries) using attributes like WHERE and SELECT DISTI... | SQL query or Programmatic Filter for Big Data? | 0 | 1 | 0 | 470 |
17,757,214 | 2013-07-20T00:00:00.000 | 7 | 0 | 1 | 0 | python,objective-c,garbage-collection | 17,760,465 | 1 | false | 0 | 0 | As far as I can tell, Objective-C's ARC gives, in the end, the same thing as CPython's reference counting, minus the circular reference handling. ARC is merely a fancy new name that was (re)invented to mean that the Objective-C compiler, rather than the programmer, inserts the reference counting code automatically.
Le... | 1 | 4 | 0 | I was reading about memory management for various languages and the fact that Objective-C doesn't have managed memory because it causes stutters in the UX of the mobile apps.
I know ARC doesn't deal with circular reference, while Python's GC does.
I know that ARC is not a garbage collector at all and so it does not s... | What is the difference between Python GC reference counting and Objective-C's ARC? | 1 | 0 | 0 | 921 |
17,758,039 | 2013-07-20T02:21:00.000 | 0 | 0 | 0 | 0 | python,module,virtualenv | 17,758,271 | 1 | false | 1 | 0 | Uploading your virtualenv probably won't work. There is a good chance that something in the virtualenv is dependent on the exact file paths and versions that won't match from your machine to the virtual host.
You can upload the virtualenv tool, make a new virtualenv, and then install the version of flask you want insi... | 1 | 0 | 0 | I have a flask based app, and it's now running with virtualenv on my dev machine. Now I want to deploy it to my virtual host. Sadly, this virtual host is running flask 0.6, and I want flask 0.10. I don't have enough privilege to upgrade it.
Can I just upload my whole virtual environment, and to use my own version of f... | how to deploy apps developed in virtual env | 0 | 0 | 0 | 83 |
17,759,832 | 2013-07-20T07:22:00.000 | 1 | 0 | 0 | 1 | python,swig,web-deployment | 17,759,977 | 1 | true | 0 | 0 | If you need the package to be installed by some user the easiest way will be to write the setup.py - but no just with simple setup function like most of installers. If you look at some packages, they have very complicated setup.py scripts which builds many things and C extensions with installation scripts for many exte... | 1 | 0 | 0 | I developed my first webserver app in Python.
It's a but unusual, because it does not only depend on python modules (like tornado) but also on some proprietary C++ libs wrapped using SWIG.
And now it's time to deliver it (to Linux platform).
Due to dependency on C++ lib, just sending sources with requirements.txt does ... | How to properly deploy python webserver application with extension deps? | 1.2 | 0 | 0 | 148 |
17,761,974 | 2013-07-20T11:51:00.000 | 0 | 0 | 0 | 0 | python,django,search,inheritance,django-forms | 17,762,184 | 3 | false | 1 | 0 | It seems like you just need to create another SearchView which takes the query and displays the results. I am not sure if the results have to be displayed differently depending on which page the search has been performed from but it does not seem like.
The form would not have anything to do with the other views. Yo... | 1 | 0 | 0 | We have a large Django application made up of a large number of different views (some of which contain forms). As with most large applications, we use a base layout template that contains the common layout elements across the applications (mainly a header and a footer), which the templates for all of our views extend.... | Implementing Universal Search in a Django Application | 0 | 0 | 0 | 624 |
17,764,457 | 2013-07-20T16:54:00.000 | 0 | 0 | 0 | 0 | wxpython | 17,770,596 | 2 | false | 0 | 1 | You could always set the background colour to make the grey clearer. | 1 | 0 | 0 | I have a window that is always on top as a status display. The problem is that when it is not the focused window the text (using wx.StaticText) becomes gray and thus harder to read.
Is it possible to make the text render in black even though the window is not focused? | Make disabled text render black | 0 | 0 | 0 | 272 |
17,764,619 | 2013-07-20T17:12:00.000 | 5 | 0 | 0 | 0 | python,pandas | 54,003,707 | 4 | false | 0 | 0 | if your Data Frame has Headers say : DataFrame ['Population','Salary','vehicle count']
Make your index as Year: DataFrame=DataFrame.set_index('Year')
use below code to resample data in decade of 10 years and also gives you some of all other columns within that dacade
datafame=dataframe.resample('10AS').sum() | 1 | 15 | 1 | suppose I have a dataframe with index as monthy timestep, I know I can use dataframe.groupby(lambda x:x.year) to group monthly data into yearly and apply other operations. Is there some way I could quick group them, let's say by decade?
thanks for any hints. | pandas dataframe group year index by decade | 0.244919 | 0 | 0 | 31,949 |
17,767,579 | 2013-07-20T23:09:00.000 | 1 | 0 | 1 | 1 | python,ide,development-environment | 17,768,272 | 1 | true | 0 | 0 | Assuming that Python is already on your computer:
Go to /Applications folder
Then open Utilities
Double Click Terminal to open it and get a command line
type 'python' in the command prompt
Your all set! | 1 | 0 | 0 | I would like to know from you guys how you have set up your Mac terminal for python programming. I havent done anything big so far (have used ide's until now) with python in terminal but I think that you can do all kinds of fancy things (automatic fill up functions, colors, ...). Any suggestions??
Thanks you guys! | How to setup the Mac terminal for Programming with Python? | 1.2 | 0 | 0 | 263 |
17,767,807 | 2013-07-20T23:55:00.000 | 0 | 0 | 0 | 0 | python,machine-learning,scipy,scikit-learn,unsupervised-learning | 17,768,482 | 1 | false | 0 | 0 | The fastest clustering algorithm I know of does this:
Repeat O(log N) times:
C = M x X
Where X is N x dim and M is clus x N...
If your clusters are not "flat"...
Perform f(X) = ... This just projects X onto some "flat" space... | 1 | 3 | 1 | Are there implementations available for any co-clustering algorithms in python? The scikit-learn package has k-means and hierarchical clustering but seems to be missing this class of clustering. | Co-clustering algorithm in python | 0 | 0 | 0 | 720 |
17,772,477 | 2013-07-21T12:43:00.000 | 0 | 1 | 0 | 0 | python,matplotlib,matplotlib-basemap | 18,180,819 | 2 | false | 0 | 0 | I think there's no equivalent function for your needs. You could however, derive the lon/lat-values of the end point mathematically (knowing the northpole-referenced bearing) and assign these to the drawgreatcircle()- function. | 1 | 2 | 0 | I would like to draw a great circle arc on maps.
The function drawgreatcircle() in Basemap is usefull as long as you know the latitude and longitude of the starting and the destination points on the map.
My problem is that I have the starting point and a bearing in degrees referenced to the North pole.
Applications : R... | drawing great circle arc with Basemap knowing starting point and a bearing | 0 | 0 | 0 | 1,784 |
17,775,957 | 2013-07-21T19:19:00.000 | 1 | 0 | 1 | 0 | python,import,module,namespaces | 17,776,985 | 3 | false | 0 | 0 | When you import a module, Python's import machinery executes the code for that module to populate it, but only once. If you import the same module multiple times, it's fetched from the sys.modules cache instead. There's no way to end up with an infinite import loop.
However, Python adds the module to sys.modules befo... | 2 | 1 | 0 | I have function foo() in main.py. In main.py, I import create.py. but there is a function in create.py that needs foo() from main. I can't import main.py into create.py because main.py errors out...I assume this is some kind of race condition.
How can I make foo() available in create.py namespace? It seems kind of ine... | Python Import Statement and Recursion- need function available in module namespace | 0.066568 | 0 | 0 | 560 |
17,775,957 | 2013-07-21T19:19:00.000 | 1 | 0 | 1 | 0 | python,import,module,namespaces | 17,776,050 | 3 | true | 0 | 0 | The easy answer is move foo() to foo.py and import from there or move it to create.py and import it from there into main.py - if there are things in main.py that it needs the move the too. Your other option is to pass foo from main into create as a function parameter where it is needed. | 2 | 1 | 0 | I have function foo() in main.py. In main.py, I import create.py. but there is a function in create.py that needs foo() from main. I can't import main.py into create.py because main.py errors out...I assume this is some kind of race condition.
How can I make foo() available in create.py namespace? It seems kind of ine... | Python Import Statement and Recursion- need function available in module namespace | 1.2 | 0 | 0 | 560 |
17,776,581 | 2013-07-21T20:28:00.000 | 1 | 0 | 1 | 0 | python-3.x,python-idle | 23,576,785 | 1 | false | 0 | 0 | The feature you are referring to, is 'Code Context'.
You can select 'Options', and un-tick 'Code Context' option to remove this.
As far as I am aware, there is no user-selectable option that allows you to resize it, but I hope I am wrong or that they include that feature. | 1 | 0 | 0 | Beginner question - using IDLE w/ Python version 3.3 under Windows 7. There is a grey bar at the top of the editor window showing the current indent level (I tried but apparently don't have enough stackOverflow reputation points to show an image of it).
I find this area to be useful but sometimes my code is indented t... | How to resize grey area at top of Python IDLE editor window | 0.197375 | 0 | 0 | 1,080 |
17,777,487 | 2013-07-21T22:13:00.000 | 0 | 0 | 1 | 0 | python,autosuggest | 17,777,911 | 2 | true | 0 | 1 | I think you are referring to your IDE, the editor you are using to write your code. If this is the case, that would depend on your editor, which one are you using?
If you are using the built-in editor IDLE, then what you are looking to do is not an available option.
If you are trying to do this within your own code usi... | 1 | 0 | 0 | In python 3.3.2, how you adjust the time it takes for the suggestion box to appear just after typing a '.'. For example, say I import wxPython and type wx. after 3 seconds a list box would appear showing the available options. Is there any way to set this to appear instantly or in a very short time? Sort of like Visual... | How to adjust delay of suggestion list in Python 3.3.2 | 1.2 | 0 | 0 | 104 |
17,778,972 | 2013-07-22T02:12:00.000 | 0 | 0 | 0 | 0 | javascript,django,browser,python-2.7,client | 17,778,994 | 2 | false | 1 | 0 | Unfortunately, you can't do this unless trying a second request. There's no way to know this before actually interacting with the browser itself.
The closest I can think of is trying to set a cookie and store this information for future visits.
Hope it helps. | 2 | 0 | 0 | I am trying to find a solution to detect if clients brower has javascript enabled or not.
Is there a way to check whether JavaScript is enabled in the client browser, in django if possible or in python? | JavaScript is enabled in client browser in django or in python? | 0 | 0 | 0 | 319 |
17,778,972 | 2013-07-22T02:12:00.000 | 0 | 0 | 0 | 0 | javascript,django,browser,python-2.7,client | 32,660,783 | 2 | false | 1 | 0 | The right approach is to degrade gracefully, but that is not always possible especially with web app. Use a <noscript> tag to tell the user to re-enable javascript.
If you need a solution through django, set a cookie using JS and try to read it in the second request. If you dont see the cookie then JS is not enabled. ... | 2 | 0 | 0 | I am trying to find a solution to detect if clients brower has javascript enabled or not.
Is there a way to check whether JavaScript is enabled in the client browser, in django if possible or in python? | JavaScript is enabled in client browser in django or in python? | 0 | 0 | 0 | 319 |
17,779,316 | 2013-07-22T03:04:00.000 | 3 | 0 | 0 | 0 | python,matplotlib,histogram,gaussian | 20,057,520 | 3 | false | 0 | 0 | Another way of doing this is to find the normalized fit and multiply the normal distribution with (bin_width*total length of data)
this will un-normalize your normal distribution | 1 | 6 | 1 | I have data which is of the gaussian form when plotted as histogram. I want to plot a gaussian curve on top of the histogram to see how good the data is. I am using pyplot from matplotlib. Also I do NOT want to normalize the histogram. I can do the normed fit, but I am looking for an Un-normalized fit. Does anyone here... | Un-normalized Gaussian curve on histogram | 0.197375 | 0 | 0 | 12,313 |
17,779,403 | 2013-07-22T03:17:00.000 | 2 | 0 | 1 | 0 | python | 17,779,425 | 5 | false | 0 | 0 | UPDATE: If you want to have running the program disable only that copy? Well, the simple answer is to have the program delete itself. However, you run into the fundamental problem of copy protection: the user can just make copies of the program and run them separately, or even back up his computer before running the pr... | 4 | 0 | 0 | Is there anyway to construct a python program such that, after using it once, that specific program will no longer be usable on any computer? If so, how?
Note that I'll be compiling the program into a .exe, in case that makes things easier. | How to make a python program one-time use? | 0.07983 | 0 | 0 | 210 |
17,779,403 | 2013-07-22T03:17:00.000 | 0 | 0 | 1 | 0 | python | 17,779,471 | 5 | false | 0 | 0 | Well, I don't know python, but seems you need TWO programs. The first is a launcher, the other - your main program that you want to work only once - is loaded by the launcher, and deleted/deformed after it executes by the launcher itself, so it would never work again. I'm thinking as a windows programmer, as i'd do it ... | 4 | 0 | 0 | Is there anyway to construct a python program such that, after using it once, that specific program will no longer be usable on any computer? If so, how?
Note that I'll be compiling the program into a .exe, in case that makes things easier. | How to make a python program one-time use? | 0 | 0 | 0 | 210 |
17,779,403 | 2013-07-22T03:17:00.000 | 2 | 0 | 1 | 0 | python | 17,779,485 | 5 | false | 0 | 0 | Not really. I can load script into a virtual machine, save the state of the machine, and then reset the virtual machine every time I want to run the script.
Plus, executables generated by Py2exe, cx_Freeze, PyInstaller, etc. are easy to disassemble into your original source code, so someone wouldn't even need to go as ... | 4 | 0 | 0 | Is there anyway to construct a python program such that, after using it once, that specific program will no longer be usable on any computer? If so, how?
Note that I'll be compiling the program into a .exe, in case that makes things easier. | How to make a python program one-time use? | 0.07983 | 0 | 0 | 210 |
17,779,403 | 2013-07-22T03:17:00.000 | 1 | 0 | 1 | 0 | python | 17,784,182 | 5 | false | 0 | 0 | Distribute only a downloader with a URL with a unique key. Set up the server to only allow downloads from authorized keys (obviously, make the keys hard to guess) and to disable a key upon successful download.
Hire and set up response staff to react 24/7 to customers who insist they should get another go because lightn... | 4 | 0 | 0 | Is there anyway to construct a python program such that, after using it once, that specific program will no longer be usable on any computer? If so, how?
Note that I'll be compiling the program into a .exe, in case that makes things easier. | How to make a python program one-time use? | 0.039979 | 0 | 0 | 210 |
17,780,235 | 2013-07-22T05:02:00.000 | 0 | 0 | 0 | 0 | python,eclipse,openerp | 17,897,177 | 1 | false | 1 | 0 | I can't think of any easy way of doing this. When OpenERP connects to a database it sets up a registry containing all models and all the fields and as part of this, loads the fields into the database, performs database refactoring etc. The idea is that it is simple to inherit existing models and add your fields that ... | 1 | 0 | 0 | Hi I have created an openerp module using Python (eclipse) . I want to add a feature in my form so that admin will be able to create his own fields whenever and whatever he wants . I needed some guidance of how this will be done . As I am new to openerp , any help will be good to me . Thanks
Hopes for advice | how to make dynamic field creation capability in openerp module? | 0 | 0 | 1 | 228 |
17,783,481 | 2013-07-22T09:01:00.000 | 3 | 0 | 0 | 0 | python,scipy,curve-fitting | 17,786,438 | 1 | true | 0 | 0 | I'm afraid that the older FORTRAN-77 version of ODRPACK wrapped by scipy.odr does not incorporate constraints. ODRPACK95 is a later extension of the original ODRPACK library that predates the scipy.odr wrappers, and it is unclear that we could legally include it in scipy. There is no explicit licensing information for ... | 1 | 3 | 1 | I'm using the ODRPACK library in Python to fit some 1d data. It works quite well, but I have one question: is there any possibility to make constraints on the fitting parameters? For example if I have a model y = a * x + b and for physical reasons parameter a can by only in range (-1, 1). I've found that such constrain... | Constraints on fitting parameters with Python and ODRPACK | 1.2 | 0 | 0 | 780 |
17,785,000 | 2013-07-22T10:16:00.000 | 1 | 1 | 0 | 0 | python,git,ant,build | 17,787,947 | 2 | false | 1 | 0 | I would make with ant - it standard tool for Java-platform. May be generate ant from python or other one. Lack of this manner is not flexible of ant by comparison with Python.
Lack of Python-based solution is greater complexity of deployment in future: for linux good practice make packet, for Windows you have install p... | 1 | 0 | 0 | During our build , we call ANT from our Python .For code checkout,We have two options to checkout code from Git.
Pull code directly from Python script
Make an ANT target to pull code , Call that target from Python.
Can anyone please brief about pros and cons of both approach. I am new to all three tech.
Thanks | Git check-out from ant target or python | 0.099668 | 0 | 0 | 106 |
17,789,071 | 2013-07-22T13:38:00.000 | 0 | 0 | 0 | 0 | python,openerp | 18,320,029 | 1 | false | 1 | 0 | You can write a small wizard to do so.refer to openerp documentation for how to. | 1 | 0 | 0 | I have created a button in debugging mode of OpenERP and want to display a message on click of that button.
This is the button Ex. then How to write an action on click of this button mainly the popup and message is required | How to create a function for a pop up in OpenERP | 0 | 0 | 0 | 604 |
17,797,829 | 2013-07-22T21:34:00.000 | 2 | 0 | 1 | 0 | python,python-dateutil | 59,402,694 | 2 | false | 0 | 0 | As of 2019, I'd prefer the rrule.replace() method, e.g.:
r2 = r1.replace(until=datetime(2013, 7, 20, 0, 0)) | 1 | 2 | 0 | I want to edit an existing rrule that was parsed from a string to set an UNTIL date. How can I do that? Theoretically, I could modify the rule string and re-parse it, but then it gets complicated. I want to make it simple: Whatever the rule says about how many occurrences or until what date it goes to, I want to overri... | How to edit existing rrule? | 0.197375 | 0 | 0 | 421 |
17,800,796 | 2013-07-23T03:00:00.000 | 0 | 0 | 0 | 1 | python-2.7,httprequest,openshift,paas | 21,300,896 | 2 | false | 1 | 0 | You can also bind to arbitrary ports as long as you either want to talk out on that port or want to only consume it internally. For example some people write IRC bots using OpenShift, which goes out on port 6666 or 6667. If you want to have something listening to requests that come from outside openshift then you can o... | 2 | 0 | 0 | I am currently engaged in a project which has the following requirements.
The application is written in Python,
The Application has two threads running at any instance, one is the 'server' and the other is the 'app-logic'.
The server listens on port 6000 (or any such custom port) and reads the incoming message (whi... | Free PaaS without / with less port forwarding to bind to custom ports? | 0 | 0 | 0 | 362 |
17,800,796 | 2013-07-23T03:00:00.000 | 0 | 0 | 0 | 1 | python-2.7,httprequest,openshift,paas | 18,064,738 | 2 | false | 1 | 0 | I have found one way! That is to use the DIY cartridge (Do it yourself) in Openshift, install Python and run "Websockets". Of course this still means that the transmissions should be of HTTP.
The other option is to move to IaaS (infrastructure as a service) rather than PaaS. | 2 | 0 | 0 | I am currently engaged in a project which has the following requirements.
The application is written in Python,
The Application has two threads running at any instance, one is the 'server' and the other is the 'app-logic'.
The server listens on port 6000 (or any such custom port) and reads the incoming message (whi... | Free PaaS without / with less port forwarding to bind to custom ports? | 0 | 0 | 0 | 362 |
17,802,242 | 2013-07-23T05:41:00.000 | 9 | 0 | 1 | 0 | python,exception,python-2.7,superclass | 17,802,352 | 2 | true | 0 | 0 | BaseException includes things like KeyboardInterrupt and SystemExit, which use the exception mechanism, but which most people shouldn't be catching. It's analogous to Throwable in Java, if you're familiar with that. Things that derive directly from BaseException are generally intended to shut down the system while exec... | 1 | 5 | 0 | In python, whenever we are writing User-defined exception, we have to extend it from class Exception.
my question is why can't we extend it from BaseException which is super-class of exception hierarchy and Exception is also subclass of BaseException. | why should we use Exception as a superclass, why not BaseException | 1.2 | 0 | 0 | 990 |
17,805,952 | 2013-07-23T09:09:00.000 | 0 | 1 | 0 | 0 | python,ruby,macos | 17,810,311 | 3 | false | 1 | 0 | If all that you are worried about is quickly setting up a new machine, use a backup software to setup the new machine. You can also try to use a custom time machine setup with just the folders that you are interested it. | 2 | 2 | 0 | I'm a designer who writes mostly Sass, Less (CSS pre-processors), HTML, Javascript and usually starts off with static site generators such as Jekyll, Yeoman, etc. While working with developers who code in Python, Ruby, Clojure, I help with the templates. In my free time, I design wordpress themes and write plugins in P... | Best practices for management of a developer system on Mac OS X for non-developers | 0 | 0 | 0 | 673 |
17,805,952 | 2013-07-23T09:09:00.000 | 0 | 1 | 0 | 0 | python,ruby,macos | 17,808,568 | 3 | false | 1 | 0 | I am not sure what you meant by "How can you help me setup my Mac?". It seems that you are very much comfortable installing all the dependencies(gems and all) for your projects. If you want to automate all these environment installation setup then you may go ahead and write a generic shell script to install ruby, pytho... | 2 | 2 | 0 | I'm a designer who writes mostly Sass, Less (CSS pre-processors), HTML, Javascript and usually starts off with static site generators such as Jekyll, Yeoman, etc. While working with developers who code in Python, Ruby, Clojure, I help with the templates. In my free time, I design wordpress themes and write plugins in P... | Best practices for management of a developer system on Mac OS X for non-developers | 0 | 0 | 0 | 673 |
17,807,106 | 2013-07-23T10:04:00.000 | 0 | 0 | 0 | 0 | python,wxpython | 18,277,589 | 1 | true | 0 | 1 | Found the problem:
Boa Constructor always automatically add wx.StaticBox into previous wx.BoxSizer you created on wx.Panel, and you have to remove wx.StaticBox from wx.BoxSizer before you add wx.StaticBoxSizer for wx.StaticBox, or the whole program would crash. | 1 | 0 | 0 | I'm recently using Boa Constructor to build GUI, and here's my problem:
create a new wx.Frame
add a wx.Panel
add a wx.BoxSizer
add a wx.StaticBox
add a wx.StaticBoxSizer
It crashes every single time and I've no idea why? Am I doing something wrong?
Environment: win 7 Ultimate 64bit / python 2.7.3(32bit) / wxPython 2.... | Boa Constructor keeps crashing | 1.2 | 0 | 0 | 187 |
17,808,137 | 2013-07-23T10:52:00.000 | 0 | 0 | 0 | 0 | python,flask,recaptcha,flask-wtforms | 17,856,425 | 3 | false | 1 | 0 | After a couple hours trying to get a custom design working I couldn't make it work. Flask-WTF outputs all the html and javascript code for the recaptcha to work. You can't change its behavior without editing the extension code itself. | 1 | 1 | 0 | I'm trying to customize the recaptcha inside my form, but I only get a javascript error. Can it be made, or do I have to modify the Flask-WTF code myself? | How to use a recaptcha custom theme with Flask-WTF | 0 | 0 | 0 | 1,772 |
17,813,029 | 2013-07-23T14:25:00.000 | 2 | 0 | 0 | 0 | python,algorithm,set,cover | 17,813,855 | 1 | false | 0 | 0 | If you want an exponential algorithm, just try every subset of the set of packages and take the cheapest one that contains all the things you need. | 1 | 0 | 1 | Sorry about the title, SO wasn't allowing the word "problem" in it. I have the following problem:
I have packages of things I want to sell, and each package has a price. When someone requests things X, Y and Z, I want to look through all the packages, some of which contain more than one item, and give the user the comb... | An optimal algorithm for the weighted set cover issue? | 0.379949 | 0 | 0 | 1,472 |
17,815,798 | 2013-07-23T16:27:00.000 | 0 | 0 | 0 | 0 | python,networking,router,modem | 17,822,488 | 1 | false | 0 | 0 | A very common way of monitoring router status is by using snmp.
As a summary, for a small home router, it involves at least the following steps:
Enable snmp in your router (this usually is only setup "snmp
communities", they are the passwords for reading and writing). If
your router allows it, I recommend to you to ad... | 1 | 1 | 0 | I want To Read my Internet router traffic light(Power + adsl ) light to simulate the real time Lights as my modem is located far from my room and my dsl lights keeps disconnecting frequently , So it becomes a pain to check it status every time lights go out...
How Can I Do this in python (I have Read about pyserial But... | Read traffic light from Router to simulate lights on python/shell script | 0 | 0 | 1 | 400 |
17,817,019 | 2013-07-23T17:27:00.000 | 2 | 0 | 1 | 0 | python,emacs,ipython | 26,088,884 | 6 | false | 0 | 0 | I've tried abo-abo's approach to running ipython inside of emacs. Its a pretty slick way of shortcutting shell functions within emacs. However, you do lose emacs functionality when you are in the shell (e.g. can't M-x o out of the shell)
Instead, I personally think that using the Emacs builtin shell command (M-x shel... | 1 | 25 | 0 | In order to use IPython during Python development in Emacs, I have been opening up a terminal, and typing ipython. This doesn't seem like the right way to do it.
For one thing, my buffer lists this buffer as *ansi-term*, which is confusing, as I often end up with multiple terminals, one of which is dedicated to Python.... | How to open IPython interpreter in emacs? | 0.066568 | 0 | 0 | 24,097 |
17,817,889 | 2013-07-23T18:13:00.000 | 20 | 0 | 0 | 0 | python,scipy,kdtree | 17,822,258 | 1 | false | 0 | 0 | The problem with k-d-trees is that they are not designed for updates.
While you can somewhat easily insert objects (if you use a pointer based representation, which needs substantially more memory than an array-based tree), and do deletions with tricks such as tombstone messages, doing such changes will degrate the per... | 1 | 22 | 1 | I have a set of points for which I want to construct KD Tree. After some time I want to add few more points to this KDTree periodically. Is there any way to do this in scipy implementation | Is there any way to add points to KD tree implementation in Scipy | 1 | 0 | 0 | 6,831 |
17,819,464 | 2013-07-23T19:34:00.000 | 3 | 1 | 1 | 0 | php,python | 17,819,545 | 2 | true | 0 | 0 | You need to test it, because there's no single right answer. All cx_freeze does is wrap up the bytecode into an executable, vs. the interpreter reading from its cached .pyc on disk.
In theory the packaged executable could be quicker because it's reading fewer files, but on the other hand the interpreter could be quick... | 2 | 0 | 0 | I'm planning to use python to build a couple of programs to be used as services, run from PHP code later on.
In terms of performance, which is faster, to compile the python code into a binary file using cx_freeze or to run the python interpreter each time I run the program?
Deployment environment:
OS: Arch Linux ARM
Ha... | Compiled binaries VS interpreted code in python | 1.2 | 0 | 0 | 139 |
17,819,464 | 2013-07-23T19:34:00.000 | 3 | 1 | 1 | 0 | php,python | 17,819,536 | 2 | false | 0 | 0 | cx_freeze (and the various competitors for "compiling" Python code to executables) don't actually compile anything. They're just a convenient way of packaging the app in such a way that it can be run directly. In other words, there's no performance difference.
Depending on what you need to do in your Python script, you... | 2 | 0 | 0 | I'm planning to use python to build a couple of programs to be used as services, run from PHP code later on.
In terms of performance, which is faster, to compile the python code into a binary file using cx_freeze or to run the python interpreter each time I run the program?
Deployment environment:
OS: Arch Linux ARM
Ha... | Compiled binaries VS interpreted code in python | 0.291313 | 0 | 0 | 139 |
17,820,037 | 2013-07-23T20:06:00.000 | 1 | 0 | 0 | 0 | python,django,virtualenv | 17,820,118 | 3 | false | 1 | 0 | Yes. Use virtualenv to install each project in its own isolated environment, with its own installation of libraries. | 1 | 0 | 0 | I'm using different Django framework version(1.3, 1.4, 1.5) for different projects.
On my laptop, I have to reinstall Django with pip, every time I want to switch to another project.
Is there an easier(less stupid! :D) way, that i can automatically switch to the version I need? Something like NVM for node? | Switch Django's version | 0.066568 | 0 | 0 | 1,815 |
17,820,618 | 2013-07-23T20:40:00.000 | 42 | 0 | 1 | 0 | python,pdb | 41,372,274 | 7 | false | 0 | 0 | A simple Ctrl-D will break out of pdb. If you want to continue rather than breaking, just press c rather than the whole continue command | 3 | 154 | 0 | I'm using the pdb module to debug a program. I'd like to understand how I can exit pdb and allow the program to continue onward to completion. The program is computationally expensive to run, so I don't want to exit without the script attempting to complete. continue doesn't seems to work. How can I exit pdb and contin... | How to exit pdb and allow program to continue? | 1 | 0 | 0 | 102,882 |
17,820,618 | 2013-07-23T20:40:00.000 | 0 | 0 | 1 | 0 | python,pdb | 60,901,222 | 7 | false | 0 | 0 | find new way to exit the pdb without install anything:
- when the program starts to run, press ctrl+c, then switch the window to another(any window), then the original shell with pdb running should show
something like: (pdb) .....
- switch back to pdb, then press Enter, now you are all set, pdb command
shell reappear a... | 3 | 154 | 0 | I'm using the pdb module to debug a program. I'd like to understand how I can exit pdb and allow the program to continue onward to completion. The program is computationally expensive to run, so I don't want to exit without the script attempting to complete. continue doesn't seems to work. How can I exit pdb and contin... | How to exit pdb and allow program to continue? | 0 | 0 | 0 | 102,882 |
17,820,618 | 2013-07-23T20:40:00.000 | 0 | 0 | 1 | 0 | python,pdb | 71,297,328 | 7 | false | 0 | 0 | Disable the breakpoint. from pdb, just type disable N, where N is the breakpoint number you are stuck on. If you don't know the number of your troubling breakpoint, enter tbreak. This will list your breakpoints by number under column "Num" and show whether (yes) or not (no) they are enabled or disabled under the colum... | 3 | 154 | 0 | I'm using the pdb module to debug a program. I'd like to understand how I can exit pdb and allow the program to continue onward to completion. The program is computationally expensive to run, so I don't want to exit without the script attempting to complete. continue doesn't seems to work. How can I exit pdb and contin... | How to exit pdb and allow program to continue? | 0 | 0 | 0 | 102,882 |
17,822,123 | 2013-07-23T22:30:00.000 | 2 | 0 | 0 | 0 | python,fonts,widget,wxpython | 17,824,813 | 2 | false | 0 | 1 | Not yet, but it will probably be possible soon. I saw a patch and discussion about it recently in the wxWidgets Trac. | 1 | 3 | 0 | I'm developing an application for a company that is trying to brand itself with a particular font. They've given me all the .otf files for the fonts their other products use. Is it possible to set the font on widgets such as buttons and static texts to use these external files?
If so, would it be platform-independent? ... | Set wxPython widget font to external font file | 0.197375 | 0 | 0 | 1,017 |
17,822,595 | 2013-07-23T23:17:00.000 | 1 | 0 | 0 | 0 | python,pandas | 17,822,815 | 1 | true | 0 | 0 | I believe we enabled in 0.12
you can pass str,np.str_,object in place of an S4
which all convert to object dtype in any event
or after you read it in
df['year'].astype(object) | 1 | 0 | 1 | I am loading a text file into pandas, and have a field that contains year. I want to make sure that this field is a string when pulled into the dataframe.
I can only seem to get this to work if I specify the exact length of the string using the code below:
df = pd.read_table('myfile.tsv', dtype={'year':'S4'})
Is the... | Specify DataType using read_table() in Pandas | 1.2 | 0 | 0 | 4,022 |
17,824,526 | 2013-07-24T03:07:00.000 | 0 | 0 | 0 | 1 | python-2.7,websocket,tornado | 17,835,810 | 2 | false | 1 | 0 | WebSocket was designed for low-latency bidirectional browser<->service communication. It's placed on top of TCP/IP and brings along some overhead. It was designed to solve all the problems that you simply do not have when it's about front-end<->back-end communication, because there we're talking about a defined environ... | 1 | 0 | 0 | Im using python tornado as web server and I have a backend server and a frontend server. I want to create browser-frontend-backend connection. Can anyone help me how to do this? I know how to create websocket connection between frontend and browser but I have no idea how to connect my frontend server to backend server... | Websocket connection between two servers | 0 | 0 | 1 | 1,390 |
17,824,920 | 2013-07-24T03:52:00.000 | 1 | 0 | 1 | 0 | python,notepad++ | 17,825,068 | 1 | true | 0 | 0 | You might be able to leverage regular expressions. The range limitation makes it more difficult, but with 2 different replaces, I think we can manage it. (The complication comes from the fact you don't want to replace values like 900.4.3.)
Back up your file, just to be safe.
Open the Replace dialog, and change Search ... | 1 | 0 | 0 | I'm trying to replace several hundred different values with a single value:(example)=
Line 115242: birth_date="850.1.1"
Line 115317: birth_date="851.1.1"
Line 115392: birth_date="855.1.1"
.... etc.
I want to replace each one with: birth_date="451.1.1"
Is there a quick and easy way to do... | Notepad++ range replace | 1.2 | 0 | 0 | 602 |
17,826,391 | 2013-07-24T06:07:00.000 | 5 | 0 | 0 | 0 | python,database,sqlite | 17,826,461 | 2 | false | 0 | 0 | Wrap all insert commands into a single transaction.
Use prepared statements.
Create the index only after inserting all the data (i.e., don't declare a primary key). | 1 | 1 | 0 | I have a load of data in CSV format. I need to be able to index this data based on a single text field (the primary key), so I'm thinking of entering it into a database. I'm familiar with sqlite from previous projects, so I've decided to use that engine.
After some experimentation, I realized that that storing a hund... | What's the best way to insert over a hundred million rows into a SQLite database? | 0.462117 | 1 | 0 | 1,881 |
17,830,806 | 2013-07-24T10:02:00.000 | 0 | 0 | 0 | 0 | python,format,return,bottle | 17,832,612 | 2 | false | 1 | 0 | The Request Mime-type(or content-type) is the type of the content being sent to the server - it does not mean this is the same type that should be returned by the server.
The client should know what the server Response type is going to be, and not otherwise - the server should not "guess" what response the client wants... | 1 | 0 | 0 | I am using bottle for a POC restful service project. would someone kindly let me know what is the best way to decide if the caller wants me to send the response in JSON, XML, or HTML? I have seen some examples of this using request.mimetypes.best_match, but that needs me to import flask. is there a way to do this in bo... | python bottle deciding on return mimetype | 0 | 0 | 1 | 377 |
17,832,132 | 2013-07-24T11:04:00.000 | 0 | 0 | 0 | 0 | python,django | 17,834,315 | 2 | false | 1 | 0 | When DEBUG=False Error messages wont appear on site.You will get email to mails listed in 'ADMINS' settings in the "settings.py" file. | 2 | 0 | 0 | Let's say I have console handler that prints DEBUG messages to console.
On production server where DEBUG=False, do debug messages displayed on console? Or they're only valid on development machine. | Do debug messages being displayed on production server? | 0 | 0 | 0 | 124 |
17,832,132 | 2013-07-24T11:04:00.000 | 1 | 0 | 0 | 0 | python,django | 17,853,247 | 2 | false | 1 | 0 | Django prints to apache's error.log when DEBUG=False. | 2 | 0 | 0 | Let's say I have console handler that prints DEBUG messages to console.
On production server where DEBUG=False, do debug messages displayed on console? Or they're only valid on development machine. | Do debug messages being displayed on production server? | 0.099668 | 0 | 0 | 124 |
17,832,954 | 2013-07-24T11:40:00.000 | 1 | 0 | 0 | 0 | php,python,cgi | 17,833,204 | 1 | true | 1 | 0 | Probably by bind mounts (assuming Linux), so that the file is in it's original location as well as in the web root.
Or by priviledge separation. The web root sends a query to some worker job, that has access to all the needed files. | 1 | 0 | 0 | I have developed a python desktop application and application itself having setup page to change some configurations in the application and it is saved as a configuration file.
Now I need do to give web interface to change those configurations by using web browser remotely. But I need to change the same configuration f... | Edit a file outside the web root | 1.2 | 0 | 0 | 126 |
17,837,723 | 2013-07-24T14:57:00.000 | 1 | 0 | 1 | 0 | python,django,virtualenv | 17,837,797 | 3 | false | 1 | 0 | This goes to the very heart of how you use virtualenv: cd to the virtualenv directory, then activate it (or the other way around - it doesn't really matter). The usual way to do this on linux (or cygwin) is to source ./bin/activate/ from inside the virtualenv.
At that point, if you use pip or python they will be local ... | 1 | 15 | 0 | I am very new to django. I just have a very basic question about project layout using virtualenv. When we create virtualenv and install all the dependencies-django etc, do I need to switch my directory to the virtualenv and then create a project there? Or do I need to create my project outside of virtualenv. I apologiz... | Django virtualenv layout | 0.066568 | 0 | 0 | 6,964 |
17,844,688 | 2013-07-24T20:58:00.000 | 0 | 0 | 0 | 0 | python,igraph | 17,845,330 | 1 | false | 0 | 0 | As far as I understand, you wont have access to the C backend from Python. What about storing the sorted edge in an attribute of the vertices eg in g.vs["sortedOutEdges"] ? | 1 | 0 | 1 | In python and igraph I have many nodes with high degree. I always need to consider the edges from a node in order of their weight. It is slow to sort the edges each time I visit the same node. Is there some way to persuade igraph to always give the edges from a node in weight sorted order, perhaps by some preprocessing... | Fast processing | 0 | 0 | 0 | 71 |
17,847,054 | 2013-07-25T00:28:00.000 | 3 | 0 | 1 | 0 | python | 17,847,078 | 4 | false | 0 | 0 | Apparently the result you are looking for is twice the sum of the integers in [1, n/2], which evaluates to (n/2)*(n/2 + 1)/2. The formula you are looking for hence is (n/2)*(n/2 + 1). | 2 | 0 | 0 | Im new to python and although this following question seems easy I cant seem to get it right. After I put my input for n in the code and cant think of a way to get a formula that works.
This is the question:
Write a program that asks the user for a positive even integer input n, and the outputs the sum 2+4+6+8+...+n, t... | Python... display positive even numbers up to... | 0.148885 | 0 | 0 | 1,296 |
17,847,054 | 2013-07-25T00:28:00.000 | 3 | 0 | 1 | 0 | python | 17,847,069 | 4 | false | 0 | 0 | Two tips, since this is an assignment and you haven't posted any code.
The range function can produce the list you want. It takes 3 parameters, the start of the list, the stop (which is not included in the list), and the step. Since you're counting every other number, your step is 2.
The sum function would be quite ... | 2 | 0 | 0 | Im new to python and although this following question seems easy I cant seem to get it right. After I put my input for n in the code and cant think of a way to get a formula that works.
This is the question:
Write a program that asks the user for a positive even integer input n, and the outputs the sum 2+4+6+8+...+n, t... | Python... display positive even numbers up to... | 0.148885 | 0 | 0 | 1,296 |
17,855,093 | 2013-07-25T10:12:00.000 | 1 | 0 | 1 | 0 | python,tabs | 17,855,141 | 6 | false | 0 | 0 | It's best not to use tabs at all. | 5 | 0 | 0 | I usually experience the problem with tab when programming with Python (when editing the .py file with a different editor possibly).
It is so frustrating! that sometimes i want to manually put all the tabs from first line to end of the file if i need to edit.
Is there any better way of solving this problem? | How to correct syntax error due to tab order in python? | 0.033321 | 0 | 0 | 430 |
17,855,093 | 2013-07-25T10:12:00.000 | 0 | 0 | 1 | 0 | python,tabs | 17,855,174 | 6 | false | 0 | 0 | I use eclipse with pydev plugin
I can tell it once that I use spaces for indentation and that's it
I have not had do this after that at all
Also it has a lot of cool features | 5 | 0 | 0 | I usually experience the problem with tab when programming with Python (when editing the .py file with a different editor possibly).
It is so frustrating! that sometimes i want to manually put all the tabs from first line to end of the file if i need to edit.
Is there any better way of solving this problem? | How to correct syntax error due to tab order in python? | 0 | 0 | 0 | 430 |
17,855,093 | 2013-07-25T10:12:00.000 | 0 | 0 | 1 | 0 | python,tabs | 17,855,272 | 6 | false | 0 | 0 | do not use tabs spaces are better, and if you want to use an ide than vim or vi, you can choose pycharm you can format all your file with spaces | 5 | 0 | 0 | I usually experience the problem with tab when programming with Python (when editing the .py file with a different editor possibly).
It is so frustrating! that sometimes i want to manually put all the tabs from first line to end of the file if i need to edit.
Is there any better way of solving this problem? | How to correct syntax error due to tab order in python? | 0 | 0 | 0 | 430 |
17,855,093 | 2013-07-25T10:12:00.000 | 0 | 0 | 1 | 0 | python,tabs | 17,855,397 | 6 | false | 0 | 0 | Few suggestions:
Either use all tabs or all spaces.
If you already have mixed tabs & spaces, convert tabs to spaces. Many editors provide this feature.
You can also use linux command expand to convert tabs to 'n' spaces. I myself prefer this option, because it's easy to format the code (& any stupid ascii arts or tab... | 5 | 0 | 0 | I usually experience the problem with tab when programming with Python (when editing the .py file with a different editor possibly).
It is so frustrating! that sometimes i want to manually put all the tabs from first line to end of the file if i need to edit.
Is there any better way of solving this problem? | How to correct syntax error due to tab order in python? | 0 | 0 | 0 | 430 |
17,855,093 | 2013-07-25T10:12:00.000 | 0 | 0 | 1 | 0 | python,tabs | 17,855,152 | 6 | false | 0 | 0 | Use an editor that either
does not suck
has the capability to read tags (like vim, emacs or gedit)
has settings to decide how to indent your code automatically
And additionally you could
limit yourself to either tabs or spaces | 5 | 0 | 0 | I usually experience the problem with tab when programming with Python (when editing the .py file with a different editor possibly).
It is so frustrating! that sometimes i want to manually put all the tabs from first line to end of the file if i need to edit.
Is there any better way of solving this problem? | How to correct syntax error due to tab order in python? | 0 | 0 | 0 | 430 |
17,857,138 | 2013-07-25T11:45:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,oauth-2.0,google-oauth | 20,981,524 | 2 | false | 1 | 0 | You can't use OAuth2 to connect to your app with remote_api_stub/shell. This option is not provided. | 1 | 5 | 0 | I'm using GAE remote api to access the data store of my app. The authentication to GAE is made using remote_api_stub.ConfigureRemoteApi with an authentication function that returns a user name and a password.
Is there a way for authenticating using an access_token, for example OAuth or OAuth 2.0? | Google App Engine Remote API + OAuth | 0 | 0 | 1 | 907 |
17,857,189 | 2013-07-25T11:49:00.000 | 1 | 0 | 1 | 0 | python,eclipse,pydev | 17,857,465 | 1 | true | 1 | 0 | In the preferences of Eclipse, go to "PyDev/Editor/Interactive Console" and uncheck "Focus console when an evaluate command is sent from the editor". This will leave the focus in the editor, while evaluating the code in the console. | 1 | 0 | 0 | I usually use the key combination Ctrl+Alt+Enter to send a code selection from the Eclipse (Juno) PyDev editor to the interactive console. But this passes control to the console.
I was wondering if there is any way to automatically (or using a shortcut) return control to the code editor. | Switching between editor and console in PyDev | 1.2 | 0 | 0 | 264 |
17,859,553 | 2013-07-25T13:33:00.000 | 1 | 1 | 0 | 0 | python,ubuntu,crc | 17,859,633 | 1 | true | 0 | 0 | The downloaded file is most likely corrupted, try re-downloading it again. (Also note the distribute_setup.yp extension typo). | 1 | 1 | 0 | I'm using ubuntu 12.04 and I wanted to enable ubuntu one at first. So I ran ubuntuone-control-panel-qt. Then it said ImportError: No module named pkg_resources. The solutions I found on Internet said it could be fixed by reinstalling the python distribute package. So I used curl -O http://python-distribute.org/distribu... | Manually install a python distribute package occuring IOError: CRC check failed | 1.2 | 0 | 0 | 785 |
17,867,471 | 2013-07-25T19:50:00.000 | 1 | 0 | 0 | 0 | python,html,refresh | 17,868,479 | 1 | true | 1 | 0 | Without diving into complex modern things like WebSockets, there's no way for the server to 'push' a notice to a web browser. What you can do, however, it make the client check for updates in a way that is not visible to the user.
It will involve writing Javascript & writing an extra file. When writing your main webp... | 1 | 2 | 0 | I have a webpage showing some data. I have a python script that continuously updates the data(fetches the data from database, and writes it to the html page).It takes about 5 minutes for the script to fetch the data. I have the html page set to refresh every 60 seconds using the meta tag. However, I want to change this... | Refresh Webpage using python | 1.2 | 0 | 1 | 3,417 |
17,867,473 | 2013-07-25T19:50:00.000 | 1 | 0 | 0 | 1 | python,eclipse,pydev | 17,868,662 | 1 | false | 0 | 0 | Ctrl+Alt+F9 should terminate all launches, which will do the job for you. | 1 | 3 | 0 | I am afraid that my question may be duplicate, but I could not find good answers for my question in stackoverflow.
I use PyDev under Eclipse. And I often run my programs by opening a Python Console (Ctrl+Alt+Enter on the editor) for quick-and-easy debugging. The thing is I do not know how to stop the running program on... | How to stop a running program on PyDev | 0.197375 | 0 | 0 | 2,429 |
17,869,176 | 2013-07-25T21:36:00.000 | 2 | 0 | 1 | 0 | python,collections,rotation,deque | 17,869,217 | 7 | false | 0 | 0 | Using ''.join(y) should do the trick. | 1 | 6 | 0 | I am trying to output a rotated version of a string. I have taken a string, z="string", and created a deque out of it, y=collections.deque(z) (deque(['S','t','r','i','n','g']), and rotated it using the rotate method. How do I "convert" that deque object I rotated back to a string? | How to "convert" a dequed object to string in Python? | 0.057081 | 0 | 0 | 10,358 |
17,869,727 | 2013-07-25T22:15:00.000 | 0 | 1 | 0 | 0 | python,multithreading,performance,request,xml-rpc | 17,869,783 | 1 | false | 0 | 0 | In Python, due to the GIL, threads doesn't really execute in parallel. If the RPC part is waiting in an active way (loop poling for connection instead of waiting), you most probably will have the behavior you are describing. However, without seeing any code, this is just wild guess. | 1 | 0 | 0 | I am running a simulation and transmitting data through XML-RPC to a remote client. I'm using a thread to run the XML-RPC part.
But for some reason, the program runs really slow until I a make a request from any of clients that connect. And after I run the very first request, the program then runs fine.
I have a class ... | XML-RPC Python Slow before first request | 0 | 0 | 1 | 171 |
17,869,761 | 2013-07-25T22:19:00.000 | 11 | 0 | 0 | 0 | python,postgresql | 17,869,993 | 1 | false | 0 | 0 | I've always thought of it as psycho-Postgres. | 1 | 21 | 0 | Psycopg is the most popular PostgreSQL adapter for the Python programming language.
The name Psycopg does not make sense to me.
I understand the last pg means Postgres, but what about Psyco? | Where does the name `Psycopg` come from? | 1 | 1 | 0 | 2,412 |
17,869,917 | 2013-07-25T22:32:00.000 | 0 | 0 | 1 | 0 | python | 17,869,978 | 4 | false | 0 | 0 | To check if a dict has a key, you can do dict.has_key('a') | 1 | 1 | 0 | Suppose that I have a data file in which a string (say 'a,'b','c'...) appear multiple times. I wish to use 'a' and 'b' as keys, and they have multiple values associated with them.
If my dictionary is dict, and I use dict1.update({'a':1}) followed by dict1.update[{'a':2}], the 2 overwrites value 1. However, I cannot use... | Combining the use of update and append for dictionaries | 0 | 0 | 0 | 1,960 |
17,872,753 | 2013-07-26T04:10:00.000 | 21 | 0 | 0 | 0 | python,scrapy,web-crawler | 17,872,865 | 1 | true | 1 | 0 | While they have almost identical interfaces, they serve different purposes:
Downloader middlewares modify requests and responses or generate requests in response to responses. They don't directly interact with spiders. Some examples are middlewares that implement cookies, caching, proxies, redirects, setting user-agen... | 1 | 18 | 0 | Both middleware can process Request and Response. But what is the difference? | What is the difference between Scrapy's spider middleware and downloader middleware? | 1.2 | 0 | 1 | 3,140 |
17,874,063 | 2013-07-26T06:04:00.000 | 19 | 0 | 0 | 0 | python,pandas,matplotlib | 58,946,534 | 6 | false | 0 | 0 | I know this answer is 6 years later but to anyone using density=True (the substitute for the normed=True), this is not doing what you might want to. It will normalize the whole distribution so that the area of the bins is 1. So if you have more bins with a width < 1 you can expect the height to be > 1 (y-axis). If you ... | 1 | 78 | 1 | I would like to compare two histograms by having the Y axis show the percentage of each column from the overall dataset size instead of an absolute value. Is that possible? I am using Pandas and matplotlib.
Thanks | Is there a parameter in matplotlib/pandas to have the Y axis of a histogram as percentage? | 1 | 0 | 0 | 86,215 |
17,875,627 | 2013-07-26T07:39:00.000 | 1 | 0 | 0 | 0 | javascript,python,chameleon | 17,876,341 | 3 | false | 1 | 0 | You need to JSON encode the dictionary. You don't then need to put quotes around the dictionary, and JavaScript will see it as a JavaScript object. | 2 | 0 | 0 | I am trying to pass a python dictionary from a chameleon template to a javascript function. But since the dictionary contains single quotes or ' which need to be escaped I get an error in firebug that says : SyntaxError: missing ) after argument list.
My code looks like this:
<div id = "divsfp">
<input type="button" i... | Escape quotes in Javascript/Chameleon template | 0.066568 | 0 | 0 | 414 |
17,875,627 | 2013-07-26T07:39:00.000 | 0 | 0 | 0 | 0 | javascript,python,chameleon | 17,876,140 | 3 | false | 1 | 0 | You can try this, if this helps
"get_sfp('"+${dict_value}+"')"
Also from your implementation it seems that the dict_value is the variable you already know. So whats the problem accessing it from the get_sfp function.
Sorry couldn't comment as I still don't have that privilege. | 2 | 0 | 0 | I am trying to pass a python dictionary from a chameleon template to a javascript function. But since the dictionary contains single quotes or ' which need to be escaped I get an error in firebug that says : SyntaxError: missing ) after argument list.
My code looks like this:
<div id = "divsfp">
<input type="button" i... | Escape quotes in Javascript/Chameleon template | 0 | 0 | 0 | 414 |
17,877,139 | 2013-07-26T09:01:00.000 | 1 | 1 | 0 | 0 | python,hudson,sonarqube,pylint | 18,736,027 | 1 | true | 0 | 0 | There is no "reuse report" feature on the SonarQube python plugin so for now you can't prevent SonarQube to start a new pylint analysis.
I suggest you ask for the creation of a JIRA feature request on SonarQube user mailing list.
In the meantime you can try to use sonar.python.pylint parameter to make SonarQube run pyf... | 1 | 1 | 0 | I am currently using Hudson for continuous integration with python and sonar plugin for code analysis. Since I prefer pyflakes to pylint, in the build option, I've written a pyflakes command to generate a txt file. In the report violations section, I've redirected the pylint option to this txt (in the XML filename patt... | How to configure Hudson with sonar plugin for python so that the sonar report shows pyflakes-based analysis instead of pylint-based analysis? | 1.2 | 0 | 0 | 740 |
17,878,039 | 2013-07-26T09:42:00.000 | 0 | 0 | 0 | 0 | python,winapi | 18,193,224 | 1 | true | 0 | 1 | Turns out this was not a Python issue, but was an issue with the device I was using to generate mouse movements. A separate API call was required to allow this device to push events when its owner was out of focus. | 1 | 1 | 0 | I'm using win32api in a Python script to control mouse movements. It's working fantastic, but as soon as I click (I also generate click events) outside my Python shell/IDE, all my mouse events immediately stop. If I click my shell/IDE again, control is restored.
It seems like mouse control is only working when my Pytho... | Python win32api mouse control losing focus | 1.2 | 0 | 0 | 435 |
17,881,838 | 2013-07-26T12:53:00.000 | 0 | 0 | 0 | 0 | python,video,3d,move | 17,882,938 | 1 | false | 0 | 1 | I'd try to use a decent video client (mplayer, vlc). They can present the video in lots of ways, hopefully your stereoscopic issue can be solved by them.
Then I would let the client present a single window (not fullscreen) which I then would move around using window manager controls.
If you must not have window decora... | 1 | 2 | 0 | I would like to move a (stereoscopic) video on a computer screen automatically. Think of the video as the ball in a Pong game. The problem is that it should be a stereoscopic 3D video. So the video size itself is kind of small. I did this kind of movements with pictures or drawing object, but I don't know how to do it ... | move a stereoscopic video on the screen | 0 | 0 | 0 | 110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.