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,694,967 | 2012-03-14T02:05:00.000 | 4 | 0 | 0 | 0 | python,database,sqlite,indexing,bigdata | 9,695,095 | 3 | true | 0 | 0 | sqlite3 is too slow, and I need something more heavyweight
First, sqlite3 is fast, sometime faster than MySQL
Second, you have to use index, put a compound index in (date1, date2, name) will speed thing up significantly | 1 | 2 | 0 | I have a spreadsheet with about 1.7m lines, totalling 1 GB, and need to perform various queries on it. Being most comfortable with Python, my first approach was to hack together a bunch of dictionaries keyed in a way that would facilitate the queries I was trying to make. E.g. if I needed to be able to access everyone ... | Querying (pretty) big relational data in Python in a reasonable amount of time? | 1.2 | 1 | 0 | 572 |
9,695,320 | 2012-03-14T02:59:00.000 | 4 | 0 | 0 | 1 | python,google-app-engine | 9,696,354 | 2 | false | 0 | 0 | Wrap appcfg.py in a shell script. Before actually running appcfg.py update, save the current time, possibly adjusting for your time zone, if necessary, in a file that's marked as a resource. You can open and read that file from the deployed app.
Alternatively, have that script substitute the current time directly into ... | 1 | 3 | 0 | I need to know a value holding timestamp when my app was deployed on the GAE server. In runtime.
Surely I could generate some Python constant in the deployment script. But is there an easier and more correct way to reach the goal?
(I'd like not to use data store for that.) | How do I know timestamp when my Python app was deployed on GAE? | 0.379949 | 0 | 0 | 266 |
9,695,924 | 2012-03-14T04:25:00.000 | 3 | 0 | 1 | 0 | python | 9,695,974 | 1 | true | 0 | 0 | In 2.x, there is no difference; str is a sequence of bytes.
In 3.x, A byte string is identified by a byte literal, b'...'; it can be gotten from a string by encoding it to a specific charset, and it is the default type for most I/O operations. | 1 | 0 | 0 | What's the difference between a string and a byte string?
When is it appropriate to use a byte string instead of a string?
More specifically, if I download an image or another binary file from the web, why do I need to convert it to a byte string before I can save it? | String vs Byte string | 1.2 | 0 | 0 | 184 |
9,696,294 | 2012-03-14T05:13:00.000 | 0 | 0 | 0 | 0 | python,django,ftp,web-hosting | 9,698,149 | 3 | false | 1 | 0 | There are different tools for FTP and SSH file transfer. Which one is best for you depends on your environment (e.g. operating system) and your needs (do you want a graphical or command line interface?). But basically it's always a program you run on your machine that connects to a server to upload files. You don't do ... | 1 | 0 | 0 | I'm in the midst of trying to get my first website up and running all of the sudden I get to the point where I need to get my file online and I have zero idea on how to do that. I thought it would be as easy as selecting your files and clicking upload but so far it has not been that easy. Currently I'm using djangoeuro... | Beginner advice on how to use FTP or SSH? (django) | 0 | 0 | 0 | 676 |
9,698,557 | 2012-03-14T08:54:00.000 | 0 | 0 | 0 | 0 | python,authentication,proxy,pip | 65,307,484 | 11 | false | 0 | 0 | For me, the issue was being inside a conda environment. Most likely it used the pip command from the conda environment ("where pip" pointed to the conda environment). Setting proxy-settings via --proxy or set http_proxy did not help.
Instead, simply opening a new CMD and doing "pip install " there, helped. | 1 | 99 | 0 | My computer is running windows behind a proxy on a windows server (using active directory), and I can't figure out how to get through it with pip (in python3). I have tried using --proxy, but it still just timeouts. I have also tried setting a long timeout (60s), but that made no difference. My proxy settings are co... | How to use pip on windows behind an authenticating proxy | 0 | 0 | 0 | 241,528 |
9,700,623 | 2012-03-14T11:00:00.000 | 0 | 0 | 0 | 0 | python,build,titanium,titanium-mobile,appcelerator-mobile | 9,706,293 | 1 | false | 1 | 1 | Ajeet, I believe you can create a directory for android and iphone inside the resources folder that you can keep your platform-specific code/assets in. I think the compiler recognizes this. | 1 | 1 | 0 | I am building a Titanium mobile project.
I have some folders with some .JS files in the Resources folder. The problem I ran into is that I need to exclude some of the folder while building for iphone but those folder are needed in my android build.
I looked into the python files in the SDK folder and found out that the... | Avoid folders in Resources folder from being build or compile | 0 | 0 | 0 | 332 |
9,700,942 | 2012-03-14T11:21:00.000 | 4 | 0 | 0 | 0 | python,plone | 9,704,631 | 1 | false | 1 | 0 | You can change the workflow used for File objects, or indeed copy the File type in portal_types to a a new Drawing type and change the workflow for that new type if you want to treat them differently to standard files in your CMS. | 1 | 1 | 0 | How can I use Plone 4.1.4 to manage autocad drawings with different roles like architect, sr.architect, Project Manager, accounts manager(who manages the user accounts). I would first of all like to know whether Plone can be used to crease a workflow for uploaded autocad drawing files or for uploaded files as such? Dou... | can i use plone workflow to manage autocad related drawings? | 0.664037 | 0 | 0 | 150 |
9,701,682 | 2012-03-14T12:08:00.000 | 3 | 0 | 1 | 0 | python,download,urllib2,fedora | 9,702,345 | 3 | false | 0 | 0 | first, the http server should return Content-Length header. this is usually means the file is a static file, if it is a dynamic file, such as a result of php or jsp, you can not do such split.
then, you can use http Range header when request, this header tell the server which part of file should return. see python doc ... | 1 | 6 | 0 | I'm trying to create a 'Download Manager' for Linux that lets me download one single file using multiple threads. This is what I'm trying to do :
Divide the file to be downloaded into different parts by specifying an offset
Download the different parts into a temporary location
Merge them into a single file.
Steps 2... | Download A Single File Using Multiple Threads | 0.197375 | 0 | 1 | 3,774 |
9,703,511 | 2012-03-14T14:06:00.000 | 5 | 0 | 0 | 0 | python,django,django-orm,django-q | 9,703,606 | 3 | true | 1 | 0 | No, but you could create the Q object first, and use that; alternatively, create your query as a dict, and pass that to your filter method and the Q object. | 1 | 8 | 0 | I have a Django QuerySet, and I want to get a Q object out of it. (i.e. that holds the exact same query as that queryset.)
Is that possible? And if so, how? | Django: Extracting a `Q` object from a `QuerySet` | 1.2 | 0 | 0 | 1,110 |
9,705,201 | 2012-03-14T15:45:00.000 | 2 | 0 | 0 | 0 | wxpython,mouseevent,proximity,shaped-window | 9,716,353 | 2 | false | 0 | 1 | I don't think it can be done that easily if the mouse is outside the main frame. That said, you can always do the following:
1) Start a timer in your main frame and poll it every 50 milliseconds (or whatever suits you);
2) Once you poll it in your OnTimer event handler, check the mouse position via wx.GetMousePosition(... | 1 | 4 | 0 | In Python using wxPython, how can I set the transparency and size of a window based on the proximity of the mouse relative to the application's window, or frame?
Eg. similar to a hyperbolic zoom, or The Dock in MAC OS X? I am trying to achieve this effect with a png with transparency and a shaped window.
Any librarie... | Capturing mouse events outside wx.Frame in Python | 0.197375 | 0 | 0 | 2,043 |
9,705,852 | 2012-03-14T16:21:00.000 | 2 | 0 | 0 | 0 | javascript,python,django,django-templates | 9,705,930 | 3 | false | 1 | 0 | This depends a lot on what you are trying to do. If the chart is dynamic and animated, doing it client side with js may be the only choice. It also depends on how much data you have. I would not recommend doing it in js if you have over 10mb of raw data. | 2 | 4 | 0 | In general is it better for performance to do lots of data calculations on the server side or on the javascript side?
I have a bunch of data that i'm displaying on a page - and I'm wondering if I should format/ parse/ make calculations on that data on the server side (in python) and return a template or if I should re... | Server side or Javascript calculations? | 0.132549 | 0 | 0 | 1,820 |
9,705,852 | 2012-03-14T16:21:00.000 | 1 | 0 | 0 | 0 | javascript,python,django,django-templates | 9,708,096 | 3 | false | 1 | 0 | In addition to the facts stated by thedk, you should also keep in mind that calculations you do on client side are more likely to fail because the client may not fulfill certain preconditions. Think of disabled JavaScript or an unreliable internet connection. You generally have no control over your data as soon as it h... | 2 | 4 | 0 | In general is it better for performance to do lots of data calculations on the server side or on the javascript side?
I have a bunch of data that i'm displaying on a page - and I'm wondering if I should format/ parse/ make calculations on that data on the server side (in python) and return a template or if I should re... | Server side or Javascript calculations? | 0.066568 | 0 | 0 | 1,820 |
9,707,816 | 2012-03-14T18:22:00.000 | 1 | 1 | 0 | 0 | python,django | 9,707,962 | 1 | true | 1 | 0 | The filesystem cache in Django works like any of the other caches, when the timeout value expires, the cache is "invalidated". In the case of files, that means it will be deleted/overwritten.
If you want long-term storage, you need to use a a long-term storage solution (Django's cache framework is specifically not a lo... | 1 | 0 | 0 | I'm using Django to power a site where I pull in tweets from twitter timelines for use (for about 50 different people). I want to keep a large dictionary of all the tweets in a cache so I don't have to poll twitter every page-refresh. Right now I have it so when it retrieves tweets (30) from twitter, it saves it in the... | Do files with filesystem caching in Django delete after timeout? | 1.2 | 0 | 0 | 970 |
9,709,513 | 2012-03-14T20:10:00.000 | 6 | 1 | 1 | 0 | c++,python,algorithm,optimization,scipy | 9,709,955 | 3 | true | 0 | 0 | Often the choice between double and float is made more on space demands than speed. Modern processors are capable of operating on double quite fast.
Floats may be faster than doubles when using SIMD instructions (such as SSE) which can operate on multiple values at a time. Also if the operations are faster than the mem... | 2 | 7 | 0 | I am reading through code for optimization routines (Nelder Mead, SQP...). Languages are C++, Python. I observe that often conversion from double to float is performed, or methods are duplicated with double resp. float arguments. Why is it profitable in optimization routines code, and is it significant? In my own code ... | Double or float - optimization routines | 1.2 | 0 | 0 | 958 |
9,709,513 | 2012-03-14T20:10:00.000 | 2 | 1 | 1 | 0 | c++,python,algorithm,optimization,scipy | 9,710,279 | 3 | false | 0 | 0 | Other times that I've come across the need to consider the choice between double and float types in terms of optimisation include:
Networking. Sending double precision data across a socket connection
will obviously require more time than sending half that amount of
data.
Mobile and embedded processors may only be able... | 2 | 7 | 0 | I am reading through code for optimization routines (Nelder Mead, SQP...). Languages are C++, Python. I observe that often conversion from double to float is performed, or methods are duplicated with double resp. float arguments. Why is it profitable in optimization routines code, and is it significant? In my own code ... | Double or float - optimization routines | 0.132549 | 0 | 0 | 958 |
9,710,914 | 2012-03-14T21:58:00.000 | 0 | 0 | 0 | 0 | python,sockets,socketserver | 9,711,006 | 1 | true | 0 | 0 | socket is the low-level interface which SocketServer (as well as other networking code) is based off of. I'd start out learning it, whether you plan to use it directly or not, just so that you know what you're working with.
Also, SocketServer is of no use if you're writing client code. :) | 1 | 0 | 0 | I've read that socketserver is easier to use, but for someone who is just learning about sockets, which would be quicker and more beginner-friendly, socket or socketserver? For a very basic client/server setup using stream sockets. (Python) | Which is better to use for the server of a basic server/client socket implementation, "socket" or "socketserver"? | 1.2 | 0 | 1 | 72 |
9,711,561 | 2012-03-14T22:56:00.000 | 3 | 0 | 0 | 0 | python,youtube,gdata | 9,714,978 | 1 | true | 0 | 0 | Short answer: Not possible.
Long answer: Videos are just data files. So the question becomes: is it possible for a program on Computer A to tell Server B to send a file to Server C using standard internet communication? YouTube only accepts POST requests for uploading videos, so Server B would need to send this requ... | 1 | 1 | 0 | Is it possible to upload a video on youtube with a remote URL (not from the local machine). I am using Youtube API and python gdata tools for this.
I don't have the videos on the server where the script will run, and I want to upload them directly to youtube from a remote URL, instead of downloading them first... Do yo... | Upload video to youtube via URL with python gdata | 1.2 | 0 | 1 | 1,998 |
9,712,898 | 2012-03-15T01:44:00.000 | 2 | 1 | 0 | 0 | java,php,javascript,c++,python | 9,712,935 | 2 | true | 0 | 0 | It is possible to raise the limits in Apache and PHP to handle files of this size. The basic HTTP upload mechanism does not offer progressive information, however, so I would usually consider this acceptable only for LAN-type connections.
The normal alternative is to locate a Flash or Javascript uploader widget. These ... | 1 | 4 | 0 | I have a problem I've been dealing with lately. My application asks its users to upload videos, to be shared with a private community. They are teaching videos, which are not always optimized for web quality to start with. The problem is, many of the videos are huge, way over the 50 megs I've seen in another questio... | Uploading huge files with PHP or any other language? | 1.2 | 0 | 1 | 200 |
9,713,908 | 2012-03-15T04:16:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 9,715,283 | 2 | false | 0 | 0 | Though I agree with suggestions in comment, I think I have a better solution to your problem (Hopefully :))
Although it's not necessary you can use pull queue in your application, to facilitate design of your problem. The pattern I am suggesting is like this:
1) A servlet centrally handles execution (Let's call it cont... | 1 | 0 | 0 | Hi um struggling with a problem . I created number of crons and i and i want to run them one after another in a specific order . Lets say i have A , B , C and D crons and want to Run Cron B after Completion of Cron A and after that want to run Cron D and after that cron C. I searched for a way to accomplish this task b... | Google app engine how to schedule Crons one after another | 0.099668 | 0 | 0 | 112 |
9,714,161 | 2012-03-15T04:50:00.000 | 4 | 0 | 1 | 0 | python,coding-style,formatting | 9,714,174 | 3 | false | 0 | 0 | It means you shouldn't do things like a = f ( 1 ) or l = [ 2, 3 ]. | 1 | 1 | 0 | Python tutorial says "Use spaces around operators and after commas, but not directly inside bracketing constructs: a = f(1, 2) + g(3, 4)." What does "not directly inside bracketing constructs" exactly mean? | Spaces in Python coding style | 0.26052 | 0 | 0 | 3,381 |
9,714,877 | 2012-03-15T06:21:00.000 | 5 | 0 | 0 | 0 | php,python,json,zend-framework,serialization | 9,716,132 | 3 | true | 1 | 0 | Use JSON for data serialization. It's clean, simple, compact, widely supported, and understands data types. Use SOAP only if you like pain. It is a bloated sack of cruft built upon another bloated sack of cruft. | 3 | 1 | 0 | I am doing a car rental software, in which a front end back end are there, where the back end will do the accounting part. I have to send some data like customer name, amount, currency etc. to account engine to prepare the ledgers. I am confused whether to use json or soap for information exchange between front and bac... | Either json or Soap to exchange data in my project? | 1.2 | 0 | 1 | 181 |
9,714,877 | 2012-03-15T06:21:00.000 | 3 | 0 | 0 | 0 | php,python,json,zend-framework,serialization | 9,720,556 | 3 | false | 1 | 0 | Use JSON.
My argument is that JSON maps directly to and from native data types in common scripting languages.
If you use Python, then None <-> null, True <-> true, False <-> false, int/float <-> Number, str/unicode <-> String, list <-> Array and dict <-> Object. You feel right at home with JSON.
If you use PHP, there s... | 3 | 1 | 0 | I am doing a car rental software, in which a front end back end are there, where the back end will do the accounting part. I have to send some data like customer name, amount, currency etc. to account engine to prepare the ledgers. I am confused whether to use json or soap for information exchange between front and bac... | Either json or Soap to exchange data in my project? | 0.197375 | 0 | 1 | 181 |
9,714,877 | 2012-03-15T06:21:00.000 | 0 | 0 | 0 | 0 | php,python,json,zend-framework,serialization | 9,720,841 | 3 | false | 1 | 0 | Depending on your needs, you could use both. For example, using XML bindings you get the (de)serialization of the data going across the wire for free. That is, if you're going to be POSTing lots of data to your web-service, and want to avoid calling the equivalent of "request.getParameter" for each parameter and buil... | 3 | 1 | 0 | I am doing a car rental software, in which a front end back end are there, where the back end will do the accounting part. I have to send some data like customer name, amount, currency etc. to account engine to prepare the ledgers. I am confused whether to use json or soap for information exchange between front and bac... | Either json or Soap to exchange data in my project? | 0 | 0 | 1 | 181 |
9,715,395 | 2012-03-15T07:19:00.000 | 7 | 0 | 1 | 0 | python,html,vim,ubuntu | 9,715,804 | 1 | true | 0 | 0 | That's what compilers scripts are for!
The idea is to put a "compiler script" in your vim's compiler directory. That script is actually a settings file(the difference between script files and settings files in vim is only conceptual - technically they are the same), just like your .vimrc file. That script should contai... | 1 | 3 | 0 | I'm pretty new to Vim and I just set it up so that I can write Python code, with code completion, folding, etc. and am able to compile it also with a shortcut via plug-ins.
The thing is, I would also like to write some HTML/CSS in Vim as well and I'd like to install some similar plug-ins. I know that I could do this a... | Configuring Vim workspaces for programming in multiple languages? | 1.2 | 0 | 0 | 1,189 |
9,715,877 | 2012-03-15T08:03:00.000 | 8 | 0 | 1 | 0 | python,string,encoding,utf | 9,715,989 | 1 | true | 0 | 0 | Python 3 distinguishes between text and binary data. Text is guaranteed to be in Unicode, though no specific encoding is specified, as far as I could see. So it could be UTF-8, or UTF-16, or UTF-32¹ – but you wouldn't even notice.
The main point here is: You shouldn't even care. If you want to deal with text, then use ... | 1 | 5 | 0 | I believe most of you who are familiar with Python have read Dive Into Python 3. In chapter 4.3, it says this:
In Python 3, all strings are sequences of Unicode characters. There is no such thing as a Python string encoded in UTF-8, or a Python string encoded as CP-1252. “Is this string UTF-8?” is an invalid question.... | how strings are stored by python in computers? | 1.2 | 0 | 0 | 3,787 |
9,719,937 | 2012-03-15T12:43:00.000 | 1 | 1 | 0 | 0 | php,python,netbeans,ide | 9,719,988 | 2 | false | 0 | 0 | For first download netbeans for php support, and form plugin manager install python support. | 1 | 0 | 0 | netbean IDE support when downloading PHP bundle version. I also found a download of netbean for python. But How can I let one netbean IDE support both PHP and python? | How to make netbean IDE support both python and php | 0.099668 | 0 | 0 | 400 |
9,720,797 | 2012-03-15T13:35:00.000 | 2 | 0 | 1 | 0 | ipython,matplotlib | 9,722,583 | 1 | true | 0 | 0 | ipython's magic function %who should do the job. | 1 | 3 | 0 | Scenario:
I often work in 'pylab' mode of iPython for interactive data analysis. During these sessions I create many intermittent variables and sometimes I forget what I have called things, especially if an analyis session is running for several days (obviously with interruptions).
Now the problem is, that with the dir... | How to identify/find self-created variables in iPython session? | 1.2 | 0 | 0 | 270 |
9,720,894 | 2012-03-15T13:41:00.000 | 11 | 0 | 0 | 0 | java,python,machine-learning,nltk,mahout | 9,722,329 | 3 | false | 1 | 0 | I think one big thing Java has going for it is Hadoop. If you really mean large scale, you'll want to be able to use something like that. Generally speaking Java has the performance advantage, and more libraries available. So: Java. | 3 | 34 | 0 | I am currently embarking on a project that will involve crawling and processing huge amounts of data (hundreds of gigs), and also mining them for extracting structured data, named entity recognition, deduplication, classification etc.
I'm familiar with ML tools from both Java and the Python world: Lingpipe, Mahout, NL... | Large scale machine learning - Python or Java? | 1 | 0 | 0 | 12,549 |
9,720,894 | 2012-03-15T13:41:00.000 | 5 | 0 | 0 | 0 | java,python,machine-learning,nltk,mahout | 9,735,214 | 3 | false | 1 | 0 | If you are looking at NoSQL databases fit for ML task, then Neo4J is one of the more production ready (relatively) and capable of handling BigData, it is native to JAVA but comes along with a beautiful REST API out of the box and hence can be integrated with the platform of your choice. JAVA will give you an performanc... | 3 | 34 | 0 | I am currently embarking on a project that will involve crawling and processing huge amounts of data (hundreds of gigs), and also mining them for extracting structured data, named entity recognition, deduplication, classification etc.
I'm familiar with ML tools from both Java and the Python world: Lingpipe, Mahout, NL... | Large scale machine learning - Python or Java? | 0.321513 | 0 | 0 | 12,549 |
9,720,894 | 2012-03-15T13:41:00.000 | 18 | 0 | 0 | 0 | java,python,machine-learning,nltk,mahout | 9,723,569 | 3 | true | 1 | 0 | As Apache is going strong producing excellent stuff like Lucene/Solr/Nutch for Search, Mahout for Big Data Machine Learning, Hadoop for Map Reduce, OpenNLP for NLP, lot of NoSQL stuff. The best part is the big "I" which stands for integration and these products can be integrated with each other well as of course in mos... | 3 | 34 | 0 | I am currently embarking on a project that will involve crawling and processing huge amounts of data (hundreds of gigs), and also mining them for extracting structured data, named entity recognition, deduplication, classification etc.
I'm familiar with ML tools from both Java and the Python world: Lingpipe, Mahout, NL... | Large scale machine learning - Python or Java? | 1.2 | 0 | 0 | 12,549 |
9,722,778 | 2012-03-15T15:21:00.000 | 1 | 1 | 0 | 1 | python,unix | 10,034,142 | 1 | true | 0 | 0 | You're asking about something pretty messy here. I suspect that none of this is what you want to do at all, and that you really want to accomplish this some simpler way. However, presuming you really want to mess with process groups...
Generally, a new process group is created only by the setpgrp(2) system call. Otherw... | 1 | 1 | 0 | I'm writing a unittesting framework for servers that uses popen to basically execute "python myserver.py" with shell=False, run some tests, and then proceed to take the server down by killpg.
This myserver.py can and will use multiprocessing to spawn subprocesses of its own. The problem is, from my tests, it seems tha... | Popen-ing a python call that invokes a script using multiprocessing (pgrp issue)? | 1.2 | 0 | 0 | 241 |
9,723,000 | 2012-03-15T15:33:00.000 | 7 | 0 | 1 | 0 | python,parsing,datetime,pandas | 9,739,828 | 1 | true | 0 | 0 | Pass dateutil.parser.parse (or another datetime conversion function) in the converters argument to read_csv | 1 | 6 | 1 | I have a csv file where one of the columns is a date/time string. How do I parse it correctly with pandas? I don't want to make that column the index. Thanks!
Uri | How do I tell pandas to parse a particular column as a datetime object, but not make it an index? | 1.2 | 0 | 0 | 1,378 |
9,723,381 | 2012-03-15T15:53:00.000 | 1 | 0 | 1 | 0 | python,import | 9,723,534 | 3 | false | 0 | 0 | Python has modules that give the code more functionalities. import re gives access to the re module which gives RegEx support. If you type help() at the Python interpreter and then type modules, it will return a list of all the modules. | 1 | 0 | 0 | I keep noticing blocks of code starting with import string, import re or import sys.
I know that you must import a module before you can use it. Is the import based on the object? | import string/re/sys in python | 0.066568 | 0 | 0 | 1,444 |
9,724,539 | 2012-03-15T16:59:00.000 | 0 | 0 | 0 | 0 | python,django | 10,783,975 | 2 | false | 1 | 0 | Think of CBV, more specifically "Generic Class Based Views" as a large tree of Python classes. Starting with the simplest class. Each one subclasses and over rides methods from one another. For example, the ArchiveIndexView is typically the view you will sub-class for the index of your site. It adds an extra context va... | 1 | 0 | 0 | I have a news on my site done with "James Bennett - Practical Django Projects, 2nd Edition (2009)". So I am using a date-based views, which will be deprecated in django-1.4. How can I just convert my views and urls to class-based views ? May be you have seen this, please just post a link, I can't find any working examp... | Can you share an example of using class based view with MonthMixin? | 0 | 0 | 0 | 362 |
9,725,725 | 2012-03-15T18:17:00.000 | 1 | 0 | 0 | 0 | python,.net,xml,xslt,ado.net | 11,595,618 | 1 | true | 0 | 0 | Finally we have used SAXON + XSLT2.0 (saxon called from Perl) and Perl::Twig for the parts we did not know how to program in XSLT | 1 | 1 | 0 | I have 10 XML files containing several Objects.
The XML files define ACTIONS on those objects.
ACTIONS on objects=
MODIFY values
DELETE Object
CREATE Object with values
I need to get the result of those 10 XML files (10 files of actions on those objects).
Any suggestion ?
programming .NET and ADO ?
programming PYTHO... | XML files to be sum up | 1.2 | 0 | 1 | 81 |
9,726,214 | 2012-03-15T18:50:00.000 | 0 | 1 | 1 | 0 | python,testing | 9,726,303 | 2 | false | 0 | 0 | Functional testing. Or regression testing, if that is its purpose. Or code coverage, if you structure your data to cover all code paths. | 1 | 4 | 0 | I have a completely non-interactive python program that takes some command-line options and input files and produces output files. It can be fairly easily tested by choosing simple cases and writing the input and expected output files by hand, then running the program on the input files and comparing output files to t... | Testing full program by comparing output file to reference file: what's it called, and is there a package for it? | 0 | 0 | 0 | 1,131 |
9,726,483 | 2012-03-15T19:09:00.000 | 3 | 0 | 1 | 0 | python,wxpython | 9,726,647 | 2 | false | 0 | 0 | Only the first import executes the file. Subsequent imports copy the reference from sys.modules. | 2 | 2 | 0 | Just for my knowledge, how does python, especially wxpython reacts to multiple imports? If I import wx in multiple files, how does it handle that when called the main frame? Does it slows the speed or it firstly checks whether it is already been imported or not? | Multiple imports of python modules | 0.291313 | 0 | 0 | 111 |
9,726,483 | 2012-03-15T19:09:00.000 | 5 | 0 | 1 | 0 | python,wxpython | 9,726,645 | 2 | true | 0 | 0 | When Python imports a file, it keps track of it by storing it in sys.modules. So whenever Python is importing a file it checks there first and, if it finds it there, returns that instead; if it is not there, it imports it, adds it to sys.modules, and then returns it. | 2 | 2 | 0 | Just for my knowledge, how does python, especially wxpython reacts to multiple imports? If I import wx in multiple files, how does it handle that when called the main frame? Does it slows the speed or it firstly checks whether it is already been imported or not? | Multiple imports of python modules | 1.2 | 0 | 0 | 111 |
9,727,608 | 2012-03-15T20:25:00.000 | 0 | 0 | 0 | 1 | python,bottle | 10,681,349 | 1 | true | 1 | 0 | I actually resolved the issue. The Bottle framework tutorial encourages first-time users to set up the server on a high port (to avoid conflict with apache, etc) for development. I was missing two parts of the process: 1. import the python script so that it can be called from the main bottle file 2. in the main bottle ... | 1 | 1 | 0 | I have written a webapp using traditional cgi. I'm now trying to rewrite it with bottle
The page is simple...the user fills out a form, hits submit and the data object is sent to a python script that used to live in my cgi-bin
The python script generates an image, and prints the url for that image out to standard out
O... | bottle framework: getting requests and routing to work | 1.2 | 0 | 0 | 693 |
9,730,769 | 2012-03-16T01:49:00.000 | 0 | 0 | 0 | 0 | python,wxpython,wxwidgets | 9,742,560 | 1 | false | 1 | 1 | I don't think you are missing anything, this hasn't yet been implemented. Mouse and keyboard events are high on my todo list though, I will update this question when they have been added. | 1 | 2 | 0 | I would like to bind the wx.html2.WebView.New widget with wx.EVT_LEFT_UP however it doesnt work (it doesnt get noticed, nothing happens).
Is there anything i am missing? | Binding a wx.html2.WebView.New Widget? | 0 | 0 | 0 | 419 |
9,731,496 | 2012-03-16T03:36:00.000 | 2 | 0 | 1 | 0 | python,multithreading,matrix,distributed | 9,731,658 | 2 | true | 0 | 0 | You will probably get the best performance if you use one thread for each CPU core available to the machine running your application. You won't get any performance benefit by running more threads than you have processors.
If you are planning to spawn new threads each time you perform a matrix multiplication then ther... | 1 | 2 | 1 | For a class project I am writing a simple matrix multiplier in Python. My professor has asked for it to be threaded. The way I handle this right now is to create a thread for every row and throw the result in another matrix.
What I wanted to know if it would be faster that instead of creating a thread for each row it c... | Creating a thread for each operation or a some threads for various operations? | 1.2 | 0 | 0 | 251 |
9,734,403 | 2012-03-16T09:05:00.000 | 2 | 0 | 0 | 0 | python,machine-learning,scikits,scikit-learn | 9,760,852 | 1 | true | 0 | 0 | You can either use an aggregate confusion matrix or compute one for each CV partition and compute the mean and the standard deviation (or standard error) for each component in the matrix as a measure of the variability.
For the classification report, the code would need to be modified to accept 2 dimensional inputs so ... | 1 | 6 | 1 | I am training a svm classifier with cross validation (stratifiedKfold) using the scikits interfaces. For each test set (of k), I get a classification result. I want to have a confusion matrix with all the results.
Scikits has a confusion matrix interface:
sklearn.metrics.confusion_matrix(y_true, y_pred)
My question... | scikits confusion matrix with cross validation | 1.2 | 0 | 0 | 4,075 |
9,735,381 | 2012-03-16T10:15:00.000 | 1 | 0 | 1 | 0 | python,nltk,corpus | 9,878,800 | 2 | false | 0 | 0 | CategorizedCorpusReader only supports one level of categories. But since categories are based on the filename, you are free to set up your own name/category scheme and filter the corpus fileids as needed.
How do you want to use the multi-level categories? If you have follow-up questions, explain what you want to achie... | 1 | 3 | 0 | I was trying to create another category under a parent category.
Is is possible to create. How it can be done and how can a refer to these sub-categories? | How to create a sub-category for a corpus in NLTK Python | 0.099668 | 0 | 0 | 990 |
9,736,542 | 2012-03-16T11:38:00.000 | 1 | 0 | 1 | 0 | python | 9,739,990 | 2 | true | 0 | 0 | Sounds like you have a stand-alone program that reads from stdin, and you want to automate input to it using python. Download and use the pexpect module, that's what it's for. | 1 | 1 | 0 | I have a python script say script1.py. It will prompt the user with a serious of questions like Name, 'Y' / 'N' type questions. Now i need to call this python script from another python script,say scripts2.py such that I would define the user inputs in script2.py. So how to pass the input sequentially???
Help would... | Python : Automate the user input data(Multiple sequential inputs)? | 1.2 | 0 | 0 | 751 |
9,737,757 | 2012-03-16T13:02:00.000 | 1 | 1 | 0 | 0 | python,encryption,public-key-encryption | 9,738,049 | 2 | false | 0 | 0 | What you need is to do something like SSL does: exchange a key using public key encryption, then use symmetric encryption. Asymmetric encryption is very inefficient in terms of performance, and should not be used for such stuff. | 2 | 3 | 0 | I have a program that regularly appends small pieces (say 8 bytes) of sensitive data to a number of logfiles. I would like this data to be encrypted. I want the program to start automatically at boot time, so I don't want to type a password at program start. I also don't want it to store a password somewhere, since tha... | Is there a public key stream cipher encryption? | 0.099668 | 0 | 0 | 2,836 |
9,737,757 | 2012-03-16T13:02:00.000 | 5 | 1 | 0 | 0 | python,encryption,public-key-encryption | 9,738,026 | 2 | true | 0 | 0 | Typically this is solved in the way that the program creates some (real) random numbers which are used as a secret key to a symmetric encryption algorithm.
In you program you have to do something like:
Generate some real random data (maybe use /dev/random) as a secret key.
Encrypt the secret key with the public key al... | 2 | 3 | 0 | I have a program that regularly appends small pieces (say 8 bytes) of sensitive data to a number of logfiles. I would like this data to be encrypted. I want the program to start automatically at boot time, so I don't want to type a password at program start. I also don't want it to store a password somewhere, since tha... | Is there a public key stream cipher encryption? | 1.2 | 0 | 0 | 2,836 |
9,738,522 | 2012-03-16T13:54:00.000 | 4 | 0 | 0 | 0 | python,algorithm,http,web-scraping,beautifulsoup | 9,738,568 | 2 | false | 0 | 0 | You could use the HEAD HTTP method and look at the Date-Modified and ETag headers, etc. before actually downloading the full content again.
However nothing guarantees that the server will actually update these headers when the entity's (URL's) content changes, or indeed even respond properly to the HEAD method. | 2 | 0 | 0 | I need to create software in Python which monitoring sites when changes have happened. At the moment I have periodic task and check content of site with previous version. Is there any easier way to check if content of site has been changed, maybe time of last changes, so to avoid downloading content everu time ? | Get last changes on site | 0.379949 | 0 | 0 | 118 |
9,738,522 | 2012-03-16T13:54:00.000 | 1 | 0 | 0 | 0 | python,algorithm,http,web-scraping,beautifulsoup | 9,738,636 | 2 | false | 0 | 0 | Altough it doesn't answer your question I think its worth to mention that you don't have to store the previous version of website to look for changes. You can just count md5 sum of it and store this sum, then count it for the new version and check if they are equal.
And about the question itself, AKX gave a great answe... | 2 | 0 | 0 | I need to create software in Python which monitoring sites when changes have happened. At the moment I have periodic task and check content of site with previous version. Is there any easier way to check if content of site has been changed, maybe time of last changes, so to avoid downloading content everu time ? | Get last changes on site | 0.099668 | 0 | 0 | 118 |
9,739,963 | 2012-03-16T15:22:00.000 | 2 | 0 | 1 | 0 | python | 9,740,014 | 4 | false | 0 | 0 | You can seek() to a position and write a single byte. It will overwrite what's there, rather than inserting. | 1 | 6 | 0 | This is a theoretical question as I don't have an actual problem, but I got to wondering ...
If I had a huge file, say many gigs long and I wanted to change a single byte and I knew the offset of that byte, how could I do this efficiently? Is there a way to do this without rewriting the entire file and only writing th... | Python - Small Change to a Huge File | 0.099668 | 0 | 0 | 1,583 |
9,742,351 | 2012-03-16T18:05:00.000 | 0 | 0 | 0 | 0 | python,encryption,passwords,hashlib | 9,742,498 | 5 | false | 0 | 0 | The HTTPS channel over which you send the password to the server provides encryption that is good enough.
However, you need a more secure storage mechanism for the password. Use an algorithm like "bcrypt" with many thousands of hash iterations (bcrypt calls this the cost factor, and it should be at least 16, meaning 21... | 1 | 0 | 0 | I'm trying to send username and password data from a web form to my server.
The password is sent as plain text over a https connection, then properly encrypted on the server (using python hashlib.sha224) before being stored, however I'm not sure how to transmit the password text to the server in an encrypted format.
My... | How to encrypt password sent to server | 0 | 0 | 1 | 2,259 |
9,742,739 | 2012-03-16T18:36:00.000 | -4 | 0 | 1 | 0 | python,matrix,multiprocessing | 9,743,633 | 4 | false | 0 | 0 | You don't.
Either they return their edits in a format you can use in the main programme, or you use some kind of interprocess-communication to have them send their edits over, or you use some kind of shared storage, such as a database, or a datastructure server like redis. | 1 | 9 | 0 | I am making a process pool and each of them need to write in different parts of a matrix that exists in the main program. There exists no fear of overwriting information as each process will work with different rows of the matrix. How can i make the matrix writable from within the processes??
The program is a matrix mu... | How do I make processes able to write in an array of the main program? | -1 | 0 | 0 | 29,338 |
9,743,838 | 2012-03-16T20:08:00.000 | 4 | 0 | 1 | 1 | python,subprocess | 9,743,899 | 4 | false | 0 | 0 | You don't need to run a thread for each process. You can peek at the stdout streams for each process without blocking on them, and only read from them if they have data available to read.
You do have to be careful not to accidentally block on them, though, if you're not intending to. | 1 | 22 | 0 | I want to run many processes in parallel with ability to take stdout in any time. How should I do it? Do I need to run thread for each subprocess.Popen() call, a what? | Python subprocess in parallel | 0.197375 | 0 | 0 | 25,715 |
9,744,806 | 2012-03-16T21:35:00.000 | 4 | 0 | 1 | 0 | python | 9,745,145 | 1 | true | 0 | 0 | It should not break any tools and it should work on Python 3.
It is ok If it doesn't hurt a source code readability i.e., you can still find out what the function does and how to use it.
The problem might be that it masks a poor design. If several methods use the same list of arguments the code should be refactored (cr... | 1 | 7 | 0 | A python docstring must be given as a literal string; but sometimes it's useful to have similar docstrings for several functions (e.g., different constructors), or several access methods might accept the same list of arguments (and then rely on the same hidden method), so it would be nice to use the same description ev... | Modifying a python docstring with a decorator: Is it a good idea? | 1.2 | 0 | 0 | 1,266 |
9,746,586 | 2012-03-17T01:56:00.000 | 2 | 1 | 0 | 0 | c++,python,embedding,extending | 9,746,618 | 2 | false | 0 | 1 | In my opinion, in your case it makes no sense to embed Python in C++, while the reverse could be beneficial.
In most of programs, the performance problems are very localized, which means that you should rewrite the problematic code in C++ only where it makes sense, leaving Python for the rest.
This gives you the best o... | 1 | 1 | 0 | I have some big mysql databases with data for calculations and some parts where I need to get data from external websites.
I used python to do the whole thing until now, but what shall I say: its not a speedster.
Now I'm thinking about mixing Python with C++ using Boost::Python and Python C API.
The question I've got n... | Speed - embedding python in c++ or extending python with c++ | 0.197375 | 0 | 0 | 2,903 |
9,747,258 | 2012-03-17T04:30:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,google-api,google-api-client,google-api-python-client | 9,748,040 | 2 | false | 1 | 0 | The packages needs to be locally available, where did you put the packages, in the Python folder or in your project folder? | 1 | 0 | 0 | I've been experimenting with the Google App Engine, and I'm trying to import certain libraries in order to execute API commands. I've been having trouble importing, however. When I tried to execute "from apiclient.discovery import build", my website doesn't load anymore. When I test locally in IDLE, this command works... | Google App Engine library imports | 0 | 0 | 1 | 2,099 |
9,748,915 | 2012-03-17T09:43:00.000 | 3 | 0 | 0 | 0 | python,user-interface,pygame | 9,751,549 | 2 | true | 0 | 1 | You might try running two separate programs. I just ran two of my pygame programs separately, they work fine. Run one using the other, maybe? Or, if that doesn't work, put use two surfaces as screens, and draw one into the other. | 2 | 2 | 0 | Is there any way to bind two windows from seprate processes together using Python/Pygame? By binding I mean in two possible ways:
A large window that contains two smaller windows
Two separate windows which appear side to side (perhaps using OS environment variables?) | Possibility of binding multiple PyGame windows | 1.2 | 0 | 0 | 531 |
9,748,915 | 2012-03-17T09:43:00.000 | 0 | 0 | 0 | 0 | python,user-interface,pygame | 9,855,904 | 2 | false | 0 | 1 | Interprocess communication is probably the simplest. The issue though is that SDL is fundamentally not set up for multiple windows.
Probably the best long-term solution is to set up with wxPython, and then use PyGame inside of it. This will let you have all manner of windows with PyGame renderers. | 2 | 2 | 0 | Is there any way to bind two windows from seprate processes together using Python/Pygame? By binding I mean in two possible ways:
A large window that contains two smaller windows
Two separate windows which appear side to side (perhaps using OS environment variables?) | Possibility of binding multiple PyGame windows | 0 | 0 | 0 | 531 |
9,750,481 | 2012-03-17T13:50:00.000 | 2 | 0 | 0 | 0 | python,download,html-parsing,beautifulsoup,printing-web-page | 9,750,658 | 1 | true | 1 | 0 | Use http.client to send a HEAD request to the URL. This will return only the headers for the resource then you can look at the content-type header and see if it text/html. If it is then send a GET request to the URL to get the body. | 1 | 0 | 0 | I want to write a python script which downloads the web-page only if the web-page contains HTML. I know that content-type in header will be used. Please suggest someway to do it as i am unable to get a way to get header before the file download. | Download a URL only if it is a HTML Webpage | 1.2 | 0 | 1 | 103 |
9,752,808 | 2012-03-17T18:54:00.000 | 1 | 1 | 1 | 0 | python,yaml,sublimetext | 9,752,868 | 1 | true | 0 | 0 | /Users/me/Developer/Cellar/python/2.7.2/lib/python2.7 doesn't seem like a pre-installed version of Python on a Mac. Can you try to identify the system-wide Python installation and use the explicit path to the python executable to execute setup.py install? Then try the Sublime Text plug-in.
The default Mac OS X Python s... | 1 | 0 | 0 | I'm using OS X with Sublime text build 2181, and I am having trouble using the Yaml module in a Sublime Text plugin.
I have installed PyYaml by doing python setup.py install. When I go to the python console, and try import yaml I have no problems. But when I try to save my Sublime Text plugin with the import yaml state... | Python SublimeText plugin - No module named Yaml | 1.2 | 0 | 0 | 5,021 |
9,752,891 | 2012-03-17T19:08:00.000 | 0 | 0 | 0 | 0 | python,url,dynamic | 9,753,135 | 1 | true | 1 | 0 | If you parsing some product pages, usually these URLs have some kind of product id.
Find the pattern to extract product id from URLs, and use it to filter already visited URLs. | 1 | 0 | 0 | I am crawling online stores for price comparison. Mot of the stores are using dynamic URLs heavily. This is causing my crawler to spend lot of time on every online stores. Even though most of them have only 5-6k unique products, they have unique URLs >= 300k. Any idea how to get around this.
Thanks in advance! | How to handle dynamic URLs while crawling online stores? | 1.2 | 0 | 1 | 205 |
9,754,056 | 2012-03-17T21:48:00.000 | 1 | 0 | 0 | 0 | python,user-interface,csv,tkinter | 9,754,842 | 2 | false | 0 | 1 | you can use a lambda function in order to pass an argument to your load function. Unfortunately pastebin ist down right now so i cannot have a look at your code. The idea is something like this:
for filename in filenames:
...Button(...,command=lambda i=filename:loadFile(i),...
so in your loadFile function you have ... | 1 | 3 | 0 | I'm trying to get this program to print the contents of a .csv file onto a GUI.
I've created in Tkinter. It mostly works, but I can't figure out a way to get each button to print the contents of the file it's linked to.
At the moment I've created a variable that links to just one of the files, which shows that it work... | How to make a button open a specific .csv file using Python Tkinter? | 0.099668 | 0 | 0 | 2,189 |
9,755,990 | 2012-03-18T04:26:00.000 | 2 | 0 | 1 | 0 | python,list,tuples,immutability,python-internals | 9,756,037 | 8 | false | 0 | 0 | A tuple is immutable in the sense that the tuple itself can not expand or shrink, not that all the items contained themselves are immutable. Otherwise tuples are dull. | 2 | 200 | 0 | If a tuple is immutable then why can it contain mutable items?
It is seemingly a contradiction that when a mutable item such as a list does get modified, the tuple it belongs to maintains being immutable. | Why can tuples contain mutable items? | 0.049958 | 0 | 0 | 37,518 |
9,755,990 | 2012-03-18T04:26:00.000 | 5 | 0 | 1 | 0 | python,list,tuples,immutability,python-internals | 9,756,035 | 8 | false | 0 | 0 | I'll go out on a limb here and say that the relevant part here is that while you can change the contents of a list, or the state of an object, contained within a tuple, what you can't change is that the object or list is there. If you had something that depended on thing[3] being a list, even if empty, then I could se... | 2 | 200 | 0 | If a tuple is immutable then why can it contain mutable items?
It is seemingly a contradiction that when a mutable item such as a list does get modified, the tuple it belongs to maintains being immutable. | Why can tuples contain mutable items? | 0.124353 | 0 | 0 | 37,518 |
9,757,203 | 2012-03-18T09:15:00.000 | 6 | 0 | 0 | 1 | python,google-app-engine,python-2.7 | 9,757,219 | 1 | false | 1 | 0 | AppEngine restricts you from doing things that don't make sense. Your AppEngine application can't go wandering all over the filesystem once it is running on Google's servers, and Google's servers certainly don't have a C: drive.
Whatever you are trying to accomplish by changing directories, it's something that you need... | 1 | 0 | 0 | import os os.chdir("c:\Users")
works in the command prompt but not on localhost (google app engine.)
can anyone help. | change directory (python) doesnt work in localhost | 1 | 0 | 0 | 213 |
9,757,361 | 2012-03-18T09:49:00.000 | 1 | 0 | 1 | 0 | python,openpyxl | 9,757,506 | 1 | false | 0 | 0 | i want it as they are in excel file.
A date is recorded in an Excel file (both 2007+ XLSX files and earlier XLS files) as a floating point number of days (and fraction thereof) since some date in 1899/1900 or 1904. Only the "number format" that is recorded against the cell can be used to distinguish whether a date or ... | 1 | 0 | 0 | i am new in python and i want to read office 2010 excel file without changing its style. Currently its working fine but changing date format. i want it as they are in excel file. | How to read office 2010 excelfile using openpyxl without changing style | 0.197375 | 1 | 0 | 719 |
9,758,636 | 2012-03-18T13:16:00.000 | 0 | 1 | 0 | 0 | python,api,twitter | 29,076,949 | 2 | false | 0 | 0 | I am currently studying twitter structure and had found out that is a field called tweet_count associated with each tweet as to # of times that particular original tweet has been retweeted | 2 | 1 | 0 | I have used twitter search API to collect lots of tweets given a search keyword. Now that I have this collection of tweets, I'd like to find out which tweet has been retweeted most.
Since search API does not have retweet_count, I have to find some other way to check how many times each tweet has been retweeted. The... | Getting Retweet Count of a Given Tweet ID Number | 0 | 0 | 1 | 1,571 |
9,758,636 | 2012-03-18T13:16:00.000 | 0 | 1 | 0 | 0 | python,api,twitter | 9,758,703 | 2 | false | 0 | 0 | i don't think so, since one can either retweet using the retweet command or using a commented retweet. At least the second alternative generates a new tweet id | 2 | 1 | 0 | I have used twitter search API to collect lots of tweets given a search keyword. Now that I have this collection of tweets, I'd like to find out which tweet has been retweeted most.
Since search API does not have retweet_count, I have to find some other way to check how many times each tweet has been retweeted. The... | Getting Retweet Count of a Given Tweet ID Number | 0 | 0 | 1 | 1,571 |
9,759,558 | 2012-03-18T15:33:00.000 | 0 | 0 | 0 | 0 | python,templates,flask,bottle | 26,185,476 | 3 | false | 1 | 0 | Note: this same solution can be used with the other template engines. The technique is exactly the same, but you use BaseTemplate (it works for all template classes) or the class for the engine you want to use. | 1 | 7 | 0 | Is there a bottle.py equivalent of context processors that you get in Flask? | Include variables in template context on every page with Bottle.py | 0 | 0 | 0 | 1,518 |
9,759,680 | 2012-03-18T15:49:00.000 | 6 | 0 | 1 | 0 | python,class,function,object,methods | 9,759,706 | 2 | true | 0 | 0 | Methods need to be called on a specific object. Functions don't.
The functions that are available at any time are the built-in ones, such as sorted and list, plus any functions that are in modules that you've imported or that you've defined yourself. The methods that are available on a particular object are the ones th... | 2 | 1 | 0 | In sorted(list(mydict.keys())), sorted and list doesn't need an object prefix someobject., but keys() needed dict1.. When, or for what functions, is the prefix necessary? | In Python, when a function doesn't need an object prefix? | 1.2 | 0 | 0 | 121 |
9,759,680 | 2012-03-18T15:49:00.000 | 2 | 0 | 1 | 0 | python,class,function,object,methods | 9,759,707 | 2 | false | 0 | 0 | The "prefix" means that you are calling a method from an object (someobject or dict in your example). If your function is not a method of an object, you do not need "a prefix" | 2 | 1 | 0 | In sorted(list(mydict.keys())), sorted and list doesn't need an object prefix someobject., but keys() needed dict1.. When, or for what functions, is the prefix necessary? | In Python, when a function doesn't need an object prefix? | 0.197375 | 0 | 0 | 121 |
9,760,636 | 2012-03-18T17:46:00.000 | 0 | 0 | 0 | 0 | python,keyword,wikipedia,topic-maps | 9,760,985 | 2 | false | 0 | 0 | You can scrape the categories if you want. If you're working with python, you can read the wikitext directly from their API, and use mwlib to parse the article and find the links.
A more interesting but harder to implement approach would be to create clusters of related terms, and given the list of terms extracted from... | 1 | 1 | 1 | I am writing a user-app that takes input from the user as the current open wikipedia page. I have written a piece of code that takes this as input to my module and generates a list of keywords related to that particular article using webscraping and natural language processing.
I want to expand the functionality of the... | How to get related topics from a present wikipedia article? | 0 | 0 | 0 | 1,060 |
9,761,240 | 2012-03-18T18:52:00.000 | 1 | 0 | 1 | 0 | python,class,automation,replication | 9,761,303 | 2 | true | 0 | 0 | Any new-style object can get a reference to its class by accessing its __class__ attribute. From there it can invoke a constructor, manipulate class attributes, etc. | 1 | 1 | 0 | I am trying to come up with a way of taking a created instance that acts as an environment for n-many sub-instances within; like having a overall 'network' instance with multiple dynamically-interconnecting objects inside. My current idea is for the network instance to first be instantiated, and then an initial sub-obj... | Python - Creating self-replicating class-object instance | 1.2 | 0 | 0 | 1,634 |
9,762,156 | 2012-03-18T20:48:00.000 | 0 | 0 | 1 | 0 | python,windows,filesystems,dokan | 9,844,594 | 1 | false | 0 | 0 | No way (without some very deep kernel-mode hacking). You need to have a filesystem visible to the OS via the driver stack in order to run an EXE from it. One option is to create a hidden filesystem or map the virtual file system to the directory on existing NTFS drive (eg. our Callback File System lets you do this), bu... | 1 | 1 | 0 | A quick question for anyone who knows the answer. I'm doing with with virtual file systems and python. I have an EXE file within my file system, is it possible to run this application without having to expose the file system with something like Dokan?
If not possible, is there a way to expose the file system without th... | python - Run Application out of Virtual File System | 0 | 0 | 0 | 477 |
9,762,841 | 2012-03-18T22:22:00.000 | 1 | 0 | 0 | 0 | python,sqlite,user-interface,wxpython,wxwidgets | 9,771,997 | 1 | false | 0 | 1 | You could use wx.grid or one of the ListCtrls. There's an example of a grid with 100 million cells in the wxPython demo that you could use for guidance on projects with lots of information. For ListCtrls, you would want to use a Virtual ListCtrl using the wx.LC_VIRTUAL flag. There's an example of that in the demo as we... | 1 | 1 | 0 | I'm creating python app using relatively big SQL database (250k rows). Application needs GUI where most important part of it would be to present results of SQL queries.
So I'm looking for a best way to quickly present data in tables in GUI.
Most preferably I'd be using wx - as it has seamless connection to main applica... | Most seamless way to present data in gui | 0.197375 | 1 | 0 | 420 |
9,763,056 | 2012-03-18T22:54:00.000 | 0 | 0 | 0 | 1 | python,macos,module,homebrew | 10,824,368 | 1 | false | 0 | 0 | From the Homebrew page: "Homebrew installs packages into their own isolated prefix and then symlinks everything into /usr/local"
I think that the OS X preinstalled python looks for modules in
/Library/Frameworks/Python.framework/Versions/Current//lib/python2.7/site-packages
So maybe you need to symlink your Homebrew in... | 1 | 0 | 0 | I am installing modules with homebrew and other installers, and they are not recognized by my default python. Module installations with easy_install (such as pip) appear to be available for my system and system python).
My default python is located here and is this version:
15:49 [~]: which python
/usr/local/bin... | default python does not locate modules installed with homebrew | 0 | 0 | 0 | 311 |
9,763,675 | 2012-03-19T00:41:00.000 | 5 | 1 | 1 | 0 | python | 9,763,705 | 2 | true | 0 | 0 | Opening the file in write/read mode (w+) will truncate the file without rewriting it if it already exists. | 1 | 2 | 0 | I want to basically copy whats from the clipboard and paste it in a file in utf-8 encoding, but what ever I try, the file has the '?' symbols in it and is Anscii encoding...
But what I found out is, if there is a file that's already in utf-8 encoding, then whatever I paste in it manually (deleting whats there already),... | How to erase all text from a file using python, but not delete/recreate the file? | 1.2 | 0 | 0 | 12,883 |
9,764,895 | 2012-03-19T04:03:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,coffeescript,go | 9,764,949 | 2 | true | 1 | 0 | Coffeescript compiles to Javascript, which can be run in a web browser. In that case, App Engine can serve up the resulting javascript.
I don't know of any way to compile coffeescript to python, java or go though, so you can't use it as a server side language. | 1 | 2 | 0 | Does anyone know if it is possible to use Coffeescript on Google App Engine? If so how can this be done with the app engine Python or Go platforms? | How to use Coffeescript on Google App Engine | 1.2 | 0 | 0 | 1,031 |
9,764,930 | 2012-03-19T04:09:00.000 | 9 | 0 | 1 | 0 | python,regex | 9,765,037 | 4 | false | 0 | 0 | You can fix the problem of (\.\w+)+ only capturing the last match by doing this instead: ((?:\.\w+)+) | 1 | 34 | 0 | While matching an email address, after I match something like yasar@webmail, I want to capture one or more of (\.\w+)(what I am doing is a little bit more complicated, this is just an example), I tried adding (.\w+)+ , but it only captures last match. For example, yasar@webmail.something.edu.tr matches but only include... | Capturing repeating subpatterns in Python regex | 1 | 0 | 0 | 55,735 |
9,764,963 | 2012-03-19T04:13:00.000 | 2 | 0 | 0 | 0 | python,mysql-python | 9,765,239 | 2 | true | 0 | 0 | I guess you're using InnoDB. This is default for an InnoDB transaction.
REPEATABLE READ
This is the default isolation level for InnoDB. For consistent reads,
there is an important difference from the READ COMMITTED isolation
level: All consistent reads within the same transaction read the
snapshot established by... | 1 | 2 | 0 | >>> _cursor.execute("select * from bitter.test where id > 34")
1L
>>> _cursor.fetchall()
({'priority': 1L, 'default': 0, 'id': 35L, 'name': 'chinanet'},)
>>> _cursor.execute("select * from bitter.test where id > 34")
1L
>>> _cursor.fetchall()
({'priority': 1L, 'default': 0, 'id': 35L, 'name'... | cursor fetch wrong records from mysql | 1.2 | 1 | 0 | 677 |
9,767,585 | 2012-03-19T09:20:00.000 | 6 | 0 | 0 | 0 | python,jinja2 | 9,767,951 | 5 | false | 1 | 0 | Try putting the syntax in the other files in {% raw %} {% endraw %}
You can use jQuery if you dont want to edit the external files:
Make a dive to contain the content <div id="contentoffile"></div>
and use jquery to load the file : $("#contentoffile").load("url to file") << the url can be relative | 1 | 19 | 0 | I'm trying to insert file into a page using Jinja 2.6 using the include tag. This worked fine until I started using characters in the file that are reminiscent of the Jinja syntax, at which point it realized it couldn't parse them and bombed.
Short of going though the file and escaping all characters, what can I do to... | Insert static files literally into Jinja templates without parsing them | 1 | 0 | 0 | 18,579 |
9,768,218 | 2012-03-19T10:04:00.000 | 11 | 0 | 0 | 0 | python,ctypes,pickle | 9,771,616 | 3 | true | 0 | 0 | Python has no way of doing that automatically for you:
You will have to build code to pick all the desired Data yourself, putting them in a suitable Python data structure (or just adding the data in a unique bytes-string where you will know where each element is by its offset) - and then save that object to disk.
This ... | 3 | 8 | 1 | I use a 3rd party library which returns after a lot of computation a ctypes object containing pointers.
How can I save the ctypes object and what the pointers are pointing to for later use?
I tried
scipy.io.savemat => TypeError: Could not convert object to array
cPickle => ctypes objects containing pointers cannot b... | How to save ctypes objects containing pointers | 1.2 | 0 | 0 | 14,249 |
9,768,218 | 2012-03-19T10:04:00.000 | 1 | 0 | 0 | 0 | python,ctypes,pickle | 41,899,145 | 3 | false | 0 | 0 | To pickle a ctypes object that has pointers, you would have to define your own __getstate__/__reduce__ methods for pickling and __setstate__ for unpickling. More information in the docs for pickle module. | 3 | 8 | 1 | I use a 3rd party library which returns after a lot of computation a ctypes object containing pointers.
How can I save the ctypes object and what the pointers are pointing to for later use?
I tried
scipy.io.savemat => TypeError: Could not convert object to array
cPickle => ctypes objects containing pointers cannot b... | How to save ctypes objects containing pointers | 0.066568 | 0 | 0 | 14,249 |
9,768,218 | 2012-03-19T10:04:00.000 | 0 | 0 | 0 | 0 | python,ctypes,pickle | 9,768,597 | 3 | false | 0 | 0 | You could copy the data into a Python data structure and dereference the pointers as you go (using the contents attribute of a pointer). | 3 | 8 | 1 | I use a 3rd party library which returns after a lot of computation a ctypes object containing pointers.
How can I save the ctypes object and what the pointers are pointing to for later use?
I tried
scipy.io.savemat => TypeError: Could not convert object to array
cPickle => ctypes objects containing pointers cannot b... | How to save ctypes objects containing pointers | 0 | 0 | 0 | 14,249 |
9,768,794 | 2012-03-19T10:48:00.000 | 1 | 0 | 1 | 0 | python | 9,768,810 | 2 | true | 0 | 0 | "Immediately", no. The garbage collector will sweep it up next run, assuming there are no other references to that object. | 1 | 1 | 0 | I have a large dataset that I am dealing with in Python. It is hierarchical just like DOM. I have a root node object, and from that object all the other objects emanate.
SO, if I just do del obj where obj is root node, will the entire hierarchy be gone immediately? | Python: deleting large data | 1.2 | 0 | 0 | 64 |
9,768,901 | 2012-03-19T10:57:00.000 | 0 | 0 | 1 | 0 | javascript,python,sandbox,embedded-v8 | 9,796,559 | 2 | false | 0 | 0 | Would simply locking down the V8 instance (ie: giving it no permissions in a chroot) and killing the process if it doesn't return after a certain amount of time not work? | 2 | 6 | 0 | I'm new to V8 and plan on using it in a python web application. The purpose is to let users submit and execute certain JS scripts. Obviously this is a security threat so I'm looking for resources that document the ways one might 'lock down' v8. For example, can I create a white list of functions allowed to be called? O... | How to "Lock down" V8? | 0 | 0 | 0 | 670 |
9,768,901 | 2012-03-19T10:57:00.000 | 1 | 0 | 1 | 0 | javascript,python,sandbox,embedded-v8 | 9,796,731 | 2 | false | 0 | 0 | If you use a plain V8 (i.e. not something like node.js) there won't be any dangerous functions. JavaScript itself doesn't have a stdlib containing filesystem functions etc.
The only thing a malicious user can do is creating infinite loops, deep recursions and memory hogs. | 2 | 6 | 0 | I'm new to V8 and plan on using it in a python web application. The purpose is to let users submit and execute certain JS scripts. Obviously this is a security threat so I'm looking for resources that document the ways one might 'lock down' v8. For example, can I create a white list of functions allowed to be called? O... | How to "Lock down" V8? | 0.099668 | 0 | 0 | 670 |
9,771,171 | 2012-03-17T17:03:00.000 | 0 | 1 | 0 | 0 | python,openerp | 10,222,065 | 3 | false | 1 | 0 | i dont know but i think you can also use the sheduled actions in administration->shedular->sheduled actions or else ir.cron is the best option for sheduling outgoing emails | 3 | 4 | 0 | In OpenERP 6.0.1, I've created a server action to send a confirmation email after an invoice is confirmed, and linked it to appropriately to the invoice workflow. now normally when an invoice is confirmed, an email is automatically sent.
is there a way to set a date for when the email should be sent instead of being se... | openerp schedule server action | 0 | 0 | 0 | 1,470 |
9,771,171 | 2012-03-17T17:03:00.000 | 9 | 1 | 0 | 0 | python,openerp | 9,784,730 | 3 | true | 1 | 0 | There is a one object ir.cron which will run on specific time period. There you can specify the time when you want to sent the mail.
This object will call the function which you given in Method attribute. In this function you have to search for those invoices which are in created state. Then check the date when it cre... | 3 | 4 | 0 | In OpenERP 6.0.1, I've created a server action to send a confirmation email after an invoice is confirmed, and linked it to appropriately to the invoice workflow. now normally when an invoice is confirmed, an email is automatically sent.
is there a way to set a date for when the email should be sent instead of being se... | openerp schedule server action | 1.2 | 0 | 0 | 1,470 |
9,771,171 | 2012-03-17T17:03:00.000 | 0 | 1 | 0 | 0 | python,openerp | 10,615,931 | 3 | false | 1 | 0 | With OpenERO 6.1 New Email Engine has Email Queue so what you just need to do it queue your Email on that email queue and we already have one Scheduled Action which processes this email queue at defined interval, so what you can do it you can change the trigger time of the same action. and you can see the email Engine... | 3 | 4 | 0 | In OpenERP 6.0.1, I've created a server action to send a confirmation email after an invoice is confirmed, and linked it to appropriately to the invoice workflow. now normally when an invoice is confirmed, an email is automatically sent.
is there a way to set a date for when the email should be sent instead of being se... | openerp schedule server action | 0 | 0 | 0 | 1,470 |
9,773,232 | 2012-03-19T15:43:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,server-side-includes,static-files | 9,782,676 | 2 | false | 1 | 0 | Or use a framework like django, which will help in inheritance of templates. | 1 | 0 | 0 | Is there a decent way to "simulate" server side includes using Python on Google App Engine?
I would really like to split my static html files up into smaller pieces for two reasons:
They will be easier to manage from a development perspective
HTML that is redundant across multiple pages can be more easily re-used and ... | Practical server side includes with Python on Google App Engine | 0 | 0 | 0 | 1,024 |
9,774,966 | 2012-03-19T17:31:00.000 | 0 | 1 | 0 | 0 | python,ruby,vim,code-completion | 9,775,180 | 1 | false | 0 | 0 | Commercial IDE for python like wing (www.wingware.com) and pycharm (www.jetbrains.com/pycharm) are better to solve majority of code-completion issues. Of course, they are not free though. I myself, when use eclipse with pydev plugin was not able to get satisfactory results. | 1 | 10 | 0 | I'm working on a large python project using vim with tagexplorer, pythoncomplete, and ctags. Tag-based code-browsing and code-completion features don't work the way they should unfortunately because ctags doesn't tie instances to types.
Hypothetical scenarios:
Auto Complete: vim won't auto-complete method on() in myCa... | How to address python code-browsing and code-completion issues in vim? | 0 | 0 | 0 | 273 |
9,776,206 | 2012-03-19T18:59:00.000 | 1 | 0 | 0 | 0 | c++,python,c,wxpython | 9,777,740 | 3 | false | 0 | 1 | You could strictly seperate design(python part) and code(c++ part) like this:
Write a complete c++ programm that works in the terminal/console and then make the python-application call these c++-terminal programm via os.Popen.
So if your programm is a calculator it does this:
(python gui) 5 + 5 -> my_c_programm.exe "5 ... | 1 | 0 | 0 | I am writing an application where I am coding all of my front-end and GUI with python library (wxpython specifically). For this application, I would like to write the model class with C and use python to use the compiled C code? How can this be implemented in python?
I know this is little vague question but I am strugg... | Using C compiled code from python GUI | 0.066568 | 0 | 0 | 894 |
9,776,425 | 2012-03-19T19:16:00.000 | 3 | 0 | 1 | 0 | python,filesize | 9,776,500 | 3 | false | 0 | 0 | no. 1 is definitely the worst. If at all, it's better to seek() and tell(), but that's not as good as the other two.
no. 2 and no. 3 are equally ok IMO. I think no. 3 is a bit clearer to read, but that's negligible. | 2 | 1 | 0 | There are actually three ways I have in mind to determine a files size:
open and read it, and get the size of the string with len()
using os.stat and getting it via st_size -> what should be the "right" way because its handled by the underlying os
os.path.getsize what should be the same as above
So what is the actual... | Whats the best way to get the filesize? | 0.197375 | 0 | 0 | 3,713 |
9,776,425 | 2012-03-19T19:16:00.000 | 4 | 0 | 1 | 0 | python,filesize | 9,777,252 | 3 | false | 0 | 0 | Method 1 is the slowest way possible. Don't use it unless you will need the entire contents of the file as a string later.
Methods 2 and 3 are the fastest, since they don't even have to open the file.
Using f.seek(os.SEEK_END) and f.tell() requires opening the file, and might be a bit slower than 2&3 unless you're goin... | 2 | 1 | 0 | There are actually three ways I have in mind to determine a files size:
open and read it, and get the size of the string with len()
using os.stat and getting it via st_size -> what should be the "right" way because its handled by the underlying os
os.path.getsize what should be the same as above
So what is the actual... | Whats the best way to get the filesize? | 0.26052 | 0 | 0 | 3,713 |
9,776,529 | 2012-03-19T19:24:00.000 | 0 | 1 | 0 | 1 | android,python,android-intent,android-emulator,monkeyrunner | 10,211,905 | 1 | false | 0 | 0 | wpa_cli should work.Open wpa_cli>>
add_network
set_network ssid "APSSID"
set_network key_mgmt NONE \if ap is confgrd in open none
save_config
enable
these set of commands should work if WiFI is ON in UI.
using Monkeyrunner navigate using keycode is the only option OR
you need to make an APK for ... | 1 | 1 | 0 | I am trying to connect an android device to specific AP without keycodes. I am looking for adb shell commands or monkeyrunner script that can perform the same.
Hope you guys can help me with this.
PS. After researching for days only way I found is using wpa_cli in adb shell. But couldnt exactly connect because I was no... | How to connect android device to specific AP with adb shell or monkeyrunner | 0 | 0 | 0 | 799 |
9,777,879 | 2012-03-19T21:01:00.000 | 2 | 0 | 0 | 0 | python,django,wizard,django-formwizard | 9,778,474 | 3 | false | 1 | 0 | What do you want to do ?
If you want to create a wizard where step x is repeated n times then answer is yes, you can do that and it is not that hard.
You just need to create a wizard class factory that creates the class given specific parameters and you're done.
In case you mean, can I change the steps of a wizard on-t... | 1 | 3 | 0 | Is possible that the steps of the wizard are dynamic? For example, the second step occur repeatedly n times? | Dynamic number of Steps using Django Wizard | 0.132549 | 0 | 0 | 1,832 |
9,778,006 | 2012-03-19T21:11:00.000 | 1 | 0 | 0 | 0 | python,encryption,cryptography,toolkit | 9,821,078 | 5 | true | 0 | 0 | I ended up using M2Crypto after trying PyOpenSSL
the problem with PyOpenSSL is that it doesnt have a method to return a public key. I was having a lot of problem with this.
M2Crypto has its own encryption method as well, meaning you dont need to install multiple libraries :) | 1 | 2 | 0 | I have an assignment to create a secure communication between 2 people with a middle man.
The messages have to be encrypted using public and private keys and a X.509 certificate should be created for each user, this certificate is stored by the third party.
I'm currently sending messages between users through a socket... | Python open source cryptographic toolkit | 1.2 | 0 | 1 | 994 |
9,779,200 | 2012-03-19T23:00:00.000 | 1 | 1 | 1 | 1 | python,daemon | 9,779,553 | 3 | false | 0 | 0 | I've written many things in C/C++ and Perl that are initiated when a LINUX box O.S. boots, launching them using the rc.d.
Also I've written a couple of java and python scripts that are started the same way I've mentioned above, but I needed a little shell-script (.sh file) to launch them and I used rc.5.
Let me tell y... | 2 | 18 | 0 | I have to write a daemon program that constantly runs in the background and performs some simple tasks. The logic is not complicated at all, however it has to run for extended periods of time and be stable.
I think C++ would be a good choice for writing this kind of application, however I'm also considering Python sin... | Is writing a daemon in Python a good idea? | 0.066568 | 0 | 0 | 2,480 |
9,779,200 | 2012-03-19T23:00:00.000 | 14 | 1 | 1 | 1 | python,daemon | 9,779,293 | 3 | true | 0 | 0 | I've written a number of daemons in Python for my last company. The short answer is, it works just fine. As long as the code itself doesn't have some huge memory bomb, I've never seen any gradual degradation or memory hogging. Be mindful of anything in the global or class scopes, because they'll live on, so use del mor... | 2 | 18 | 0 | I have to write a daemon program that constantly runs in the background and performs some simple tasks. The logic is not complicated at all, however it has to run for extended periods of time and be stable.
I think C++ would be a good choice for writing this kind of application, however I'm also considering Python sin... | Is writing a daemon in Python a good idea? | 1.2 | 0 | 0 | 2,480 |
9,780,717 | 2012-03-20T02:43:00.000 | 2 | 0 | 1 | 1 | python,macos,pip,python-2.6 | 40,450,261 | 36 | false | 0 | 0 | (Context: My OS is Amazon linux using AWS. It seems similar to RedHat but it's stripped down a bit, it seems.)
Exit the shell, then open a new shell. The pip command now works.
That's what solved the problem at this location.
You might want to know as well: The pip commands to install software then needed to be writte... | 10 | 580 | 0 | I downloaded pip and ran python setup.py install and everything worked just fine. The very next step in the tutorial is to run pip install <lib you want> but before it even tries to find anything online I get an error "bash: pip: command not found".
This is on Mac OS X, which I'm new to, so I'm assuming there's some ki... | bash: pip: command not found | 0.011111 | 0 | 0 | 1,748,193 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.