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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
189,943 | 2008-10-10T02:39:00.000 | 82 | 0 | 1 | 0 | python,image-processing,background-subtraction,image-comparison,timelapse | 189,960 | 24 | false | 0 | 0 | A simple solution:
Encode the image as a jpeg and look for a substantial change in filesize.
I've implemented something similar with video thumbnails, and had a lot of success and scalability. | 6 | 212 | 0 | Here's what I would like to do:
I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much looks the same, I don't want to store the latest snapshot.
I imagine there's some way of quantifying the difference, and I w... | How can I quantify difference between two images? | 1 | 0 | 0 | 231,920 |
189,943 | 2008-10-10T02:39:00.000 | 14 | 0 | 1 | 0 | python,image-processing,background-subtraction,image-comparison,timelapse | 190,036 | 24 | false | 0 | 0 | A trivial thing to try:
Resample both images to small thumbnails (e.g. 64 x 64) and compare the thumbnails pixel-by-pixel with a certain threshold. If the original images are almost the same, the resampled thumbnails will be very similar or even exactly the same. This method takes care of noise that can occur especiall... | 6 | 212 | 0 | Here's what I would like to do:
I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much looks the same, I don't want to store the latest snapshot.
I imagine there's some way of quantifying the difference, and I w... | How can I quantify difference between two images? | 1 | 0 | 0 | 231,920 |
190,115 | 2008-10-10T04:19:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,python-idle | 56,122,726 | 3 | false | 0 | 0 | Not really. You can download the latest version of Python 3.x suitable for whichever operating system you are using, and you can load IDLE without any internet. | 1 | 1 | 0 | If I have no connection to internet, does that mean I can't start IDLE (which comes with python 3.0)? | IDLE doesn't start in python 3.0 | 0 | 0 | 1 | 945 |
190,675 | 2008-10-10T09:56:00.000 | 0 | 0 | 1 | 1 | python,google-app-engine,image,analysis | 190,958 | 3 | false | 0 | 0 | If you are willing to put Flash or a Java applet on the page, you might be able to do it on the client. I'm not sure if anything like canvas or SVG supports pixel-level manipulation, but if they do, you might be able to get it to work in some browsers with JavaScript.
The Flash or Java Applet, can be invisible and opti... | 1 | 1 | 0 | How can I read the colors of an image with python using google app engine?
Example: I like to build a function to determine the most striking colors of an image to set a harmonic background color for it. | Read colors of image with Python (GAE) | 0 | 0 | 0 | 1,703 |
191,062 | 2008-10-10T12:40:00.000 | 7 | 0 | 0 | 0 | python,pylons,cherrypy,web-frameworks,turbogears | 191,805 | 5 | false | 1 | 0 | Give a try to web2py. It is point and click (you do not even need to install Python, comes with it). You develop using a web interface and you can deploy almost everywhere, including iPhone, Oracle and Google App Engine. Before trying web2py, try install some of the other Python frameworks, you will appreciate it even ... | 2 | 10 | 0 | Could someone please explain to me how the current python webframworks fit together?
The three I've heard of are CherryPy, TurboGears and Pylons. However I'm confused because TurboGears seems to use CherryPy as the 'Controller' (although isn't CherryPy a framework in in it's own right?), and TurbGears 2 is going to be ... | Python Webframework Confusion | 1 | 0 | 0 | 2,552 |
191,062 | 2008-10-10T12:40:00.000 | 6 | 0 | 0 | 0 | python,pylons,cherrypy,web-frameworks,turbogears | 191,336 | 5 | false | 1 | 0 | CherryPy is not a full-stack web framework (like Django for example), in fact it isn't a web framework but a HTTP framework. Writing a web application using CherryPy is much like writing a regular object-oriented application in Python.
Also, CherryPy has it's own production-ready WSGI web server, which can be also used... | 2 | 10 | 0 | Could someone please explain to me how the current python webframworks fit together?
The three I've heard of are CherryPy, TurboGears and Pylons. However I'm confused because TurboGears seems to use CherryPy as the 'Controller' (although isn't CherryPy a framework in in it's own right?), and TurbGears 2 is going to be ... | Python Webframework Confusion | 1 | 0 | 0 | 2,552 |
191,700 | 2008-10-10T14:52:00.000 | 2 | 0 | 1 | 1 | python,memory | 191,790 | 2 | false | 0 | 0 | Are you sure that the machine does not have a 128M process limit? If you are running the python script as a CGI inside a web server, it is quite likely that there is a process limit set - you will need to look at the web server configuration. | 2 | 2 | 0 | I am new to python and struggling to find how to control the amount of memory a python process can take? I am running python on a Cento OS machine with more than 2 GB of main memory size. Python is taking up only 128mb of this and I want to allocate it more. I tried to search all over the internet on this for last half... | Configuring python | 0.197375 | 0 | 0 | 1,627 |
191,700 | 2008-10-10T14:52:00.000 | 11 | 0 | 1 | 1 | python,memory | 191,744 | 2 | true | 0 | 0 | Forget all that, python just allocates more memory as needed, there is not a myriad of comandline arguments for the VM as in java, just let it run. For all comandline switches you can just run python -h or read man python. | 2 | 2 | 0 | I am new to python and struggling to find how to control the amount of memory a python process can take? I am running python on a Cento OS machine with more than 2 GB of main memory size. Python is taking up only 128mb of this and I want to allocate it more. I tried to search all over the internet on this for last half... | Configuring python | 1.2 | 0 | 0 | 1,627 |
192,907 | 2008-10-10T20:22:00.000 | 7 | 0 | 0 | 0 | python,xml,dom,sax,elementtree | 192,913 | 4 | false | 0 | 0 | ElementTree's parse() is like DOM, whereas iterparse() is like SAX. In my opinion, ElementTree is better than DOM and SAX in that it provides API easier to work with. | 1 | 80 | 0 | Python has several ways to parse XML...
I understand the very basics of parsing with SAX. It functions as a stream parser, with an event-driven API.
I understand the DOM parser also. It reads the XML into memory and converts it to objects that can be accessed with Python.
Generally speaking, it was easy to choose bet... | XML parsing - ElementTree vs SAX and DOM | 1 | 0 | 1 | 33,129 |
193,077 | 2008-10-10T21:26:00.000 | 23 | 0 | 0 | 1 | python,linux | 193,963 | 8 | false | 0 | 0 | Create a deb (for everything Debian-derived) and an rpm (for Fedora/SuSE). Add the right dependencies to the packaging and you can be reasonably sure that it will work. | 3 | 33 | 0 | How can I distribute a standalone Python application in Linux?
I think I can take for granted the presence of a recent Python interpreter in any modern distribution. The problem is dealing with those libraries that do not belong to the standard library, i.e. wxPython, scipy, python cryptographic toolkit, reportlab, and... | Standalone Python applications in Linux | 1 | 0 | 0 | 28,132 |
193,077 | 2008-10-10T21:26:00.000 | -9 | 0 | 0 | 1 | python,linux | 193,083 | 8 | false | 0 | 0 | Nope.
Python is notoriously flaky with respect to different setups. The only sane way to deploy a python app is to ship the whole bundle of interpreter and libraries that you are relying on with your code. That will most likely work.
Update 2019: I stand by this. Virtualenv is a way of packaging libraries and interpret... | 3 | 33 | 0 | How can I distribute a standalone Python application in Linux?
I think I can take for granted the presence of a recent Python interpreter in any modern distribution. The problem is dealing with those libraries that do not belong to the standard library, i.e. wxPython, scipy, python cryptographic toolkit, reportlab, and... | Standalone Python applications in Linux | -1 | 0 | 0 | 28,132 |
193,077 | 2008-10-10T21:26:00.000 | 7 | 0 | 0 | 1 | python,linux | 193,101 | 8 | false | 0 | 0 | You can't easily do it in a distribution-neutral format. The only reliable dependency tracking mechanisms are built into the package management systems on the distributions and will vary from distribution to distribution. You'll effectively have to do rpm for fedora, debs for ubuntu and debian etc.
Py2exe works fine ... | 3 | 33 | 0 | How can I distribute a standalone Python application in Linux?
I think I can take for granted the presence of a recent Python interpreter in any modern distribution. The problem is dealing with those libraries that do not belong to the standard library, i.e. wxPython, scipy, python cryptographic toolkit, reportlab, and... | Standalone Python applications in Linux | 1 | 0 | 0 | 28,132 |
193,161 | 2008-10-10T21:50:00.000 | 18 | 0 | 1 | 1 | python,directory-structure,organization,project-structure | 193,280 | 8 | false | 0 | 0 | In my experience, it's just a matter of iteration. Put your data and code wherever you think they go. Chances are, you'll be wrong anyway. But once you get a better idea of exactly how things are going to shape up, you're in a much better position to make these kinds of guesses.
As far as extension sources, we have ... | 3 | 880 | 0 | Imagine that you want to develop a non-trivial end-user desktop (not web) application in Python. What is the best way to structure the project's folder hierarchy?
Desirable features are ease of maintenance, IDE-friendliness, suitability for source control branching/merging, and easy generation of install packages.
In p... | What is the best project structure for a Python application? | 1 | 0 | 0 | 551,755 |
193,161 | 2008-10-10T21:50:00.000 | 470 | 0 | 1 | 1 | python,directory-structure,organization,project-structure | 193,181 | 8 | true | 0 | 0 | Doesn't too much matter. Whatever makes you happy will work. There aren't a lot of silly rules because Python projects can be simple.
/scripts or /bin for that kind of command-line interface stuff
/tests for your tests
/lib for your C-language libraries
/doc for most documentation
/apidoc for the Epydoc-generated AP... | 3 | 880 | 0 | Imagine that you want to develop a non-trivial end-user desktop (not web) application in Python. What is the best way to structure the project's folder hierarchy?
Desirable features are ease of maintenance, IDE-friendliness, suitability for source control branching/merging, and easy generation of install packages.
In p... | What is the best project structure for a Python application? | 1.2 | 0 | 0 | 551,755 |
193,161 | 2008-10-10T21:50:00.000 | 13 | 0 | 1 | 1 | python,directory-structure,organization,project-structure | 193,256 | 8 | false | 0 | 0 | Non-python data is best bundled inside your Python modules using the package_data support in setuptools. One thing I strongly recommend is using namespace packages to create shared namespaces which multiple projects can use -- much like the Java convention of putting packages in com.yourcompany.yourproject (and being a... | 3 | 880 | 0 | Imagine that you want to develop a non-trivial end-user desktop (not web) application in Python. What is the best way to structure the project's folder hierarchy?
Desirable features are ease of maintenance, IDE-friendliness, suitability for source control branching/merging, and easy generation of install packages.
In p... | What is the best project structure for a Python application? | 1 | 0 | 0 | 551,755 |
193,701 | 2008-10-11T05:34:00.000 | 2 | 0 | 1 | 0 | php,python,api,rest | 193,807 | 6 | false | 0 | 0 | Try to write a common unit test suite for both. Maybe by wrapping a class in one language for calling it from the other. If you can't do it, at least make sure the two versions of the tests are equivalent. | 6 | 3 | 0 | I am working on developing a pair of libraries to work with a REST API. Because I need to be able to use the API in very different settings I'm currently planning to have a version in PHP (for web applications) and a second version in Python (for desktop applications, and long running processes). Are there any best p... | What are best practices for developing consistent libraries? | 0.066568 | 0 | 0 | 493 |
193,701 | 2008-10-11T05:34:00.000 | 2 | 0 | 1 | 0 | php,python,api,rest | 193,714 | 6 | false | 0 | 0 | 'Be your own client' : I've found that the technique of writing tests first is an excellent way of ensuring an API is easy to use. Writing tests first means you will be thinking like a 'consumer' of your API rather than just an implementor. | 6 | 3 | 0 | I am working on developing a pair of libraries to work with a REST API. Because I need to be able to use the API in very different settings I'm currently planning to have a version in PHP (for web applications) and a second version in Python (for desktop applications, and long running processes). Are there any best p... | What are best practices for developing consistent libraries? | 0.066568 | 0 | 0 | 493 |
193,701 | 2008-10-11T05:34:00.000 | 0 | 0 | 1 | 0 | php,python,api,rest | 389,024 | 6 | false | 0 | 0 | AFAIKT there are a lot of bridges from to scripting languages. Let's take e.g Jruby, it's Ruby + Java, then there are things to embed Ruby in Python (or the other way). Then there are examples like Etoile where the base is Objective-C but also bridges to Python and Smalltalk, another approach on wide use: Wrapping C... | 6 | 3 | 0 | I am working on developing a pair of libraries to work with a REST API. Because I need to be able to use the API in very different settings I'm currently planning to have a version in PHP (for web applications) and a second version in Python (for desktop applications, and long running processes). Are there any best p... | What are best practices for developing consistent libraries? | 0 | 0 | 0 | 493 |
193,701 | 2008-10-11T05:34:00.000 | 0 | 0 | 1 | 0 | php,python,api,rest | 193,709 | 6 | false | 0 | 0 | Well, the obvious one would be to keep your naming consistent. Functions and classes should be named similarly (if not identically) in both implementations. This usually happens naturally whenever you implement an API separately in two different languages. The big ticket item though (at least in my book) is to follo... | 6 | 3 | 0 | I am working on developing a pair of libraries to work with a REST API. Because I need to be able to use the API in very different settings I'm currently planning to have a version in PHP (for web applications) and a second version in Python (for desktop applications, and long running processes). Are there any best p... | What are best practices for developing consistent libraries? | 0 | 0 | 0 | 493 |
193,701 | 2008-10-11T05:34:00.000 | 6 | 0 | 1 | 0 | php,python,api,rest | 193,713 | 6 | true | 0 | 0 | So, the problem with developing parallel libraries in different languages is that often times different languages will have different idioms for the same task. I know this from personal experience, having ported a library from Python to PHP. Idioms aren't just naming: for example, Python has a good deal of magic you ca... | 6 | 3 | 0 | I am working on developing a pair of libraries to work with a REST API. Because I need to be able to use the API in very different settings I'm currently planning to have a version in PHP (for web applications) and a second version in Python (for desktop applications, and long running processes). Are there any best p... | What are best practices for developing consistent libraries? | 1.2 | 0 | 0 | 493 |
193,701 | 2008-10-11T05:34:00.000 | 0 | 0 | 1 | 0 | php,python,api,rest | 959,080 | 6 | false | 0 | 0 | why not use python for web applications too? there are several frameworks available: django, web2py - similar to django but many say it's simpler to use, there is also TurboGears, web.py, Pylons
along the lines of bridging - you could use interprocess communication to have PHP and python application (in daemon mode) ta... | 6 | 3 | 0 | I am working on developing a pair of libraries to work with a REST API. Because I need to be able to use the API in very different settings I'm currently planning to have a version in PHP (for web applications) and a second version in Python (for desktop applications, and long running processes). Are there any best p... | What are best practices for developing consistent libraries? | 0 | 0 | 0 | 493 |
193,789 | 2008-10-11T07:06:00.000 | 4 | 0 | 1 | 0 | python,windows,microphone | 193,823 | 3 | true | 0 | 0 | Best way to go about it would be to use the ctypes library and use WinMM from that. mixerOpen will open a microphone device and you can read the data easily from there. Should be very straightforward. | 1 | 10 | 0 | Can I access a users microphone in Python?
Sorry I forgot not everyone is a mind reader:
Windows at minimum XP but Vista support would be VERY good. | Microphone access in Python | 1.2 | 0 | 0 | 11,203 |
193,862 | 2008-10-11T08:44:00.000 | 1 | 1 | 1 | 0 | ironpython,boo | 194,040 | 7 | false | 0 | 0 | I agree with VolkA here. Being able to run Django is big. It's just such an amazing framework, that Boo will have a hard time redoing it. Today it's more a question of the frameworks that a language provides, than it is the construct that it provides. And Boo doesn't provide much improvements over Python in the constru... | 2 | 26 | 0 | After having looked at each of these two projects, it seems that both are VERY similar. Both run on top of the CLI, both have python style syntax, both use .NET instead of the standard python libraries.
So, what are the differences between them and advantages of each? | Boo vs. IronPython | 0.028564 | 0 | 0 | 6,385 |
193,862 | 2008-10-11T08:44:00.000 | 4 | 1 | 1 | 0 | ironpython,boo | 199,236 | 7 | false | 0 | 0 | I have written applications in both Boo and IronPython. For me IronPython has been the more robust choice and much of what I've written in CPython ports without changes. All recent projects have been pure IronPython if targeted for .Net Framework.
Since Jim "defected" to Microsoft, IronPython has been elevated to a t... | 2 | 26 | 0 | After having looked at each of these two projects, it seems that both are VERY similar. Both run on top of the CLI, both have python style syntax, both use .NET instead of the standard python libraries.
So, what are the differences between them and advantages of each? | Boo vs. IronPython | 0.113791 | 0 | 0 | 6,385 |
194,289 | 2008-10-11T16:34:00.000 | 4 | 0 | 0 | 0 | c#,java,python,chess,dataformat | 194,306 | 9 | false | 0 | 0 | Let's think. We're describing objects (locations and pieces) with states and behaviors. We need to note a current state and an ever-changing set of allowed state changes from a current state.
This is programming. You don't want some "meta-language" that you can then parse in a regular programming language. Just use... | 4 | 8 | 0 | I'm going to be writing a chess server and one or more clients for chess and I want to describe the rules of chess (e.g. allowable moves based on game state, rules for when a game is complete) in a programming language independant way. This is a bit tricky since some of the chess rules (e.g. King Castling, en passent, ... | Recommended data format for describing the rules of chess | 0.088656 | 0 | 0 | 1,846 |
194,289 | 2008-10-11T16:34:00.000 | 2 | 0 | 0 | 0 | c#,java,python,chess,dataformat | 194,318 | 9 | false | 0 | 0 | Edit: Overly wordy answer deleted.
The short answer is, write the rules in Python. Use Iron Python to interface that to the C# client, and Jython for the Java client. | 4 | 8 | 0 | I'm going to be writing a chess server and one or more clients for chess and I want to describe the rules of chess (e.g. allowable moves based on game state, rules for when a game is complete) in a programming language independant way. This is a bit tricky since some of the chess rules (e.g. King Castling, en passent, ... | Recommended data format for describing the rules of chess | 0.044415 | 0 | 0 | 1,846 |
194,289 | 2008-10-11T16:34:00.000 | 2 | 0 | 0 | 0 | c#,java,python,chess,dataformat | 194,332 | 9 | false | 0 | 0 | I would suggest Prolog for describing the rules. | 4 | 8 | 0 | I'm going to be writing a chess server and one or more clients for chess and I want to describe the rules of chess (e.g. allowable moves based on game state, rules for when a game is complete) in a programming language independant way. This is a bit tricky since some of the chess rules (e.g. King Castling, en passent, ... | Recommended data format for describing the rules of chess | 0.044415 | 0 | 0 | 1,846 |
194,289 | 2008-10-11T16:34:00.000 | 0 | 0 | 0 | 0 | c#,java,python,chess,dataformat | 297,803 | 9 | false | 0 | 0 | I would agree with the comment left by ΤΖΩΤΖΙΟΥ, viz. just let the server do the validation and let the clients submit a potential move. If that's not the way you want to take the design, then just write the rules in Python as suggested by S. Lott and others.
It really shouldn't be that hard. You can break the rules do... | 4 | 8 | 0 | I'm going to be writing a chess server and one or more clients for chess and I want to describe the rules of chess (e.g. allowable moves based on game state, rules for when a game is complete) in a programming language independant way. This is a bit tricky since some of the chess rules (e.g. King Castling, en passent, ... | Recommended data format for describing the rules of chess | 0 | 0 | 0 | 1,846 |
195,101 | 2008-10-12T04:36:00.000 | 5 | 0 | 0 | 0 | python,django,grails,groovy,web-applications | 288,617 | 5 | false | 1 | 0 | With Java hosting you don't need to do all the stupid tricks with apache, or nginx. Jetty itself can host everything you need, that's how the guys at www.mor.ph do it, and they find it to be pretty fast.
The memory usage that way is pretty minimal, I host mine on a 256MB Ubuntu server from RapidXen, so it's about $10/m... | 3 | 5 | 0 | I'm currently in the planning stage for a web application and I find myself trying to decide on using Grails or Django. From an operation perspective:
Which ecosystem is easier to maintain (migrations, backup, disaster recovery etc.)? If using grails it'll probably be a typical tomcat + mysql on linux. If django it... | Running a web app in Grails vs Django | 0.197375 | 0 | 0 | 5,101 |
195,101 | 2008-10-12T04:36:00.000 | 0 | 0 | 0 | 0 | python,django,grails,groovy,web-applications | 195,137 | 5 | false | 1 | 0 | i think python tend to have lower hosting requirements (i.e., grails needs a jvm, and most el-cheapo hosts dont provide one, where as they usually provide python support). Plus google app engine supports django (to some extend).
But if you got the dough, grails is so much better imho. | 3 | 5 | 0 | I'm currently in the planning stage for a web application and I find myself trying to decide on using Grails or Django. From an operation perspective:
Which ecosystem is easier to maintain (migrations, backup, disaster recovery etc.)? If using grails it'll probably be a typical tomcat + mysql on linux. If django it... | Running a web app in Grails vs Django | 0 | 0 | 0 | 5,101 |
195,101 | 2008-10-12T04:36:00.000 | 2 | 0 | 0 | 0 | python,django,grails,groovy,web-applications | 197,592 | 5 | false | 1 | 0 | I think from an operations perspective things are going to be close enough that you can base your decision on other criteria. If you can afford a virtual private server with at least 256 MB RAM you will be able to deploy Grails applications. If the cost seems like a lot check out Sun. They are really pushing hosting so... | 3 | 5 | 0 | I'm currently in the planning stage for a web application and I find myself trying to decide on using Grails or Django. From an operation perspective:
Which ecosystem is easier to maintain (migrations, backup, disaster recovery etc.)? If using grails it'll probably be a typical tomcat + mysql on linux. If django it... | Running a web app in Grails vs Django | 0.07983 | 0 | 0 | 5,101 |
195,534 | 2008-10-12T14:14:00.000 | 14 | 1 | 0 | 0 | python,apache,nginx,mod-wsgi | 196,580 | 4 | false | 1 | 0 | The main difference is that nginx is built to handle large numbers of connections in a much smaller memory space. This makes it very well suited for apps that are doing comet like connections that can have many idle open connections. This also gives it quite a smaller memory foot print.
From a raw performance perspec... | 1 | 68 | 0 | What to use for a medium to large python WSGI application, Apache + mod_wsgi or Nginx + mod_wsgi?
Which combination will need more memory and CPU time?
Which one is faster?
Which is known for being more stable than the other?
I am also thinking to use CherryPy's WSGI server but I hear it's not very suitable for a very ... | In production, Apache + mod_wsgi or Nginx + mod_wsgi? | 1 | 0 | 0 | 31,610 |
195,625 | 2008-10-12T15:58:00.000 | 41 | 0 | 1 | 0 | python | 195,647 | 4 | true | 0 | 0 | Pop() for the last element ought to be O(1) since you only need to return the element referred to by the last element in the array and update the index of the last element. I would expect pop() for an arbitrary element to be O(N) and require on average N/2 operations since you would need to move any elements beyond th... | 1 | 64 | 0 | I wonder what is the time complexity of pop method of list objects in Python (in CPython particulary). Also does the value of N for list.pop(N) affects the complexity? | What is the time complexity of popping elements from list in Python? | 1.2 | 0 | 0 | 64,836 |
196,217 | 2008-10-12T22:27:00.000 | 2 | 0 | 0 | 0 | python,mysql,timeout | 196,308 | 2 | false | 0 | 0 | if the communication is such a problem, consider writing a 'proxy' that receives your SQL commands over the flaky connection and relays them to the MySQL server on a reliable channel (maybe running on the same box as the MySQL server). This way you have total control over failure detection and retrying. | 2 | 2 | 0 | Sometimes in our production environment occurs situation when connection between service (which is python program that uses MySQLdb) and mysql server is flacky, some packages are lost, some black magic happens and .execute() of MySQLdb.Cursor object never ends (or take great amount of time to end).
This is very bad be... | MySQLdb execute timeout | 0.197375 | 1 | 0 | 2,995 |
196,217 | 2008-10-12T22:27:00.000 | 1 | 0 | 0 | 0 | python,mysql,timeout | 196,891 | 2 | false | 0 | 0 | You need to analyse exactly what the problem is. MySQL connections should eventually timeout if the server is gone; TCP keepalives are generally enabled. You may be able to tune the OS-level TCP timeouts.
If the database is "flaky", then you definitely need to investigate how. It seems unlikely that the database really... | 2 | 2 | 0 | Sometimes in our production environment occurs situation when connection between service (which is python program that uses MySQLdb) and mysql server is flacky, some packages are lost, some black magic happens and .execute() of MySQLdb.Cursor object never ends (or take great amount of time to end).
This is very bad be... | MySQLdb execute timeout | 0.099668 | 1 | 0 | 2,995 |
196,755 | 2008-10-13T05:03:00.000 | 0 | 0 | 1 | 0 | python,search,scripting,stackexchange-api | 196,800 | 5 | false | 0 | 0 | I would just use Pycurl to concatenate the search terms onto the query uri. | 2 | 5 | 0 | Given a string of keywords, such as "Python best practices", I would like to obtain the first 10 Stack Overflow questions that contain that keywords, sorted by relevance (?), say from a Python script. My goal is to end up with a list of tuples (title, URL).
How can I accomplish this? Would you consider querying Google ... | How can I search through Stack Overflow questions from a script? | 0 | 0 | 0 | 1,383 |
196,755 | 2008-10-13T05:03:00.000 | 1 | 0 | 1 | 0 | python,search,scripting,stackexchange-api | 196,758 | 5 | false | 0 | 0 | You could screen scrape the returned HTML from a valid HTTP request. But that would result in bad karma, and the loss of the ability to enjoy a good night's sleep. | 2 | 5 | 0 | Given a string of keywords, such as "Python best practices", I would like to obtain the first 10 Stack Overflow questions that contain that keywords, sorted by relevance (?), say from a Python script. My goal is to end up with a list of tuples (title, URL).
How can I accomplish this? Would you consider querying Google ... | How can I search through Stack Overflow questions from a script? | 0.039979 | 0 | 0 | 1,383 |
196,924 | 2008-10-13T07:32:00.000 | 3 | 0 | 1 | 0 | javascript,python,nlp | 197,064 | 10 | false | 0 | 0 | You are already doing NLP, if your module doesn't understand what language the text was then either the module doesn't work or the input was not in the correct language. | 2 | 9 | 0 | I am building a project involving natural language processing, since the nlp module currently only deal with english text, so I have to make sure the user submitted content (not long, only several words) is in english. Are there established ways to achieve this? Python or Javascript way preferred. | How to ensure user submit only english text | 0.059928 | 0 | 0 | 1,046 |
196,924 | 2008-10-13T07:32:00.000 | 5 | 0 | 1 | 0 | javascript,python,nlp | 196,967 | 10 | false | 0 | 0 | I think the most effective way would be to ask the users to submit english text only :)
You can show a language selection drop-down over your text area with English/ Other as the options. When user selects "Other", disable the text area with a message that only English language is supported [at the moment]. | 2 | 9 | 0 | I am building a project involving natural language processing, since the nlp module currently only deal with english text, so I have to make sure the user submitted content (not long, only several words) is in english. Are there established ways to achieve this? Python or Javascript way preferred. | How to ensure user submit only english text | 0.099668 | 0 | 0 | 1,046 |
197,759 | 2008-10-13T14:26:00.000 | 1 | 1 | 1 | 0 | python,string,unicode,encoding | 197,854 | 5 | false | 0 | 0 | I don't suppose you have any way of convincing the person who hosts the other machine to switch to unicode?
This is one of the reasons Unicode was invented, after all. | 2 | 9 | 0 | I'm not exactly sure how to ask this question really, and I'm no where close to finding an answer, so I hope someone can help me.
I'm writing a Python app that connects to a remote host and receives back byte data, which I unpack using Python's built-in struct module. My problem is with the strings, as they include mu... | Dealing with a string containing multiple character encodings | 0.039979 | 0 | 0 | 3,280 |
197,759 | 2008-10-13T14:26:00.000 | 3 | 1 | 1 | 0 | python,string,unicode,encoding | 197,786 | 5 | false | 0 | 0 | I would write a codec that incrementally scanned the string and decoded the bytes as they came along. Essentially, you would have to separate strings into chunks with a consistent encoding and decode those and append them to the strings that followed them. | 2 | 9 | 0 | I'm not exactly sure how to ask this question really, and I'm no where close to finding an answer, so I hope someone can help me.
I'm writing a Python app that connects to a remote host and receives back byte data, which I unpack using Python's built-in struct module. My problem is with the strings, as they include mu... | Dealing with a string containing multiple character encodings | 0.119427 | 0 | 0 | 3,280 |
198,692 | 2008-10-13T19:11:00.000 | 2 | 0 | 1 | 0 | python,sqlite,pickle | 198,763 | 14 | false | 0 | 0 | Since Pickle can dump your object graph to a string it should be possible.
Be aware though that TEXT fields in SQLite uses database encoding so you might need to convert it to a simple string before you un-pickle. | 6 | 40 | 0 | Any gotchas I should be aware of? Can I store it in a text field, or do I need to use a blob?
(I'm not overly familiar with either pickle or sqlite, so I wanted to make sure I'm barking up the right tree with some of my high-level design ideas.) | Can I pickle a python dictionary into a sqlite3 text field? | 0.028564 | 1 | 0 | 31,019 |
198,692 | 2008-10-13T19:11:00.000 | 5 | 0 | 1 | 0 | python,sqlite,pickle | 198,767 | 14 | false | 0 | 0 | Pickle has both text and binary output formats. If you use the text-based format you can store it in a TEXT field, but it'll have to be a BLOB if you use the (more efficient) binary format. | 6 | 40 | 0 | Any gotchas I should be aware of? Can I store it in a text field, or do I need to use a blob?
(I'm not overly familiar with either pickle or sqlite, so I wanted to make sure I'm barking up the right tree with some of my high-level design ideas.) | Can I pickle a python dictionary into a sqlite3 text field? | 0.071307 | 1 | 0 | 31,019 |
198,692 | 2008-10-13T19:11:00.000 | 2 | 0 | 1 | 0 | python,sqlite,pickle | 198,770 | 14 | false | 0 | 0 | If a dictionary can be pickled, it can be stored in text/blob field as well.
Just be aware of the dictionaries that can't be pickled (aka that contain unpickable objects). | 6 | 40 | 0 | Any gotchas I should be aware of? Can I store it in a text field, or do I need to use a blob?
(I'm not overly familiar with either pickle or sqlite, so I wanted to make sure I'm barking up the right tree with some of my high-level design ideas.) | Can I pickle a python dictionary into a sqlite3 text field? | 0.028564 | 1 | 0 | 31,019 |
198,692 | 2008-10-13T19:11:00.000 | 2 | 0 | 1 | 0 | python,sqlite,pickle | 198,829 | 14 | false | 0 | 0 | Yes, you can store a pickled object in a TEXT or BLOB field in an SQLite3 database, as others have explained.
Just be aware that some object cannot be pickled. The built-in container types can (dict, set, list, tuple, etc.). But some objects, such as file handles, refer to state that is external to their own data str... | 6 | 40 | 0 | Any gotchas I should be aware of? Can I store it in a text field, or do I need to use a blob?
(I'm not overly familiar with either pickle or sqlite, so I wanted to make sure I'm barking up the right tree with some of my high-level design ideas.) | Can I pickle a python dictionary into a sqlite3 text field? | 0.028564 | 1 | 0 | 31,019 |
198,692 | 2008-10-13T19:11:00.000 | 1 | 0 | 1 | 0 | python,sqlite,pickle | 199,190 | 14 | false | 0 | 0 | SpoonMeiser is correct, you need to have a strong reason to pickle into a database.
It's not difficult to write Python objects that implement persistence with SQLite. Then you can use the SQLite CLI to fiddle with the data as well. Which in my experience is worth the extra bit of work, since many debug and admin fu... | 6 | 40 | 0 | Any gotchas I should be aware of? Can I store it in a text field, or do I need to use a blob?
(I'm not overly familiar with either pickle or sqlite, so I wanted to make sure I'm barking up the right tree with some of my high-level design ideas.) | Can I pickle a python dictionary into a sqlite3 text field? | 0.014285 | 1 | 0 | 31,019 |
198,692 | 2008-10-13T19:11:00.000 | 23 | 0 | 1 | 0 | python,sqlite,pickle | 198,748 | 14 | true | 0 | 0 | If you want to store a pickled object, you'll need to use a blob, since it is binary data. However, you can, say, base64 encode the pickled object to get a string that can be stored in a text field.
Generally, though, doing this sort of thing is indicative of bad design, since you're storing opaque data you lose the ab... | 6 | 40 | 0 | Any gotchas I should be aware of? Can I store it in a text field, or do I need to use a blob?
(I'm not overly familiar with either pickle or sqlite, so I wanted to make sure I'm barking up the right tree with some of my high-level design ideas.) | Can I pickle a python dictionary into a sqlite3 text field? | 1.2 | 1 | 0 | 31,019 |
199,180 | 2008-10-13T22:08:00.000 | 3 | 1 | 0 | 0 | python,vim,omnicomplete | 213,253 | 6 | false | 0 | 0 | Once I generated ctags for one of my site-packages, it started working for that package -- so I'm guessing that the omnicomplete function depends on ctags for non-sys modules.
EDIT: Not true at all.
Here's the problem -- poor testing on my part -- omnicomplete WAS working for parts of my project, just not most of it.
T... | 1 | 9 | 0 | The only thing I can get python omnicomplete to work with are system modules. I get nothing for help with modules in my site-packages or modules that I'm currently working on. | Is there any way to get python omnicomplete to work with non-system modules in vim? | 0.099668 | 0 | 0 | 4,900 |
199,556 | 2008-10-14T00:23:00.000 | 1 | 0 | 0 | 0 | java,php,python,django,jakarta-ee | 219,328 | 4 | false | 1 | 0 | A lot of the recommendations being given here are assuming you -- and just you -- are doing a full rewrite of the application. This is probably not the case, and it changes the answer quite a bit
If you've already got J2EE kicking around, the correct answer is Grails. It simply is: you probably already have Hibernate... | 3 | 4 | 0 | I want to move a legacy Java web application (J2EE) to a scripting language - any scripting language - in order to improve programming efficiency.
What is the easiest way to do this? Are there any automated tools that can convert the bulk of the business logic? | How can I port a legacy Java/J2EE website to a modern scripting language (PHP,Python/Django, etc)? | 0.049958 | 0 | 0 | 1,554 |
199,556 | 2008-10-14T00:23:00.000 | 6 | 0 | 0 | 0 | java,php,python,django,jakarta-ee | 199,593 | 4 | false | 1 | 0 | Using an automated tool to "port" the web application will almost certainly guarantee that future programming efficiency will be minimised -- not improved.
A good scripting language can help programming efficiency when used by good programmers who understand good coding practices in that language. Automated tools are ... | 3 | 4 | 0 | I want to move a legacy Java web application (J2EE) to a scripting language - any scripting language - in order to improve programming efficiency.
What is the easiest way to do this? Are there any automated tools that can convert the bulk of the business logic? | How can I port a legacy Java/J2EE website to a modern scripting language (PHP,Python/Django, etc)? | 1 | 0 | 0 | 1,554 |
199,556 | 2008-10-14T00:23:00.000 | 11 | 0 | 0 | 0 | java,php,python,django,jakarta-ee | 199,736 | 4 | false | 1 | 0 | Here's what you have to do.
First, be sure you can walk before you run. Build something simple, possibly tangentially related to your main project.
DO NOT build a piece of the final project and hope it will "evolve" into the final project. This never works out well. Why? You'll make dumb mistakes. But you can't de... | 3 | 4 | 0 | I want to move a legacy Java web application (J2EE) to a scripting language - any scripting language - in order to improve programming efficiency.
What is the easiest way to do this? Are there any automated tools that can convert the bulk of the business logic? | How can I port a legacy Java/J2EE website to a modern scripting language (PHP,Python/Django, etc)? | 1 | 0 | 0 | 1,554 |
200,250 | 2008-10-14T07:27:00.000 | 1 | 0 | 0 | 0 | python,apache,http,cookies | 200,271 | 3 | false | 0 | 0 | Return the header
Set-Cookie: token=opaque; Domain=.your.domain; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/
The Domain and Path must match the original attributes that the cookie was issued under. | 3 | 5 | 0 | I've got a web system where users log in, and it stores a cookie of their session. When they log in as someone else or log out I want to remove that original cookie that I stored. What's the best way to do that?
I'm using Python and Apache, though I suppose the answer will remain the same for most languages. | How do I remove a cookie that I've set on someone's computer? | 0.066568 | 0 | 0 | 2,053 |
200,250 | 2008-10-14T07:27:00.000 | 4 | 0 | 0 | 0 | python,apache,http,cookies | 200,255 | 3 | false | 0 | 0 | I guess the best way is to set the expiration to a date of the cookie to some date in the past. | 3 | 5 | 0 | I've got a web system where users log in, and it stores a cookie of their session. When they log in as someone else or log out I want to remove that original cookie that I stored. What's the best way to do that?
I'm using Python and Apache, though I suppose the answer will remain the same for most languages. | How do I remove a cookie that I've set on someone's computer? | 0.26052 | 0 | 0 | 2,053 |
200,250 | 2008-10-14T07:27:00.000 | 7 | 0 | 0 | 0 | python,apache,http,cookies | 200,265 | 3 | true | 0 | 0 | Set the cookie again, as if you hadn't set it the first time, but specify an expiration date that is in the past. | 3 | 5 | 0 | I've got a web system where users log in, and it stores a cookie of their session. When they log in as someone else or log out I want to remove that original cookie that I stored. What's the best way to do that?
I'm using Python and Apache, though I suppose the answer will remain the same for most languages. | How do I remove a cookie that I've set on someone's computer? | 1.2 | 0 | 0 | 2,053 |
200,599 | 2008-10-14T10:04:00.000 | 0 | 0 | 1 | 0 | python,database,web,settings | 201,272 | 12 | false | 0 | 0 | I agree with the reply about using Pickled Dictionary. Very simple and effective for storing simple data in a Dictionary structure. | 3 | 8 | 0 | I am programming a website in which users will have a number of settings, such as their choice of colour scheme, etc. I'm happy to store these as plain text files, and security is not an issue.
The way I currently see it is: there is a dictionary, where all the keys are users and the values are dictionaries with the us... | Store simple user settings in Python | 0 | 0 | 0 | 10,429 |
200,599 | 2008-10-14T10:04:00.000 | 0 | 0 | 1 | 0 | python,database,web,settings | 201,020 | 12 | false | 0 | 0 | Is there are particular reason you're not using the database for this? it seems the normal and natural thing to do - or store a pickle of the settings in the db keyed on user id or something.
You haven't described the usage patterns of the website, but just thinking of a general website - but I would think that keeping... | 3 | 8 | 0 | I am programming a website in which users will have a number of settings, such as their choice of colour scheme, etc. I'm happy to store these as plain text files, and security is not an issue.
The way I currently see it is: there is a dictionary, where all the keys are users and the values are dictionaries with the us... | Store simple user settings in Python | 0 | 0 | 0 | 10,429 |
200,599 | 2008-10-14T10:04:00.000 | 0 | 0 | 1 | 0 | python,database,web,settings | 200,621 | 12 | false | 0 | 0 | If you have a database, I might suggest storing the settings in the database. However, it sounds like ordinary files might suit your environment better.
You probably don't want to store all the users settings in the same file, because you might run into trouble with concurrent access to that one file. If you stored eac... | 3 | 8 | 0 | I am programming a website in which users will have a number of settings, such as their choice of colour scheme, etc. I'm happy to store these as plain text files, and security is not an issue.
The way I currently see it is: there is a dictionary, where all the keys are users and the values are dictionaries with the us... | Store simple user settings in Python | 0 | 0 | 0 | 10,429 |
203,758 | 2008-10-15T04:55:00.000 | 1 | 0 | 1 | 0 | python,sockets | 203,769 | 3 | false | 0 | 0 | What is your question exactly?
What happens when you do receive on a socket is that the current available data in the socket buffer is immediately returned. If you give receive (or read, I guess), a huge buffer size, such as 40000, it'll likely never return that much data at once. If you give it a tiny buffer size lik... | 3 | 2 | 0 | I am writing a program in Python that will act as a server and accept data from a client, is it a good idea to impose a hard limit as to the amount of data, if so why?
More info:
So certain chat programs limit the amount of text one can send per send (i.e. per time user presses send) so the question comes down to is th... | Receive socket size limits good? | 0.066568 | 0 | 1 | 1,350 |
203,758 | 2008-10-15T04:55:00.000 | 2 | 0 | 1 | 0 | python,sockets | 203,933 | 3 | true | 0 | 0 | Most likely you've seen code which protects against "extra" incoming data. This is often due to the possibility of buffer overruns, where the extra data being copied into memory overruns the pre-allocated array and overwrites executable code with attacker code. Code written in languages like C typically has a lot of le... | 3 | 2 | 0 | I am writing a program in Python that will act as a server and accept data from a client, is it a good idea to impose a hard limit as to the amount of data, if so why?
More info:
So certain chat programs limit the amount of text one can send per send (i.e. per time user presses send) so the question comes down to is th... | Receive socket size limits good? | 1.2 | 0 | 1 | 1,350 |
203,758 | 2008-10-15T04:55:00.000 | 0 | 0 | 1 | 0 | python,sockets | 207,096 | 3 | false | 0 | 0 | I don't know what your actual application is, however, setting a hard limit on the total amount of data that a client can send could be useful in reducing your exposure to denial of service attacks, e.g. client connects and sends 100MB of data which could load your application unacceptably.
But it really depends on wha... | 3 | 2 | 0 | I am writing a program in Python that will act as a server and accept data from a client, is it a good idea to impose a hard limit as to the amount of data, if so why?
More info:
So certain chat programs limit the amount of text one can send per send (i.e. per time user presses send) so the question comes down to is th... | Receive socket size limits good? | 0 | 0 | 1 | 1,350 |
203,912 | 2008-10-15T06:59:00.000 | 1 | 0 | 1 | 0 | python,multicore | 203,923 | 7 | false | 0 | 0 | The main difference is how you organize and distribute data. Multicore typically has higher bandwidths between the different cores in a cpu, and multiprocessor needs to involve the bus between the cpus more.
Python 2.6 has gotten multiprocess (process, as in program running) and more synchronization and communication o... | 1 | 70 | 0 | What is the difference between multiprocessor programming and multicore programming?
preferably show examples in python how to write a small program for multiprogramming & multicore programming | Does python support multiprocessor/multicore programming? | 0.028564 | 0 | 0 | 71,173 |
204,062 | 2008-10-15T08:42:00.000 | 5 | 0 | 1 | 0 | python,winapi,service,alerts | 204,082 | 1 | true | 0 | 0 | No, Windows services run on a completely separate hidden desktop and have no access to the logged-on user's desktop. There is no way around this from a service developer's perspective.
In previous versions of Windows, it was possible for a service to be marked as "allowed to interact with the user desktop", but this op... | 1 | 3 | 0 | I have been using win32api.MessageBox to do alerts, and this works for apps running from the interactive prompt and normally executed code, however when I built a Python service when a MessageBox is triggered I can hear the 'beep' but the box does not display. Is it possible to display alerts from services? | Alert Popups from service in Python | 1.2 | 0 | 0 | 958 |
204,802 | 2008-10-15T13:57:00.000 | 2 | 0 | 0 | 0 | php,python,lighttpd,cherrypy,high-load | 244,836 | 5 | false | 1 | 0 | I would go with nginx + php + xcache + postgresql | 4 | 7 | 0 | For a website like reddit with lots of up/down votes and lots of comments per topic what should I go with?
Lighttpd/Php or Lighttpd/CherryPy/Genshi/SQLAlchemy?
and for database what would scale better / be fastest MySQL ( 4.1 or 5 ? ) or PostgreSQL? | What would you recommend for a high traffic ajax intensive website? | 0.07983 | 1 | 0 | 1,670 |
204,802 | 2008-10-15T13:57:00.000 | 2 | 0 | 0 | 0 | php,python,lighttpd,cherrypy,high-load | 204,854 | 5 | false | 1 | 0 | Going to need more data. Jeff had a few articles on the same problems and the answer was to wait till you hit a performance issue.
to start with - who is hosting and what do they have available ? what's your in house talent skill sets ? Are you going to be hiring an outside firm ? what do they recommend ? brand new... | 4 | 7 | 0 | For a website like reddit with lots of up/down votes and lots of comments per topic what should I go with?
Lighttpd/Php or Lighttpd/CherryPy/Genshi/SQLAlchemy?
and for database what would scale better / be fastest MySQL ( 4.1 or 5 ? ) or PostgreSQL? | What would you recommend for a high traffic ajax intensive website? | 0.07983 | 1 | 0 | 1,670 |
204,802 | 2008-10-15T13:57:00.000 | 8 | 0 | 0 | 0 | php,python,lighttpd,cherrypy,high-load | 204,853 | 5 | true | 1 | 0 | I can't speak to the MySQL/PostgreSQL question as I have limited experience with Postgres, but my Masters research project was about high-performance websites with CherryPy, and I don't think you'll be disappointed if you use CherryPy for your site. It can easily scale to thousands of simultaneous users on commodity h... | 4 | 7 | 0 | For a website like reddit with lots of up/down votes and lots of comments per topic what should I go with?
Lighttpd/Php or Lighttpd/CherryPy/Genshi/SQLAlchemy?
and for database what would scale better / be fastest MySQL ( 4.1 or 5 ? ) or PostgreSQL? | What would you recommend for a high traffic ajax intensive website? | 1.2 | 1 | 0 | 1,670 |
204,802 | 2008-10-15T13:57:00.000 | 3 | 0 | 0 | 0 | php,python,lighttpd,cherrypy,high-load | 205,425 | 5 | false | 1 | 0 | On the DB question, I'd say PostgreSQL scales better and has better data integrity than MySQL. For a small site MySQL might be faster, but from what I've heard it slows significantly as the size of the database grows. (Note: I've never used MySQL for a large database, so you should probably get a second opinion about i... | 4 | 7 | 0 | For a website like reddit with lots of up/down votes and lots of comments per topic what should I go with?
Lighttpd/Php or Lighttpd/CherryPy/Genshi/SQLAlchemy?
and for database what would scale better / be fastest MySQL ( 4.1 or 5 ? ) or PostgreSQL? | What would you recommend for a high traffic ajax intensive website? | 0.119427 | 1 | 0 | 1,670 |
205,062 | 2008-10-15T15:02:00.000 | 1 | 1 | 1 | 0 | python,module,compilation | 209,176 | 4 | false | 0 | 0 | I think you can use jython to compile python to Java bytecode, and then compile that with GCJ. | 1 | 14 | 0 | I wonder if it is possible to create an executable module from a Python script. I need to have the most performance and the flexibility of Python script, without needing to run in the Python environment. I would use this code to load on demand user modules to customize my application. | Is it possible to compile Python natively (beyond pyc byte code)? | 0.049958 | 0 | 0 | 4,549 |
205,204 | 2008-10-15T15:37:00.000 | 1 | 0 | 0 | 0 | javascript,python,frameworks | 213,325 | 5 | false | 1 | 0 | web2py uses jQuery | 1 | 1 | 0 | I am starting a new web application project. I want to use python as I am using it at my bread-and-butter-job.
However I don't want to reinvent the wheel. Some things I have thought about:
AJAX would be nice if it’s not too much of a hazzle.
It is best if the licensing allows commercialization but is not crucial at t... | Starting a new database driven python web application would you use a javascript widget framework? If so which framework? | 0.039979 | 0 | 0 | 2,019 |
205,704 | 2008-10-15T17:46:00.000 | 2 | 1 | 0 | 0 | python,validation,emacs,syntax | 207,059 | 5 | false | 0 | 0 | Or from emacs (or vim) you could run python -c 'import x' where x is the name of your file minus the .py extension. | 2 | 15 | 0 | Python's IDLE has 'Check Module' (Alt-X) to check the syntax which can be called without needing to run the code. Is there an equivalent way to do this in Emacs instead of running and executing the code? | How can I check the syntax of Python code in Emacs without actually executing it? | 0.07983 | 0 | 0 | 8,119 |
205,704 | 2008-10-15T17:46:00.000 | 0 | 1 | 0 | 0 | python,validation,emacs,syntax | 207,593 | 5 | false | 0 | 0 | You can use pylint, pychecker, pyflakes etc. from Emacs' compile command (M-x compile).
Hint: bind a key (say, F5) to recompile. | 2 | 15 | 0 | Python's IDLE has 'Check Module' (Alt-X) to check the syntax which can be called without needing to run the code. Is there an equivalent way to do this in Emacs instead of running and executing the code? | How can I check the syntax of Python code in Emacs without actually executing it? | 0 | 0 | 0 | 8,119 |
206,823 | 2008-10-15T22:49:00.000 | 1 | 1 | 0 | 1 | python,ruby,interop | 4,859,776 | 5 | false | 0 | 0 | Expose your Ruby classes as web services using Sinatra, Rails, or, plain old Rack.
Expose your Python classes as web services using web.py, flask, Django, or App Engine.
Use HTTParty for Ruby to build an API into your Python classes.
Use a Python REST library to build an API into your Ruby classes. | 2 | 8 | 0 | I am interested in getting some Python code talking to some Ruby code on Windows, Linux and possibly other platforms. Specificlly I would like to access classes in Ruby from Python and call their methods, access their data, create new instances and so on.
An obvious way to do this is via something like XML-RPC or maybe... | Ruby to Python bridge | 0.039979 | 0 | 0 | 2,499 |
206,823 | 2008-10-15T22:49:00.000 | 3 | 1 | 0 | 1 | python,ruby,interop | 206,839 | 5 | false | 0 | 0 | Please be advised that I don't speak from personal experience here, but I imagine JRuby and Jython (The ruby and python implementations in the JVM) would be able to to easily talk to each other, as well as Java code. You may want to look into that. | 2 | 8 | 0 | I am interested in getting some Python code talking to some Ruby code on Windows, Linux and possibly other platforms. Specificlly I would like to access classes in Ruby from Python and call their methods, access their data, create new instances and so on.
An obvious way to do this is via something like XML-RPC or maybe... | Ruby to Python bridge | 0.119427 | 0 | 0 | 2,499 |
207,234 | 2008-10-16T02:32:00.000 | 24 | 0 | 0 | 1 | python,networking | 207,246 | 11 | true | 0 | 0 | If by "local" you mean on the same network segment, then you have to perform the following steps:
Determine your own IP address
Determine your own netmask
Determine the network range
Scan all the addresses (except the lowest, which is your network address and the highest, which is your broadcast address).
Use your DNS... | 1 | 46 | 0 | How can I get a list of the IP addresses or host names from a local network easily in Python?
It would be best if it was multi-platform, but it needs to work on Mac OS X first, then others follow.
Edit: By local I mean all active addresses within a local network, such as 192.168.xxx.xxx.
So, if the IP address of my com... | List of IP addresses/hostnames from local network in Python | 1.2 | 0 | 1 | 129,230 |
207,290 | 2008-10-16T03:02:00.000 | 1 | 0 | 1 | 0 | python,parsing | 209,420 | 4 | false | 0 | 0 | If you want to handle arbitrary expressions like {'{spam': 42}["spam}"], you can't get away without full-blown parser. | 1 | 1 | 0 | I've been wondering about how hard it would be to write some Python code to search a string for the index of a substring of the form ${expr}, for example, where expr is meant to be a Python expression or something resembling one. Given such a thing, one could easily imagine going on to check the expression's syntax wi... | Extracting a parenthesized Python expression from a string | 0.049958 | 0 | 0 | 1,094 |
207,904 | 2008-10-16T09:21:00.000 | 2 | 0 | 1 | 0 | python,debugging,pdb,watchpoint | 207,968 | 5 | true | 0 | 0 | Please look what pydev in eclipse offers... | 1 | 8 | 0 | pdb and winpdb both seem to be missing this essential (to me) feature. I saw something suggesting WingIDE has it but I'd prefer a solution that is free, and if I do have to pay, I'd prefer to pay for something that is better than Wing. | Is there a free python debugger that has watchpoints? | 1.2 | 0 | 0 | 3,022 |
209,470 | 2008-10-16T17:11:00.000 | 6 | 1 | 1 | 0 | python,bash,shell | 20,313,297 | 17 | false | 0 | 0 | I will give here my opinion based on experience:
For shell:
shell can very easily spawn read-only code. Write it and when you come back to it, you will never figure out what you did again. It's very easy to accomplish this.
shell can do A LOT of text processing, splitting, etc in one line with pipes.
it is the best gl... | 5 | 242 | 0 | I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl.
I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends? | How to implement common bash idioms in Python? | 1 | 0 | 0 | 115,137 |
209,470 | 2008-10-16T17:11:00.000 | 2 | 1 | 1 | 0 | python,bash,shell | 209,665 | 17 | false | 0 | 0 | Your best bet is a tool that is specifically geared towards your problem. If it's processing text files, then Sed, Awk and Perl are the top contenders. Python is a general-purpose dynamic language. As with any general purpose language, there's support for file-manipulation, but that isn't what it's core purpose is. ... | 5 | 242 | 0 | I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl.
I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends? | How to implement common bash idioms in Python? | 0.023525 | 0 | 0 | 115,137 |
209,470 | 2008-10-16T17:11:00.000 | 3 | 1 | 1 | 0 | python,bash,shell | 210,429 | 17 | false | 0 | 0 | I have built semi-long shell scripts (300-500 lines) and Python code which does similar functionality. When many external commands are being executed, I find the shell is easier to use. Perl is also a good option when there is lots of text manipulation. | 5 | 242 | 0 | I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl.
I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends? | How to implement common bash idioms in Python? | 0.035279 | 0 | 0 | 115,137 |
209,470 | 2008-10-16T17:11:00.000 | 16 | 1 | 1 | 0 | python,bash,shell | 210,290 | 17 | false | 0 | 0 | In the beginning there was sh, sed, and awk (and find, and grep, and...). It was good. But awk can be an odd little beast and hard to remember if you don't use it often. Then the great camel created Perl. Perl was a system administrator's dream. It was like shell scripting on steroids. Text processing, including regula... | 5 | 242 | 0 | I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl.
I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends? | How to implement common bash idioms in Python? | 1 | 0 | 0 | 115,137 |
209,470 | 2008-10-16T17:11:00.000 | 7 | 1 | 1 | 0 | python,bash,shell | 16,726,383 | 17 | false | 0 | 0 | One reason I love Python is that it is much better standardized than the POSIX tools. I have to double and triple check that each bit is compatible with other operating systems. A program written on a Linux system might not work the same on a BSD system of OSX. With Python, I just have to check that the target syste... | 5 | 242 | 0 | I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl.
I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends? | How to implement common bash idioms in Python? | 1 | 0 | 0 | 115,137 |
209,888 | 2008-10-16T19:19:00.000 | 2 | 0 | 1 | 0 | python,python-3.x,python-2.x | 209,907 | 6 | false | 0 | 0 | Python 2.x has been out long enough to build up quite a few tutorials already, but 3k has much less resources available. Some intro level 3k stuff would probably see more general purpose use. So unless you're tailoring this to a specific sub domain that lacks any python resources, 3k would be of greater use. | 4 | 7 | 0 | Python 3.0 is in beta with a final release coming shortly. Obviously it will take some significant time for general adoption and for it to eventually replace 2.x.
I am writing a tutorial about certain aspects of programming Python. I'm wondering if I should do it in Python 2.x or 3.0? (not that the difference is huge... | Tutorial for Python - Should I use 2.x or 3.0? | 0.066568 | 0 | 0 | 3,359 |
209,888 | 2008-10-16T19:19:00.000 | 2 | 0 | 1 | 0 | python,python-3.x,python-2.x | 209,911 | 6 | false | 0 | 0 | Learn Python 3.0, as contagious suggests.
Python 2.x is not very different, there seems to be a great deal of FUD about the rather minor differences between them. Sure, the differences are great enough that most programs will need to be modified, but almost all of the modifications are straightforward (like changing p... | 4 | 7 | 0 | Python 3.0 is in beta with a final release coming shortly. Obviously it will take some significant time for general adoption and for it to eventually replace 2.x.
I am writing a tutorial about certain aspects of programming Python. I'm wondering if I should do it in Python 2.x or 3.0? (not that the difference is huge... | Tutorial for Python - Should I use 2.x or 3.0? | 0.066568 | 0 | 0 | 3,359 |
209,888 | 2008-10-16T19:19:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,python-2.x | 209,910 | 6 | false | 0 | 0 | The differences are small enough that it's really not going to matter much. | 4 | 7 | 0 | Python 3.0 is in beta with a final release coming shortly. Obviously it will take some significant time for general adoption and for it to eventually replace 2.x.
I am writing a tutorial about certain aspects of programming Python. I'm wondering if I should do it in Python 2.x or 3.0? (not that the difference is huge... | Tutorial for Python - Should I use 2.x or 3.0? | 0 | 0 | 0 | 3,359 |
209,888 | 2008-10-16T19:19:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,python-2.x | 209,893 | 6 | false | 0 | 0 | It depends on your audience. If it's a general audience, and you plan to leave it posted for a long time, I'd suggest looking forward and going with 3.0. On the other hand if it's for a project or group that's going to be doing work in the near future, Python 2 probably make more sense. | 4 | 7 | 0 | Python 3.0 is in beta with a final release coming shortly. Obviously it will take some significant time for general adoption and for it to eventually replace 2.x.
I am writing a tutorial about certain aspects of programming Python. I'm wondering if I should do it in Python 2.x or 3.0? (not that the difference is huge... | Tutorial for Python - Should I use 2.x or 3.0? | 0 | 0 | 0 | 3,359 |
210,978 | 2008-10-17T03:04:00.000 | 0 | 0 | 0 | 1 | python,shell,exec | 211,898 | 2 | false | 1 | 0 | Make sure you aren't relying on shell expansion in your classpath. E.g. "~/my.jar" will get expanded by the shell in an os.system call, but not, I believe in an os.execvp call. | 1 | 7 | 0 | I have a question about using os.execvp in Python. I have the following bit of code that's used to create a list of arguments:
args = [ "java"
, classpath
, "-Djava.library.path=" + lib_path()
, ea
, "-Xmx1000m"
, "-server"
, "code_swarm"
, params
]
When I outpu... | Using os.execvp in Python | 0 | 0 | 0 | 11,349 |
211,160 | 2008-10-17T05:30:00.000 | 1 | 1 | 0 | 0 | python,algorithm,matrix,linear-algebra,matrix-inverse | 213,717 | 7 | false | 0 | 0 | If you hate numpy, get out RPy and your local copy of R, and use it instead.
(I would also echo to make you you really need to invert the matrix. In R, for example, linalg.solve and the solve() function don't actually do a full inversion, since it is unnecessary.) | 1 | 62 | 1 | How do I get the inverse of a matrix in python? I've implemented it myself, but it's pure python, and I suspect there are faster modules out there to do it. | Python Inverse of a Matrix | 0.028564 | 0 | 0 | 125,109 |
211,501 | 2008-10-17T09:02:00.000 | 0 | 0 | 0 | 0 | python,exception,sqlite | 214,623 | 8 | false | 0 | 0 | Yes, I was nuking out the problem. All I needed to do was check for the file and catch the IOError if it didn't exist.
Thanks for all the other answers. They may come in handy in the future. | 5 | 13 | 0 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in produc... | Using SQLite in a Python program | 0 | 1 | 0 | 31,269 |
211,501 | 2008-10-17T09:02:00.000 | 3 | 0 | 0 | 0 | python,exception,sqlite | 211,539 | 8 | false | 0 | 0 | Doing SQL in overall is horrible in any language I've picked up. SQLalchemy has shown to be easiest from them to use because actual query and committing with it is so clean and absent from troubles.
Here's some basic steps on actually using sqlalchemy in your app, better details can be found from the documentation.
pr... | 5 | 13 | 0 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in produc... | Using SQLite in a Python program | 0.07486 | 1 | 0 | 31,269 |
211,501 | 2008-10-17T09:02:00.000 | 7 | 0 | 0 | 0 | python,exception,sqlite | 211,573 | 8 | false | 0 | 0 | SQLite automatically creates the database file the first time you try to use it. The SQL statements for creating tables can use IF NOT EXISTS to make the commands only take effect if the table has not been created This way you don't need to check for the database's existence beforehand: SQLite can take care of that for... | 5 | 13 | 0 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in produc... | Using SQLite in a Python program | 1 | 1 | 0 | 31,269 |
211,501 | 2008-10-17T09:02:00.000 | 29 | 0 | 0 | 0 | python,exception,sqlite | 211,660 | 8 | false | 0 | 0 | Don't make this more complex than it needs to be. The big, independent databases have complex setup and configuration requirements. SQLite is just a file you access with SQL, it's much simpler.
Do the following.
Add a table to your database for "Components" or "Versions" or "Configuration" or "Release" or something ... | 5 | 13 | 0 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in produc... | Using SQLite in a Python program | 1 | 1 | 0 | 31,269 |
211,501 | 2008-10-17T09:02:00.000 | 13 | 0 | 0 | 0 | python,exception,sqlite | 211,534 | 8 | true | 0 | 0 | AFAIK an SQLITE database is just a file.
To check if the database exists, check for file existence.
When you open a SQLITE database it will automatically create one if the file that backs it up is not in place.
If you try and open a file as a sqlite3 database that is NOT a database, you will get this:
"sqlite3.Database... | 5 | 13 | 0 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in produc... | Using SQLite in a Python program | 1.2 | 1 | 0 | 31,269 |
211,536 | 2008-10-17T09:23:00.000 | 2 | 1 | 1 | 0 | java,javascript,python,scripting-language | 838,738 | 11 | false | 1 | 0 | Short version
Don’t use a scripting language! Instead focus on configurability (which is something that a non-programmer can do well).
Longer version
One oft-used argument in favour of having a scripting language is that it allows for lesser programmers to more trivial tasks. Don't belive this, it will not save you any... | 3 | 8 | 0 | Me and some friends are writing a MORPG in Java, and we would like to use a scripting language to, eg. to create quests.
We have non experience with scripting in Java. We have used Python, but we are very inexperienced with it. One of us also have used Javascript.
What scripting language should we use?
What scripting ... | Scripting in Java | 0.036348 | 0 | 0 | 1,679 |
211,536 | 2008-10-17T09:23:00.000 | 0 | 1 | 1 | 0 | java,javascript,python,scripting-language | 211,883 | 11 | false | 1 | 0 | I am a big fan of Python/Jython due to the clean syntax - which may suit you if you have some python experience.
Otherwise Groovy which is based on Java syntax and may be an easier learning curve if most of your developers are Java guys. It also has the advantage of closer ties with the Java language and libraries.
B... | 3 | 8 | 0 | Me and some friends are writing a MORPG in Java, and we would like to use a scripting language to, eg. to create quests.
We have non experience with scripting in Java. We have used Python, but we are very inexperienced with it. One of us also have used Javascript.
What scripting language should we use?
What scripting ... | Scripting in Java | 0 | 0 | 0 | 1,679 |
211,536 | 2008-10-17T09:23:00.000 | 9 | 1 | 1 | 0 | java,javascript,python,scripting-language | 215,096 | 11 | false | 1 | 0 | I'm responsible for a fairly large hybrid Java/Jython system. We use java for core API development, then wire Java objects together using Jython. This is in a scientific computing environment where we need to be able to put together ad-hoc data analysis scripts quickly.
If I were starting this system from scratch t... | 3 | 8 | 0 | Me and some friends are writing a MORPG in Java, and we would like to use a scripting language to, eg. to create quests.
We have non experience with scripting in Java. We have used Python, but we are very inexperienced with it. One of us also have used Javascript.
What scripting language should we use?
What scripting ... | Scripting in Java | 1 | 0 | 0 | 1,679 |
213,483 | 2008-10-17T19:12:00.000 | 3 | 1 | 1 | 0 | python,apache,webserver,mod-python | 213,742 | 11 | false | 0 | 0 | Its hard to give a definitive answer without knowing what kind of site you are working on and what kind of load you are expecting. Sub second performance may be a serious requirement or it may not. If you really need to save that last millisecond then you absolutely need to keep your arrays in memory. However as oth... | 3 | 13 | 0 | I am looking for a python webserver which is multithreaded instead of being multi-process (as in case of mod_python for apache). I want it to be multithreaded because I want to have an in memory object cache that will be used by various http threads. My webserver does a lot of expensive stuff and computes some large ar... | A good multithreaded python webserver? | 0.054491 | 0 | 0 | 12,249 |
213,483 | 2008-10-17T19:12:00.000 | 7 | 1 | 1 | 0 | python,apache,webserver,mod-python | 213,572 | 11 | false | 0 | 0 | Consider reconsidering your design. Maintaining that much state in your webserver is probably a bad idea. Multi-process is a much better way to go for stability.
Is there another way to share state between separate processes? What about a service? Database? Index?
It seems unlikely that maintaining a huge array of da... | 3 | 13 | 0 | I am looking for a python webserver which is multithreaded instead of being multi-process (as in case of mod_python for apache). I want it to be multithreaded because I want to have an in memory object cache that will be used by various http threads. My webserver does a lot of expensive stuff and computes some large ar... | A good multithreaded python webserver? | 1 | 0 | 0 | 12,249 |
213,483 | 2008-10-17T19:12:00.000 | 2 | 1 | 1 | 0 | python,apache,webserver,mod-python | 215,292 | 11 | false | 0 | 0 | web.py has made me happy in the past. Consider checking it out.
But it does sound like an architectural redesign might be the proper, though more expensive, solution. | 3 | 13 | 0 | I am looking for a python webserver which is multithreaded instead of being multi-process (as in case of mod_python for apache). I want it to be multithreaded because I want to have an in memory object cache that will be used by various http threads. My webserver does a lot of expensive stuff and computes some large ar... | A good multithreaded python webserver? | 0.036348 | 0 | 0 | 12,249 |
213,838 | 2008-10-17T21:02:00.000 | 5 | 1 | 0 | 0 | python,performance,trac | 214,162 | 4 | true | 0 | 0 | It's hard to say without knowing more about your setup, but one easy win is to make sure that Trac is running in something like mod_python, which keeps the Python runtime in memory. Otherwise, every HTTP request will cause Python to run, import all the modules, and then finally handle the request. Using mod_python (or ... | 2 | 3 | 0 | I have noticed that my particular instance of Trac is not running quickly and has big lags. This is at the very onset of a project, so not much is in Trac (except for plugins and code loaded into SVN).
Setup Info: This is via a SELinux system hosted by WebFaction. It is behind Apache, and connections are over SSL. C... | How to improve Trac's performance | 1.2 | 0 | 1 | 2,997 |
213,838 | 2008-10-17T21:02:00.000 | 3 | 1 | 0 | 0 | python,performance,trac | 215,084 | 4 | false | 0 | 0 | We've had the best luck with FastCGI. Another critical factor was to only use https for authentication but use http for all other traffic -- I was really surprised how much that made a difference. | 2 | 3 | 0 | I have noticed that my particular instance of Trac is not running quickly and has big lags. This is at the very onset of a project, so not much is in Trac (except for plugins and code loaded into SVN).
Setup Info: This is via a SELinux system hosted by WebFaction. It is behind Apache, and connections are over SSL. C... | How to improve Trac's performance | 0.148885 | 0 | 1 | 2,997 |
214,536 | 2008-10-18T03:56:00.000 | 1 | 0 | 0 | 0 | python,templating | 215,700 | 7 | false | 1 | 0 | I've played both roles and at heart I prefer more of a programmer's templating language. However, I freelance for a few graphic designers doing the "heavy lifting" backed and db programming and can tell you that I've had the best luck with XML templating languages (SimpleTAL, Genshi, etc).
When I'm trying to be web de... | 1 | 5 | 0 | What are some good templating engines for web designers? I definitely have my preferences as to what I'd prefer to work with as a programmer. But web designers seem to have a different way of thinking about things and thus may prefer a different system.
So:
Web designers: what templating engine do you prefer to wor... | Python templates for web designers | 0.028564 | 0 | 0 | 1,891 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.