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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,273,414 | 2010-02-16T14:06:00.000 | 1 | 0 | 0 | 0 | python,sql,mysql,tdd,automated-tests | 2,273,471 | 2 | true | 0 | 0 | I'd do both. Run against the small set first to make sure all the code works, then run against the large dataset for things which need to be tested for time, this would be selects, searches and reports especially. If you are doing inserts or deletes or updates on multiple row sets, I'd test those as well against the la... | 2 | 1 | 0 | I am developing some Python modules that use a mysql database to insert some data and produce various types of report. I'm doing test driven development and so far I run:
some CREATE / UPDATE / DELETE tests against a temporary database that is thrown away at the end of each test case, and
some report generation tests... | Should pre-commit tests use a big data set and fail if queries take too long, or use a small test database? | 1.2 | 1 | 0 | 107 |
2,273,414 | 2010-02-16T14:06:00.000 | 1 | 0 | 0 | 0 | python,sql,mysql,tdd,automated-tests | 2,273,476 | 2 | false | 0 | 0 | The problem with testing against real data is that it contains lots of duplicate values, and not enough edge cases. It is also difficult to know what the expected values ought to be (especially if your live database is very big). Oh, and depending on what the live application does, it can be illegal to use the data ... | 2 | 1 | 0 | I am developing some Python modules that use a mysql database to insert some data and produce various types of report. I'm doing test driven development and so far I run:
some CREATE / UPDATE / DELETE tests against a temporary database that is thrown away at the end of each test case, and
some report generation tests... | Should pre-commit tests use a big data set and fail if queries take too long, or use a small test database? | 0.099668 | 1 | 0 | 107 |
2,273,462 | 2010-02-16T14:14:00.000 | 1 | 0 | 1 | 0 | python,regex,string,split,uppercase | 2,273,756 | 5 | false | 0 | 0 | So 'words' in this case are:
Any number of uppercase letters - unless the last uppercase letter is followed by a lowercase letter.
One uppercase letter followed by any number of lowercase letters.
so try:
([A-Z]+(?![a-z])|[A-Z][a-z]*)
The first alternation includes a negative lookahead (?![a-z]), which handles the bo... | 2 | 4 | 0 | I would like to replace strings like 'HDMWhoSomeThing' to 'HDM Who Some Thing' with regex.
So I would like to extract words which starts with an upper-case letter or consist of upper-case letters only. Notice that in the string 'HDMWho' the last upper-case letter is in the fact the first letter of the word Who - and sh... | Regex divide with upper-case | 0.039979 | 0 | 0 | 2,370 |
2,273,462 | 2010-02-16T14:14:00.000 | 2 | 0 | 1 | 0 | python,regex,string,split,uppercase | 2,273,759 | 5 | false | 0 | 0 | one liner :
' '.join(a or b for a,b in re.findall('([A-Z][a-z]+)|(?:([A-Z]*)(?=[A-Z]))',s))
using regexp
([A-Z][a-z]+)|(?:([A-Z]*)(?=[A-Z])) | 2 | 4 | 0 | I would like to replace strings like 'HDMWhoSomeThing' to 'HDM Who Some Thing' with regex.
So I would like to extract words which starts with an upper-case letter or consist of upper-case letters only. Notice that in the string 'HDMWho' the last upper-case letter is in the fact the first letter of the word Who - and sh... | Regex divide with upper-case | 0.07983 | 0 | 0 | 2,370 |
2,274,068 | 2010-02-16T15:46:00.000 | 1 | 0 | 1 | 0 | ironpython | 2,278,532 | 1 | true | 0 | 0 | My guess is you're using a version of pyc.py against a version of IronPython for which it is not intended. The latest versions of IronPython include pyc.py in the Tools\Scripts directory of the installation dir. | 1 | 1 | 0 | AttributeError: attribute "CompilerSink" of "namespace#" object is read-only | Error in IronPython Command Line Compiler | 1.2 | 0 | 0 | 189 |
2,275,043 | 2010-02-16T17:50:00.000 | 2 | 0 | 0 | 0 | python,django | 2,275,652 | 2 | true | 1 | 0 | The User model has a lot of dependencies and must conform to a diverse set of API requirements in order to interoperate with the rest of the django framework. This is because of its relationship with authentication and authorization. Changing User means changing the expected behavior of contrib.auth. If you want to ... | 2 | 0 | 0 | Why doesn't django just have the model to use for User configured in the settings file?
The requirements on the model specified would be that it contain a certain set of fields.
Is there a reason why it couldn't be done this way? | Why does django not do for the User model the same as it does for the userprofile model? | 1.2 | 0 | 0 | 89 |
2,275,043 | 2010-02-16T17:50:00.000 | 0 | 0 | 0 | 0 | python,django | 2,275,208 | 2 | false | 1 | 0 | "Why doesn't django just have the model to use for User configured in the settings file?"
I have a site that doesn't need users or a login or authentication.
I don't want the model for User.
In order to support everyone with applications like mine, User is optional. | 2 | 0 | 0 | Why doesn't django just have the model to use for User configured in the settings file?
The requirements on the model specified would be that it contain a certain set of fields.
Is there a reason why it couldn't be done this way? | Why does django not do for the User model the same as it does for the userprofile model? | 0 | 0 | 0 | 89 |
2,276,000 | 2010-02-16T20:15:00.000 | 4 | 1 | 0 | 0 | python | 2,276,041 | 6 | false | 1 | 0 | One of the lightest-weight frameworks is mod_wsgi. Anything less is going to be a huge amount of work parsing HTTP requests to find headers and URI's and methods and parsing the GET or POST query/data association, handling file uploads, cookies, etc.
As it is, mod_wsgi will only handle the basics of request parsing an... | 1 | 43 | 0 | I am just starting Python and I was wondering how I would go about programming web applications without the need of a framework. I am an experienced PHP developer but I have an urge to try out Python and I usually like to write from scratch without the restriction of a framework like flask or django to name a few. | Program web applications in python without a framework? | 0.132549 | 0 | 0 | 35,567 |
2,276,117 | 2010-02-16T20:33:00.000 | 5 | 0 | 1 | 0 | python,multiprocessing,virtual-machine | 2,276,333 | 2 | false | 0 | 0 | If you ignore any communication issues (i.e., if the separate Python VMs do not communicate among themselves, or communicate only through other mechanisms that are explicitly established), there are no other substantial differences. (I believe multiprocessing, under certain conditions -- Unix-like platforms, in partic... | 2 | 17 | 0 | Aside from the ease of use of the multiprocessing module when it comes to hooking up processes with communication resources, are there any other differences between spawning multiple processes using multiprocessing compared to using subprocess to launch separate Python VMs ? | Python multiprocessing process vs. standalone Python VM | 0.462117 | 0 | 0 | 5,857 |
2,276,117 | 2010-02-16T20:33:00.000 | 22 | 0 | 1 | 0 | python,multiprocessing,virtual-machine | 2,276,366 | 2 | true | 0 | 0 | On Posix platforms, multiprocessing primitives essentially wrap an os.fork(). What this means is that at point you spawn a process in multiprocessing, the code already imported/initialized remains so in the child process.
This can be a boon if you have a lot of things to initialize and then each subprocess essentially ... | 2 | 17 | 0 | Aside from the ease of use of the multiprocessing module when it comes to hooking up processes with communication resources, are there any other differences between spawning multiple processes using multiprocessing compared to using subprocess to launch separate Python VMs ? | Python multiprocessing process vs. standalone Python VM | 1.2 | 0 | 0 | 5,857 |
2,276,235 | 2010-02-16T20:50:00.000 | 2 | 0 | 0 | 0 | python,gis,arcgis,gdal | 2,294,445 | 3 | false | 0 | 0 | ArcObjects and geoprocessing add a lot more functionality than GDAL and is mostly aimed at the desktop. Another option for looking at Python is also using QGIS which has a python API, is Free and Open Source, and an active developer community.
There are also plenty of python libraries for doing spatial work, such as S... | 1 | 3 | 0 | Im just starting off with GDAL + python to support operations that cannot be done with ArcGIS python geoprocessing scripting. Mainly I am doing spatial modeling/analysis/editing of raster and vector data.
I am a bit confused when ArcObject development is required versus when GDAL can be used?
Is there functionality of ... | GIS: When and why to use ArcObjects over GDAL programming to work with ArcGIS rasters and vectors? | 0.132549 | 0 | 0 | 3,379 |
2,276,512 | 2010-02-16T21:31:00.000 | 0 | 1 | 1 | 1 | python,windows,installation,path,python-3.x | 2,276,543 | 2 | false | 0 | 0 | Hmm, find the Lib dir from sys.path and extrapolate from there? | 1 | 1 | 0 | I need to access the Scripts and tcl sub-directories of the currently executing Python instance's installation directory on Windows.
What is the best way to locate these directories? | Path of current Python instance? | 0 | 0 | 0 | 590 |
2,276,800 | 2010-02-16T22:18:00.000 | 1 | 1 | 1 | 0 | python,properties,metaprogramming,automatic-properties | 2,277,257 | 4 | false | 0 | 0 | Be careful using magic, especially magically altering other people's bindings. This has the disadvantages that
Your code is incompatible with other people accessing the same library. Someone can't import one of your modules or copy and paste your code and have it work perfectly with their program accessing the same l... | 1 | 4 | 0 | I have a big library written in C++ and someone created an interface to use it in python (2.6) in an automatic way. Now I have a lot of classes with getter and setter methods. Really: I hate them.
I want to re-implement the classes with a more pythonic interface using properties. The problem is that every class has hun... | Automatic transformation from getter/setter to properties | 0.049958 | 0 | 0 | 2,591 |
2,277,302 | 2010-02-16T23:50:00.000 | 11 | 0 | 0 | 0 | python,url,encoding | 2,277,313 | 3 | true | 0 | 0 | Take a look at urllib.unquote and urllib.unquote_plus. That will address your problem. Technically though url "encoding" is the process of passing arguments into a url with the & and ? characters (e.g. www.foo.com?x=11&y=12). | 1 | 11 | 0 | Given this:
It%27s%20me%21
Unencode it and turn it into regular text? | How do I url unencode in Python? | 1.2 | 0 | 1 | 5,032 |
2,277,571 | 2010-02-17T00:45:00.000 | 0 | 0 | 1 | 1 | c#,python,command-line | 7,886,740 | 2 | false | 0 | 0 | I had a similar issue, I solved it by adding raw_input() at the end of the script.
Even if it's not using the value the script should hold before quitting as it waits for input from the command line.
Sadly this doesn't help if the script errors out before it reaches the raw_input() line, but you'll see how far along i... | 1 | 1 | 0 | Now the obvious answer is to just open the script from a command line, but that isn't an option. I'm writing a simple application to syntax highlight Python and then run the scripts from the same program. A Python IDE if you will. The scripts I want to run are entirely command line programs.
I'm using a System.Diagn... | How can I keep a Python script command window open when opened from a .Net application? | 0 | 0 | 0 | 797 |
2,277,895 | 2010-02-17T02:13:00.000 | 0 | 0 | 1 | 0 | python,dictionary,merge | 2,278,164 | 3 | false | 0 | 0 | If I understood your question correctly and you have integer ids for the words and corpora, then you can gain some performance by switching from a dict to a list, or even better, a numpy array. This may be annoying!
Basically, you need to replace the tuple with a single integer, which we can call the newid. You want a... | 1 | 2 | 0 | Sorry for the very general title but I'll try to be as specific as possible.
I am working on a text mining application. I have a large number of key value pairs of the form ((word, corpus) -> occurence_count) (everything is an integer) which I am storing in multiple python dictionaries (tuple->int). These values are s... | merging dictionaries in python | 0 | 0 | 0 | 1,000 |
2,278,228 | 2010-02-17T04:04:00.000 | 4 | 0 | 0 | 0 | c++,python,c,opencv | 10,057,553 | 4 | false | 0 | 1 | I think it depends how proficient you are in C++. The Mat interface does appear more modern than the old IPLImage C interface. The problem I'm having is that most of the examples you'll find on the web, or even here on stackoverflow are for the C interface (e.g. cvCvtColor), not for the C++ interface. So I'm really str... | 3 | 27 | 0 | I was thinking of trying OpenCV for a project and noticed that it had C, C++ and Python.
I am trying to figure out whether I should use C++, C or Python -- and would like to use whatever has the best OpenCV support.
Just from looking at the index page for the various documentation it looks like the C++ bindings might... | OpenCV Image Processing -- C++ vs C vs Python | 0.197375 | 0 | 0 | 7,757 |
2,278,228 | 2010-02-17T04:04:00.000 | 13 | 0 | 0 | 0 | c++,python,c,opencv | 2,278,331 | 4 | true | 0 | 1 | The Python interface is still being developed whereas the C++ interface (especially with the new Mat class) is quite mature. If you're comfortable in C++, I would highly recommend using it - else, you can start using Python and contribute back any features you think OpenCV needs :) | 3 | 27 | 0 | I was thinking of trying OpenCV for a project and noticed that it had C, C++ and Python.
I am trying to figure out whether I should use C++, C or Python -- and would like to use whatever has the best OpenCV support.
Just from looking at the index page for the various documentation it looks like the C++ bindings might... | OpenCV Image Processing -- C++ vs C vs Python | 1.2 | 0 | 0 | 7,757 |
2,278,228 | 2010-02-17T04:04:00.000 | 1 | 0 | 0 | 0 | c++,python,c,opencv | 16,210,061 | 4 | false | 0 | 1 | Even if you're very proficient in C or C++, you should use python to speed up your development (I should guess a 4x factor). Performance are really quite the same. | 3 | 27 | 0 | I was thinking of trying OpenCV for a project and noticed that it had C, C++ and Python.
I am trying to figure out whether I should use C++, C or Python -- and would like to use whatever has the best OpenCV support.
Just from looking at the index page for the various documentation it looks like the C++ bindings might... | OpenCV Image Processing -- C++ vs C vs Python | 0.049958 | 0 | 0 | 7,757 |
2,278,665 | 2010-02-17T06:06:00.000 | -1 | 0 | 0 | 1 | python,udp,twisted | 2,278,671 | 2 | false | 0 | 0 | Are you sure that it is not a receive problem?
There is no indication that your packets won't be fragmented en route to the destination | 2 | 1 | 0 | I would like to find out if Twisted imposes restriction on maximum size of UDP packets. The allowable limit on linux platforms is upto 64k (although I intend to send packets of about 10k bytes consisting of JPEG images) but I am not able to send more than approx. 2500 bytes | Question regarding UDP communication in twisted framework | -0.099668 | 0 | 0 | 435 |
2,278,665 | 2010-02-17T06:06:00.000 | 1 | 0 | 0 | 1 | python,udp,twisted | 2,280,167 | 2 | false | 0 | 0 | It's very unlikely that Twisted is imposing any limit but there's no reason some other part of the network wouldn't drop the packets if they're too large. It's very rare for people to send UDP packets of such a large size for precisely that sort of reason. Most game applications for example try to keep them below 1.5K ... | 2 | 1 | 0 | I would like to find out if Twisted imposes restriction on maximum size of UDP packets. The allowable limit on linux platforms is upto 64k (although I intend to send packets of about 10k bytes consisting of JPEG images) but I am not able to send more than approx. 2500 bytes | Question regarding UDP communication in twisted framework | 0.099668 | 0 | 0 | 435 |
2,279,749 | 2010-02-17T10:11:00.000 | 0 | 0 | 0 | 1 | python,bash,curl,scripting,multiplatform | 2,301,977 | 2 | false | 0 | 0 | I thought Pycurl might be the answer. Ahh Daniel Sternberg and his innocent presumptions that everybody knows what he does. I asked on the list whether or not pycurl had a "curl -o" analogue, and then asked 'If so: How would one go about coding it/them in a Python script?' His reply was the following:
"curl.setopt(pycu... | 1 | 4 | 0 | The particular alias I'm looking to "class up" into a Python script happens to be one that makes use of the cUrl -o (output to file) option. I suppose I could as easily turn it into a BASH function, but someone advised me that I could avoid the quirks and pitfalls of the different versions and "flavors" of BASH by taki... | Bash alias to Python script -- is it possible? | 0 | 0 | 0 | 11,553 |
2,281,373 | 2010-02-17T14:23:00.000 | 0 | 0 | 0 | 0 | python,pygtk | 70,261,450 | 2 | false | 0 | 1 | If you don't want to see the object then you could button.set_visible(False) to hide it or button.set_visible(True) to show it. This will prevent users from seeing the button. | 1 | 18 | 0 | How can I set a gtk.Button enabled or disabled in PyGTK? | Enable or disable gtk.Button in PyGTK | 0 | 0 | 0 | 12,047 |
2,282,300 | 2010-02-17T16:14:00.000 | 1 | 0 | 1 | 0 | python,list,tuples | 2,282,328 | 2 | false | 0 | 0 | Tuples are immutable, they can't be modified. Convert it to a list, then convert it back if you want to (list((a, b))). | 1 | 3 | 0 | I have a list of tuples representing x,y points. I also have a list of values for each of these points. How do I combine them into a list of lists (i.e one entry for each point [x,y,val]) or a list of tuples?
Thanks | Adding an entry to a python tuple | 0.099668 | 0 | 0 | 928 |
2,282,360 | 2010-02-17T16:20:00.000 | 1 | 0 | 0 | 0 | java,python | 2,282,470 | 5 | false | 1 | 0 | The largest issue I can think of is the need to install an interpreter.
With Java, a lot of people will already have that interpreter installed, although you won't necessarily know which version. It may be wise to include the installer for Java with the program.
With Python, you're going to have to install the interpr... | 2 | 0 | 0 | I'm going to write my first non-Access project, and I need advice on choosing the platform. I will be installing it on multiple friends' and family's computers, so (since I'm sure many, many platforms would suffice just fine for my app), my highest priority has two parts: 1) ease of install for the non-technical user a... | Help for novice choosing between Java and Python for app with sql db | 0.039979 | 1 | 0 | 594 |
2,282,360 | 2010-02-17T16:20:00.000 | 1 | 0 | 0 | 0 | java,python | 2,283,347 | 5 | true | 1 | 0 | If you're going to install only (or mostly) on Windows, I'd go with .Net.
If you have experience with C++, then C# would be natural to you, but if you're comfortable with VBA, you can try VB.NET, but if you prefer Python, then there is IronPython or can give a try to IronRuby, but the best of all is you can mix them a... | 2 | 0 | 0 | I'm going to write my first non-Access project, and I need advice on choosing the platform. I will be installing it on multiple friends' and family's computers, so (since I'm sure many, many platforms would suffice just fine for my app), my highest priority has two parts: 1) ease of install for the non-technical user a... | Help for novice choosing between Java and Python for app with sql db | 1.2 | 1 | 0 | 594 |
2,282,619 | 2010-02-17T16:52:00.000 | 2 | 0 | 0 | 0 | python,django,model-view-controller,frameworks | 2,282,645 | 4 | false | 1 | 0 | Well, I have a trivial solution - get used to reading the manual and the django book they host.
Django manual is organized well, and once you have a mental picture of it, you'll really be able to make a good use of it.
Two things I wish Django docs were better at - tell clearly where to import stuff right at each defin... | 1 | 6 | 0 | I am looking for advice on best resources to learn how to develop webapps with Django [the python framework]. Here's a few information to help responders to narrow-down the gazillion options "out there".
Where I stand
I know python (2.x series) and I have developed a few applications/scripts with it. I wouldn't define... | Suggestions wanted: learning material for Django | 0.099668 | 0 | 0 | 514 |
2,283,034 | 2010-02-17T17:43:00.000 | 9 | 1 | 1 | 0 | python,perl | 2,286,686 | 7 | false | 0 | 0 | Being a hardcore Perl programmer, all I can say is DO NOT BUY O'Reilly's "Learning Python". It is nowhere NEAR as good as "Learning Perl", and there's no equivalent I know of to Larry Wall's "Programming Perl", which is simply unbeatable.
I've had the most success taking past Perl programs and translating them into Pyt... | 2 | 55 | 0 | I am an experienced Perl developer with some degree of experience and/or familiarity with other languages (working experience with C/C++, school experience with Java and Scheme, and passing familiarity with many others).
I might need to get some web work done in Python (most immediately, related to Google App Engine). ... | Python for a Perl programmer | 1 | 0 | 0 | 24,062 |
2,283,034 | 2010-02-17T17:43:00.000 | -4 | 1 | 1 | 0 | python,perl | 2,283,093 | 7 | false | 0 | 0 | I wouldn't try to compare Perl and Python too much in order to learn Python, especially since you have working knowledge of other languages. If you are unfamiliar with OOP/Functional programming aspects and just looking to work procedurally like in Perl, start learning the Python language constructs / syntax and then d... | 2 | 55 | 0 | I am an experienced Perl developer with some degree of experience and/or familiarity with other languages (working experience with C/C++, school experience with Java and Scheme, and passing familiarity with many others).
I might need to get some web work done in Python (most immediately, related to Google App Engine). ... | Python for a Perl programmer | -1 | 0 | 0 | 24,062 |
2,285,922 | 2010-02-18T02:37:00.000 | 0 | 0 | 1 | 0 | python,queue,multiprocessing | 2,286,094 | 1 | true | 0 | 0 | I don't believe multiprocessing sets up a "watch-dog" process for you to take care of crashes or kills of some of your processes. It may be worth your while to set one up (pretty hard to do cross-platform, but if, say, you're only worried about Linux, it's not that terrible). | 1 | 1 | 0 | I am using the multiprocessing python module with Queue for communication between processes. Some processes only send (i.e. queue.put) and I can't seem to find a way to detect when the receiving end gets terminated abruptly.
Is there a way to detect if the process at the other end of the Queue gets terminated without ... | detection of communication failure when "put" in queue | 1.2 | 0 | 0 | 244 |
2,286,790 | 2010-02-18T06:48:00.000 | 2 | 0 | 0 | 0 | python,api,office-communicator | 3,754,769 | 3 | true | 0 | 0 | >>> import win32com.client
>>> msg = win32com.client.Dispatch('Communicator.UIAutomation')
>>> msg.InstantMessage('user@domain.com') | 1 | 2 | 0 | I want to use ms office communicator client apis, and i wan to use those in python is it possible to do ? | How can we use ms office communicator client exposed APIs in python, is that possible? | 1.2 | 0 | 1 | 1,868 |
2,286,860 | 2010-02-18T07:09:00.000 | 2 | 0 | 1 | 0 | python,algorithm | 2,286,874 | 19 | false | 0 | 0 | Keep an array of 256 "seen" booleans, one for each possible character.
Stream your string. If you haven't seen the character before, output it and set the "seen" flag for that character. | 3 | 5 | 0 | What is an efficient algorithm to removing all duplicates in a string?
For example : aaaabbbccdbdbcd
Required result: abcd | Removing duplicates in a string in Python | 0.02105 | 0 | 0 | 13,212 |
2,286,860 | 2010-02-18T07:09:00.000 | 0 | 0 | 1 | 0 | python,algorithm | 2,330,671 | 19 | false | 0 | 0 | This sounds like a perfect use for automata. | 3 | 5 | 0 | What is an efficient algorithm to removing all duplicates in a string?
For example : aaaabbbccdbdbcd
Required result: abcd | Removing duplicates in a string in Python | 0 | 0 | 0 | 13,212 |
2,286,860 | 2010-02-18T07:09:00.000 | 19 | 0 | 1 | 0 | python,algorithm | 2,286,870 | 19 | true | 0 | 0 | You use a hashtable to store currently discovered keys (access O(1)) and then loop through the array. If a character is in the hashtable, discard it. If it isn't add it to the hashtable and a result string.
Overall: O(n) time (and space).
The naive solution is to search for the character is the result string as you pro... | 3 | 5 | 0 | What is an efficient algorithm to removing all duplicates in a string?
For example : aaaabbbccdbdbcd
Required result: abcd | Removing duplicates in a string in Python | 1.2 | 0 | 0 | 13,212 |
2,288,725 | 2010-02-18T13:00:00.000 | 0 | 0 | 0 | 1 | python,django,google-app-engine | 2,289,005 | 1 | true | 1 | 0 | I had module nammed same way as the default GAE launcher (main/ and main.py). After renaming the launcher everything works great. | 1 | 0 | 0 | I've downloaded google_appengine version 1.3.1. Using some web tutorials, I've created basic django 1.1.1 application. Using appcfg I managed to deploy it on GAE and it works. The problem is, that application doesn't want to work on dev_appengine.py developement server.
Whenever I run the app GAE local server is return... | Problem with running Django 1.1.1 on Google App Engine Developement Server | 1.2 | 0 | 0 | 261 |
2,289,187 | 2010-02-18T14:16:00.000 | 0 | 0 | 0 | 0 | python,django | 2,289,931 | 7 | false | 1 | 0 | Hm, maybe you lie to manage.py, pretending to make fixtures, but only to look for apps:
apps=$(python manage.py makefixture 2>&1 | egrep -v '(^Error|^django)'|awk -F . '{print $2}'|uniq); for i in $apps; do python manage.py sqlreset $i; done| grep DROP
That prints out a list of DROP TABLE statements for all apps tabl... | 3 | 20 | 0 | How do I completely reset my Django (1.2 alpha) DB (dropping all tables, rather than just clearing them)?
manage.py flush does too little (won't work if there are schema changes) and manage.py reset requires me to specify all apps (and appears to take a format that is different from just " ".join(INSTALLED_APPS)). I ca... | Complete django DB reset | 0 | 1 | 0 | 24,412 |
2,289,187 | 2010-02-18T14:16:00.000 | 0 | 0 | 0 | 0 | python,django | 2,289,445 | 7 | false | 1 | 0 | Just assign a new database and drop this db from the db console. Seems to me to be the simplest. | 3 | 20 | 0 | How do I completely reset my Django (1.2 alpha) DB (dropping all tables, rather than just clearing them)?
manage.py flush does too little (won't work if there are schema changes) and manage.py reset requires me to specify all apps (and appears to take a format that is different from just " ".join(INSTALLED_APPS)). I ca... | Complete django DB reset | 0 | 1 | 0 | 24,412 |
2,289,187 | 2010-02-18T14:16:00.000 | -2 | 0 | 0 | 0 | python,django | 2,289,727 | 7 | false | 1 | 0 | take a look at reset command in django's code, and write your own which drops/creates DB first. | 3 | 20 | 0 | How do I completely reset my Django (1.2 alpha) DB (dropping all tables, rather than just clearing them)?
manage.py flush does too little (won't work if there are schema changes) and manage.py reset requires me to specify all apps (and appears to take a format that is different from just " ".join(INSTALLED_APPS)). I ca... | Complete django DB reset | -0.057081 | 1 | 0 | 24,412 |
2,291,714 | 2010-02-18T19:50:00.000 | 0 | 0 | 0 | 0 | python,mysql,django,exception | 55,394,190 | 5 | false | 1 | 0 | The exceptions in object destructors (__del__) are ignored, which this message indicates. If you execute some MySQL command without fetching results from the cursor (e.g. 'create procedure' or 'insert') then the exception is unnoticed until the cursor is destroyed.
If you want to raise and catch an exception, call expl... | 3 | 8 | 0 | i'm using Python with MySQL and Django. I keep seeing this error and I can't figure out where the exception is being thrown:
Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") in <bound method Cursor.__del__ of <MySQLdb.cursors.Cursor object at 0x20108150>> ig... | Who is throwing (and catching) this MySQL Exception? | 0 | 1 | 0 | 6,125 |
2,291,714 | 2010-02-18T19:50:00.000 | 2 | 0 | 0 | 0 | python,mysql,django,exception | 2,300,154 | 5 | false | 1 | 0 | After printing out a bunch of stuff and debugging, I figured out the problem I think. One of the libraries that I used didn't close the connection or the cursor. But this problem only shows up if I iterate through a large amount of data. The problem is also very intermittent and I still don't know who's throwing the... | 3 | 8 | 0 | i'm using Python with MySQL and Django. I keep seeing this error and I can't figure out where the exception is being thrown:
Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") in <bound method Cursor.__del__ of <MySQLdb.cursors.Cursor object at 0x20108150>> ig... | Who is throwing (and catching) this MySQL Exception? | 0.07983 | 1 | 0 | 6,125 |
2,291,714 | 2010-02-18T19:50:00.000 | 2 | 0 | 0 | 0 | python,mysql,django,exception | 2,292,145 | 5 | false | 1 | 0 | I believe this error can occur if you are using the same connection/cursor from multiple threads.
However, I dont think the creators of Django has made such a mistake, but if you are doing something by yourself it can easily happen. | 3 | 8 | 0 | i'm using Python with MySQL and Django. I keep seeing this error and I can't figure out where the exception is being thrown:
Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") in <bound method Cursor.__del__ of <MySQLdb.cursors.Cursor object at 0x20108150>> ig... | Who is throwing (and catching) this MySQL Exception? | 0.07983 | 1 | 0 | 6,125 |
2,292,775 | 2010-02-18T22:39:00.000 | 1 | 0 | 0 | 0 | python,ironpython | 2,292,804 | 3 | false | 1 | 0 | Django does in theory run on Windows, but using Apache and MySQL. It's not possible (and certainly not recommended) to run it on IIS.
I know you totally didn't ask this, but I have to advise that if you really want to get into Python web development then looking into a Linux technology stack is definitely the recommend... | 1 | 6 | 0 | I started learning Python using the IronPython implementation. I'd like to do some web development now. I'm looking for a python web development framework that works on the Microsoft technology stack (IIS + MS SQL Server). Django looks like an interesting framework but based on what I have read, getting it to work on t... | What Python/IronPython web development framework work on the Microsoft technology stack? | 0.066568 | 0 | 0 | 1,847 |
2,293,273 | 2010-02-19T00:23:00.000 | 3 | 0 | 1 | 0 | ironpython | 2,299,777 | 1 | true | 0 | 0 | There's no built-in way to do this. But you could do this by hand. You can call GetItems() on the ScriptScope and then save all the values and then put all the values back into a new ScriptScope. | 1 | 4 | 0 | I'm using IronPython 2.6 and I was wondering if there was a way to copy a Microsoft.Scripting.Hosting.ScriptScope to get all the variables and context in another ScriptScope. The reason I want this is I am executing a file, and I want to restore the context to before the start of the execution if an exception occurs.
T... | Copy ScriptScope? | 1.2 | 0 | 0 | 502 |
2,294,509 | 2010-02-19T06:36:00.000 | 1 | 0 | 1 | 0 | python,encoding | 2,294,548 | 2 | true | 0 | 0 | Are you using Python 3.X or 2.X? It makes a difference. Actually looks like 2.X but you confused me by using print(blahblah) :-)
Answer to your last question: Yes, ASCII by default when you do print(). On 3.X: Use print(ascii(foo)) for debugging, not print(foo). On 2.X use repr(), not ascii().
Your original problem wit... | 1 | 1 | 0 | I'm having a problem when trying to apply a regular expression to some strings encoded in latin-1 (ISO-8859-1).
What I'm trying to do is send some data via HTTP POST from a page encoded in ISO-8859-1 to my python application and do some parsing on the data using regular expressions in my python script.
The web page us... | 'ASCII' to Unicode error in python when attempting to read a latin-1 encoded string | 1.2 | 0 | 0 | 955 |
2,294,956 | 2010-02-19T08:41:00.000 | 1 | 0 | 0 | 0 | python,qt,pyqt,qt-designer | 2,296,460 | 2 | false | 0 | 1 | Try finding pyuic3 or rather pyuic4. Since you are using PyQt all your qt tools have py in front (like pyrcc4 or pyuicc4).
I am not sure, that there are pyqt3 binaries for windows. Are you sure that Phil Thompson did PyQt3 also for windows at the time? If so, they would be on riverbank site, I guess, but I can't find t... | 1 | 0 | 0 | I've a PyQt 4 installed (I can't find PyQt 3 for Windows) and I would like to open a QtDesigner ui file which has been created with QtDesigner 3.3.
When I open this file I've the following message:
Please use uic3 -convert to convert to Qt4
Unfortunately, I don't see the uic3 tool in the bin folder of my install.
Does ... | How to open a Pyqt 3.3 ui file with QtDesigner 4? | 0.099668 | 0 | 0 | 900 |
2,296,550 | 2010-02-19T13:28:00.000 | 3 | 0 | 1 | 0 | python,scope,global-variables | 2,298,388 | 3 | false | 0 | 0 | Python does not support globals shared between several modules: this is a feature. Code that implicitly modifies variables used far away is confusing and unmaintainable. The real solution is to encapsulate all state within a class and pass its instance to anything that has to modify it. This can make code clearer, more... | 2 | 2 | 0 | I investigated that scope of global variables in python is limited to the module. But I need the scope to be global among different modules. Is there such a thing? I played around __builtin__ but no luck.
thanks in advance! | how to have global variables among different modules in Python | 0.197375 | 0 | 0 | 3,316 |
2,296,550 | 2010-02-19T13:28:00.000 | 0 | 0 | 1 | 0 | python,scope,global-variables | 2,296,580 | 3 | false | 0 | 0 | Scopes beyond the local must be written to via a reference to the scope, or after a global or nonlocal (3.x+) directive. | 2 | 2 | 0 | I investigated that scope of global variables in python is limited to the module. But I need the scope to be global among different modules. Is there such a thing? I played around __builtin__ but no luck.
thanks in advance! | how to have global variables among different modules in Python | 0 | 0 | 0 | 3,316 |
2,297,889 | 2010-02-19T16:31:00.000 | 1 | 1 | 1 | 0 | python,ruby,scripting,dsl,trading | 2,297,992 | 11 | false | 0 | 0 | Custom-made modules are going to be needed, no matter what you choose, that define your firm's high level constructs.
Here are some of the needs I envision -- you may have some of these covered already: a way to get current positions, current and historical quotes, previous performance data, etc... into the applicati... | 5 | 14 | 0 | I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav... | Scripting language for trading strategy development | 0.01818 | 0 | 0 | 3,358 |
2,297,889 | 2010-02-19T16:31:00.000 | 0 | 1 | 1 | 0 | python,ruby,scripting,dsl,trading | 2,298,038 | 11 | false | 0 | 0 | Existing languages are "a little "low level" for my target users."
Yet, all you need is "a minimum of support for looping, simple arithmatic, logical expression evaluation"
I don't get the problem. You only want a few features. What's wrong with the list of languages you provided? They actually offer those features?... | 5 | 14 | 0 | I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav... | Scripting language for trading strategy development | 0 | 0 | 0 | 3,358 |
2,297,889 | 2010-02-19T16:31:00.000 | 0 | 1 | 1 | 0 | python,ruby,scripting,dsl,trading | 2,298,183 | 11 | false | 0 | 0 | I would use Common Lisp, which supports rapid development (you have a running image and can compile/recompile individual functions) and tailoring the language to your domain. You would provide functions and macros as building blocks to express strategies, and the whole language would be available to the user for combi... | 5 | 14 | 0 | I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav... | Scripting language for trading strategy development | 0 | 0 | 0 | 3,358 |
2,297,889 | 2010-02-19T16:31:00.000 | 0 | 1 | 1 | 0 | python,ruby,scripting,dsl,trading | 2,298,573 | 11 | false | 0 | 0 | Define the language first -- if possible, use the pseudo-language called EBN, it's very simple (see the Wikipedia entry).
Then once you have that, pick the language. Almost certainly you will want to use a DSL. Ruby and Lua are both really good at that, IMO.
Once you start working on it, you may find that you go back... | 5 | 14 | 0 | I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav... | Scripting language for trading strategy development | 0 | 0 | 0 | 3,358 |
2,297,889 | 2010-02-19T16:31:00.000 | 0 | 1 | 1 | 0 | python,ruby,scripting,dsl,trading | 2,298,008 | 11 | false | 0 | 0 | This might be a bit simplistic, but a lot of quant users are used to working with Excel & VBA macros. Would something like VBSCript be usable, as they may have some experience in this area. | 5 | 14 | 0 | I'm currently working on a component of a trading product that will allow a quant or strategy developer to write their own custom strategies. I obviously can't have them write these strategies in natively compiled languages (or even a language that compiles to a bytecode to run on a vm) since their dev/test cycles hav... | Scripting language for trading strategy development | 0 | 0 | 0 | 3,358 |
2,299,454 | 2010-02-19T20:51:00.000 | 0 | 0 | 1 | 0 | python,dictionary,csv,large-files | 3,279,041 | 6 | false | 0 | 0 | my idea is to use python zodb module to store dictionaty type data and then create new csv file using that data structure. do all your operation at that time. | 2 | 4 | 1 | I'm reading a 6 million entry .csv file with Python, and I want to be able to search through this file for a particular entry.
Are there any tricks to search the entire file? Should you read the whole thing into a dictionary or should you perform a search every time? I tried loading it into a dictionary but that took a... | How do quickly search through a .csv file in Python | 0 | 0 | 0 | 20,439 |
2,299,454 | 2010-02-19T20:51:00.000 | 1 | 0 | 1 | 0 | python,dictionary,csv,large-files | 2,443,606 | 6 | false | 0 | 0 | You can't go directly to a specific line in the file because lines are variable-length, so the only way to know when line #n starts is to search for the first n newlines. And it's not enough to just look for '\n' characters because CSV allows newlines in table cells, so you really do have to parse the file anyway. | 2 | 4 | 1 | I'm reading a 6 million entry .csv file with Python, and I want to be able to search through this file for a particular entry.
Are there any tricks to search the entire file? Should you read the whole thing into a dictionary or should you perform a search every time? I tried loading it into a dictionary but that took a... | How do quickly search through a .csv file in Python | 0.033321 | 0 | 0 | 20,439 |
2,299,627 | 2010-02-19T21:15:00.000 | 0 | 1 | 0 | 1 | python,windows,wmi | 2,505,040 | 2 | false | 0 | 0 | Process name: is sys.argv[0] not sufficient for your purposes? | 1 | 0 | 0 | What is the best way in python find the process name and owner?
Now i use WMI, but this version is too slow. | python and process | 0 | 0 | 0 | 325 |
2,299,697 | 2010-02-19T21:23:00.000 | 1 | 0 | 0 | 0 | python,django,django-models,wiki | 2,299,776 | 3 | false | 1 | 0 | Assuming that there will be a community of users you can provide good tools for them to spot problems and easily undo damage. The most important of these is to provide a Recent Changes page that summarizes recent edits. Then each page that can be edited should retain prior versions of the page that can be used to repla... | 2 | 0 | 0 | I'm building this app in Python with Django.
I would like to give parts of the site wiki like functionality,
but I don't know how to go on about reliability and security.
Make sure that good content is not ruined
Check for quality
Prevent spam from invading the site
The items requiring wiki like functionality are jus... | Building a wiki application? | 0.066568 | 0 | 0 | 1,412 |
2,299,697 | 2010-02-19T21:23:00.000 | 1 | 0 | 0 | 0 | python,django,django-models,wiki | 2,299,849 | 3 | false | 1 | 0 | Make sure that good content is not ruined = version each edit and allow roll-backs.
Check for quality = get people to help with that
Prevent spam from invading the site = get people to help with that, require login, add a captcha if need be, use nofollow for all links | 2 | 0 | 0 | I'm building this app in Python with Django.
I would like to give parts of the site wiki like functionality,
but I don't know how to go on about reliability and security.
Make sure that good content is not ruined
Check for quality
Prevent spam from invading the site
The items requiring wiki like functionality are jus... | Building a wiki application? | 0.066568 | 0 | 0 | 1,412 |
2,299,751 | 2010-02-19T21:32:00.000 | 0 | 0 | 0 | 0 | python,ping,icmp | 2,299,927 | 1 | true | 0 | 0 | A problem you might be having is due to the fact that ICMP is layer 3 of the OSI model and does not use a port for communication. In short, ICMP isn't really designed for this. The desired behavior is still possible but perhaps the IP Stack you are using is getting in the way and if this is on a Windows system then 10... | 1 | 1 | 0 | I'm writing service in python that async ping domains. So it must be able to ping many ip's at the same time. I wrote it on epoll ioloop, but have problem with packets loss.
When there are many simultaneous ICMP requests much part of replies on them didn't reach my servise. What may cause this situation and how i can m... | Problem with asyn icmp ping | 1.2 | 0 | 1 | 788 |
2,301,458 | 2010-02-20T07:38:00.000 | 8 | 0 | 1 | 0 | python,file,multithreading | 2,301,462 | 3 | false | 0 | 0 | When two threads access the same resources, weird things happen. To avoid that, always lock the resource. Python has the convenient threading.Lock for that, as well as some other tools (see documentation of the threading module). | 1 | 14 | 0 | I have two threads, one which writes to a file, and another which periodically
moves the file to a different location. The writes always calls open before writing a message, and calls close after writing the message. The mover uses shutil.move to do the move.
I see that after the first move is done, the writer cannot w... | Python multiple threads accessing same file | 1 | 0 | 0 | 28,811 |
2,302,663 | 2010-02-20T15:32:00.000 | 3 | 0 | 1 | 0 | python,parameter-passing | 2,302,668 | 3 | false | 0 | 0 | Dictionaries don't preserve the order of the keys. You could use a list of tuples instead of a dictionary. | 1 | 1 | 0 | def createNode(doc_, **param_):
cache = {'p':'property','l':'label','td':'totalDelay','rd':'routeDelay','ld':'logicDelay'}
for index in param_:
newIndex = cache[index]
value = param_[index]
print newIndex, '=', value
doc = 10
createNode(doc, p='path', l='ifft4k_radix4_noUnolling_core.vi... | What's the way to keep the dictionary parameter order in Python? | 0.197375 | 0 | 0 | 2,708 |
2,302,761 | 2010-02-20T16:05:00.000 | 0 | 0 | 0 | 0 | java,python,sockets | 2,302,787 | 2 | false | 0 | 0 | Typically when doing client-server communication you need to establish some kind of protocol. One very simple protocol is to send the String "COMMAND" before you send any commands and the String "ERROR" before you send any errors. This doubles the number of Strings you have to send but gives more flexibility.
There a... | 2 | 1 | 0 | I am writing a general Client-Server socket program where the client sends commands to the Server, which executes it and sends the result to the Client.
However if there is an error while executing a command, I want to be able to inform the Client of an error. I know I could send the String "ERROR" or maybe something ... | Pass error on socket | 0 | 0 | 1 | 134 |
2,302,761 | 2010-02-20T16:05:00.000 | 0 | 0 | 0 | 0 | java,python,sockets | 2,302,805 | 2 | false | 0 | 0 | You're already (necessarily) establishing some format or protocol whereby strings are being sent back and forth -- either you're somehow terminating each string, or sending its length first, or the like. (TCP is intrinsically just a stream so without such a protocol there would be no way the recipient could possibly k... | 2 | 1 | 0 | I am writing a general Client-Server socket program where the client sends commands to the Server, which executes it and sends the result to the Client.
However if there is an error while executing a command, I want to be able to inform the Client of an error. I know I could send the String "ERROR" or maybe something ... | Pass error on socket | 0 | 0 | 1 | 134 |
2,303,254 | 2010-02-20T18:53:00.000 | 2 | 0 | 0 | 0 | python,django | 8,542,155 | 3 | false | 1 | 0 | When you creates a model with ImageField or FileField attributes, you should pass the upload_to argument. That is a relative path will be appended to your MEDIA_ROOT path and there will be save and retrieve that files. | 1 | 9 | 0 | What does Django do with MEDIA_ROOT exactly? I never understood it. Since Django itself doesn't serve static media, and you have to set up apache or something similar for it, why does it care in which directory it sits? | What does Django do with `MEDIA_ROOT`? | 0.132549 | 0 | 0 | 4,138 |
2,303,683 | 2010-02-20T20:55:00.000 | 2 | 1 | 1 | 0 | python,c,performance,bytecode | 2,303,703 | 4 | false | 0 | 1 | It makes sense to use C modules in Python for:
Performance
Libraries that won't be ported to Python (because of performance reasons, for example) or that use OS-specific functions
Scripting. For example, many games use Python, Lua and other languages as scripting languages. Therefore they expose C/C++ functions to Pyt... | 3 | 1 | 0 | If Python was so fast as C, the latter would be present in python apps/libraries?
Example: if Python was fast as C would PIL be written completely in Python? | Is there any purpose for a python application use C other than performance? | 0.099668 | 0 | 0 | 196 |
2,303,683 | 2010-02-20T20:55:00.000 | 0 | 1 | 1 | 0 | python,c,performance,bytecode | 2,303,876 | 4 | false | 0 | 1 | To access hardware. | 3 | 1 | 0 | If Python was so fast as C, the latter would be present in python apps/libraries?
Example: if Python was fast as C would PIL be written completely in Python? | Is there any purpose for a python application use C other than performance? | 0 | 0 | 0 | 196 |
2,303,683 | 2010-02-20T20:55:00.000 | 7 | 1 | 1 | 0 | python,c,performance,bytecode | 2,303,685 | 4 | true | 0 | 1 | To access "legacy" C libraries and OS facilities. | 3 | 1 | 0 | If Python was so fast as C, the latter would be present in python apps/libraries?
Example: if Python was fast as C would PIL be written completely in Python? | Is there any purpose for a python application use C other than performance? | 1.2 | 0 | 0 | 196 |
2,303,956 | 2010-02-20T22:12:00.000 | 8 | 0 | 0 | 1 | python,emacs,virtualenv | 2,307,435 | 2 | true | 0 | 0 | So it seems that python-shell does the right thing by picking up the environment settings, whereas py-shell does not. python-shell is provided by python.el and py-shell is provided by python-mode.el , There's bug reports etc related to this, so I'm just not going to use py-shell for now. Figured I'd close the loop on t... | 1 | 12 | 0 | Today I've been trying to bring more of the Python related modes into
my Emacs configuration but I haven't had much luck.
First what I've noticed is that depending on how Emacs is
launched (terminal vs from the desktop), the interpreter it decides to
use is different.
launched from KDE menu: M-! which python gives /us... | Specifying python interpreter from virtualenv in emacs | 1.2 | 0 | 0 | 6,786 |
2,303,966 | 2010-02-20T22:17:00.000 | -2 | 0 | 0 | 0 | python,django,geolocation | 2,303,976 | 2 | true | 1 | 0 | You can't collect a real zip code from an IP address as these are assigned by ISP's when you route threw their connection. | 1 | 3 | 0 | Is it possible to find the zip code based on a users IP address using python / django (not geodjango)? I assume I would have to use a web service, but I would really like to just be able to query a database if possible.
I am using geopy right now, so it would be cool if I could integrate that somehow. | Get zip code based on IP Address with Python | 1.2 | 0 | 0 | 3,231 |
2,304,632 | 2010-02-21T03:19:00.000 | 2 | 1 | 1 | 0 | python,regex,twitter | 2,304,704 | 11 | false | 0 | 0 | The only characters accepted in the form are A-Z, 0-9, and underscore. Usernames are not case-sensitive, though, so you could use r'@(?i)[a-z0-9_]+' to match everything correctly and also discern between users. | 2 | 46 | 0 | Could you provide a regex that match Twitter usernames?
Extra bonus if a Python example is provided. | regex for Twitter username | 0.036348 | 0 | 0 | 35,359 |
2,304,632 | 2010-02-21T03:19:00.000 | 1 | 1 | 1 | 0 | python,regex,twitter | 2,330,440 | 11 | false | 0 | 0 | Shorter, /@([\w]+)/ works fine. | 2 | 46 | 0 | Could you provide a regex that match Twitter usernames?
Extra bonus if a Python example is provided. | regex for Twitter username | 0.01818 | 0 | 0 | 35,359 |
2,305,115 | 2010-02-21T06:49:00.000 | 2 | 0 | 1 | 0 | python,file-io | 2,305,125 | 6 | false | 0 | 0 | Open a second file to write to, read and then write the lines you want to copy over, write the new lines, read the lines you want to skip, then copy the rest. | 1 | 4 | 0 | I have a text file looks like:
first line
second line
third line
forth line
fifth line
sixth line
I want to replace the third and forth lines with three new lines. The above contents would become:
first line
second line
new line1
new line2
new line3
fifth line
sixth line
How can I do this u... | Remove and insert lines in a text file | 0.066568 | 0 | 0 | 15,256 |
2,305,353 | 2010-02-21T08:48:00.000 | 1 | 0 | 0 | 0 | python,sql,django,security,sql-injection | 2,305,359 | 2 | false | 1 | 0 | Create and use non-modifiable views. | 2 | 2 | 0 | I'm planning on building a Django log-viewing app with powerful filters. I'd like to enable the user to finely filter the results with some custom (possibly DB-specific) SELECT queries.
However, I dislike giving the user write access to the database. Is there a way to make sure a query doesn't change anything in the da... | How can I limit an SQL query to be nondestructive? | 0.099668 | 1 | 0 | 543 |
2,305,353 | 2010-02-21T08:48:00.000 | 14 | 0 | 0 | 0 | python,sql,django,security,sql-injection | 2,305,379 | 2 | true | 1 | 0 | Connect with a user that has only been granted SELECT permissions. Situations like this is why permissions exist in the first place. | 2 | 2 | 0 | I'm planning on building a Django log-viewing app with powerful filters. I'd like to enable the user to finely filter the results with some custom (possibly DB-specific) SELECT queries.
However, I dislike giving the user write access to the database. Is there a way to make sure a query doesn't change anything in the da... | How can I limit an SQL query to be nondestructive? | 1.2 | 1 | 0 | 543 |
2,305,501 | 2010-02-21T09:52:00.000 | 2 | 0 | 1 | 0 | python,dictionary,sampling | 2,305,591 | 4 | false | 0 | 0 | If the values are too large for gnibler's approach:
Build a list of tuples (key, index), where index is the sum of all values that come before key in the list (this would be the index of the first occurrence of key gnibler's list c. Also calculate the sum of all values (n).
Now, generate a random number xbetween 0 and ... | 1 | 1 | 0 | I have a dictionary in python with key->value as str->int. If I have to chose a key based on it's own value, then as the value gets larger the key has a lower possibility of being chosen.
For example, if key1=2 and key2->1, then the attitude of key1 should be 2:1.
How can I do this? | Sampling keys due to their values | 0.099668 | 0 | 0 | 131 |
2,306,048 | 2010-02-21T13:45:00.000 | 24 | 0 | 0 | 0 | python,mysql,django,sqlite,dev-to-production | 2,306,070 | 6 | true | 1 | 0 | I'd highly recommend using the same database backend in production as in development, and all stages in between. Django will abstract the database stuff, but having different environments will leave you open to horrible internationalisation, configuration issues, and nasty tiny inconsistencies that won't even show up u... | 4 | 20 | 0 | Quick question: is it a good idea to use sqlite while developing a Django project, and use MySQL on the production server? | Django: sqlite for dev, mysql for prod? | 1.2 | 1 | 0 | 4,303 |
2,306,048 | 2010-02-21T13:45:00.000 | 7 | 0 | 0 | 0 | python,mysql,django,sqlite,dev-to-production | 9,401,789 | 6 | false | 1 | 0 | Use the same database in all environments.
As much as the ORM tries to abstract the differences between databases, there will always be certain features that behave differently based on the database. Database portability is a complete myth.
Plus, it seems pretty insane to test and develop against code paths that you w... | 4 | 20 | 0 | Quick question: is it a good idea to use sqlite while developing a Django project, and use MySQL on the production server? | Django: sqlite for dev, mysql for prod? | 1 | 1 | 0 | 4,303 |
2,306,048 | 2010-02-21T13:45:00.000 | 3 | 0 | 0 | 0 | python,mysql,django,sqlite,dev-to-production | 2,306,069 | 6 | false | 1 | 0 | In short, no; unless you want to unnecessarily double development time. | 4 | 20 | 0 | Quick question: is it a good idea to use sqlite while developing a Django project, and use MySQL on the production server? | Django: sqlite for dev, mysql for prod? | 0.099668 | 1 | 0 | 4,303 |
2,306,048 | 2010-02-21T13:45:00.000 | 3 | 0 | 0 | 0 | python,mysql,django,sqlite,dev-to-production | 12,684,980 | 6 | false | 1 | 0 | Just made this major mistake starting off with sqlite and when i try to deploy on production server with mysql, things didn't work as smooth as i expected. I tried dumpdata/loaddata with various switches but somehow keep getting errors thrown one after another. Do yourself a big favor and use the same db for both produ... | 4 | 20 | 0 | Quick question: is it a good idea to use sqlite while developing a Django project, and use MySQL on the production server? | Django: sqlite for dev, mysql for prod? | 0.099668 | 1 | 0 | 4,303 |
2,306,984 | 2010-02-21T18:50:00.000 | 1 | 0 | 0 | 0 | python,oauth,google-api | 3,110,939 | 1 | true | 1 | 0 | When you're exchanging for the access token, the oauth_verifier parameter is required. If you don't provide that parameter, then google will tell you that the token is invalid. | 1 | 2 | 0 | I am having trouble exchanging my Oauth request token for an Access Token. My Python application successfully asks for a Request Token and then redirects to the Google login page asking to grant access to my website. When I grant access I retrieve a 200 status code but exchanging this authorized request token for an ac... | Exchange Oauth Request Token for Access Token fails Google API | 1.2 | 0 | 1 | 1,332 |
2,307,464 | 2010-02-21T21:09:00.000 | 30 | 0 | 0 | 0 | python,tkinter | 42,928,131 | 4 | false | 0 | 1 | root.quit() causes mainloop to exit. The interpreter is still intact, as are all the widgets. If you call this function, you can have code that executes after the call to root.mainloop(), and that code can interact with the widgets (for example, get a value from an entry widget).
Calling root.destroy() will destroy all... | 2 | 39 | 0 | In Python using tkinter, what is the difference between root.destroy() and root.quit() when closing the root window?
Is one prefered over the other? Does one release resources that the other doesn't? | What is the difference between root.destroy() and root.quit()? | 1 | 0 | 0 | 35,380 |
2,307,464 | 2010-02-21T21:09:00.000 | 0 | 0 | 0 | 0 | python,tkinter | 61,423,826 | 4 | false | 0 | 1 | My experience with root.quit() and root.destroy() ...
I have a dos python script, which calls a tkinter script (to choose from set of known values from combobox), then returns to the dos script to complete other things.
The TKinter script I've added onto the parent script. I may convert all to tkinter, but a combo wor... | 2 | 39 | 0 | In Python using tkinter, what is the difference between root.destroy() and root.quit() when closing the root window?
Is one prefered over the other? Does one release resources that the other doesn't? | What is the difference between root.destroy() and root.quit()? | 0 | 0 | 0 | 35,380 |
2,308,050 | 2010-02-22T00:05:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,task-queue | 2,402,964 | 1 | false | 1 | 0 | When a task-queue ends in error : I believe it stays in your queue ..
Check that | 1 | 2 | 0 | I have been testing the taskqueue with mixed success. Currently I am
using the default queue, in default settings etc etc....
I have a test URL setup which inserts about 8 tasks into the queue.
With short order, all 8 are completed properly. So far so good.
The problem comes up when I re-load that URL twice under say a... | GAE Task Queue oddness | 0 | 0 | 0 | 630 |
2,308,443 | 2010-02-22T02:20:00.000 | 9 | 0 | 1 | 0 | python | 2,308,452 | 4 | true | 0 | 0 | It really depends where you get your number from.
If the number you are trying to convert comes from user input, use locale.atoi(). That way, the number will be parsed in a way that is consistent with the user's settings and thus expectations.
If on the other hand you read it, let's say, from a file, that always uses t... | 1 | 7 | 0 | In Python, what is a clean and elegant way to convert strings like "1,374" or "21,000,000" to int values like 1374 or 21000000? | How to convert a numeric string with place-value commas into an integer? | 1.2 | 0 | 0 | 4,118 |
2,309,108 | 2010-02-22T06:02:00.000 | 0 | 1 | 1 | 0 | python,mobile-phones,imei | 2,309,202 | 1 | false | 0 | 0 | Sending AT+CGSN through the appropriate serial device will have it return the IMEI. | 1 | 0 | 0 | How can I get the IMEI number of a mobile phone using Python? | IMEI number of a mobile phone using python | 0 | 0 | 0 | 2,251 |
2,309,645 | 2010-02-22T08:26:00.000 | 2 | 0 | 1 | 0 | python,function,arguments,argument-passing | 2,309,739 | 4 | false | 0 | 0 | I see that someone has already offered the answer i had in mind, so i'll suggest a purely practical one. IDLE will give you a function's parameters as a 'tooltip'.
This should be enabled by default; the tooltip will appear just after you type the function name and the left parenthesis.
To do this, IDLE just accesses ... | 2 | 3 | 0 | Suppose I have a function and I want to print out the arguments it accepts. How can I do this? | How do I print out which arguments a Python function requires/allows? | 0.099668 | 0 | 0 | 357 |
2,309,645 | 2010-02-22T08:26:00.000 | 0 | 0 | 1 | 0 | python,function,arguments,argument-passing | 2,310,447 | 4 | false | 0 | 0 | The help function does this.
All you have to do is put in docstrings for your functions. | 2 | 3 | 0 | Suppose I have a function and I want to print out the arguments it accepts. How can I do this? | How do I print out which arguments a Python function requires/allows? | 0 | 0 | 0 | 357 |
2,310,130 | 2010-02-22T10:11:00.000 | 2 | 0 | 1 | 0 | python,user-interface | 2,310,200 | 6 | false | 0 | 1 | As an answer for #1: Yes. It is quite good for this; scripting languages with GUI toolkits are often a good way to put a GUI on an application. They can also be used to wrap applications written in low level languages such as C or C++. Python offers good integration to quite a few toolkits. The posting linked above... | 1 | 11 | 0 | I would like to try to write a GUI application in Python. I found out that there are a lot of ways to do it (different toolkits). And, in this context, I have several basic (and I think simple) question?
Is it, in general, a good idea to write a GUI application in Python?
What is the standard (easiest and most stable)... | How to write GUI in Python? | 0.066568 | 0 | 0 | 20,880 |
2,311,074 | 2010-02-22T13:22:00.000 | 0 | 0 | 1 | 1 | python,windows,command-line,command-prompt | 2,311,082 | 3 | false | 0 | 0 | Is python.exe in your windows path? Try to look at the PATH environment variable and see if the installation folder of python is listed there. | 2 | 2 | 0 | I have just installed Python on my Windows 7. I thought that after that I will be able to run python on the command prompt but it is not the case. After the installation I also found out that I can run the python command shell. This is nice. But what should I do if I want to save my program in a file and then I want to... | How can I get python in the command prompt on Windows? | 0 | 0 | 0 | 314 |
2,311,074 | 2010-02-22T13:22:00.000 | 0 | 0 | 1 | 1 | python,windows,command-line,command-prompt | 2,311,098 | 3 | false | 0 | 0 | You need to update your environment variables to include the path to the Python executable.
On XP you can do this by right clicking on "My Computer" -> Properties and then going to the "Advanced" tab. | 2 | 2 | 0 | I have just installed Python on my Windows 7. I thought that after that I will be able to run python on the command prompt but it is not the case. After the installation I also found out that I can run the python command shell. This is nice. But what should I do if I want to save my program in a file and then I want to... | How can I get python in the command prompt on Windows? | 0 | 0 | 0 | 314 |
2,311,094 | 2010-02-22T13:27:00.000 | 0 | 0 | 0 | 0 | python,django,user-management | 2,311,740 | 2 | false | 1 | 0 | If I'm understanding you correctly, it seems like you want to have two different groups have access to all the same views, but they will see different numbers. You can achieve this effect by making separate templates for the different groups, and then loading the appropriate template for each view depending on the grou... | 1 | 2 | 0 | Background information:
I have created an internal site for a company. Most of the work has gone into making calculation tools that their sale persons can use to make offers for clients. Create pdf offers and contracts that can be downloaded, compare prices etc. All of this is working fine.
Now their sale persons have ... | How to handle user mangement in Django for groups that has same access but different rules? | 0 | 0 | 0 | 439 |
2,311,102 | 2010-02-22T13:28:00.000 | 0 | 0 | 1 | 0 | python,configparser | 2,311,146 | 3 | false | 0 | 0 | Doesn't RawConfigParser.has_option(section, option) do the job? | 1 | 3 | 0 | I have a config file that I read using the RawConfigParser in the standard ConfigParser library. My config file has a [DEFAULT] section followed by a [specific] section. When I loop through the options in the [specific] section, it includes the ones under [DEFAULT], which is what is meant to happen.
However, for repor... | Python ConfigParser: how to work out options set in a specific section (rather than defaults) | 0 | 0 | 0 | 7,751 |
2,311,223 | 2010-02-22T13:49:00.000 | 2 | 0 | 1 | 0 | python,database,string,list,dictionary | 2,312,727 | 5 | false | 0 | 0 | There are any number of serialization methods out there, JSON is readable, reasonably compact, supported natively, and portable. I prefer it over pickle, since the latter can execute arbitrary code and potentially introduce security holes, and because of its portability.
Depending on your data's layout, you may also b... | 3 | 1 | 0 | If I have a dictionary full of nested stuff, how do I store that in a database, as a string? and then, convert it back to a dictionary when I'm ready to parse?
Edit: I just want to convert it to a string...and then back to a dictionary. | How do I store a dict/list in a database? | 0.07983 | 0 | 0 | 2,541 |
2,311,223 | 2010-02-22T13:49:00.000 | 4 | 0 | 1 | 0 | python,database,string,list,dictionary | 2,311,245 | 5 | false | 0 | 0 | Options:
1) Pickling
2) XML
3) JSON
others I am sure. It has a lot to do on how much portability means to you. | 3 | 1 | 0 | If I have a dictionary full of nested stuff, how do I store that in a database, as a string? and then, convert it back to a dictionary when I'm ready to parse?
Edit: I just want to convert it to a string...and then back to a dictionary. | How do I store a dict/list in a database? | 0.158649 | 0 | 0 | 2,541 |
2,311,223 | 2010-02-22T13:49:00.000 | 1 | 0 | 1 | 0 | python,database,string,list,dictionary | 2,312,726 | 5 | false | 0 | 0 | You have two options
use a standard serialization format (json, xml, yaml, ...)
pros: you can access with a any language that can parse those formats (on the worst case you can write your own parser)
cons: could be slower to save and load the data (this depends of the implementation mostly)
use cPickle:
pros: easy ... | 3 | 1 | 0 | If I have a dictionary full of nested stuff, how do I store that in a database, as a string? and then, convert it back to a dictionary when I'm ready to parse?
Edit: I just want to convert it to a string...and then back to a dictionary. | How do I store a dict/list in a database? | 0.039979 | 0 | 0 | 2,541 |
2,311,455 | 2010-02-22T14:28:00.000 | 1 | 0 | 1 | 1 | python,command-line,desktop,command-prompt | 2,332,334 | 4 | false | 0 | 0 | Use py2exe to make an exe and just to make it more 'user friendly' use Inno set up (www.jrsoftware.org/isinfo.php ) along with IStools to build up an installer which would integrate the GUI with sound, widgets, other elements etc and users who do not have python etc installed in their systems can also play your GUI per... | 1 | 0 | 0 | I have a Python program (GUI application). I can run this program from the command prompt on Windows (command line on Linux). But it can be too complicated for users. Is there an easy way to initiate a start of the program with a click (double click) on a pictogram (a small image on the desktop)? | How to make a user friendly start of a Python program? | 0.049958 | 0 | 0 | 3,714 |
2,312,169 | 2010-02-22T16:06:00.000 | 0 | 0 | 1 | 0 | python,operators | 2,312,204 | 3 | false | 0 | 0 | you shouldn't use <> in python. | 2 | 5 | 0 | I think if I understand correctly, a <> b is the exact same thing functionally as a != b, and in Python not a == b, but is there reason to use <> over the other versions? I know a common mistake for Python newcomers is to think that not a is b is the same as a != b or not a == b.
Do similar misconceptions occur with <... | Python ( or general programming ). Why use <> instead of != and are there risks? | 0 | 0 | 0 | 492 |
2,312,169 | 2010-02-22T16:06:00.000 | 15 | 0 | 1 | 0 | python,operators | 2,312,202 | 3 | true | 0 | 0 | <> in Python 2 is an exact synonym for != -- no reason to use it, no disadvantages either except the gratuitous heterogeneity (a style issue). It's been long discouraged, and has now been removed in Python 3. | 2 | 5 | 0 | I think if I understand correctly, a <> b is the exact same thing functionally as a != b, and in Python not a == b, but is there reason to use <> over the other versions? I know a common mistake for Python newcomers is to think that not a is b is the same as a != b or not a == b.
Do similar misconceptions occur with <... | Python ( or general programming ). Why use <> instead of != and are there risks? | 1.2 | 0 | 0 | 492 |
2,313,017 | 2010-02-22T18:11:00.000 | 0 | 1 | 0 | 1 | java,python,programming-languages,binding,java-native-interface | 2,313,266 | 3 | false | 0 | 0 | I would use Python. You could write very basic wrappers using the Python C API and then call said functions from Python with relative ease. | 3 | 1 | 0 | I have quite a lot of C++ legacy code modules from my colleagues, unfortunately poorly written. Each is doing a different job, but they are all GNU C++ code running under Linux.
I want to write a controller program, to make a singular C++ module for a workflow, for a very urgent demo. Also I need to write a front-end... | Programming language decision for C++ legacy project workflow | 0 | 0 | 0 | 317 |
2,313,017 | 2010-02-22T18:11:00.000 | 2 | 1 | 0 | 1 | java,python,programming-languages,binding,java-native-interface | 2,313,312 | 3 | false | 0 | 0 | Given the urgency, I'd have to stick with C++.
Without that, I'd say keep what you got, but feel free to switch to a preferred language when refactoring. That would be the time to do it.
What you should not do, ever, is "port" anything to another language without rewriting or changing functionality in any way. It is a... | 3 | 1 | 0 | I have quite a lot of C++ legacy code modules from my colleagues, unfortunately poorly written. Each is doing a different job, but they are all GNU C++ code running under Linux.
I want to write a controller program, to make a singular C++ module for a workflow, for a very urgent demo. Also I need to write a front-end... | Programming language decision for C++ legacy project workflow | 0.132549 | 0 | 0 | 317 |
2,313,017 | 2010-02-22T18:11:00.000 | 3 | 1 | 0 | 1 | java,python,programming-languages,binding,java-native-interface | 2,313,159 | 3 | true | 0 | 0 | Noting the "very urgent demo" part, assuming that that would take about a month, depending on the complexity, I'd stick to the familiar.
True, maintaining python would be easier in the end, and learning python should be a breeze, if you deem it viable.
I'd say, have the team learn python and do the basic stuff, as you ... | 3 | 1 | 0 | I have quite a lot of C++ legacy code modules from my colleagues, unfortunately poorly written. Each is doing a different job, but they are all GNU C++ code running under Linux.
I want to write a controller program, to make a singular C++ module for a workflow, for a very urgent demo. Also I need to write a front-end... | Programming language decision for C++ legacy project workflow | 1.2 | 0 | 0 | 317 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.