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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16,479,249 | 2013-05-10T09:35:00.000 | 2 | 0 | 0 | 1 | multithreading,wsgi,python-multithreading | 16,480,852 | 1 | true | 1 | 0 | You mean why do you have 3 extra per mod_wsgi daemon process.
For your configuration, 15 new threads will be created for handling the requests. The other 3 in a process are due to:
The main thread which the process was started as. It will wait until the appropriate signal is received to shutdown the process.
A monitor... | 1 | 3 | 0 | I have deployed a wsgi application on the apache and I have configured it like this:
WSGIDaemonProcess wsgi-pcapi user= group= processes=2 threads=15
After I restart the apache I am counting the number of threads:
ps -efL | grep | grep -c httpd
The local apache is running only one wsgi app but the number I get back is... | How to count the threads and process of WSGI? | 1.2 | 0 | 0 | 1,298 |
16,481,015 | 2013-05-10T11:14:00.000 | 1 | 1 | 1 | 0 | python,exception,constants,organization | 20,154,892 | 1 | false | 0 | 0 | There are really two options to solve your problem. The first approach is to classify all the constants and exceptions, and have a smaller number of broader categories. This would allow you to easily navigate into which categories you want. A dictionary (or probably nested dictionaries) would be a good way to implement... | 1 | 5 | 0 | I'm writing a Python module that has only about twenty interesting types and global methods, but lots of constants and exceptions (about 70 constants for locales, 60 constants for encodings, 20 formatting attributes, more than 200 exceptions, and so on). As a result help() on this module produces about 16,000 lines of ... | How to organize a Python module with lots of constants and exceptions? | 0.197375 | 0 | 0 | 776 |
16,485,470 | 2013-05-10T15:14:00.000 | 0 | 0 | 0 | 0 | python,button,gtk | 33,197,888 | 2 | false | 0 | 1 | Assuming you are using a gtk.Entry() and a gtk.Button(), I think what you need to do is just connecting the gtk.Entry() to your data-process function like this:
b = gtk.Button("Process")
b.connect("clicked", data-process)
e = gtk.Entry()
e.connect("activate", data-process)
That should do the "Trick".
H... | 1 | 0 | 0 | I want a key press to be mapped with a button click function in Gtk-python, i.e. if Enter key is pressed, the data-process function should execute, which is called by pressing the process button.
Can this be done? | Map a key press to a button click in Gtk Python | 0 | 0 | 0 | 1,088 |
16,487,059 | 2013-05-10T16:43:00.000 | 0 | 0 | 0 | 0 | python,qt,user-interface,pyside | 16,492,340 | 1 | false | 0 | 1 | This may or may not help but when I encountered this the only thing that helped was reinstalling/updating pyside. I thought the fixed that bug a while back however. | 1 | 2 | 0 | I've been experiencing a really weird bug recently:
Often when I zoom too much on a QGraphicsItem (using scale on the view containing it) that has a QGraphicsDropShadowEffect on it, my app closes with a segmentation fault (core dumped) error.
What's weird is that:
I use Python (with the PySide binding)
If I remove the... | Qt : Segfault when zooming on QGraphicsDropShadowEffect | 0 | 0 | 0 | 150 |
16,487,863 | 2013-05-10T17:34:00.000 | 0 | 0 | 0 | 0 | python,django | 16,488,072 | 2 | false | 1 | 0 | Are you depending on the garbage collector to close your files? I.E. the handle goes out of scope and even though you've "closed" the file, it won't go away until GC runs. If the object chain never goes out of scope, GC cannot collect it. Also, if GC does not get an opportunity to run, they won't be collected either.
I... | 1 | 1 | 0 | I recently got an exception on my server about "Too many open files". I checked lsof, and sure enough, there are a bunch of PDF files that remain open (all in the same directory). This particular file is managed through a Django FileField. I've tried to track down any places in my project that explicitly open the file ... | How can I find out which line of code is leaving a file open? | 0 | 0 | 0 | 88 |
16,490,263 | 2013-05-10T20:23:00.000 | 0 | 0 | 0 | 0 | python,user-interface,frame,wxwidgets | 16,537,239 | 3 | false | 0 | 1 | I'm not sure you can move a wxPanel from a wxFrame to another on the fly on wx.
The main reason is that the panel is dependent of its parent and you can't change it on the fly.
Now if you really want to do it, you'll have to create copy the panel in the other frame and delete the previous panel and frame (or just hide... | 1 | 2 | 0 | I am designing a GUI with several components and two wx.Frame objects F1 and F2. F1 is the main frame and F2 is the secondary frame. I would like to have a mechanism, so the user can attach these two frames into one frame, and also detach them into two frames again if needed.
Assume F1 and F2 contain panels P1 and P2 r... | Attach/Detach two frames in wxpython | 0 | 0 | 0 | 829 |
16,490,795 | 2013-05-10T21:02:00.000 | 4 | 0 | 0 | 0 | python,sockets,osi | 16,491,016 | 1 | true | 0 | 0 | Yes, that's correct.
Note that the OSI model is not commonly used in practice. More typically, you see the Internet Reference model, which compresses the OSI layers 5, 6, and 7 into a single layer called the Application Layer. | 1 | 0 | 0 | In Python I have been playing around with server sockets that listen for messages, and client socket connections that send the data to the server.
Am i correct in thinking that the server/client python programs that utilize the socket module span layers 5 (session),6(presentation) and 7(application)? I think of the pyt... | Python program sending data via sockets, what OSI layers? | 1.2 | 0 | 1 | 1,025 |
16,490,822 | 2013-05-10T21:04:00.000 | 7 | 0 | 1 | 0 | python,ruby-on-rails,ruby,rvm,virtualenv | 16,492,610 | 2 | true | 0 | 0 | At the basics, they are very similar: they provide a mean for you to have a "jailed" environment with the libraries you need in your project without installing them in the "host" environment.
RVM however provides something called gemsets which I think doesn't have an equivalent in Virtualenv (the idea of grouping a set... | 1 | 4 | 0 | Having used VirtualEnv before, I'm wondering whether RVM is essentially the exact same action, of creating unique environments where updating dependencies won't break various projects, or if it departs in some ways. | Is VirtualEnv for Python essentially the same as RVM for Ruby | 1.2 | 0 | 0 | 1,162 |
16,491,077 | 2013-05-10T21:27:00.000 | 0 | 1 | 0 | 1 | python,windows,wmi,wmic | 16,491,345 | 2 | false | 0 | 0 | From CMD.EXE, I think the command I need is wmic path Win32_USBControllerDevice get *
So most likely the general pattern is:
PowerShell: gwmi MYCLASSNAME
translates into:
CMD.EXE: wmic path
MYCLASSNAME get * | 1 | 1 | 0 | I am writing a Windows python program that needs to query WMI. I am planning to do this by using the subprocess module to call WMIC with the arguments I need.
I see a lot of examples online of using WMI via PowerShell, usually using the "commandlet" Get-WmiObject or the equivalent gwmi.
How do you do the equivalent of ... | Get-WmiObject without PowerShell | 0 | 0 | 0 | 1,863 |
16,494,463 | 2013-05-11T06:25:00.000 | 1 | 0 | 1 | 0 | python | 16,494,533 | 1 | false | 0 | 0 | No. What you are looking for is sophisticated macro functionality. You can do this in Lisp, but Python (like most languages) does not support it.
If you want, you can preprocess a file and parse it using the ast module. But you would have to do this as a separate step, before you run your Python script. | 1 | 1 | 0 | I am experimenting with writing more forgiving/ flexible functions and would like to know if it is possible to access the input arguments of a function as strings, before Python checks for syntax errors, NameErrors, etc, (for the purposes of doing my own input checking first)? | Is it possible to get at a function argument before it is parsed? | 0.197375 | 0 | 0 | 55 |
16,500,292 | 2013-05-11T18:14:00.000 | 3 | 0 | 1 | 0 | python,python-import | 16,500,314 | 1 | true | 0 | 0 | Import the modules in the module that uses them.
Placing import os in __init__.py would put os in the package's global namespace, but it would not affect the namespace of the module that uses os. Global namespaces are not shared across modules or packages, so you would get NameErrors if you did not import them in the m... | 1 | 2 | 0 | When writing your own package in Python, should __init__.py contain imports like os, sys? Or should these just be imported within the file that is using them? | Should __init__.py also contain python module imports? | 1.2 | 0 | 0 | 241 |
16,502,445 | 2013-05-11T22:51:00.000 | 5 | 0 | 0 | 0 | python,python-2.7,numpy,scipy,scikit-learn | 16,524,872 | 1 | true | 0 | 0 | There is no function for that, as we like to keep the interface very simple.
You can just do
y - rf.predict(X) | 1 | 4 | 1 | When using RandomForestRegressor from Sklearn, how do you get the residuals of the regression? I would like to plot out these residuals to check the linearity. | Residuals of Random Forest Regression (Python) | 1.2 | 0 | 0 | 2,682 |
16,503,242 | 2013-05-12T01:10:00.000 | 0 | 0 | 0 | 0 | javascript,python,ruby,browser | 16,503,582 | 3 | false | 1 | 0 | One of the reasons you don't find browsers supporting languages like Ruby or Python, is because of the user's security. JavaScript was originally embedded in browsers for convenience, but, because that was an established relationship, as security issues occurred, JavaScript was locked down, as was the browser, to remov... | 1 | 0 | 0 | Can a scripting language like Python or Ruby replace Javascript as the browser's interpreted language so that we could be writing .py or .rb files instead of .js for frontend work? If so, would that be a good idea? If not, why? If it's a good idea, why isn't it done that way? If Python/Ruby can't replace JS in the brow... | Using an alternate Scripting Language to be interpreted by the browser instead of Javascript | 0 | 0 | 0 | 392 |
16,504,470 | 2013-05-12T05:26:00.000 | 0 | 0 | 0 | 0 | python,ruby-on-rails | 16,525,800 | 1 | false | 1 | 0 | Right now I am using Flask with localtunnel. It works. | 1 | 3 | 0 | I have a webapp that is built in Rails, but I'm working with graphs and Python has far better graph libraries (namely, Graph-Tool). There are on the order of 10k lines of code written already, so it would be a hassle to switch to Django. However, the work I'm doing involves querying very, very large graphs, ones that w... | Running a Python interpreter from Rails | 0 | 0 | 0 | 73 |
16,504,499 | 2013-05-12T05:31:00.000 | 0 | 0 | 1 | 0 | python,eval | 16,506,039 | 1 | true | 0 | 0 | I think you're confusing eval() with the exact type of z[0], which is, I guess, what does the magic here. I believe that if you try to run ((1 & z[0]) != 0) directly, without eval(), you'd get the same answer BoolRef: 1 & v__a != 0. Am I correct? If so, then you need to look in the class BoolRef to fix how it implem... | 1 | 0 | 0 | A string variable is defined clause1 = "((1 & z[0]) != 0)"
Its eval() gives BoolRef: 1 & v__a != 0
while I actually need BoolRef: ((1 & v__a) != 0)
How to keep the brackets in eval() and evaluate everything else | Stop python eval() from removing brackets | 1.2 | 0 | 0 | 934 |
16,510,227 | 2013-05-12T17:36:00.000 | 4 | 0 | 0 | 0 | python,scipy,curve-fitting,least-squares | 16,521,114 | 3 | false | 0 | 0 | Assuming your data are in arrays x, y with yerr, and the model is f(p, x), just define the error function to be minimized as (y-f(p,x))/yerr. | 1 | 6 | 1 | I am fitting data points using a logistic model. As I sometimes have data with a ydata error, I first used curve_fit and its sigma argument to include my individual standard deviations in the fit.
Now I switched to leastsq, because I needed also some Goodness of Fit estimation that curve_fit could not provide. Everyth... | Python / Scipy - implementing optimize.curve_fit 's sigma into optimize.leastsq | 0.26052 | 0 | 0 | 4,123 |
16,511,231 | 2013-05-12T19:31:00.000 | 0 | 0 | 1 | 0 | python,pydev | 16,513,405 | 1 | false | 0 | 0 | There is no 'automatic' way for that... But usually in this situation you can just do a find/replace from 2 spaces to 3 spaces (or whatever was the format you had to the expected format).
Sometimes rectangular editing is helpful there too (hint: use alt+shift+A to enter/leave rectangular editing mode). | 1 | 2 | 0 | I am using PyDev perspective. I get a bad indentation warning in python files.
I just copy code from somewhere else, I cannot make sure how much space others use... so how to automatically format that or how to erase that warning? It looks bad. | Pydev indentation warning in Eclipse | 0 | 0 | 0 | 582 |
16,511,384 | 2013-05-12T19:49:00.000 | 1 | 0 | 0 | 0 | python,google-chrome,selenium,selenium-webdriver | 61,971,091 | 6 | false | 1 | 0 | I also needed to add an extention to chrome while using selenium. What I did was first open the browser using selenium then add extention to the browser in the normal way like you would do in google chrome. | 1 | 24 | 0 | I am currently using Selenium to run instances of Chrome to test web pages. Each time my script runs, a clean instance of Chrome starts up (clean of extensions, bookmarks, browsing history, etc). I was wondering if it's possible to run my script with Chrome extensions. I've tried searching for a Python example, but not... | Using Extensions with Selenium (Python) | 0.033321 | 0 | 1 | 52,452 |
16,513,269 | 2013-05-13T00:06:00.000 | -1 | 0 | 0 | 0 | python,networking,udp | 16,514,349 | 1 | true | 0 | 0 | In short, yes. I use Python/Scapy to test network equipments all the time. I am assuming you will be using Threads for the two separate communication channels. If your CPU can handle it there is no reason why you cannot do this, and of course the amount of traffic generated by network games are usually not enough to si... | 1 | 1 | 0 | Okay, please don't kill me for asking this.
I'm currently developing a 2D online multiplayer platformer shooter. Yeah, it's that cool. I have most of the game written with a couple of bugs and unoptimized, but I'm stuck when it comes to networking. I used PyGame, and so I tried using a bunch of Python libraries for ne... | Python networking with UDP for action games | 1.2 | 0 | 1 | 1,137 |
16,515,314 | 2013-05-13T05:20:00.000 | 0 | 0 | 0 | 0 | python,formencode | 16,554,536 | 2 | true | 1 | 0 | I ended up moving from FormEncode to WTForms and everything is now a whole lot easier. Seems to me like Formencode wasn't very well thought out. | 1 | 0 | 0 | How can I write a custom validator which is always executed, even when the user has submitted an empty or missing value?
I've tried overriding the to_python, validate_python, _to_python, _validate_python (and more) methods but none of these seem to get run if the user has submitted an empty or None value | Formencode and empty values | 1.2 | 0 | 0 | 430 |
16,518,002 | 2013-05-13T08:46:00.000 | 0 | 1 | 0 | 0 | python,django,jenkins,code-coverage,sonarqube | 19,887,503 | 3 | false | 1 | 0 | On Jenkins I found that coverage.xml has paths that are relative to the directory in which manage.py jenkins is run.
In my case I need to run unit tests on a different machine than Jenkins. To allow Sonar to use the generated coverage.xml, it was necessary for me to run the tests from a folder in the same spot relative... | 1 | 4 | 0 | I'm trying to get test unit coverage with Sonar. To do so, I have followed these steps :
Generating report with python manage.py jenkins --coverage-html-report=report_coverage
Setting properties in /sonar/sonar-3.5.1/conf/sonar.properties:
sonar.dynamicAnalysis=reuseReports
sonar.cobertura.reportPath=/var/lib/jenkins... | How to get tests coverage using Django, Jenkins and Sonar? | 0 | 0 | 0 | 6,621 |
16,518,733 | 2013-05-13T09:26:00.000 | 6 | 0 | 0 | 0 | python,django | 16,518,803 | 2 | false | 1 | 0 | The whole point of GET is that they are retrieved from the URL itself, removing them from the URL removes them entirely.
If you want them 'hidden' you will need to use POST. | 1 | 1 | 0 | I have the form which i am showing by normal view. Then i am send the GET parameters to djnago ChangeList view like django does for lookups like this
student/?region__id__exact=1&status__exact=Published
now is there any way to remove that from the URL in the address bar.
I don't users to see what i am doing | How can i remove the GET parameters from url in django | 1 | 0 | 0 | 3,872 |
16,519,231 | 2013-05-13T09:53:00.000 | 1 | 0 | 0 | 0 | python,http,python-2.6,python-requests,tor | 16,529,177 | 1 | true | 0 | 0 | If I remember, Tor changes routes after some pre-specified number of minutes. I'm tempted to say that the time period is 10 minutes, but I'm not entirely certain. Either way, so long as those two requests are made within that time-frame they'll have the same IP address. | 1 | 0 | 0 | I would like to use the library requests to make two HTTP-requests within a session.
However I don't know whether the IP adresses will be the same for both HTTP-requests (within that session).
Can you tell me whether it will use the same IP (important for me) or whether Tor will use two different Exit-nodes? | Make 2 HTTP-requests in a session through Tor with the same exit-node | 1.2 | 0 | 1 | 180 |
16,519,506 | 2013-05-13T10:08:00.000 | 0 | 0 | 0 | 0 | python,django,image,django-views | 16,520,285 | 5 | false | 1 | 0 | This can be only by serving your images with your custom views. E.g you should write your own view that will return static resources, and you will not use a standard django static handler | 2 | 0 | 0 | I have a django project which is running (for example) on localhost:8000.
I have an image in this address localhost:8000/static/test.jpg . A user may open just this image by going to it's url and not open the containing page.
I want to find out if this image is loaded in a user's browser (by loading the containing page... | How to find out if an image is loaded? | 0 | 0 | 0 | 195 |
16,519,506 | 2013-05-13T10:08:00.000 | 0 | 0 | 0 | 0 | python,django,image,django-views | 16,767,630 | 5 | false | 1 | 0 | Your way goes fine but bot for a high traffic. In that case you can use XSendFile library witch works with Apache | 2 | 0 | 0 | I have a django project which is running (for example) on localhost:8000.
I have an image in this address localhost:8000/static/test.jpg . A user may open just this image by going to it's url and not open the containing page.
I want to find out if this image is loaded in a user's browser (by loading the containing page... | How to find out if an image is loaded? | 0 | 0 | 0 | 195 |
16,522,493 | 2013-05-13T12:49:00.000 | 0 | 0 | 0 | 0 | android,python,sl4a | 16,633,755 | 1 | true | 1 | 0 | Ok, so I was silly to look for a droid command to write files.
The standard Python open, write, read, close commands work fine. | 1 | 1 | 0 | Is there an API call for opening, reading and writing to text files on an Android device using SL4A and Python?
If not, what options are available for persistent storage?
e.g. database, preferences, dropbox, google drive. | Writing to file with SL4A Python | 1.2 | 0 | 1 | 1,062 |
16,524,269 | 2013-05-13T14:16:00.000 | 0 | 0 | 1 | 0 | python,inheritance | 16,524,415 | 2 | false | 0 | 0 | Are you coming from a Java background by any chance?
First off, you've given no indication that any of your classes should inherit from another. For that matter, you probably don't need as many classes as you think you do.
Solver #Contains the actual algorithm for solving
If it's only one function you might as well j... | 1 | 1 | 0 | This is a somewhat basic question about the correct order of class inheritance.
Basically I'm trying to write a numerical simulation to solve a physical model, the details are not important (I happen to be writing this in python), it is a well known algorithm solved by iterating over a volume of space.
The classes that... | Class inheritance order for a simulation program | 0 | 0 | 0 | 236 |
16,524,544 | 2013-05-13T14:28:00.000 | 2 | 0 | 1 | 0 | python,multithreading | 16,524,566 | 1 | true | 0 | 0 | It returns nothing interesting, None. | 1 | 0 | 0 | What does the Python Thread.start() method return?
I can't seem to find this in the Python docs.
(I also think I miss something obvious from them because the return value for methods is seldom described.) | What does the standard thread.start() return in Python? | 1.2 | 0 | 0 | 61 |
16,525,173 | 2013-05-13T14:59:00.000 | 0 | 0 | 1 | 0 | python,hamcrest | 33,946,106 | 3 | false | 0 | 0 | I am using assertNotEqual([], list) to check if the list isn't empty | 1 | 0 | 0 | Is there a clean way to test that a list is not empty in Hamcrest (python). There are several ways to do it by checking the list length etc., but I'd like something that reads nicely for tests. | Python Hamcrest - test that list is not empty | 0 | 0 | 0 | 2,139 |
16,525,623 | 2013-05-13T15:22:00.000 | 0 | 0 | 1 | 0 | python,virtualenv,pip | 16,564,496 | 2 | false | 0 | 0 | Problem is solved by installing latest version of pip and recompiling python with SSL support. | 1 | 0 | 0 | I get this error when I try to use pip in virtualenv.It works nice when I deactivate environment. What could be wrong? I use python 2.7 in CentOS. | "'module' object has no attribute 'HTTPSConnection'" when try to use pip in virtualenv | 0 | 0 | 0 | 1,788 |
16,526,314 | 2013-05-13T15:58:00.000 | 1 | 0 | 0 | 0 | python,django,django-allauth | 39,067,085 | 6 | false | 1 | 0 | Allauth tries to extend myproject/templates/base.html. The easiest ways are to move base.html to myproject/templates/site/ in order to get myproject/templates/site/base.html or simply rename base.html | 3 | 9 | 0 | I've been trying to get django-allauth working for a couple days now and I finally found out what was going on.
Instead of loading the base.html template that installs with django-allauth, the app loads the base.html file that I use for the rest of my website.
How do i tell django-allauth to use the base.html templ... | Django-allauth loads wrong base.html template | 0.033321 | 0 | 0 | 2,348 |
16,526,314 | 2013-05-13T15:58:00.000 | 7 | 0 | 0 | 0 | python,django,django-allauth | 16,526,472 | 6 | true | 1 | 0 | Unless called directly, your base.html is an extension of the templates that you define.
For example, if you render a template called Page.html - at the top you will have {% extends "base.html" %}.
When defined as above, base.html is located in the path that you defined in your settings.py under TEMPLATE_DIRS = () - wh... | 3 | 9 | 0 | I've been trying to get django-allauth working for a couple days now and I finally found out what was going on.
Instead of loading the base.html template that installs with django-allauth, the app loads the base.html file that I use for the rest of my website.
How do i tell django-allauth to use the base.html templ... | Django-allauth loads wrong base.html template | 1.2 | 0 | 0 | 2,348 |
16,526,314 | 2013-05-13T15:58:00.000 | 2 | 0 | 0 | 0 | python,django,django-allauth | 53,967,402 | 6 | false | 1 | 0 | All of the answers provided force you to rewrite files and modify your own project to fit in with allauth, which is a completely unacceptable workflow. Such a third-party application should not have such manipulative power over your own project.
Truly, the easiest way to handle this situation, especially based on the ... | 3 | 9 | 0 | I've been trying to get django-allauth working for a couple days now and I finally found out what was going on.
Instead of loading the base.html template that installs with django-allauth, the app loads the base.html file that I use for the rest of my website.
How do i tell django-allauth to use the base.html templ... | Django-allauth loads wrong base.html template | 0.066568 | 0 | 0 | 2,348 |
16,528,178 | 2013-05-13T17:55:00.000 | 3 | 0 | 1 | 0 | python,file-io | 16,528,237 | 2 | false | 0 | 0 | You write the exact number of characters == bytes, after .seek()-ing back to your start_offset position. These then overwrite the data that was there before.
You can split that up into multiple writes, even writes of one character (byte) at a time if needed. | 1 | 0 | 0 | I've seen multiple tutorials in python, played around a bit with python file write(), tell(), seek() functions and also os.write(), lseek() functions.
But I still don't get how can I do the following:
What I have:
In a file I know the start_offset and end_offset bytes. And I need to replace the bytes from start_offse... | python overwrite bytes from offset1 to offset2 | 0.291313 | 0 | 0 | 561 |
16,532,314 | 2013-05-13T22:39:00.000 | 3 | 0 | 0 | 0 | python,django,import,request,nlp | 16,538,939 | 1 | true | 1 | 0 | Django, under most deployment mechanism, does not import modules for every request. Even the development server only reloads code when it changes. I don't know how you're verifying that all the imports are re-run each time, but that certainly shouldn't be happening. | 1 | 1 | 0 | I'm working on a Python project, currently using Django, which does quite a bit of NLP work in a form post process. I'm using the NLTK package, and profiling my code and experimenting I've realised that the majority of the time the code takes is performing the import process of NLTK and various other packages. My quest... | Python - Can a web server avoid imporing for every request? | 1.2 | 0 | 1 | 216 |
16,536,683 | 2013-05-14T06:42:00.000 | 2 | 0 | 1 | 0 | python,ipython,pypy | 67,074,248 | 4 | false | 0 | 0 | The "straight forward" way is:
Install pypy3
pypy3 -m pip install ipython
pypy3 -m IPython | 1 | 27 | 0 | How do I use ipython on top of a pypy interpreter rather than a cpython interpreter? ipython website just says it works, but is scant on the details of how to do it. | How to run ipython with pypy? | 0.099668 | 0 | 0 | 6,903 |
16,541,847 | 2013-05-14T11:20:00.000 | 3 | 1 | 0 | 1 | python,debugging,printing,pager,pdb | 16,565,699 | 1 | true | 0 | 0 | You might want to create a function which accepts a text, puts this text into a temporary file, and calls os.system('less %s' % temporary_file_name).
To make it easier for everyday use: Put the function into a file (e.g: ~/.pythonrc) and specify it in your PYTHONSTARTUP.
Alternatively you can just install bpython (pip ... | 1 | 4 | 0 | I am using ipdb to debug a python script.
I want to print a very long variable. Is there any ipdb pager like more or less used in shells?
Thanks | Is there any ipdb print pager? | 1.2 | 0 | 0 | 725 |
16,542,897 | 2013-05-14T12:16:00.000 | 5 | 1 | 1 | 0 | python,haskell,compiler-construction,lisp,interpreter | 16,543,659 | 3 | false | 0 | 0 | If you mean the stackless compilation with lightweight concurrency, Haskell has done that from the very beginning. IIRC the first compilation scheme for Haskell was called the G-machine. Later that was replaced by the STG-machine. This is actually necessary for efficient laziness, but easy concurrency and parallelis... | 2 | 2 | 0 | Well thats the question. Are there any projects for other languages which try to imitate what stackless python is doing for python? | Are there any Stackless Python like projects for other languages (Java, Lisp, Haskell, Go etc) | 0.321513 | 0 | 0 | 372 |
16,542,897 | 2013-05-14T12:16:00.000 | 4 | 1 | 1 | 0 | python,haskell,compiler-construction,lisp,interpreter | 16,543,577 | 3 | false | 0 | 0 | Both Haskell and Erlang contain (in the standard implementation) microthreads/green threads with multi-core support, a preemptive scheduler, and some analogue of channels. The only rather unique feature of Stackless that I can think of is serialisation of threads, although you can sometimes fake it by providing a way o... | 2 | 2 | 0 | Well thats the question. Are there any projects for other languages which try to imitate what stackless python is doing for python? | Are there any Stackless Python like projects for other languages (Java, Lisp, Haskell, Go etc) | 0.26052 | 0 | 0 | 372 |
16,543,715 | 2013-05-14T12:52:00.000 | 0 | 1 | 0 | 0 | python,raspberry-pi,schedule | 16,543,818 | 3 | false | 0 | 0 | The easiest way would be to set up a cron job to call a python script every hour. | 1 | 1 | 0 | I'd like to know how to preform an action every hour in python. My Raspberry Pi should send me information about the temp and so on every hour. Is this possible?
I am new to python and linux, so a detailed explanation would be nice. | How to schedule an action in python? | 0 | 0 | 0 | 7,805 |
16,543,855 | 2013-05-14T12:58:00.000 | 4 | 0 | 1 | 0 | python,memory-management,storage,contiguous | 16,544,131 | 1 | false | 0 | 0 | No, except of course by coincidence. While this is highly implementation- and environment-specific, and there are actually memory management schemes which would dedicate page-sized memory regions to objects of the same type, no Python implementations I'm aware of exhibits the behavior you describe. With the possible ex... | 1 | 4 | 0 | Does Python stores similar objects at memory locations nearer to each other?
Because id of similar objects, say lists and tuples, are nearer to each other than an object of type str. | does python stores similar objects at contiguous memory locations? | 0.664037 | 0 | 0 | 763 |
16,546,843 | 2013-05-14T15:12:00.000 | 0 | 0 | 1 | 0 | python-idle | 18,759,525 | 1 | false | 0 | 0 | Did you use any othere mode file name to instead of sys mode? ex. I meet the same issue, after check, there is one 'string.py' when i do a test about Relative paths and an absolute path, so, when idle start, it always load wrong 'string.py', after i delete it which create by myself, it can work now. | 1 | 0 | 0 | I cannot start IDLE from my shortcut or from Start > All Programs > Python 3.3 > IDLE (Python GUI).
When I click on it, nothing happens. I tried running as administrator; nothing either... It was working fine a few days ago.
I can run it if I go to C:\Python 33\Lib\idlelib\_main_ (However a black python command line st... | IDLE for Python 3.3 doesn't start and does not give an error message | 0 | 0 | 0 | 1,787 |
16,547,305 | 2013-05-14T15:34:00.000 | 1 | 0 | 1 | 0 | python,python-idle | 50,389,292 | 3 | false | 0 | 0 | In IDLE 3.6.5, it's Format > Untabify Region | 1 | 6 | 0 | I know that spaces are preferred over tabs in Python, so is there a way to easily convert tabs to spaces in IDLE or does it automatically do that? | Can I configure IDLE to automatically convert tabs to spaces? | 0.066568 | 0 | 0 | 15,163 |
16,563,668 | 2013-05-15T11:19:00.000 | 2 | 0 | 1 | 0 | python | 16,563,725 | 3 | false | 0 | 0 | I didn't exactly understand if you're talking about several scripts running in the same process, or several processes that need to share the same data:
Several processes:
I think the simplest way of doing this, sharing data between several scripts (different processes), is to use a simple file database.
SQLite3 comes ... | 1 | 0 | 0 | I am looking for a way to use a common or centralised dictionary in python. I have several scripts that work on the same data sets, but do different things. I have dictionarys in these scripts (e.g. instrument name) that are used in more than one script. If I make changes or add values I have to make shure I do this in... | Common or centralised dictionary in python | 0.132549 | 0 | 0 | 96 |
16,564,791 | 2013-05-15T12:16:00.000 | 2 | 0 | 0 | 0 | python,django,cloud-hosting,photo-gallery | 16,565,006 | 1 | false | 1 | 0 | Pros:
You don't have to pay extra for your S3 servers after it crosses the 20GB limit.
Cons
Your server will slow down as it will not be able to take the load after certain limit.
Performance of the server will go down, in worst case your servers may crash.
Your node will also have limit on the disk space, which you... | 1 | 0 | 0 | I have this small app in Django, hosted on cheap linode. We want to add photo-sharing functionality so I am wondering should I put all user uploaded static photo files locally on linode serwer or it is better to use Amazon S3 or similar cloud soulution ?
What are pros and cons of both solutions ? | Should I store static files (photos) local or in the cloud? | 0.379949 | 0 | 0 | 128 |
16,565,363 | 2013-05-15T12:45:00.000 | 13 | 1 | 1 | 1 | python,linux,open-source | 16,565,499 | 2 | true | 0 | 0 | For sure, if this program is to be available only for root, then the main execution python script have to go to /usr/sbin/.
Config files ought to go to /etc/, and log files to /var/log/.
Other python files should be deployed to /usr/share/pyshared/.
Executable scripts of other languages will go either in /usr/bin/ or /... | 2 | 12 | 0 | My python program consists of several files:
the main execution python script
python modules in *.py files
config file
log files
executables scripts of other languages.
All this files should be available only for root. The main script should run on startup, e.g. via upstart.
Where I should put all this files in Linu... | Where I should put my python scripts in Linux? | 1.2 | 0 | 0 | 14,785 |
16,565,363 | 2013-05-15T12:45:00.000 | 1 | 1 | 1 | 1 | python,linux,open-source | 16,565,490 | 2 | false | 0 | 0 | If only root should access the scripts, why not put it in /root/ ?
Secondly, if you're going to distribute your application you'll probably need easy_install or something similar, otherwise just tar.gz the stuff if only a few people will access it?
It all depends on your scale..
Pyglet, wxPython and similar have a hugh... | 2 | 12 | 0 | My python program consists of several files:
the main execution python script
python modules in *.py files
config file
log files
executables scripts of other languages.
All this files should be available only for root. The main script should run on startup, e.g. via upstart.
Where I should put all this files in Linu... | Where I should put my python scripts in Linux? | 0.099668 | 0 | 0 | 14,785 |
16,566,430 | 2013-05-15T13:31:00.000 | 1 | 1 | 0 | 0 | php,python,web | 16,566,525 | 2 | true | 0 | 0 | I personally think if you have little web development experience you should go with PHP. You can directly embed it in your HTML and perhaps that will make it easier to understand for you. That's of course if you don't want to make complicated websites (yet).
After you familiarise yourself with web development, you can ... | 1 | 0 | 0 | I want to design a website with minimal front end and a backend for periodic processing. Some 200 users will use the site.I have choosen php vs python. I have done few defect fixes in PHP and some automation scription in python and I have absolutely no web development experience. But I have application development expe... | from c++ development to PHP or Python | 1.2 | 0 | 0 | 164 |
16,567,751 | 2013-05-15T14:26:00.000 | 0 | 0 | 0 | 0 | python,django,django-models,django-forms | 16,568,130 | 1 | true | 1 | 0 | ModelForms are for creating/updating objects. Authentication doesn't modify the model instance (the User), therefore use a normal form instead.
From the docs:
The save() method
Every form produced by ModelForm also has a save() method. This method
creates and saves a database object from the data bound to the form. ... | 1 | 0 | 0 | ModelForms are a nice way to prevent repeating the definitions of models one creates. What I would like to do is take advantage of that feature and use it for more than just processing POST requests. I use forms a lot for validation.
Example:
Say you have a User model with the fields (email, password, first_name, last_... | Are ModelForms in django used only for POSTing? | 1.2 | 0 | 0 | 84 |
16,568,621 | 2013-05-15T15:04:00.000 | 1 | 0 | 1 | 1 | python,debian,apt | 20,988,427 | 3 | false | 0 | 0 | A very effective way is to create local apt caches for all the relevant distributions. The tool chdist from the devscripts package allows you to create a number of these caches without the need to use root privileges. You can then use the tools you are used to (e.g. apt-rdepends) to query those caches by wrapping them ... | 1 | 5 | 0 | I want to be able to look at local .deb files and at remote repositories and deduce dependencies etc so that I can build my own repositories and partial mirrors (probably by creating config files for reprepro).
The challenge is that many of the command-line tools to help with this (apt-rdepends etc) assume that you're ... | How to query and manage Debian package repositories in Python? | 0.066568 | 0 | 0 | 1,224 |
16,569,247 | 2013-05-15T15:32:00.000 | 1 | 0 | 1 | 0 | regex,python-2.7 | 16,569,422 | 3 | false | 0 | 0 | "R(\.|aj)? (K(\.|umar)? )?Goyal" will only match those four cases. You can modify this for other names as well. | 2 | 0 | 0 | I need a regular expression in python that will be able to match different name formats like
I have 4 different names format for same person.like
R. K. Goyal
Raj K. Goyal
Raj Kumar Goyal
R. Goyal
What will be the regular expression to get all these names from a single regular expression in a list of thousands.
PS: My l... | Regular expression for matching diffrent name format in python | 0.066568 | 0 | 0 | 403 |
16,569,247 | 2013-05-15T15:32:00.000 | 0 | 0 | 1 | 0 | regex,python-2.7 | 16,569,677 | 3 | false | 0 | 0 | Fair warning: I haven't used Python in a while, so I won't be giving you specific function names.
If you're looking for a generic solution that will apply to any possible name, you're going to have to construct it dynamically.
ASSUMING that the first name is always the one that won't be dropped (I know people whose nam... | 2 | 0 | 0 | I need a regular expression in python that will be able to match different name formats like
I have 4 different names format for same person.like
R. K. Goyal
Raj K. Goyal
Raj Kumar Goyal
R. Goyal
What will be the regular expression to get all these names from a single regular expression in a list of thousands.
PS: My l... | Regular expression for matching diffrent name format in python | 0 | 0 | 0 | 403 |
16,574,640 | 2013-05-15T20:43:00.000 | 1 | 0 | 0 | 0 | python,pdf,reportlab | 16,574,684 | 2 | false | 0 | 0 | canvas.showPage()
will force a new page (even though it sounds like its showing a page,)
(assuming you are using the canvas)
if you are using flowables I think there is a PageBreak flowable | 1 | 0 | 0 | How can I generate a PDF with two or more pages with reportlab? I've been unable to find anything in the documentation. | Reportlab 2 or more pages per file | 0.099668 | 0 | 0 | 99 |
16,574,746 | 2013-05-15T20:51:00.000 | 0 | 1 | 0 | 0 | python,twitter,tweepy | 16,589,445 | 2 | false | 0 | 0 | What one could do, is get the last nth tweet from a user, and then get the tweet.id of the relevant tweet. This can be done doing:
latestTweets = api.user_timeline(screen_name = 'user', count = n, include_rts = False)
I, however, doubt that it is the most efficient way. | 1 | 1 | 0 | I want to check if a certain tweet is a reply to the tweet that I sent. Here is how I think I can do it:
Step1: Post a tweet and store id of posted tweet
Step2: Listen to my handle and collect all the tweets that have my handle in it
Step3: Use tweet.in_reply_to_status_id to see if tweet is reply to the stored id
In th... | How to get id of the tweet posted in tweepy | 0 | 0 | 1 | 1,649 |
16,577,725 | 2013-05-16T01:43:00.000 | 0 | 1 | 0 | 0 | javascript,python,ruby,perl | 16,579,794 | 1 | true | 1 | 0 | There is no way to accomplish this very oddly specific task without digging through the code, although this isn't as hard as it seems considering it's quite legible and easy to build on your own system, even if you don't have any previous experience with JavaScript. | 1 | 0 | 0 | In the Visual Event description, it says that it extracts "which elements have events attached to them". I can confirm this by running the bookmarklet and seeing all the colour highlights.
I would like to extract this information without the fancy presentation so that I can play around with it into a script (Ruby/Pytho... | Extracting Visual Event 2 output into script | 1.2 | 0 | 0 | 67 |
16,578,545 | 2013-05-16T03:30:00.000 | 0 | 0 | 0 | 0 | python,web-crawler | 16,578,621 | 2 | true | 1 | 0 | Well you should probably start by learning the language in general it would make it alot easier to do
but for the Web stuff you can use something called urllib and urllib2 these can open up the browser to get the data without actually opening the window
also there are a few automated web browsers like selenium which a... | 1 | 0 | 0 | So i've been looking around trying to figure out how i could extract some specific data such as just the text, and push that data into a program that organizes the data.
So if you took homedepot.com for example and wanted to extract from each item listed under "2x4 wood" and from each item you are needing to grab the ... | Need to extract data from website and push to a program | 1.2 | 0 | 1 | 225 |
16,579,775 | 2013-05-16T05:44:00.000 | 5 | 0 | 0 | 0 | python,machine-learning,scikit-learn,scikits | 16,583,343 | 2 | false | 0 | 0 | First, a couple of remarks:
the name of the algorithm is Gradient Boosting (Regression Trees or Machines) and is not directly related to Stochastic Gradient Descent
you should never evaluate the accuracy of a machine learning algorithm on you training data, otherwise you won't be able to detect the over-fitting of the... | 1 | 0 | 1 | I'm using the Scikit module for Python to implement Stochastic Gradient Boosting. My data set has 2700 instances and 1700 features (x) and contains binary data. My output vector is 'y', and contains 0 or 1 (binary classification). My code is,
gb = GradientBoostingClassifier(n_estimators=1000,learn_rate=1,subsample=0.5... | Stochastic Gradient Boosting giving unpredictable results | 0.462117 | 0 | 0 | 1,888 |
16,582,065 | 2013-05-16T08:05:00.000 | 0 | 0 | 1 | 0 | python,image-processing,wordnet | 16,582,205 | 1 | false | 0 | 0 | Well, I suppose you take a bunch of path to images as strings, you can get them as command line arguments or reading them from stdin. Then you just have to open them or do whatever you want with it.
Is that answering your question? | 1 | 0 | 0 | I am trying to take a set of tagged images as input and remove noisy tags from each image. I have written a python code which takes a text file as input, each line of which corresponds to tags of an image, and removes the noisy tags from each line. I have used the structure and similarity measures in Wordnet to do so.
... | Using set of images as an input | 0 | 0 | 0 | 65 |
16,585,683 | 2013-05-16T11:00:00.000 | 1 | 0 | 1 | 0 | python,c,gdb,coredump,gdb-python | 16,720,674 | 1 | false | 0 | 0 | There isn't a way to iterate over symbol tables from Python yet. So, it can't be done.
However, adding support to expose this information to Python would be a reasonable thing to do. | 1 | 1 | 0 | how to extract all the global variables , data structures and sub-structures (with address, type and values) from core dump,using gdb-python, generated after crashing of a C code.? | Core dump : Extract all the global variables , data structures and sub-structures from a core dump | 0.197375 | 0 | 0 | 894 |
16,586,364 | 2013-05-16T11:35:00.000 | 3 | 0 | 1 | 0 | javascript,python,data-structures,map | 16,619,311 | 5 | true | 0 | 0 | I agree with delnan in that the human example is probably too close to that of an object. This works well if you are trying to transition into explaining how objects are implemented in loosely typed languages, however a map is a concept that exists in Java and C# as well. This could potentially be very confusing if the... | 5 | 3 | 0 | I'm trying to explain Map (aka hash table, dict) to someone who's new to programming. While the concepts of Array (=list of things) and Set (=bag of things) are familiar to everyone, I'm having a hard time finding a real-world metaphor for Maps (I'm specifically interested in python dicts and Javascript Objects). The o... | Maps (hashtables) in the real world | 1.2 | 0 | 0 | 239 |
16,586,364 | 2013-05-16T11:35:00.000 | 2 | 0 | 1 | 0 | javascript,python,data-structures,map | 16,588,162 | 5 | false | 0 | 0 | Perhaps it would be the analogy of a human being that your meeting for the first time:
Each person has an unordered amount of attributes, each of these attributes can only have 1 value, which is unique (like hair=long, eye_color=blue). And you would discover these attributes in no particular order.
So for a person she ... | 5 | 3 | 0 | I'm trying to explain Map (aka hash table, dict) to someone who's new to programming. While the concepts of Array (=list of things) and Set (=bag of things) are familiar to everyone, I'm having a hard time finding a real-world metaphor for Maps (I'm specifically interested in python dicts and Javascript Objects). The o... | Maps (hashtables) in the real world | 0.07983 | 0 | 0 | 239 |
16,586,364 | 2013-05-16T11:35:00.000 | 1 | 0 | 1 | 0 | javascript,python,data-structures,map | 16,619,115 | 5 | false | 0 | 0 | In some restaurants when you make your order in the counter, they give you a number to identify your order. The numbers :
Don't need to be sorted.
Don't need to be consecutive
The only idea of the numbers is that they can find your order easily. In the map/hash table/associative array world the number would be the ke... | 5 | 3 | 0 | I'm trying to explain Map (aka hash table, dict) to someone who's new to programming. While the concepts of Array (=list of things) and Set (=bag of things) are familiar to everyone, I'm having a hard time finding a real-world metaphor for Maps (I'm specifically interested in python dicts and Javascript Objects). The o... | Maps (hashtables) in the real world | 0.039979 | 0 | 0 | 239 |
16,586,364 | 2013-05-16T11:35:00.000 | 1 | 0 | 1 | 0 | javascript,python,data-structures,map | 16,587,930 | 5 | false | 0 | 0 | I have seen cases where a large list of people were binned according to their last N digits of their identifying number, in order to save on key search. This binning is somewhat similar to hashing, and may help explain it. | 5 | 3 | 0 | I'm trying to explain Map (aka hash table, dict) to someone who's new to programming. While the concepts of Array (=list of things) and Set (=bag of things) are familiar to everyone, I'm having a hard time finding a real-world metaphor for Maps (I'm specifically interested in python dicts and Javascript Objects). The o... | Maps (hashtables) in the real world | 0.039979 | 0 | 0 | 239 |
16,586,364 | 2013-05-16T11:35:00.000 | 1 | 0 | 1 | 0 | javascript,python,data-structures,map | 16,617,849 | 5 | false | 0 | 0 | Are you successful in explaining the array in a logical way..that array is a storage where elements are kept at first position. second position , third position....first,second.third are basically keys...
Now extend it to say maps are storage where are keys are not necessarily numbers..lets say they are strings...or ev... | 5 | 3 | 0 | I'm trying to explain Map (aka hash table, dict) to someone who's new to programming. While the concepts of Array (=list of things) and Set (=bag of things) are familiar to everyone, I'm having a hard time finding a real-world metaphor for Maps (I'm specifically interested in python dicts and Javascript Objects). The o... | Maps (hashtables) in the real world | 0.039979 | 0 | 0 | 239 |
16,587,145 | 2013-05-16T12:14:00.000 | 2 | 1 | 1 | 0 | python,genetic-algorithm | 45,485,156 | 6 | false | 0 | 0 | Not exactly a GA library, but the book "Genetic Algorithms with Python" from Clinton Sheppard is quite useful as it helps you build your own GA library specified for your needs. | 1 | 5 | 0 | I'm currently looking for a mature GA library for python 3.x. But the only GA library can be found are pyevolve and pygene. They both support python 2.x only. I'd appreciate if anyone could help. | Any Genetic Algorithms module for python 3.x? | 0.066568 | 0 | 0 | 11,702 |
16,589,274 | 2013-05-16T13:50:00.000 | 1 | 0 | 1 | 0 | python,regex,optparse | 16,589,345 | 3 | false | 0 | 0 | Your question lacks alot of data to effectively answer it, but perhaps the following helps:
If you are unable to use a regex that starts with spaces, try using the replacement characters that represent spaces: \s .. So \s{3}test will match "<3 spaces>test".
If it is shell script, do remember to double-escape it since s... | 1 | 0 | 0 | I am writing a regex match program, and I am unable to use regular expressions that start with spaces.
Is there any way to tell OptParse to only delimit by the first whitespace? | optparse does not save second whitespace into arg | 0.066568 | 0 | 0 | 229 |
16,591,244 | 2013-05-16T15:12:00.000 | 0 | 0 | 0 | 1 | python,clipboard,timing,sendkeys,queuing | 16,609,920 | 1 | false | 0 | 0 | No, I don't think so. You're talking about separate message queues here. Alt+Esc is a global hotkey, presumably handled by windows explorer. Ctrl+A and Ctrl+C are handled by the source app, and should be processed in order. However, there will be a lag after the Ctrl+C, as the clipboard must be locked, cleared, and ... | 1 | 1 | 0 | We are writing a Python application that relies on copying and pasting content from the top windows.
To do that we issue sendkey commands:
Ctrl-Esc for going to the previous windows
Ctrl-A followed by Ctrl-C to copy all text from the window
And Cnrl-V to paste the the clipboard content to the top window.
Unfortunatel... | Is it possible to queue sendkey commands in Windows? | 0 | 0 | 0 | 248 |
16,591,538 | 2013-05-16T15:25:00.000 | 0 | 1 | 0 | 0 | python,graphic | 22,495,380 | 1 | false | 0 | 0 | If you take this approach, you will have to maintain an ever changing database of graphics cards and the performance capabilities of each. Typically, options are available to the user for changing texture quality, terrain/water detail, shadows, lighting, anti-aliasing, etc. There is also usually a test where the game r... | 1 | 2 | 0 | I am trying finding a library of Python that could detect the model of a graphics card. For a better graphics card, there is a higher score associated with it, because I need to configure a game's display based on the performance of graphic card. | Python Library Can Detect Graphic Card | 0 | 0 | 0 | 252 |
16,594,103 | 2013-05-16T17:46:00.000 | 0 | 0 | 1 | 0 | python,pep8 | 16,595,842 | 4 | false | 0 | 0 | How about not returning anything but yielding the results one by one? Generators are generally a convenient thing, as they avoid building up lists that are then used and discarded one by one anyway. | 2 | 2 | 0 | I have a function which searches for results to a query. If there's no results what is recommended to return, False or None?
I suppose it's not that important but I'd like to follow best practice. | In Python, what to return for no results, False or None? | 0 | 0 | 0 | 1,272 |
16,594,103 | 2013-05-16T17:46:00.000 | 1 | 0 | 1 | 0 | python,pep8 | 16,594,681 | 4 | false | 0 | 0 | I would return an empty list, it will save you headaches when looking at the return values of this function down the road.
If you want your program to die when you make assumptions that the list has elements however, None is a good choice. | 2 | 2 | 0 | I have a function which searches for results to a query. If there's no results what is recommended to return, False or None?
I suppose it's not that important but I'd like to follow best practice. | In Python, what to return for no results, False or None? | 0.049958 | 0 | 0 | 1,272 |
16,595,625 | 2013-05-16T19:15:00.000 | 0 | 0 | 1 | 0 | python,time-complexity | 16,597,039 | 4 | false | 0 | 0 | I figured it out.
T(n) = n*T(n-1) + n! + O(n^2) = n*T(n-1) + n! = n*( (n-1)T(n-2) + (n-1)! ) + n! = n(n-1)T(n-2) + 2n! = ... = n! = n*n! = O(n*n!) | 1 | 3 | 0 | When analyzing some code I've written, I've come up with the following recursive equation for its running time -
T(n) = n*T(n-1) + n! + O(n^2).
Initially, I assumed that O((n+1)!) = O(n!), and therefore I solved the equation like this -
T(n) = n! + O(n!) + O(n^3) = O(n!)
Reasoning that even had every recursion yielded... | Factorial running time | 0 | 0 | 0 | 2,532 |
16,596,188 | 2013-05-16T19:48:00.000 | 5 | 0 | 0 | 0 | python,pandas,bioinformatics | 42,148,893 | 2 | false | 0 | 0 | Just ran into this issue--I specified a str converter for the column instead, so I could keep na elsewhere:
pd.read_csv(... , converters={ "file name": str, "company name": str}) | 1 | 15 | 1 | I just picked up Pandas to do with some data analysis work in my biology research. Turns out one of the proteins I'm analyzing is called 'NA'.
I have a matrix with pairwise 'HA, M1, M2, NA, NP...' on the column headers, and the same as "row headers" (for the biologists who might read this, I'm working with influenza). ... | Pandas Convert 'NA' to NaN | 0.462117 | 0 | 0 | 11,645 |
16,597,149 | 2013-05-16T20:45:00.000 | 0 | 0 | 0 | 0 | python,html,jsp,beautifulsoup | 16,597,278 | 1 | false | 1 | 0 | I assume you are talking about web scraping which is pulling information from other websites.
You are not going to be able to do something like this in somebody's browser because it violates Javascript's same origin policy, AND there is no way a browser is going to let you download and execute a script on a client's co... | 1 | 0 | 0 | I am trying to invoke a python code for screen scraping (using Beautiful Soup) from my jsp servlet. Or it would also work if it can be directly invoked from the HTML.
Looked through few threads but couldn't get any solution.
What I want is to give the python program some arguments and want it to do some screen scrappin... | how to invoke python script in jsp/servlet? | 0 | 0 | 0 | 1,132 |
16,597,216 | 2013-05-16T20:49:00.000 | 18 | 1 | 1 | 0 | python,vim | 16,606,672 | 3 | false | 0 | 0 | Personally:
When inside Vim editing my Python scripts, I simply hit CtrlZ so as to return in console mode.
Run my script with command $ python my_script.py.
When done, I enter $ fg in the command line and that gets me back inside Vim, in the state I was before hitting CtrlZ. (fg as in foreground)
Edit
Recently I hav... | 1 | 1 | 0 | Is it possible to run Python code from within the vim editor?
What is necessary to install the support along with Python syntax highlighting?
How would I install "python.vim : Enhanced version of the python syntax highlighting script" ?
I did not automatically create ~/.vim/syntax and I'm using a Mac, all I downloaded... | Can Python be run from within the vim editor? | 1 | 0 | 0 | 11,604 |
16,597,739 | 2013-05-16T21:23:00.000 | 1 | 0 | 0 | 0 | python,django,email,django-email | 16,599,805 | 1 | true | 1 | 0 | Are you trying to read from a mailbox and write the information into the database? If so, then you want to:
1) Open a connection to the mail server using poplib or imaplib from the standard library
2) Retrieve messages from the server (again with poplib or imaplib)
3) Parse the messages with the email package from the... | 1 | 1 | 0 | How to implement something like this:
If someone send email with file in attachment to system@mail.com, this file is added automatically to database.
Please general algorithm how to do or suggest existing app | Upload files via email in Django. General algorithm | 1.2 | 0 | 0 | 99 |
16,599,357 | 2013-05-16T23:58:00.000 | 0 | 0 | 0 | 0 | python,pandas,pip | 21,592,812 | 2 | false | 0 | 0 | Thanks, I just had the same issue with Angstrom Linux on the BeagleBone Black board and the easy_install downgrade solution solved it. One thing I did need to do, is after installing easy_install using
opkg install python-setuptools
I then had to go into the easy_install file (located in /usr/bin/easy_install)
and ch... | 1 | 3 | 1 | So, I'm trying to install pandas for Python 3.3 and have been having a really hard time- between Python 2.7 and Python 3.3 and other factors.
Some pertinent information: I am running Mac OSX Lion 10.7.5. I have both Python 2.7 and Python 3.3 installed, but for my programming purposes only use 3.3.
This is where I'm a... | Python 3.3 pandas, pip-3.3 | 0 | 0 | 0 | 2,260 |
16,601,049 | 2013-05-17T03:42:00.000 | 0 | 0 | 0 | 0 | python,arrays,numpy,nested,vectorization | 16,607,943 | 4 | false | 0 | 0 | I think it makes little sense to use numpy arrays to do that, just think you're missing out on all the advantages of numpy. | 1 | 0 | 1 | In other words, each element of the outer array will be a row vector from the original 2D array. | How do I convert a 2D numpy array into a 1D numpy array of 1D numpy arrays? | 0 | 0 | 0 | 5,758 |
16,603,207 | 2013-05-17T06:56:00.000 | 0 | 0 | 0 | 0 | python,pyqt,qtableview,qstandarditemmodel | 16,761,536 | 1 | false | 0 | 1 | Did you follow the advice on subclassing model classes? I only encountered such problems if I didn't followed the hints in the docs ;)
A removeRows() implementation must call beginRemoveRows() before the rows are removed from the data structure, and endRemoveRows() immediately afterwards. | 1 | 0 | 0 | Got a QStandardItemModel on my QTableView and trying to remove all the rows in it.
I was first calling a method I created with a call to takeRow, which does not delete the object if I'm right.
What about removeRows from QAbstractItemModel? I've tried it, and as I had a signal on the model ( dataChanged ), it seems that... | QStandardItemModel removeRows does not remove signals on cells? | 0 | 0 | 0 | 371 |
16,604,125 | 2013-05-17T07:53:00.000 | 1 | 1 | 0 | 0 | c++,python,login,operating-system | 16,604,457 | 1 | true | 0 | 0 | Assuming that you would like to support login systems such as User/Pass, LDAP, OpenID, Oauth etc.. you have to model your authentication layer to be able to support all these mechanisms. I usually consider the above authentication methods as strategies.
Lets say you have an Authentication class with an authenticate met... | 1 | 0 | 0 | I would like to make an authentication system where users or an administrator can choose which login system they prefer. The problem is that different systems have different Login-Systems and different client-informations.
I thought I will make an simple User-Class in the c++ application and an administrator can exten... | handling multiple login systems | 1.2 | 0 | 0 | 398 |
16,604,372 | 2013-05-17T08:10:00.000 | 0 | 0 | 0 | 1 | python,azure,azure-virtual-machine | 16,604,662 | 1 | false | 1 | 0 | Could it be that port 81 is blocked by firewall in Ubuntu? | 1 | 1 | 0 | I have created a VM on Windows Azure with Ubuntu 12.04 running on it.
I have two end-points
End-point1
public port: 50348
private port: 22
End-point2
public port: 81
private port: 81
Now, I have a simple python HTTP server running on the Virtual Machine, which is listening on port 81.
When I try to connect to localho... | Azure - Running an http server on an VM | 0 | 0 | 0 | 453 |
16,606,906 | 2013-05-17T10:33:00.000 | 1 | 0 | 0 | 0 | python,hbase,thrift | 16,608,107 | 1 | false | 0 | 0 | HBase provides a scanner interface that allows you to enumerate over a range of keys in an HTable. HappyBase has support for scans and this is documented pretty well in their API.
So this would solve your question if you were asking for a "like 'name%'" type of query which searches for anything that begins with the pre... | 1 | 0 | 0 | I want to do something like
select * from table where name like '%name%'
is there anyway to do this in Hbase ? and if there is a way so how to do that
ps. I use HappyBase to communicate with Hbase | Hbase wildcard support | 0.197375 | 1 | 0 | 364 |
16,615,838 | 2013-05-17T18:40:00.000 | 0 | 0 | 0 | 0 | python,komodo | 16,616,493 | 2 | false | 0 | 1 | Ok heres what I personally do.
Open run, type in cmd
Navigate to whatever directory my mypythonfile.py file is
Open whatever text editor you feel like ( personally i use notepad++ because it is NOT an IDE like kodomo, but just a pretty text editor.)
Type python mypythonfile.py and hit enter. This will run the program.... | 1 | 1 | 0 | I am just learning python as my first programming language, and I just installed python 3.3, 64 bit on my windows 7 OS.
I installed komodo edit 8.0, and I am trying to print ('Hello world'). I set up the correct path so that I can access python through my command prompt.
From komodo, I saved my helloworld.py file to my... | I need help recognizing files in komodo in order to run them in python | 0 | 0 | 0 | 968 |
16,616,029 | 2013-05-17T18:52:00.000 | 2 | 0 | 0 | 0 | python,gtk,pyqt,pygtk | 16,616,290 | 3 | true | 0 | 1 | The user interfaces create with glade are saved as xml file: using gtkbuilder, this file can be used with many programming languages, like c++ or python.
Pygtk lets you create application with user interfaces, based on glade file.But you have to do all by hand. | 1 | 3 | 0 | I'm learning the Python and now I'm trying to choose cross-platform-GUI-framework. As I see, the PyGTK is the best one, which fits my goals completely.
The only question: is there any analog of pyuic4 (which creates python class based on .ui file created by QtDesigner) for files made with Glade app? Or the only way is ... | How to convert .glade file to python class? | 1.2 | 0 | 0 | 2,653 |
16,616,728 | 2013-05-17T19:43:00.000 | 0 | 0 | 0 | 0 | c++,python,qt,pyqt,pyqt4 | 16,761,507 | 1 | true | 0 | 1 | Use PySide. It's about 99.8 % compatible with PyQt, except for Signals and Slots.
Replace every occurence of PyQt4 with PySide in your project, then replace pyqtSignal with Qt.Signal and pyqtSlot with Qt.Slot.
It should work out of the box.
Many projects support both PyQt and PySide because there is virtually no differ... | 1 | 0 | 0 | Can someone tell whether there is any application that converts a PyQt4 (with syntax in Python) project to a Qt4 (with syntax in C++) project?
This will help people to switch from using a GPL non-commercial license in case of PyQt to a much liberal LGPL non-commercial license in case of Qt! | is there any application that converts a PyQt (with syntax in Python) project to a Qt (with syntax in C++ ) project? | 1.2 | 0 | 0 | 217 |
16,617,136 | 2013-05-17T20:12:00.000 | 0 | 0 | 1 | 0 | python,sqlalchemy | 16,617,300 | 2 | false | 0 | 0 | try printing SQLAlchemy.__all__ which will return you a list of all functions in that module which are publicly available. | 1 | 4 | 0 | I'm using SQLAlchemy and am trying to import the function group_by into the interpreter, but I can't seem to find it. Is there an easy way to search the module tree to see where this function lives?
Of course I've tried from sqlalchemy import + tab and searching manually, but at each tree level there are too many optio... | How to locate a function in a Python module tree? | 0 | 0 | 0 | 502 |
16,620,143 | 2013-05-18T02:36:00.000 | 1 | 0 | 0 | 0 | python,localization,future-proof | 25,901,048 | 2 | true | 0 | 0 | It sounds like you are trying to use the English representation of your text as a unique ID for the message, but then when you change the English representation, it no longer matches the IDs in your previously stored preference files. The solution is to use a unique and permanent ID for each message. This ID could be E... | 2 | 1 | 0 | so I know this is a not a good question for the StackOverflow format. but I am at a bit of a loss, feel free to recommend a different place to put this where it may get some eyeballs
I am very familliar with the xgettext stuff for localizing your python program. currently we are saving user preferences as strings (eg... | Localization and future-proofing | 1.2 | 0 | 0 | 75 |
16,620,143 | 2013-05-18T02:36:00.000 | 0 | 0 | 0 | 0 | python,localization,future-proof | 16,623,416 | 2 | false | 0 | 0 | i don't get your actual problem, where are you storing.
but hope "base64 utf encoding decoding" can solve your problem. | 2 | 1 | 0 | so I know this is a not a good question for the StackOverflow format. but I am at a bit of a loss, feel free to recommend a different place to put this where it may get some eyeballs
I am very familliar with the xgettext stuff for localizing your python program. currently we are saving user preferences as strings (eg... | Localization and future-proofing | 0 | 0 | 0 | 75 |
16,621,503 | 2013-05-18T06:41:00.000 | 0 | 0 | 1 | 0 | python,file,text,reload | 16,621,540 | 2 | false | 0 | 0 | Why we cannot just reopen the file? | 1 | 1 | 0 | I am making a script that looks for changes in a file using python. It is being pushed using FTP to the server but I cannot make the script reload a file with the same name and get new data from that.
i.e
Mean_value=12
Server prints 12
BUT when I change that line to become 13 the following happens:
Server prints 12 AGA... | How to reload a changing file? | 0 | 0 | 0 | 93 |
16,624,353 | 2013-05-18T12:39:00.000 | 1 | 0 | 0 | 0 | python,math,2d,triangulation | 16,624,415 | 1 | true | 0 | 0 | First, solve the math. Make a drawing. You will find that you can use two points and their distance to reduce the possible points to just two, the third one will only be needed to disambiguate between the two. Putting the whole into Python should be easy then.
Note that I'm not going to spell this out completely for yo... | 1 | 0 | 0 | I have data about 10 points in a 2D map, I know the location of points 1,2 and 3. I also know the distance between point 1,2 and 3 to all other points.
I know that cell phone uses distance from gsm towers to locate their location. I wish to use similar approach to locate points 3-10. How can I implement such a solution... | Locational triangulation | 1.2 | 0 | 0 | 1,138 |
16,625,298 | 2013-05-18T14:20:00.000 | 1 | 0 | 0 | 0 | python,scipy,numeric,numerical-methods | 16,652,325 | 2 | false | 0 | 0 | Before you can ask the programming question, it seems to me you need to investigate a more fundamental scientific one.
Before you can start picking out particular equations to fit badfastclock to goodslowclock, you should investigate the nature of the drift. Let both clocks run a while, and look at their points togethe... | 2 | 2 | 1 | I have some sampled (univariate) data - but the clock driving the sampling process is inaccurate - resulting in a random slip of (less than) 1 sample every 30. A more accurate clock at approximately 1/30 of the frequency provides reliable samples for the same data ... allowing me to establish a good estimate of the cl... | Interpolaton algorithm to correct a slight clock drift | 0.099668 | 0 | 0 | 426 |
16,625,298 | 2013-05-18T14:20:00.000 | 0 | 0 | 0 | 0 | python,scipy,numeric,numerical-methods | 16,708,058 | 2 | false | 0 | 0 | Bsed on your updated question, if the data is smooth with time, just place all the samples in a time trace, and interpolate on the sparse grid (time). | 2 | 2 | 1 | I have some sampled (univariate) data - but the clock driving the sampling process is inaccurate - resulting in a random slip of (less than) 1 sample every 30. A more accurate clock at approximately 1/30 of the frequency provides reliable samples for the same data ... allowing me to establish a good estimate of the cl... | Interpolaton algorithm to correct a slight clock drift | 0 | 0 | 0 | 426 |
16,627,465 | 2013-05-18T18:15:00.000 | 3 | 0 | 1 | 0 | python,image | 16,627,502 | 3 | false | 0 | 0 | One caveat is that .read() isn't necessarily guaranteed to read the entire file at once, so you must make sure to repeat the read/write cycle until all of the data has been copied. Another is that there may not be enough memory to read all of the data at once, in which case you'll need to perform multiple partial reads... | 2 | 2 | 0 | I'm relatively new to python, and am part of the way through "Learning python the Hard Way," but have a question.
So, from what I've read, if you want to make a copy of a text file, you can just open and read it contents to a variable, then write this variable to a different file. I've tested it out with images, and i... | Copying files with python | 0.197375 | 0 | 0 | 2,498 |
16,627,465 | 2013-05-18T18:15:00.000 | 0 | 0 | 1 | 0 | python,image | 16,627,936 | 3 | false | 0 | 0 | So, from what I've read, if you want to make a copy of a text file, you can just open and read it contents to a variable, then write this variable to a different file.
I've tested it out with images, and it actually seems to work. Are there downsides to this method of copying that I'll run into later, and are there a... | 2 | 2 | 0 | I'm relatively new to python, and am part of the way through "Learning python the Hard Way," but have a question.
So, from what I've read, if you want to make a copy of a text file, you can just open and read it contents to a variable, then write this variable to a different file. I've tested it out with images, and i... | Copying files with python | 0 | 0 | 0 | 2,498 |
16,628,859 | 2013-05-18T20:56:00.000 | 0 | 0 | 1 | 0 | python,file,save,python-idle | 65,625,337 | 2 | false | 0 | 0 | It is in ".idlerc" named folder in your users directory in windows 10
here are the steps
press win+R OR simply search in windows search(the taskbar one)
then paste %USERPROFILE%\.idlerc
hit enter
copy all files in it to wherever you may like to (a usb in your case) | 2 | 3 | 0 | I have several computers at different locations, and although I'm not coding in IDLE, it is always running in the background, for small testing, debugging and researching tasks.
I configured IDLE custom highlighting, key set, etc. at home, and it would be pretty comfy to save my settings into an external file, and inst... | How to save custom preferences of python's IDLE? | 0 | 0 | 0 | 2,340 |
16,628,859 | 2013-05-18T20:56:00.000 | 3 | 0 | 1 | 0 | python,file,save,python-idle | 16,629,655 | 2 | true | 0 | 0 | IDLE saves its preferences in several files in the $HOME/.idlerc directory, creating the files (for example, config-main.cfg) as needed. The important ones, at least, are simple text files so you should be able to copy those files from your home directory on one machine to another. There are a few potential gotcha's ... | 2 | 3 | 0 | I have several computers at different locations, and although I'm not coding in IDLE, it is always running in the background, for small testing, debugging and researching tasks.
I configured IDLE custom highlighting, key set, etc. at home, and it would be pretty comfy to save my settings into an external file, and inst... | How to save custom preferences of python's IDLE? | 1.2 | 0 | 0 | 2,340 |
16,629,529 | 2013-05-18T22:19:00.000 | 0 | 0 | 0 | 0 | python,numpy,opencl,gpgpu | 18,478,963 | 2 | false | 0 | 0 | If memory servers, pyCuda at least, probably also pyOpenCL can work with numPy | 1 | 2 | 1 | I reconized numpy can link with blas, and I thought of why not using gpu accelerated blas library.
Did anyone use to do so? | Can I link numpy with AMD's gpu accelerated blas library | 0 | 0 | 0 | 2,411 |
16,630,537 | 2013-05-19T01:12:00.000 | 0 | 0 | 0 | 0 | python,pdf-generation | 16,631,012 | 1 | false | 1 | 0 | Turns that Adobe's reader has a "Booklet" option in the printing options. Worked out nicely. | 1 | 0 | 0 | I'm trying to write a novel and I am trying to print out my own book prototypes.
I have a PDF of the book. Now I want to merge the pages so that I can print it double-sided, fold it in half, and staple it like a boss.
The problem I need to solve is how to splice 2 pages together with a left and right side. I looked at ... | Splice 2 PDF pages into one with Python | 0 | 0 | 0 | 255 |
16,630,885 | 2013-05-19T02:26:00.000 | 1 | 0 | 0 | 0 | python,web2py | 16,634,500 | 1 | false | 1 | 0 | Can you share the error details? If you can't access the error dump file via the admin app, use some other tool to view the file under ...web2py/theapp/errors. The file format isn't easily readable, but the last few lines are usually pretty informative. | 1 | 0 | 0 | I have a web2py app I developed on my local machine. I tried to move the application to a Windows Server 2003 Virtual Machine but when I run it on the VM the app simply errors out on start up and when I click to see the error it prompts me for the admin password. When I enter it, the app errors again. There are no erro... | web2py on a Virtual Machine | 0.197375 | 0 | 0 | 169 |
16,630,969 | 2013-05-19T02:50:00.000 | 5 | 0 | 0 | 0 | ipython-notebook | 16,632,621 | 3 | true | 0 | 0 | Not on stable, and only on Header(1-6) cell on master. Just click on the header cell and it will put the right anchor in the url bar, wich is usually #header_title_sanitized
Using the prompt number is not a good idea as it might change. It will be supported on nbviewer as well, we are working on it. | 1 | 13 | 0 | I am writing documentation for a notebook-based framework. When referring to important cells in a demo-notebook, can I point to a particular cell by using some sort of anchor?
For example if I have the demo-notebook at 127.0.0.1/mydemo, is it possible to refer to the input cell In[10] by some anchor tag like 127.0.0.1... | ipython notebook anchor link to refer a cell directly from outside | 1.2 | 0 | 0 | 10,450 |
16,634,773 | 2013-05-19T12:44:00.000 | 0 | 0 | 0 | 0 | python,web | 16,634,850 | 3 | false | 0 | 0 | The urllib2 module has been split across several modules in Python 3.0
named urllib.request and urllib.error. The 2to3 tool will automatically
adapt imports when converting your sources to 3 | 1 | 2 | 0 | I wanted to use urllib2 for python 3, but I don't think it's available in such name.
I use urllib.request, is there another way to use urllib2? | Using urllib2 for Python3 | 0 | 0 | 1 | 4,670 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.