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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,427,875 | 2011-03-25T02:21:00.000 | 2 | 0 | 0 | 0 | python,macos,tkinter,exit | 5,427,950 | 1 | false | 0 | 1 | I figured out how. I just put a simple exit() command after the main loop. | 1 | 2 | 0 | I need to know how to do this on a mac because whenever I try quitting it, I have to force quit it. Is there a proper way when the user clicks the exit button that Tkinter will exit normally? | Python: How can I make my tkinter app exit properly? | 0.379949 | 0 | 0 | 888 |
5,428,298 | 2011-03-25T03:39:00.000 | 2 | 1 | 0 | 0 | c#,ironpython | 5,439,443 | 1 | true | 0 | 0 | If the XML file is in the same location as the assembly and has the same filename just with ".xml" instead of ".exe" or ".dll" then IronPython should pick it up and include it in relevant doc strings for types, methods, etc... | 1 | 4 | 0 | I have a C# module which can be imported into IronPython (well, technically the all can, but one that's meant to be imported). However, the default help used for C# modules by IronPython just isn't sufficient enough.
Is there a way to grab and attach the VS exported xml documentation to a C# module with IronPython's he... | IronPython use C# module documentation | 1.2 | 0 | 0 | 547 |
5,430,272 | 2011-03-25T08:49:00.000 | 1 | 0 | 1 | 0 | python,wxpython,filedialog | 5,437,736 | 1 | false | 0 | 0 | You might be able to use the wx.GenericDirCtrl for this, although it's a little ugly. There's also the pure python MultiDirDialog widget which can be found in wx.lib.agw.multidirdialog. While it doesn't appear to support the display and selection of files now, since it's pure Python, you can probably hack it. | 1 | 0 | 0 | is it somehow possible to open a file (instead of a directory) with Python's DirSelector. It's also fine to make a wx.FileSelector to open also a directory.
I just need one dialog window to open both, files and directories. | Open file with Python DirSelector | 0.197375 | 0 | 0 | 1,678 |
5,430,388 | 2011-03-25T09:01:00.000 | 4 | 0 | 1 | 0 | python,exception | 5,430,438 | 4 | false | 0 | 0 | TypeError is most appropriate - this is what you get usually. | 1 | 1 | 0 | If I have a python function with 2 optional parameters (for search criteria) but no one is provided (I need at least one parameter) what is the right exception to throw?
What if I only one of two parameters have to be passed? What exception to throw if two are provided? Or may be create two distinct functions? | What exception to throw? (Python) | 0.197375 | 0 | 0 | 1,341 |
5,430,652 | 2011-03-25T09:31:00.000 | 0 | 0 | 0 | 0 | python-3.x,mysql-python | 5,430,722 | 1 | false | 0 | 0 | To be honest, I haven't used mysqldb in python in a very long time.
That being said, I would suggest using an execute("now()") (or "select 1", any other "dummy" SQL command) and handle any errors.
edit: That should also probably be part of a class you're using. Don't fill your entire project with .execute("now()") on ... | 1 | 0 | 0 | I using MySQLdb for access to mysql database from python. I need to know if connection with database is still alive... are there any attribute or method in order to do this???
thanks!! | Verify the connection with MySQL database | 0 | 1 | 0 | 146 |
5,431,887 | 2011-03-25T11:37:00.000 | 2 | 1 | 0 | 0 | php,python | 5,433,000 | 1 | false | 1 | 0 | I'm not familiar with Pyke; but when this type of situation arises for me, I usually end up wrapping the Python code with a web-service. I then use PHP to make SOAP or cURL calls to the webservice. | 1 | 4 | 0 | I am facing a problem here which I could not find a good solution for it. I am developing a mobile web app using php and I need a rule based inference engine (open source) - expert system. The only one I could find was Pyke in Python. So I need to integrate Pykes' source code with my php implementation. My service prov... | Python PHP Integration | 0.379949 | 0 | 0 | 1,667 |
5,431,958 | 2011-03-25T11:44:00.000 | 1 | 1 | 0 | 0 | python,apache,mod-wsgi,soappy | 5,432,043 | 1 | true | 1 | 0 | No. SOAPpy has its own HTTP server based on BaseHTTPServer which means that it is not possible to turn it into a WSGI app without a non-trivial amount of hacking. | 1 | 0 | 0 | Is it possible to run webservice based on SOAPpy with mod_wsgi under Apache?
if yes can you post link to sample(example)? | Is it possible to run webservice based on SOAPpy with mod_wsgi under Apache? | 1.2 | 0 | 0 | 227 |
5,432,871 | 2011-03-25T13:12:00.000 | 0 | 0 | 1 | 0 | python,user-interface,toolkit | 5,432,925 | 4 | false | 0 | 1 | I've used PyQt together with Qt Designer, nice documentation and cross platform support. | 1 | 3 | 0 | I am looking for a GUI toolkit which also has a good designer (like visual studio) for Python language.
It should have
...Good Documentation
...Good IDE + Designer
...Cross Platform Support (if possible) | GUI Toolkit with Good Designer for Python | 0 | 0 | 0 | 1,203 |
5,434,520 | 2011-03-25T15:24:00.000 | 2 | 0 | 0 | 0 | python,load | 5,434,558 | 2 | false | 0 | 0 | urllib and urllib2 will let you load the raw HTML. HTML parsers such as BeautifulSoup and lxml will let you parse the raw HTML so you can get at the sections you care about. Template engines such as Mako, Cheetah, etc. will let you generate HTML so that you can have web pages to display. | 1 | 1 | 0 | How can i load a specific content from a website through python?For example,i want to load some posts of a blog and appear them to my own site.How can i do this? | Load website's content through python | 0.197375 | 0 | 1 | 4,342 |
5,435,169 | 2011-03-25T16:20:00.000 | 1 | 0 | 0 | 0 | python,django,json,database-design | 5,435,451 | 1 | false | 1 | 0 | Man, what I think you can do is convert the classes you already have made into django model classes. Of course, only the ones that need to be saved to a database. The other classes, as the rest of the code, I recommend you to encapsulate them for use as helper functions. So you don't have to change too much your code a... | 1 | 0 | 0 | I've got a Python program with about a dozen classes, with several classes possessing instances of other classes, e.g. ObjectA has a list of ObjectB's, and a dictionary of (ObjectC, ObjectD) pairs.
My goal is to put the program's functionality on a website.
I've written and tested JSON encode and decode methods for eac... | Converting Python App into Django | 0.197375 | 0 | 0 | 753 |
5,435,367 | 2011-03-25T16:36:00.000 | 0 | 0 | 1 | 0 | python | 5,435,597 | 6 | false | 0 | 0 | Sounds like homework involving searching algorithms or something, but I'll give you a start.
One solution might be to index the file (if this can be done in a reasonable time) into a tree structure with each character representing a node value and each child being all subsequent characters. You could then traverse th... | 1 | 0 | 0 | I have a file dict.txt that has all words in the English language.
The user will input their word:
x = raw_input("Enter partial word: ")
Example inputs would be: r-n, --n, -u-, he--o, h-llo and so on, unknown characters would be specified by a underscore preferably instead of (-).
I want the program to come up with a l... | Best matches for a partially specified word in Python | 0 | 0 | 0 | 652 |
5,436,185 | 2011-03-25T17:49:00.000 | 2 | 0 | 0 | 0 | python,url,ipv6,libpcap,sniffing | 5,446,765 | 1 | true | 0 | 0 | Unfortunately, with IPv6 you are stuck doing your own TCP re-assembly. The good news that you are only concerned with URL data which should (generally) be in one or two packets.
You should be able to get away with using pylibpcap to do this. You'll want to use setfilter on your pcap object to make sure you are only lo... | 1 | 5 | 0 | Does anyone know how to write a live data sniffer in Python which extracts the originating IP address and the full URL that was being accessed? I have looked at pulling data from urlsnarf however IPv6 is not supported (and the connections will be to IPv6 hosts).
While I can pull data from tcpdump and greping for GET/PO... | URL Sniffing in Python | 1.2 | 0 | 1 | 1,843 |
5,436,249 | 2011-03-25T17:54:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 5,436,314 | 2 | false | 1 | 0 | Assuming Google has, and routes to, Datacenters in Asia, the latency should be reasonable.
The reverse proxy to avoid the firewall should be in a country that does not censor and is as near as possible to the target area.
In those conditions, google would choose a datacenter near your reverse proxy, and the latency is ... | 1 | 2 | 0 | China blocks appspot -- How do I get around this?
Assuming the censorship was not an issue, how bad are the latency issues? | How do I make my website on Google App Engine accessible to visitors in China? | 0.099668 | 0 | 0 | 534 |
5,436,420 | 2011-03-25T18:13:00.000 | 0 | 0 | 1 | 0 | python,string,eval,tuples | 5,436,872 | 2 | false | 0 | 0 | If the tuple inside the string can only have simple numbers, then use a regex. If the tuple members can be arbitrarily complex (such as nested lists), use eval. | 1 | 1 | 0 | I need a clean way to determine if a string is actually a tuple, like so:
'(123,456)' --> True
'hello world' --> False
I can think of two ways to do this:
a regex
call eval and catch/ignore a SyntaxError
I don't like the second option. I'm fine with the first option but just wanted to know if there was a better way ... | python: How to determine if a string contains a tuple? | 0 | 0 | 0 | 381 |
5,441,522 | 2011-03-26T09:42:00.000 | -2 | 0 | 1 | 0 | python,multithreading,thread-safety | 5,441,655 | 2 | false | 0 | 0 | I am not really familiar with python, but can't you use Semaphores / Monitors for atomic insurance? | 2 | 2 | 0 | import os, sys, time
from threading import Thread
from threading import currentThread
import SimpleXMLRPCServer
servAddr = ("localhost", 8000)
serv = SimpleXMLRPCServer.SimpleXMLRPCServer(servAddr)
tt = []
import SimpleXMLRPCServer
class myThread(Thread):
def __init__ (self,p):
self.p = p
Thr... | How to make this script "thread-safe"? | -0.197375 | 0 | 0 | 747 |
5,441,522 | 2011-03-26T09:42:00.000 | 2 | 0 | 1 | 0 | python,multithreading,thread-safety | 5,441,669 | 2 | false | 0 | 0 | Python objects like dict are already thread safe, so in that sense your script is already thread safe. What other specific thing you want to make thread safe, at-least for now it looks ok | 2 | 2 | 0 | import os, sys, time
from threading import Thread
from threading import currentThread
import SimpleXMLRPCServer
servAddr = ("localhost", 8000)
serv = SimpleXMLRPCServer.SimpleXMLRPCServer(servAddr)
tt = []
import SimpleXMLRPCServer
class myThread(Thread):
def __init__ (self,p):
self.p = p
Thr... | How to make this script "thread-safe"? | 0.197375 | 0 | 0 | 747 |
5,442,825 | 2011-03-26T14:05:00.000 | 1 | 0 | 0 | 0 | python,sql,sqlalchemy | 5,469,880 | 3 | false | 0 | 0 | Session.merge() works fine for both new and existing object. But you have to remember, that merge() returns object bound to the session as opposed to add() (and save_or_update() in old versions) which puts object passed as argument into the session. This behavior is required to insure there is a single object for each ... | 2 | 2 | 0 | save_or_update has been removed in 0.6. Are there alternatives to use them in 0.6 and above?
I noticed the existence of the method _save_or_update_state for session objects, but there are no docs on this method. | save_or_update using SQLalchemy 0.6 | 0.066568 | 1 | 0 | 4,986 |
5,442,825 | 2011-03-26T14:05:00.000 | -1 | 0 | 0 | 0 | python,sql,sqlalchemy | 11,861,997 | 3 | false | 0 | 0 | session.merge() will not work if you have your db setup as a master-slave, where you typically want to query from the slave, but write to the master. I have such a setup, and ended up re-querying from the master just before the writing, then using a session.add() if the data is indeed not there on the master. | 2 | 2 | 0 | save_or_update has been removed in 0.6. Are there alternatives to use them in 0.6 and above?
I noticed the existence of the method _save_or_update_state for session objects, but there are no docs on this method. | save_or_update using SQLalchemy 0.6 | -0.066568 | 1 | 0 | 4,986 |
5,444,023 | 2011-03-26T17:39:00.000 | 0 | 0 | 1 | 0 | python,binaryfiles,binary-data | 5,444,094 | 6 | false | 0 | 0 | I recommend using the codecs module of Python for writing text files (it allows you to set the related charset/encoding). For writing binary file use the standard file() method. On windows you may need use 'wb' or 'rb' for binary modes (does not matter on Unix). | 3 | 8 | 0 | I am a beginner and I am having trouble in grasping binary files. When I write to a file in binary mode (in python), I just write normal text. There is nothing binary about it. I know every file on my computer is a binary file but I am having trouble distinguishing between files written in binary mode by me and files l... | General question about Binary files | 0 | 0 | 0 | 2,122 |
5,444,023 | 2011-03-26T17:39:00.000 | 3 | 0 | 1 | 0 | python,binaryfiles,binary-data | 5,444,192 | 6 | false | 0 | 0 | So-called "text" files are simply files that follow certain conventions: the bytes are usually a subset of all the possible bytes, generally ASCII or Unicode values, and are organized into "lines" with "line terminators". The standard line terminators vary by platform - Unix uses \n, Mac \r, and Windows \r\n - so part ... | 3 | 8 | 0 | I am a beginner and I am having trouble in grasping binary files. When I write to a file in binary mode (in python), I just write normal text. There is nothing binary about it. I know every file on my computer is a binary file but I am having trouble distinguishing between files written in binary mode by me and files l... | General question about Binary files | 0.099668 | 0 | 0 | 2,122 |
5,444,023 | 2011-03-26T17:39:00.000 | 0 | 0 | 1 | 0 | python,binaryfiles,binary-data | 5,444,091 | 6 | false | 0 | 0 | Maybe your are sending string in your binary file and your computer can decode it and show it to you? Try to write a file with random byte. Or you could show us your code so we can understand the problem. | 3 | 8 | 0 | I am a beginner and I am having trouble in grasping binary files. When I write to a file in binary mode (in python), I just write normal text. There is nothing binary about it. I know every file on my computer is a binary file but I am having trouble distinguishing between files written in binary mode by me and files l... | General question about Binary files | 0 | 0 | 0 | 2,122 |
5,444,445 | 2011-03-26T18:45:00.000 | 1 | 1 | 0 | 0 | python,web.py | 12,962,245 | 2 | false | 1 | 0 | Combining web.py and PHP doesn't really make sense. But you can definitely set up Apache to have both. You just install mod_php and mod_wsgi. Point mod_wsgi to your web.py WSGI function, and set up your PHP web app in some directory where Apache can find it. You won't be combining the two technologies, but you will... | 1 | 1 | 0 | I normally web develop in PHP. I am working on a python based project, and want to make a front-end web site for it.
I looked at web.py, and I was wondering if PHP can be used together with web.py, or would I have to rely completely on python as the server side scripting?
Thanks. | How to run PHP and Web.py together | 0.099668 | 0 | 0 | 915 |
5,444,798 | 2011-03-26T19:35:00.000 | 2 | 0 | 0 | 1 | python,web2py | 5,444,972 | 3 | false | 1 | 0 | No, there is a Windows installer. | 1 | 2 | 0 | I recall setting up other frameworks in a Windows environment were extremely painful :) | Is there a difference between developing a web2py app on Windows or Linux? | 0.132549 | 0 | 0 | 1,990 |
5,444,810 | 2011-03-26T19:39:00.000 | 1 | 0 | 1 | 0 | python,windows,regex,string,validation | 5,444,908 | 3 | false | 0 | 0 | In posix, only two octets are reserved, forward slash (/, 0x2F, dec 42), and null (\0, 0x00, dec 0). Any other character could appear in a filename. | 1 | 1 | 0 | I would like to save a file with the name that has the most valid characters remaining intact, f.e. if I get supplied the filename:
>This\ Ăwesomé_Song?©.mp3
and I want to save it under Windows 7, it won't let me save it until I remove >, \ and ?. The characters Ă, © and é are totally fine and I would like to keep the... | How to remove unsafe characters to save file | 0.066568 | 0 | 0 | 2,364 |
5,445,166 | 2011-03-26T20:41:00.000 | 2 | 0 | 0 | 0 | javascript,python,game-engine | 5,445,501 | 3 | true | 1 | 1 | For the requirements that you have Unity3d is probably one of your best bets. As roy said there aren't any other 3D engines out there that will span that wide a range of platforms. Why do you think that going to a completely code based system would save you from creating a variety of classes with various responsibiliti... | 2 | 0 | 0 | I am developing a 3d shooter game that I would like to run on Computers/Phones/Tablets and would like some help to choose which engine to use.
I would like to write the application once and port it over to Android/iOS/windows/mac with ease.
I would like to make the application streamable over the internet.
The engine... | 3d game engine suggestions | 1.2 | 0 | 0 | 1,543 |
5,445,166 | 2011-03-26T20:41:00.000 | 0 | 0 | 0 | 0 | javascript,python,game-engine | 5,445,300 | 3 | false | 1 | 1 | Well I see you've checked Unity3D already, but I can't think of any other engines work on PC, Telephones and via streaming internet that suport 3D (for 2D check EXEN or any others).
I'm also pretty sure that you can use Unity code-based, and it supports a couple of different languages, but for Unity to work you can't ... | 2 | 0 | 0 | I am developing a 3d shooter game that I would like to run on Computers/Phones/Tablets and would like some help to choose which engine to use.
I would like to write the application once and port it over to Android/iOS/windows/mac with ease.
I would like to make the application streamable over the internet.
The engine... | 3d game engine suggestions | 0 | 0 | 0 | 1,543 |
5,445,777 | 2011-03-26T22:30:00.000 | 6 | 0 | 1 | 0 | python,arrays,list | 5,445,784 | 3 | true | 0 | 0 | The arrays will take less space.
I've never used the array module, numpy provides the same benefits plus many many more. | 2 | 1 | 0 | What is the main advantage of using the array module instead of lists? | Python Arrays vs Lists | 1.2 | 0 | 0 | 1,097 |
5,445,777 | 2011-03-26T22:30:00.000 | 0 | 0 | 1 | 0 | python,arrays,list | 5,446,375 | 3 | false | 0 | 0 | Arrays can be very useful if you want to strictly type the data in your collection. Notwithstanding performance it can be quite convenient to be sure of the data types contained within your data structure. However, arrays don't feel very 'pythonic' to me (though I must stress this is only personal preference). Unless ... | 2 | 1 | 0 | What is the main advantage of using the array module instead of lists? | Python Arrays vs Lists | 0 | 0 | 0 | 1,097 |
5,445,994 | 2011-03-26T23:07:00.000 | 6 | 0 | 0 | 0 | python,regex,django | 5,446,040 | 4 | false | 1 | 0 | Don't ever send passwords in the URL. They belong in the POST body, which is not stored by browsers (you can repeat POSTs in browsers, but POST data is not stored in the history). | 1 | 0 | 0 | I want to match a url that:
begins with /signup
and ends with password=goodbye
That's it. If something begins with that and ends with that, how do I match that in regex?
I understand that I should do this in urls.py, but I have to because of certain reasons.
Please answer how I would match it this way. I have to becaus... | How do I match this URL in Django's urls.py? | 1 | 0 | 0 | 1,876 |
5,446,816 | 2011-03-27T02:23:00.000 | 2 | 1 | 0 | 0 | python,opengl,python-imaging-library,gpu | 5,446,952 | 1 | true | 0 | 1 | "Draw some simple lines on top of the .png" is not a computationally intensive task.
This doesn't seems to be a good candidate for the GPU since they are better suited for more complex tasks. You've got to realize that the image is initially loaded on the RAM, making it your job to send this data to the GPU memory and... | 1 | 0 | 0 | I have some .png images and I want to be able to quickly:
(a) Load a .png from a file.
(b) Draw some simple lines on top of the .png.
(c) Get the contents (bytes) of the resulting image to return as the result of an http request.
It sounds like PIL is a good candidate for doing this with relatively little code. However... | How fast is Python Image Library's (PIL) ImageDraw Module, for instance as compared to OpenGL? | 1.2 | 0 | 0 | 2,486 |
5,447,104 | 2011-03-27T03:56:00.000 | 0 | 0 | 0 | 0 | c++,python | 5,447,117 | 2 | false | 0 | 0 | Matrix manipulation is in NumPy. Everything else listed in in the standard library. You may want to look into something like Twisted in order to mediate the network access though. | 1 | 0 | 0 | I am working on a client-server simulation software. And I want the client to be implemented on the web, and also require that the client can do computations like matrix multiplication, random number generation etc., which framework can I use? And also I hope that the client side and server side communicate using simpl... | Python web client programming library | 0 | 0 | 1 | 396 |
5,447,482 | 2011-03-27T05:42:00.000 | 0 | 1 | 1 | 0 | php,python,debugging | 5,447,505 | 5 | false | 0 | 0 | Python has a debugger: pdb. If you use Werkzeug, then you can also access each frame of a stack trace and debug there on an error | 3 | 0 | 0 | I am quite new with development. In some programming language such as python and PHP there is not a good debugger. How is the development going on without a debugger? just put the logs in the source code? Especially for the framework developers, how do they test their codes?
Thank you very much.
-Stefan- | How a framework development works without a debugger? | 0 | 0 | 0 | 94 |
5,447,482 | 2011-03-27T05:42:00.000 | 2 | 1 | 1 | 0 | php,python,debugging | 5,447,522 | 5 | false | 0 | 0 | Your answer concerning the debugging in Python is truly nonsense. Python has a reasonable "pdb" debugger which is useful since years. Apart from that you can have a powerful IDE as WingIDE giving you all debugging and inspection power you need. Making such wild claims about Python is not appropriate. That's why this qu... | 3 | 0 | 0 | I am quite new with development. In some programming language such as python and PHP there is not a good debugger. How is the development going on without a debugger? just put the logs in the source code? Especially for the framework developers, how do they test their codes?
Thank you very much.
-Stefan- | How a framework development works without a debugger? | 0.07983 | 0 | 0 | 94 |
5,447,482 | 2011-03-27T05:42:00.000 | 0 | 1 | 1 | 0 | php,python,debugging | 5,452,043 | 5 | false | 0 | 0 | python -m pdb foo.py
And even without using that, usually you get detailed tracebacks when an error happens so many people don't know about pdb because they can just read the error message containing everything they ever wanted to know. It's not like C where it just goes boom and says "Segmentation fault" and leaves yo... | 3 | 0 | 0 | I am quite new with development. In some programming language such as python and PHP there is not a good debugger. How is the development going on without a debugger? just put the logs in the source code? Especially for the framework developers, how do they test their codes?
Thank you very much.
-Stefan- | How a framework development works without a debugger? | 0 | 0 | 0 | 94 |
5,447,631 | 2011-03-27T06:30:00.000 | 5 | 0 | 0 | 1 | python,google-app-engine,rtmp | 5,450,822 | 2 | false | 1 | 0 | Google App Engine is tricky for RTMP because it does not support sockets. You would have to use something like RTMPT which is tunneled over HTTP, however, this tunneling incurs latency so if you are looking to do anything realtime this could become an issue.
Currently rtmplite does not support RTMPT so this would not b... | 2 | 3 | 0 | I am in the process of building a Google App Engine application which requires audio to be recorded and saved in our database. I have found no alternative to using some form of RTMP server for recording audio through flash, so [rtmplite] (http://code.google.com/p/rtmplite/) came into our horizon.
Since I have no experi... | Record audio in Google App Engine using rtmplite? | 0.462117 | 0 | 0 | 981 |
5,447,631 | 2011-03-27T06:30:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,rtmp | 6,433,502 | 2 | false | 1 | 0 | Try appengine backends, they currently don't whitelist a lot of things required for such streaming. But they might soon do so. Once they enable sockets, then rtmplite or rtmpy could easily be ported to run there. Backends already support unlimited request length which is required for streaming. | 2 | 3 | 0 | I am in the process of building a Google App Engine application which requires audio to be recorded and saved in our database. I have found no alternative to using some form of RTMP server for recording audio through flash, so [rtmplite] (http://code.google.com/p/rtmplite/) came into our horizon.
Since I have no experi... | Record audio in Google App Engine using rtmplite? | 0 | 0 | 0 | 981 |
5,448,257 | 2011-03-27T09:11:00.000 | 0 | 1 | 0 | 0 | python,c,swig | 5,521,222 | 2 | false | 0 | 1 | Take a look at Chapter 4 in C Interfaces and Implementations by Richard R. Hanson. | 1 | 4 | 0 | I have recently converted a library, I originally wrote in C++ with Boost Python wrapping, to C with SWIG wrapping to support more languages.
I switched from C++ to C because the library consists only of a set of functions and I also want the library to be callable from C (without having to compile the whole program wi... | Most elegant way for SWIG wrapped C library to raise exceptions | 0 | 0 | 0 | 1,235 |
5,448,698 | 2011-03-27T10:38:00.000 | 6 | 0 | 0 | 1 | python,google-app-engine,sendmail | 5,450,093 | 1 | true | 1 | 0 | You can't. Sending email from someone without their knowledge isn't permitted by App Engine.
You can send email from any administrator address; you could add a "donotreply@yourapp.com" type address as an administrator and send email from that address. | 1 | 3 | 0 | I'm using GAE send mail- but I dont want the sender of the mail to get a coppy of the mail.
as for now, when a user is sending mail he gets a mail saying that he sent a mail to someone and the body of the sent mail, how do I disable that? | how to have google apps engine send mail- not send a copy of the mail to the sender | 1.2 | 0 | 0 | 288 |
5,448,766 | 2011-03-27T10:53:00.000 | 1 | 0 | 1 | 0 | python,delete-file,termination | 5,448,796 | 4 | false | 0 | 0 | Python offers support for tempfiles (see module of the same name). These may not be guaranteed to be deleted when the program terminates, but the OS knows that they can be deleted without notice whenever desired (e.g. on some Unixes, every night). | 1 | 1 | 0 | My script creates files to store data for the duration of its run time, I would like to delete these files on termination of my program. Is this possible?
I DO NOT want suggestions for a work around ... like 'don't create files'.
Much appreciated! | Trigger code on program termination | 0.049958 | 0 | 0 | 1,225 |
5,448,867 | 2011-03-27T11:18:00.000 | 1 | 0 | 1 | 0 | python,string,floating-point,numbers,format | 5,448,903 | 3 | false | 0 | 0 | If you use integers, Python assumes you really mean them to be integers and does integer math. If you use floats, it will do floating point math.
Try something like this to get floating point output:
print 3/4.0 | 2 | 1 | 0 | How can I print the following lines of code but get a floating point number of of it instead of a rounded int?
print "Math Question: ", 100 - 25 * 3 % 4
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 | Printing floating point number in python | 0.066568 | 0 | 0 | 1,996 |
5,448,867 | 2011-03-27T11:18:00.000 | 3 | 0 | 1 | 0 | python,string,floating-point,numbers,format | 5,448,894 | 3 | true | 0 | 0 | Division with / in 2.x results in a integer if both operands are integers. Either cast one of the operands to a float first, or from __future__ import division. | 2 | 1 | 0 | How can I print the following lines of code but get a floating point number of of it instead of a rounded int?
print "Math Question: ", 100 - 25 * 3 % 4
print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 | Printing floating point number in python | 1.2 | 0 | 0 | 1,996 |
5,449,084 | 2011-03-27T12:03:00.000 | 0 | 1 | 0 | 0 | python,email,unicode,gmail,decode | 5,449,108 | 1 | true | 0 | 0 | Use the 'email' module of Python in order to generate proper formatted emails.
Dealing yourself with encoding issues on the application level while composing emails directly through Python is not the way to go. | 1 | 0 | 0 | I am trying to send an email (through gmail) using python script that someone once wrote on this site, but I'm getting an error:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe8 in position 2: invalid continuation byte
the script:
import smtplib
from email.mime.text import MIMEText
#mail setup
FROMMAIL = "xxx@... | Python : sending mail through gmail issue | 1.2 | 0 | 1 | 548 |
5,449,091 | 2011-03-27T12:05:00.000 | 0 | 1 | 0 | 0 | python,twitter | 16,450,651 | 4 | false | 0 | 0 | The newest version of python-twitter allows you to retweet with the command
api.PostRetweet(tweet_id)
where api is a logged-in api and tweet_id is the id of the tweet you want to retweet. | 1 | 4 | 0 | I wanted to know if this was possible- I want to use Python to retweet every tweet a person sends out. If yes then how can I implement this? | Sending out twitter retweets with Python | 0 | 0 | 1 | 4,449 |
5,449,207 | 2011-03-27T12:28:00.000 | 2 | 0 | 0 | 1 | python,map,vim | 5,449,239 | 2 | true | 0 | 0 | I suspect that you have something before map: <buffer> argument means that mapping is defined for current buffer only, so adding it to vimrc without something like autocmd FileType python before it is weird. Maybe it is the reason why it does not work: you somehow switch to another buffer before testing this mapping.
S... | 2 | 0 | 0 | grr. I'm struggling with Vim's learning curve.
And trying to get a simple mapping in my vimrc to execute the current buffer's python script.
The mapping is well-formed and works after I enter it into the command line in Vim. This is the mapping:
map <buffer> <S-e> :w<CR>:!usr/bin/env python % <CR>
But it won't ... | vimrc mapping problem; execute python script mapping not working from vimrc | 1.2 | 0 | 0 | 764 |
5,449,207 | 2011-03-27T12:28:00.000 | 0 | 0 | 0 | 1 | python,map,vim | 5,449,247 | 2 | false | 0 | 0 | Jesus, Murphy's Law.
After searching for an answer for an hour, 1 min after posting this q I solved it. The problem was <buffer> in the mapping.
Removing it made the mapping work, thus:
nnoremap E w:<CR>:!python % <CR> | 2 | 0 | 0 | grr. I'm struggling with Vim's learning curve.
And trying to get a simple mapping in my vimrc to execute the current buffer's python script.
The mapping is well-formed and works after I enter it into the command line in Vim. This is the mapping:
map <buffer> <S-e> :w<CR>:!usr/bin/env python % <CR>
But it won't ... | vimrc mapping problem; execute python script mapping not working from vimrc | 0 | 0 | 0 | 764 |
5,450,881 | 2011-03-27T17:19:00.000 | 0 | 0 | 0 | 0 | python,django,django-models | 5,450,932 | 2 | false | 1 | 0 | Create and add items to the model before saving. | 2 | 2 | 0 | I have a little project I am working. I am writing django database to hold some data. I have one ManyToManyField.
I am using my own Manager and adding methods for convience. I have one that adds different tasks to the users to do list. These items can be assigned to many people and so on.
When I do this I am getting ... | Django IntegrityError | 0 | 0 | 0 | 2,397 |
5,450,881 | 2011-03-27T17:19:00.000 | 3 | 0 | 0 | 0 | python,django,django-models | 5,970,201 | 2 | true | 1 | 0 | Turns out all I needed to do was clean out my database with a python manage.py sqlflush Everything was fine afterwards. I then added south to help with migrations in the future.
I would advise caution since sqlflush will return your database to back the state of the last syncdb. | 2 | 2 | 0 | I have a little project I am working. I am writing django database to hold some data. I have one ManyToManyField.
I am using my own Manager and adding methods for convience. I have one that adds different tasks to the users to do list. These items can be assigned to many people and so on.
When I do this I am getting ... | Django IntegrityError | 1.2 | 0 | 0 | 2,397 |
5,451,246 | 2011-03-27T18:16:00.000 | 0 | 1 | 0 | 0 | python,django,compiler-construction,comparison,benchmarking | 5,497,595 | 2 | false | 1 | 0 | One thing you should considerate is the C extensions. Different implementations require different extension ways. At present, the CTYPES may be the most common one.
So I recommend you take CPython, in case of possible C extensions. | 1 | 3 | 0 | Has anyone tried to compare those python implementations?
pypy
psyco
unladen swallow (is it dead?)
cpython
I am planning to squeeze something more from my server.
Setup:
Django 1.3
Python 2.7
Psycopg2 1.4
apache 2
mod_wsgi
and... Windows server
I am not a windows fanboy, but it has to be :{ There is some legacy cod... | django: on pypy, psyco, unladen swallow or cpython, which one is the fastest? | 0 | 0 | 0 | 611 |
5,453,101 | 2011-03-27T23:05:00.000 | 2 | 0 | 0 | 1 | python,linux,binary,atomic | 5,453,629 | 3 | false | 0 | 0 | Do what the RDBMS engines do.
Write an "update sequence number" in each file.
You cannot ever guarantee that both files are written.
However, you can compare the update sequence numbers to see if the files have the same sequence number.
If the sequence numbers disagree, it's logically equivalent to no file having been... | 1 | 3 | 0 | I have two binary files that are related one to another (meaning, when one file's records are updated, the other file's matching records should be updated as well). both files are binary files stored on disk.
The updation will look something like this:
UpdateFirstFile() -- first file is updated.....
UpdateSecondFile() ... | Update Two Related Files On Disk In a "Secure" Way? | 0.132549 | 0 | 0 | 90 |
5,453,256 | 2011-03-27T23:36:00.000 | 0 | 0 | 0 | 0 | python,tkinter,pyusb | 5,489,197 | 2 | false | 0 | 1 | Might I suggest that instead of trying to constantly monitor the presence of a USB device you include a search or refresh button that will check just once. | 1 | 2 | 0 | I would like to monitor the presence of USB devices and have found modules such as PyUSB that serve this purpose. However, I don't know how to run USB detection services alongside the Tkinter main loop. Is this possible? | Tkinter and detection of USB devices | 0 | 0 | 0 | 874 |
5,453,267 | 2011-03-27T23:39:00.000 | 8 | 0 | 1 | 0 | python,file-io | 5,453,315 | 5 | false | 0 | 0 | No. You cannot safely write to a file you are also reading, as any changes you make to the file could overwrite content you have not read yet. To do it safely you'd have to read the file into a buffer, updating any lines as required, and then re-write the file.
If you're replacing byte-for-byte the content in the file ... | 1 | 79 | 0 | Is it possible to parse a file line by line, and edit a line in-place while going through the lines? | Is it possible to modify lines in a file in-place? | 1 | 0 | 0 | 63,119 |
5,457,644 | 2011-03-28T10:28:00.000 | 2 | 0 | 0 | 0 | python,user-interface,wxpython | 5,458,130 | 3 | false | 0 | 1 | It seems there are better ways to do this, but panel.Layout() solved the problem for now. :) | 3 | 2 | 0 | I am trying to make several different pages where I need to show different texts and buttons.
What I did was I created a panel, and then several sizers on it, and then in the next page, I destroyed the panel and recreated the panel again with different contents/sizers.
It worked well in Linux, but when I tried the same... | wxPython panel redraw in windows | 0.132549 | 0 | 0 | 3,727 |
5,457,644 | 2011-03-28T10:28:00.000 | 3 | 0 | 0 | 0 | python,user-interface,wxpython | 5,460,406 | 3 | true | 0 | 1 | Calling Layout on the widget's parent is the best way to do this is you are adding or destroying widgets. Sometimes you also need to call Refresh() to make it redraw too, although that might only be required when you're using Freeze/Thaw. | 3 | 2 | 0 | I am trying to make several different pages where I need to show different texts and buttons.
What I did was I created a panel, and then several sizers on it, and then in the next page, I destroyed the panel and recreated the panel again with different contents/sizers.
It worked well in Linux, but when I tried the same... | wxPython panel redraw in windows | 1.2 | 0 | 0 | 3,727 |
5,457,644 | 2011-03-28T10:28:00.000 | 1 | 0 | 0 | 0 | python,user-interface,wxpython | 5,461,786 | 3 | false | 0 | 1 | I agree with using Layout(), but might I suggest just hiding the unused panel instead of destroying it? Using the Show()/Hide() functions of the sizer, you can add both side-by-side and just hide the unused panel instead of destryong it and recreating it each time? | 3 | 2 | 0 | I am trying to make several different pages where I need to show different texts and buttons.
What I did was I created a panel, and then several sizers on it, and then in the next page, I destroyed the panel and recreated the panel again with different contents/sizers.
It worked well in Linux, but when I tried the same... | wxPython panel redraw in windows | 0.066568 | 0 | 0 | 3,727 |
5,459,896 | 2011-03-28T13:46:00.000 | 0 | 1 | 0 | 0 | php,python,html,ruby | 5,460,038 | 5 | false | 0 | 0 | PhpBB is an excellent. It's very easy to set up and has many great features, but it is more difficult to customize right out of the box. For a superfast "community" solution, try using WordPress with the BuddyPress plugin. | 1 | 1 | 0 | Looking for a low volume, probably no more that 20-30 users, Open Source message/bulletin board. Obviously must be written in something which our web server supports, PHP/Python/Ruby etc. Any suggestions?
Thanks,
Nick | Low volume Open source Message Board suggestions? | 0 | 0 | 0 | 462 |
5,462,635 | 2011-03-28T17:21:00.000 | 1 | 0 | 1 | 0 | python | 5,463,687 | 4 | false | 1 | 0 | Best of my recollection Django's models include save() and delete() methods so you can deal exclusively with objects, rather than interacting with a database connection object. I don't know that it's instantly a Python way of doing things, but I'm pretty sure it's a pervasive Django pattern.
If I was told "this is Djan... | 3 | 8 | 0 | I am a seasoned .Net developer who's trying to write some Python code. On one of the projects I am contributing to, we have a services layer which is a set of classes which abstract away functionality and a django web app which consumes these in process services (which are just classes).
I had created a repository laye... | Python, beginner's question! Repository or Object persisting itself? | 0.049958 | 0 | 0 | 2,180 |
5,462,635 | 2011-03-28T17:21:00.000 | 3 | 0 | 1 | 0 | python | 5,522,389 | 4 | false | 1 | 0 | Maybe that is a Django pattern, but not a Python one by all means.
That said, if the target audience of your module are Django developers, I would advise you to follow as much as possible the Django philosophy and its associated patterns. | 3 | 8 | 0 | I am a seasoned .Net developer who's trying to write some Python code. On one of the projects I am contributing to, we have a services layer which is a set of classes which abstract away functionality and a django web app which consumes these in process services (which are just classes).
I had created a repository laye... | Python, beginner's question! Repository or Object persisting itself? | 0.148885 | 0 | 0 | 2,180 |
5,462,635 | 2011-03-28T17:21:00.000 | 2 | 0 | 1 | 0 | python | 6,884,336 | 4 | false | 1 | 0 | Django's ORM provides save() and delete() methods on the object. SQLAlchemy on the other hand has a so called session to which you add or delete objects.
Both are very popular so I'd say that both methods are about equal in terms of popularity. However in the context of a Django application going with the Django conven... | 3 | 8 | 0 | I am a seasoned .Net developer who's trying to write some Python code. On one of the projects I am contributing to, we have a services layer which is a set of classes which abstract away functionality and a django web app which consumes these in process services (which are just classes).
I had created a repository laye... | Python, beginner's question! Repository or Object persisting itself? | 0.099668 | 0 | 0 | 2,180 |
5,463,541 | 2011-03-28T18:42:00.000 | 1 | 0 | 1 | 0 | python,recursion,floating-point,integer | 5,463,612 | 6 | false | 0 | 0 | It would be more reliable an algorithm to just parse the number as a string and do a string manipulation. Any numerical calculation involving floating-point numbers are bound to inaccuracy, as you've witnessed. There's no going around that. | 2 | 2 | 0 | First off all, thanks for the attention, I'm new to this site ^^ so excuse me if I do something wrong...
I have a huge problem with my Python code... I'm new to programming, and I'm new to Python as well.
I need to take a floating point number and move the point right so it becomes an integer, like taking 60.27 and get... | Moving the point downwards in a floating point number | 0.033321 | 0 | 0 | 1,787 |
5,463,541 | 2011-03-28T18:42:00.000 | 1 | 0 | 1 | 0 | python,recursion,floating-point,integer | 5,463,691 | 6 | false | 0 | 0 | Just taking a wild stab in the dark here, but do your numbers represent amounts of money that you're trying to convert between (say) dollars and cents? If so, you need to stop what you are doing and convert everything to cents, and only use "dollar" values when actually presenting things to the user. Using floating poi... | 2 | 2 | 0 | First off all, thanks for the attention, I'm new to this site ^^ so excuse me if I do something wrong...
I have a huge problem with my Python code... I'm new to programming, and I'm new to Python as well.
I need to take a floating point number and move the point right so it becomes an integer, like taking 60.27 and get... | Moving the point downwards in a floating point number | 0.033321 | 0 | 0 | 1,787 |
5,463,769 | 2011-03-28T19:03:00.000 | 2 | 0 | 0 | 0 | python,django,formset | 5,463,957 | 2 | true | 1 | 0 | No, objects in a collection don't generally have access to their index or key.
However if you're outputting the formset in a template, you're presumably looping through the forms. So you can use {% forloop.counter %} to get the index of the iteration. | 1 | 1 | 0 | I have a formset created using inlineformset_factory. It doesn't matter what it looks like to answer this question. In the template I am looping through it with for form in forms.formset:
I want to be able to display the form index of the form in my template. By form index, I mean the number associated with that form i... | form index in inlineformset | 1.2 | 0 | 0 | 189 |
5,463,782 | 2011-03-28T19:04:00.000 | 2 | 0 | 1 | 1 | python,eclipse,twisted,pydev | 5,466,280 | 1 | true | 1 | 0 | Make sure you:
Have PyDev installed
Have twisted / zope.interface installed and in your PYTHONPATH.
Have configured your eclipse project as a python/pydev project.
Have configured the interpreter in the Eclipse environment (Pydev settings). | 1 | 2 | 0 | I installed Twisted for Python and I am trying to build a simple server on Eclipse and I am getting the following error:
ImportError: No module named zope.interface
I'm not sure how to correct this. Doesn't Twisted install all of the dependencies first? | Python Twisted does not work on Eclipse | 1.2 | 0 | 0 | 991 |
5,463,924 | 2011-03-28T19:19:00.000 | 0 | 0 | 0 | 0 | python,numpy,matplotlib,scipy | 5,627,073 | 1 | true | 0 | 0 | If you simply use matplotlib's plot function, the plot will fit into one online window, so you don't really need to 'rescale' explicitly. Linearly rescaling is pretty easy, if you include some code sample to show your formatting of the data, somebody can help you in translating the origin and scaling the coordinates. | 1 | 2 | 1 | I'm trying to plot a series of rectangles and lines based on a tab delimited text file in matplotlib. The coordinates are quite large in the data and shown be drawn to scale -- except scaled down by some factor X -- in matplotlib.
What's the easiest way to do this in matplotlib? I know that there are transformations,... | transforming coordinates in matplotlib | 1.2 | 0 | 0 | 1,909 |
5,465,010 | 2011-03-28T21:00:00.000 | 1 | 1 | 0 | 1 | python,routing,network-programming,erlang,protocols | 5,473,481 | 3 | false | 0 | 0 | Erlang is very well suited for just a logical prototype without concrete implementation as well as implementing real world capable implementations of the protocols.
You don't need any other framework, just Erlang and OTP which comes with it is enough.
Even if you have to work down to packet level Erlang helps you with ... | 1 | 2 | 0 | I am doing research on routing protocols. Currently I perform simulations written in Python of a new protocol. The next step would be to build a real prototype which can really run on top of a Linux-based operating system (as a routing daemon such as ospfd).
What would be a well-suited programming environment/languag... | Environment for quickly developing routing protocol prototype | 0.066568 | 0 | 0 | 1,573 |
5,465,982 | 2011-03-28T22:54:00.000 | 2 | 0 | 0 | 0 | python,numpy,scipy,fortran77 | 5,466,008 | 2 | false | 0 | 0 | Can't you just dump the data generated by the Fortran program to a file and then read it from python ?
Numpy can read a binary file and treat it as a array.
Going from here to matplotlib then should be a breeeze. | 1 | 2 | 1 | So I am in a bit of a pickle. I am trying to write plotting and fitting extensions to a Fortran77 (why this program was rewritten in F77 is a mystery too me, btw) code that requires command line input, i.e. it prompts the user for input. Currently the program uses GNUplot to plot, but the GNUplot fitting routine is les... | Run Fortran command line program within Python | 0.197375 | 0 | 0 | 3,047 |
5,467,035 | 2011-03-29T01:47:00.000 | 2 | 0 | 1 | 0 | python,virtualenv,dreamhost | 5,468,328 | 2 | true | 0 | 0 | The general answer is "Place the 'bin' directory of the virtual environment in your path ahead of the system default". The specific answer on exactly how to do this depends rather dramatically on which OS and and shell you're using. Since you used the term "home directory", however, I'm going to assume you're using som... | 1 | 0 | 0 | I recently started with virtualenv and was trying to install my own packages like PIL etc.
I wanted to know what do I need to do to make sure once I activate the environment, it remains activated or at least it is used, instead of the system python.
So far I have created the environment in my home directory and can ac... | virtualenv on Dreamhost: How to make sure MY environment used all the time | 1.2 | 0 | 0 | 376 |
5,467,471 | 2011-03-29T03:05:00.000 | 0 | 0 | 1 | 0 | python,user-input | 5,474,499 | 3 | false | 0 | 0 | As an alternative to brute force, take two minutes and think about the problem. Think about A - what is the smallest number A could be? What is the largest? Think about B - there is something special about B, some special property that only 4 of the total 10 digits have. In the end, you will still have to loop over a ... | 1 | 2 | 0 | Write a program that finds two digit A and B (dont search the web,
and dont try 'manually') so that we get a two digit number AB (say
A = 8, B = 9 then the number is 89) and so that AB*AB = CAB for
some digit C. Thus if you square AB you get a 3 digit number. The
two last digits in AB^2 are AB but the first digit is so... | program that finds results of two digits python | 0 | 0 | 0 | 624 |
5,468,511 | 2011-03-29T06:01:00.000 | 1 | 0 | 0 | 0 | python,python-sphinx | 11,197,460 | 1 | true | 1 | 0 | That is correct, only one Sphinx theme can be used at a time. | 1 | 1 | 0 | I want to use multiple themes in Sphinx - so that one page has one theme, and a second page has a second theme. It seems to me that only one theme can be set at once - is this true?
Many thanks,
Ned | Multiple Sphinx Themes Used Simultaneously | 1.2 | 0 | 0 | 393 |
5,468,921 | 2011-03-29T06:53:00.000 | 1 | 0 | 0 | 0 | python,r,numpy,large-files,graphing | 5,469,268 | 2 | false | 0 | 0 | I think python+Numpy would be the most efficient way, regarding speed and ease of implementation.
Numpy is highly optimized so the performance is decent, and python would ease up the algorithm implementation part.
This combo should work well for your case, providing you optimize the loading of the file on memory, try t... | 1 | 5 | 1 | We have pretty large files, the order of 1-1.5 GB combined (mostly log files) with raw data that is easily parseable to a csv, which is subsequently supposed to be graphed to generate a set of graph images.
Currently, we are using bash scripts to turn the raw data into a csv file, with just the numbers that need to be ... | Reading and graphing data read from huge files | 0.099668 | 0 | 0 | 2,960 |
5,470,161 | 2011-03-29T09:04:00.000 | 0 | 1 | 0 | 0 | python,module,load | 5,471,112 | 3 | false | 0 | 0 | Yes, you can import your code in creative ways.
No, it will not protect the code from being seen. Rethink your strategy, not tactics. | 1 | 1 | 0 | in python,can i load a module from remote server to local?
what i do this is want to protect my source code.
what should i do ,thanks | python can load modules from remote server? | 0 | 0 | 1 | 5,926 |
5,470,693 | 2011-03-29T09:52:00.000 | 10 | 0 | 1 | 0 | python,numbers,limit,bit | 16,956,726 | 4 | false | 0 | 0 | There used to be a limit in earlier versions of Python for int. But, this is dropped as Python treats integers as objects. So, although Python allocates 32 bits for the value object reference is pointing to, as the value goes beyond 2^32 it can keep moving up all the way up to the size of RAM on your computer. | 1 | 30 | 0 | I know in most, if not all programming languages, integers, floats etc all have a maximum amount they can hold, either unsigned or signed. Eg pascal's int type can only hold up to 32768 ~.
What i wanted to know was, what is the limit on python's int and floating point variables. I tried a little program to produce extr... | Python Number Limit | 1 | 0 | 0 | 46,547 |
5,471,312 | 2011-03-29T10:47:00.000 | 0 | 0 | 0 | 0 | python,django,django-views | 5,471,592 | 2 | false | 1 | 0 | check caching.
first check cache meta tags on the client
then check web server cache
Note: "GET" requets some times cached on the server or client automatically. | 2 | 0 | 0 | I have django supported web application. when i hit refresh button on a page the view method corresponding to the page's url is not being called. But it gets called when i re-enter the url in th address bar. can any one suggest the reason and the solution? | why hitting refresh button is not calling the view method of the page's url? | 0 | 0 | 0 | 153 |
5,471,312 | 2011-03-29T10:47:00.000 | 0 | 0 | 0 | 0 | python,django,django-views | 5,537,714 | 2 | true | 1 | 0 | finally found the ans: just add the new tab command to your html page itself | 2 | 0 | 0 | I have django supported web application. when i hit refresh button on a page the view method corresponding to the page's url is not being called. But it gets called when i re-enter the url in th address bar. can any one suggest the reason and the solution? | why hitting refresh button is not calling the view method of the page's url? | 1.2 | 0 | 0 | 153 |
5,473,301 | 2011-03-29T13:29:00.000 | 0 | 0 | 1 | 0 | python,format,xls | 5,473,492 | 4 | false | 0 | 0 | If the available tools like xlrd, xlwt, and xlutils don't work, you may have to fall back to programmatically editing the file with Excel via COM. Of course, you'll need a copy of Excel, have to work from Windows, and it will be slower than other approaches. | 1 | 2 | 0 | Is there a way to write something into an XLS file with python while keeping the initial format of this XLS file unchanged (such as font size, cell background color, etc)Thanks! | how to write into XLS with python with format unchanged? | 0 | 0 | 0 | 763 |
5,473,340 | 2011-03-29T13:31:00.000 | 3 | 0 | 0 | 0 | python,django,django-models,django-templates,captcha | 5,473,845 | 4 | false | 1 | 0 | Your question about which 3rd party solution is "better" is subjective, and stackoverflow doesn't generally like to answer subjective questions. Take some time and evaluate each in light of your needs.
You often don't need a fancy image captcha. Even a simple question like "what color is an orange?" will stop most spam... | 1 | 0 | 0 | I am a Django newbie. I created an app which has a user login/registration page. Now I want to include CAPTCHA also in the registration page. Can somebody guide me how to implement this in Django as i am quite new to it. On googling I found there are many modules which do the function out of the box. If this is the way... | Including CAPTCHA on user registration page with Django | 0.148885 | 0 | 0 | 2,880 |
5,473,369 | 2011-03-29T13:33:00.000 | 1 | 0 | 1 | 0 | python,parsing,unicode,file-io,csv | 9,166,741 | 2 | true | 0 | 0 | The problem was solved using the csv module as proposed by Daenyth | 1 | 1 | 0 | A few weeks ago I wrote a CSV parser in python and it was working great with the provided text file. But when we tried to test is with other files the problems started.
First was the
ValueError: empty string for float()
for a string like "313.44". The problem was that in unicode there was some empty bytes betwee the... | Python and parsing unicode files | 1.2 | 0 | 0 | 1,581 |
5,475,154 | 2011-03-29T15:38:00.000 | 0 | 0 | 0 | 0 | python,webdriver,selenium-webdriver | 8,529,382 | 1 | false | 0 | 0 | In the meantime, one could manually write wrapper class that routes Selenium RC calls to WebDriver equivalent. I did some work on that for PHP, it's not that hard, though not all functions can be ported, but a majority can. And the process is similar across languages in terms of code flow / algorithm to wrap the calls. | 1 | 1 | 0 | Is there a way of using webdriverbackedselenium in python, as in
selenium =
webdriverbackedselenium(driver,"http://www.google.com") | webdriverbackedselenium in python | 0 | 0 | 1 | 636 |
5,475,649 | 2011-03-29T16:14:00.000 | 6 | 0 | 0 | 1 | python,r | 5,475,771 | 3 | false | 0 | 0 | No
In the shortcut key list in IDLE, in Options > Configure IDLE > Keys, in the Action - Key(s) list, one does not find any shortcut key for executing selected code. | 1 | 8 | 0 | If you have a script open in the Windows version of R, you can run a line (or section of highlighted code) in the shell by hitting CTRL-R (believe it's command-enter in apple version). Is there similar functionality for IDLE? Many thanks | Python IDLE equivalent of CTRL-R in R | 1 | 0 | 0 | 6,260 |
5,476,065 | 2011-03-29T16:52:00.000 | 1 | 0 | 1 | 0 | python,datetime | 19,115,366 | 17 | false | 0 | 0 | There is a module datetime_truncate which handlers this for you. It just calls datetime.replace. | 1 | 314 | 0 | What is a classy way to way truncate a python datetime object?
In this particular case, to the day. So basically setting hour, minute, seconds, and microseconds to 0.
I would like the output to also be a datetime object, not a string. | How to truncate the time on a datetime object? | 0.011764 | 0 | 0 | 295,476 |
5,476,189 | 2011-03-29T17:03:00.000 | 2 | 1 | 1 | 0 | python,math,sqrt | 5,476,318 | 4 | false | 0 | 0 | Some modules are written in C and not in python so you wouldn't be able to find the .py files. For a list of these you can use:
import sys
print sys.builtin_module_names
Since it's written in C you will have to find it in the source code. If you have the source already it's in the modules directory. | 1 | 27 | 0 | I would like to look at the way Python does computes square roots, so I tried to find the definition for math.sqrt(), but I can't find it anywhere. I have looked in _math.c, mathmodule.c, and elsewhere.
I know that python uses C's math functions, but are these somewhere in the Python distribution, or are they linked to... | Where can I inspect Python's math functions? | 0.099668 | 0 | 0 | 16,849 |
5,477,078 | 2011-03-29T18:19:00.000 | 5 | 1 | 0 | 0 | python,html,eclipse,syntax,cheetah | 5,477,725 | 1 | true | 1 | 0 | Can I somehow trick Eclipse into treating .tmpl files as if they were .html?
It's not a trick.
Under Windows -> Preferences, General -> Editors -> File Associations, you can associate *.tmpl files with your HTML editor. | 1 | 7 | 0 | Hello How can I enable syntax highlighting for HTML/CSS/JS in Eclipse I am mainly developing in python using the PyDev package but right now I am creating Cheetah templates and they are very hard to read unhighlighted.
Any plugin/package suggestions related to Cheetah or just highlighting any file as html would be grea... | HTML/CSS/JS Syntax Highlighting in Eclipse | 1.2 | 0 | 0 | 8,276 |
5,479,387 | 2011-03-29T21:52:00.000 | -1 | 0 | 0 | 1 | python,perl,iis,iis-7,cgi | 5,479,573 | 3 | false | 1 | 0 | the windows TCP stack is limited to 4GB file uploads. Anymore than that is not possible. | 2 | 1 | 0 | We need to handle massive file uploads without spending resources on an IIS 7 server. To emphasize how light-weight this needs to be, let's say that we need to handle file uploads of sizes that are completely insane, like 100GB uploads, or something that can continue running for an extremely long time without consuming... | Need CGI (or another solution compatible with IIS 7) to handle *massive* uploads | -0.066568 | 0 | 0 | 300 |
5,479,387 | 2011-03-29T21:52:00.000 | 3 | 0 | 0 | 1 | python,perl,iis,iis-7,cgi | 5,483,933 | 3 | false | 1 | 0 | You want WebDAV, not CGI. It provides all the nice bits that make file transfers not suck, like resuming and pausing. | 2 | 1 | 0 | We need to handle massive file uploads without spending resources on an IIS 7 server. To emphasize how light-weight this needs to be, let's say that we need to handle file uploads of sizes that are completely insane, like 100GB uploads, or something that can continue running for an extremely long time without consuming... | Need CGI (or another solution compatible with IIS 7) to handle *massive* uploads | 0.197375 | 0 | 0 | 300 |
5,479,897 | 2011-03-29T22:56:00.000 | 1 | 0 | 1 | 0 | python | 5,479,995 | 3 | false | 0 | 0 | You need to use the os.path library. If you start off with directory d then os.path.abspath(os.path.join(d, '..')) will return that directory's parent. You do this until you get to /mnt, for each directory running chown on it. | 1 | 1 | 0 | Folks,
Might find this on searching, but need this rather quickly done:
I have the path like this: /mnt/path1/path2/path3/
I need to chown all the directories such as /mnt, /mnt/path1, /mnt/path1/path2, /mnt/path1/path2/path3, how to get this done in python?
I cannot do 'chown -R /mnt/' since it tries to chown all the ... | Python: How to do this string manipulation | 0.066568 | 0 | 0 | 292 |
5,480,340 | 2011-03-29T23:52:00.000 | 1 | 0 | 1 | 0 | python,mongodb,performance,iteration,database-cursor | 7,828,897 | 4 | false | 0 | 0 | the default cursor size is 4MB, and the maximum it can go to is 16MB. you can try to increase your cursor size until that limit is reached and see if you get an improvement, but it also depends on what your network can handle. | 2 | 10 | 0 | I'm actually working in a search engine project. We are working with python + mongoDb.
I have a pymongo cursor after excecuting a find() command to the mongo db. The pymongo cursor has around 20k results.
I have noticed that the iteration over the pymongo cursor is really slow compared with a normal iteration over for ... | Python + MongoDB - Cursor iteration too slow | 0.049958 | 1 | 0 | 14,362 |
5,480,340 | 2011-03-29T23:52:00.000 | -4 | 0 | 1 | 0 | python,mongodb,performance,iteration,database-cursor | 5,480,531 | 4 | false | 0 | 0 | You don't provide any information about the overall document sizes. Fetch such an amount of document requires both network traffic and IO on the database server.
The performance is sustained "bad" even in "hot" state with warm caches? You can use "mongosniff" in order to inspect the "wire" activity and system tools lik... | 2 | 10 | 0 | I'm actually working in a search engine project. We are working with python + mongoDb.
I have a pymongo cursor after excecuting a find() command to the mongo db. The pymongo cursor has around 20k results.
I have noticed that the iteration over the pymongo cursor is really slow compared with a normal iteration over for ... | Python + MongoDB - Cursor iteration too slow | -1 | 1 | 0 | 14,362 |
5,480,742 | 2011-03-30T00:58:00.000 | 3 | 1 | 0 | 0 | python,database,database-design,login | 5,480,782 | 1 | true | 1 | 0 | You can do this many ways, either you store most of the data in a generic usertable (as you are about to) and the provider details separated.
Or you make a design where you can connect multiple logins to same user. This will end up with something like
id user
id facebookuser (nullable)
id twitteruser (nullable)
This ... | 1 | 1 | 0 | I have something simple right now, userdb schema is:
userid - autoincrement id email
email address
password
I want to incorporate Facebook and twitter, how would i deal with it on the DB side? | Incorporating multiple login systems? | 1.2 | 0 | 0 | 105 |
5,482,097 | 2011-03-30T05:05:00.000 | 0 | 1 | 0 | 0 | python,email,scalability,message-queue,messaging | 5,483,282 | 3 | true | 0 | 0 | Most (if not all) Messaging solutions support two modes of messaging
Publish \ Subscribe -that is, you need to subscribe to get the message.
Queuing - one party sends a message to the queue, the other reads the message from the Queue - no subscription needed, and the message is consumed when it's read.
Actually, stan... | 1 | 0 | 0 | Is there a messaging solution out there (preferably supporting Python) that I can use like a mailbox, e.g. retrieve messages from any given queue without having to subscribe? I suppose message queues could work, but I would have to repeatedly subscribe, grab messages from the queue, then unsubscribe, which does not sou... | Protocol for retrieving and publishing messages (message queues without the pub/sub) | 1.2 | 0 | 1 | 423 |
5,482,893 | 2011-03-30T06:50:00.000 | 0 | 0 | 1 | 0 | python,multithreading | 7,379,773 | 3 | false | 0 | 0 | Python threads are good for IO bound loads, but CPU bound loads end up fighting over processor time as the global interpreter lock forces all threads to execute one at a time even on a multi core machine. You would be better looking at the multiprocessing module and deploying as many processes as you need and have the... | 1 | 2 | 0 | I want to running large-scale mathematical operations using Python multi-threading; I need software for many computer to do this. What is the best way?
Thanks.
This is my idea:
use c to handle the core code of python
setup a software to handle the multi-threading
and so on | High multi-threading using Python | 0 | 0 | 0 | 204 |
5,483,121 | 2011-03-30T07:17:00.000 | 1 | 0 | 1 | 0 | python,performance | 6,976,587 | 6 | false | 0 | 0 | Questions: Is this a scaling issue ? Are you finding that the code runs more than twice as slow when you have twice as much data? Is it possible that you are running out of physical memory and using swap memory ?
10 million strings of 100 characters each is a gigabyte. If you have 2 sets of those, that would be 2 gig... | 2 | 5 | 0 | I have few python scripts where I am storing 5-10 million string key value pairs in a dictionary and I query this dictionary around 5-10 million times. I noticed that python dict is not performing very well. Is there any other implementation best suited for string keys.
Edit:
I am having two large lists of person names... | Python: Best Dictionary implementation | 0.033321 | 0 | 0 | 1,007 |
5,483,121 | 2011-03-30T07:17:00.000 | 1 | 0 | 1 | 0 | python,performance | 5,483,165 | 6 | false | 0 | 0 | Wow. A hashmap (dictionary) might not be the structure you're looking for.
Instead of using strings, try a representation that can give you good and fast hashing. Or are you really storing strings? If so, scracth the "might" in the previous sentence.
Could you give us details about the problem you're tackling? | 2 | 5 | 0 | I have few python scripts where I am storing 5-10 million string key value pairs in a dictionary and I query this dictionary around 5-10 million times. I noticed that python dict is not performing very well. Is there any other implementation best suited for string keys.
Edit:
I am having two large lists of person names... | Python: Best Dictionary implementation | 0.033321 | 0 | 0 | 1,007 |
5,483,163 | 2011-03-30T07:20:00.000 | 1 | 1 | 1 | 0 | python,performance | 5,506,495 | 1 | false | 0 | 0 | mmap takes a file and sticks it in RAM so that you can index it like an array of bytes or as a big data structure.
Its a lot faster if you are accessing your file in a "random-access" manner -- that is doing a lot of fseek(), fread(), fwrite() combinations.
But if you are just reading the file in and processing each li... | 1 | 5 | 0 | I read that mmap is advantageous than fileinput, because it will read a page into kernel pagecache and shares the page in user address space. Whereas, fileinput actually brings a page into kernel and copies a line to user address space. So, there is this extra space overhead with fileinput.
So, I am planning to move t... | Advantages of mmap vs fileinput | 0.197375 | 0 | 0 | 2,184 |
5,483,387 | 2011-03-30T07:43:00.000 | 0 | 0 | 1 | 0 | python,multicore,multiprocessing | 5,483,470 | 3 | false | 0 | 0 | Reading the same file from several processes concurrently is tricky. Is it possible to split the file beforehand?
While Python has the GIL both Jython and IronPython hasn't that limitation.
Also make sure that a simple single process doesn't already max disk I/O. You will have a hard time gaining anything if it does. | 2 | 3 | 0 | I have a python program that reads a line from a input file, does some manipulation and writes it to output file. I have a quadcore machine, and I want to utilize all of them. I think there are two alternatives to do this,
Creating n multiple python processes each handling a total number of records/n
Creating n threa... | Parallelize my python program | 0 | 0 | 0 | 679 |
5,483,387 | 2011-03-30T07:43:00.000 | 0 | 0 | 1 | 0 | python,multicore,multiprocessing | 5,483,483 | 3 | false | 0 | 0 | Number one is the right answer.
First of all, it is easier to create and manage multiple processes than multiple threads. You can use the multiprocessing module or something like pyro to take care of the details. Secondly, threading needs to deal with Python's global interpreter lock which makes it more complicated eve... | 2 | 3 | 0 | I have a python program that reads a line from a input file, does some manipulation and writes it to output file. I have a quadcore machine, and I want to utilize all of them. I think there are two alternatives to do this,
Creating n multiple python processes each handling a total number of records/n
Creating n threa... | Parallelize my python program | 0 | 0 | 0 | 679 |
5,483,404 | 2011-03-30T07:46:00.000 | 0 | 0 | 0 | 0 | javascript,jquery,python,ruby-on-rails,django | 5,484,532 | 4 | false | 1 | 0 | We've had a blast developing with Django/Jquery, and development, in our opinion, is easier, faster. That being said, we tend to go with Django because of Python's raw power and reliability. Not to say ROR doesn't have similar strengths, but we get "stuck" more often than not when using ROR than when using Django.
If ... | 2 | 0 | 0 | I want to build a heavy ajax web2.0 app and I don't have javascript, django or ruby on rails. I have some experience with python. I am not sure which one to choose. I have a backend database and have to run few queries for each page, no big deal. So, I am looking for a choice which is quite easy to learn and maintain i... | Django or Ruby on Rails, which one is better for web 2.0 heavy ajax app? | 0 | 0 | 0 | 1,274 |
5,483,404 | 2011-03-30T07:46:00.000 | 0 | 0 | 0 | 0 | javascript,jquery,python,ruby-on-rails,django | 5,483,855 | 4 | false | 1 | 0 | ROR has much better community activity. It's easier to learn without learning ruby (i do not recommend that way, but yes - you can write in ROR barely understanding ruby).
About performance: ruby 1.8 was much slower than python. But maybe ruby 1.9 is faster.
If you want to build smart ajax application and you underst... | 2 | 0 | 0 | I want to build a heavy ajax web2.0 app and I don't have javascript, django or ruby on rails. I have some experience with python. I am not sure which one to choose. I have a backend database and have to run few queries for each page, no big deal. So, I am looking for a choice which is quite easy to learn and maintain i... | Django or Ruby on Rails, which one is better for web 2.0 heavy ajax app? | 0 | 0 | 0 | 1,274 |
5,484,900 | 2011-03-30T10:09:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,local-storage | 5,486,121 | 2 | true | 1 | 0 | How the datastore reads and writes its underlying files varies - the standard datastore is read on startup, and written progressively, journal-style, as the app modifies data. The SQLite backend uses a SQLite database.
You shouldn't have to care, though - neither backend is designed for robustness in the face of failur... | 1 | 0 | 0 | I have just noticed that when I have a running instance of my GAE application, there nothing happens with the datastore file when I add or remove entries using Python code or in admin console. I can even remove the file and still have all data safe and sound in admin area and accessible from code. But when I restart my... | Does local GAE read and write to a local datastore file on the hard drive while it's running? | 1.2 | 0 | 0 | 196 |
5,485,795 | 2011-03-30T11:39:00.000 | 0 | 0 | 1 | 0 | python,dictionary | 5,485,901 | 2 | true | 0 | 0 | which language do you use? what kind of dictionary do you use?
If Python, use the following:
[ x for x, y in mydict.items() if y > 42 ] | 1 | 0 | 0 | I need to write a function that takes such a dictionary as the first argument and an integer as the second argument and returns the list of keys all of whose values are bigger than the second argument. I'm thinking of building it using a for loop to be much simpler. | writing a dictionary function | 1.2 | 0 | 0 | 240 |
5,487,301 | 2011-03-30T13:55:00.000 | 0 | 0 | 0 | 0 | python,mouse,xlib | 5,499,581 | 2 | false | 0 | 1 | I'm not familiar with SMC. It may be that it uses warp_pointer itself. I know a lot of games do to simulate the relative motion support only recently introduced to XInput and I think some of them use it to stash the mouse "out of the way". Have you tried it with games that do different things with the mouse? | 1 | 1 | 0 | I am trying to change the mouse pointer using python xlib. I successfully did it using warp_pointer. But when i try to play any games like Secret Maryo Chronicles, the mouse pointer moves to the rightmost corner of the screen and not the specified location. Why is it so? Can anyone help me with this? | Python xlib warp_pointer not working properly inside games | 0 | 0 | 0 | 1,321 |
5,489,649 | 2011-03-30T17:09:00.000 | 2 | 0 | 0 | 0 | python,django,decorator,login-required | 5,490,446 | 2 | false | 1 | 0 | It seems that your situation is as follows:
1. You have pages that are secured and behind a login-required decorator
2. You have pages that are non-secure and can be visited in both a logged-in state and anonymous state.
If I understand your requirements, you want a user to be redirected to Main Page (Assuming this to ... | 1 | 16 | 0 | My question is a general one, but specifically my application is the login_required decorator for Django.
I'm curious if there is a way to check if a view/function has a specific decorator (in this case the login_required decorator)
I am redirecting after logging a user out, and I want to redirect to the main page if t... | Check if a function has a decorator | 0.197375 | 0 | 0 | 8,338 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.