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
342,729
2008-12-05T02:20:00.000
7
0
1
0
python,winapi
343,804
12
false
0
0
Avoid tutorials (written by kids, for kids, newbie level) Read the Petzold, Richter, Pietrek, Russinovich and Adv. Win32 api newsgroup news://comp.os.ms-windows.programmer.win32
3
23
0
I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. How should I go about learning to use the Windows API with Python?
How should I learn to use the Windows API with Python?
1
0
0
54,742
342,729
2008-12-05T02:20:00.000
2
0
1
0
python,winapi
343,020
12
false
0
0
Since you've asked about Python, why do you need the Win32 API ? That's used for writing small, fast C/C++ programs. If your tool is Python, just download wxPython which runs wonderfully on Windows and produces sleek native GUIs with 1% the code and the effort.
3
23
0
I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. How should I go about learning to use the Windows API with Python?
How should I learn to use the Windows API with Python?
0.033321
0
0
54,742
342,729
2008-12-05T02:20:00.000
3
0
1
0
python,winapi
342,831
12
false
0
0
Learning Win32 API is 5% of initial understanding of concepts and the patterns used and 95% of RTFM. For those initial 5% the Petzold book is really good but I suspect that there ought to be some online tutorials which you can find in google as good as I can to find. Really, once you get the hang of it it's really st...
3
23
0
I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. How should I go about learning to use the Windows API with Python?
How should I learn to use the Windows API with Python?
0.049958
0
0
54,742
343,622
2008-12-05T12:02:00.000
2
0
0
0
python,django,testing,parsing,form-submit
343,794
4
false
1
0
It is simple... and hard at the same time. Disclaimer: I don't know much about Python and nothing at all about Django... So I give general, language agnostic advices... If one of the above advices doesn't work for you, you might want to do it manually: Load the page with an HTML parser, list the forms. If the method a...
1
0
0
I would like to be able to submit a form in an HTML source (string). In other words I need at least the ability to generate POST parameters from a string containing HTML source of the form. This is needed in unit tests for a Django project. I would like a solution that possibly; Uses only standard Python library and D...
How do I submit a form given only the HTML source?
0.099668
0
0
941
343,769
2008-12-05T13:08:00.000
3
0
0
0
python,wiki,moinmoin
343,926
3
true
1
0
check out the interwiki page in moinmoin, (most wikis have them) we use trac for example and you can set up different link paths to point to your different web resources. So in our Trac you can go [[SSGWiki:Some Topic]] and it will point to another internal wiki.
1
2
0
We use a number of diffrent web services in our company, wiki(moinmoin), bugtracker (internally), requestracker (customer connection), subversion. Is there a way to parse the wikipages so that if I write "... in Bug1234 you could ..." Bug1234 woud be renderd as a link to http://mybugtracker/bug1234
How to use InterWiki links in moinmoin?
1.2
0
1
714
344,559
2008-12-05T17:15:00.000
1
1
0
0
python,xml,performance,large-files,expat-parser
344,641
4
false
0
0
If you know that the XML files are generated using the ever-same algorithm, it might be more efficient to not do any XML parsing at all. E.g. if you know that the data is in lines 3, 4, and 5, you might read through the file line-by-line, and then use regular expressions. Of course, that approach would fail if the file...
3
3
0
I have a directory full (~103, 104) of XML files from which I need to extract the contents of several fields. I've tested different xml parsers, and since I don't need to validate the contents (expensive) I was thinking of simply using xml.parsers.expat (the fastest one) to go through the files, one by one to extract ...
What is the most efficient way of extracting information from a large number of xml files in python?
0.049958
0
1
572
344,559
2008-12-05T17:15:00.000
1
1
0
0
python,xml,performance,large-files,expat-parser
345,650
4
false
0
0
One thing you didn't indicate is whether or not you're reading the XML into a DOM of some kind. I'm guessing that you're probably not, but on the off chance you are, don't. Use xml.sax instead. Using SAX instead of DOM will get you a significant performance boost.
3
3
0
I have a directory full (~103, 104) of XML files from which I need to extract the contents of several fields. I've tested different xml parsers, and since I don't need to validate the contents (expensive) I was thinking of simply using xml.parsers.expat (the fastest one) to go through the files, one by one to extract ...
What is the most efficient way of extracting information from a large number of xml files in python?
0.049958
0
1
572
344,559
2008-12-05T17:15:00.000
3
1
0
0
python,xml,performance,large-files,expat-parser
344,694
4
true
0
0
The quickest way would be to match strings (with, e.g., regular expressions) instead of parsing XML - depending on your XMLs this could actually work. But the most important thing is this: instead of thinking through several options, just implement them and time them on a small set. This will take roughly the same amou...
3
3
0
I have a directory full (~103, 104) of XML files from which I need to extract the contents of several fields. I've tested different xml parsers, and since I don't need to validate the contents (expensive) I was thinking of simply using xml.parsers.expat (the fastest one) to go through the files, one by one to extract ...
What is the most efficient way of extracting information from a large number of xml files in python?
1.2
0
1
572
344,753
2008-12-05T18:34:00.000
1
0
1
0
python,django,image,python-imaging-library
344,805
2
true
1
0
The error above happens because your file is called Image.py and you're trying to import yourself. As Manual pointed out, you should import Image from the PIL module, but you'd also need to rename your file so it's not called Image.py.
1
0
0
i am trying to do something with the PIL Image library in django, but i experience some problems. I do like this: import Image And then I do like this images = map(Image.open, glob.glob(os.path.join(dirpath, '*.thumb.jpg'))) But when i try to run this i get an error and it leeds me to think that its not imported co...
Having problem importing the PIL image library
1.2
0
0
2,719
345,255
2008-12-05T21:41:00.000
14
0
1
0
python,python-3.x
345,269
7
false
0
0
Go with 2.6 since that's what most libraries(pygame, wxpython, django, etc) target. The differences in 3.0 aren't that huge, so transitioning to it later shouldn't be much of a problem.
7
5
0
I am extremely new to python, having started to learn it less than a month ago, but experienced with some other programming languages (primarily C# and SQL). But now that Python 3.0 has been released and is not backwards compatible, what would be the advantages and disadvantages of deciding to focus on Python 3.0 or P...
Python Version for a Newbie
1
0
0
1,088
345,255
2008-12-05T21:41:00.000
1
0
1
0
python,python-3.x
346,438
7
false
0
0
If you're looking at it from a getting-a-job perspective, I'd definitely at least learn 2.x as well. The code I work on is still targeting python 2.4 and to the best of my knowledge there is no plans to move to even 2.6, let alone 3.0 in the near future. There will be a ton of 2.x python code floating around for year...
7
5
0
I am extremely new to python, having started to learn it less than a month ago, but experienced with some other programming languages (primarily C# and SQL). But now that Python 3.0 has been released and is not backwards compatible, what would be the advantages and disadvantages of deciding to focus on Python 3.0 or P...
Python Version for a Newbie
0.028564
0
0
1,088
345,255
2008-12-05T21:41:00.000
2
0
1
0
python,python-3.x
346,278
7
false
0
0
It depends on what you are willing to do. Python 3.0 is the newer release, and with time should become the standard. However, it has almost no libraries or frameworks available, and even the tools are not so up to date (e.g. the Eclipse plug-in for Python is still in the migration phase). On the other hand, there are n...
7
5
0
I am extremely new to python, having started to learn it less than a month ago, but experienced with some other programming languages (primarily C# and SQL). But now that Python 3.0 has been released and is not backwards compatible, what would be the advantages and disadvantages of deciding to focus on Python 3.0 or P...
Python Version for a Newbie
0.057081
0
0
1,088
345,255
2008-12-05T21:41:00.000
3
0
1
0
python,python-3.x
345,917
7
false
0
0
Start with 2.6, and when you get a bit more proficient with the language (few thousands of lines of code written), transitioning to 3.0 will be easy and natural. While learning I suggest you ignore classic classes, and pay special attention to iterators, generators, and list comprehension.
7
5
0
I am extremely new to python, having started to learn it less than a month ago, but experienced with some other programming languages (primarily C# and SQL). But now that Python 3.0 has been released and is not backwards compatible, what would be the advantages and disadvantages of deciding to focus on Python 3.0 or P...
Python Version for a Newbie
0.085505
0
0
1,088
345,255
2008-12-05T21:41:00.000
6
0
1
0
python,python-3.x
345,263
7
false
0
0
Since they have incompatibilities, I suggest you start going for Python 3.0 which is more useful in the future anyway. It's a better language. You can see the precise differences in What's new page on its Web site.
7
5
0
I am extremely new to python, having started to learn it less than a month ago, but experienced with some other programming languages (primarily C# and SQL). But now that Python 3.0 has been released and is not backwards compatible, what would be the advantages and disadvantages of deciding to focus on Python 3.0 or P...
Python Version for a Newbie
1
0
0
1,088
345,255
2008-12-05T21:41:00.000
5
0
1
0
python,python-3.x
345,288
7
true
0
0
I would say begin with 2.6 since the vast, vast majority of documentation regarding Python will be applicable to 2.6 as well most open source projects you may want to contribute to will be in 2.6 for awhile. Then, once you have a good foundation in 2.6, you can learn 3.0. That way you can kind of appreciate how the lan...
7
5
0
I am extremely new to python, having started to learn it less than a month ago, but experienced with some other programming languages (primarily C# and SQL). But now that Python 3.0 has been released and is not backwards compatible, what would be the advantages and disadvantages of deciding to focus on Python 3.0 or P...
Python Version for a Newbie
1.2
0
0
1,088
345,255
2008-12-05T21:41:00.000
1
0
1
0
python,python-3.x
345,304
7
false
0
0
Be careful though. Libraries such as the mysql driver are still in 2.5
7
5
0
I am extremely new to python, having started to learn it less than a month ago, but experienced with some other programming languages (primarily C# and SQL). But now that Python 3.0 has been released and is not backwards compatible, what would be the advantages and disadvantages of deciding to focus on Python 3.0 or P...
Python Version for a Newbie
0.028564
0
0
1,088
345,356
2008-12-05T22:14:00.000
10
0
1
0
python,python-3.x
345,502
2
false
0
0
All these are syntax/grammar changes. Such changes are traditionally introduced first in a Python x.y version with a from __future__ import … statement, and implemented at least on Python x.(y+1) version. Such a transition hasn't happened yet for these changes. Technically, I've answered your "why". Now, if you meant, ...
1
14
0
Python 2.6 was basically a stepping stone to make converting to Python 3 easier. A lot of the features destined for Python 3 were implemented in 2.6 if they didn't break backward compatibility with syntax and the class libs. Why weren't set literals ({1, 2, 3}), set comprehensions ({v for v in l}), or dict comprehensi...
Why doesn't Python 2.6 have set literals and comprehensions or dict comprehensions?
1
0
0
4,263
345,991
2008-12-06T05:59:00.000
2
0
0
0
python,logging,opengl,wxpython,pyopengl
369,184
3
false
0
1
After adding the Logging above, I was able to see that the problem was caused by missing TConstants class, which I was excluding in the py2exe setup.py file. After removing the "Tconstants" from the excluded list, I no longer had problems.
1
80
0
Okay, what is it, and why does it occur on Win2003 server, but not on WinXP. It doesn't seem to affect my application at all, but I get this error message when I close the application. And it's annoying (as errors messages should be). I am using pyOpenGl and wxPython to do the graphics stuff. Unfortunately, I'm a C# ...
Python - No handlers could be found for logger "OpenGL.error"
0.132549
0
0
91,403
346,230
2008-12-06T12:41:00.000
77
0
1
0
python,file,urllib2
346,237
3
true
0
0
You can use Python in interactive mode to search for solutions. if f is your object, you can enter dir(f) to see all methods and attributes. There's one called read. Enter help(f.read) and it tells you that f.read() is the way to retrieve a string from an file object.
1
31
0
I'm using urllib2 to read in a page. I need to do a quick regex on the source and pull out a few variables but urllib2 presents as a file object rather than a string. I'm new to python so I'm struggling to see how I use a file object to do this. Is there a quick way to convert this into a string?
Read file object as string in python
1.2
0
1
48,579
346,823
2008-12-06T21:40:00.000
0
0
0
0
python,algorithm,math
346,873
5
false
0
0
Using deltaX if deltax between 2 and 10 half increment if deltax between 10 and 20 unit increment if smaller than 2 we multiply by 10 and test again if larger than 20 we divide Then we get the position of the first unit or half increment on the width using xmin. I still need to test this solution.
1
2
1
I am trying to figure out the following problem. I am building Yet another math function grapher, The function is drawn on its predefined x,y range, that's all good. Now I am working on the background and the ticking of X, Y axes (if any axes are shown). I worked out the following. I have a fixed width of 250 p The ti...
Ticking function grapher
0
0
0
239
347,054
2008-12-07T00:49:00.000
7
0
0
1
php,asp.net,python,linux
347,065
9
true
0
0
You will only have a first language for a little while. Pick any direction that interests you, and follow it. There is no way around the introduction "Drink from the Firehose" experience. Keep early project simple, and tangible. Build useful things and the motivation will be there. Web / desktop / mobile / etc, its all...
7
3
0
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
1.2
0
0
775
347,054
2008-12-07T00:49:00.000
0
0
0
1
php,asp.net,python,linux
347,353
9
false
0
0
I had the same issue for a little while myself. I was getting bored of just being in PHP and wanted to be able to do more. I ended up settling on C# since it not only fulfilled the 'necessary evil' argument, but allows me to do anything I want in the MS realm, and is the closest syntax wise to another language (Java). ...
7
3
0
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
0
0
0
775
347,054
2008-12-07T00:49:00.000
0
0
0
1
php,asp.net,python,linux
347,348
9
false
0
0
Really all you need to do is make sure you take baby steps and are doing something you are enjoying. I started off programming in visual basic on a little game. Not the best language, but it was a good starting point for me at the time. My point is, you don't need to pick the best language/operating system/anything fro...
7
3
0
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
0
0
0
775
347,054
2008-12-07T00:49:00.000
0
0
0
1
php,asp.net,python,linux
347,120
9
false
0
0
I find some of my junior colleagues (atleast the ones that are very passionate about CS) asking similar questions (sometimes I find myself asking this too, even though I am now 12+ yrs into the industry). One advice I give them (and to myself too), which helped me, is - Focus on the job that is already assigned to yo...
7
3
0
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
0
0
0
775
347,054
2008-12-07T00:49:00.000
2
0
0
1
php,asp.net,python,linux
347,066
9
false
0
0
The reason I settled in on Web Development as my course to learning programming is because I actually have a task to implement rather then aimlessly reading reference books etc. This is exactly the course to follow. I think most of us get into programming the same way. Find a problem and work out its solution in wh...
7
3
0
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
0.044415
0
0
775
347,054
2008-12-07T00:49:00.000
0
0
0
1
php,asp.net,python,linux
347,121
9
false
0
0
Thanks for the thoughtful responses That seemed to be another distraction from learning programming for me anyway. I spent more time chasing apparent fixes for upgraded packages and such. Mostly things that were already working and it just seemed to not make much sense to spend time recreating the wheel so to speak. Be...
7
3
0
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
0
0
0
775
347,054
2008-12-07T00:49:00.000
0
0
0
1
php,asp.net,python,linux
347,076
9
false
0
0
Don't worry so much about the direction you're going, just make sure that: a) You are enjoying it, and are understanding what you are doing. You don't have to initially understand concepts like polymorphism for example, but you should be understanding the basics of what you are doing. Just can't wrap your mind around T...
7
3
0
I seem to be in a never ending tail spin of Linux, or not, Windows or not. Web programming or system programming. Python or PHP. I'am self teaching myself programming. But it seems I keep being torn about which way to go. Unfortunately it is always seemingly good reasons to get side tracked. You know the whole open sou...
Where do I go from here -- regarding programming?
0
0
0
775
347,812
2008-12-07T17:41:00.000
8
0
0
0
python,django,caching,django-cache
348,079
4
false
1
0
Mock the view, hit the page, and see if the mock was called. if it was not, the cache was used instead.
2
17
0
Is there a way to be sure that a page is coming from cache on a production server and on the development server as well? The solution shouldn't involve caching middleware because not every project uses them. Though the solution itself might be a middleware. Just checking if the data is stale is not a very safe testing ...
How to test django caching?
1
0
0
7,621
347,812
2008-12-07T17:41:00.000
2
0
0
0
python,django,caching,django-cache
348,192
4
false
1
0
The reason you use caches is to improve performance. Test the performance by running a load test against your server. If the server's performance matches your needs, then you are all set!
2
17
0
Is there a way to be sure that a page is coming from cache on a production server and on the development server as well? The solution shouldn't involve caching middleware because not every project uses them. Though the solution itself might be a middleware. Just checking if the data is stale is not a very safe testing ...
How to test django caching?
0.099668
0
0
7,621
348,392
2008-12-08T00:12:00.000
2
1
0
0
python,email
348,579
9
false
0
0
Depending on the amount of mail you are sending you might want to look into using a real mail server like postifx or sendmail (*nix systems) Both of those programs have the ability to send a received mail to a program based on the email address.
4
43
0
How can I receive and send email in python? A 'mail server' of sorts. I am looking into making an app that listens to see if it receives an email addressed to foo@bar.domain.com, and sends an email to the sender. Now, am I able to do this all in python, would it be best to use 3rd party libraries?
Receive and send emails in python
0.044415
0
1
51,409
348,392
2008-12-08T00:12:00.000
4
1
0
0
python,email
348,403
9
false
0
0
poplib and smtplib will be your friends when developing your app.
4
43
0
How can I receive and send email in python? A 'mail server' of sorts. I am looking into making an app that listens to see if it receives an email addressed to foo@bar.domain.com, and sends an email to the sender. Now, am I able to do this all in python, would it be best to use 3rd party libraries?
Receive and send emails in python
0.088656
0
1
51,409
348,392
2008-12-08T00:12:00.000
12
1
0
0
python,email
349,352
9
false
0
0
I do not think it would be a good idea to write a real mail server in Python. This is certainly possible (see mcrute's and Manuel Ceron's posts to have details) but it is a lot of work when you think of everything that a real mail server must handle (queuing, retransmission, dealing with spam, etc). You should explain ...
4
43
0
How can I receive and send email in python? A 'mail server' of sorts. I am looking into making an app that listens to see if it receives an email addressed to foo@bar.domain.com, and sends an email to the sender. Now, am I able to do this all in python, would it be best to use 3rd party libraries?
Receive and send emails in python
1
0
1
51,409
348,392
2008-12-08T00:12:00.000
7
1
0
0
python,email
348,423
9
false
0
0
Python has an SMTPD module that will be helpful to you for writing a server. You'll probably also want the SMTP module to do the re-send. Both modules are in the standard library at least since version 2.3.
4
43
0
How can I receive and send email in python? A 'mail server' of sorts. I am looking into making an app that listens to see if it receives an email addressed to foo@bar.domain.com, and sends an email to the sender. Now, am I able to do this all in python, would it be best to use 3rd party libraries?
Receive and send emails in python
1
0
1
51,409
348,999
2008-12-08T09:33:00.000
5
0
0
0
python,mime-types
349,020
3
true
0
0
On my system (Debian lenny) its in /usr/lib/python2.5/mimetypes.py in the list knownfiles you can supply your own files for the init() function.
3
7
0
On my Centos server Python's mimetypes.guess_type("mobile.3gp") returns (None, None), instead of ('video/3gpp', None). Where does Python get the list of mimetypes from, and is it possible to add a missing type to the list?
Adding a mimetype in python
1.2
0
0
3,062
348,999
2008-12-08T09:33:00.000
0
0
0
0
python,mime-types
43,311,856
3
false
0
0
In python 3.6 find that file: C:\Users\Me\AppData\Local\Programs\Python\Python36\Lib\mimetypes.py Search for mp3 (to get the list of extension). Add your file (it's intuitive)
3
7
0
On my Centos server Python's mimetypes.guess_type("mobile.3gp") returns (None, None), instead of ('video/3gpp', None). Where does Python get the list of mimetypes from, and is it possible to add a missing type to the list?
Adding a mimetype in python
0
0
0
3,062
348,999
2008-12-08T09:33:00.000
2
0
0
0
python,mime-types
349,024
3
false
0
0
The mimetypes module uses mime.types files as they are common on Linux/Unix systems. If you look in mimetypes.knownfiles you will find a list of files that Python tries to access to load the data. You can also specify your own file to add new types by adding it to that list.
3
7
0
On my Centos server Python's mimetypes.guess_type("mobile.3gp") returns (None, None), instead of ('video/3gpp', None). Where does Python get the list of mimetypes from, and is it possible to add a missing type to the list?
Adding a mimetype in python
0.132549
0
0
3,062
351,656
2008-12-09T02:57:00.000
10
1
0
0
python,testing,imap,mocking
351,675
4
true
0
0
I found it quite easy to write an IMAP server in twisted last time I tried. It comes with support for writing IMAP servers and you have a huge amount of flexibility.
3
11
0
I'm curious to know if there is an easy way to mock an IMAP server (a la the imaplib module) in Python, without doing a lot of work. Is there a pre-existing solution? Ideally I could connect to the existing IMAP server, do a dump, and have the mock server run off the real mailbox/email structure. Some background into t...
How do I mock an IMAP server in Python, despite extreme laziness?
1.2
0
0
4,288
351,656
2008-12-09T02:57:00.000
7
1
0
0
python,testing,imap,mocking
353,175
4
false
0
0
How much of it do you really need for any one test? If you start to build something on the order of complexity of a real server so that you can use it on all your tests, you've already gone wrong. Just mock the bits any one tests needs. Don't bother trying so hard to share a mock implementation. They're not suppose...
3
11
0
I'm curious to know if there is an easy way to mock an IMAP server (a la the imaplib module) in Python, without doing a lot of work. Is there a pre-existing solution? Ideally I could connect to the existing IMAP server, do a dump, and have the mock server run off the real mailbox/email structure. Some background into t...
How do I mock an IMAP server in Python, despite extreme laziness?
1
0
0
4,288
351,656
2008-12-09T02:57:00.000
1
1
0
0
python,testing,imap,mocking
352,194
4
false
0
0
I never tried but, if I had to, I would start with the existing SMTP server.
3
11
0
I'm curious to know if there is an easy way to mock an IMAP server (a la the imaplib module) in Python, without doing a lot of work. Is there a pre-existing solution? Ideally I could connect to the existing IMAP server, do a dump, and have the mock server run off the real mailbox/email structure. Some background into t...
How do I mock an IMAP server in Python, despite extreme laziness?
0.049958
0
0
4,288
352,340
2008-12-09T10:34:00.000
2
0
0
0
python,file,mime-types,download
352,385
3
false
1
0
You can either pass back a reference to the file itself i.e. the full path to the file. Then you can open the file or otherwise manipulate it. Or, the more normal case is to pass back the file handle, and, use the standard read/write operations on the file handle. It is not recommended to pass the actual data as files ...
1
1
0
Edit: How to return/serve a file from a python controller (back end) over a web server, with the file_name? as suggested by @JV
Return file from python module
0.132549
0
1
14,590
352,670
2008-12-09T13:15:00.000
4
0
0
0
python,algorithm,random,random-sample
9,827,070
9
false
0
0
The following is a description of random weighted selection of an element of a set (or multiset, if repeats are allowed), both with and without replacement in O(n) space and O(log n) time. It consists of implementing a binary search tree, sorted by the elements to be selected, where each node of the tree contains: ...
2
52
1
Recently I needed to do weighted random selection of elements from a list, both with and without replacement. While there are well known and good algorithms for unweighted selection, and some for weighted selection without replacement (such as modifications of the resevoir algorithm), I couldn't find any good algorithm...
Weighted random selection with and without replacement
0.088656
0
0
32,149
352,670
2008-12-09T13:15:00.000
1
0
0
0
python,algorithm,random,random-sample
66,553,611
9
false
0
0
This is an old question for which numpy now offers an easy solution so I thought I would mention it. Current version of numpy is version 1.2 and numpy.random.choice allows the sampling to be done with or without replacement and with given weights.
2
52
1
Recently I needed to do weighted random selection of elements from a list, both with and without replacement. While there are well known and good algorithms for unweighted selection, and some for weighted selection without replacement (such as modifications of the resevoir algorithm), I couldn't find any good algorithm...
Weighted random selection with and without replacement
0.022219
0
0
32,149
354,421
2008-12-09T22:07:00.000
2
0
1
0
python
354,622
4
false
0
0
There are two different implementations one for int (long in 3.0) objects and another one for float objects. The float pow is the float_pow(PyObject *v, PyObject *w, PyObject *z) function defined in Objects/floatobject.c file of the Python source code. This functions calls pow() from C stdlib's math.h The int pow has ...
1
12
0
I'm wondering where I find the source to show how the operator ** is implemented in Python. Can someone point me in the right direction?
How is ** implemented in Python?
0.099668
0
0
1,787
354,755
2008-12-10T00:43:00.000
0
0
0
0
python,django,django-models
355,537
2
false
1
0
You can add field CommentCount to you Post model, and update it in pre_save, pre_delete signals. It's a hard for the db to calculate comments count at every view call and number of queries will be grow.
1
2
0
I'm working on a blog application in Django. Naturally, I have models set up such that there are Posts and Comments, and a particular Post may have many Comments; thus, Post is a ForeignKey in the Comments model. Given a Post object, is there an easy way (ideally, through a method call) to find out how many Comments be...
How can I get the number of records that reference a particular foreign key in Django?
0
0
0
270
355,539
2008-12-10T09:49:00.000
7
0
1
0
python,attributes
355,571
3
false
0
0
For checking if a key is in a dictionary you can use in: 'key' in dictionary. For checking for attributes in object use the hasattr() function: hasattr(obj, 'attribute')
1
88
0
If I had a dictionary dict and I wanted to check for dict['key'] I could either do so in a try block (bleh!) or use the get() method, with False as a default value. I'd like to do the same thing for object.attribute. That is, I already have object to return False if it hasn't been set, but then that gives me errors lik...
A get() like method for checking for Python attributes
1
0
0
47,471
355,739
2008-12-10T11:23:00.000
1
0
1
0
python,web-crawler
355,992
4
false
0
0
I am not sure if I understood the question right, I am just curious, so here are few questions and suggestions: Are you planning to catch the Ctrl+C interrupt and do the deque? What happens if the crawler crashes for some arbitrary reason like an unhandled exception or crash? You loose the queue status and start over a...
2
3
0
I am writing a crawler in Python, in order to make Ctrl+C not to cause my crawler to start over in next run, I need to save the processing deque in a text file (one item per line) and update it every iteration, the update operation needs to be super fast. In order not to reinvent the wheel, I am asking if there is an e...
Save a deque in a text file
0.049958
0
0
2,440
355,739
2008-12-10T11:23:00.000
0
0
1
0
python,web-crawler
355,788
4
false
0
0
Some things that come to my mind: leave the file handle open (don't close the file everytime you wrote something) or write the file every n items and catch a close signal to write the current non-written items
2
3
0
I am writing a crawler in Python, in order to make Ctrl+C not to cause my crawler to start over in next run, I need to save the processing deque in a text file (one item per line) and update it every iteration, the update operation needs to be super fast. In order not to reinvent the wheel, I am asking if there is an e...
Save a deque in a text file
0
0
0
2,440
356,090
2008-12-10T13:49:00.000
0
0
0
0
python,math,nth-root
356,110
11
false
0
0
In older versions of Python, 1/3 is equal to 0. In Python 3.0, 1/3 is equal to 0.33333333333 (and 1//3 is equal to 0). So, either change your code to use 1/3.0 or switch to Python 3.0 .
3
31
0
I need a way to compute the nth root of a long integer in Python. I tried pow(m, 1.0/n), but it doesn't work: OverflowError: long int too large to convert to float Any ideas? By long integer I mean REALLY long integers like: 11968003966030964356885611480383408833172346450467339251 19609314414104568346308529111567...
How to compute the nth root of a very big integer
0
0
0
40,897
356,090
2008-12-10T13:49:00.000
-3
0
0
0
python,math,nth-root
356,213
11
false
0
0
Well, if you're not particularly worried about precision, you could convert it to a sting, chop off some digits, use the exponent function, and then multiply the result by the root of how much you chopped off. E.g. 32123 is about equal to 32 * 1000, the cubic root is about equak to cubic root of 32 * cubic root of 1000...
3
31
0
I need a way to compute the nth root of a long integer in Python. I tried pow(m, 1.0/n), but it doesn't work: OverflowError: long int too large to convert to float Any ideas? By long integer I mean REALLY long integers like: 11968003966030964356885611480383408833172346450467339251 19609314414104568346308529111567...
How to compute the nth root of a very big integer
-0.054491
0
0
40,897
356,090
2008-12-10T13:49:00.000
-1
0
0
0
python,math,nth-root
356,102
11
false
0
0
Try converting the exponent to a floating number, as the default behaviour of / in Python is integer division n**(1/float(3))
3
31
0
I need a way to compute the nth root of a long integer in Python. I tried pow(m, 1.0/n), but it doesn't work: OverflowError: long int too large to convert to float Any ideas? By long integer I mean REALLY long integers like: 11968003966030964356885611480383408833172346450467339251 19609314414104568346308529111567...
How to compute the nth root of a very big integer
-0.01818
0
0
40,897
358,398
2008-12-11T03:50:00.000
1
0
0
0
python,google-app-engine,post,get
358,757
6
false
1
0
HTTP is stateless, so you have no (built-in) way of knowing if the user that loads one page is the same user that loaded another. Further, even if you do know that, thanks to session cookies, for example, you have no way of telling if the browser window they're loading the subsequent page in is the same one they loaded...
5
0
0
I have a class called myClass which defines post() and get() methods. From index.html, I have a form with an action that calls myClass.post() which grabs some data from the data base, sets a couple variables and sends the user to new.html. now, new.html has a form which calls myClass.get(). I want the get() method t...
Keeping a variable around from post to get?
0.033321
0
0
509
358,398
2008-12-11T03:50:00.000
0
0
0
0
python,google-app-engine,post,get
358,805
6
false
1
0
Why not just use memcache to temporarily store the variable, and then redirect to the POST URL? That seems like the easiest solution.
5
0
0
I have a class called myClass which defines post() and get() methods. From index.html, I have a form with an action that calls myClass.post() which grabs some data from the data base, sets a couple variables and sends the user to new.html. now, new.html has a form which calls myClass.get(). I want the get() method t...
Keeping a variable around from post to get?
0
0
0
509
358,398
2008-12-11T03:50:00.000
3
0
0
0
python,google-app-engine,post,get
359,034
6
false
1
0
What you're talking about is establishing a "session". That is, a way to remember the user and the state of their transaction. There are several ways of tackling this, all of which rely on techniques for remembering that you're in a session in the first place. HTTP provides you no help. You have to find some place to...
5
0
0
I have a class called myClass which defines post() and get() methods. From index.html, I have a form with an action that calls myClass.post() which grabs some data from the data base, sets a couple variables and sends the user to new.html. now, new.html has a form which calls myClass.get(). I want the get() method t...
Keeping a variable around from post to get?
0.099668
0
0
509
358,398
2008-12-11T03:50:00.000
0
0
0
0
python,google-app-engine,post,get
358,425
6
false
1
0
I don't know specifically about the google app engine, but normally, here's what happens: The server would have some kind of thread pool. Every time an http request is sent to the server, a thread is selected from the pool or created. In that thread an instance of some kind of controller object will be created. This ob...
5
0
0
I have a class called myClass which defines post() and get() methods. From index.html, I have a form with an action that calls myClass.post() which grabs some data from the data base, sets a couple variables and sends the user to new.html. now, new.html has a form which calls myClass.get(). I want the get() method t...
Keeping a variable around from post to get?
0
0
0
509
358,398
2008-12-11T03:50:00.000
0
0
0
0
python,google-app-engine,post,get
360,292
6
false
1
0
OK -- Thanks everyone. I'll try some of these ideas out, soon, and get back to you all. It seems I can work around some these things by doing a lot of writing and reading from the datastore*, but I thought there might be an easier way of keeping that instance of the class around (I'm trying to use my known techniques...
5
0
0
I have a class called myClass which defines post() and get() methods. From index.html, I have a form with an action that calls myClass.post() which grabs some data from the data base, sets a couple variables and sends the user to new.html. now, new.html has a form which calls myClass.get(). I want the get() method t...
Keeping a variable around from post to get?
0
0
0
509
359,347
2008-12-11T13:30:00.000
30
0
0
1
python,windows,subprocess
359,737
5
false
0
0
To do that, you would have to: supply the shell=True argument in the subprocess.Popen call, and separate the commands with: ; if running under a *nix shell (bash, ash, sh, ksh, csh, tcsh, zsh etc) & if running under the cmd.exe of Windows
1
25
0
I would like to execute multiple commands in a row: i.e. (just to illustrate my need): cmd (the shell) then cd dir and ls and read the result of the ls. Any idea with subprocess module? Update: cd dir and ls are just an example. I need to run complex commands (following a particular order, without any pipelining). In f...
Execute Commands Sequentially in Python?
1
0
0
51,127
359,409
2008-12-11T13:52:00.000
3
0
0
0
python,postgresql,sqlalchemy
405,923
3
true
0
0
we've never had an "OID" type specifically, though we've supported the concept of an implicit "OID" column on every table through the 0.4 series, primarily for the benefit of postgres. However since user-table defined OID columns are deprecated in Postgres, and we in fact never really used the OID feature that was pre...
1
8
0
What is the sqlalchemy equivalent column type for 'money' and 'OID' column types in Postgres?
What is the sqlalchemy equivalent column type for 'money' and 'OID' in Postgres?
1.2
1
0
10,565
359,498
2008-12-11T14:21:00.000
1
0
1
0
python,dll,ctypes
49,419,937
6
false
0
0
If you need this functionality, you could write 2 dlls where dll_A loads/Unloads library from dll_B. Use dll_A as as python interface-loader and passthrough for functions in dll_B.
1
24
0
I'm using ctypes to load a DLL in Python. This works great. Now we'd like to be able to reload that DLL at runtime. The straightforward approach would seem to be: 1. Unload DLL 2. Load DLL Unfortunately I'm not sure what the correct way to unload the DLL is. _ctypes.FreeLibrary is available, but private. Is there so...
How can I unload a DLL using ctypes in Python?
0.033321
0
0
25,010
359,706
2008-12-11T15:26:00.000
3
0
0
0
python-imaging-library,polygon,alpha
385,867
7
false
0
0
PIL's Image module provides a blend method. Create a second image the same size as your first, with a black background. Draw your polygon on it (with full colour). Then call Image.blend passing the two images and an alpha level. It returns a third image, which should have a semi-transparent polygon on it. I haven't mea...
1
27
0
I'm using PIL (Python Imaging Library). I'd like to draw transparent polygons. It seems that specifying a fill color that includes alpha level does not work. Are their workarounds? If it can't be done using PIL I'm willing to use something else. If there is more than one solution, then performance should be factored...
How to draw transparent polygons?
0.085505
0
0
36,190
359,933
2008-12-11T16:18:00.000
2
0
1
0
.net,attributes,ironpython
361,448
2
false
0
0
One, albeit ugly and sometimes impractical, workaround is to create a stub class in C# and decorate it with attributes and derive from that in IronPython.
1
1
0
Since IronPython doesn't support attributes I am wondering if there is another way to decorate IronPython classes with attributes, perhaps with reflection?
How can I add attributes to methods and types defined in IronPython?
0.197375
0
0
1,393
360,602
2008-12-11T19:38:00.000
8
0
0
0
python,windows,linux,native,gui-toolkit
361,672
3
false
0
1
Python binding of Wx is very strong since at least one of the core developer is a python guy itself. WxWdgets is robust, time proven stable, mature, but also bit more than just GUI. Even is a lot is left out in WxPython - because Python itself offers that already - you might find that extra convenient for your project....
2
4
0
I need to decide on a GUI/Widget toolkit to use with Python for a new project. The target platforms will be Linux with KDE and Windows XP (and probably Vista). What Python GUI toolkit looks best and consistent with the native look and feel of the run time platform? If possible, cite strengths and weaknesses of the sugg...
What GUI toolkit looks best for a native LAF for Python in Windows and Linux?
1
0
0
1,840
360,602
2008-12-11T19:38:00.000
0
0
0
0
python,windows,linux,native,gui-toolkit
361,996
3
false
0
1
Like others said, PyQt or wxPython... The technical difference between the two is more or less imaginary - it's a question of your comfort with the toolkit that matters, really.
2
4
0
I need to decide on a GUI/Widget toolkit to use with Python for a new project. The target platforms will be Linux with KDE and Windows XP (and probably Vista). What Python GUI toolkit looks best and consistent with the native look and feel of the run time platform? If possible, cite strengths and weaknesses of the sugg...
What GUI toolkit looks best for a native LAF for Python in Windows and Linux?
0
0
0
1,840
360,911
2008-12-11T21:05:00.000
0
0
0
1
python,apache,cvs,sspi
361,235
1
true
1
0
Usage of SSPI make me think you are using CVSNT, thus a Windows system; what is the user you are running Apache into? Default user for services is SYSTEM, which does not share the same registry as your current user.
1
0
0
I'm running an Apache server (v2.2.10) with mod_python, Python 2.5 and Django. I have a small web app that will show the current projects we have in CVS and allow users to make a build of the different projects (the build checks out the project, and copies certain files over with the source stripped out). On the Djang...
Access CVS through Apache service using SSPI
1.2
0
0
820
361,675
2008-12-12T01:50:00.000
31
1
1
0
python,unit-testing,comparison,doctest
10,861,736
11
false
0
0
I work as a bioinformatician, and most of the code I write is "one time, one task" scripts, code that will be run only once or twice and that execute a single specific task. In this situation, writing big unittests may be overkill, and doctests are an useful compromise. They are quicker to write, and since they are usu...
9
169
0
I'm trying to get started with unit testing in Python and I was wondering if someone could explain the advantages and disadvantages of doctest and unittest. What conditions would you use each for?
Python - doctest vs. unittest
1
0
0
29,175
361,675
2008-12-12T01:50:00.000
37
1
1
0
python,unit-testing,comparison,doctest
667,829
11
false
0
0
Another advantage of doctesting is that you get to make sure your code does what your documentation says it does. After a while, software changes can make your documentation and code do different things. :-)
9
169
0
I'm trying to get started with unit testing in Python and I was wondering if someone could explain the advantages and disadvantages of doctest and unittest. What conditions would you use each for?
Python - doctest vs. unittest
1
0
0
29,175
361,675
2008-12-12T01:50:00.000
7
1
1
0
python,unit-testing,comparison,doctest
361,788
11
false
0
0
Using both is a valid and rather simple option. The doctest module provides the DoctTestSuite and DocFileSuite methods which create a unittest-compatible testsuite from a module or file, respectively. So I use both and typically use doctest for simple tests with functions that require little or no setup (simple types f...
9
169
0
I'm trying to get started with unit testing in Python and I was wondering if someone could explain the advantages and disadvantages of doctest and unittest. What conditions would you use each for?
Python - doctest vs. unittest
1
0
0
29,175
361,675
2008-12-12T01:50:00.000
7
1
1
0
python,unit-testing,comparison,doctest
361,703
11
false
0
0
I use unittest exclusively; I think doctest clutters up the main module too much. This probably has to do with writing thorough tests.
9
169
0
I'm trying to get started with unit testing in Python and I was wondering if someone could explain the advantages and disadvantages of doctest and unittest. What conditions would you use each for?
Python - doctest vs. unittest
1
0
0
29,175
361,675
2008-12-12T01:50:00.000
50
1
1
0
python,unit-testing,comparison,doctest
361,680
11
false
0
0
I use unittest almost exclusively. Once in a while, I'll put some stuff in a docstring that's usable by doctest. 95% of the test cases are unittest. Why? I like keeping docstrings somewhat shorter and more to the point. Sometimes test cases help clarify a docstring. Most of the time, the application's test cases are...
9
169
0
I'm trying to get started with unit testing in Python and I was wondering if someone could explain the advantages and disadvantages of doctest and unittest. What conditions would you use each for?
Python - doctest vs. unittest
1
0
0
29,175
361,675
2008-12-12T01:50:00.000
8
1
1
0
python,unit-testing,comparison,doctest
13,722,080
11
false
0
0
I don't use doctest as a replacement for unittest. Although they overlap a bit, the two modules don't have the same function: I use unittest as a unit testing framework, meaning it helps me determine quickly the impact of any modification on the rest of the code. I use doctest as a guarantee that comments (namely docs...
9
169
0
I'm trying to get started with unit testing in Python and I was wondering if someone could explain the advantages and disadvantages of doctest and unittest. What conditions would you use each for?
Python - doctest vs. unittest
1
0
0
29,175
361,675
2008-12-12T01:50:00.000
4
1
1
0
python,unit-testing,comparison,doctest
361,698
11
false
0
0
I almost never use doctests. I want my code to be self documenting, and the docstrings provide the documentation to the user. IMO adding hundreds of lines of tests to a module makes the docstrings far less readable. I also find unit tests easier to modify when needed.
9
169
0
I'm trying to get started with unit testing in Python and I was wondering if someone could explain the advantages and disadvantages of doctest and unittest. What conditions would you use each for?
Python - doctest vs. unittest
0.072599
0
0
29,175
361,675
2008-12-12T01:50:00.000
3
1
1
0
python,unit-testing,comparison,doctest
361,886
11
false
0
0
I prefer the discovery based systems ("nose" and "py.test", using the former currently). doctest is nice when the test is also good as a documentation, otherwise they tend to clutter the code too much.
9
169
0
I'm trying to get started with unit testing in Python and I was wondering if someone could explain the advantages and disadvantages of doctest and unittest. What conditions would you use each for?
Python - doctest vs. unittest
0.054491
0
0
29,175
361,675
2008-12-12T01:50:00.000
14
1
1
0
python,unit-testing,comparison,doctest
361,683
11
false
0
0
If you're just getting started with the idea of unit testing, I would start with doctest because it is so simple to use. It also naturally provides some level of documentation. And for more comprehensive testing with doctest, you can place tests in an external file so it doesn't clutter up your documentation. I would s...
9
169
0
I'm trying to get started with unit testing in Python and I was wondering if someone could explain the advantages and disadvantages of doctest and unittest. What conditions would you use each for?
Python - doctest vs. unittest
1
0
0
29,175
362,428
2008-12-12T10:36:00.000
0
0
0
0
ironpython,ironpython-studio
363,455
2
true
0
1
In the end it was even simpler. I was trying to invoke the subform thus: f = frmSubform() f.Show() But I actually needed to do it this way f = frmSubform() Form.Show(f) Form.ShowDialog(f) worked also; in a Dialog format of course. A simple enough error but until you know you, well, don't know. I'm not 100% sure I under...
1
1
0
This is a two part question. A dumb technical query and a broader query about my possibly faulty approach to learning to do some things in a language I'm new to. I'm just playing around with a few Python GUI libraries (mostly wxPython and IronPython) for some work I'm thinking of doing on an open source app, just to im...
Ironpython Studio forms
1.2
0
0
1,298
362,522
2008-12-12T11:37:00.000
1
0
1
0
python,emacs,editing
362,596
6
false
0
0
python-mode.el is written by the Python community. python.el is written by the emacs community. I've used python-mode.el for as long as I can remember and python.el doesn't even come close to the standards of python-mode.el. I trust the Python community better than the Emacs community to come up with a decent mode file...
4
30
0
I recently tried switching from using python-mode.el to python.el for editing python files in emacs, found the experience a little alien and unproductive, and scurried back. I've been using python-mode.el for something like ten years, so perhaps I'm a little set in my ways. I'd be interested in hearing from anyone wh...
Switching from python-mode.el to python.el
0.033321
0
0
7,412
362,522
2008-12-12T11:37:00.000
1
0
1
0
python,emacs,editing
1,005,515
6
false
0
0
python-mode.el has no support triple-quoted strings, so if your program contains long docstrings, all the syntax coloring (and associated syntaxic features) tends to break down. my .02
4
30
0
I recently tried switching from using python-mode.el to python.el for editing python files in emacs, found the experience a little alien and unproductive, and scurried back. I've been using python-mode.el for something like ten years, so perhaps I'm a little set in my ways. I'd be interested in hearing from anyone wh...
Switching from python-mode.el to python.el
0.033321
0
0
7,412
362,522
2008-12-12T11:37:00.000
2
0
1
0
python,emacs,editing
13,267,654
6
false
0
0
Note nearly everything said here is obsolete meanwhile as things changed. python-mode.el commands are prefixed "py-" basically, you should be able to use commands from both, nonewithstanding which one was loaded first. python-mode.el does not unload python.el; beside of python-mode-map, which is re-defined. The diff i...
4
30
0
I recently tried switching from using python-mode.el to python.el for editing python files in emacs, found the experience a little alien and unproductive, and scurried back. I've been using python-mode.el for something like ten years, so perhaps I'm a little set in my ways. I'd be interested in hearing from anyone wh...
Switching from python-mode.el to python.el
0.066568
0
0
7,412
362,522
2008-12-12T11:37:00.000
0
0
1
0
python,emacs,editing
71,343,689
6
false
0
0
Debian has deleted the python-mode package, alas, so I felt compelled to try python.el. I loaded it and ran "describe-bindings". It appeared to be designed for elisp coders who think c-X ; is the intuitive binding for commenting a line of Python code. (Wow.) Also, I found no way at all to comment a region of code, ...
4
30
0
I recently tried switching from using python-mode.el to python.el for editing python files in emacs, found the experience a little alien and unproductive, and scurried back. I've been using python-mode.el for something like ten years, so perhaps I'm a little set in my ways. I'd be interested in hearing from anyone wh...
Switching from python-mode.el to python.el
0
0
0
7,412
364,015
2008-12-12T20:22:00.000
5
0
0
0
python,django,django-models,django-templates
364,161
3
false
1
0
first, forget all MVC mantra. it's important to have a good layered structure, but MVC (as defined originally) isn't one, it was a modular structure, where each GUI module is split in these tree submodules. nothing to use on the web here. in web development, it really pays to have a layered structure, where the most ...
1
8
0
Pretty new to this scene and trying to find some documentation to adopt best practices. We're building a fairly large content site which will consist of various media catalogs and I'm trying to find some comparable data / architectural models so that we can get a better idea of the approach we should use using a frame...
MVC and django fundamentals
0.321513
0
0
5,782
364,486
2008-12-12T23:26:00.000
0
1
0
0
php,python,perl,eclipse
6,481,753
7
false
1
0
I develop in PHP, python, C(python modules), SQL and JS/HTML/CSS all on eclipse. I do this by installing PDT, CDT, pydev and SQL tools onto the eclipse-platform, and then using different workspaces for mixed projects. Two workspaces to be specific, one for PHP web development and another for Python/C. I do run it on a...
3
4
0
I'd like to try out Eclipse, but I'm a bit baffled with all the different distributions of it. I mainly program in Python doing web development, but I also need to maintain PHP and Perl apps. It looks like EasyEclipse is a bit behind. Should I just grab the base Eclipse and start loading plug-ins?
Which Eclipse distribution is good for web development using Python, PHP, or Perl?
0
0
0
2,130
364,486
2008-12-12T23:26:00.000
0
1
0
0
php,python,perl,eclipse
18,023,885
7
false
1
0
I use the javascript eclipse helios and added pydev plugin to it for django support it seems to do everything I need.
3
4
0
I'd like to try out Eclipse, but I'm a bit baffled with all the different distributions of it. I mainly program in Python doing web development, but I also need to maintain PHP and Perl apps. It looks like EasyEclipse is a bit behind. Should I just grab the base Eclipse and start loading plug-ins?
Which Eclipse distribution is good for web development using Python, PHP, or Perl?
0
0
0
2,130
364,486
2008-12-12T23:26:00.000
0
1
0
0
php,python,perl,eclipse
364,517
7
false
1
0
PyDev is pretty decent as I'm sure you know. It can fit on top of all the Eclipse distributions (provided they meet the minimum version requirements). If you're doing webdev stuff, you'll probably find the closest fit with Aptana. That said, I find Aptana hideously clunky when compared to a decent text editor. I build...
3
4
0
I'd like to try out Eclipse, but I'm a bit baffled with all the different distributions of it. I mainly program in Python doing web development, but I also need to maintain PHP and Perl apps. It looks like EasyEclipse is a bit behind. Should I just grab the base Eclipse and start loading plug-ins?
Which Eclipse distribution is good for web development using Python, PHP, or Perl?
0
0
0
2,130
364,802
2008-12-13T03:55:00.000
2
0
1
0
python
27,446,011
7
false
0
0
Generator comprehension is an approach to create iterables, something like a cursor which moves on a resource. If you know mysql cursor or mongodb cursor, you may be aware of that the whole actual data never gets loaded into the memory at once, but one at a time. Your cursor moves back and forth, but there is always a...
1
119
0
What does generator comprehension do? How does it work? I couldn't find a tutorial about it.
How exactly does a generator comprehension work?
0.057081
0
0
77,729
365,058
2008-12-13T09:55:00.000
3
0
0
0
python,winapi
365,096
2
false
0
0
In a console application, you can use win32api.SetConsoleCtrlHandler and look for CTRL_LOGOFF_EVENT. In a GUI application, you need a window open and wait for the WM_QUERYENDSESSION message. How precisely that works (and if it works at all) depends on your GUI library.
1
5
0
How can I detect, or be notified, when windows is logging out in python? Edit: Martin v. Löwis' answer is good, and works for a full logout but it does not work for a 'fast user switching' event like pressing win+L which is what I really need it for. Edit: im not using a gui this is running as a service
Detect windows logout in Python
0.291313
0
0
2,932
365,082
2008-12-13T10:30:00.000
5
0
0
0
python,python-3.x,django,django-forms,django-admin
365,431
6
false
1
0
Building on Javier's answer; if you need one label in forms (on the front-end) and another label on admin it is best to set internal (admin) one in the model and overwrite it on forms. Admin will of course use the label in the model field automatically.
1
64
0
As the title suggests. I want to be able to change the label of a single field in the admin application. I'm aware of the Form.field attribute, but how do I get my Model or ModelAdmin to pass along that information?
Can you change a field label in the Django Admin application?
0.16514
0
0
67,765
366,682
2008-12-14T16:20:00.000
5
0
1
0
python,multithreading
366,754
13
false
0
0
The only "safe" way to do this, in any language, is to use a secondary process to do that timeout-thing, otherwise you need to build your code in such a way that it will time out safely by itself, for instance by checking the time elapsed in a loop or similar. If changing the method isn't an option, a thread will not s...
1
90
0
There is a socket related function call in my code, that function is from another module thus out of my control, the problem is that it blocks for hours occasionally, which is totally unacceptable, How can I limit the function execution time from my code? I guess the solution must utilize another thread.
How to limit execution time of a function call?
0.076772
0
1
100,904
366,838
2008-12-14T18:48:00.000
0
0
0
0
python,django,localization,internationalization
367,026
10
false
1
0
It depends on who will provide the translations. If you want to provide a web interface to translation, then you need to develop that yourself, and also represent the translations in the database. If the same translators who translated the site will also translate the data, you can provide them with the same model that...
2
8
0
Hey, i am currently working on a django app for my studies, and came to the point of l18n. Localizing the site itself was very easy, but now i have to allow users, to translate the dynamic content of the application. Users can save "products" in the database and give them names and descriptions, but since the whole sit...
How to localize Content of a Django application
0
0
0
9,378
366,838
2008-12-14T18:48:00.000
0
0
0
0
python,django,localization,internationalization
3,870,634
10
false
1
0
I think you should operate in two steps: Get translations Show translated strings For the first step, you should tell Django that the user-inserted strings are to be translated. I think there is no native way to do so. Maybe you can extract the strings from your db putting them in locale-specific files, run 'makemess...
2
8
0
Hey, i am currently working on a django app for my studies, and came to the point of l18n. Localizing the site itself was very easy, but now i have to allow users, to translate the dynamic content of the application. Users can save "products" in the database and give them names and descriptions, but since the whole sit...
How to localize Content of a Django application
0
0
0
9,378
366,980
2008-12-14T21:00:00.000
17
1
1
0
python,perl,sed,awk,language-comparisons
367,082
5
false
0
0
First, there are two unrelated things in the list "Perl, Python awk and sed". Thing 1 - simplistic text manipulation tools. sed. It has a fixed, relatively simple scope of work defined by the idea of reading and examining each line of a file. sed is not designed to be particularly readable. It is designed to be ver...
4
274
0
What are the main differences among them? And in which typical scenarios is it better to use each language?
What are the differences between Perl, Python, AWK and sed?
1
0
0
86,075
366,980
2008-12-14T21:00:00.000
588
1
1
0
python,perl,sed,awk,language-comparisons
367,014
5
true
0
0
In order of appearance, the languages are sed, awk, perl, python. The sed program is a stream editor and is designed to apply the actions from a script to each line (or, more generally, to specified ranges of lines) of the input file or files. Its language is based on ed, the Unix editor, and although it has conditiona...
4
274
0
What are the main differences among them? And in which typical scenarios is it better to use each language?
What are the differences between Perl, Python, AWK and sed?
1.2
0
0
86,075
366,980
2008-12-14T21:00:00.000
100
1
1
0
python,perl,sed,awk,language-comparisons
2,905,791
5
false
0
0
After mastering a few dozen languages, you get tired of people like S. Lott (see his controversial answer to this question, nearly half as many down-votes as up (+45/-22) six years after answering). Sed is the best tool for extremely simple command-line pipelines. In the hands of a sed master, it's suitable for one-of...
4
274
0
What are the main differences among them? And in which typical scenarios is it better to use each language?
What are the differences between Perl, Python, AWK and sed?
1
0
0
86,075
366,980
2008-12-14T21:00:00.000
22
1
1
0
python,perl,sed,awk,language-comparisons
367,002
5
false
0
0
I wouldn't call sed a fully-fledged programming language, it is a stream editor with language constructs aimed at editing text files programmatically. Awk is a little more of a general purpose language but it is still best suited for text processing. Perl and Python are fully fledged, general purpose programming langua...
4
274
0
What are the main differences among them? And in which typical scenarios is it better to use each language?
What are the differences between Perl, Python, AWK and sed?
1
0
0
86,075
367,029
2008-12-14T21:45:00.000
1
0
0
0
python,google-app-engine,model,referenceproperty
367,334
3
false
1
0
I'm having similar difficulties for my project. As I code the beta version of my application, I do create a lot of dead link and its trully a pain to untangle things afterward. Ideally, this tool would have to also report of the offending reference so that you could pin-point problems in the code.
2
0
0
Most of the time, the errors you get from your model properties will happen when you're saving data. For instance, if you try saving a string as an IntegerProperty, that will result in an error. The one exception (no pun intended) is ReferenceProperty. If you have lots of references and you're not completely careful ab...
Deleting erroneous ReferenceProperty properties in AppEngine
0.066568
0
0
1,235
367,029
2008-12-14T21:45:00.000
0
0
0
0
python,google-app-engine,model,referenceproperty
374,241
3
false
1
0
You could extend and customize ReferenceProperty to not throw this exception, but then it'll need to return something - presumably None - in which case your template will simply throw an exception when it attempts to access properties on the returned object. A better approach is to fetch the referenceproperty and check...
2
0
0
Most of the time, the errors you get from your model properties will happen when you're saving data. For instance, if you try saving a string as an IntegerProperty, that will result in an error. The one exception (no pun intended) is ReferenceProperty. If you have lots of references and you're not completely careful ab...
Deleting erroneous ReferenceProperty properties in AppEngine
0
0
0
1,235
367,115
2008-12-14T22:57:00.000
10
1
1
0
python,perl,command-line,language-features
367,181
6
true
0
0
The command line usage from 'python -h' certainly strongly suggests there is no such equivalent. Perl tends to make extensive use of '$_' (your examples make implicit use of it), and I don't think Python supports any similar concept, thereby making Python equivalents of the Perl one-liners much harder.
1
17
0
I know of python -c '<code>', but I'm wondering if there's a more elegant python equivalent to perl -pi -e '<code>'. I still use it quite a bit for things like find and replace in a whole directory (perl -pi -e s/foo/bar/g * or even find . | xargs perl -pi -e s/foo/bar/g for sub-directories). I actually feel that that...
Is there a Python equivalent to `perl -pi -e`?
1.2
0
0
3,183
369,230
2008-12-15T18:12:00.000
0
0
0
0
python,xml,django,json,serialization
372,371
2
false
1
0
If your problem is just to serialze a ModelForm to json, just write your own simplejson serializer subclass.
1
2
0
I am using Django and the Google Web Toolkit (GWT) for my current project. I would like to pass a ModelForm instance to GWT via an Http response so that I can "chop" it up and render it as I please. My goal is to keep the form in sync with changes to my models.py file, yet increase control I have over the look of the f...
What is the best way to serialize a ModelForm object in Django?
0
0
0
2,670
369,305
2008-12-15T18:39:00.000
2
0
0
1
python,django,apache
392,945
1
false
1
0
This doesn't directly answer your question, but have you thought about using something like MacPorts for this sort of thing? If you're compiling a lot of software like this, MacPorts can really make your life easier, since building software and dependencies is practically automatic.
1
4
0
I'm working on a Django project that requires debugging on a multithreaded server. I've found mod_wsgi 2.0+ to be the easiest to work with, because of easy workarounds for python module reloading. Problem is can't get it to compile on Leopard. Is there anyone who has managed to do it so far, either for the builtin Apac...
Is there anyone who has managed to compile mod_wsgi for apache on Mac OS X Leopard?
0.379949
0
0
953
369,391
2008-12-15T19:12:00.000
-1
1
1
0
python,ruby,interpreter
12,280,987
6
false
0
0
There is pybasic (python basic), rockit-minibasic (rubybasic). To make these able to use the gui, then one has to develop extensions with kivy and shoes gui toolkits for pybasic and rockit-minibasic respectively and similarly prima gui for perlbasic if ever exists.
1
2
0
I want something simple in order to experiment/hack. I've created a lot interpreters/compilers for c and I just want something simple. A basic BASIC :D If you don't know any (I've done my google search...), yacc/bison is the only way? Thx
Is there an OpenSource BASIC interpreter in Ruby/Python?
-0.033321
0
0
2,470
370,680
2008-12-16T07:55:00.000
3
0
0
0
python,pygame,pyglet
2,477,829
5
false
0
1
Having looked at both pygame and pyglet I found pyglet easier to pick up and was able to write a simple breakout style game within a few days.
2
46
0
I've had some experience with Pygame, but there seems to be a lot of buzz around Pyglet these days. How do these two libraries compare? What would be the advantage of using one over the other, both in features and ease of use? Finally, would you say that one is more Pythonic than the other?
Differences between Python game libraries Pygame and Pyglet?
0.119427
0
0
24,875
370,680
2008-12-16T07:55:00.000
15
0
0
0
python,pygame,pyglet
4,520,448
5
false
0
1
Pyglet is good (for 2D games) if you never intend to draw any vector graphics or primitives within the game itself, and just stick to loading images from disk. It's also much cleaner because there's no need to write your own game loop and have to worry about speed and timing and responsiveness. However, if you ever hav...
2
46
0
I've had some experience with Pygame, but there seems to be a lot of buzz around Pyglet these days. How do these two libraries compare? What would be the advantage of using one over the other, both in features and ease of use? Finally, would you say that one is more Pythonic than the other?
Differences between Python game libraries Pygame and Pyglet?
1
0
0
24,875
372,042
2008-12-16T17:32:00.000
43
0
1
0
python,interface,abstract-class
16,447,106
8
false
0
0
In a more basic way to explain: An interface is sort of like an empty muffin pan. It's a class file with a set of method definitions that have no code. An abstract class is the same thing, but not all functions need to be empty. Some can have code. It's not strictly empty. Why differentiate: There's not much practical ...
2
612
0
What is the difference between abstract class and interface in Python?
Difference between abstract class and interface in Python
1
0
0
442,422