GUI and Desktop Applications
int64 0
1
| Data Science and Machine Learning
int64 0
1
| REVIEW
int64 0
1
| DISCREPANCY
int64 0
1
| ERRORS
int64 0
1
| Question
stringlengths 25
6.53k
| Q_Score
int64 0
3.67k
| Tags
stringlengths 6
90
| Web Development
int64 0
1
| Score
float64 -1
1.2
| API_USAGE
int64 1
1
| Answer
stringlengths 15
5.1k
| ViewCount
int64 15
3.72M
| Networking and APIs
int64 0
1
| Q_Id
int64 2.93k
49.7M
| API_CHANGE
int64 0
1
| AnswerCount
int64 1
42
| System Administration and DevOps
int64 0
1
| is_accepted
bool 2
classes | Other
int64 0
1
| CreationDate
stringlengths 23
23
| DOCUMENTATION
int64 0
1
| Title
stringlengths 11
148
| CONCEPTUAL
int64 0
1
| Python Basics and Environment
int64 0
1
| A_Id
int64 2.98k
72.5M
| Available Count
int64 1
17
| Users Score
int64 -10
437
| Database and SQL
int64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux.
The problem being I have no idea where to start or how to write a GUI with it, can anybody shed some light on this and point me in the right direction please? | 300 | python,user-interface,deployment,tkinter,release-management | 0 | 0.061461 | 1 | I'm not sure that this is the best way to do it, but when I'm deploying Ruby GUI apps (not Python, but has the same "problem" as far as .exe's are concerned) on Windows, I just write a short launcher in C# that calls on my main script. It compiles to an executable, and I then have an application executable. | 199,251 | 0 | 2,933 | 0 | 13 | 1 | false | 0 | 2008-08-05T22:26:00.000 | 0 | Create a directly-executable cross-platform GUI app using Python | 1 | 0 | 12,167 | 2 | 4 | 0 |
0 | 0 | 0 | 0 | 0 | Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux.
The problem being I have no idea where to start or how to write a GUI with it, can anybody shed some light on this and point me in the right direction please? | 300 | python,user-interface,deployment,tkinter,release-management | 0 | 1 | 1 | Since python is installed on nearly every non-Windows OS by default now, the only thing you really need to make sure of is that all of the non-standard libraries you use are installed.
Having said that, it is possible to build executables that include the python interpreter, and any libraries you use. This is likely to create a large executable, however.
MacOS X even includes support in the Xcode IDE for creating full standalone GUI apps. These can be run by any user running OS X. | 199,251 | 0 | 2,933 | 0 | 13 | 1 | false | 0 | 2008-08-05T22:26:00.000 | 0 | Create a directly-executable cross-platform GUI app using Python | 1 | 0 | 2,980 | 2 | 6 | 0 |
0 | 0 | 0 | 0 | 0 | I was wondering how as semantic service like Open Calais figures out the names of companies, or people, tech concepts, keywords, etc. from a piece of text. Is it because they have a large database that they match the text against?
How would a service like Zemanta know what images to suggest to a piece of text for instance? | 5 | python,ruby,semantics,zemanta | 1 | 0 | 1 | Open Calais probably use language parsing technology and language statics to guess which words or phrases are Names, Places, Companies, etc. Then, it is just another step to do some kind of search for those entities and return meta data.
Zementa probably does something similar, but matches the phrases against meta-data attached to images in order to acquire related results.
It certainly isn't easy. | 2,346 | 0 | 22,059 | 0 | 3 | 0 | false | 0 | 2008-08-22T10:51:00.000 | 0 | How do content discovery engines, like Zemanta and Open Calais work? | 0 | 0 | 23,041 | 1 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | I have a small utility that I use to download an MP3 file from a website on a schedule and then builds/updates a podcast XML file which I've added to iTunes.
The text processing that creates/updates the XML file is written in Python. However, I use wget inside a Windows .bat file to download the actual MP3 file. I would prefer to have the entire utility written in Python.
I struggled to find a way to actually download the file in Python, thus why I resorted to using wget.
So, how do I download the file using Python? | 1,032 | python,http,urllib | 0 | 1 | 1 | Following are the most commonly used calls for downloading files in python:
urllib.urlretrieve ('url_to_file', file_name)
urllib2.urlopen('url_to_file')
requests.get(url)
wget.download('url', file_name)
Note: urlopen and urlretrieve are found to perform relatively bad with downloading large files (size > 500 MB). requests.get stores the file in-memory until download is complete. | 1,341,778 | 1 | 22,676 | 0 | 27 | 0 | false | 0 | 2008-08-22T15:34:00.000 | 0 | How to download a file over HTTP? | 0 | 0 | 39,573,536 | 1 | 20 | 0 |
0 | 0 | 0 | 0 | 0 | How would you go about finding out how much memory is being used by an object? I know it is possible to find out how much is used by a block of code, but not by an instantiated object (anytime during its life), which is what I want. | 267 | python,performance,memory-profiling | 0 | 0.07983 | 1 | For big objects you may use a somewhat crude but effective method:
check how much memory your Python process occupies in the system, then delete the object and compare.
This method has many drawbacks but it will give you a very fast estimate for very big objects. | 222,118 | 0 | 33,978 | 0 | 5 | 0 | false | 0 | 2008-08-29T04:59:00.000 | 0 | Find out how much memory is being used by an object in Python | 1 | 1 | 24,495,011 | 1 | 2 | 0 |
0 | 0 | 0 | 0 | 0 | Can you please tell me how much is (-2) % 5?
According to my Python interpreter is 3, but do you have a wise explanation for this?
I've read that in some languages the result can be machine-dependent, but I'm not sure though. | 18 | python,math,modulo | 0 | 1.2 | 1 | By the way: most programming languages would disagree with Python and give the result -2. Depending on the interpretation of modulus this is correct. However, the most agreed-upon mathematical definition states that the modulus of a and b is the (strictly positive) rest r of the division of a / b. More precisely, 0 <= r < b by definition. | 11,706 | 0 | 43,775 | 0 | 12 | 0 | true | 0 | 2008-09-04T13:36:00.000 | 0 | Modulus operation with negatives values - weird thing? | 0 | 1 | 43,794 | 6 | 16 | 0 |
0 | 0 | 0 | 0 | 0 | Can you please tell me how much is (-2) % 5?
According to my Python interpreter is 3, but do you have a wise explanation for this?
I've read that in some languages the result can be machine-dependent, but I'm not sure though. | 18 | python,math,modulo | 0 | 1 | 1 | Your Python interpreter is correct.
One (stupid) way of calculating a modulus is to subtract or add the modulus until the resulting value is between 0 and (modulus − 1).
e.g.:
13 mod 5 = (13 − 5) mod 5 = (13 − 10) mod 5 = 3
or in your case: −2 mod 5 = (−2 + 5) mod 5 = 3 | 11,706 | 0 | 43,775 | 0 | 12 | 0 | false | 0 | 2008-09-04T13:36:00.000 | 0 | Modulus operation with negatives values - weird thing? | 0 | 1 | 43,780 | 6 | 14 | 0 |
0 | 0 | 0 | 0 | 0 | Can you please tell me how much is (-2) % 5?
According to my Python interpreter is 3, but do you have a wise explanation for this?
I've read that in some languages the result can be machine-dependent, but I'm not sure though. | 18 | python,math,modulo | 0 | 0 | 1 | Well, -2 divided by 5 would be 0 with a remainder of 3. I don't believe that should be very platform dependent, but I've seen stranger things. | 11,706 | 0 | 43,775 | 0 | 12 | 0 | false | 0 | 2008-09-04T13:36:00.000 | 0 | Modulus operation with negatives values - weird thing? | 0 | 1 | 43,781 | 6 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | Can you please tell me how much is (-2) % 5?
According to my Python interpreter is 3, but do you have a wise explanation for this?
I've read that in some languages the result can be machine-dependent, but I'm not sure though. | 18 | python,math,modulo | 0 | 0.066568 | 1 | Well, 0 % 5 should be 0, right?
-1 % 5 should be 4 because that's the next allowed digit going in the reverse direction (i.e., it can't be 5, since that's out of range).
And following along by that logic, -2 must be 3.
The easiest way to think of how it will work is that you keep adding or subtracting 5 until the number falls between 0 (inclusive) and 5 (exclusive).
I'm not sure about machine dependence - I've never seen an implementation that was, but I can't say it's never done. | 11,706 | 0 | 43,775 | 0 | 12 | 0 | false | 0 | 2008-09-04T13:36:00.000 | 0 | Modulus operation with negatives values - weird thing? | 0 | 1 | 43,785 | 6 | 4 | 0 |
0 | 0 | 0 | 0 | 0 | Can you please tell me how much is (-2) % 5?
According to my Python interpreter is 3, but do you have a wise explanation for this?
I've read that in some languages the result can be machine-dependent, but I'm not sure though. | 18 | python,math,modulo | 0 | 0 | 1 | The result depends on the language. Python returns the sign of the divisor, where for example c# returns the sign of the dividend (ie. -2 % 5 returns -2 in c#). | 11,706 | 0 | 43,775 | 0 | 12 | 0 | false | 0 | 2008-09-04T13:36:00.000 | 0 | Modulus operation with negatives values - weird thing? | 0 | 1 | 43,799 | 6 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | Can you please tell me how much is (-2) % 5?
According to my Python interpreter is 3, but do you have a wise explanation for this?
I've read that in some languages the result can be machine-dependent, but I'm not sure though. | 18 | python,math,modulo | 0 | 0 | 1 | There seems to be a common confusion between the terms "modulo" and "remainder".
In math, a remainder should always be defined consistent with the quotient, so that if a / b == c rem d then (c * b) + d == a. Depending on how you round your quotient, you get different remainders.
However, modulo should always give a result 0 <= r < divisor, which is only consistent with round-to-minus-infinity division if you allow negative integers. If division rounds towards zero (which is common), modulo and remainder are only equivalent for non-negative values.
Some languages (notably C and C++) don't define the required rounding/remainder behaviours and % is ambiguous. Many define rounding as towards zero, yet use the term modulo where remainder would be more correct. Python is relatively unusual in that it rounds to negative infinity, so modulo and remainder are equivalent.
Ada rounds towards zero IIRC, but has both mod and rem operators.
The C policy is intended to allow compilers to choose the most efficient implementation for the machine, but IMO is a false optimisation, at least these days. A good compiler will probably be able to use the equivalence for optimisation wherever a negative number cannot occur (and almost certainly if you use unsigned types). On the other hand, where negative numbers can occur, you almost certainly care about the details - for portability reasons you have to use very carefully designed overcomplex algorithms and/or checks to ensure that you get the results you want irrespective of the rounding and remainder behaviour.
In other words, the gain for this "optimisation" is mostly (if not always) an illusion, whereas there are very real costs in some cases - so it's a false optimisation. | 11,706 | 0 | 43,775 | 0 | 12 | 0 | false | 0 | 2008-09-04T13:36:00.000 | 0 | Modulus operation with negatives values - weird thing? | 0 | 1 | 5,203,460 | 6 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | My development shop has put together a fairly useful Python-based test suite, and we'd like to test some Linux-based C++ code with it. We've gotten the test project they ship with Boost to compile (type 'bjam' in the directory and it works), but we're having issues with our actual project.
Building the boost libraries and bjam from source (v1.35.0), when I run bjam I get a .so in the bin/gcc-4.1.2/debug directory. I run python and "import " and I get:
ImportError: libboost_python-gcc41-d-1_35.so.1.35.0: cannot open shared object file: No such file or directory
Looking in the library directory, I have the following:
libboost_python-gcc41-mt-1_35.so libboost_python-gcc41-mt-1_35.so.1.35.0 libboost_python-gcc41-mt.so
Obviously I need the -d instead of the -mt libraries, or to point at the -mt libraries instead of -d, but I can't figure out how to make my Jamroot file do that.
When I install Debian Etch's versions of the libraries, I get "No Jamfile in /usr/include" - and there's a debian bug that says they left out the system-level jamfile.
I'm more hopeful about getting it working from source, so if anyone has any suggestions to resolve the library issues, I'd like to hear them.
Response to answer 1: Thanks for the tip. So, do you know how I'd go about getting it to use the MT libraries instead? It appears to be more of a problem with bjam or the Jamfile I am using thinking I am in debug mode, even though I can't find any flags for that. While I know how to include specific libraries in a call to GCC, I don't see a way to configure that from the Boost end. | 3 | c++,boost-python | 0 | 0.132549 | 1 | Found the solution! Boost builds a debug build by default. Typing "bjam release" builds the release configuration. (This isn't listed in any documentation anywhere, as far as I can tell.) Note that this is not the same as changing your build-type to release, as that doesn't build a release configuration. Doing a 'complete' build as Torsten suggests also does not stop it from building only a debug version.
It's also worth noting that the -d libraries were in <boost-version>/bin.v2/libs/python/build/<gcc version>/debug/ and the release libraries were in <gcc-version>/release, and not installed into the top-level 'libs' directory.
Thanks for the other suggestions! | 3,149 | 0 | 67,015 | 0 | 3 | 0 | false | 1 | 2008-09-15T21:11:00.000 | 0 | Using boost-python with C++ in Linux | 0 | 0 | 93,027 | 2 | 2 | 0 |
0 | 0 | 0 | 1 | 0 | My development shop has put together a fairly useful Python-based test suite, and we'd like to test some Linux-based C++ code with it. We've gotten the test project they ship with Boost to compile (type 'bjam' in the directory and it works), but we're having issues with our actual project.
Building the boost libraries and bjam from source (v1.35.0), when I run bjam I get a .so in the bin/gcc-4.1.2/debug directory. I run python and "import " and I get:
ImportError: libboost_python-gcc41-d-1_35.so.1.35.0: cannot open shared object file: No such file or directory
Looking in the library directory, I have the following:
libboost_python-gcc41-mt-1_35.so libboost_python-gcc41-mt-1_35.so.1.35.0 libboost_python-gcc41-mt.so
Obviously I need the -d instead of the -mt libraries, or to point at the -mt libraries instead of -d, but I can't figure out how to make my Jamroot file do that.
When I install Debian Etch's versions of the libraries, I get "No Jamfile in /usr/include" - and there's a debian bug that says they left out the system-level jamfile.
I'm more hopeful about getting it working from source, so if anyone has any suggestions to resolve the library issues, I'd like to hear them.
Response to answer 1: Thanks for the tip. So, do you know how I'd go about getting it to use the MT libraries instead? It appears to be more of a problem with bjam or the Jamfile I am using thinking I am in debug mode, even though I can't find any flags for that. While I know how to include specific libraries in a call to GCC, I don't see a way to configure that from the Boost end. | 3 | c++,boost-python | 0 | 0.132549 | 1 | If you want to build the debug variants of the boost libraries as well, you have to invoke bjam with the option --build-type=complete.
On Debian, you get the debug Python interpreter in the python2.x-dbg packages. Debug builds of the Boost libraries are in libboost1.xy-dbg, if you want to use the system Boost. | 3,149 | 0 | 67,015 | 0 | 3 | 0 | false | 1 | 2008-09-15T21:11:00.000 | 0 | Using boost-python with C++ in Linux | 0 | 0 | 67,282 | 2 | 2 | 0 |
0 | 0 | 0 | 0 | 0 | My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible?
If it's not, how would you do it with POST? Just out of curiosity.
Cheers! | 1 | python,authentication,cgi | 0 | 0 | 1 | With a bit of JavaScript, you could have the client hash the entered password and a server-generated nonce, and use that in an HTTP GET. | 2,893 | 1 | 69,979 | 0 | 6 | 0 | false | 1 | 2008-09-16T07:07:00.000 | 0 | Can I implement a web user authentication system in python without POST? | 1 | 0 | 70,003 | 3 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible?
If it's not, how would you do it with POST? Just out of curiosity.
Cheers! | 1 | python,authentication,cgi | 0 | 1.2 | 1 | You can actually do it all with GET methods. However, you'll want to use a full challenge response protocol for the logins. (You can hash on the client side using javascript. You just need to send out a unique challenge each time.) You'll also want to use SSL to ensure that no one can see the strings as they go across.
In some senses there's no real security difference between GET and POST requests as they both go across in plaintext, in other senses and in practice... GET is are a hell of a lot easier to intercept and is all over most people's logs and your web browser's history. :)
(Or as suggested by the other posters, use a different method entirely like HTTP auth, digest auth or some higher level authentication scheme like AD, LDAP, kerberos or shib. However I kinda assumed that if you didn't have POST you wouldn't have these either.) | 2,893 | 1 | 69,979 | 0 | 6 | 0 | true | 1 | 2008-09-16T07:07:00.000 | 0 | Can I implement a web user authentication system in python without POST? | 1 | 0 | 69,995 | 3 | 5 | 0 |
0 | 0 | 0 | 0 | 0 | My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible?
If it's not, how would you do it with POST? Just out of curiosity.
Cheers! | 1 | python,authentication,cgi | 0 | 0.033321 | 1 | You could use HTTP Authentication, if supported.
You'd have to add SSL, as all methods, POST, GET and HTTP Auth (well, except Digest HHTP authentication) send plaintext.
GET is basically just like POST, it just has a limit on the amount of data you can send which is usually a lot smaller than POST and a semantic difference which makes GET not a good candidate from that point of view, even if technically they both can do it.
As for examples, what are you using? There are many choices in Python, like the cgi module or some framework like Django, CherryPy, and so on | 2,893 | 1 | 69,979 | 0 | 6 | 0 | false | 1 | 2008-09-16T07:07:00.000 | 0 | Can I implement a web user authentication system in python without POST? | 1 | 0 | 69,989 | 3 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | How do I have a Python script that a) can accept user input and how do I make it b) read in arguments if run from the command line? | 591 | python,input,command-line-arguments | 0 | 1 | 1 | Careful not to use the input function, unless you know what you're doing. Unlike raw_input, input will accept any python expression, so it's kinda like eval | 1,321,249 | 0 | 70,797 | 0 | 12 | 1 | false | 0 | 2008-09-16T09:44:00.000 | 0 | How to prompt for user input and read command-line arguments | 0 | 1 | 70,869 | 1 | 19 | 0 |
0 | 0 | 0 | 0 | 0 | The problem: I have a class which contains a template method execute which calls another method _execute. Subclasses are supposed to overwrite _execute to implement some specific functionality. This functionality should be documented in the docstring of _execute.
Advanced users can create their own subclasses to extend the library. However, another user dealing with such a subclass should only use execute, so he won't see the correct docstring if he uses help(execute).
Therefore it would be nice to modify the base class in such a way that in a subclass the docstring of execute is automatically replaced with that of _execute. Any ideas how this might be done?
I was thinking of metaclasses to do this, to make this completely transparent to the user. | 4 | python,metaclass | 1 | 0.039979 | 1 | Look at the functools.wraps() decorator; it does all of this, but I don't know offhand if you can get it to run in the right context | 2,897 | 0 | 71,817 | 0 | 5 | 0 | false | 0 | 2008-09-16T12:46:00.000 | 0 | Using the docstring from one method to automatically overwrite that of another method | 0 | 0 | 73,473 | 2 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | The problem: I have a class which contains a template method execute which calls another method _execute. Subclasses are supposed to overwrite _execute to implement some specific functionality. This functionality should be documented in the docstring of _execute.
Advanced users can create their own subclasses to extend the library. However, another user dealing with such a subclass should only use execute, so he won't see the correct docstring if he uses help(execute).
Therefore it would be nice to modify the base class in such a way that in a subclass the docstring of execute is automatically replaced with that of _execute. Any ideas how this might be done?
I was thinking of metaclasses to do this, to make this completely transparent to the user. | 4 | python,metaclass | 1 | 0 | 1 | Well the doc-string is stored in __doc__ so it wouldn't be too hard to re-assign it based on the doc-string of _execute after the fact.
Basically:
class MyClass(object):
def execute(self):
'''original doc-string'''
self._execute()
class SubClass(MyClass):
def _execute(self):
'''sub-class doc-string'''
pass
# re-assign doc-string of execute
def execute(self,*args,**kw):
return MyClass.execute(*args,**kw)
execute.__doc__=_execute.__doc__
Execute has to be re-declared to that the doc string gets attached to the version of execute for the SubClass and not for MyClass (which would otherwise interfere with other sub-classes).
That's not a very tidy way of doing it, but from the POV of the user of a library it should give the desired result. You could then wrap this up in a meta-class to make it easier for people who are sub-classing. | 2,897 | 0 | 71,817 | 0 | 5 | 0 | false | 0 | 2008-09-16T12:46:00.000 | 0 | Using the docstring from one method to automatically overwrite that of another method | 0 | 0 | 72,126 | 2 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I have to know how it's made. If I see a Ruby DSL or some Ruby voodoo, I'm hooked on Ruby for a while.
Right now I'm working as a Java developer, but plan on taking CEH in the near future. My question is: for tool writing and exploit development, which language do you find to be the most appropriate?
Again, I don't want to cause a flame-war or any trouble, I just want honest opinions from scripters that know what they're doing.
One more thing: maybe some of you will ask "Why settle on one language?". To answer this: I would like to choose only one language, in order to try to master it. | 6 | python,ruby,perl,security,penetration-testing | 0 | 0.049958 | 1 | That depends on the implementation, if it will be distributed I would go with Java, seeing as you know that, because of its portability. If it is just for internal use, or will be used in semi-controlled environments, then go with whatever you are the most comfortable maintaining, and whichever has the best long-term outlook.
Now to just answer the question, I would go with Perl, but I'm a linux guy so I may be a bit biased in this. | 6,338 | 0 | 76,408 | 0 | 12 | 0 | false | 1 | 2008-09-16T20:11:00.000 | 0 | Which of these scripting languages is more appropriate for pen-testing? | 0 | 0 | 76,441 | 7 | 3 | 0 |
0 | 0 | 0 | 1 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I have to know how it's made. If I see a Ruby DSL or some Ruby voodoo, I'm hooked on Ruby for a while.
Right now I'm working as a Java developer, but plan on taking CEH in the near future. My question is: for tool writing and exploit development, which language do you find to be the most appropriate?
Again, I don't want to cause a flame-war or any trouble, I just want honest opinions from scripters that know what they're doing.
One more thing: maybe some of you will ask "Why settle on one language?". To answer this: I would like to choose only one language, in order to try to master it. | 6 | python,ruby,perl,security,penetration-testing | 0 | 0 | 1 | Well, what kind of exploits are you thinking about? If you want to write something that needs low level stuff (ptrace, raw sockets, etc.) then you'll need to learn C. But both Perl and Python can be used. The real question is which one suits your style more?
As for toolmaking, Perl has good string-processing abilities, is closer to the system, has good support, but IMHO it's very confusing. I prefer Python: it's a clean, easy to use, easy to learn language with good support (complete language/lib reference, 3rd party libs, etc.). And it's (strictly IMHO) cool. | 6,338 | 0 | 76,408 | 0 | 12 | 0 | false | 1 | 2008-09-16T20:11:00.000 | 0 | Which of these scripting languages is more appropriate for pen-testing? | 0 | 0 | 76,470 | 7 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I have to know how it's made. If I see a Ruby DSL or some Ruby voodoo, I'm hooked on Ruby for a while.
Right now I'm working as a Java developer, but plan on taking CEH in the near future. My question is: for tool writing and exploit development, which language do you find to be the most appropriate?
Again, I don't want to cause a flame-war or any trouble, I just want honest opinions from scripters that know what they're doing.
One more thing: maybe some of you will ask "Why settle on one language?". To answer this: I would like to choose only one language, in order to try to master it. | 6 | python,ruby,perl,security,penetration-testing | 0 | 0.016665 | 1 | All of them should be sufficient for that. Unless you need some library that is only available in one language, I'd let personal preference guide me. | 6,338 | 0 | 76,408 | 0 | 12 | 0 | false | 1 | 2008-09-16T20:11:00.000 | 0 | Which of these scripting languages is more appropriate for pen-testing? | 0 | 0 | 76,495 | 7 | 1 | 0 |
0 | 0 | 0 | 1 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I have to know how it's made. If I see a Ruby DSL or some Ruby voodoo, I'm hooked on Ruby for a while.
Right now I'm working as a Java developer, but plan on taking CEH in the near future. My question is: for tool writing and exploit development, which language do you find to be the most appropriate?
Again, I don't want to cause a flame-war or any trouble, I just want honest opinions from scripters that know what they're doing.
One more thing: maybe some of you will ask "Why settle on one language?". To answer this: I would like to choose only one language, in order to try to master it. | 6 | python,ruby,perl,security,penetration-testing | 0 | 0.016665 | 1 | If you're looking for a scripting language that will play well with Java, you might want to look at Groovy. It has the flexibility and power of Perl (closures, built in regexes, associative arrays on every corner) but you can access Java code from it thus you have access to a huge number of libraries, and in particular the rest of the system you're developing. | 6,338 | 0 | 76,408 | 0 | 12 | 0 | false | 1 | 2008-09-16T20:11:00.000 | 0 | Which of these scripting languages is more appropriate for pen-testing? | 0 | 0 | 76,508 | 7 | 1 | 0 |
0 | 0 | 0 | 1 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I have to know how it's made. If I see a Ruby DSL or some Ruby voodoo, I'm hooked on Ruby for a while.
Right now I'm working as a Java developer, but plan on taking CEH in the near future. My question is: for tool writing and exploit development, which language do you find to be the most appropriate?
Again, I don't want to cause a flame-war or any trouble, I just want honest opinions from scripters that know what they're doing.
One more thing: maybe some of you will ask "Why settle on one language?". To answer this: I would like to choose only one language, in order to try to master it. | 6 | python,ruby,perl,security,penetration-testing | 0 | 0.049958 | 1 | If you plan on using Metasploit for pen-testing and exploit development I would recommend ruby as mentioned previously Metasploit is written in ruby and any exploit/module development you may wish to do will require ruby.
If you will be using Immunity CANVAS for pen testing then for the same reasons I would recommend Python as CANVAS is written in python. Also allot of fuzzing frameworks like Peach and Sulley are written in Python.
I would not recommend Perl as you will find very little tools/scripts/frameworks related to pen testing/fuzzing/exploits/... in Perl.
As your question is "tool writing and exploit development" I would recommend Ruby if you choose Metasploit or python if you choose CANVAS.
hope that helps :) | 6,338 | 0 | 76,408 | 0 | 12 | 0 | false | 1 | 2008-09-16T20:11:00.000 | 0 | Which of these scripting languages is more appropriate for pen-testing? | 0 | 0 | 78,106 | 7 | 3 | 0 |
0 | 0 | 0 | 1 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I have to know how it's made. If I see a Ruby DSL or some Ruby voodoo, I'm hooked on Ruby for a while.
Right now I'm working as a Java developer, but plan on taking CEH in the near future. My question is: for tool writing and exploit development, which language do you find to be the most appropriate?
Again, I don't want to cause a flame-war or any trouble, I just want honest opinions from scripters that know what they're doing.
One more thing: maybe some of you will ask "Why settle on one language?". To answer this: I would like to choose only one language, in order to try to master it. | 6 | python,ruby,perl,security,penetration-testing | 0 | 0 | 1 | I'm with tqbf. I've worked with Python and Ruby. Currently I'm working with JRuby. It has all the power of Ruby with access to the Java libraries so if there is something you absolutely need a low-level language to solve you can do so with a high-level language. So far I haven't needed to really use much Java as Ruby has had the ability to do everything I've needed as an API tester. | 6,338 | 0 | 76,408 | 0 | 12 | 0 | false | 1 | 2008-09-16T20:11:00.000 | 0 | Which of these scripting languages is more appropriate for pen-testing? | 0 | 0 | 4,927,367 | 7 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I have to know how it's made. If I see a Ruby DSL or some Ruby voodoo, I'm hooked on Ruby for a while.
Right now I'm working as a Java developer, but plan on taking CEH in the near future. My question is: for tool writing and exploit development, which language do you find to be the most appropriate?
Again, I don't want to cause a flame-war or any trouble, I just want honest opinions from scripters that know what they're doing.
One more thing: maybe some of you will ask "Why settle on one language?". To answer this: I would like to choose only one language, in order to try to master it. | 6 | python,ruby,perl,security,penetration-testing | 0 | 1 | 1 | [Disclaimer: I am primarily a Perl programmer, which may be colouring my judgement. However, I am not a particularly tribal one, and I think on this particular question my argument is reasonably objective.]
Perl was designed to blend seamlessly into the Unix landscape, and that is why it feels so alien to people with a mainly-OO background (particularly the Java school of OOP). For that reason, though, it’s incredibly widely installed on machines with any kind of Unixoid OS, and many vendor system utilities are written in it. Also for the same reason, servers that have neither Python nor Ruby installed are still likely to have Perl on them, again making it important to have some familiarity with. So if your CEH activity includes extensive activity on Unix, you will have to have some amount of familiarity with Perl anyway, and you might as well focus on it.
That said, it is largely a matter of preference. There is not much to differentiate the languages; their expressive power is virtually identical. Some things are a little easier in one of the languages, some a little easier in another.
In terms of libraries I do not know how Ruby and Python compare against each other – I do know that Perl has them beat by a margin. Then again, sometimes (particularly when you’re looking for libraries for common needs) the only effect of that is that you get deluged with choices. And if you are only looking to do things in some particular area which is well covered by libraries for Python or Ruby, the mass of other stuff on CPAN isn’t necessarily an advantage. In niche areas, however, it matters, and you never know what unforeseen need you will eventually have (err, by definition).
For one-liner use on the command line, Python is kind of a non-starter.
In terms of interactive interpreter environment, Perl… uhm… well, you can use the debugger, which is not that great, or you can install one from CPAN, but Perl doesn’t ship a good one itself.
So I think Perl does have a very slight edge for your needs in particular, but only just. If you pick Ruby you’ll probably not be much worse off at all. Python might inconvenience you a little more noticeably, but it too is hardly a bad choice. | 6,338 | 0 | 76,408 | 0 | 12 | 0 | false | 1 | 2008-09-16T20:11:00.000 | 0 | Which of these scripting languages is more appropriate for pen-testing? | 0 | 0 | 77,717 | 7 | 8 | 0 |
0 | 0 | 0 | 0 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons was faster than php, I could maybe, hopefully, eventually convince my employer to allow me to convert the site over to pylons. | 41 | php,python,performance,pylons | 0 | 1 | 1 | I would assume that PHP (>5.5) is faster and more reliable for complex web applications because it is optimized for website scripting.
Many of the benchmarks you will find at the net are only made to prove that the favoured language is better. But you can not compare 2 languages with a mathematical task running X-times. For a real benchmark you need two comparable frameworks with hundreds of classes/files an a web application running 100 clients at once. | 58,657 | 0 | 77,086 | 0 | 10 | 0 | false | 1 | 2008-09-16T21:05:00.000 | 0 | Which is faster, python webpages or php webpages? | 0 | 0 | 33,627,050 | 9 | 7 | 0 |
0 | 0 | 0 | 0 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons was faster than php, I could maybe, hopefully, eventually convince my employer to allow me to convert the site over to pylons. | 41 | php,python,performance,pylons | 0 | 0.019997 | 1 | If it ain't broke don't fix it.
Just write a quick test, but bear in mind that each language will be faster with certain functions then the other. | 58,657 | 0 | 77,086 | 0 | 10 | 0 | false | 1 | 2008-09-16T21:05:00.000 | 0 | Which is faster, python webpages or php webpages? | 0 | 0 | 77,093 | 9 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons was faster than php, I could maybe, hopefully, eventually convince my employer to allow me to convert the site over to pylons. | 41 | php,python,performance,pylons | 0 | 0.019997 | 1 | You need to be able to make a business case for switching, not just that "it's faster". If a site built on technology B costs 20% more in developer time for maintenance over a set period (say, 3 years), it would likely be cheaper to add another webserver to the system running technology A to bridge the performance gap.
Just saying "we should switch to technology B because technology B is faster!" doesn't really work.
Since Python is far less ubiquitous than PHP, I wouldn't be surprised if hosting, developer, and other maintenance costs for it (long term) would have it fit this scenario. | 58,657 | 0 | 77,086 | 0 | 10 | 0 | false | 1 | 2008-09-16T21:05:00.000 | 0 | Which is faster, python webpages or php webpages? | 0 | 0 | 77,166 | 9 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons was faster than php, I could maybe, hopefully, eventually convince my employer to allow me to convert the site over to pylons. | 41 | php,python,performance,pylons | 0 | 1 | 1 | There's no point in attempting to convince your employer to port from PHP to Python, especially not for an existing system, which is what I think you implied in your question.
The reason for this is that you already have a (presumably) working system, with an existing investment of time and effort (and experience). To discard this in favour of a trivial performance gain (not that I'm claiming there would be one) would be foolish, and no manager worth his salt ought to endorse it.
It may also create a problem with maintainability, depending on who else has to work with the system, and their experience with Python. | 58,657 | 0 | 77,086 | 0 | 10 | 0 | false | 1 | 2008-09-16T21:05:00.000 | 0 | Which is faster, python webpages or php webpages? | 0 | 0 | 77,297 | 9 | 30 | 0 |
0 | 0 | 0 | 0 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons was faster than php, I could maybe, hopefully, eventually convince my employer to allow me to convert the site over to pylons. | 41 | php,python,performance,pylons | 0 | 0 | 1 | The only right answer is "It depends". There's a lot of variables that can affect the performance, and you can optimize many things in either situation. | 58,657 | 0 | 77,086 | 0 | 10 | 0 | false | 1 | 2008-09-16T21:05:00.000 | 0 | Which is faster, python webpages or php webpages? | 0 | 0 | 77,112 | 9 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons was faster than php, I could maybe, hopefully, eventually convince my employer to allow me to convert the site over to pylons. | 41 | php,python,performance,pylons | 0 | 0.039979 | 1 | PHP and Python are similiar enough to not warrent any kind of switching.
Any performance improvement you might get from switching from one language to another would be vastly outgunned by simply not spending the money on converting the code (you don't code for free right?) and just buy more hardware. | 58,657 | 0 | 77,086 | 0 | 10 | 0 | false | 1 | 2008-09-16T21:05:00.000 | 0 | Which is faster, python webpages or php webpages? | 0 | 0 | 77,220 | 9 | 2 | 0 |
0 | 0 | 0 | 0 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons was faster than php, I could maybe, hopefully, eventually convince my employer to allow me to convert the site over to pylons. | 41 | php,python,performance,pylons | 0 | 0.019997 | 1 | an IS organization would not ponder this unless availability was becoming an issue.
if so the case, look into replication, load balancing and lots of ram. | 58,657 | 0 | 77,086 | 0 | 10 | 0 | false | 1 | 2008-09-16T21:05:00.000 | 0 | Which is faster, python webpages or php webpages? | 0 | 0 | 510,276 | 9 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons was faster than php, I could maybe, hopefully, eventually convince my employer to allow me to convert the site over to pylons. | 41 | php,python,performance,pylons | 0 | -0.019997 | 1 | I had to come back to web development at my new job, and, if not Pylons/Python, maybe I would have chosen to live in jungle instead :) In my subjective opinion, PHP is for kindergarten, I did it in my 3rd year of uni and, I believe, many self-respecting (or over-estimating) software engineers will not want to be bothered with PHP code.
Why my employers agreed? We (the team) just switched to Python, and they did not have much to say. The website still is and will be PHP, but we are developing other applications, including web, in Python. Advantages of Pylons? You can integrate your python libraries into the web app, and that is, imho, a huge advantage.
As for performance, we are still having troubles. | 58,657 | 0 | 77,086 | 0 | 10 | 0 | false | 1 | 2008-09-16T21:05:00.000 | 0 | Which is faster, python webpages or php webpages? | 0 | 0 | 2,412,215 | 9 | -1 | 0 |
0 | 0 | 0 | 0 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons was faster than php, I could maybe, hopefully, eventually convince my employer to allow me to convert the site over to pylons. | 41 | php,python,performance,pylons | 0 | 0.039979 | 1 | It's about the same. The difference shouldn't be large enough to be the reason to pick one or the other. Don't try to compare them by writing your own tiny benchmarks ("hello world") because you will probably not have results that are representative of a real web site generating a more complex page. | 58,657 | 0 | 77,086 | 0 | 10 | 0 | false | 1 | 2008-09-16T21:05:00.000 | 0 | Which is faster, python webpages or php webpages? | 0 | 0 | 77,174 | 9 | 2 | 0 |
0 | 0 | 0 | 0 | 0 | I'd like to search for a given MAC address on my network, all from within a Python script. I already have a map of all the active IP addresses in the network but I cannot figure out how to glean the MAC address. Any ideas? | 9 | python,network-programming | 0 | 0.024995 | 1 | I don't think there is a built in way to get it from Python itself.
My question is, how are you getting the IP information from your network?
To get it from your local machine you could parse ifconfig (unix) or ipconfig (windows) with little difficulty. | 16,340 | 1 | 85,577 | 0 | 8 | 1 | false | 0 | 2008-09-17T17:23:00.000 | 0 | Search for host with MAC-address using Python | 0 | 0 | 85,608 | 4 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | I'd like to search for a given MAC address on my network, all from within a Python script. I already have a map of all the active IP addresses in the network but I cannot figure out how to glean the MAC address. Any ideas? | 9 | python,network-programming | 0 | 0 | 1 | You would want to parse the output of 'arp', but the kernel ARP cache will only contain those IP address(es) if those hosts have communicated with the host where the Python script is running.
ifconfig can be used to display the MAC addresses of local interfaces, but not those on the LAN. | 16,340 | 1 | 85,577 | 0 | 8 | 1 | false | 0 | 2008-09-17T17:23:00.000 | 0 | Search for host with MAC-address using Python | 0 | 0 | 85,641 | 4 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | I'd like to search for a given MAC address on my network, all from within a Python script. I already have a map of all the active IP addresses in the network but I cannot figure out how to glean the MAC address. Any ideas? | 9 | python,network-programming | 0 | 0.024995 | 1 | It seems that there is not a native way of doing this with Python. Your best bet would be to parse the output of "ipconfig /all" on Windows, or "ifconfig" on Linux. Consider using os.popen() with some regexps. | 16,340 | 1 | 85,577 | 0 | 8 | 1 | false | 0 | 2008-09-17T17:23:00.000 | 0 | Search for host with MAC-address using Python | 0 | 0 | 85,634 | 4 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | I'd like to search for a given MAC address on my network, all from within a Python script. I already have a map of all the active IP addresses in the network but I cannot figure out how to glean the MAC address. Any ideas? | 9 | python,network-programming | 0 | 0 | 1 | Depends on your platform. If you're using *nix, you can use the 'arp' command to look up the mac address for a given IP (assuming IPv4) address. If that doesn't work, you could ping the address and then look, or if you have access to the raw network (using BPF or some other mechanism), you could send your own ARP packets (but that is probably overkill). | 16,340 | 1 | 85,577 | 0 | 8 | 1 | false | 0 | 2008-09-17T17:23:00.000 | 0 | Search for host with MAC-address using Python | 0 | 0 | 85,620 | 4 | 0 | 0 |
0 | 0 | 1 | 0 | 0 | We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that is all over the place, and cannot do it, in a reasonable manner, with the current technology. The big missing features are proper dispatching and templating with inheritance, amongst others.
Currently there are two paths being discussed:
Port the existing application to Classic ASP using JScript, which will allow us to hopefully go from there to .NET MSJscript without too much trouble, and eventually end up on the .NET platform (preferably the MVC stuff will be done by then, ASP.NET isn't much better than were we are on now, in our opinions). This has been argued as the safer path with less risk than the next option, albeit it might take slightly longer.
Completely rewrite the application using some other technology, right now the leader of the pack is Python WSGI with a custom framework, ORM, and a good templating solution. There is wiggle room here for even django and other pre-built solutions. This method would hopefully be the quickest solution, as we would probably run a beta beside the actual product, but it does have the potential for a big waste of time if we can't/don't get it right.
This does not mean that our logic is gone, as what we have built over the years is fairly stable, as noted just difficult to deal with. It is built on SQL Server 2005 with heavy use of stored procedures and published on IIS 6, just for a little more background.
Now, the question. Has anyone taken either of the two paths above? If so, was it successful, how could it have been better, etc. We aren't looking to deviate much from doing one of those two things, but some suggestions or other solutions would potentially be helpful. | 3 | python,asp-classic,vbscript | 1 | 0.022219 | 1 | Half a year ago I took over a large web application (fortunately already in Python) which had some major architectural deficiencies (templates and code mixed, code duplication, you name it...).
My plan is to eventually have the system respond to WSGI, but I am not there yet. I found the best way to do it, is in small steps. Over the last 6 month, code reuse has gone up and progress has accelerated.
General principles which have worked for me:
Throw away code which is not used or commented out
Throw away all comments which are not useful
Define a layer hierarchy (models, business logic, view/controller logic, display logic, etc.) of your application. This has not to be very clear cut architecture but rather should help you think about the various parts of your application and help you better categorize your code.
If something grossly violates this hierarchy, change the offending code. Move the code around, recode it at another place, etc. At the same time adjust the rest of your application to use this code instead of the old one. Throw the old one away if not used anymore.
Keep you APIs simple!
Progress can be painstakingly slow, but should be worth it. | 406 | 0 | 87,522 | 0 | 9 | 0 | false | 0 | 2008-09-17T20:48:00.000 | 0 | If it is decided that our system needs an overhaul, what is the best way to go about it? | 0 | 0 | 101,074 | 7 | 1 | 0 |
0 | 0 | 1 | 0 | 0 | We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that is all over the place, and cannot do it, in a reasonable manner, with the current technology. The big missing features are proper dispatching and templating with inheritance, amongst others.
Currently there are two paths being discussed:
Port the existing application to Classic ASP using JScript, which will allow us to hopefully go from there to .NET MSJscript without too much trouble, and eventually end up on the .NET platform (preferably the MVC stuff will be done by then, ASP.NET isn't much better than were we are on now, in our opinions). This has been argued as the safer path with less risk than the next option, albeit it might take slightly longer.
Completely rewrite the application using some other technology, right now the leader of the pack is Python WSGI with a custom framework, ORM, and a good templating solution. There is wiggle room here for even django and other pre-built solutions. This method would hopefully be the quickest solution, as we would probably run a beta beside the actual product, but it does have the potential for a big waste of time if we can't/don't get it right.
This does not mean that our logic is gone, as what we have built over the years is fairly stable, as noted just difficult to deal with. It is built on SQL Server 2005 with heavy use of stored procedures and published on IIS 6, just for a little more background.
Now, the question. Has anyone taken either of the two paths above? If so, was it successful, how could it have been better, etc. We aren't looking to deviate much from doing one of those two things, but some suggestions or other solutions would potentially be helpful. | 3 | python,asp-classic,vbscript | 1 | 0 | 1 | Don't try and go 2.0 ( more features then currently exists or scheduled) instead build your new platform with the intent of resolving the current issues with the code base (maintainability/speed/wtf) and go from there. | 406 | 0 | 87,522 | 0 | 9 | 0 | false | 0 | 2008-09-17T20:48:00.000 | 0 | If it is decided that our system needs an overhaul, what is the best way to go about it? | 0 | 0 | 89,452 | 7 | 0 | 0 |
0 | 0 | 1 | 0 | 0 | We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that is all over the place, and cannot do it, in a reasonable manner, with the current technology. The big missing features are proper dispatching and templating with inheritance, amongst others.
Currently there are two paths being discussed:
Port the existing application to Classic ASP using JScript, which will allow us to hopefully go from there to .NET MSJscript without too much trouble, and eventually end up on the .NET platform (preferably the MVC stuff will be done by then, ASP.NET isn't much better than were we are on now, in our opinions). This has been argued as the safer path with less risk than the next option, albeit it might take slightly longer.
Completely rewrite the application using some other technology, right now the leader of the pack is Python WSGI with a custom framework, ORM, and a good templating solution. There is wiggle room here for even django and other pre-built solutions. This method would hopefully be the quickest solution, as we would probably run a beta beside the actual product, but it does have the potential for a big waste of time if we can't/don't get it right.
This does not mean that our logic is gone, as what we have built over the years is fairly stable, as noted just difficult to deal with. It is built on SQL Server 2005 with heavy use of stored procedures and published on IIS 6, just for a little more background.
Now, the question. Has anyone taken either of the two paths above? If so, was it successful, how could it have been better, etc. We aren't looking to deviate much from doing one of those two things, but some suggestions or other solutions would potentially be helpful. | 3 | python,asp-classic,vbscript | 1 | 0.044415 | 1 | Whatever you do, see if you can manage to follow a plan where you do not have to port the application all in one big bang. It is tempting to throw it all away and start from scratch, but if you can manage to do it gradually the mistakes you do will not cost so much and cause so much panic. | 406 | 0 | 87,522 | 0 | 9 | 0 | false | 0 | 2008-09-17T20:48:00.000 | 0 | If it is decided that our system needs an overhaul, what is the best way to go about it? | 0 | 0 | 87,684 | 7 | 2 | 0 |
0 | 0 | 1 | 0 | 0 | We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that is all over the place, and cannot do it, in a reasonable manner, with the current technology. The big missing features are proper dispatching and templating with inheritance, amongst others.
Currently there are two paths being discussed:
Port the existing application to Classic ASP using JScript, which will allow us to hopefully go from there to .NET MSJscript without too much trouble, and eventually end up on the .NET platform (preferably the MVC stuff will be done by then, ASP.NET isn't much better than were we are on now, in our opinions). This has been argued as the safer path with less risk than the next option, albeit it might take slightly longer.
Completely rewrite the application using some other technology, right now the leader of the pack is Python WSGI with a custom framework, ORM, and a good templating solution. There is wiggle room here for even django and other pre-built solutions. This method would hopefully be the quickest solution, as we would probably run a beta beside the actual product, but it does have the potential for a big waste of time if we can't/don't get it right.
This does not mean that our logic is gone, as what we have built over the years is fairly stable, as noted just difficult to deal with. It is built on SQL Server 2005 with heavy use of stored procedures and published on IIS 6, just for a little more background.
Now, the question. Has anyone taken either of the two paths above? If so, was it successful, how could it have been better, etc. We aren't looking to deviate much from doing one of those two things, but some suggestions or other solutions would potentially be helpful. | 3 | python,asp-classic,vbscript | 1 | 0 | 1 | I agree with Michael Pryor and Joel that it's almost always a better idea to continue evolving your existing code base rather than re-writing from scratch. There are typically opportunities to just re-write or re-factor certain components for performance or flexibility. | 406 | 0 | 87,522 | 0 | 9 | 0 | false | 0 | 2008-09-17T20:48:00.000 | 0 | If it is decided that our system needs an overhaul, what is the best way to go about it? | 0 | 0 | 994,326 | 7 | 0 | 0 |
0 | 0 | 1 | 0 | 0 | We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that is all over the place, and cannot do it, in a reasonable manner, with the current technology. The big missing features are proper dispatching and templating with inheritance, amongst others.
Currently there are two paths being discussed:
Port the existing application to Classic ASP using JScript, which will allow us to hopefully go from there to .NET MSJscript without too much trouble, and eventually end up on the .NET platform (preferably the MVC stuff will be done by then, ASP.NET isn't much better than were we are on now, in our opinions). This has been argued as the safer path with less risk than the next option, albeit it might take slightly longer.
Completely rewrite the application using some other technology, right now the leader of the pack is Python WSGI with a custom framework, ORM, and a good templating solution. There is wiggle room here for even django and other pre-built solutions. This method would hopefully be the quickest solution, as we would probably run a beta beside the actual product, but it does have the potential for a big waste of time if we can't/don't get it right.
This does not mean that our logic is gone, as what we have built over the years is fairly stable, as noted just difficult to deal with. It is built on SQL Server 2005 with heavy use of stored procedures and published on IIS 6, just for a little more background.
Now, the question. Has anyone taken either of the two paths above? If so, was it successful, how could it have been better, etc. We aren't looking to deviate much from doing one of those two things, but some suggestions or other solutions would potentially be helpful. | 3 | python,asp-classic,vbscript | 1 | 0.066568 | 1 | Use this as an opportunity to remove unused features! Definitely go with the new language. Call it 2.0. It will be a lot less work to rebuild the 80% of it that you really need.
Start by wiping your brain clean of the whole application. Sit down with a list of its overall goals, then decide which features are needed based on which ones are used. Then redesign it with those features in mind, and build.
(I love to delete code.) | 406 | 0 | 87,522 | 0 | 9 | 0 | false | 0 | 2008-09-17T20:48:00.000 | 0 | If it is decided that our system needs an overhaul, what is the best way to go about it? | 0 | 0 | 87,562 | 7 | 3 | 0 |
0 | 0 | 1 | 0 | 0 | We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that is all over the place, and cannot do it, in a reasonable manner, with the current technology. The big missing features are proper dispatching and templating with inheritance, amongst others.
Currently there are two paths being discussed:
Port the existing application to Classic ASP using JScript, which will allow us to hopefully go from there to .NET MSJscript without too much trouble, and eventually end up on the .NET platform (preferably the MVC stuff will be done by then, ASP.NET isn't much better than were we are on now, in our opinions). This has been argued as the safer path with less risk than the next option, albeit it might take slightly longer.
Completely rewrite the application using some other technology, right now the leader of the pack is Python WSGI with a custom framework, ORM, and a good templating solution. There is wiggle room here for even django and other pre-built solutions. This method would hopefully be the quickest solution, as we would probably run a beta beside the actual product, but it does have the potential for a big waste of time if we can't/don't get it right.
This does not mean that our logic is gone, as what we have built over the years is fairly stable, as noted just difficult to deal with. It is built on SQL Server 2005 with heavy use of stored procedures and published on IIS 6, just for a little more background.
Now, the question. Has anyone taken either of the two paths above? If so, was it successful, how could it have been better, etc. We aren't looking to deviate much from doing one of those two things, but some suggestions or other solutions would potentially be helpful. | 3 | python,asp-classic,vbscript | 1 | 0.066568 | 1 | It works out better than you'd believe.
Recently I did a large reverse-engineering job on a hideous old collection of C code. Function by function I reallocated the features that were still relevant into classes, wrote unit tests for the classes, and built up what looked like a replacement application. It had some of the original "logic flow" through the classes, and some classes were poorly designed [Mostly this was because of a subset of the global variables that was too hard to tease apart.]
It passed unit tests at the class level and at the overall application level. The legacy source was mostly used as a kind of "specification in C" to ferret out the really obscure business rules.
Last year, I wrote a project plan for replacing 30-year old COBOL. The customer was leaning toward Java. I prototyped the revised data model in Python using Django as part of the planning effort. I could demo the core transactions before I was done planning.
Note: It was quicker to build a the model and admin interface in Django than to plan the project as a whole.
Because of the "we need to use Java" mentality, the resulting project will be larger and more expensive than finishing the Django demo. With no real value to balance that cost.
Also, I did the same basic "prototype in Django" for a VB desktop application that needed to become a web application. I built the model in Django, loaded legacy data, and was up and running in a few weeks. I used that working prototype to specify the rest of the conversion effort.
Note: I had a working Django implementation (model and admin pages only) that I used to plan the rest of the effort.
The best part about doing this kind of prototyping in Django is that you can mess around with the model, unit tests and admin pages until you get it right. Once the model's right, you can spend the rest of your time fiddling around with the user interface until everyone's happy. | 406 | 0 | 87,522 | 0 | 9 | 0 | false | 0 | 2008-09-17T20:48:00.000 | 0 | If it is decided that our system needs an overhaul, what is the best way to go about it? | 0 | 0 | 87,998 | 7 | 3 | 0 |
0 | 0 | 1 | 0 | 0 | We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that is all over the place, and cannot do it, in a reasonable manner, with the current technology. The big missing features are proper dispatching and templating with inheritance, amongst others.
Currently there are two paths being discussed:
Port the existing application to Classic ASP using JScript, which will allow us to hopefully go from there to .NET MSJscript without too much trouble, and eventually end up on the .NET platform (preferably the MVC stuff will be done by then, ASP.NET isn't much better than were we are on now, in our opinions). This has been argued as the safer path with less risk than the next option, albeit it might take slightly longer.
Completely rewrite the application using some other technology, right now the leader of the pack is Python WSGI with a custom framework, ORM, and a good templating solution. There is wiggle room here for even django and other pre-built solutions. This method would hopefully be the quickest solution, as we would probably run a beta beside the actual product, but it does have the potential for a big waste of time if we can't/don't get it right.
This does not mean that our logic is gone, as what we have built over the years is fairly stable, as noted just difficult to deal with. It is built on SQL Server 2005 with heavy use of stored procedures and published on IIS 6, just for a little more background.
Now, the question. Has anyone taken either of the two paths above? If so, was it successful, how could it have been better, etc. We aren't looking to deviate much from doing one of those two things, but some suggestions or other solutions would potentially be helpful. | 3 | python,asp-classic,vbscript | 1 | 0 | 1 | I would not recommend JScript as that is definitely the road less traveled.
ASP.NET MVC is rapidly maturing, and I think that you could begin a migration to it, simultaneously ramping up on the ASP.NET MVC framework as its finalization comes through.
Another option would be to use something like ASP.NET w/Subsonic or NHibernate. | 406 | 0 | 87,522 | 0 | 9 | 0 | false | 0 | 2008-09-17T20:48:00.000 | 0 | If it is decided that our system needs an overhaul, what is the best way to go about it? | 0 | 0 | 87,573 | 7 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | I know how to do this if I iterate through all of the characters in the string but I am looking for a more elegant method. | 95 | python,regex,string | 0 | -0.01818 | 1 | You could always use a list comprehension and check the results with all, it would be a little less resource intensive than using a regex: all([c in string.letters + string.digits + ["_", "-"] for c in mystring]) | 148,492 | 0 | 89,909 | 0 | 11 | 0 | false | 0 | 2008-09-18T04:04:00.000 | 0 | How do I verify that a string only contains letters, numbers, underscores and dashes? | 0 | 1 | 89,940 | 1 | -1 | 0 |
0 | 0 | 0 | 0 | 0 | I've gotten to grips with the basics of Python and I've got a small holiday which I want to use some of to learn a little more Python. The problem is that I have no idea what to learn or where to start. I'm primarily web development but in this case I don't know how much difference it will make. | 14 | python | 0 | 0.039979 | 1 | The Python Cookbook is absolutely essential if you want to master idiomatic Python. Besides, that's the book that made me fall in love with the language. | 4,581 | 0 | 92,230 | 0 | 10 | 0 | false | 0 | 2008-09-18T12:51:00.000 | 0 | Python, beyond the basics | 0 | 1 | 92,691 | 3 | 2 | 0 |
0 | 0 | 0 | 0 | 0 | I've gotten to grips with the basics of Python and I've got a small holiday which I want to use some of to learn a little more Python. The problem is that I have no idea what to learn or where to start. I'm primarily web development but in this case I don't know how much difference it will make. | 14 | python | 0 | 0.019997 | 1 | Search "Alex Martelli", "Alex Martelli patterns" and "Thomas Wouters" on Google video. There's plenty of interesting talks on advanced Python, design patterns in Python, and so on. | 4,581 | 0 | 92,230 | 0 | 10 | 0 | false | 0 | 2008-09-18T12:51:00.000 | 0 | Python, beyond the basics | 0 | 1 | 181,078 | 3 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | I've gotten to grips with the basics of Python and I've got a small holiday which I want to use some of to learn a little more Python. The problem is that I have no idea what to learn or where to start. I'm primarily web development but in this case I don't know how much difference it will make. | 14 | python | 0 | 0.019997 | 1 | I'd suggest writing a non-trivial webapp using either Django or Pylons, something that does some number crunching.
No better way to learn a new language than commiting yourself to a problem and learning as you go! | 4,581 | 0 | 92,230 | 0 | 10 | 0 | false | 0 | 2008-09-18T12:51:00.000 | 0 | Python, beyond the basics | 0 | 1 | 92,254 | 3 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | I need to write a module to detect similar documents. I have read many papers of fingerprints of documents techniques and others, but I do not know how to write code or implement such a solution. The algorithm should work for Chinese, Japanese, English and German language or be language independent. How can I accomplish this? | 10 | python,algorithm,diff | 0 | 0 | 1 | I think Jeremy has hit the nail on the head - if you just want to detect if files are different, a hash algorithm like MD5 or SHA1 is a good way to go.
Linus Torvalds' Git source control software uses SHA1 hashing in just this way - to check when files have been modified. | 13,411 | 0 | 101,569 | 0 | 10 | 0 | false | 0 | 2008-09-19T12:47:00.000 | 1 | Algorithm to detect similar documents in python script | 0 | 1 | 108,649 | 2 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | I need to write a module to detect similar documents. I have read many papers of fingerprints of documents techniques and others, but I do not know how to write code or implement such a solution. The algorithm should work for Chinese, Japanese, English and German language or be language independent. How can I accomplish this? | 10 | python,algorithm,diff | 0 | 0.059928 | 1 | You need to make your question more concrete. If you've already read the fingerprinting papers, you already know the principles at work, so describing common approaches here would not be beneficial. If you haven't, you should also check out papers on "duplicate detection" and various web spam detection related papers that have come out of Stanford, Google, Yahoo, and MS in recent years.
Are you having specific problems with coding the described algorithms?
Trouble getting started?
The first thing I'd probably do is separate the tokenization (the process of extracting "words" or other sensible sequences) from the duplicate detection logic, so that it is easy to plug in different parsers for different languages and keep the duplicate detection piece the same. | 13,411 | 0 | 101,569 | 0 | 10 | 0 | false | 0 | 2008-09-19T12:47:00.000 | 1 | Algorithm to detect similar documents in python script | 0 | 1 | 101,623 | 2 | 3 | 0 |
0 | 0 | 0 | 1 | 0 | In Python specifically, how do variables get shared between threads?
Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to avoid this sharing?
I have seen many warnings about synchronizing access to shared data among threads by using locks but I have yet to see a really good example of the problem.
Thanks in advance! | 123 | python,multithreading,thread-local | 0 | 0.099668 | 1 | Just like in every other language, every thread in Python has access to the same variables. There's no distinction between the 'main thread' and child threads.
One difference with Python is that the Global Interpreter Lock means that only one thread can be running Python code at a time. This isn't much help when it comes to synchronising access, however, as all the usual pre-emption issues still apply, and you have to use threading primitives just like in other languages. It does mean you need to reconsider if you were using threads for performance, however. | 68,654 | 0 | 104,983 | 0 | 6 | 0 | false | 0 | 2008-09-19T19:53:00.000 | 0 | What is "thread local storage" in Python, and why do I need it? | 0 | 1 | 105,058 | 3 | 3 | 0 |
0 | 0 | 0 | 1 | 0 | In Python specifically, how do variables get shared between threads?
Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to avoid this sharing?
I have seen many warnings about synchronizing access to shared data among threads by using locks but I have yet to see a really good example of the problem.
Thanks in advance! | 123 | python,multithreading,thread-local | 0 | 0.033321 | 1 | Worth mentioning threading.local() is not a singleton.
You can use more of them per thread.
It is not one storage. | 68,654 | 0 | 104,983 | 0 | 6 | 0 | false | 0 | 2008-09-19T19:53:00.000 | 0 | What is "thread local storage" in Python, and why do I need it? | 0 | 1 | 70,450,414 | 3 | 1 | 0 |
0 | 0 | 0 | 1 | 0 | In Python specifically, how do variables get shared between threads?
Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to avoid this sharing?
I have seen many warnings about synchronizing access to shared data among threads by using locks but I have yet to see a really good example of the problem.
Thanks in advance! | 123 | python,multithreading,thread-local | 0 | 0.033321 | 1 | I may be wrong here. If you know otherwise please expound as this would help explain why one would need to use thread local().
This statement seems off, not wrong: "If you want to atomically modify anything that another thread has access to, you have to protect it with a lock." I think this statement is ->effectively<- right but not entirely accurate. I thought the term "atomic" meant that the Python interpreter created a byte-code chunk that left no room for an interrupt signal to the CPU.
I thought atomic operations are chunks of Python byte code that does not give access to interrupts. Python statements like "running = True" is atomic. You do not need to lock CPU from interrupts in this case (I believe). The Python byte code breakdown is safe from thread interruption.
Python code like "threads_running[5] = True" is not atomic. There are two chunks of Python byte code here; one to de-reference the list() for an object and another byte code chunk to assign a value to an object, in this case a "place" in a list. An interrupt can be raised -->between<- the two byte-code ->chunks<-. That is were bad stuff happens.
How does thread local() relate to "atomic"? This is why the statement seems misdirecting to me. If not can you explain? | 68,654 | 0 | 104,983 | 0 | 6 | 0 | false | 0 | 2008-09-19T19:53:00.000 | 0 | What is "thread local storage" in Python, and why do I need it? | 0 | 1 | 60,241,832 | 3 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | Almost every Python web framework has a simple server that runs a wsgi application and automatically reloads the imported modules every time the source gets changed. I know I can look at the code and see how it's done, but that may take some time and I'm asking just out of curiosity. Does anyone have any idea how this is implemented? | 2 | python | 1 | 1.2 | 1 | As the author of one of the reloader mechanisms (the one in werkzeug) I can tell you that it doesn't work. What all the reloaders do is forking one time and restarting the child process if a monitor thread notices that one module changed on the file system.
Inline reload()ing doesn't work because references to the reloaded module are not updated. | 304 | 0 | 126,787 | 0 | 2 | 0 | true | 1 | 2008-09-24T12:21:00.000 | 0 | Checking for code changes in all imported python modules | 0 | 0 | 126,843 | 1 | 2 | 0 |
0 | 0 | 0 | 0 | 0 | I write tons of python scripts, and I find myself reusing lots code that I've written for other projects. My solution has been to make sure the code is separated into logical modules/packages (this one's a given). I then make them setuptools-aware and publish them on PyPI. This allows my other scripts to always have the most up-to-date code, I get a warm fuzzy feeling because I'm not repeating myself, and my development, in general, is made less complicated. I also feel good that there MAY be someone out there that finds my code handy for something they're working on, but it's mainly for selfish reasons :)
To all the pythonistas, how do you handle this? Do you use PyPI or setuptools (easy_install)? or something else? | 9 | python,code-reuse | 0 | 0 | 1 | I store it all offline in a logical directory structure, with commonly used modules grouped as utilities. This means it's easier to control which versions I publish, and manage. I also automate the build process to interpret the logical directory structure. | 344 | 0 | 136,207 | 0 | 3 | 0 | false | 1 | 2008-09-25T21:18:00.000 | 0 | How do you manage your custom modules? | 0 | 1 | 48,569,865 | 2 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | I write tons of python scripts, and I find myself reusing lots code that I've written for other projects. My solution has been to make sure the code is separated into logical modules/packages (this one's a given). I then make them setuptools-aware and publish them on PyPI. This allows my other scripts to always have the most up-to-date code, I get a warm fuzzy feeling because I'm not repeating myself, and my development, in general, is made less complicated. I also feel good that there MAY be someone out there that finds my code handy for something they're working on, but it's mainly for selfish reasons :)
To all the pythonistas, how do you handle this? Do you use PyPI or setuptools (easy_install)? or something else? | 9 | python,code-reuse | 0 | 0.066568 | 1 | What kind of modules are we talking about here? If you're planning on distributing your projects to other python developers, setuptools is great. But it's usually not a very good way to distribute apps to end users. Your best bet in the latter case is to tailor your packaging to the platforms you're distributing it for. Sure, it's a pain, but it makes life for end users far easier.
For example, in my Debian system, I usually don't use easy_install because it is a little bit more difficult to get eggs to work well with the package manager. In OS X and windows, you'd probably want to package everything up using py2app and py2exe respectively. This makes life for the end user better. After all, they shouldn't know or care what language your scripts are written in. They just need them to install. | 344 | 0 | 136,207 | 0 | 3 | 0 | false | 1 | 2008-09-25T21:18:00.000 | 0 | How do you manage your custom modules? | 0 | 1 | 137,291 | 2 | 1 | 0 |
1 | 0 | 0 | 0 | 0 | Dear Stacktoverflow, can you show me an example of how to use a QScrollBar? Thanks. | 0 | python,pyqt | 0 | 1.2 | 1 | It will come down to you using the QScrollArea, it is a widget that implements showing something that is larger than the available space. You will not need to use QScrollBar directly. I don't have a PyQt example but there is a C++ example in the QT distribution it is called the "Image Viewer". The object hierarchy will still be the same | 3,106 | 0 | 139,005 | 0 | 3 | 0 | true | 0 | 2008-09-26T12:05:00.000 | 0 | PyQt - QScrollBar | 0 | 0 | 139,056 | 1 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | The __debug__ variable is handy in part because it affects every module. If I want to create another variable that works the same way, how would I do it?
The variable (let's be original and call it 'foo') doesn't have to be truly global, in the sense that if I change foo in one module, it is updated in others. I'd be fine if I could set foo before importing other modules and then they would see the same value for it. | 127 | python,module,global | 0 | 1 | 1 | I believe that there are plenty of circumstances in which it does make sense and it simplifies programming to have some globals that are known across several (tightly coupled) modules. In this spirit, I would like to elaborate a bit on the idea of having a module of globals which is imported by those modules which need to reference them.
When there is only one such module, I name it "g". In it, I assign default values for every variable I intend to treat as global. In each module that uses any of them, I do not use "from g import var", as this only results in a local variable which is initialized from g only at the time of the import. I make most references in the form g.var, and the "g." serves as a constant reminder that I am dealing with a variable that is potentially accessible to other modules.
If the value of such a global variable is to be used frequently in some function in a module, then that function can make a local copy: var = g.var. However, it is important to realize that assignments to var are local, and global g.var cannot be updated without referencing g.var explicitly in an assignment.
Note that you can also have multiple such globals modules shared by different subsets of your modules to keep things a little more tightly controlled. The reason I use short names for my globals modules is to avoid cluttering up the code too much with occurrences of them. With only a little experience, they become mnemonic enough with only 1 or 2 characters.
It is still possible to make an assignment to, say, g.x when x was not already defined in g, and a different module can then access g.x. However, even though the interpreter permits it, this approach is not so transparent, and I do avoid it. There is still the possibility of accidentally creating a new variable in g as a result of a typo in the variable name for an assignment. Sometimes an examination of dir(g) is useful to discover any surprise names that may have arisen by such accident. | 177,508 | 0 | 142,545 | 0 | 12 | 0 | false | 0 | 2008-09-26T23:59:00.000 | 0 | How to make a cross-module variable? | 0 | 1 | 15,035,172 | 2 | 28 | 0 |
0 | 0 | 0 | 0 | 0 | The __debug__ variable is handy in part because it affects every module. If I want to create another variable that works the same way, how would I do it?
The variable (let's be original and call it 'foo') doesn't have to be truly global, in the sense that if I change foo in one module, it is updated in others. I'd be fine if I could set foo before importing other modules and then they would see the same value for it. | 127 | python,module,global | 0 | 0.083141 | 1 | You can already do this with module-level variables. Modules are the same no matter what module they're being imported from. So you can make the variable a module-level variable in whatever module it makes sense to put it in, and access it or assign to it from other modules. It would be better to call a function to set the variable's value, or to make it a property of some singleton object. That way if you end up needing to run some code when the variable's changed, you can do so without breaking your module's external interface.
It's not usually a great way to do things — using globals seldom is — but I think this is the cleanest way to do it. | 177,508 | 0 | 142,545 | 0 | 12 | 0 | false | 0 | 2008-09-26T23:59:00.000 | 0 | How to make a cross-module variable? | 0 | 1 | 3,911,089 | 2 | 5 | 0 |
1 | 0 | 0 | 1 | 0 | I need to develop a small-medium sized desktop GUI application, preferably with Python as a language of choice because of time constraints.
What GUI library choices do I have which allow me to redistribute my application standalone, assuming that the users don't have a working Python installation and obviously don't have the GUI libraries I'm using either?
Also, how would I go about packaging everything up in binaries of reasonable size for each target OS? (my main targets are Windows and Mac OS X)
Addition:
I've been looking at WxPython, but I've found plenty of horror stories of packaging it with cx_freeze and getting 30mb+ binaries, and no real advice on how to actually do the packaging and how trust-worthy it is. | 11 | python,user-interface,wxpython,distribution,freeze | 0 | 0 | 1 | I've used py2Exe myself - it's really easy (at least for small apps). | 5,407 | 0 | 153,956 | 0 | 7 | 0 | false | 0 | 2008-09-30T16:50:00.000 | 0 | Python GUI Application redistribution | 0 | 0 | 153,999 | 1 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | I have to write a reliable, totally-ordered multicast system from scratch in Python. I can't use any external libraries. I'm allowed to use a central sequencer.
There seems to be two immediate approaches:
write an efficient system, attaching a unique id to each multicasted message,
having the sequencer multicast sequence numbers for the message id's it receives,
and sending back and forth ACK's and NACK's.
write an inefficient flooding system, where each multicaster simply re-sends each
message it receives once (unless it was sent by that particular multicaster.)
I'm allowed to use the second option, and am inclined to do so.
I'm currently multicasting UDP messages (which seems to be the only option,) but that means that some messages might get lost. That means I have to be able to uniquely identify each sent UDP message, so that it can be re-sent according to #2. Should I really generate unique numbers (e.g. using the sender address and a counter) and pack them into each and every UDP message sent? How would I go about doing that? And how do I receive a single UDP message in Python, and not a stream of data (i.e. socket.recv)? | 5 | python,sockets,networking,ip,multicast | 0 | 0.066568 | 1 | The approach you take is going to depend very much on the nature of the data that you're sending, the scale of your network and the quantity of data you're sending. In particular it is going to depend on the number of targets each of your nodes is connected to.
If you're expecting this to scale to a large number of targets for each node and a large quantity of data then you may well find that the overhead of adding an ACK/NAK to every packet is sufficient to adversely limit your throughput, particularly when you add retransmissions into the mix.
As Frank Szczerba has said multimedia data has the benefit of being able to recover from lost packets. If you have any control over the data that you're sending you should try to design the payloads so that you minimise the susceptibility to dropped packets.
If the data that you're sending cannot tolerate dropped packets and you're trying to scale to high utilisation of your network then perhaps udp is not the best protocol to use. Implementing a series of tcp proxies (where each node retransmits, unicast, to all other connected nodes - similar to your flooding idea) would be a more reliable mechanism.
With all of that said, have you considered using true multicast for this application?
Just saw the "homework" tag... these suggestions might not be appropriate for a homework problem. | 3,074 | 0 | 176,179 | 0 | 3 | 0 | false | 0 | 2008-10-06T21:03:00.000 | 0 | Writing a reliable, totally-ordered multicast system in Python | 0 | 0 | 176,501 | 2 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | I have to write a reliable, totally-ordered multicast system from scratch in Python. I can't use any external libraries. I'm allowed to use a central sequencer.
There seems to be two immediate approaches:
write an efficient system, attaching a unique id to each multicasted message,
having the sequencer multicast sequence numbers for the message id's it receives,
and sending back and forth ACK's and NACK's.
write an inefficient flooding system, where each multicaster simply re-sends each
message it receives once (unless it was sent by that particular multicaster.)
I'm allowed to use the second option, and am inclined to do so.
I'm currently multicasting UDP messages (which seems to be the only option,) but that means that some messages might get lost. That means I have to be able to uniquely identify each sent UDP message, so that it can be re-sent according to #2. Should I really generate unique numbers (e.g. using the sender address and a counter) and pack them into each and every UDP message sent? How would I go about doing that? And how do I receive a single UDP message in Python, and not a stream of data (i.e. socket.recv)? | 5 | python,sockets,networking,ip,multicast | 0 | 1.2 | 1 | The flooding approach can cause a bad situation to get worse. If messages are dropped due to high network load, having every node resend every message will only make the situation worse.
The best approach to take depends on the nature of the data you are sending. For example:
Multimedia data: no retries, a dropped packet is a dropped frame, which won't matter when the next frame gets there anyway.
Fixed period data: Recipient node keeps a timer that is reset each time an update is received. If the time expires, it requests the missing update from the master node. Retries can be unicast to the requesting node.
If neither of these situations applies (every packet has to be received by every node, and the packet timing is unpredictable, so recipients can't detect missed packets on their own), then your options include:
Explicit ACK from every node for each packet. Sender retries (unicast) any packet that is not ACKed.
TCP-based grid approach, where each node is manually repeats received packets to neighbor nodes, relying on TCP mechanisms to ensure delivery.
You could possibly rely on recipients noticing a missed packet upon reception of one with a later sequence number, but this requires the sender to keep the packet around until at least one additional packet has been sent. Requiring positive ACKs is more reliable (and provable). | 3,074 | 0 | 176,179 | 0 | 3 | 0 | true | 0 | 2008-10-06T21:03:00.000 | 0 | Writing a reliable, totally-ordered multicast system in Python | 0 | 0 | 176,287 | 2 | 4 | 0 |
0 | 0 | 0 | 0 | 0 | I have a series of datetime objects and would like to calculate the average delta between them.
For example, if the input was (2008-10-01 12:15:00, 2008-10-01 12:25:00, 2008-10-01 12:35:00), then the average delta would be exactly 00:10:00, or 10 minutes.
Any suggestions on how to calculate this using Python? | 4 | python,algorithm,datetime | 0 | 0.07983 | 1 | Since you seem to be throwing out the 20 minute delta between times 1 and 3 in your example, I'd say you should just sort the list of datetimes, add up the deltas between adjacent times, then divide by n-1.
Do you have any code you can share with us, so we can help you debug it? | 6,291 | 0 | 179,716 | 0 | 5 | 0 | false | 0 | 2008-10-07T18:18:00.000 | 0 | Average difference between dates in Python | 0 | 1 | 179,760 | 2 | 2 | 0 |
0 | 0 | 0 | 0 | 0 | I have a series of datetime objects and would like to calculate the average delta between them.
For example, if the input was (2008-10-01 12:15:00, 2008-10-01 12:25:00, 2008-10-01 12:35:00), then the average delta would be exactly 00:10:00, or 10 minutes.
Any suggestions on how to calculate this using Python? | 4 | python,algorithm,datetime | 0 | 1.2 | 1 | You can subtract each successive date from the one prior (resulting in a timedelta object which represents the difference in days, seconds). You can then average the timedelta objects to find your answer. | 6,291 | 0 | 179,716 | 0 | 5 | 0 | true | 0 | 2008-10-07T18:18:00.000 | 0 | Average difference between dates in Python | 0 | 1 | 179,761 | 2 | 0 | 0 |
0 | 0 | 0 | 1 | 0 | There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cases. If the contempt was simply subjective, I cannot imagine that such a large number of people would care about it.
What am I missing? What is the problem with reduce()? | 78 | python,python-3.x | 0 | 1 | 1 | reduce() is not being removed -- it's simply being moved into the functools module. Guido's reasoning is that except for trivial cases like summation, code written using reduce() is usually clearer when written as an accumulation loop. | 22,140 | 0 | 181,543 | 0 | 5 | 0 | false | 0 | 2008-10-08T06:27:00.000 | 0 | What is the problem with reduce()? | 0 | 1 | 181,646 | 3 | 37 | 0 |
0 | 0 | 0 | 1 | 0 | There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cases. If the contempt was simply subjective, I cannot imagine that such a large number of people would care about it.
What am I missing? What is the problem with reduce()? | 78 | python,python-3.x | 0 | 0.158649 | 1 | The primary reason of reduce's existence is to avoid writing explicit for loops with accumulators. Even though python has some facilities to support the functional style, it is not encouraged. If you like the 'real' and not 'pythonic' functional style - use a modern Lisp (Clojure?) or Haskell instead. | 22,140 | 0 | 181,543 | 0 | 5 | 0 | false | 0 | 2008-10-08T06:27:00.000 | 0 | What is the problem with reduce()? | 0 | 1 | 43,993,022 | 3 | 4 | 0 |
0 | 0 | 0 | 1 | 0 | There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cases. If the contempt was simply subjective, I cannot imagine that such a large number of people would care about it.
What am I missing? What is the problem with reduce()? | 78 | python,python-3.x | 0 | 1 | 1 | People worry it encourages an obfuscated style of programming, doing something that can be achieved with clearer methods.
I'm not against reduce myself, I also find it a useful tool sometimes. | 22,140 | 0 | 181,543 | 0 | 5 | 0 | false | 0 | 2008-10-08T06:27:00.000 | 0 | What is the problem with reduce()? | 0 | 1 | 181,593 | 3 | 9 | 0 |
0 | 0 | 0 | 1 | 0 | Since Python is a dynamic, interpreted language you don't have to compile your code before running it. Hence, it's very easy to simply write your code, run it, see what problems occur, and fix them. Using hotkeys or macros can make this incredibly quick.
So, because it's so easy to immediately see the output of your program and any errors that may occur, I haven't uses a debugger tool yet. What situations may call for using a real debugger vs. the method I currently use?
I'd like to know before I get into a situation and get frustrated because I don't know how to fix the problem. | 6 | python,debugging | 0 | 0.066568 | 1 | Any time you want to inspect the contents of variables that may have caused the error. The only way you can do that is to stop execution and take a look at the stack.
pydev in Eclipse is a pretty good IDE if you are looking for one. | 1,057 | 0 | 181,724 | 0 | 6 | 0 | false | 0 | 2008-10-08T07:49:00.000 | 0 | When to use the Python debugger | 0 | 1 | 181,761 | 4 | 2 | 0 |
0 | 0 | 0 | 1 | 0 | Since Python is a dynamic, interpreted language you don't have to compile your code before running it. Hence, it's very easy to simply write your code, run it, see what problems occur, and fix them. Using hotkeys or macros can make this incredibly quick.
So, because it's so easy to immediately see the output of your program and any errors that may occur, I haven't uses a debugger tool yet. What situations may call for using a real debugger vs. the method I currently use?
I'd like to know before I get into a situation and get frustrated because I don't know how to fix the problem. | 6 | python,debugging | 0 | 0.033321 | 1 | I find it very useful to drop into a debugger in a failing test case.
I add import pdb; pdb.set_trace() just before the failure point of the test. The test runs, building up a potentially quite large context (e.g. importing a database fixture or constructing an HTTP request). When the test reaches the pdb.set_trace() line, it drops into the interactive debugger and I can inspect the context in which the failure occurs with the usual pdb commands looking for clues as to the cause. | 1,057 | 0 | 181,724 | 0 | 6 | 0 | false | 0 | 2008-10-08T07:49:00.000 | 0 | When to use the Python debugger | 0 | 1 | 183,563 | 4 | 1 | 0 |
0 | 0 | 0 | 1 | 0 | Since Python is a dynamic, interpreted language you don't have to compile your code before running it. Hence, it's very easy to simply write your code, run it, see what problems occur, and fix them. Using hotkeys or macros can make this incredibly quick.
So, because it's so easy to immediately see the output of your program and any errors that may occur, I haven't uses a debugger tool yet. What situations may call for using a real debugger vs. the method I currently use?
I'd like to know before I get into a situation and get frustrated because I don't know how to fix the problem. | 6 | python,debugging | 0 | 1 | 1 | In 30 years of programming I've used a debugger exactly 4 times. All four times were to read the core file produced from a C program crashing to locate the traceback information that's buried in there.
I don't think debuggers help much, even in compiled languages. Many people like debuggers, there are some reasons for using them, I'm sure, or people wouldn't lavish such love and care on them.
Here's the point -- software is knowledge capture.
Yes, it does have to run. More importantly, however, software has meaning.
This is not an indictment of your use of a debugger. However, I find that the folks who rely on debugging will sometimes produce really odd-looking code and won't have a good justification for what it means. They can only say "it may be a hack, but it works."
My suggestion on debuggers is "don't bother".
"But, what if I'm totally stumped?" you ask, "should I learn the debugger then?" Totally stumped by what? The language? Python's too simple for utter befuddlement. Some library? Perhaps.
Here's what you do -- with or without a debugger.
You have the source, read it.
You write small tests to exercise the library. Using the interactive shell, if possible. [All the really good libraries seem to show their features using the interactive Python mode -- I strive for this level of tight, clear simplicity.]
You have the source, add print functions. | 1,057 | 0 | 181,724 | 0 | 6 | 0 | false | 0 | 2008-10-08T07:49:00.000 | 0 | When to use the Python debugger | 0 | 1 | 182,010 | 4 | 8 | 0 |
0 | 0 | 0 | 1 | 0 | Since Python is a dynamic, interpreted language you don't have to compile your code before running it. Hence, it's very easy to simply write your code, run it, see what problems occur, and fix them. Using hotkeys or macros can make this incredibly quick.
So, because it's so easy to immediately see the output of your program and any errors that may occur, I haven't uses a debugger tool yet. What situations may call for using a real debugger vs. the method I currently use?
I'd like to know before I get into a situation and get frustrated because I don't know how to fix the problem. | 6 | python,debugging | 0 | 1.2 | 1 | I use pdb for basic python debugging. Some of the situations I use it are:
When you have a loop iterating over 100,000 entries and want to break at a specific point, it becomes really helpful.(conditional breaks)
Trace the control flow of someone else's code.
Its always better to use a debugger than litter the code with prints.
Normally there can be more than one point of failures resulting in a bug, all are not obvious in the first look. So you look for obvious places, if nothing is wrong there, you move ahead and add some more prints.. debugger can save you time here, you dont need to add the print and run again. | 1,057 | 0 | 181,724 | 0 | 6 | 0 | true | 0 | 2008-10-08T07:49:00.000 | 0 | When to use the Python debugger | 0 | 1 | 181,767 | 4 | 7 | 0 |
0 | 0 | 0 | 0 | 0 | I am new to python and struggling to find how to control the amount of memory a python process can take? I am running python on a Cento OS machine with more than 2 GB of main memory size. Python is taking up only 128mb of this and I want to allocate it more. I tried to search all over the internet on this for last half an hour and found absolutely nothing! Why is it so difficult to find information on python related stuff :(
I would be happy if someone could throw some light on how to configure python for various things like allowed memory size, number of threads etc.
A link to a site where most controllable parameters of python are described would be appreciated well. | 2 | python,memory | 0 | 0.197375 | 1 | Are you sure that the machine does not have a 128M process limit? If you are running the python script as a CGI inside a web server, it is quite likely that there is a process limit set - you will need to look at the web server configuration. | 1,627 | 0 | 191,700 | 0 | 2 | 1 | false | 0 | 2008-10-10T14:52:00.000 | 1 | Configuring python | 0 | 1 | 191,790 | 2 | 2 | 0 |
0 | 0 | 0 | 0 | 0 | I am new to python and struggling to find how to control the amount of memory a python process can take? I am running python on a Cento OS machine with more than 2 GB of main memory size. Python is taking up only 128mb of this and I want to allocate it more. I tried to search all over the internet on this for last half an hour and found absolutely nothing! Why is it so difficult to find information on python related stuff :(
I would be happy if someone could throw some light on how to configure python for various things like allowed memory size, number of threads etc.
A link to a site where most controllable parameters of python are described would be appreciated well. | 2 | python,memory | 0 | 1.2 | 1 | Forget all that, python just allocates more memory as needed, there is not a myriad of comandline arguments for the VM as in java, just let it run. For all comandline switches you can just run python -h or read man python. | 1,627 | 0 | 191,700 | 0 | 2 | 1 | true | 0 | 2008-10-10T14:52:00.000 | 1 | Configuring python | 0 | 1 | 191,744 | 2 | 11 | 0 |
0 | 0 | 0 | 0 | 0 | I'm not exactly sure how to ask this question really, and I'm no where close to finding an answer, so I hope someone can help me.
I'm writing a Python app that connects to a remote host and receives back byte data, which I unpack using Python's built-in struct module. My problem is with the strings, as they include multiple character encodings. Here is an example of such a string:
"^LThis is an example ^Gstring with multiple ^Jcharacter encodings"
Where the different encoding starts and ends is marked using special escape chars:
^L - Latin1
^E - Central Europe
^T - Turkish
^B - Baltic
^J - Japanese
^C - Cyrillic
^G - Greek
And so on... I need a way to convert this sort of string into Unicode, but I'm really not sure how to do it. I've read up on Python's codecs and string.encode/decode, but I'm none the wiser really. I should mention as well, that I have no control over how the strings are outputted by the host.
I hope someone can help me with how to get started on this. | 9 | python,string,unicode,encoding | 0 | 0.039979 | 1 | I don't suppose you have any way of convincing the person who hosts the other machine to switch to unicode?
This is one of the reasons Unicode was invented, after all. | 3,280 | 0 | 197,759 | 0 | 5 | 0 | false | 1 | 2008-10-13T14:26:00.000 | 0 | Dealing with a string containing multiple character encodings | 0 | 1 | 197,854 | 2 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | I'm not exactly sure how to ask this question really, and I'm no where close to finding an answer, so I hope someone can help me.
I'm writing a Python app that connects to a remote host and receives back byte data, which I unpack using Python's built-in struct module. My problem is with the strings, as they include multiple character encodings. Here is an example of such a string:
"^LThis is an example ^Gstring with multiple ^Jcharacter encodings"
Where the different encoding starts and ends is marked using special escape chars:
^L - Latin1
^E - Central Europe
^T - Turkish
^B - Baltic
^J - Japanese
^C - Cyrillic
^G - Greek
And so on... I need a way to convert this sort of string into Unicode, but I'm really not sure how to do it. I've read up on Python's codecs and string.encode/decode, but I'm none the wiser really. I should mention as well, that I have no control over how the strings are outputted by the host.
I hope someone can help me with how to get started on this. | 9 | python,string,unicode,encoding | 0 | 0.119427 | 1 | I would write a codec that incrementally scanned the string and decoded the bytes as they came along. Essentially, you would have to separate strings into chunks with a consistent encoding and decode those and append them to the strings that followed them. | 3,280 | 0 | 197,759 | 0 | 5 | 0 | false | 1 | 2008-10-13T14:26:00.000 | 0 | Dealing with a string containing multiple character encodings | 0 | 1 | 197,786 | 2 | 3 | 0 |
0 | 0 | 0 | 0 | 0 | What is the difference between multiprocessor programming and multicore programming?
preferably show examples in python how to write a small program for multiprogramming & multicore programming | 70 | python,multicore | 0 | 0.028564 | 1 | The main difference is how you organize and distribute data. Multicore typically has higher bandwidths between the different cores in a cpu, and multiprocessor needs to involve the bus between the cpus more.
Python 2.6 has gotten multiprocess (process, as in program running) and more synchronization and communication objects for multithreaded programming. | 71,173 | 0 | 203,912 | 0 | 7 | 0 | false | 0 | 2008-10-15T06:59:00.000 | 0 | Does python support multiprocessor/multicore programming? | 0 | 1 | 203,923 | 1 | 1 | 0 |
0 | 0 | 0 | 1 | 0 | I've been wondering about how hard it would be to write some Python code to search a string for the index of a substring of the form ${expr}, for example, where expr is meant to be a Python expression or something resembling one. Given such a thing, one could easily imagine going on to check the expression's syntax with compile(), evaluate it against a particular scope with eval(), and perhaps even substitute the result into the original string. People must do very similar things all the time.
I could imagine solving such a problem using a third-party parser generator [oof], or by hand-coding some sort of state machine [eek], or perhaps by convincing Python's own parser to do the heavy lifting somehow [hmm]. Maybe there's a third-party templating library somewhere that can be made to do exactly this. Maybe restricting the syntax of expr is likely to be a worthwhile compromise in terms of simplicity or execution time or cutting down on external dependencies -- for example, maybe all I really need is something that matches any expr that has balanced curly braces.
What's your sense?
Update:
Thanks very much for your responses so far! Looking back at what I wrote yesterday, I'm not sure I was sufficiently clear about what I'm asking. Template substitution is indeed an interesting problem, and probably much more useful to many more people than the expression extraction subproblem I'm wondering about, but I brought it up only as a simple example of how the answer to my question might be useful in real life. Some other potential applications might include passing the extracted expressions to a syntax highlighter; passing the result to a real Python parser and looking at or monkeying with the parse tree; or using the sequence of extracted expressions to build up a larger Python program, perhaps in conjunction with some information taken from the surrounding text.
The ${expr} syntax I mentioned is also intended as an example, and in fact I wonder if I shouldn't have used $(expr) as my example instead, because it makes the potential drawbacks of the obvious approach, along the lines of re.finditer(r'$\{([^}]+)\}', s), a bit easier to see. Python expressions can (and often do) contain the ) (or }) character. It seems possible that handling any of those cases might be much more trouble than it's worth, but I'm not convinced of that yet. Please feel free to try to make this case!
Prior to posting this question, I spent quite a bit of time looking at Python template engines hoping that one might expose the sort of low-level functionality I'm asking about -- namely, something that can find expressions in a variety of contexts and tell me where they are rather than being limited to finding expressions embedded using a single hard-coded syntax, always evaluating them, and always substituting the results back into the original string. I haven't figured out how to use any of them to solve my problem yet, but I do very much appreciate the suggestions regarding more to look at (can't believe I missed that wonderful list on the wiki!). The API documentation for these things tends to be pretty high-level, and I'm not too familiar with the internals of any of them, so I'm sure I could use help looking at those and figuring out how to get them to do this sort of thing.
Thanks for your patience! | 1 | python,parsing | 0 | 0.049958 | 1 | If you want to handle arbitrary expressions like {'{spam': 42}["spam}"], you can't get away without full-blown parser. | 1,094 | 0 | 207,290 | 0 | 4 | 0 | false | 0 | 2008-10-16T03:02:00.000 | 0 | Extracting a parenthesized Python expression from a string | 1 | 1 | 209,420 | 1 | 1 | 0 |
0 | 0 | 0 | 1 | 1 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in production.
What I'm trying to do is have a method check to see if the database is already created. If so, then I can use it. If not, an exception is raised and the program will create the database. (Or use if/else statements, whichever is better).
I created a test script to see if my logic is correct but it's not working. When I create the try statement, it just creates a new database rather than checking if one already exists. The next time I run the script, I get an error that the table already exists, even if I tried catching the exception. (I haven't used try/except before but figured this is a good time to learn).
Are there any good tutorials for using SQLite operationally or any suggestions on how to code this? I've looked through the pysqlite tutorial and others I found but they don't address this. | 13 | python,exception,sqlite | 0 | 0 | 1 | Yes, I was nuking out the problem. All I needed to do was check for the file and catch the IOError if it didn't exist.
Thanks for all the other answers. They may come in handy in the future. | 31,269 | 0 | 211,501 | 0 | 8 | 0 | false | 0 | 2008-10-17T09:02:00.000 | 1 | Using SQLite in a Python program | 0 | 0 | 214,623 | 5 | 0 | 1 |
0 | 0 | 0 | 1 | 1 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in production.
What I'm trying to do is have a method check to see if the database is already created. If so, then I can use it. If not, an exception is raised and the program will create the database. (Or use if/else statements, whichever is better).
I created a test script to see if my logic is correct but it's not working. When I create the try statement, it just creates a new database rather than checking if one already exists. The next time I run the script, I get an error that the table already exists, even if I tried catching the exception. (I haven't used try/except before but figured this is a good time to learn).
Are there any good tutorials for using SQLite operationally or any suggestions on how to code this? I've looked through the pysqlite tutorial and others I found but they don't address this. | 13 | python,exception,sqlite | 0 | 0.07486 | 1 | Doing SQL in overall is horrible in any language I've picked up. SQLalchemy has shown to be easiest from them to use because actual query and committing with it is so clean and absent from troubles.
Here's some basic steps on actually using sqlalchemy in your app, better details can be found from the documentation.
provide table definitions and create ORM-mappings
load database
ask it to create tables from the definitions (won't do so if they exist)
create session maker (optional)
create session
After creating a session, you can commit and query from the database. | 31,269 | 0 | 211,501 | 0 | 8 | 0 | false | 0 | 2008-10-17T09:02:00.000 | 1 | Using SQLite in a Python program | 0 | 0 | 211,539 | 5 | 3 | 1 |
0 | 0 | 0 | 1 | 1 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in production.
What I'm trying to do is have a method check to see if the database is already created. If so, then I can use it. If not, an exception is raised and the program will create the database. (Or use if/else statements, whichever is better).
I created a test script to see if my logic is correct but it's not working. When I create the try statement, it just creates a new database rather than checking if one already exists. The next time I run the script, I get an error that the table already exists, even if I tried catching the exception. (I haven't used try/except before but figured this is a good time to learn).
Are there any good tutorials for using SQLite operationally or any suggestions on how to code this? I've looked through the pysqlite tutorial and others I found but they don't address this. | 13 | python,exception,sqlite | 0 | 1 | 1 | SQLite automatically creates the database file the first time you try to use it. The SQL statements for creating tables can use IF NOT EXISTS to make the commands only take effect if the table has not been created This way you don't need to check for the database's existence beforehand: SQLite can take care of that for you.
The main thing I would still be worried about is that executing CREATE TABLE IF EXISTS for every web transaction (say) would be inefficient; you can avoid that by having the program keep an (in-memory) variable saying whether it has created the database today, so it runs the CREATE TABLE script once per run. This would still allow for you to delete the database and start over during debugging. | 31,269 | 0 | 211,501 | 0 | 8 | 0 | false | 0 | 2008-10-17T09:02:00.000 | 1 | Using SQLite in a Python program | 0 | 0 | 211,573 | 5 | 7 | 1 |
0 | 0 | 0 | 1 | 1 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in production.
What I'm trying to do is have a method check to see if the database is already created. If so, then I can use it. If not, an exception is raised and the program will create the database. (Or use if/else statements, whichever is better).
I created a test script to see if my logic is correct but it's not working. When I create the try statement, it just creates a new database rather than checking if one already exists. The next time I run the script, I get an error that the table already exists, even if I tried catching the exception. (I haven't used try/except before but figured this is a good time to learn).
Are there any good tutorials for using SQLite operationally or any suggestions on how to code this? I've looked through the pysqlite tutorial and others I found but they don't address this. | 13 | python,exception,sqlite | 0 | 1 | 1 | Don't make this more complex than it needs to be. The big, independent databases have complex setup and configuration requirements. SQLite is just a file you access with SQL, it's much simpler.
Do the following.
Add a table to your database for "Components" or "Versions" or "Configuration" or "Release" or something administrative like that.
CREATE TABLE REVISION(
RELEASE_NUMBER CHAR(20)
);
In your application, connect to your database normally.
Execute a simple query against the revision table. Here's what can happen.
The query fails to execute: your database doesn't exist, so execute a series of CREATE statements to build it.
The query succeeds but returns no rows or the release number is lower than expected: your database exists, but is out of date. You need to migrate from that release to the current release. Hopefully, you have a sequence of DROP, CREATE and ALTER statements to do this.
The query succeeds, and the release number is the expected value. Do nothing more, your database is configured correctly. | 31,269 | 0 | 211,501 | 0 | 8 | 0 | false | 0 | 2008-10-17T09:02:00.000 | 1 | Using SQLite in a Python program | 0 | 0 | 211,660 | 5 | 29 | 1 |
0 | 0 | 0 | 1 | 1 | I have created a Python module that creates and populates several SQLite tables. Now, I want to use it in a program but I don't really know how to call it properly. All the tutorials I've found are essentially "inline", i.e. they walk through using SQLite in a linear fashion rather than how to actually use it in production.
What I'm trying to do is have a method check to see if the database is already created. If so, then I can use it. If not, an exception is raised and the program will create the database. (Or use if/else statements, whichever is better).
I created a test script to see if my logic is correct but it's not working. When I create the try statement, it just creates a new database rather than checking if one already exists. The next time I run the script, I get an error that the table already exists, even if I tried catching the exception. (I haven't used try/except before but figured this is a good time to learn).
Are there any good tutorials for using SQLite operationally or any suggestions on how to code this? I've looked through the pysqlite tutorial and others I found but they don't address this. | 13 | python,exception,sqlite | 0 | 1.2 | 1 | AFAIK an SQLITE database is just a file.
To check if the database exists, check for file existence.
When you open a SQLITE database it will automatically create one if the file that backs it up is not in place.
If you try and open a file as a sqlite3 database that is NOT a database, you will get this:
"sqlite3.DatabaseError: file is encrypted or is not a database"
so check to see if the file exists and also make sure to try and catch the exception in case the file is not a sqlite3 database | 31,269 | 0 | 211,501 | 0 | 8 | 0 | true | 0 | 2008-10-17T09:02:00.000 | 1 | Using SQLite in a Python program | 0 | 0 | 211,534 | 5 | 13 | 1 |
1 | 0 | 0 | 1 | 0 | I installed Python 2.6 for one user on Windows Vista. Python works okay, but when I try: import Tkinter, it says the side-by-side configuration has errors. I've tried tinkering with the Visual Studio runtime, with no good results. Any ideas on how to resolve this? | 3 | python,windows,windows-vista,tkinter | 0 | -0.066568 | 1 | python 2.6.2 + tkinter 8.5, no problems | 1,345 | 0 | 219,215 | 0 | 3 | 0 | false | 0 | 2008-10-20T17:19:00.000 | 0 | How do I use Tkinter with Python on Windows Vista? | 0 | 1 | 792,527 | 3 | -1 | 0 |
1 | 0 | 0 | 1 | 0 | I installed Python 2.6 for one user on Windows Vista. Python works okay, but when I try: import Tkinter, it says the side-by-side configuration has errors. I've tried tinkering with the Visual Studio runtime, with no good results. Any ideas on how to resolve this? | 3 | python,windows,windows-vista,tkinter | 0 | 0.066568 | 1 | It seems this is a one of the many weird Vista problems and some random reinstalling, installing/upgrading of the visual studio runtime or some such seems sometimes to help, or disabling sxs in the system configuration or writing a manifest file etc.
Though I think you should downgrade to windows XP. | 1,345 | 0 | 219,215 | 0 | 3 | 0 | false | 0 | 2008-10-20T17:19:00.000 | 0 | How do I use Tkinter with Python on Windows Vista? | 0 | 1 | 219,326 | 3 | 1 | 0 |
1 | 0 | 0 | 1 | 0 | I installed Python 2.6 for one user on Windows Vista. Python works okay, but when I try: import Tkinter, it says the side-by-side configuration has errors. I've tried tinkering with the Visual Studio runtime, with no good results. Any ideas on how to resolve this? | 3 | python,windows,windows-vista,tkinter | 0 | 1.2 | 1 | Maybe you should downgrade to 2.5 version? | 1,345 | 0 | 219,215 | 0 | 3 | 0 | true | 0 | 2008-10-20T17:19:00.000 | 0 | How do I use Tkinter with Python on Windows Vista? | 0 | 1 | 219,284 | 3 | 1 | 0 |
1 | 0 | 0 | 0 | 0 | I'm making a program that fits the wizard concept ideally; the user is walked through the steps to create a character for a game.
However, I'm realizing that the limitations of the wizard are making it difficult to design "elegant" logic flow. For example, because all pages of the wizard are initalized at the same time, I can't have the values entered in one page available to the next one. I have to put a button on each page to get the values from a previous page rather than simply having fields auto-populated.
I've thought about alternatives to using the wizard. I think the best idea is to have some buttons on one panel that change the information on another panel, e.g. a splitter window.
However, I can't find any documentation in wxPython on how to dynamically change the panel. Everything I've found so far is really pretty static, hence the use of the wizard. Even the "wxPython in Action" book doesn't mention it.
Are there any tutorials for making "dynamic panels" or better management of a wizard? | 3 | python,wxpython,wizard | 0 | 0.039979 | 1 | The wxPython demo has an example of a "dynamic" wizard. Pages override GetNext() and GetPrev() to show pages dynamically. This shows the basic technique; you can extend it to add and remove pages, change pages on the fly, and rearrange pages dynamically.
The wizard class is just a convenience, though. You can modify it, or create your own implementation. A style that seems popular nowadays is to use an HTML-based presentation; you can emulate this with the wxHtml control, or the IEHtmlWindow control if your app is Windows only. | 2,843 | 0 | 224,337 | 0 | 5 | 0 | false | 0 | 2008-10-22T02:54:00.000 | 1 | Alternatives to a wizard | 0 | 0 | 247,409 | 2 | 1 | 0 |
1 | 0 | 0 | 0 | 0 | I'm making a program that fits the wizard concept ideally; the user is walked through the steps to create a character for a game.
However, I'm realizing that the limitations of the wizard are making it difficult to design "elegant" logic flow. For example, because all pages of the wizard are initalized at the same time, I can't have the values entered in one page available to the next one. I have to put a button on each page to get the values from a previous page rather than simply having fields auto-populated.
I've thought about alternatives to using the wizard. I think the best idea is to have some buttons on one panel that change the information on another panel, e.g. a splitter window.
However, I can't find any documentation in wxPython on how to dynamically change the panel. Everything I've found so far is really pretty static, hence the use of the wizard. Even the "wxPython in Action" book doesn't mention it.
Are there any tutorials for making "dynamic panels" or better management of a wizard? | 3 | python,wxpython,wizard | 0 | 0 | 1 | I'd get rid of wizard in whole. They are the most unpleasant things I've ever used.
The problem that requires a wizard-application where you click 'next' is perhaps a problem where you could apply a better user interface in a bit different manner. Instead of bringing up a dialog with annoying 'next' -button. Do this:
Bring up a page. When the user inserts the information to the page, extend or shorten it according to the input. If your application needs to do some processing to continue, and it's impossible to revert after that, write a new page or disable the earlier section of the current page. When you don't need any input from the user anymore or the app is finished, you can show a button or enable an existing such.
I don't mean you should implement it all in browser. Make simply a scrolling container that can contain buttons and labels in a flat list.
Benefit: The user can just click a tab, and you are encouraged to put all the processing into the end of filling the page. | 2,843 | 0 | 224,337 | 0 | 5 | 0 | false | 0 | 2008-10-22T02:54:00.000 | 1 | Alternatives to a wizard | 0 | 0 | 247,633 | 2 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | I've been exploring the details of Django for about a week now and like what I see. However I've come upon some.. negativity in relation to fine-grained control of permissions to the CRUD interface.
What I'm writing is an Intranet client management web-app. The organisation is about 6 tiers, and I need to restrict access to client groups based on tiers. Continually expanding. I have a fairly good idea how I'm going to do this, but am not sure if I'll be able to integrate it well into the pre-built admin interface.
I've done absolutely zero Django development otherwise I'd probably have a better idea on whether this would work or not. I probably won't use Django if the generated admin interface is going to be useless to this project - but like I said, there is a heavy reliance on fine-grained custom permissions.
Will Django let me build custom permissions/rules and integrate it seamlessly into the admin CRUD interface?
Update One: I want to use the admin app to minimise the repitition of generating CRUD interfaces, so yes I consider it a must have.
Update Two:
I want to describe the permissions required for this project.
A client can belong to one or many 'stores'. Full time employees should only be able to edit clients at their store (even if they belong to another store). However, they should not be able to see/edit clients at another store. Casuals should only be able to view clients based on what store they are rostered too (or if the casual is logged in as the store user - more likely).
Management above them need to be able to see all employees for the stores they manage, nothing more.
Senior management should be able to edit ALL employees and grant permissions below themselves.
After reading the django documentation, it says you can't (autmoatically) set permissions for a sub-set of a group. Only the entire group. Is it easy enough to mock up your own permissions for this purpose? | 14 | python,django,permissions | 1 | 0.132549 | 1 | The Django permission system totally rules. Each model has a default set of permissions. You can add new permissions to your models, also.
Each User has a set of permissions as well as group memberships. Individual users can have individual permissions. And they inherit permissions from their group membership.
Your view functions (and templates) can easily check the presence of absence of those permissions at any level of granularity you need to use.
And if this isn't enough for you, the Profile add-on gives you yet more options for defining a "User" and their capabilities, permissions, roles, responsibilities, etc.
And if this isn't enough for you, you can define your own authentication schemes.
What's important is not to try and define groups that are actual subsets of users, not casually defined titles or roles. You never need to "set permissions for a sub-set of a group". You need to have smaller groups. Groups defined around subsets of people.
Django's default permissions are around model access, not row access within a model. On the other hand, your problem is about subsets of rows in several models: Client, Store, Employee, Manager.
You'll need a basic set of FK's among these items, and some filters to subset the rows. You may have trouble doing this with default admin pages. You may need your own version of admin to make use of specialized filters.
If you can't do it with the Django permission system, you should rethink your use cases. Seriously.
[The Django-REST Interface, however, is another beast entirely, and requires some care and feeding.] | 8,167 | 0 | 232,008 | 0 | 6 | 0 | false | 0 | 2008-10-23T23:50:00.000 | 0 | Will Django be a good choice for a permissions based web-app? | 0 | 0 | 232,243 | 1 | 4 | 0 |
0 | 0 | 0 | 0 | 0 | I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base?
When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python?
When you make changes deep inside the code, how do you find out what operations an instance provides, since you don't have a static type to lookup?
How do you handle/prevent typing errors (typos)?
Are UnitTest's used as a substitute for static type checking?
As you can guess I almost only worked with statically typed languages (C++/Java), but I would like to try my hands on Python for larger programs. But I had a very bad experience, a long time ago, with the clipper (dBase) language, which was also dynamically typed. | 62 | python,development-environment | 0 | 0.07486 | 1 | My general rule of thumb is to use dynamic languages for small non-mission-critical projects and statically-typed languages for big projects. I find that code written in a dynamic language such as python gets "tangled" more quickly. Partly that is because it is much quicker to write code in a dynamic language and that leads to shortcuts and worse design, at least in my case. Partly it's because I have IntelliJ for quick and easy refactoring when I use Java, which I don't have for python. | 19,675 | 0 | 236,407 | 0 | 8 | 0 | false | 1 | 2008-10-25T13:30:00.000 | 0 | How can I use Python for large scale development? | 0 | 0 | 236,570 | 4 | 3 | 0 |
0 | 0 | 0 | 0 | 0 | I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base?
When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python?
When you make changes deep inside the code, how do you find out what operations an instance provides, since you don't have a static type to lookup?
How do you handle/prevent typing errors (typos)?
Are UnitTest's used as a substitute for static type checking?
As you can guess I almost only worked with statically typed languages (C++/Java), but I would like to try my hands on Python for larger programs. But I had a very bad experience, a long time ago, with the clipper (dBase) language, which was also dynamically typed. | 62 | python,development-environment | 0 | 0.049958 | 1 | The usual answer to that is testing testing testing. You're supposed to have an extensive unit test suite and run it often, particularly before a new version goes online.
Proponents of dynamically typed languages make the case that you have to test anyway because even in a statically typed language conformance to the crude rules of the type system covers only a small part of what can potentially go wrong. | 19,675 | 0 | 236,407 | 0 | 8 | 0 | false | 1 | 2008-10-25T13:30:00.000 | 0 | How can I use Python for large scale development? | 0 | 0 | 236,470 | 4 | 2 | 0 |
0 | 0 | 0 | 0 | 0 | I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base?
When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python?
When you make changes deep inside the code, how do you find out what operations an instance provides, since you don't have a static type to lookup?
How do you handle/prevent typing errors (typos)?
Are UnitTest's used as a substitute for static type checking?
As you can guess I almost only worked with statically typed languages (C++/Java), but I would like to try my hands on Python for larger programs. But I had a very bad experience, a long time ago, with the clipper (dBase) language, which was also dynamically typed. | 62 | python,development-environment | 0 | 1.2 | 1 | Since nobody pointed out pychecker, pylint and similar tools, I will: pychecker and pylint are tools that can help you find incorrect assumptions (about function signatures, object attributes, etc.) They won't find everything that a compiler might find in a statically typed language -- but they can find problems that such compilers for such languages can't find, too.
Python (and any dynamically typed language) is fundamentally different in terms of the errors you're likely to cause and how you would detect and fix them. It has definite downsides as well as upsides, but many (including me) would argue that in Python's case, the ease of writing code (and the ease of making it structurally sound) and of modifying code without breaking API compatibility (adding new optional arguments, providing different objects that have the same set of methods and attributes) make it suitable just fine for large codebases. | 19,675 | 0 | 236,407 | 0 | 8 | 0 | true | 1 | 2008-10-25T13:30:00.000 | 0 | How can I use Python for large scale development? | 0 | 0 | 236,537 | 4 | 24 | 0 |
0 | 0 | 0 | 0 | 0 | I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base?
When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python?
When you make changes deep inside the code, how do you find out what operations an instance provides, since you don't have a static type to lookup?
How do you handle/prevent typing errors (typos)?
Are UnitTest's used as a substitute for static type checking?
As you can guess I almost only worked with statically typed languages (C++/Java), but I would like to try my hands on Python for larger programs. But I had a very bad experience, a long time ago, with the clipper (dBase) language, which was also dynamically typed. | 62 | python,development-environment | 0 | 1 | 1 | I had some experience with modifying "Frets On Fire", an open source python "Guitar Hero" clone.
as I see it, python is not really suitable for a really large scale project.
I found myself spending a large part of the development time debugging issues related to assignment of incompatible types, things that static typed laguages will reveal effortlessly at compile-time.
also, since types are determined on run-time, trying to understand existing code becomes harder, because you have no idea what's the type of that parameter you are currently looking at.
in addition to that, calling functions using their name string with the __getattr__ built in function is generally more common in Python than in other programming languages, thus getting the call graph to a certain function somewhat hard (although you can call functions with their name in some statically typed languages as well).
I think that Python really shines in small scale software, rapid prototype development, and gluing existing programs together, but I would not use it for large scale software projects, since in those types of programs maintainability becomes the real issue, and in my opinion python is relatively weak there. | 19,675 | 0 | 236,407 | 0 | 8 | 0 | false | 1 | 2008-10-25T13:30:00.000 | 0 | How can I use Python for large scale development? | 0 | 0 | 236,445 | 4 | 40 | 0 |
0 | 0 | 0 | 0 | 1 | I need to update data to a mssql 2005 database so I have decided to use adodbapi, which is supposed to come built into the standard installation of python 2.1.1 and greater.
It needs pywin32 to work correctly and the open office python 2.3 installation does not have pywin32 built into it. It also seems like this built int python installation does not have adodbapi, as I get an error when I go import adodbapi.
Any suggestions on how to get both pywin32 and adodbapi installed into this open office 2.4 python installation?
thanks
oh yeah I tried those ways. annoyingly nothing. So i have reverted to jython, that way I can access Open Office for its conversion capabilities along with decent database access.
Thanks for the help. | 0 | python,openoffice.org,pywin32,adodbapi | 0 | 0.066568 | 1 | maybe the best way to install pywin32 is to place it in
(openofficedir)\program\python-core-2.3.4\lib\site-packages
it is easy if you have a python 2.3 installation (with pywin installed) under
C:\python2.3
move the C:\python2.3\Lib\site-packages\ to your
(openofficedir)\program\python-core-2.3.4\lib\site-packages | 833 | 0 | 239,009 | 0 | 3 | 0 | false | 0 | 2008-10-27T03:32:00.000 | 0 | getting pywin32 to work inside open office 2.4 built in python 2.3 interpreter | 0 | 0 | 239,487 | 1 | 1 | 1 |
0 | 0 | 0 | 0 | 0 | Anyone have any thoughts on how/if it is possible to integrate Google Code commits to cause a Google AppEngine deployment of the most recent code?
I have a simple Google AppEngine project's source hosted on Google Code and would love if everytime I committed to Subversion, that AppEngine would reflect the latest commit. I don't mind if things are broken on the live site since the project is for personal use mainly and for learning.
Anyone have any thoughts on how to tie into the subversion commit for the Code repository and/or how to kickoff the deployment to AppEngine? Ideally the solution would not require anything manual from me nor any type of server/listener software on my machine. | 18 | python,svn,google-app-engine,continuous-integration,google-code | 1 | 0.039979 | 1 | For those of us who are using Github, this feature from the GAE team would make us all seriously consider switching to Google Code... | 2,320 | 0 | 241,007 | 0 | 5 | 1 | false | 0 | 2008-10-27T18:43:00.000 | 0 | Possible to integrate Google AppEngine and Google Code for continuous integration? | 1 | 0 | 241,672 | 2 | 1 | 0 |
0 | 0 | 0 | 0 | 0 | Anyone have any thoughts on how/if it is possible to integrate Google Code commits to cause a Google AppEngine deployment of the most recent code?
I have a simple Google AppEngine project's source hosted on Google Code and would love if everytime I committed to Subversion, that AppEngine would reflect the latest commit. I don't mind if things are broken on the live site since the project is for personal use mainly and for learning.
Anyone have any thoughts on how to tie into the subversion commit for the Code repository and/or how to kickoff the deployment to AppEngine? Ideally the solution would not require anything manual from me nor any type of server/listener software on my machine. | 18 | python,svn,google-app-engine,continuous-integration,google-code | 1 | 0.039979 | 1 | Very interesting, but not yet possible, AFAIK. I have been looking for that option in Google Code with no success.
The only solution I can figure out is to install something in your machine that checks for changes in your SVN repository.
I'll be happy to hear about other approaches. | 2,320 | 0 | 241,007 | 0 | 5 | 1 | false | 0 | 2008-10-27T18:43:00.000 | 0 | Possible to integrate Google AppEngine and Google Code for continuous integration? | 1 | 0 | 241,126 | 2 | 1 | 0 |
0 | 0 | 1 | 1 | 0 | I have been enjoying learning the basics of python, but before I started reading things I tried to install various python versions and modules clumsily. Now that I have some ideas of what I want to do and how to do it I'm finding that various aspects are broken. For instance, 2.6 IDLE won't launch, and when I try to import modules they usually don't work.
My question is, how would you recommend I clean this up and start fresh? I have read information about modifying the 2.6 install, but I still can't get it to work.
IDLE 2.4 works, and when I launch python from the terminal I am running python 2.4.4. | 2 | python,python-2.6,python-install | 0 | 0.066568 | 1 | Macports should be easy to get rid of; just delete /opt/local/. I think that Fink does something similar.
You can do which python to see what python is the default one. The system python should be in /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
The MacPython you may have downloaded would either be in /Library/Frameworks/Python.framework. You can delete this as well.
Also, both MacPython and MacPorts edit your ~/.profile and change the PYTHONPATH, make sure to edit it and remove the extra paths there. | 3,948 | 0 | 242,065 | 0 | 3 | 0 | false | 0 | 2008-10-28T02:34:00.000 | 0 | Python + Leopard + Fink + Mac Ports + Python.org + Idiot = broken Python - fresh start? | 0 | 1 | 248,884 | 1 | 1 | 0 |
1 | 0 | 0 | 0 | 0 | I am getting a DC for a window handle of an object in another program using win32gui.GetDC which returns an int/long. I need to blit this DC into a memory DC in python. The only thing I can't figure out how to do is get a wxDC derived object from the int/long that win32gui returns. None of the wxDC objects allow me to pass an actual DC handle to them from what I can tell. This of course keeps me from doing my blit. Is there any way to do this? | 2 | wxpython,device,win32gui,bitblit | 0 | 0 | 1 | From what I can tell, DCs in python are abstracted due to platform variation. So a device context in python doesn't directly map to a device context in Windows even though many of the methods are direct Windows method calls. To make this happen it appears you would need to make your own DelegateDC class or something similar that is intended just for Windows so that you could set the DC handle directly.
There might also be some way to attach a wxWindow to the window handle after which you could get a wxWindowDC from the wxWindow...can't figure this out though. | 1,086 | 0 | 244,340 | 0 | 2 | 0 | false | 0 | 2008-10-28T18:35:00.000 | 0 | wxPython wxDC object from win32gui.GetDC | 0 | 0 | 253,897 | 1 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | As it seems there is no scripting language for Windows mobile devices that gives access to phone (sms, mms, make a call, take photo). I wonder how complex it would be to make a Python library that would enable that (write something in C, compile, and import in PythonCE).
Question: Where shall start to understand how to compile a PythonCE module that will give additional functionality to Python on Windows mobile. Also, what is the required toolkit. Is it at all possible on Mac (Leopard)? | 1 | c,windows-mobile,extending,pythonce | 0 | 0.066568 | 1 | MSDN has plenty of samples for C++ development on Windows Mobile, and the SDK comes with several sample application. Unfortunately VS Express editions (the free ones) do not come with compilers for Smart Devices. The only free option is the older eMbedded Visual C++ (eVC), which is now something like 8 years old and not supported (though it can still create apps for devices at least up through CE 5.0). | 871 | 0 | 252,859 | 0 | 3 | 0 | false | 0 | 2008-10-31T08:13:00.000 | 0 | Extending PythonCE to Access gsm/camera/gps Easily from PythonCE | 1 | 0 | 253,562 | 1 | 1 | 0 |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
New: Create and edit this dataset card directly on the website!
Contribute a Dataset Card- Downloads last month
- 0