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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,524,148 | 2012-03-01T21:09:00.000 | 0 | 0 | 1 | 0 | python,sockets,node.js,programming-languages | 9,524,210 | 5 | false | 0 | 0 | The answer is "it depends", but in general there's nothing wrong with it, no.
Many times it's beneficial to actually do so for ease of development and maintenance since some languages are just simply suited towards certain tasks.
Other times, there's a communication barrier between languages depending on the data you'r... | 4 | 2 | 0 | Is it a bad idea to mix programming languages, for example have a node.js server that sends some stuff to a python program that then goes and does other stuff with it. This is pretty vague but what is the best way to send data between different programs, or is this just a terrible idea and I shouldn't even consider it?... | Mixing programming languages for the same project | 0 | 0 | 0 | 2,891 |
9,524,148 | 2012-03-01T21:09:00.000 | 1 | 0 | 1 | 0 | python,sockets,node.js,programming-languages | 9,524,220 | 5 | false | 0 | 0 | It's not a bad idea. As a matter of fact, it's often a necessity. Especially with the two language you've mentioned. It's often necessary to have a client-side language, and then a separate server-side language. They have different purposes and they're both needed.
As for passing data between them, it's generally not a... | 4 | 2 | 0 | Is it a bad idea to mix programming languages, for example have a node.js server that sends some stuff to a python program that then goes and does other stuff with it. This is pretty vague but what is the best way to send data between different programs, or is this just a terrible idea and I shouldn't even consider it?... | Mixing programming languages for the same project | 0.039979 | 0 | 0 | 2,891 |
9,524,148 | 2012-03-01T21:09:00.000 | 1 | 0 | 1 | 0 | python,sockets,node.js,programming-languages | 9,524,230 | 5 | false | 0 | 0 | The main problem is that you can't reuse code as easily. This means for example that you might have to duplicate things like the ORM mapping for each language you are using. | 4 | 2 | 0 | Is it a bad idea to mix programming languages, for example have a node.js server that sends some stuff to a python program that then goes and does other stuff with it. This is pretty vague but what is the best way to send data between different programs, or is this just a terrible idea and I shouldn't even consider it?... | Mixing programming languages for the same project | 0.039979 | 0 | 0 | 2,891 |
9,524,148 | 2012-03-01T21:09:00.000 | 6 | 0 | 1 | 0 | python,sockets,node.js,programming-languages | 9,524,184 | 5 | true | 0 | 0 | I don't see why this is harmful. Polyglot programming is common these days: jQuery and JavaScript on clients, Java or .NET on servers, etc.
It's common to write web services in Java or .NET. It shouldn't bother anyone to mix and match.
Use the best tool for the job. | 4 | 2 | 0 | Is it a bad idea to mix programming languages, for example have a node.js server that sends some stuff to a python program that then goes and does other stuff with it. This is pretty vague but what is the best way to send data between different programs, or is this just a terrible idea and I shouldn't even consider it?... | Mixing programming languages for the same project | 1.2 | 0 | 0 | 2,891 |
9,524,574 | 2012-03-01T21:41:00.000 | 0 | 0 | 0 | 0 | python,json,django-models | 9,540,376 | 2 | false | 1 | 0 | Once I dropped the notion of Value Object carried over from JAVA background,
and started to focus on what I really want, I found a simple way to get
this: to custom build a dictionary in views.py, based on the data
coming back from related models. And then add each dictionary to
a list bucket and use json dumps prio... | 1 | 1 | 0 | Our Django data model objects are nicely mapped to database tables. We want a way to package data from two or more tables into a customized structure, so that we can easily serve it up as JSON feed, having all the attributes and is in the desired format.
It is kind of like "value objects" (POJO) in other environment s... | What's the best way to have value object using Django data model? | 0 | 0 | 0 | 676 |
9,525,437 | 2012-03-01T22:47:00.000 | 0 | 0 | 0 | 0 | python,gstreamer,python-gstreamer | 9,540,599 | 1 | false | 0 | 0 | Instead of "pipe1. ! volume name=volume ! autoaudiosink name=audiosink" you can write pipe1.srcXX ! volume name=volume ! autoaudiosink name=audiosink" where XX is the pad you want to connect to. You will need to listen to newly added pads with a signal handler and ideally connect them all to an input-selector. This you... | 1 | 0 | 0 | How can I switch between audio tracks in a video using PyGST, but without using playbin2? I'm using this pipeline, but I have no idea about how to select a specific audio stream in the video and connecting it to the audiosink:
uridecodebin name=pipe1 pipe1. ! videobalance name=balance ! textoverlay name=text ! xvimage... | PyGST and videos with multiple audio tracks | 0 | 0 | 0 | 411 |
9,528,395 | 2012-03-02T05:23:00.000 | 0 | 1 | 0 | 0 | python,http,authentication,screen-scraping,web-scraping | 9,542,705 | 1 | false | 1 | 0 | It's very unlikely that any of the sites you are interested in use basic auth. You will need a library like mechanize that manages cookies and you will need to submit the login information to the site's login page. | 1 | 0 | 0 | I've been reading about beautifulSoup, http headers, authentication, cookies and something about mechanize.
I'm trying to scrape my favorite art websites with python. Like deviant art which I found a scraper for. Right now I'm trying to login but the basic authentication code examples I try don't work.
So question, How... | how to find the authentication used on a website | 0 | 0 | 1 | 829 |
9,528,748 | 2012-03-02T06:02:00.000 | 2 | 0 | 1 | 0 | python,django | 9,528,803 | 1 | true | 1 | 0 | The first thing to look out for is overplanning. This, along with overengineering, is even more true for your second project.
You have lots of ideas about how this program will behave, but don't get ahead of yourself. Remember what the problem is you want to solve, and try to keep focused on the simplest way to solve t... | 1 | 2 | 0 | I want to create a program that will take user input and create a
calendar using the input.
example: John,Conner 1/3/10 birthday
This information will also be sortable by the obvious: last name,first name, date, (other).
It will be able to print this information as a list or a calendar.
It will have to have excepti... | First project what should I look out for | 1.2 | 0 | 0 | 177 |
9,529,113 | 2012-03-02T06:39:00.000 | 0 | 0 | 0 | 0 | python,web.py | 9,531,601 | 2 | false | 1 | 0 | you can use a Get Variable:
web.seeother('/somepage?message=hello')
bye | 1 | 0 | 0 | In web.py, I use web.seeother() to redirect to another page, is there a way to transfer some message to that page too? | How to transfer message between different request in web.py? | 0 | 0 | 1 | 569 |
9,533,423 | 2012-03-02T12:37:00.000 | 2 | 0 | 0 | 0 | python,proxy | 11,974,958 | 2 | false | 0 | 0 | You will need to set your browser proxy to localhost:8080. | 2 | 1 | 0 | For using mitmproxy do I have to set my proxy to localhost or does mitmproxy work immediately when I start it? | mitmproxy: does one have to set proxy server to local? | 0.197375 | 0 | 0 | 556 |
9,533,423 | 2012-03-02T12:37:00.000 | 0 | 0 | 0 | 0 | python,proxy | 61,481,642 | 2 | false | 0 | 0 | By default, mitmproxy server is installed to listen for 127.0.0.1:8080 (or localhost:8080)
To let mitmproxy work, you have to:
Start mitmproxy
Set up 127.0.0.1:8080 or localhost:8080 as a proxy server in your browser settings. | 2 | 1 | 0 | For using mitmproxy do I have to set my proxy to localhost or does mitmproxy work immediately when I start it? | mitmproxy: does one have to set proxy server to local? | 0 | 0 | 0 | 556 |
9,534,179 | 2012-03-02T13:34:00.000 | 2 | 0 | 1 | 0 | python,pycharm,pydoc | 9,555,368 | 1 | true | 0 | 0 | Documentation is available on Ctrl+Q (default Windows Keymap or View | Quick Documentation).
If you want it to appear automatically on explicit code completion, turn on Settings | Editor | Code Completion | Autopopup documentation in... | 1 | 1 | 0 | I cannot configure pydoc3.2 on pycharm 2.0.2. Any instructions will help me lot. Thanks. | Cannot add pydoc on PyCharm | 1.2 | 0 | 0 | 2,154 |
9,534,242 | 2012-03-02T13:38:00.000 | 0 | 1 | 1 | 0 | python,visual-studio-2010 | 9,534,308 | 2 | false | 0 | 0 | If Iron python can do everything C# and VB can do in VS2010 i'll be happy. But can it?
No, C# and VB, and to a lesser extent F#, are the primary languages for Visual Studio. Microsoft support for IronPython has been dropped and it seems to be stagnating.
If you are just writing console based code then you may be OK wi... | 1 | 2 | 0 | i'm trying to work out which language to work with in VS2010, c# or Python.
I understand that there are better ide's for Python out there but i like the VS IDE environment.
If Iron python can do everything CS and VB can do in VS2010 i'll be happy. But can it? | Python in VS2010 | 0 | 0 | 0 | 1,931 |
9,534,290 | 2012-03-02T13:42:00.000 | 2 | 0 | 1 | 0 | python,linux,tkinter | 9,534,359 | 1 | true | 0 | 0 | Unfortunately, python-tk is actually a separately-packaged version of Tkinter, built straight from the Python source code; it's not a separately available source package.
What you can do is build and install your own version of Python in your homedir. | 1 | 1 | 0 | I have an issue to install python-tk package for my app to user's computer. User does not have sudo rights, but has python installed by default.
I can't even find downloadable python-tk module to simply run "python setup.py install" .
Can someone help with this? Are there any other choices? | How to install python-tk package without sudo? | 1.2 | 0 | 0 | 917 |
9,535,222 | 2012-03-02T14:49:00.000 | 1 | 0 | 1 | 1 | python,tcp,py2exe,scapy | 9,535,512 | 1 | true | 0 | 0 | I don't think you're going to be able to accomplish what you want. Even for the simplest scripts Py2Exe will require many dependent files.
As for Scapy it will definitely need winpcap. I would assume it needs most of the others as well. You could probably get away without readline, but at that point why bother? | 1 | 1 | 0 | i want to code a program using scapy, e.g. send a custom packet using scapy, and after finishing the program, i want to convert the python file into EXE file using py2exe, in order to use on windows platform without python . but i noticed that the installation of scapy for windows needs a lot of dependent file, such as... | does the final EXE file of scapy need another dependent file | 1.2 | 0 | 0 | 623 |
9,537,326 | 2012-03-02T17:01:00.000 | 0 | 0 | 0 | 0 | python,django,django-models,content-management-system,django-admin | 9,537,653 | 3 | false | 1 | 0 | I would find out how much they need to change? If they plan a complete redesign every week then you're still looking for an answer. If they just need a dynamic front page then you can split it up into variables and let them edit sections of html. Much safer and less prone to breaking the html. | 3 | 0 | 0 | I'm new to working with Django and am developing for a client who wants to be able to change page content in the Django Admin. They need to be able to change the html of the index page without editing the files on the server.
I know about flatfiles but I'm not sure that's completely what I'm after as I can't display st... | Django - Managing page content in Django Admin | 0 | 0 | 0 | 984 |
9,537,326 | 2012-03-02T17:01:00.000 | 0 | 0 | 0 | 0 | python,django,django-models,content-management-system,django-admin | 9,537,377 | 3 | false | 1 | 0 | I don't believe that is possible at this time. Of course you can edit your models but templates, I think not. | 3 | 0 | 0 | I'm new to working with Django and am developing for a client who wants to be able to change page content in the Django Admin. They need to be able to change the html of the index page without editing the files on the server.
I know about flatfiles but I'm not sure that's completely what I'm after as I can't display st... | Django - Managing page content in Django Admin | 0 | 0 | 0 | 984 |
9,537,326 | 2012-03-02T17:01:00.000 | 1 | 0 | 0 | 0 | python,django,django-models,content-management-system,django-admin | 9,537,635 | 3 | true | 1 | 0 | Honestly, the scope of what you're looking for is too huge to cover in this format. There's a number of ways this could be done, but they're all going to require some work and customization based on the client's needs.
Flatpages could work if you allow HTML content and make sure the content is rendered as "safe" in the... | 3 | 0 | 0 | I'm new to working with Django and am developing for a client who wants to be able to change page content in the Django Admin. They need to be able to change the html of the index page without editing the files on the server.
I know about flatfiles but I'm not sure that's completely what I'm after as I can't display st... | Django - Managing page content in Django Admin | 1.2 | 0 | 0 | 984 |
9,539,006 | 2012-03-02T19:12:00.000 | 3 | 0 | 0 | 0 | python,networking | 9,539,066 | 8 | false | 0 | 0 | Convert the last part of your IP address into a number, add 1 to it, and call ifconfig.
I think the approach of incrementing the last bit will not scale well as we span across networks. –OP
I thought of mentioning that in my original answer, but didn't, for various reasons. These reasons are as follows:
I thought it... | 1 | 15 | 0 | I would like to increment an ip address by a fixed value.
Precisely this is what I am trying to achieve, I have an ip address say, 192.168.0.3 and I want to increment it by 1 which would result in 192.168.0.4 or even by a fixed value, x so that it will increment my ip address by that number. so, I can have a host like ... | python increment ipaddress | 0.07486 | 0 | 1 | 22,989 |
9,540,154 | 2012-03-02T20:49:00.000 | 6 | 0 | 0 | 0 | python,database,django,sqlite | 9,540,685 | 4 | false | 1 | 0 | MySQL and PostgreSQL work best with Django. I would highly suggest that when you choose one that you change your development settings to use it while development (opposed to using sqlite3 in dev mode and a "real" database in prod) as there are subtle behavioral differences that can caused lots of headaches in the futur... | 1 | 48 | 0 | I'm new to Django and have only been using sqlite3 as a database engine in Django. Now one of the applications I'm working on is getting pretty big, both in terms of models' complexity and requests/second.
How do database engines supported by Django compare in terms of performance? Any pitfalls in using any of them? An... | Which database engine to choose for Django app? | 1 | 1 | 0 | 41,120 |
9,540,220 | 2012-03-02T20:54:00.000 | 1 | 1 | 1 | 0 | c++,python,visual-studio-2010,debugging,dll | 9,540,284 | 1 | false | 0 | 0 | You need to have the .pdb file in your bin directory if you want to be able to step into and debug a dll, otherwise you will not have access to any of the debugging symbols. This .pdb allows visual studio to read the .dll file and step into its method calls. | 1 | 1 | 0 | I have a dll built in c++, under VS2010, and I am calling it from a python project.
I had an error, inside the dll, and I would have liked to be able to debug using VS tools, step into the solution until I reach the task that "read an invalid memory location".
The debug / stepping into functions didn't step into the f... | debugging a c++ dll in VS2010, from python | 0.197375 | 0 | 0 | 1,816 |
9,541,301 | 2012-03-02T22:31:00.000 | 3 | 0 | 1 | 0 | python,apache,mod-wsgi | 9,541,433 | 2 | true | 1 | 0 | Web-apps are generally “shared-nothing”. In the context of WSGI, that means you have no idea how many times your application (and the counter with it) will be instantiated; that choice is up to the WSGI server which acts as your app's container.
If you want some notion of user sessions, you have to implement it explici... | 1 | 4 | 0 | I know there are frameworks that exist, but I am trying to use wsgi directly to improve my own understanding.
I have my wsgi handler, and up at the top I have declared a variable i = 0.
In my application(environ, start_response) function, I declare global i, then I increment i whenever a button is pressed.
It is my und... | Global variables in Python and Apache mod_wsgi | 1.2 | 0 | 0 | 3,538 |
9,542,814 | 2012-03-03T02:18:00.000 | -1 | 1 | 1 | 1 | python,macos,text,compiler-construction | 9,542,902 | 5 | false | 0 | 0 | You could try py2exe (http://www.py2exe.org/) since it compiles your code into an exe file, they should have a hell of a time trying to decompose it. | 2 | 4 | 0 | I'm trying to send a python script I wrote on my Mac to my friends. Problem is, I don't want to send them the code that they can edit. How can I have my script change from an editable text file, to a program that you click to run? | "Compiling" python script | -0.039979 | 0 | 0 | 4,391 |
9,542,814 | 2012-03-03T02:18:00.000 | 0 | 1 | 1 | 1 | python,macos,text,compiler-construction | 9,543,052 | 5 | false | 0 | 0 | If your friends are on windows you could use py2exe, but if they're on Mac I'm not sure there's an equivalent. Either way, compiling like that breaks cross platform compatability, which is the whole point of an interpreted language really...
Python just isn't really set up to hide code like that, it's against it's phil... | 2 | 4 | 0 | I'm trying to send a python script I wrote on my Mac to my friends. Problem is, I don't want to send them the code that they can edit. How can I have my script change from an editable text file, to a program that you click to run? | "Compiling" python script | 0 | 0 | 0 | 4,391 |
9,543,171 | 2012-03-03T03:30:00.000 | 0 | 1 | 0 | 0 | php,python,wordpress | 9,543,194 | 1 | false | 0 | 0 | I did this yesterday.
my process was to add a row to a master accounts table, get the auto inc id, use that along with the company name to create the db name. so in my case the db's are
Root_1companyname1
Root_2companyname2
..
Root_ is optional of course.
Ask if you have any questions. | 1 | 0 | 0 | I am trying to think through a script that I need to create. I am most likely going to be using php unless there would be a better language to do this with e.g. python or ror. I only know a little bit of php so this will definitely be a learning experience for me and starting fresh with a different language wouldn't be... | Automate database creation with incremental name? | 0 | 1 | 0 | 90 |
9,543,993 | 2012-03-03T06:16:00.000 | 2 | 0 | 0 | 0 | python,browser,cgi,urllib | 9,544,394 | 2 | true | 0 | 0 | The only reason that you are probably convinced that this is a working approach is most likely because you are running the server on your local machine. The python code you are executing is server-side so it has no control over the client. The client would normally be on a remote machine. In your case since your client... | 1 | 1 | 0 | I am making a website where I am using some html forms, which passes the values to a python script and in return the python script opens a new page/tab in the web browser. I am using the webbrowser module for it. Although I can choose the default browser or any other browser using "webbrowser.get([name])"; but my conce... | How to detect the current open webbrowser and open new page in that same browser using Python? | 1.2 | 0 | 1 | 2,834 |
9,544,618 | 2012-03-03T08:17:00.000 | 1 | 0 | 0 | 0 | python,database,flask | 9,545,480 | 1 | true | 1 | 0 | You might look at mongoengine we use it in production with flask(there's an extension) and it has suited our needs well, there's also mongoalchemy which I haven't tried but seems to be decently popular.
The downside to using mongo is that there is no expire automatically, having said that you might take a look at usin... | 1 | 3 | 0 | I have a Python Flask app I'm writing, and I'm about to start on the backend. The main part of it involves users POSTing data to the backend, usually a small piece of data every second or so, to later be retrieved by other users. The data will always be retrieved within under an hour, and could be retrieved in as low a... | In need of a light, changing database/storage solution | 1.2 | 1 | 0 | 168 |
9,550,690 | 2012-03-03T23:13:00.000 | 0 | 0 | 0 | 0 | jquery,python,screen-scraping | 9,551,356 | 2 | false | 1 | 0 | If I'm reading your question right, you're not trying to build a web app (client- or server-side), but rather a standalone app that simply requests and downloads pages from the Web.
You can write a standalone app in JavaScript, but it's not common. The primary use of JavaScript is for code that's going to run in a user... | 2 | 0 | 0 | So lets say I'm scraping multiple pages (lets say a 1000) on a website. I want to know which language is best to use to scrape those pages with - javascript or python.
Further, I've heard about javascript scrapers being faster (due to multiple get requests), but am unsure how to implement this - can anyone enlighten m... | Scraping with JQuery or Python? | 0 | 0 | 1 | 1,586 |
9,550,690 | 2012-03-03T23:13:00.000 | 3 | 0 | 0 | 0 | jquery,python,screen-scraping | 9,551,757 | 2 | true | 1 | 0 | This is just my opinion but I would rank them like this
javascript might be the best choice but only if you have a node
environment already set up. The advantage of javascript scrapers is
they can interpret the js in the pages you're scraping.
next is a three way tie between perl python and ruby. They all have a mecha... | 2 | 0 | 0 | So lets say I'm scraping multiple pages (lets say a 1000) on a website. I want to know which language is best to use to scrape those pages with - javascript or python.
Further, I've heard about javascript scrapers being faster (due to multiple get requests), but am unsure how to implement this - can anyone enlighten m... | Scraping with JQuery or Python? | 1.2 | 0 | 1 | 1,586 |
9,551,108 | 2012-03-04T00:16:00.000 | 1 | 0 | 0 | 0 | python,search-engine | 10,133,419 | 2 | true | 1 | 0 | pySearch is no longer supported, the only way to search yahoo is to use their BOSS API.
The BOOS api would require payments for every 1000 queries. | 1 | 0 | 0 | Google and Bing are both free, for Google I use urllib and json to get the results. For Bing i use pyBing. Yahoo requires me to pay per 1000 queries, which I don't want to do for a homework assignment.
Is there any other SEs that has a python api? Or has something similar to Google's ajax googleapis? | besides google and bing, what other search engine has an python api? | 1.2 | 0 | 1 | 332 |
9,552,225 | 2012-03-04T04:08:00.000 | 1 | 0 | 1 | 0 | python | 9,552,530 | 4 | false | 0 | 0 | That is not because of python but rather due to how the complex number maths is.
when you access (1j).imag => you are reading the imaginary part of 1j which is 1.
Hence it does the 1+1 = 2.
1+1j is 1 real + 1 imaginary.
Hope it helped. | 3 | 1 | 0 | It's very strange. Looks like python interpret it as (1+1)j.imag, but why? Shouldn't it be 1+(1j).imag or (1+1j).imag? | Python: `1+1j == (1+1j)` but `1+1j.imag == 2`, why? | 0.049958 | 0 | 0 | 477 |
9,552,225 | 2012-03-04T04:08:00.000 | 3 | 0 | 1 | 0 | python | 9,552,249 | 4 | false | 0 | 0 | 1j is a complex number literal. Like other literals in python, you can call methods on it and access its fields. "hello".upper() would be an analogous example for a string literal.
So, 1j is a complex number (type(1j) returns <class 'complex'>). 1j.imag is accessing the imag property of that number; the value of that p... | 3 | 1 | 0 | It's very strange. Looks like python interpret it as (1+1)j.imag, but why? Shouldn't it be 1+(1j).imag or (1+1j).imag? | Python: `1+1j == (1+1j)` but `1+1j.imag == 2`, why? | 0.148885 | 0 | 0 | 477 |
9,552,225 | 2012-03-04T04:08:00.000 | 0 | 0 | 1 | 0 | python | 9,553,497 | 4 | false | 0 | 0 | 1+1j = (1) + (1j)
1+1j.imag = (1) + (1j.imag)
It is perfectly consistent. | 3 | 1 | 0 | It's very strange. Looks like python interpret it as (1+1)j.imag, but why? Shouldn't it be 1+(1j).imag or (1+1j).imag? | Python: `1+1j == (1+1j)` but `1+1j.imag == 2`, why? | 0 | 0 | 0 | 477 |
9,552,629 | 2012-03-04T05:35:00.000 | 3 | 0 | 1 | 0 | python,regex,numbers,regex-group | 9,552,653 | 2 | true | 0 | 0 | I noticed that I don't need the \g<1> syntax. Instead I can use one of several techniques to separate the numeric backreference like \2 from the digit like 9 that follows it. Here are three such techniques:
a non-capturing group (?:\2)9
an otherwise unnecessary quantification by one \2{1}9
using an otherwise unnecessa... | 2 | 2 | 0 | In a Python match pattern, how do I match a literal digit like 1 after a backreference by number like \1?
I tried the \g<1> syntax that is available in substitution patterns for this purpose, but it doesn't work in my match pattern.
I have a larger problem that I want to solve using a function that will perform the fol... | python re.match group: number after \number | 1.2 | 0 | 0 | 549 |
9,552,629 | 2012-03-04T05:35:00.000 | 2 | 0 | 1 | 0 | python,regex,numbers,regex-group | 9,552,654 | 2 | false | 0 | 0 | Put the digit that you want to match literally in a character class \1[1] or a group \1(1) of its own so that the bracket or parentheses separates the digit from the backreference. | 2 | 2 | 0 | In a Python match pattern, how do I match a literal digit like 1 after a backreference by number like \1?
I tried the \g<1> syntax that is available in substitution patterns for this purpose, but it doesn't work in my match pattern.
I have a larger problem that I want to solve using a function that will perform the fol... | python re.match group: number after \number | 0.197375 | 0 | 0 | 549 |
9,553,207 | 2012-03-04T07:40:00.000 | 3 | 0 | 1 | 0 | python,file | 9,553,232 | 3 | false | 0 | 0 | If you know how many bytes you have before the line you're interested in, you could seek to that point and read out a line. Otherwise, a "line" is not a first class construct (it's just a list of characters terminated by a character you're assigning a special meaning to - a newline). To find these newlines, you have to... | 1 | 1 | 0 | I need to get a specific line number from a file that I am passing into a python program I wrote. I know that the line I want will be line 5, so is there a way I can just grab line 5, and not have to iterate through the file? | python reading files | 0.197375 | 0 | 0 | 228 |
9,554,204 | 2012-03-04T10:41:00.000 | 0 | 0 | 0 | 0 | python,database,sqlalchemy | 9,554,925 | 2 | false | 0 | 0 | I think you're perhaps over-thinking the situation. If you want to create the database afresh, you normally just call Base.metadata.create_all() or equivalent, and if you don't want to do that, you don't call it.
You could try calling it every time and handling the exception if it goes wrong, assuming that the database... | 1 | 0 | 0 | there's something I'm struggling to understand with SQLAlchamy from it's documentation and tutorials.
I see how to autoload classes from a DB table, and I see how to design a class and create from it (declaratively or using the mapper()) a table that is added to the DB.
My question is how does one write code that bot... | SQLAlchamy Database Construction & Reuse | 0 | 1 | 0 | 77 |
9,554,610 | 2012-03-04T11:48:00.000 | 1 | 0 | 0 | 0 | javascript,python,django | 9,768,878 | 1 | true | 1 | 0 | Yeah I had to edit the widget contained in the django install (... site-packages/django/contrib/admin/media/js/admin/DateTimeShortcuts.js). I was getting confused as even when I edited it, it was not working. It was my fault, as even though I was working on a local machine the settings were still pointing to the remo... | 1 | 0 | 0 | Simple question really, is there any programmatic way to over load the "choose a time" options in django for the DateTimeShortcuts.js when used in the admin?
The options they present aren't very helpful the last option of the day is noon. I was hoping to have every hour of the day as an option | Overloading DateTimeShortcuts.js in Django | 1.2 | 0 | 0 | 1,664 |
9,555,742 | 2012-03-04T14:39:00.000 | 1 | 1 | 0 | 1 | python,ubuntu-10.04 | 9,555,991 | 3 | false | 0 | 0 | Save your pid to a file; if the file already exists, check that the process that left its PID is still alive. (This is safer than trying to ensure you always remove the file: You can't). The full process goes like this:
Check if the checkpoint file exists. If it does not, write your PID into the file and go ahead with ... | 2 | 1 | 0 | I have my python script set to run from cron in Ubuntu Server. However it might take longer time to finish, before another cron event will try to start it. I would like to determine such case from script itself and if running then gracefully terminate it from python script. | How to determine if my python script is running? | 0.066568 | 0 | 0 | 3,425 |
9,555,742 | 2012-03-04T14:39:00.000 | 0 | 1 | 0 | 1 | python,ubuntu-10.04 | 9,555,781 | 3 | false | 0 | 0 | There are two obvious solutions:
Some kind of lock file, which it checks. If the lock file exists, then don't start, otherwise create it. (Or more aptly, in true python 'ask for forgiveness, not permission' style, try to make it and catch the error if it exists - stopping a race condition). You need to be careful to e... | 2 | 1 | 0 | I have my python script set to run from cron in Ubuntu Server. However it might take longer time to finish, before another cron event will try to start it. I would like to determine such case from script itself and if running then gracefully terminate it from python script. | How to determine if my python script is running? | 0 | 0 | 0 | 3,425 |
9,556,280 | 2012-03-04T15:46:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,cgi,wsgi,cherrypy | 15,619,684 | 1 | true | 1 | 0 | The problem was that cherrypy was not in the root of the working directory, all of which I uploaded with the app engine tool. Not 100% sure if its the correct way to use GAE but it works. | 1 | 1 | 0 | Can someone please show me how to get cherrypy to work with Google App Engine, I have made applications with cherrypys built in server, but I have no idea how to make an app that works with WSGI and GAE.
I have read the documentation for cherrypy and GAE but can't find anything. And I would prefer cherrypy to the webap... | Setup Cherrypy with Google App Engine | 1.2 | 0 | 0 | 1,132 |
9,557,070 | 2012-03-04T17:18:00.000 | 2 | 0 | 0 | 1 | python,queue,rabbitmq,task-queue,beanstalkd | 9,567,697 | 2 | true | 0 | 0 | You create your initial batch of jobs and add them to the queue.
You have n-consumers of the queue each running the jobs. Adding consumers to the queue simply round-robins the distribution of jobs to each listening consumer, giving you arbitrary horizontal scalability.
Each job can, upon completion, be responsible for ... | 2 | 0 | 0 | I have about 1000-10000 jobs which I need to run on a constant basis each minute or so. Sometimes new job comes in or other needs to be cancelled but it's rare event. Jobs are tagged and must be disturbed among workers each of them processes only jobs of specific kind.
For now I want to use cron and load whole databas... | What is the optimal way to organize infinitely looped work queue? | 1.2 | 0 | 0 | 341 |
9,557,070 | 2012-03-04T17:18:00.000 | 0 | 0 | 0 | 1 | python,queue,rabbitmq,task-queue,beanstalkd | 9,578,495 | 2 | false | 0 | 0 | You can use asynchronous framework, e.g. Twisted
I don't think either it's a good idea to run script by cron daemon each minute (and you mentioned reasons), so I offer you Twisted. It doesn't give you benefit with scheduling, but you get flexibility in process management and memory sharing | 2 | 0 | 0 | I have about 1000-10000 jobs which I need to run on a constant basis each minute or so. Sometimes new job comes in or other needs to be cancelled but it's rare event. Jobs are tagged and must be disturbed among workers each of them processes only jobs of specific kind.
For now I want to use cron and load whole databas... | What is the optimal way to organize infinitely looped work queue? | 0 | 0 | 0 | 341 |
9,557,074 | 2012-03-04T17:18:00.000 | 3 | 0 | 0 | 0 | python,algorithm,hadoop,graph-theory,distributed-computing | 9,557,746 | 2 | false | 0 | 0 | You can look CUDA as another option, if it is highly computational task. | 1 | 2 | 0 | I am interested in implementing and running some heavy graph-theory algorithms for the purpose of (hopefully) finding counterexamples for some conjecture.
What is the most efficient libraries, server setups you would recommend?
I am thinking of using Python's Graph API.
For running the algorithms I was thinking of us... | I am interested in disproving some graph theory conjectures in python, what is the most efficient library/server set up to use? | 0.291313 | 0 | 1 | 252 |
9,557,552 | 2012-03-04T18:17:00.000 | 3 | 0 | 0 | 0 | python,nosql,redis,rdbms,flask | 9,557,895 | 1 | true | 1 | 0 | You should have no problem using an ORM because, in the end, it just stores strings, numbers and other values. So you could have a game in progress, and keep its state in Redis, including the players' IDs from the SQL player table, because the ID is just a unique integer. | 1 | 4 | 0 | I'm developing a multi-player game in Python with a Flask frontend, and I'm using it as an opportunity to learn more about the NoSQL way of doing things.
Redis seems to be a good fit for some of the things I need for this app, including storage of server-side sessions and other transient data, e.g. what games are in pr... | Redis and RDBMS coexistence (hopefully cooperation) in Flask applications | 1.2 | 1 | 0 | 532 |
9,557,888 | 2012-03-04T19:01:00.000 | 5 | 0 | 1 | 0 | python | 9,558,958 | 2 | true | 0 | 0 | If features are added or changed, we add 'version changed' or 'version added' entries to the docs.
If you want to (as it sounds like you do) monitor places where we improve the docs, then one way would be to subscribe to the python-checkins mailing list, and add a filter to your email program to only capture checkins t... | 1 | 7 | 0 | "What's new" sections, message boards, community, etc, are great, but what happens when a reference I've read, am familiar with, and may never look at again (or think I don't need to), gets a significant update. I fear I may potentially miss the point of something useful when some new insightful examples or more compl... | How to see when there are changes/enhancements to the CPython documentation | 1.2 | 0 | 0 | 68 |
9,559,475 | 2012-03-04T22:34:00.000 | 0 | 0 | 0 | 1 | python,ubuntu,cherrypy | 9,561,238 | 1 | true | 0 | 0 | I wound up downloading the tar file (which I think may be a minor version or two more recent than what apt-get knows about) and using setup.py to install it. This version includes the digest authorization module. | 1 | 0 | 0 | I have a CherryPy web site running on a virtual ubuntu linux server. I'm attempting to move the application to a second, larger-memory server. Both servers appears to have CherryPy 3.2 installed (I just used apt-get to install it on the newer server).
The newer server, however, does not appear to have the CherryPy au... | Where to get the CherryPy auth_digest module? | 1.2 | 0 | 1 | 219 |
9,560,950 | 2012-03-05T02:30:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,web.py | 9,561,004 | 2 | false | 1 | 0 | You could create a signed java applet that will run along side the javascript and allow access to local files. You may be able to find an applet already developed that you can call from javascript. You have to be careful with this though because once the user trusts the applet it's installed and any site can call the a... | 2 | 0 | 0 | I currently have a local python application that scans a users drive, maps it into a tree and displays this information with javascript. I would really like to try to develop something with a Drop-Box like system to manage drive trees.
I have searched and read that App Engine specifically doesn't allow access to a use... | What is the possibility of using a Python app, deployed online, that has access to a users local disk? | 0.197375 | 0 | 0 | 139 |
9,560,950 | 2012-03-05T02:30:00.000 | 4 | 0 | 0 | 1 | python,google-app-engine,web.py | 9,560,968 | 2 | true | 1 | 0 | You'd have to create a "client" and "server" type of interface to do this. So it wouldn't be a solely JavaScript with Python on the server program. They'd have to have something running on their end as well, communicating in the background.
HTML5 allows some local storage, but not what you're looking for. | 2 | 0 | 0 | I currently have a local python application that scans a users drive, maps it into a tree and displays this information with javascript. I would really like to try to develop something with a Drop-Box like system to manage drive trees.
I have searched and read that App Engine specifically doesn't allow access to a use... | What is the possibility of using a Python app, deployed online, that has access to a users local disk? | 1.2 | 0 | 0 | 139 |
9,563,935 | 2012-03-05T08:59:00.000 | 7 | 0 | 0 | 0 | python,django,django-admin | 9,564,009 | 2 | true | 1 | 0 | Do not remove or change anything in the admin.
Instead remove user's/group's permission to delete given model. If user does not have the permission to delete, the delete button won't appear at any page related to that model. | 1 | 2 | 0 | I have an apps and I am making used of django admin, but my apps does not allow deleting of data and django admin have a delete button/link. I have already removed the delete action.
my question is, how can i remove the delete button/link in admin page in django? | removing buttons/links in django admin | 1.2 | 0 | 0 | 2,890 |
9,564,203 | 2012-03-05T09:20:00.000 | 0 | 0 | 1 | 1 | python,macos,osx-lion,gevent | 11,092,390 | 1 | false | 0 | 0 | I encountered this error as well. I believe it is due to a conflict between libev and libevent (in my case, libev-4.11 and libevent-1.4.14b). libev replaces /usr/local/include/event.h and /usr/local/include/evutil.h with its own version of those files, and trying to compile gevent with the versions from libev results i... | 1 | 2 | 0 | Tried installing gevent using pip install gevent and also tried compiling from source. Both the times the installation stopped because of the following error.
/usr/local/include/evhttp.h:223: error: expected specifier-qualifier-list before ‘ev_int64_t’
i have libevent installed in /usr/local/lib and its being picked up... | Gevent installation error in Mac OS X Lion | 0 | 0 | 0 | 590 |
9,564,755 | 2012-03-05T10:03:00.000 | 4 | 0 | 1 | 0 | python | 9,564,771 | 2 | true | 0 | 0 | Strings are immutable types in python. Main advantages of being immutable would be:
simplify multithreaded programming.
can be used as dictionary keys (will keep the same hash) | 1 | 0 | 0 | I found it odd that a string method operation on a string object doesn't modify the string object. Why is it? I wasted quite a bit of time yesterday trying to understand why my code wasn't working when I finally discovered this. | Why string method on a string object doesn't modify the object in Python? | 1.2 | 0 | 0 | 148 |
9,566,060 | 2012-03-05T11:45:00.000 | 1 | 0 | 0 | 0 | python,cassandra,uuid,pycassa | 9,567,221 | 3 | true | 0 | 0 | You might be able to do this by making a get_range request with a random start key (just a random string), and a row_count of 1.
From memory, I think the finish key would need to be the same as start, so that the query 'wraps around' the keyspace; this would normally return all rows, but the row_count will limit that.... | 1 | 3 | 1 | Is there a possibility to retrieve random rows from Cassandra (using it with Python/Pycassa)?
Update: With random rows I mean randomly selected rows! | Cassandra/Pycassa: Getting random rows | 1.2 | 0 | 0 | 2,264 |
9,567,322 | 2012-03-05T13:19:00.000 | 0 | 0 | 1 | 1 | python,perforce | 9,567,478 | 5 | false | 0 | 0 | Have you tried merely piping the input to the command?
In cmd.exe:
C:\> echo m | p4 resolve | 1 | 0 | 0 | p4.exe is the perforce command line tool (git/cvs/svn like tool).
I am trying to launch several ms-dos commands 'p4 resolve' in an python script. because I have a hundred files to resolve.
However I cannot launch 'p4 resolve -m' as I want (which automatically opens my 3-way merge tool on the conflicting files). p4 does... | Feed input of MS-DOS interactive executable with a string value | 0 | 0 | 0 | 373 |
9,567,579 | 2012-03-05T13:37:00.000 | 0 | 1 | 1 | 0 | python,json,security,configuration-files,pickle | 9,568,058 | 1 | false | 0 | 0 | I'd think about encrypting the credentials file. The process that uses it will need a key/password to decrypt it, and you can store that somewhere else-- or even enter it interactively on server start-up. That way you don't have a single point of failure (though of course a determined intruder can eventually put the pi... | 1 | 0 | 0 | I tried to figure it out, the most secure and flexible solution for storing in config file some credentials for database connection and other private info.
This is inside a python module for logging into different handlers (mongodb, mysqldb, files,etc) the history of users activity in the system.
This logging module,... | Security issues storing config file in json/CPickle | 0 | 0 | 0 | 427 |
9,568,336 | 2012-03-05T14:30:00.000 | 1 | 0 | 0 | 0 | python,django,validation,model | 9,586,795 | 2 | false | 1 | 0 | Case 1:
Don't do it like that, have a different table for telephone numbers and have a ForeignKey from the Person (I'm assuming it's a person) to the the telephone number. If you have more than one telephone number per person, do it the other way around, otherwise consider using a OneToOne.
Obviously you'll want the Fo... | 1 | 3 | 0 | How can I have field dependency?
Case 1: If boolean field call_me is set, then telephone must be set, else it should be blank
Case 2: If many to many field category (with values sale, rent) has one of the values as sale, then price_sale must be set, else it should be blank | Django models - field dependency | 0.099668 | 0 | 0 | 2,667 |
9,570,157 | 2012-03-05T16:23:00.000 | 0 | 0 | 0 | 0 | python,excel,csv | 9,570,191 | 4 | false | 0 | 0 | Can you see the missing values when you open the CSV with wordpad? If so, then Python or any other scripting language should see them too. | 2 | 0 | 1 | I'm currently opening CSV files in Excel with multiple columns, where values will only appear if a number changes. For example, the data may ACTUALLY be: 90,90,90,90,91. But it will only appear as 90,,,,91. I'd really like the values in between to be filled with 90s. Is there anyway python could help with this? I reall... | Blank Values in Excel File From CSV (not just rows) | 0 | 0 | 0 | 2,496 |
9,570,157 | 2012-03-05T16:23:00.000 | 0 | 0 | 0 | 0 | python,excel,csv | 9,570,477 | 4 | false | 0 | 0 | You can also do this entirely in excel:
Select column (or whatever range you're working with), then go to Edit>Go To (Ctrl+G) and click Special.
Check Blanks & click OK.
This will select only the empty cells within the list.
Now type the = key, then up arrow and ctrl-enter.
This will put a formula in every blank cel... | 2 | 0 | 1 | I'm currently opening CSV files in Excel with multiple columns, where values will only appear if a number changes. For example, the data may ACTUALLY be: 90,90,90,90,91. But it will only appear as 90,,,,91. I'd really like the values in between to be filled with 90s. Is there anyway python could help with this? I reall... | Blank Values in Excel File From CSV (not just rows) | 0 | 0 | 0 | 2,496 |
9,573,193 | 2012-03-05T20:05:00.000 | -1 | 0 | 1 | 0 | macos,xcode4,python-3.x | 9,573,545 | 1 | false | 0 | 0 | Xcode projects are bundles like app bundles. So 'foo.xcodeproj' will be a directory, inside of which is project.pbxproj.
There may be other files in the directory, but they are not used for the build and direct project definition; they are user configuration and window layout and things like that for the user of the ... | 1 | 2 | 0 | I am a Xcode newbie and need to programmatically access Xcode projects and methods to modify from a Python module. For example, say i have a "hello world" program in Xcode, and i need to modify the message to "Hello Python!", how do i do that from within my Python module? Please note i am talking about a Python module ... | How to access and modify Xcode project files from python code? | -0.197375 | 0 | 0 | 461 |
9,574,970 | 2012-03-05T22:23:00.000 | 0 | 0 | 0 | 0 | python,django | 9,575,013 | 4 | true | 1 | 0 | All installed apps can contribute to the database schema. django.contrib.auth.models contributes, among others, the auth_user table behind the django.contrib.auth.models.User model, therefore you do not have to worry about recreating it unless you have a specific reason to do so. | 2 | 0 | 0 | The import statement import the needed parts. but is the "user" class already made when you put that into your installed apps? or do you still need to clarify in models.py in order to make the table in the db? or can someone expand on how to use django users and sessions? I'm looking over the django docs right now and ... | Do I need to create a separate class in my models.py when using the django.contrib.auth.models import user? | 1.2 | 0 | 0 | 104 |
9,574,970 | 2012-03-05T22:23:00.000 | 0 | 0 | 0 | 0 | python,django | 9,575,285 | 4 | false | 1 | 0 | There's a number of things going on here. As you're aware, Django comes with a number of "contrib" packages that can be used in your app. You "activate" these by putting them into your INSTALLED_APPS.
When you run python manage.py syncdb, Django parse the models.py files of every app in INSTALLED_APPS and creates the a... | 2 | 0 | 0 | The import statement import the needed parts. but is the "user" class already made when you put that into your installed apps? or do you still need to clarify in models.py in order to make the table in the db? or can someone expand on how to use django users and sessions? I'm looking over the django docs right now and ... | Do I need to create a separate class in my models.py when using the django.contrib.auth.models import user? | 0 | 0 | 0 | 104 |
9,575,148 | 2012-03-05T22:39:00.000 | 1 | 1 | 0 | 0 | python,amazon-ec2,amazon-web-services,boto | 9,575,281 | 3 | false | 0 | 0 | In EC2 there's no api to change the actually name of the machine. You basically have two options.
You can pass the desired name of the computer in the user-data and when the server starts run a script that will change the name of the computer.
You can use an EC2 tag to name the server ec2-create-tags <instance-id> --t... | 1 | 23 | 0 | I'm using boto to spawn a new EC2 instance based on an AMI.
The ami.run method has a number of parameters, but none for "name" - maybe it's called something different? | With boto, how can I name a newly spawned EC2 instance? | 0.066568 | 0 | 1 | 9,225 |
9,576,263 | 2012-03-06T00:35:00.000 | 2 | 1 | 0 | 0 | python,session,cookies,pyramid | 9,576,386 | 3 | true | 1 | 0 | In general, the cookie stored with the client is just a long, hard-to-guess hash code string that can be used as a key into a database. On the server side, you have a table mapping those session hashes to primary keys (a session hash should never be a primary key) and expiration timestamps.
So when you get a request, f... | 2 | 1 | 0 | I'm using pyramid web framework. I was confused by the relationship between the cookie and session. After looked up in wikipedia, did I know that session is an abstract concept and cookie may just be an kind of approach (on the client side).
So, my question is, what's the most common implementation (on both the client ... | Is cookie a common and secure implementation of session? | 1.2 | 0 | 0 | 365 |
9,576,263 | 2012-03-06T00:35:00.000 | 1 | 1 | 0 | 0 | python,session,cookies,pyramid | 9,576,390 | 3 | false | 1 | 0 | A session is (usually) a cookie that has a unique value. This value maps to a value in a database or held in memory that then tells you what session to load. PHP has an alternate method where it appends a unique value to the end of every URL (if you've ever seen PHPSESSID in a URL you now know why) but that has securit... | 2 | 1 | 0 | I'm using pyramid web framework. I was confused by the relationship between the cookie and session. After looked up in wikipedia, did I know that session is an abstract concept and cookie may just be an kind of approach (on the client side).
So, my question is, what's the most common implementation (on both the client ... | Is cookie a common and secure implementation of session? | 0.066568 | 0 | 0 | 365 |
9,576,578 | 2012-03-06T01:20:00.000 | 0 | 0 | 0 | 0 | python,sql | 9,576,946 | 3 | false | 0 | 0 | The ORDER BY clause was made for that and doesn't look so slow. | 1 | 0 | 0 | I have a game where each player has a score. I would like to have a global scoreboard where players can compare their scores, see how well they are placed and browse the scoreboard.
Unfortunately I cannot find an efficient way to program this: storing the current player position in the scoreboard means I have to updat... | Scoreboard using Python and SQL | 0 | 1 | 0 | 857 |
9,576,822 | 2012-03-06T01:50:00.000 | 1 | 0 | 0 | 0 | python,django,django-admin | 9,588,284 | 1 | true | 1 | 0 | The django-admin-tools header is controlled by the theming.css file which is by default sitting under \admin_tools\theming\static\admin_tools\css\theming.css, and the default header should display the "Django" png that comes with django-admin-tools and is placed under \admin_tools\theming\static\admin_tools\images\djan... | 1 | 0 | 0 | I am using django-admin-tool to customized my django admin page. my problem is, how can I change the header of 'Django Administration' with django-admin-tools?
i know how to change it using base_site.html but the problem is my custom menu that i have done in django-admin-tools is not appearing. | django-admin-tools : change header 'Django Administration' | 1.2 | 0 | 0 | 2,081 |
9,577,314 | 2012-03-06T02:59:00.000 | 0 | 1 | 0 | 0 | c++,python,weak-references | 9,737,868 | 1 | false | 0 | 1 | I would write a python wrapper over the C++ module and dispatch to python observers in the python wrapper. Would that be enough?
When you mention that something needs to have a shared pointer, would it be enough if that shared pointer is on the stack until given observer returns? | 1 | 4 | 0 | I have some C++ code that delivers events to Python objects. Observers are kept as weak_ptrs, so they don't have to deregister.
This works in C++, but bridging weak pointers and Python weak references is troublesome (I also want Python event handlers not being kept alive by subscriptions, same as in C++ code). In order... | Track the lifetime of a CPython object from C extension | 0 | 0 | 0 | 107 |
9,577,614 | 2012-03-06T03:44:00.000 | 0 | 0 | 0 | 0 | python,django,web,dreamhost,domain-name | 9,588,891 | 1 | true | 1 | 0 | The problem waas that it was executing the old instance of webapp (that didn't use sites module) So i have resolved with pkill python command. | 1 | 0 | 0 | In my view i execute Site.objects.get_current().domain but the result is empty string.
So, how can i get the domain name to compose right url?
Hosting is dreamhost. | dreamhost+django: cannot get domain name using site framework | 1.2 | 0 | 0 | 152 |
9,578,245 | 2012-03-06T05:14:00.000 | 2 | 0 | 0 | 1 | python,tornado | 9,578,432 | 3 | false | 0 | 0 | I don't know why it takes so long to exit with Ctrl+C, but it worked for me in some cases to press Ctrl+\ (Linux terminal) | 1 | 3 | 0 | When developing a Tornado application, I frequently want to restart the server to pick up new changes. I hit ctrl-c to stop the server, but with Tornado, this seems to be very slow. It waits for many seconds before shutting down, or doesn't shut down at all when issued a ctrl-c.
What's weird, is if, after clicking ctrl... | Why does Tornado take so long to die when I hit ctrl-c? | 0.132549 | 0 | 0 | 1,548 |
9,582,478 | 2012-03-06T11:11:00.000 | 5 | 0 | 1 | 0 | python,import,module,readability | 9,582,510 | 2 | true | 0 | 0 | Yes, this is why from <module> import * is considered bad style. What you can do is remove these * imports one by one, then check which NameErrors you get and solve them one by one by explicit imports. | 1 | 2 | 0 | Suppose I read code written by someone else where "from import *" is used, how can I determine what module a function is from? Is this the reason why some people frown upon "from import *"? | How do I read code where "from import *" is used? | 1.2 | 0 | 0 | 1,059 |
9,588,971 | 2012-03-06T17:38:00.000 | 2 | 0 | 0 | 0 | python,neo4j | 9,589,303 | 1 | true | 0 | 0 | Yes, you should handle custom IDs using an exact matching index. Neo4j owns its IDs and will generate them for you. The only time you can set them is when you are using the BatchInserter, I don't think the Python bindings are supporting that one yet, though. | 1 | 2 | 0 | Is it possible somehow? If not, what is the recommended way to deal with custom ids. Should I create an index with my custom ids?
Is there any Python client for Neo4j that handles this case? | Specifying the id when creating a node with the official Python embedded bindings for Neo4j | 1.2 | 0 | 0 | 124 |
9,591,434 | 2012-03-06T20:35:00.000 | 2 | 0 | 1 | 0 | python,python-2.7 | 9,591,598 | 5 | false | 0 | 0 | vars(obj) returns obj.__dict__
so
vars(self).update(vars(obj)) works too | 2 | 1 | 0 | bit of an odd question here. If I have two separate objects, each with their own variables and functions, is there any way those two objects can be combined into one single object?
To be more specific: I have an object with 15 variables in it and then I have my self object. I want to load those variables into self. Is ... | Python: Fusing two separate objects into one? | 0.07983 | 0 | 0 | 166 |
9,591,434 | 2012-03-06T20:35:00.000 | 0 | 0 | 1 | 0 | python,python-2.7 | 9,591,552 | 5 | false | 0 | 0 | the quick-but-ugly (and unsafe) way of copying members from another object at once:
self.__dict__.update(otherobj.__dict__)
this will not copy methods and static (class) members however. | 2 | 1 | 0 | bit of an odd question here. If I have two separate objects, each with their own variables and functions, is there any way those two objects can be combined into one single object?
To be more specific: I have an object with 15 variables in it and then I have my self object. I want to load those variables into self. Is ... | Python: Fusing two separate objects into one? | 0 | 0 | 0 | 166 |
9,592,083 | 2012-03-06T21:18:00.000 | 0 | 0 | 0 | 1 | python,shell,upload,ftp | 9,592,357 | 1 | false | 0 | 0 | I would pick a different FTP client. The libcurl library (and its "curl" command line program) has a FTP upload method. | 1 | 0 | 0 | If there is a thread that answers this question I'm sorry for being a fool (reading through the titles and the threads that look like they might have been [about] the same as mine, none of them were close enough for me to be able to figure it out for myself.
I'm looking to have a script (I suppose bash or python would ... | One Command/Script to Upload X Files Using FTP | 0 | 0 | 0 | 313 |
9,592,389 | 2012-03-06T21:42:00.000 | 0 | 0 | 1 | 0 | python,opencv,virtualenv,vision | 53,613,660 | 4 | false | 0 | 0 | This is possible by passing the python executable as an argument to cmake. I would also suggest then to use a local install folder, so you don't need sudo at all. And then, if make install doesn't ask you for sudo permissions, it is probably targetting your virtualenv python .
Open cmakelists.txt with cmake-gui to see ... | 2 | 32 | 0 | I would like to keep everything contained within the virtualenv. Is this possible with OpenCV? I'm fine with building from scratch, do I just need to setup the virtualenv first then use special compile flags to tell it where to install to? | Is it possible to run opencv (python binding) from a virtualenv? | 0 | 0 | 0 | 20,952 |
9,592,389 | 2012-03-06T21:42:00.000 | 5 | 0 | 1 | 0 | python,opencv,virtualenv,vision | 38,141,595 | 4 | false | 0 | 0 | On Debian, I apt installed python-opencv, python-virtualenv, python-pip and then created a virtualenv using the option --system-site-packages. | 2 | 32 | 0 | I would like to keep everything contained within the virtualenv. Is this possible with OpenCV? I'm fine with building from scratch, do I just need to setup the virtualenv first then use special compile flags to tell it where to install to? | Is it possible to run opencv (python binding) from a virtualenv? | 0.244919 | 0 | 0 | 20,952 |
9,593,659 | 2012-03-06T23:39:00.000 | 2 | 0 | 0 | 0 | python,google-app-engine,cookies,oauth | 9,596,143 | 2 | false | 1 | 0 | Can you use OAUth to authenticate with Google, then use the OAuth token to ensure the messages are legitimate? | 1 | 0 | 0 | I have an app which amounts to a Python script, running on the user's phone, and a JS client, running in the user's browser. The Python script sends messages to App Engine as HTTP requests. The server then pushes the messages to the JS client.
The problem is authentication: The server can easily use Google Accounts to ... | Need to send a HTTP request in Python that'll authenticate with Google Accounts | 0.197375 | 0 | 1 | 425 |
9,594,369 | 2012-03-07T01:05:00.000 | 0 | 0 | 0 | 1 | python,bash,sudo,pythonpath | 9,594,398 | 3 | false | 0 | 0 | It uses the first one found in $PATH
try doing
echo $PATH
then
sudo bash -c 'echo $PATH'
I bet these are different.
In any case, there is usually an rc script of some sort for the shell you use in both /root and your current user, just rearrange the paths in the environment variable for the one you want. | 1 | 2 | 0 | My problem is that when I do :
$ which python
=> I get /a/b/c/python as my directory
but if I do
$ sudo which python
=> I get /d/e/python as the result
How do I change the sudo one to match with the normal case, it is making it impossible to install libraries from source. | How to change a python path in sudo state? | 0 | 0 | 0 | 2,960 |
9,595,076 | 2012-03-07T02:39:00.000 | 0 | 1 | 0 | 0 | python,notifications,push-notification,server-push | 9,595,261 | 2 | false | 1 | 0 | Maybe have a look at www.pubnub.com .. its commercial, but lets you send 5 million messages a month for free. Essentially it lets you create a named channel, and have X number of clients connect to it and send messages back and forth.
Using one of these services would of course require you to write a client to distrib... | 1 | 0 | 0 | I hope you guys can spare a moment with some ideas on how to develop my idea.
I have an Asterisk-based telephone switch . When an incoming call is arriving, I can make sure the server runs an external script of any language.
Here comes my development work. I would like to notify a group of listening clients about the c... | Cross Platform Event Notification | 0 | 0 | 0 | 335 |
9,595,494 | 2012-03-07T03:43:00.000 | 4 | 0 | 0 | 0 | python,tags,cluster-analysis,data-mining,k-means | 9,597,117 | 4 | false | 0 | 0 | Since the data you have is binary and sparse (in particular, not all users have tagged all documents, right)? So I'm not at all convinced that k-means is the proper way to do this.
Anyway, if you want to give k-means a try, have a look at the variants such as k-medians (which won't allow "half-tagging") and convex/sphe... | 1 | 3 | 1 | I have a document d1 consisting of lines of form user_id tag_id.
There is another document d2 consisting of tag_id tag_name
I need to generate clusters of users with similar tagging behaviour.
I want to try this with k-means algorithm in python.
I am completely new to this and cant figure out how to start on this.
Can ... | Clustering using k-means in python | 0.197375 | 0 | 0 | 2,252 |
9,595,497 | 2012-03-07T03:43:00.000 | 0 | 0 | 0 | 0 | python,django | 9,595,612 | 3 | false | 1 | 0 | You can pass a url parameter back to your login page and use that to direct the user once they complete the login successfully. | 1 | 1 | 0 | So currently I'm using @login_required to block certain pages from users and redirect them, telling them they need to log in. but what I can't understand is how do I "let them" go to the page they were trying to go to once they log in. Currently I'm just using a typical render_to_response('with a certain view') but wha... | How do I redirect an user back to the page they were trying to access once they log in? (Django) | 0 | 0 | 0 | 135 |
9,596,975 | 2012-03-07T06:48:00.000 | 4 | 0 | 0 | 0 | python,django | 9,677,080 | 2 | true | 1 | 0 | Roam's answer pointed me in the right direction, but it wasn't a complete answer.
The real answer to this is that you can't normally send html emails with django-mailer. It might be possible to hack django-mailer or work around it in someother way - but I haven't yet heard of any way of doing that.
The better alternat... | 1 | 1 | 0 | I am developing a site using Django and Python.
I am using django-mailer to send out a newsletter to registered subscribers. It can do text emails ok, but passing html into the send_mail function doesn't have the desired result.
Is it possible to use django-mailer to send html or otherwise is there a way I can adjust/... | Is there a way to send html emails with django-mailer? | 1.2 | 0 | 0 | 1,554 |
9,598,739 | 2012-03-07T09:26:00.000 | 4 | 0 | 1 | 0 | python,cygwin | 9,599,181 | 3 | true | 0 | 0 | The fast way is to reorder your $PATH so that 2.5 is picked up first.
The correct way is to use virtualenv to create a jail environment that's specific to a python version. | 1 | 6 | 0 | I have two versions of python installed on Win7. (Python 2.5 and Python 2.7).
These are located in 'C:/Python25' and 'C:/Python27' respectively.
I am trying to run a file using Python 2.5 but by default Cygwin picks up 2.7.
How do I change which version Cygwin uses? | How to change version of Python picked up by Cygwin | 1.2 | 0 | 0 | 11,037 |
9,602,691 | 2012-03-07T13:48:00.000 | 1 | 0 | 1 | 1 | python,py2exe | 9,602,835 | 1 | true | 0 | 0 | There is an option to compress, which you can enable in the config file, but it will always be relatively large (~megabytes) because python interpreter must also be bundled in with the source code. | 1 | 1 | 0 | Are there some practices to minimize the size of .exe file created by py2exe when creating executable of python script? My first impression upon using py2exe is, it creates relatively large size file. | Reducing the size of executable from py2exe | 1.2 | 0 | 0 | 794 |
9,603,841 | 2012-03-07T15:02:00.000 | 3 | 0 | 1 | 0 | python,django,json,security | 9,604,106 | 2 | false | 1 | 0 | I'm having trouble working out what you think could be insecure (or secure) about JSON.
JSON is a text-based data exchange format. It doesn't have any security built-in. Django comes with some functions to serialize and deserialize querysets to JSON. But these can't be "malicious" or "insecure" - they're just data.
Som... | 1 | 12 | 0 | Are there any known security vulnerabilities with Django's JSON deserializer? Regarding Python deserializing protocols, the general concensus seems to be they're completely insecure, so avoid parsing untrusted data.
However, I'm considering a distributed web application where different servers exchange model records, f... | Django JSON De-serialization Security | 0.291313 | 0 | 0 | 2,992 |
9,604,943 | 2012-03-07T16:03:00.000 | 61 | 0 | 1 | 0 | python,project,pycharm | 9,605,030 | 4 | true | 0 | 0 | Copy the files to some directory under the project root using your favorite file manager or add the directory containing your files to the project using Settings (Preferences on Mac) | Project Structure | Add Content Root. | 4 | 63 | 0 | How do I import/add an existing Python file to a PyCharm project? | How do I import/add an existing Python file to a PyCharm project? | 1.2 | 0 | 0 | 72,629 |
9,604,943 | 2012-03-07T16:03:00.000 | 29 | 0 | 1 | 0 | python,project,pycharm | 9,605,018 | 4 | false | 0 | 0 | I'm not sure if I get what you want, but there's way you can add existing source into project:
File -> Settings -> Project structure -> Add Content root -> choose folder with existing code | 4 | 63 | 0 | How do I import/add an existing Python file to a PyCharm project? | How do I import/add an existing Python file to a PyCharm project? | 1 | 0 | 0 | 72,629 |
9,604,943 | 2012-03-07T16:03:00.000 | 1 | 0 | 1 | 0 | python,project,pycharm | 50,427,857 | 4 | false | 0 | 0 | I hacked this way - copy files into another folder, create new files with the same names using IDE, and replace the new files with the copied versions. It does the trick.
P.S. I grepped .idea folder and found no project file like CMakeLists.txt to edit manually. There are numerous entries in the .idea/workspace.xml fil... | 4 | 63 | 0 | How do I import/add an existing Python file to a PyCharm project? | How do I import/add an existing Python file to a PyCharm project? | 0.049958 | 0 | 0 | 72,629 |
9,604,943 | 2012-03-07T16:03:00.000 | 2 | 0 | 1 | 0 | python,project,pycharm | 54,169,584 | 4 | false | 0 | 0 | For PyCharm 2017 (v.2017.2.3), it's slightly different.
You still need to copy the files you want to add to a directory under the project's own root directory, but they don't appear in the Project navigation window in PyCharm immediately.
To correct this, click on the Project's name in the Navigation window to collapse... | 4 | 63 | 0 | How do I import/add an existing Python file to a PyCharm project? | How do I import/add an existing Python file to a PyCharm project? | 0.099668 | 0 | 0 | 72,629 |
9,605,759 | 2012-03-07T16:50:00.000 | 1 | 0 | 0 | 1 | python,django,apache,process | 9,608,216 | 1 | true | 1 | 0 | Another alternative could be to use something like mod_wsgi in daemon mode configured with only one process, then hand off to that.
This is all assuming that your web server only ever needs to be single process, and that no other request should be served in parallel? Do you have other views which aren't rate limited? I... | 1 | 0 | 0 | I need to make apache mpm worker use only a single process to run my django server .
I have a view which needs to be run only once when the first request hits the apache . But i see it running twice. I made the runprocess configuration from 2 to 1 .
what else should i do to make apache run only one process.. | apache mpm worker run only single process | 1.2 | 0 | 0 | 452 |
9,606,937 | 2012-03-07T18:16:00.000 | 3 | 0 | 1 | 1 | python,daemon | 9,611,336 | 2 | false | 0 | 0 | Exceptions are designed for the purpose of (potentially) not being caught immediately-- that's how they differ from when a function returns a value that means "error". Each exception can be caught at the level where you want to (and can) do something about it.
At a minimum, you could start by catching all exceptions a... | 2 | 2 | 0 | I've been doing amateur coding in Python for a while now and feel quite comfortable with it. Recently though I've been writing my first Daemon and am trying to come to terms with how my programs should flow.
With my past programs, exceptions could be handled by simply aborting the program, perhaps after some minor clea... | Python Daemons - Program Structure and Exception Control | 0.291313 | 0 | 0 | 476 |
9,606,937 | 2012-03-07T18:16:00.000 | 0 | 0 | 1 | 1 | python,daemon | 9,610,525 | 2 | false | 0 | 0 | The answer will be "it depends".
If an exception occurs in some low-level function, it may be appropriate to catch it there if there is enough information available at this level to let the function complete successfully in spite of the exception. E.g. when reading triangles from an .stl file, the normal vector of the ... | 2 | 2 | 0 | I've been doing amateur coding in Python for a while now and feel quite comfortable with it. Recently though I've been writing my first Daemon and am trying to come to terms with how my programs should flow.
With my past programs, exceptions could be handled by simply aborting the program, perhaps after some minor clea... | Python Daemons - Program Structure and Exception Control | 0 | 0 | 0 | 476 |
9,606,942 | 2012-03-07T18:17:00.000 | 3 | 0 | 1 | 0 | python,ruby,linux,node.js,haskell | 9,607,629 | 3 | false | 0 | 0 | MATLAB.
GNU Octave is the free sorta-clone. | 1 | 8 | 0 | I need to take an audio signal, and extract overlapping audio frames from it. I then need to convert these to frequency data (FFT stuff / like a spectrogram) and analyze the frequency information.
For example, if I have a 1 minute mp3 file, I want split the file into smaller files, from 00:00.000 to 00:03.000, from 00... | Good sound libraries? | 0.197375 | 0 | 1 | 439 |
9,607,565 | 2012-03-07T19:10:00.000 | 13 | 0 | 1 | 0 | python,virtualenv,setuptools,distribute | 21,003,259 | 2 | true | 0 | 0 | By design, you can't make the tests_requires or the setup_requires entries go into the virtual environment. The idea is to separate what is required for performing tests/setup and what is required to actually use the package being installed. For example, I may require that the "coverage" module be needed for running te... | 1 | 33 | 0 | In a crusade to make my application pip-installable, I'm fighting big fights with setuptools and distribute. I assume my dependencies are correct, i.e. installing with pip install myapp should probably fill the virtual environment correctly. However, I'd like to streamline development while I'm at it, so my goal is to ... | How do I force `setup.py test` to install dependencies into my `virtualenv`? | 1.2 | 0 | 0 | 11,234 |
9,607,711 | 2012-03-07T19:21:00.000 | 0 | 0 | 0 | 0 | python,mysql | 9,607,771 | 1 | true | 0 | 0 | Add a TIMESTAMP column and select rows with a newer timestamp than the latest processed. | 1 | 0 | 0 | I have a table address. This table is constantly getting new row inserts, appox 1 row per second. Lets called it process1.
In parallel, I need to iterate over SELECT * from address results inserted till now via process1. This is Process2. It should wait for Process1 to insert new rows if it reaches the end, ie, there a... | python dynamically select rows from mysql | 1.2 | 1 | 0 | 112 |
9,610,192 | 2012-03-07T22:34:00.000 | 0 | 0 | 1 | 0 | c++,python,algorithm | 9,610,263 | 3 | false | 0 | 0 | I would simply filter your list for all players withthe attributes you want and then loop over the filtered list for all of the combinations.
given your constraints you should be able to use a simple (if deep) nested loop. | 1 | 3 | 0 | I've started a little side project to try to learn a few new concepts (hopefully in C++ or Python) and I was just hoping for a little help with the start of my idea.
*This is all related to a bigger fantasy basketball project, but I have to start somewhere.
I want to 100 variables (players) and find every combination o... | 100 choose 10, with extra condition | 0 | 0 | 0 | 393 |
9,610,221 | 2012-03-07T22:37:00.000 | 0 | 1 | 0 | 0 | python,email,carriage-return,smtplib | 9,610,703 | 1 | true | 0 | 0 | Email servers are free to change line endings IIRC. They could be various platforms.
If you are transmitting an attachment, use a suitable encoding such as Base64. | 1 | 0 | 0 | I am using smtplib sendmail and \n (line feed) is being added where there was just \r (carriage return).
This corrupts the file for use with the UNIX tnef utility. How can I keep the line feed from being added?
Thanks | Python's smtplib sendmail is inserting line feed | 1.2 | 0 | 0 | 433 |
9,610,306 | 2012-03-07T22:46:00.000 | 1 | 0 | 1 | 0 | python,string | 9,610,432 | 7 | false | 0 | 0 | This is language agnostic approach that aims at higher efficiency:
find first digit in the string and save its position p0
find last digit in the string and save its position p1
extract substring from 0 to p0-1 into beginning
extract substring from p0 to p1 into middle
extract substring from p1+1 to length-1 into end | 1 | 0 | 0 | Say I have three strings:
abc534loif
tvd645kgjf
tv96fjbd_gfgf
and three lists:
beginning captures just the first part of the string "the name"
middle captures just the number
end contains only the rest of the characters that are after the number portion
How do I accomplish this in the most efficent way? | How do I extract certain parts of strings in Python? | 0.028564 | 0 | 0 | 1,778 |
9,611,746 | 2012-03-08T01:31:00.000 | 1 | 0 | 1 | 0 | python,numpy,scipy,jython,linear-algebra | 9,646,517 | 1 | true | 0 | 0 | As suggested by @talonmies' comment, the real answer to this is 'find an equivalent Java package.' | 1 | 1 | 1 | I have to solve linear equations system using Jython, so I can't use Num(Sci)Py for this purpose. What are the good alternatives? | Solve linear system in Python without NumPy | 1.2 | 0 | 0 | 2,868 |
9,612,037 | 2012-03-08T02:16:00.000 | 0 | 0 | 0 | 0 | python,types | 9,612,077 | 2 | false | 0 | 0 | What function specifically are you asking for the return type? urllib2.urlopen? To get the size of an object, use sys.getsizeof or if it's a string, use len(str) to get it's size. | 2 | 1 | 0 | I'm reading data from local and from remote (urllib2) files in a Python script.
What is the return datatype?
How can I get the size of this data? ("real" size, not the size of representation in Python, in case that differs). | python: get size of buffer | 0 | 0 | 0 | 12,777 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.