Available Count
int64
1
31
AnswerCount
int64
1
35
GUI and Desktop Applications
int64
0
1
Users Score
int64
-17
588
Q_Score
int64
0
6.79k
Python Basics and Environment
int64
0
1
Score
float64
-1
1.2
Networking and APIs
int64
0
1
Question
stringlengths
15
7.24k
Database and SQL
int64
0
1
Tags
stringlengths
6
76
CreationDate
stringlengths
23
23
System Administration and DevOps
int64
0
1
Q_Id
int64
469
38.2M
Answer
stringlengths
15
7k
Data Science and Machine Learning
int64
0
1
ViewCount
int64
13
1.88M
is_accepted
bool
2 classes
Web Development
int64
0
1
Other
int64
1
1
Title
stringlengths
15
142
A_Id
int64
518
72.2M
1
2
0
0
1
1
0
0
Do locales contain information about preferred units for temperature, lengths, etc. on Unix/Linux? Is it possible to access these properties from Python? I checked out the "locales" module, but didn't find anything suitable. I'd like my application to automatically convert values into the most suitable unit.
0
python,localization
2009-04-25T23:49:00.000
1
789,953
For what it's worth, KDE offers a choice of "Metric" or "Imperial" as the standard unit system, so I would presume that it's possible to access that information through Python somehow. Gnome might have a similar setting, I'm not sure... but I don't think there's any equivalent for a generic UNIX/Linux system. The most recent version of SciPy (0.7) includes a module for unit handling, and you can use that to do your conversions if necessary.
0
355
false
0
1
Locales and temperature/length conversion
790,078
6
12
0
7
18
1
1
0
Currently I'm using a Windows batch file to build my software. It does things like running MSBuild, copying files, creating a ZIP file, running some tests, including the subversion revision number, etc. But the problem is, batch files are evil. So I would like to change to something better. I was planning to recreate my build script in Python. Is that a smart choice? What about all those build systems, like Ant, SCons, Maven, Rake, etc. Would using any of those be a better choice? Note: I'm not planning to replace my Visual Studio solution/project files. I only want to script everything else that's required to create a release of my software. Edit: I have good reasons to move away from batch, that's not what my question is about. I would like to know (for example) what SCons gives me, over a normal Python script.
0
python,build-process,build-automation
2009-04-27T08:19:00.000
0
792,629
As you're mentioning Python and SCons, I'd say go for SCons. It is Python after all. And yes, any of the above would be a better choice than hand-rolled build scripts.
0
9,281
false
0
1
Is Python the right hammer for this nail? (build script)
792,646
6
12
0
4
18
1
0.066568
0
Currently I'm using a Windows batch file to build my software. It does things like running MSBuild, copying files, creating a ZIP file, running some tests, including the subversion revision number, etc. But the problem is, batch files are evil. So I would like to change to something better. I was planning to recreate my build script in Python. Is that a smart choice? What about all those build systems, like Ant, SCons, Maven, Rake, etc. Would using any of those be a better choice? Note: I'm not planning to replace my Visual Studio solution/project files. I only want to script everything else that's required to create a release of my software. Edit: I have good reasons to move away from batch, that's not what my question is about. I would like to know (for example) what SCons gives me, over a normal Python script.
0
python,build-process,build-automation
2009-04-27T08:19:00.000
0
792,629
I've seen python scripts used for building releases elsewhere so it can't be bad. Actually, I've personally used perl scripts to automate release building. I guess any scripting language could easily automate that procedure. If it's gonna be easy to do (and probably better than batch scripts), why not try it?
0
9,281
false
0
1
Is Python the right hammer for this nail? (build script)
792,636
6
12
0
9
18
1
1
0
Currently I'm using a Windows batch file to build my software. It does things like running MSBuild, copying files, creating a ZIP file, running some tests, including the subversion revision number, etc. But the problem is, batch files are evil. So I would like to change to something better. I was planning to recreate my build script in Python. Is that a smart choice? What about all those build systems, like Ant, SCons, Maven, Rake, etc. Would using any of those be a better choice? Note: I'm not planning to replace my Visual Studio solution/project files. I only want to script everything else that's required to create a release of my software. Edit: I have good reasons to move away from batch, that's not what my question is about. I would like to know (for example) what SCons gives me, over a normal Python script.
0
python,build-process,build-automation
2009-04-27T08:19:00.000
0
792,629
Batch files aren't evil - they've actually come quite a long way from the brain-dead days of command.com. The command language can be pretty expressive nowadays, it just requires a bit of effort on your part to learn it. Unless there's an actual problem with your build script that you can't fix (and, if that's the case, that's the question you should be asking rather than some wishy-washy "What's the best replacement?" :-), my approach would be to stick with what you've got. A vague feeling of evilness would not be reason for me to waste effort 'fixing' something that isn't broken. And it would be wasted effort unless there's a clear advantage to changing ("less evil" is not something I'd consider a clear advantage).
0
9,281
false
0
1
Is Python the right hammer for this nail? (build script)
792,663
6
12
0
1
18
1
0.016665
0
Currently I'm using a Windows batch file to build my software. It does things like running MSBuild, copying files, creating a ZIP file, running some tests, including the subversion revision number, etc. But the problem is, batch files are evil. So I would like to change to something better. I was planning to recreate my build script in Python. Is that a smart choice? What about all those build systems, like Ant, SCons, Maven, Rake, etc. Would using any of those be a better choice? Note: I'm not planning to replace my Visual Studio solution/project files. I only want to script everything else that's required to create a release of my software. Edit: I have good reasons to move away from batch, that's not what my question is about. I would like to know (for example) what SCons gives me, over a normal Python script.
0
python,build-process,build-automation
2009-04-27T08:19:00.000
0
792,629
You can create custom makefiles for Microsoft nmake tool which you already have installed. Using a tool like that (SCons, Maven, etc. fall into the same category) gives you much more than regular scripts. The main benefit is that dependencies between files are tracked and also the timestamps of changes. For example, you can make your .zip file depend on some other files, so .zip only gets repacked if some of those files have changed in the meantime. Just like with source code and its compiled form.
0
9,281
false
0
1
Is Python the right hammer for this nail? (build script)
792,676
6
12
0
3
18
1
0.049958
0
Currently I'm using a Windows batch file to build my software. It does things like running MSBuild, copying files, creating a ZIP file, running some tests, including the subversion revision number, etc. But the problem is, batch files are evil. So I would like to change to something better. I was planning to recreate my build script in Python. Is that a smart choice? What about all those build systems, like Ant, SCons, Maven, Rake, etc. Would using any of those be a better choice? Note: I'm not planning to replace my Visual Studio solution/project files. I only want to script everything else that's required to create a release of my software. Edit: I have good reasons to move away from batch, that's not what my question is about. I would like to know (for example) what SCons gives me, over a normal Python script.
0
python,build-process,build-automation
2009-04-27T08:19:00.000
0
792,629
Why should you use python? If your build script isn't broke don't fix it. If your having issues updating it to deal with new aditions to the project then you may want to look at rewriting it. I wouldn't use Python though tools like NANT or MSBuild do the job. I don't see the point in using a general purpis programming language to do something that tools have already been written to do unless you have a lot of obscure requirements existing tools can't deal with. Second what happens if you get hit by a bus or win the lotto? If you are determined to script everything I'd use powershell or some other Microsoft specific technology since your already wedded to Microsoft. If you leave will there be enough Python programmers to maintain the build scripts?
0
9,281
false
0
1
Is Python the right hammer for this nail? (build script)
793,354
6
12
0
1
18
1
0.016665
0
Currently I'm using a Windows batch file to build my software. It does things like running MSBuild, copying files, creating a ZIP file, running some tests, including the subversion revision number, etc. But the problem is, batch files are evil. So I would like to change to something better. I was planning to recreate my build script in Python. Is that a smart choice? What about all those build systems, like Ant, SCons, Maven, Rake, etc. Would using any of those be a better choice? Note: I'm not planning to replace my Visual Studio solution/project files. I only want to script everything else that's required to create a release of my software. Edit: I have good reasons to move away from batch, that's not what my question is about. I would like to know (for example) what SCons gives me, over a normal Python script.
0
python,build-process,build-automation
2009-04-27T08:19:00.000
0
792,629
Python is very portable. SCons is field tested and reliable. Given what you know (from what you explained), why even ask the question? If your maintaining something, its not just about getting it to build, its also about explaining to the user why it can NOT build, which saves you a ton of very frustrating questions while helping users to help themselves. I can not think of a modern, production operating system that lacks Python, unless you get into the embedded / research arena. So, I'm answering to say, you answered your own question :)
0
9,281
false
0
1
Is Python the right hammer for this nail? (build script)
792,680
1
1
0
1
7
0
0.197375
0
Can anyone point to serious comparison of Python runtime footprint versus Java? Thanks, Avraham
0
java,python,footprint,memory-footprint
2009-04-27T20:49:00.000
0
795,241
I can't compare memory footprint because it really depends on classes what you load/use. But what I can tell you that Python (IronPython 2.7 in particular) has real memory leak problems. Especially with third party well used ones like Financial. When Java application/server runs without issues with rare cases which could be identified with common tools Python grows in memory constantly. Memory dumps shows that Python itself as well as most of packages don't pay attention for common classes like String and keep them in different parts of the execution modules. It is hard and unwise to go through all these sources and fix all leaks. I was trying a lot to fix the issues but finally gave in and simply restart application when it reaches some memory threshold.
0
5,256
false
1
1
python versus java runtime footprint
35,581,985
1
2
0
3
6
1
0.291313
0
I have a long-running Python service and I'd like to know how much cumulative wall clock time has been spent by any runnable threads (i.e., threads that weren't blocked for some other reason) waiting for the GIL. Is there an easy way to do this? E.g., perhaps I could periodically dump some counter to its log file. My underlying motivation is to rule out the GIL as a source of mystery response latency from these long-running processes. There is no particular reason to suspect the GIL (other than that it would fit the symptoms), but other forms of logging haven't turned up anything yet, so, if it is easy, it would be nice to have this information.
0
python,multithreading
2009-04-27T21:42:00.000
0
795,405
I don't think there's an easy way. There's probably an awkward way, involving rebuilding Python to traverse the PyThreadState list and count the threads each time the lock is acquired, but I doubt it's worth the effort! I know this is a speculative question but if you are even moderately concerned about there being delays caused by threading it may be prudent to move to a multiprocessing model instead of a multithreading model. Since processes are both safer and more scalable in Python they are almost always the best choice if practical.
0
536
false
0
1
Is there an easy way to tell how much time is spent waiting for the Python GIL?
797,218
8
8
0
17
109
0
1
0
I tried to learn shell(bash) scripting few times but was driven away by the syntax. Then I found Python and was able to do most of the things a shell script can do in Python. I am now not sure whether I should invest my time in learning shell scripting anymore. So I want to ask: What are strengths of shell scripting that make it an indispensable tool as compared to Python? I am not a system administration by profession, but I am interested in setting up Linux systems for home users, hence I think learning shell scripting can become necessary.
0
python,shell
2009-04-28T05:16:00.000
1
796,319
There's nothing you can do with shell scripts that you can't do with python. The big advantage of shell scripts is that you use the same commands as you do when you use the shell, so if you're a heavy shell user, shell scripting will at some point become a very quick and easy way to automate your shell work. I also find it easier to deal with pipes of data in shell scripts than in python, though it's absolutely doable from python. And, finally, you don't have to fire up an additional interpeter to run the shell scripts, giving you a very small, but sometimes maybe noticeable speed and memory usage advantage. But then again, Python scripts are a lot more maintainable, I'm trying to migrate from big ugly shell scripts to Python scripts for that very reason. It's also easier to do exception handling and QA with Python.
0
63,953
false
0
1
Strengths of Shell Scripting compared to Python
796,344
8
8
0
9
109
0
1
0
I tried to learn shell(bash) scripting few times but was driven away by the syntax. Then I found Python and was able to do most of the things a shell script can do in Python. I am now not sure whether I should invest my time in learning shell scripting anymore. So I want to ask: What are strengths of shell scripting that make it an indispensable tool as compared to Python? I am not a system administration by profession, but I am interested in setting up Linux systems for home users, hence I think learning shell scripting can become necessary.
0
python,shell
2009-04-28T05:16:00.000
1
796,319
I agree with most of the previous answers. I consider shell commands most suited to do filesystem-oriented tasks (copy and move files, grep, etc). Shell is better, in my opinion, if you have to read and write to file, since a single >>file.txt redirection appends to file instantly, instead of needing, say, file=open('file.txt','a'); file.write(), etc. Currently, for my personal use, I mix both, creating a python script and calling os.system('command') or os.popen('command') every time some action is easier in shell than in python.
0
63,953
false
0
1
Strengths of Shell Scripting compared to Python
4,980,553
8
8
0
5
109
0
0.124353
0
I tried to learn shell(bash) scripting few times but was driven away by the syntax. Then I found Python and was able to do most of the things a shell script can do in Python. I am now not sure whether I should invest my time in learning shell scripting anymore. So I want to ask: What are strengths of shell scripting that make it an indispensable tool as compared to Python? I am not a system administration by profession, but I am interested in setting up Linux systems for home users, hence I think learning shell scripting can become necessary.
0
python,shell
2009-04-28T05:16:00.000
1
796,319
Another thing to consider when choosing shell scripts of Python is the Python version that will be running on the target machines. RHEL5 (to name one) is going to be around for a long time. RHEL5 is stuck with Python 2.4. There are a lot of nice libraries that depend on functionality added to Python post-2.4.
0
63,953
false
0
1
Strengths of Shell Scripting compared to Python
9,188,834
8
8
0
36
109
0
1
0
I tried to learn shell(bash) scripting few times but was driven away by the syntax. Then I found Python and was able to do most of the things a shell script can do in Python. I am now not sure whether I should invest my time in learning shell scripting anymore. So I want to ask: What are strengths of shell scripting that make it an indispensable tool as compared to Python? I am not a system administration by profession, but I am interested in setting up Linux systems for home users, hence I think learning shell scripting can become necessary.
0
python,shell
2009-04-28T05:16:00.000
1
796,319
The shell makes common and simple actions really simple, at the expense of making more complex things much much more complex. Typically, a small shell script will be shorter and simpler than the corresponding python program, but the python program will tend to gracefully accept modifications, whereas the shell script will tend to get less and less maintainable as code is added. This has the consequence that for optimal day-to-day productivity you need shell-scripting, but you should use it mostly for throwaway scripts, and use python everywhere else.
0
63,953
false
0
1
Strengths of Shell Scripting compared to Python
814,425
8
8
0
58
109
0
1
0
I tried to learn shell(bash) scripting few times but was driven away by the syntax. Then I found Python and was able to do most of the things a shell script can do in Python. I am now not sure whether I should invest my time in learning shell scripting anymore. So I want to ask: What are strengths of shell scripting that make it an indispensable tool as compared to Python? I am not a system administration by profession, but I am interested in setting up Linux systems for home users, hence I think learning shell scripting can become necessary.
0
python,shell
2009-04-28T05:16:00.000
1
796,319
"What are strengths of shell scripting that make it an indispensable tool as compared to Python?" The shell is not indispensable. Why do you think there are so many? bash, tcsh, csh, sh, etc., etc., Python is a shell. Not the one you'd use for running all commands, but for scripting, it's ideal. Python is a more-or-less standard part of all Linux distro's. The more traditional shells do too many things. They have a handy user interface for running commands. This includes one-line commands where the shell searches your PATH, forks and execs the requested program. It also includes pipelines, sequences and concurrent programs (using ;, | and &) as well as some redirection (using > and <). They have a crummy little programming-language-like capability for running scripts. This language is rather hard to use and extremely inefficient. Most statements in this language require forking one or more additional processes, wasting time and memory. Running programs from the shell, redirecting stderr to a log file and that kind of thing is good. Do that in the shell. Almost everything else can be done more efficiently and more clearly as a Python script. You need both. However, you should never write a script with if-statements or loops in a traditional shell language.
0
63,953
false
0
1
Strengths of Shell Scripting compared to Python
797,341
8
8
0
7
109
0
1
0
I tried to learn shell(bash) scripting few times but was driven away by the syntax. Then I found Python and was able to do most of the things a shell script can do in Python. I am now not sure whether I should invest my time in learning shell scripting anymore. So I want to ask: What are strengths of shell scripting that make it an indispensable tool as compared to Python? I am not a system administration by profession, but I am interested in setting up Linux systems for home users, hence I think learning shell scripting can become necessary.
0
python,shell
2009-04-28T05:16:00.000
1
796,319
The shell is available everywhere. If you stick to a relatively basic set of portable functionality, your scripts can run on cell phones, wireless routers, DVRs, netbooks, workstations, big iron servers, and the like. Python is not necessarily included out of the box on lots of systems, and depending on the environment it may be hard to get it installed. Learning some shell scripting can also help you learn some command line tricks, since the command line is, well, the shell. It's also good for taking some fairly long and complicated command line, and converting that into a more general script after you realize you'll need it some more. The shell also has some pretty powerful features; pipelines are a really interesting control construct that is native only to the shell, as far as I know.
0
63,953
false
0
1
Strengths of Shell Scripting compared to Python
796,348
8
8
0
11
109
0
1
0
I tried to learn shell(bash) scripting few times but was driven away by the syntax. Then I found Python and was able to do most of the things a shell script can do in Python. I am now not sure whether I should invest my time in learning shell scripting anymore. So I want to ask: What are strengths of shell scripting that make it an indispensable tool as compared to Python? I am not a system administration by profession, but I am interested in setting up Linux systems for home users, hence I think learning shell scripting can become necessary.
0
python,shell
2009-04-28T05:16:00.000
1
796,319
one doesn't have to learn shell scripting, as all the previous answers indicate; but learning is never a bad thing. it's really a question of personal priorities. it's very hard for someone else to tell you what is and isn't worth your time. most programmers find that learning new languages gets incrementally easier each time. (the same is largely true of natural languages too.) and the earlier you start, the better. plus: having learned a language enables you to extravagantly diss its limitations from a position of complete knowledge and familiarity. this probably won't get you laid, but might earn you a beer from your peers!
0
63,953
false
0
1
Strengths of Shell Scripting compared to Python
3,074,616
8
8
0
95
109
0
1.2
0
I tried to learn shell(bash) scripting few times but was driven away by the syntax. Then I found Python and was able to do most of the things a shell script can do in Python. I am now not sure whether I should invest my time in learning shell scripting anymore. So I want to ask: What are strengths of shell scripting that make it an indispensable tool as compared to Python? I am not a system administration by profession, but I am interested in setting up Linux systems for home users, hence I think learning shell scripting can become necessary.
0
python,shell
2009-04-28T05:16:00.000
1
796,319
Shell scripting has simpler notations for I/O redirection. It is simpler to create pipelines out of existing programs in shell. Shell scripting reuses entire programs. Shell is universally available (on anything like Unix) - Python is not necessarily installed. 'Tis true that you can do everything in Python that you can do in shell; 'tis also true that there are things that are easy in Python that are hard in shell (just as there are things that are easy in shell but hard in Python). Knowing both will be best in the long term.
0
63,953
true
0
1
Strengths of Shell Scripting compared to Python
796,343
1
6
0
2
6
0
0.066568
0
I'm hacking some support for DomainKeys and DKIM into an open source email marketing program, which uses a python script to send the actual emails via SMTP. I decided to go the quick and dirty route, and just write a perl script that accepts an email message from STDIN, signs it, then returns it signed. What I would like to do, is from the python script, pipe the email text that's in a string to the perl script, and store the result in another variable, so I can send the email signed. I'm not exactly a python guru, however, and I can't seem to find a good way to do this. I'm pretty sure I can use something like os.system for this, but piping a variable to the perl script is something that seems to elude me. In short: How can I pipe a variable from a python script, to a perl script, and store the result in Python? EDIT: I forgot to include that the system I'm working with only has python v2.3
0
python,perl,domainkeys,dkim
2009-04-28T14:58:00.000
1
798,413
I'm sure there's a reason you're going down the route you've chosen, but why not just do the signing in Python? How are you signing it? Maybe we could provide some assitance in writing a python implementation?
0
13,888
false
0
1
How to call a Perl script from Python, piping input to it?
798,508
5
14
0
-5
6
0
-1
0
I am looking for RAD like environment for PHP and/or Python free or not does not matter. It should have a visual environment where one can use a point and click interface so that it is possible to select objects with mouse and move them around. I have looked at Delphi4PHP. The RAD part is fantastic, but I don't like the framework on which it is based VCL4PHP (vcl4php.sourceforge.net) is crappy. Just to deploy a simple Hello world application we will have to deploy 40MB of that framework. That is just stupid..... I looked at Eclipse but it is only a code IDE. Does not have a visual way of designing a page/window. Did I miss any plugin that supports this feature? I was suggested to give NetBeans IDE a close look so I also looked that up, but did not find what I wanted. I have also looked up following but none of these are true RAD: NuSphere PHPEd VS PHP for Visual Studio PHP Designer (not a designer by any means just a plain old IDE) I have not been able to find any descent Python RAD tool also. I have looked up Yes Software's Code Charge Studio (www.yessoftware.com) but it cannot be used to develop complicated applications like say for example an Accounting System or an Inventory Management App, etc.. It is useful but for very simple apps. Making changes to Visual part (referred as components by this people) is a nightmare. Finally it does not support Python.
0
php,python,vcl4php
2009-04-29T06:17:00.000
0
801,090
The good news is that you won't miss it as soon as you familiarize yourself with a way of work when the responsibilities are shared. Think it over: really the programmer is the right person to assemble the user interface? I think not even in case of a desktop application. Programmer should write good code, separated display logic, and let all the presentation things to information architects user interface/experience specialists here comes you, to write the code graphic designers sitebuilders The -not so bad- news is that, there is no such tool for PHP and Python.
0
3,848
false
1
1
Looking for a PHP and/or Python RAD
801,196
5
14
0
2
6
0
0.028564
0
I am looking for RAD like environment for PHP and/or Python free or not does not matter. It should have a visual environment where one can use a point and click interface so that it is possible to select objects with mouse and move them around. I have looked at Delphi4PHP. The RAD part is fantastic, but I don't like the framework on which it is based VCL4PHP (vcl4php.sourceforge.net) is crappy. Just to deploy a simple Hello world application we will have to deploy 40MB of that framework. That is just stupid..... I looked at Eclipse but it is only a code IDE. Does not have a visual way of designing a page/window. Did I miss any plugin that supports this feature? I was suggested to give NetBeans IDE a close look so I also looked that up, but did not find what I wanted. I have also looked up following but none of these are true RAD: NuSphere PHPEd VS PHP for Visual Studio PHP Designer (not a designer by any means just a plain old IDE) I have not been able to find any descent Python RAD tool also. I have looked up Yes Software's Code Charge Studio (www.yessoftware.com) but it cannot be used to develop complicated applications like say for example an Accounting System or an Inventory Management App, etc.. It is useful but for very simple apps. Making changes to Visual part (referred as components by this people) is a nightmare. Finally it does not support Python.
0
php,python,vcl4php
2009-04-29T06:17:00.000
0
801,090
I just remenbered some more tools that might be useful to you, besides WebDev: PHPMaker WaveMaker For Python I'm gonna try the DialogBlocks later this evening.
0
3,848
false
1
1
Looking for a PHP and/or Python RAD
801,278
5
14
0
0
6
0
0
0
I am looking for RAD like environment for PHP and/or Python free or not does not matter. It should have a visual environment where one can use a point and click interface so that it is possible to select objects with mouse and move them around. I have looked at Delphi4PHP. The RAD part is fantastic, but I don't like the framework on which it is based VCL4PHP (vcl4php.sourceforge.net) is crappy. Just to deploy a simple Hello world application we will have to deploy 40MB of that framework. That is just stupid..... I looked at Eclipse but it is only a code IDE. Does not have a visual way of designing a page/window. Did I miss any plugin that supports this feature? I was suggested to give NetBeans IDE a close look so I also looked that up, but did not find what I wanted. I have also looked up following but none of these are true RAD: NuSphere PHPEd VS PHP for Visual Studio PHP Designer (not a designer by any means just a plain old IDE) I have not been able to find any descent Python RAD tool also. I have looked up Yes Software's Code Charge Studio (www.yessoftware.com) but it cannot be used to develop complicated applications like say for example an Accounting System or an Inventory Management App, etc.. It is useful but for very simple apps. Making changes to Visual part (referred as components by this people) is a nightmare. Finally it does not support Python.
0
php,python,vcl4php
2009-04-29T06:17:00.000
0
801,090
Let me elaborate on CodeCharge Studio. I think you still can consider this system. Personally, I've been using it to develop very complex high-load data-base driven CRM applications, with 4.x version it even generates AJAX-based code and autocomplete, ajax-form submittion are piece of cake. With CCS you will need sometimes some tuning, but the tricks are pretty much typical. So, CodeCharge Studio is still a choice for complex applications too.
0
3,848
false
1
1
Looking for a PHP and/or Python RAD
1,256,441
5
14
0
1
6
0
0.014285
0
I am looking for RAD like environment for PHP and/or Python free or not does not matter. It should have a visual environment where one can use a point and click interface so that it is possible to select objects with mouse and move them around. I have looked at Delphi4PHP. The RAD part is fantastic, but I don't like the framework on which it is based VCL4PHP (vcl4php.sourceforge.net) is crappy. Just to deploy a simple Hello world application we will have to deploy 40MB of that framework. That is just stupid..... I looked at Eclipse but it is only a code IDE. Does not have a visual way of designing a page/window. Did I miss any plugin that supports this feature? I was suggested to give NetBeans IDE a close look so I also looked that up, but did not find what I wanted. I have also looked up following but none of these are true RAD: NuSphere PHPEd VS PHP for Visual Studio PHP Designer (not a designer by any means just a plain old IDE) I have not been able to find any descent Python RAD tool also. I have looked up Yes Software's Code Charge Studio (www.yessoftware.com) but it cannot be used to develop complicated applications like say for example an Accounting System or an Inventory Management App, etc.. It is useful but for very simple apps. Making changes to Visual part (referred as components by this people) is a nightmare. Finally it does not support Python.
0
php,python,vcl4php
2009-04-29T06:17:00.000
0
801,090
I don't think Yogi is a PITA. He is discerning and this is very helpful. Since none of these tools quite hit the mark for him when one does it will be the right one and then all of us will benefit from his studied decision.
0
3,848
false
1
1
Looking for a PHP and/or Python RAD
4,500,774
5
14
0
1
6
0
0.014285
0
I am looking for RAD like environment for PHP and/or Python free or not does not matter. It should have a visual environment where one can use a point and click interface so that it is possible to select objects with mouse and move them around. I have looked at Delphi4PHP. The RAD part is fantastic, but I don't like the framework on which it is based VCL4PHP (vcl4php.sourceforge.net) is crappy. Just to deploy a simple Hello world application we will have to deploy 40MB of that framework. That is just stupid..... I looked at Eclipse but it is only a code IDE. Does not have a visual way of designing a page/window. Did I miss any plugin that supports this feature? I was suggested to give NetBeans IDE a close look so I also looked that up, but did not find what I wanted. I have also looked up following but none of these are true RAD: NuSphere PHPEd VS PHP for Visual Studio PHP Designer (not a designer by any means just a plain old IDE) I have not been able to find any descent Python RAD tool also. I have looked up Yes Software's Code Charge Studio (www.yessoftware.com) but it cannot be used to develop complicated applications like say for example an Accounting System or an Inventory Management App, etc.. It is useful but for very simple apps. Making changes to Visual part (referred as components by this people) is a nightmare. Finally it does not support Python.
0
php,python,vcl4php
2009-04-29T06:17:00.000
0
801,090
Delphi4PHP is the only I know of, back in the old days I also used Macromedia (now Adobe) Dreamweaver to generate some code, and if you set up a live site it kinda acts like a RAD IDE. Kinda. For Python, I asked a similar question a couple of hours ago, I'm also interested in knowing such tool.
0
3,848
false
1
1
Looking for a PHP and/or Python RAD
801,096
2
5
0
5
4
0
1.2
0
I have two classes: Account and Operator. Account contains a list of Operators. Now, whenever an operator (in the list) receives a message I want to notify Account object to perform some business logic as well. I think of three alternatives on how to achieve this: 1) Hold a reference within Operator to the container [Account] object and call methods directly. Not absolutely good because of circular references. 2) Use events. As far as I know there is no built-in event handling mechanism in Python. So, this one is a bit tricky to implement. 3) Don't send messages to Operators directly. Instead, operate only Accounts, and within them, internally, handler operators. This one is a bit limiting because in this case I cannot pass around references to operators. I wonder which approach is the most advantageous from the architectural point of view. How do you usually handle this task? It would be great if you could point out snippets in Python.
0
python,architecture,containers,notifications
2009-04-29T11:31:00.000
1
801,931
You're over-thinking this. Seriously. Python isn't C++; your concerns are non-issues in Python. Just write what makes sense in your problem domain. " Not absolutely good because of circular references." Why not? Circularity is of no relevance here at all. Bidirectional relationships are great things. Use them. Python garbage collects them just fine without any thinking on your part. What possible problem do you have with mutual (birectional) relationships? "...operate only Accounts, and within them, internally, handler operators. This one is a bit limiting because in this case I cannot pass around references to operators. " What? Your Operators are Python objects, pass all you want. All Python objects are (in effect) references, don't sweat it. What possible problem do you have with manipulating Operator objects?
0
403
true
0
1
Notifying container object: best practices
802,084
2
5
0
3
4
0
0.119427
0
I have two classes: Account and Operator. Account contains a list of Operators. Now, whenever an operator (in the list) receives a message I want to notify Account object to perform some business logic as well. I think of three alternatives on how to achieve this: 1) Hold a reference within Operator to the container [Account] object and call methods directly. Not absolutely good because of circular references. 2) Use events. As far as I know there is no built-in event handling mechanism in Python. So, this one is a bit tricky to implement. 3) Don't send messages to Operators directly. Instead, operate only Accounts, and within them, internally, handler operators. This one is a bit limiting because in this case I cannot pass around references to operators. I wonder which approach is the most advantageous from the architectural point of view. How do you usually handle this task? It would be great if you could point out snippets in Python.
0
python,architecture,containers,notifications
2009-04-29T11:31:00.000
1
801,931
There is no "one-size-fits-all" solution for the Observer pattern. But usually, it's better to define an EventManager object where interested parties can register themselves for certain events and post these events whenever they happen. It simply creates less dependencies. Note that you need to use a global EventManager instance, which can be problematic during testing or from a general OO point of view (it's a global variable). I strongly advise against passing the EventManager around all the time because that will clutter your code. In my own code, the "key" for registering events is the class of the event. The EventManager uses a dictionary (event class -> list of observers) to know which event goes where. In the notification code, you can then use dict.get(event.__class__, ()) to find your listeners.
0
403
false
0
1
Notifying container object: best practices
802,031
1
3
0
2
1
1
0.132549
0
I have one script in Perl and the other in Python. I need to get the results of Perl in Python and then give the final report. The results from Perl can be scalar variable, hash variable, or an array. Please let me know as soon as possible regarding this.
0
python,perl
2009-04-30T02:39:00.000
0
805,160
You could serialize the results to some sort of a string format, print this to standard output in the Perl script. Then, from python call the perl script and redirect the results of stdout to a variable in python.
0
1,453
false
0
1
How can I get the results of a Perl script in Python script?
805,185
10
16
0
12
24
0
1
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
Using C++ is likely to result in a radically faster application than PHP, Perl or Python and somewhat faster than C# or Java - unless it spends most of its time waiting for the DB, in which case there won't be a difference. This is actually the most common case. On the other hand, due to the reasons benhoyt mentioned, developing a web app in C++ will take longer and will be harder to maintain. Furthermore, it's far more likely to contain serious security holes (nowadys everyone worries most about SQL injection and XSS - but if they were writing their webapps in C++ it would be buffer overflows and it would be their entire networks getting p0wned rather than just the data). And that's why almost nobody writes web apps in C++ these days.
0
16,655
false
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
806,037
10
16
0
23
24
0
1.2
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
Several years ago, I more or less learned web app programming on the job. C was the main language I knew, so I wrote the (fairly large-scale) web app in C. Bad mistake. C's string handling and memory management is tedious, and together with my lack of experience in web apps, it quickly became a hard-to-maintain project. C++ would be significantly better, mainly because std::string is much nicer than char*. However, now I'd use Python every time (though PHP is not a terrible choice, and perhaps easier to get started with). Python's string handling is awesome, and it handles Unicode seamlessly. Python has much better web tools and frameworks than C++, and its regex handling and standard libraries (urllib, email, etc) work very well. And you don't have to worry about memory management. I'd probably only use C or C++ for a web app if I was severely RAM-constrained (like on an embedded micro) or if I worked at Google and was coding a search engine that was going to have to respond to thousands of queries per second.
0
16,655
true
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
806,004
10
16
0
6
24
0
1
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
If you want to be able to implement web services in an existing running process (e.g. daemon), which is written in C/C++. It makes sense to make that process implement the FastCGI protocol for that interface. Get Apache to deal with HTTP (2-way SSL etc) to the outside world and field requests through FastCGI through a socket. If you do this in PHP, you have to get PHP to talk to your process, which means maintaining PHP code as well as your process.
0
16,655
false
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
806,257
10
16
0
2
24
0
0.024995
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
You can use FastCGI with PHP/Python/Ruby/Perl to get runtime performance that should be enough until your site grows really big. And even then, you can make architectural improvements (database tuning, caching etc) to scale even more without abandoning scripting languages. Some pretty large sites are done in PHP/Python/Ruby/Perl. The big gain you get by using high-level languages is programmer performance. And that is what you should worry about first. It will be more important to respond quickly to feature demands from users, than to trim some milliseconds off the page response time.
0
16,655
false
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
806,042
10
16
0
3
24
0
0.037482
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
There is a middle ground here. Python (and I believe Perl and Ruby) allow you to call functions from C. 99 times out of 100, you won't need to. But it's nice to know that the option is there if you need it. Usually for webapps, the speed of the programming language simply isn't an issue. In the time it takes to execute a single database query, a processor can execute a few billion instructions. It's about the same for sending and receiving http data.
0
16,655
false
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
806,988
10
16
0
7
24
0
1
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
The question is "where's the value created?" If you think the value is created in Memory management, careful class design and getting the nightly build to work, then use C++. You'll get to spend lots of time writing a lot of code to do important things like deleting objects that are no longer referenced. If you think the value is in deploying applications that people can use, then use Python with the Django framework. The Django tutorial shows you that within about 20 minutes you can have an application up and running. It's production-ready, and you could focus on important things: The model. Just write the model in Python, and the ORM layer handles all of the database interaction for you. No SQL. No manual mapping. The presentation. Just design your pages in HTML with a few {{}} "fill in a value here" and a few {% for thing in object_list %} constructs and your pages are ready to go. No string manipulation. The view functions. Write simple Python functions to encapsulate the processing part of your site. Not validation (those are in forms), not presentation (that was in the templates), not the underlying model (that was in the model classes), but a little bit of authorization checking, query processing and response formulation. Since Python has a rich set of collection classes, this code winds up being very short and to the point. Other stuff. URL mappings are Python regexes. Forms are matched to your model; you can subclass the defaults to add customized input validation and processing. Wonderful unit testing framework for low-level model features as well as end-to-end operations. No memory management, no scrupulous class design with abstracts and interfaces. No worrying about how to optimize string manipulation. No nightly build. Just create the stuff of real value.
0
16,655
false
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
806,293
10
16
0
2
24
0
0.024995
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
Well... You will save memory and CPU power with C/C++ vs Python/Perl/Ruby/Java/.NET. If the resources saved by using C/C++ represents a large fraction of the total resources available (a FastCGI running on the embedded board of a robot), then yeah, C/C++. Else, why bother ?
0
16,655
false
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
1,470,204
10
16
0
1
24
0
0.012499
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
C++ is a strongly typed language...i.e. you can declare ints, floats, etc....generally you can program more efficiently than you can with weakly typed languages. Facebook reported a 50% improvement when switching from PHP to C++. I would consider scripting languages to be prototyping languages...when you want production level efficiency use a compiled language.
0
16,655
false
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
9,231,448
10
16
0
0
24
0
0
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
My every search through Google indicates C/C++ gives best performance for web apps that need functionality such as searching for information in web pages or getting information from a database.
0
16,655
false
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
9,242,626
10
16
0
1
24
0
0.012499
0
What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks).
0
php,c++,python,perl,fastcgi
2009-04-30T08:43:00.000
0
805,957
Too bad there are no benchmarks of C/C++ vs Perl CGI. Without FastCGI I think C/C++ would be a lot faster, with FastCGI possibly it'll be faster (but maybe a little less - all the initialization part is executed once). Again this is very application dependent, so some sort of benchmarks for different dynamic web pages should be provided. Personally I think that if your company has resources it should/could invest in C/C++ (given that they have to find proper ones...), otherwise is better to stick to a scripting language. Naturally if you want to deploy fast applications you should use C/C++. At the end of the day the compiled language is faster. But probably finding good C/C++ devs is hard nowdays? Cheers,
0
16,655
false
0
1
FastCGI C++ vs. A Script Language (PHP/Python/Perl)
1,321,663
4
5
0
5
4
1
1.2
0
I have a lot of python unit tests for a project and it's getting to the point where it takes a long time to run them. I don't want to add more because I know they're going to make things slower. How do people solve this problem? Is there any easy way to distribute the test execution over a cluster?
0
python,unit-testing
2009-04-30T23:25:00.000
0
809,564
You can't frequently run all your tests, because they're too slow. This is an inevitable consequence of your project getting bigger, and won't go away. Sure, you may be able to run the tests in parallel and get a nice speedup, but the problem will just come back later, and it'll never be as it was when your project was small. For productivity, you need to be able to code, and run relevant unit tests and get results within a few seconds. If you have a hierarchy of tests, you can do this effectively: run the tests for the module you're working on frequently, the tests for the component you're working on occasionally, and the project-wide tests infrequently (perhaps before you're thinking of checking it in). You may have integration tests, or full system tests which you may run overnight: this strategy is an extension of that idea. All you need to do to set this up is to organize your code and tests to support the hierarchy.
0
1,201
true
0
1
distributed/faster python unit tests
814,552
4
5
0
3
4
1
0.119427
0
I have a lot of python unit tests for a project and it's getting to the point where it takes a long time to run them. I don't want to add more because I know they're going to make things slower. How do people solve this problem? Is there any easy way to distribute the test execution over a cluster?
0
python,unit-testing
2009-04-30T23:25:00.000
0
809,564
See py.test, which has the ability to pass unit tests off to a group of machines, or Nose, which (as of trunk, not the currently released version) supports running tests in parallel with the multiprocessing module.
0
1,201
false
0
1
distributed/faster python unit tests
811,222
4
5
0
1
4
1
0.039979
0
I have a lot of python unit tests for a project and it's getting to the point where it takes a long time to run them. I don't want to add more because I know they're going to make things slower. How do people solve this problem? Is there any easy way to distribute the test execution over a cluster?
0
python,unit-testing
2009-04-30T23:25:00.000
0
809,564
While coding, only run the tests of the class that You have just changed, not all the tests in the whole project. Still, it is a good practice to run all tests before You commit Your code (but the Continuous Integration server can do it for You).
0
1,201
false
0
1
distributed/faster python unit tests
810,002
4
5
0
2
4
1
0.07983
0
I have a lot of python unit tests for a project and it's getting to the point where it takes a long time to run them. I don't want to add more because I know they're going to make things slower. How do people solve this problem? Is there any easy way to distribute the test execution over a cluster?
0
python,unit-testing
2009-04-30T23:25:00.000
0
809,564
Profile them to see what really is slow. You may be able to solve this problem with out distribution. If the tests are truly unit tests then I see not many problems with running the tests across multiple execution engines.
0
1,201
false
0
1
distributed/faster python unit tests
809,629
1
4
0
0
1
1
0
0
I'm interested in learning python to have access to a more agile language for writing tests in my .NET projects. Is IronPython mature enough for these purposes yet? I'm content with writing tests in C#, but find dynamic languages like ruby and python very attractive. Would it be better to forgo IronPython while learning, and stick to the official version 3 distribution? I'd be interested to hear from anyone that has had success writing tests for a .net project in ironruby or ironpython. Edit: reworked my question to address the real issue about using dynamic languages for TDD in .NET - the version issue isn't as important. Apologies for the poorly worded question.
0
.net,tdd,ironpython
2009-05-01T00:32:00.000
0
809,737
What I've found however, is that IronPython to the best of my knowledge appears to be based on Python v2, while many of the learning resources available on the web are focused on Python v3. I don't know what resources you've been looking at, but the majority of them are for v2.
0
314
false
0
1
Learning Python on Windows for TDD
809,754
3
4
0
3
21
1
0.148885
0
What is the biggest software development team that uses Python? I am wondering how well the dynamic type system scales to large development teams. It's pretty clear that at Google they have C++ and Java codebases with thousands of developers; their use of Python is much smaller. Are there some huge companies that develop primarily in Python?
0
python
2009-05-01T03:24:00.000
0
810,055
Python is very powerful language, Many big and the very high ranked websites are built on python.. Some big products of python are:- Google (extensively used) Youtube (extensively used) Disqus Eventbrite Pinterest Reddit Quora Mozilla Asana (extensively used) Dropbox (started with python, stayed with python) Even Many companies are shifting their websites from PHP to Python, Because of its efficiency, fast ability, and reliability, and availability of huge support and many good frameworks such as Django.. Moreover, I am not saying that PHP is not a good server side scripting language, But truth is that, most users are adapting python instead of PHP.
0
22,280
false
0
1
Biggest python projects
40,535,335
3
4
0
12
21
1
1
0
What is the biggest software development team that uses Python? I am wondering how well the dynamic type system scales to large development teams. It's pretty clear that at Google they have C++ and Java codebases with thousands of developers; their use of Python is much smaller. Are there some huge companies that develop primarily in Python?
0
python
2009-05-01T03:24:00.000
0
810,055
Among many other Python-centered companies, beyond the ones already mentioned by Unknown, I'd mention big pharma firms such as Astra-Zeneca, film studios such as Lucasfilm, and research places such as NASA, Caltech, Lawrence Livermore NRL. Among the sponsors of Pycon Italia Tre (next week in Firenze, IT -- see www.pycon.it) are Qt/Trolltech (a wholly owned subsidiary of Nokia), Google of course, Statpro, ActiveState, Wingware -- besides, of course, several Italian companies. Among the sponsors of Pycon US in Chicago in March were (of course) Google, as well as Sun Microsystems, Microsoft, Slide.com, Walt Disney Animation Studios, Oracle, Canonical, VMWare -- these are all companies who thought it worthwhile to spend money in order to have visibility to experienced Pythonistas, so presumably ones making significant large-scale use of Python (and in most cases trying to hire experienced Python developers in particular).
0
22,280
false
0
1
Biggest python projects
810,240
3
4
0
8
21
1
1
0
What is the biggest software development team that uses Python? I am wondering how well the dynamic type system scales to large development teams. It's pretty clear that at Google they have C++ and Java codebases with thousands of developers; their use of Python is much smaller. Are there some huge companies that develop primarily in Python?
0
python
2009-05-01T03:24:00.000
0
810,055
Our project is over 30,000 lines of Python. That's probably small by some standards. But it's plenty big enough to fill my little brain. The application is mentioned in our annual report, so it's "strategic" in that sense. We're not a "huge" company, so we don't really qualify. A "huge company" (Fortune 1000?) doesn't develop primarily in any single language. Large companies will have lots of development teams, each using a different technology, depending on -- well -- on nothing in particular. When you get to "epic companies" (Fortune 10) you're looking at an organization that's very much like a conglomerate of several huge companies rolled together. Each huge company within an epic company is still a huge company with multiple uncoordinated IT shops doing unrelated things -- there's no "develop primarily in" any particular language or toolset. Even for "large companies" and "small companies" (like ours) you still have fragmentation. Our in-house IT is mostly Microsoft. Our other product development is mostly Java. My team, however, doesn't have much useful specification, so we use Python. We use python because of the duck typing and dynamic programming features. (I don't know what a dynamic type system is -- Python types are static -- when you create an object, its type can never change.) Since no huge company develops primarily in any particular language or toolset, the trivial answer to your question is "No" for any language or tool. And No for Python in particular.
0
22,280
false
0
1
Biggest python projects
810,992
3
4
0
28
28
0
1
0
It seems that Python 2.6.1 doesn't compile bz2 library by default from source. I don't have lib-dynload/bz2.so What's the quickest way to add it (without installing Python from scratch)? OS is Linux 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+tg+++opt+c8+gr2b-v6.194 #1 SMP Tue Jun 6 15:52:09 PDT 2006 i686 GNU/Linux IIRC I used only --prefix flag.
0
python,c,compiler-construction
2009-05-01T19:03:00.000
1
812,781
Use your vendor's package management to add the package that contains the development files for bz2. It's usually a package called "libbz2-dev". E.g. on Ubuntu sudo apt-get install libbz2-dev
0
40,171
false
0
1
Python's bz2 module not compiled by default
813,744
3
4
0
33
28
0
1.2
0
It seems that Python 2.6.1 doesn't compile bz2 library by default from source. I don't have lib-dynload/bz2.so What's the quickest way to add it (without installing Python from scratch)? OS is Linux 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+tg+++opt+c8+gr2b-v6.194 #1 SMP Tue Jun 6 15:52:09 PDT 2006 i686 GNU/Linux IIRC I used only --prefix flag.
0
python,c,compiler-construction
2009-05-01T19:03:00.000
1
812,781
You need libbz2.so (the general purpose libbz2 library) properly installed first, for Python to be able to build its own interface to it. That would typically be from a package in your Linux distro likely to have "libbz2" and "dev" in the package name.
0
40,171
true
0
1
Python's bz2 module not compiled by default
813,112
3
4
0
9
28
0
1
0
It seems that Python 2.6.1 doesn't compile bz2 library by default from source. I don't have lib-dynload/bz2.so What's the quickest way to add it (without installing Python from scratch)? OS is Linux 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+tg+++opt+c8+gr2b-v6.194 #1 SMP Tue Jun 6 15:52:09 PDT 2006 i686 GNU/Linux IIRC I used only --prefix flag.
0
python,c,compiler-construction
2009-05-01T19:03:00.000
1
812,781
If you happen to be trying to compile Python on RHEL5 the package is called bzip2-devel, and if you have RHN set up it can be installed with this command: yum install bzip2-devel Once that is done, you don't need either of the --enable-bz2 or --with-bz2 options, but you might need --enable-shared.
0
40,171
false
0
1
Python's bz2 module not compiled by default
6,848,047
1
7
0
-2
83
0
-0.057081
0
What is the easiest way to do the equivalent of rm -rf in Python?
0
python
2009-05-02T04:52:00.000
0
814,167
shutil.rmtree() is right answer, but just look at another useful function - os.walk()
0
31,538
false
0
1
Easiest way to rm -rf in Python
814,535
3
7
0
2
2
0
0.057081
0
In order to be able to detect RT of a particular tweet, I plan to store hashes of each formatted tweet in the database. What hashing algorithm should I use. Cryptic is of course not essential. Just a minimal way of storing a data as something which can then be compared if it is the same, in an efficient way. My first attempt at this was by using md5 hashes. But I figured there can be hashing algorithms that are much more efficient, as security is not required.
0
python,hash,twitter,md5
2009-05-02T18:17:00.000
0
815,313
There are a few issues here. First, RT's are not always identical. Some people add a comment. Others change the URL for tracking. Others add in the person that they are RT'ing (which may or may not be the originator). So if you are going to hash the tweet, you need to boil it down to the meat of the tweet, and only hash that. Good luck. Above, someone mentioned that with 32-bits, you will start having collisions at about 65K tweets. Of course, you could have collisions on tweet #2. But I think the author of that comment was confused, since 2^16 = ~65K, but 2^32 = ~4 Trillion. So you have a little more room there. A better algorithm might be to try to derive the "unique" parts of the tweet, and fingerprint it. It's not a hash, it's a fingerprint of a few key words that define uniqueness.
0
798
false
0
1
Detecting Retweets using computationally inexpensive Python hashing algorithms
1,139,680
3
7
0
6
2
0
1
0
In order to be able to detect RT of a particular tweet, I plan to store hashes of each formatted tweet in the database. What hashing algorithm should I use. Cryptic is of course not essential. Just a minimal way of storing a data as something which can then be compared if it is the same, in an efficient way. My first attempt at this was by using md5 hashes. But I figured there can be hashing algorithms that are much more efficient, as security is not required.
0
python,hash,twitter,md5
2009-05-02T18:17:00.000
0
815,313
Do you really need to hash at all? Twitter messages are short enough (and disk space cheap enough) that it may be better to just store the whole message, rather than eating up clock cycles to hash it.
0
798
false
0
1
Detecting Retweets using computationally inexpensive Python hashing algorithms
815,317
3
7
0
0
2
0
1.2
0
In order to be able to detect RT of a particular tweet, I plan to store hashes of each formatted tweet in the database. What hashing algorithm should I use. Cryptic is of course not essential. Just a minimal way of storing a data as something which can then be compared if it is the same, in an efficient way. My first attempt at this was by using md5 hashes. But I figured there can be hashing algorithms that are much more efficient, as security is not required.
0
python,hash,twitter,md5
2009-05-02T18:17:00.000
0
815,313
You are trying to hash a string right? Builtin types can be hashed right away, just do hash("some string") and you get some int. Its the same function python uses for dictonarys, so it is probably the best choice.
0
798
true
0
1
Detecting Retweets using computationally inexpensive Python hashing algorithms
817,731
2
5
0
1
0
1
0.039979
0
I've just finished writing a web server in C#. Its pretty basic and only serves static content like html, xml, and images at the moment. I would like to implement a dynamic language, however. I'm trying to choose between one of the following: ASP.NET PHP Python I'd prefer to implement PHP or Python because I am much more familiar with those, however I would like to implement whichever might be easiest. How would I go about adding this functionality to my server, and which of the three languages would be the easiest to implement? EDIT: this is not about what language i want to do web programing in, this is about what language i want to let people who use the server program in. I would like to be able for the server to serve applications written in either asp.net, PHP or Python.
0
php,asp.net,python,webserver
2009-05-02T19:25:00.000
0
815,446
Have you considered boo? It has a very configurable compiler and there are some good OSS examples out there (for example the brail view engine for Monorail & ASP.NET MVC).
0
1,357
false
0
1
C# Web Server: Implementing a Dynamic Language
815,457
2
5
0
1
0
1
0.039979
0
I've just finished writing a web server in C#. Its pretty basic and only serves static content like html, xml, and images at the moment. I would like to implement a dynamic language, however. I'm trying to choose between one of the following: ASP.NET PHP Python I'd prefer to implement PHP or Python because I am much more familiar with those, however I would like to implement whichever might be easiest. How would I go about adding this functionality to my server, and which of the three languages would be the easiest to implement? EDIT: this is not about what language i want to do web programing in, this is about what language i want to let people who use the server program in. I would like to be able for the server to serve applications written in either asp.net, PHP or Python.
0
php,asp.net,python,webserver
2009-05-02T19:25:00.000
0
815,446
If you implement a cgi interface, you could use any kind of backend language. If you want to get fancy, you could consider looking into fastcgi.
0
1,357
false
0
1
C# Web Server: Implementing a Dynamic Language
815,550
9
13
1
14
10
0
1.2
0
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
0
python,ruby,mobile,operating-system,dynamic-languages
2009-05-03T03:09:00.000
0
816,212
In general it's all of these things. Memory, speed, and probably most importantly programmer familiarity. Apple has a huge investment in Objective C, Java is known by basically everyone, and C# is very popular as well. If you're trying for mass programmer appeal it makes sense to start with something popular, even if it's sort of boring. There aren't really any technical requirements stopping it. We could write a whole Ruby stack and let the programmer re-implement the slow bits in C and it wouldn't be that big of a deal. It would be an investment for whatever company is making the mobile OS, and at the end of the day I'm not sure they gain as much from this. Finally, it's the very beginning of mobile devices. In 5 years I wouldn't be at all surprised to see a much wider mobile stack.
0
3,120
true
1
1
Python/Ruby as mobile OS
816,248
9
13
1
0
10
0
0
0
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
0
python,ruby,mobile,operating-system,dynamic-languages
2009-05-03T03:09:00.000
0
816,212
webOS -- the new OS from Palm, which will debut on the Pre -- has you write apps against a webkit runtime in JavaScript. Time will tell how successful it is, but I suspect it will not be the first to go down this path. As mobile devices become more powerful, you'll see dynamic languages become more prevalent.
0
3,120
false
1
1
Python/Ruby as mobile OS
817,560
9
13
1
0
10
0
0
0
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
0
python,ruby,mobile,operating-system,dynamic-languages
2009-05-03T03:09:00.000
0
816,212
Memory is also a significant factor. It's easy to eat memory in Python, unfortunately.
0
3,120
false
1
1
Python/Ruby as mobile OS
816,228
9
13
1
0
10
0
0
0
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
0
python,ruby,mobile,operating-system,dynamic-languages
2009-05-03T03:09:00.000
0
816,212
There is a linux distribution for OpenMoko Freerunner called SHR. Most of its settings and framework code is written in python and... well, it isn't very fast. It is bearable, but it was planned from the beginning to rewrite it in Vala. On the other side, my few smallish apps work fast enough (with the only drawback having big startup time) to consider python to develop user applications. For the record: Freerunner has ARM-something 400MHz and 128MB of RAM. I guess that once mobile devices cross 1GHz, languages like Python will be fast enough for middle-level stuff too (the low-level being the kernel).
0
3,120
false
1
1
Python/Ruby as mobile OS
1,077,315
9
13
1
1
10
0
0.015383
0
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
0
python,ruby,mobile,operating-system,dynamic-languages
2009-05-03T03:09:00.000
0
816,212
I think that performance concerns may be part of, but not all of, the reason. Mobile devices do not have very powerful hardware to work with. I am partly unsure about this, though.
0
3,120
false
1
1
Python/Ruby as mobile OS
816,225
9
13
1
1
10
0
0.015383
0
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
0
python,ruby,mobile,operating-system,dynamic-languages
2009-05-03T03:09:00.000
0
816,212
One of the most pressing matters is garbage collection. Garbage collection often times introduce unpredictable pauses in embedded machines which sometimes need real time performance. This is why there is a Java Micro Edition which has a different garbage collector which reduces pauses in exchange for a slower program. Refcounting garbage collectors (like the one in CPython) are also less prone to pauses but can explode when data with many nested pointers (like a linked list) get deleted.
0
3,120
false
1
1
Python/Ruby as mobile OS
816,233
9
13
1
0
10
0
0
0
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
0
python,ruby,mobile,operating-system,dynamic-languages
2009-05-03T03:09:00.000
0
816,212
There are many reasons. Among them: business reasons, such as software lock-in strategies, efficiency: dynamic languages are usually perceived to be slower (and in some cases really are slower, or at least provide a limit to the amount of optimsation you can do. On a mobile device, optimising code is necessary much more often than on a PC), and tend to use more memory, which is a significant issue on portable devices with limited memory and little cache,, keeping development simple: a platform that supports say Python and Ruby and Java out of the box: means thrice the work to write documentation and provide support, divides development effort into three; it takes longer for helpful material to appear on the web and there are less developers who use the same language as you on your platform, requires more storage on the device to support all these languages, management need to be convinced. I've always felt that the merits of Java are easily explained to a non-technical audience. .Net and Obj-C also seem a very natural choice for a Microsoft and Apple platform, respectively.
0
3,120
false
1
1
Python/Ruby as mobile OS
816,266
9
13
1
1
10
0
0.015383
0
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
0
python,ruby,mobile,operating-system,dynamic-languages
2009-05-03T03:09:00.000
0
816,212
Jailbroken iPhones can have python installed, and I actually use python very frequently on mine.
0
3,120
false
1
1
Python/Ruby as mobile OS
816,219
9
13
1
0
10
0
0
0
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
0
python,ruby,mobile,operating-system,dynamic-languages
2009-05-03T03:09:00.000
0
816,212
I suspect the basic reason is a combination of security and reliability. You don't want someone to be easily able to hack the phone, and you want to have some control over what's being installed.
0
3,120
false
1
1
Python/Ruby as mobile OS
816,217
4
6
0
3
12
0
0.099668
0
I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I either need a solution to ensure a user couldn't compromise any other files or inject malicious code via their uploaded script or a solution for client-side execution of the game. Any suggestions? (I'm looking for a solution that will work with my Python scripts)
0
python,cgi
2009-05-04T00:20:00.000
0
818,402
Yes. Allow them to script their client, not your server.
0
1,115
false
1
1
Letting users upload Python scripts for execution
818,405
4
6
0
4
12
0
0.132549
0
I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I either need a solution to ensure a user couldn't compromise any other files or inject malicious code via their uploaded script or a solution for client-side execution of the game. Any suggestions? (I'm looking for a solution that will work with my Python scripts)
0
python,cgi
2009-05-04T00:20:00.000
0
818,402
Along with other safeguards, you can also incorporate human review of the code. Assuming part of the experience is reviewing other members' solutions, and everyone is a python developer, don't allow new code to be activated until a certain number of members vote for it. Your users aren't going to approve malicious code.
0
1,115
false
1
1
Letting users upload Python scripts for execution
818,558
4
6
0
1
12
0
0.033321
0
I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I either need a solution to ensure a user couldn't compromise any other files or inject malicious code via their uploaded script or a solution for client-side execution of the game. Any suggestions? (I'm looking for a solution that will work with my Python scripts)
0
python,cgi
2009-05-04T00:20:00.000
0
818,402
PyPy is probably a decent bet on the server side as suggested, but I'd look into having your python backend provide well defined APIs and data formats and have the users implement the AI and logic in Javascript so it can run in their browser. So the interaction would look like: For each match/turn/etc, pass data to the browser in a well defined format, provide a javascript template that receives the data and can implement logic, and provide web APIs that can be invoked by the client (browser) to take the desired actions. That way you don't have to worry about security or server power.
0
1,115
false
1
1
Letting users upload Python scripts for execution
819,227
4
6
0
0
12
0
1.2
0
I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I either need a solution to ensure a user couldn't compromise any other files or inject malicious code via their uploaded script or a solution for client-side execution of the game. Any suggestions? (I'm looking for a solution that will work with my Python scripts)
0
python,cgi
2009-05-04T00:20:00.000
0
818,402
Have an extensive API for the users and strip all other calls upon upload (such as import statements). Also, strip everything that has anything to do with file i/o. (You might want to do multiple passes to ensure that you didn't miss anything.)
0
1,115
true
1
1
Letting users upload Python scripts for execution
878,455
1
2
0
6
3
0
1
0
I have one Python module that can be called by a CGI script (passing it information from a form) or from the command line (passing it options and arguments from the command line). Is there a way to establish if the module has been called from the CGI script or from the command line ??
0
python,cgi
2009-05-04T08:08:00.000
0
819,217
This is a really bad design idea. Your script should be designed to work independently of how it's called. The calling programs should provide a uniform environment. You'll be happiest if you design your scripts to work in exactly one consistent way. Build things like this. myscript.py - the "real work" - defined in functions and classes. myscript_cgi.py - a CGI interface that imports myscript and uses the classes and functions. myscript_cli.py - the command-line interface that parses the command-line options, imports myscript, and uses the classes and functions. A single script that does all three things (real work, cgi interface, cli interface) is usually a mistake.
0
308
false
0
1
Python, who is calling my python module
819,618
1
4
0
1
3
1
0.049958
0
Python is so dynamic that it's not always clear what's going on in a large program, and looking at a tiny bit of source code does not always help. To make matters worse, editors tend to have poor support for navigating to the definitions of tokens or import statements in a Python file. One way to compensate might be to write a special profiler that, instead of timing the program, would record the runtime types and paths of objects of the program and expose this data to the editor. This might be implemented with sys.settrace() which sets a callback for each line of code and is how pdb is implemented, or by using the ast module and an import hook to instrument the code, or is there a better strategy? How would you write something like this without making it impossibly slow, and without runnning afoul of extreme dynamism e.g side affects on property access?
0
python,profiling
2009-05-05T02:52:00.000
0
823,103
What if you monkey-patched object's class or another prototypical object? This might not be the easiest if you're not using new-style classes.
0
235
false
0
1
What's the best way to record the type of every variable assignment in a Python program?
823,117
1
6
0
8
8
1
1.2
0
I'm importing a module which raises the following error in some conditions: RuntimeError: pyparted requires root access I know that I can just check for root access before the import, but I'd like to know how to catch this spesific kind of error via a try/except statement for future reference. Is there any way to differentiate between this RuntimeError and others that might be raised?
0
python,exception-handling,try-catch,runtime-error
2009-05-05T17:01:00.000
0
825,909
I know that I can just check for root access before the import, but I'd like to know how to catch this spesific kind of error via a try/except statement for future reference. Is there any way to differentiate between this RuntimeError and others that might be raised? If the error is caused by a specific condition, then I think the easiest way to catch the error is to test for the condition, and you can raise a more specific error yourself. After all the 'error' exists before the error is thrown, since in this case its a problem with the environment. I agree with those above - text matching on an error is kind of a terrifying prospect.
0
24,955
true
0
1
Catch only some runtime errors in Python
826,144
1
2
0
2
2
0
1.2
0
How does one test a method that does some interactions with the local D-Bus (accessing a HAL object)? Results of tests will differ depending on the system that the test is run on, so I don't know how to provide the method reliable input. I'm working in Python, by the way.
0
python,unit-testing,dbus,hal
2009-05-05T22:56:00.000
0
827,295
If you can not mock the environment then it's probably impossible for you to write the test. If your access to HAL/D-Bus is via an object and you provide a mock instance to your test then it should be possible to emulate the necessary inputs to your test from the mock implementation.
0
441
true
0
1
Unit testing for D-Bus and HAL?
827,391
2
7
0
3
4
0
0.085505
0
I have been playing around with Python's FTP library and am starting to think that it is too slow as compared to using a script file in DOS? I run sessions where I download thousands of data files (I think I have over 8 million right now). My observation is that the download process seems to take five to ten times as long in Python than it does as compared to using the ftp commands in the DOS shell. Since I don't want anyone to fix my code I have not included any. I am more interested in understanding if my observation is valid or if I need to tinker more with the arguments.
0
python,ftp,performance,dos
2009-05-07T14:05:00.000
0
834,840
FTPlib may not be the cleanest Python API, I don't think it so bad that it run ten times slower than a DOS shell script. Unless you do not provide any code to compare, e.g you shell and you python snippet to batch dl 5000 files, I can't see how we can help you.
0
8,009
false
0
1
Python's FTPLib too slow?
834,923
2
7
0
4
4
0
0.113791
0
I have been playing around with Python's FTP library and am starting to think that it is too slow as compared to using a script file in DOS? I run sessions where I download thousands of data files (I think I have over 8 million right now). My observation is that the download process seems to take five to ten times as long in Python than it does as compared to using the ftp commands in the DOS shell. Since I don't want anyone to fix my code I have not included any. I am more interested in understanding if my observation is valid or if I need to tinker more with the arguments.
0
python,ftp,performance,dos
2009-05-07T14:05:00.000
0
834,840
The speed problem is probably in your code. FTPlib is not 10 times slower.
0
8,009
false
0
1
Python's FTPLib too slow?
835,474
3
4
0
1
0
0
0.049958
0
I am writing a server-client application to receive user message and publish it. Thinking about authentication method. Asymmetric encryption, probably RSA. Hash (salt+password+'msg'+'userid'), SHA256 HMAC, SHA256. seems to be more secured than the method 2. Also involve hashing the password and msg data. Symmetric Encryption of the 'msg' with static password stored on both sides, probably AES. There is no need for encryption as the msg would be publish online anyway. So I am more lean to the HMAC or PKI method. I'm using java to send the request (including whatever authentication method to be implemented) www.mysite.com/foo?userid=12345&msg=hello&token=abc1234 python on the server side to receive request and make sure the request is from the valid user. The problems are in integration and make sure both sides understand each other's authentication token. It is a big factor for me. And the availability of the libraries available on both language are taken into account as well. Or I can choose to rewrite the server side into java. (Why not python? The client side application need to be in java) What do you think? EDIT: I would not treat this as a web application. The application does not serve any webpage. Most of the operations are not related to the web. Just the client-server communication go through internet. And sending POST/GET via HTTP is what I thought of as the simpler albeit insecure way to do it. Feel free to suggest me any other alternative. SSL is a secure way for encryption. But it does not prevent attacker from sending message to the server impose as the user. Anyone can initiate a HTTPS connection. And the content of the communication does not need to be encrypted. It will be published online by the server anyway. What I need is a way to authenticate the message and sender. For now I am lean to HMAC algorithm. RSA would be more secure but it comes with more developer efforts as well. Will see how it goes. Thank you.
0
java,python,authentication,encryption,hash
2009-05-07T14:22:00.000
0
834,932
Let me just add a few random thoughts/comments to your proposals. RSA: Since you are mainly interested in authentication, I assume you'd want to use RSA signatures. This would imply that each user needs his own privat key. To me that sounds a little bit like overkill, especially when user and server already share common secrets (i.e., passwords). Using SHA256 is a good approach. I have some problems to understand why you include a salt, since a salt is commonly use to avoid that an attacker precomputes hashes of dictionaries. To be clear: dicitionary attacks are a problem here. An attacker could try to hash messages with all passwords from a dictionary. Just he has to reapeat this attack for each user and can't reuse precomputed values. One way to make such an attack a little more difficult is called key strengthening, e.g. by reapeatedly hashing the result n times and hence forcing an attacker to perform more work during a dictionary attack. I completely agree that HMAC is better than just SHA-256. After all HMAC was designed for authentication. I'm not sure why you want to hash the message before computing the HMAC. HMAC does that for you. Encryption does not always provide authentication. This is specially in cases when the attacker learns the plaintext, as he does in your case. He might be able to exploit properties of the encryption mode to manipulate the ciphertext an know exactly how the resulting plaintext will look like (E.g. the CBC mode allows these kind of manipulations). Your previous proposal (HMAC) is preferable. Finally, if you can setup an SSL connection between user and server, as others suggest: this would be a much safer solution, since not even the dicionary attack mentioned above would be possible.
0
1,626
false
1
1
authentication method
840,803
3
4
0
2
0
0
0.099668
0
I am writing a server-client application to receive user message and publish it. Thinking about authentication method. Asymmetric encryption, probably RSA. Hash (salt+password+'msg'+'userid'), SHA256 HMAC, SHA256. seems to be more secured than the method 2. Also involve hashing the password and msg data. Symmetric Encryption of the 'msg' with static password stored on both sides, probably AES. There is no need for encryption as the msg would be publish online anyway. So I am more lean to the HMAC or PKI method. I'm using java to send the request (including whatever authentication method to be implemented) www.mysite.com/foo?userid=12345&msg=hello&token=abc1234 python on the server side to receive request and make sure the request is from the valid user. The problems are in integration and make sure both sides understand each other's authentication token. It is a big factor for me. And the availability of the libraries available on both language are taken into account as well. Or I can choose to rewrite the server side into java. (Why not python? The client side application need to be in java) What do you think? EDIT: I would not treat this as a web application. The application does not serve any webpage. Most of the operations are not related to the web. Just the client-server communication go through internet. And sending POST/GET via HTTP is what I thought of as the simpler albeit insecure way to do it. Feel free to suggest me any other alternative. SSL is a secure way for encryption. But it does not prevent attacker from sending message to the server impose as the user. Anyone can initiate a HTTPS connection. And the content of the communication does not need to be encrypted. It will be published online by the server anyway. What I need is a way to authenticate the message and sender. For now I am lean to HMAC algorithm. RSA would be more secure but it comes with more developer efforts as well. Will see how it goes. Thank you.
0
java,python,authentication,encryption,hash
2009-05-07T14:22:00.000
0
834,932
Can't you just use standard SSL sockets to secure the connection, validate the user with a password, and then send the message to be published? If there won't be many clients, you can even use a self-signed certificate and put it in a KeyStore in the client app, that way you won't need to buy a certificate from Verisign or anyone else. If you are storing the user's password hash on the server (as I think you should otherwise how are you going to validate the user's password), then you can first reproduce that hash on the client side (let's assume you hash user+pass) and then append that to the message and hash the result. You send the user id, hash and message to the server. On the server side you receive a request with a user id, you retrieve the user's password (the server only has stored the hash of user+pass), you append that to the message and hash it again, and compare it against the hash in the request. If it matches, the user can publish the message. Oh and you should use HTTP POST, instead of sending data on the URL. The server should not accept data on the URL for the publish request.
0
1,626
false
1
1
authentication method
836,074
3
4
0
0
0
0
0
0
I am writing a server-client application to receive user message and publish it. Thinking about authentication method. Asymmetric encryption, probably RSA. Hash (salt+password+'msg'+'userid'), SHA256 HMAC, SHA256. seems to be more secured than the method 2. Also involve hashing the password and msg data. Symmetric Encryption of the 'msg' with static password stored on both sides, probably AES. There is no need for encryption as the msg would be publish online anyway. So I am more lean to the HMAC or PKI method. I'm using java to send the request (including whatever authentication method to be implemented) www.mysite.com/foo?userid=12345&msg=hello&token=abc1234 python on the server side to receive request and make sure the request is from the valid user. The problems are in integration and make sure both sides understand each other's authentication token. It is a big factor for me. And the availability of the libraries available on both language are taken into account as well. Or I can choose to rewrite the server side into java. (Why not python? The client side application need to be in java) What do you think? EDIT: I would not treat this as a web application. The application does not serve any webpage. Most of the operations are not related to the web. Just the client-server communication go through internet. And sending POST/GET via HTTP is what I thought of as the simpler albeit insecure way to do it. Feel free to suggest me any other alternative. SSL is a secure way for encryption. But it does not prevent attacker from sending message to the server impose as the user. Anyone can initiate a HTTPS connection. And the content of the communication does not need to be encrypted. It will be published online by the server anyway. What I need is a way to authenticate the message and sender. For now I am lean to HMAC algorithm. RSA would be more secure but it comes with more developer efforts as well. Will see how it goes. Thank you.
0
java,python,authentication,encryption,hash
2009-05-07T14:22:00.000
0
834,932
RSA protocol is generally used to setup a key exchange for a faster encryption means. That's how SSL works. If the security requirements for your applications are so sensitive that you require PKI, then it should be said (without any intent to be harsh) that if you need to ask about it on SO, then its probably something you shouldn't attempt to do (given that generally successful attacks on secure channels attack weakpoints of the implementation). As Chochos has suggested, what's wrong with simply using the existing SSL infrastructure in Java and your server to set up a secure https connection and then simply pass the user password from client to the server?
0
1,626
false
1
1
authentication method
837,532
2
5
0
-1
5
0
-0.039979
0
Does a easy to use Ruby to Python bridge exist? Or am I better off using system()?
0
python,ruby
2009-05-07T21:59:00.000
1
837,256
For python code to run the interpreter needs to be launched as a process. So system() is your best option. For calling the python code you could use RPC or network sockets, got for the simplest thing which could possibly work.
0
6,499
false
1
1
How do I invoke Python code from Ruby?
837,862
2
5
0
2
5
0
0.07983
0
Does a easy to use Ruby to Python bridge exist? Or am I better off using system()?
0
python,ruby
2009-05-07T21:59:00.000
1
837,256
I don't think there's any way to invoke Python from Ruby without forking a process, via system() or something. The language run times are utterly diferent, they'd need to be in separate processes anyway.
0
6,499
false
1
1
How do I invoke Python code from Ruby?
837,296
3
7
0
8
0
0
1
0
I just got a project where I have to do the following on a Windows OS: detect how many drives (C: D: E: ..etc) are connected to current system what the system labels are for each volume how much storage (both used and free) for each of the drives what format each drive is (NTFS/FAT32) how many files are in a given directory in any of those drives how big each file size is File processing (each file is about 2GB) where I have to do a lot of C-like fseek(), and binary data parsing, and big to little-endian conversion. Have to write some logic code as well. I'm an experienced C\C++ programmer, but I thought this would be a perfect time for me to start learning about scripting. Candidates that I thought of are: ( Python || Ruby ) && PowerShell. Are those the kinds of things I can accomplish with, say, IronPython+Powershell? Or are there better tools/languages out there? PS: Is PowerShell meant to replace VBScript? Also, what is VB.net good for anyway now that C#, WPF, and Powershell exist?
0
.net,ruby,powershell,scripting,ironpython
2009-05-08T20:35:00.000
1
841,669
Except for the seventh item on your list this should be fairly trivial using Powershell and WMI, as this is perhaps the natural domain for Powershell. Since you won't need another language for the first six list items it shouldn't really matter what you use for the last one. You probably can use PS (I've never done IO with it, though) or whatever suits you. As for your second question: VBScript is probably not going to go away in the near future as the Windows Script Host is still a safer bet when writing small scripts for deployment, as it comes preinstalled on every Windows since 98. Powershell is only included in Windows 7 and later. That being said, Powershell is surely targeted at obsoleting WSH and CMD for automation purposes since it offers the same features of the aforementioned ones and much more (like easy .NET and WMI access). VB.NET on the other hand is one of the primary .NET languages marketed by Microsoft. It has little to no relation to VBScript, is no competitor to Powershell or WPF (heck, those are completely different technologies). You may see some convergence with C# going on as both languages still seem to struggle a little finding their intended market. Still, VB.NET is the easiest choice of switching to .NET when you're a VB programmer and there were/are lots of them MS didn't want to lose just because they created .NET.
0
501
false
0
1
Advice for Windows system scripting+programming
841,689
3
7
0
0
0
0
0
0
I just got a project where I have to do the following on a Windows OS: detect how many drives (C: D: E: ..etc) are connected to current system what the system labels are for each volume how much storage (both used and free) for each of the drives what format each drive is (NTFS/FAT32) how many files are in a given directory in any of those drives how big each file size is File processing (each file is about 2GB) where I have to do a lot of C-like fseek(), and binary data parsing, and big to little-endian conversion. Have to write some logic code as well. I'm an experienced C\C++ programmer, but I thought this would be a perfect time for me to start learning about scripting. Candidates that I thought of are: ( Python || Ruby ) && PowerShell. Are those the kinds of things I can accomplish with, say, IronPython+Powershell? Or are there better tools/languages out there? PS: Is PowerShell meant to replace VBScript? Also, what is VB.net good for anyway now that C#, WPF, and Powershell exist?
0
.net,ruby,powershell,scripting,ironpython
2009-05-08T20:35:00.000
1
841,669
As for Perl, Ruby too has access to all Win32 API and WMI functions.
0
501
false
0
1
Advice for Windows system scripting+programming
844,915
3
7
0
0
0
0
0
0
I just got a project where I have to do the following on a Windows OS: detect how many drives (C: D: E: ..etc) are connected to current system what the system labels are for each volume how much storage (both used and free) for each of the drives what format each drive is (NTFS/FAT32) how many files are in a given directory in any of those drives how big each file size is File processing (each file is about 2GB) where I have to do a lot of C-like fseek(), and binary data parsing, and big to little-endian conversion. Have to write some logic code as well. I'm an experienced C\C++ programmer, but I thought this would be a perfect time for me to start learning about scripting. Candidates that I thought of are: ( Python || Ruby ) && PowerShell. Are those the kinds of things I can accomplish with, say, IronPython+Powershell? Or are there better tools/languages out there? PS: Is PowerShell meant to replace VBScript? Also, what is VB.net good for anyway now that C#, WPF, and Powershell exist?
0
.net,ruby,powershell,scripting,ironpython
2009-05-08T20:35:00.000
1
841,669
I'll give you the unpopular answer then since no one else has added it: Perl. If you're comfortable with the Win32 API as a C/C++ programmer, Perl may be the easier way to go. It has modules for accessing the Win32 API and Perl is quite easy for C/C++ programmers to get up to speed in. Perl has always done the job for me in the past.
0
501
false
0
1
Advice for Windows system scripting+programming
842,535
1
3
0
8
6
1
1
0
Is there an easy way to call Python objects from C#, that is without any COM mess?
0
c#,python,ironpython
2009-05-10T15:11:00.000
0
845,502
Yes, by hosting IronPython.
0
10,077
false
0
1
using Python objects in C#
845,506
1
4
0
3
17
1
0.148885
0
I've been programming Ruby pretty extensively for the past four years or so, and I'm extremely comfortable with the language. For no particular reason, I've decided to learn some Python this week. Is there a specific book, tutorial, or reference that would be well-suited to someone coming from a nearly-identical language, or should I just "Dive into Python"? Thanks!
0
python,ruby
2009-05-10T21:25:00.000
0
846,139
After running through some tutorials on-line (the ones posted so far look pretty good), find a current Ruby project you've done (or are working on) and re-write it in Python. I've used this technique to transition from various languages, and it's helped enormously.
0
4,331
false
0
1
What's the quickest way for a Ruby programmer to pick up Python?
846,168
1
3
0
0
2
0
0
0
M2Crypto provides EC support for ECDSA/ECDH. I have installed OpenSSL 0.9.8i which contains support for EC. However when I run "from M2Crypto import EC,BIO" I get error saying EC_init() failed. So I added debug to print m2.OPENSSL_VERSION_TEXT value. It gets printed as "OpenSSL 0.9.7 19 Feb 2003". This version of OpenSSL doesnot support EC. I tried "python setup.py build build_ext --openssl="new_path where OpenSSL 0.9.8i is installed". Though M2Crypto is built again "Python setup.py install" , I still see that it points to "Old version of OpenSSL". Any Pointers on how to successfully get M2Crypto to use 0.9.8i will be useful.
0
python,m2crypto
2009-05-11T14:55:00.000
1
848,508
Possibly its looking up shared libs libssl.so and libcrypto.so and finding the old ones in /usr/lib if you add the new_path to the top of /etc/ld.so.conf so it gets searched first it would work. But this might break other OpenSSL applications expecting old OpenSSL.
0
880
false
0
1
Python M2Crypto EC Support
848,795
2
5
0
3
12
1
0.119427
0
To squeeze into the limited amount of filesystem storage available in an embedded system I'm currently playing with, I would like to eliminate any files that could reasonably be removed without significantly impacting functionality or performance. The *.py, *.pyo, and *.pyc files in the Python library account for a sizable amount of space, I'm wondering which of these options would be most reasonable for a Python 2.6 installation in a small embedded system: Keep *.py, eliminate *.pyc and *.pyo (Maintain ability to debug, performance suffers?) Keep *.py and *.pyc, eliminate *.pyo (Does optimization really buy anything?) Keep *.pyc, eliminate *.pyo and *.py (Will this work?) Keep *.py, *.pyc, and *.pyo (All are needed?)
0
python,embedded
2009-05-12T00:18:00.000
0
850,630
Number 3 should and will work. You do not need the .pyo or .py files in order to use the compiled python code.
0
7,405
false
0
1
Python *.py, *.pyo, *.pyc: Which can be eliminated for an Embedded System?
850,642
2
5
0
2
12
1
0.07983
0
To squeeze into the limited amount of filesystem storage available in an embedded system I'm currently playing with, I would like to eliminate any files that could reasonably be removed without significantly impacting functionality or performance. The *.py, *.pyo, and *.pyc files in the Python library account for a sizable amount of space, I'm wondering which of these options would be most reasonable for a Python 2.6 installation in a small embedded system: Keep *.py, eliminate *.pyc and *.pyo (Maintain ability to debug, performance suffers?) Keep *.py and *.pyc, eliminate *.pyo (Does optimization really buy anything?) Keep *.pyc, eliminate *.pyo and *.py (Will this work?) Keep *.py, *.pyc, and *.pyo (All are needed?)
0
python,embedded
2009-05-12T00:18:00.000
0
850,630
I would recommend keeping only .py files. The difference in startup time isn't that great, and having the source around is a plus, as it will run under different python versions without any issues. As of python 2.6, setting sys.dont_write_bytecode to True will suppress compilation of .pyc and .pyo files altogether, so you may want to use that option if you have 2.6 available.
0
7,405
false
0
1
Python *.py, *.pyo, *.pyc: Which can be eliminated for an Embedded System?
851,194
4
9
0
0
12
1
0
0
I'm trying to change my PYTHONPATH. I've tried to change it in "My Computer" etc, but it doesn't exist there. I searched in the registry in some places, and even ran a whole search for the word 'PYTHONPATH', but to no avail. However, it Python I can easily see it exists. So where is it?
0
python,windows,path
2009-05-13T18:28:00.000
0
859,594
What's it set to? Have you tried creating a PYTHONPATH environment variable?
0
45,286
false
0
1
Can't find my PYTHONPATH
859,615
4
9
0
0
12
1
0
0
I'm trying to change my PYTHONPATH. I've tried to change it in "My Computer" etc, but it doesn't exist there. I searched in the registry in some places, and even ran a whole search for the word 'PYTHONPATH', but to no avail. However, it Python I can easily see it exists. So where is it?
0
python,windows,path
2009-05-13T18:28:00.000
0
859,594
You need modify your environment variables. How to do this depends on which version of Windows you have. If the PYTHONPATH variable doesn't exist, you have to create it. It might not exist if you haven't already created it.
0
45,286
false
0
1
Can't find my PYTHONPATH
859,618
4
9
0
1
12
1
0.022219
0
I'm trying to change my PYTHONPATH. I've tried to change it in "My Computer" etc, but it doesn't exist there. I searched in the registry in some places, and even ran a whole search for the word 'PYTHONPATH', but to no avail. However, it Python I can easily see it exists. So where is it?
0
python,windows,path
2009-05-13T18:28:00.000
0
859,594
MacOS 10.5.8, Python 2.6, Eclipse+Pydev 1.5.7 Python installation's site-package is, for example: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages create symlinks YOUR LIBRARY inside into site-package, for example: cd /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages ln -s /path/to/YOUR/LIBRARY/ YOUR_LIBRARY_NAME Now You can use in commandline: import YOUR_LIBRARY_NAME run Eclipse with Pydev, go to Preferences->Pydev->Interpreter Python remove Your Python interpreter record, if exists; click New and add Python 2.6 interpreter path, for example: /Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 notice, that Eclipse Pydev display Python System Library, accept that in Library section click New Folder and write path to YOUR LIBRARY, for example: /path/to/YOUR/LIBRARY/ click Apply - it is essential, because Eclipse Pydev built now his own "library map", when this operation finish - click [OK] close Eclipse run Eclipse again - now You should use in Pydev: import YOUR_LIBRARY_NAME
0
45,286
false
0
1
Can't find my PYTHONPATH
3,079,003
4
9
0
0
12
1
0
0
I'm trying to change my PYTHONPATH. I've tried to change it in "My Computer" etc, but it doesn't exist there. I searched in the registry in some places, and even ran a whole search for the word 'PYTHONPATH', but to no avail. However, it Python I can easily see it exists. So where is it?
0
python,windows,path
2009-05-13T18:28:00.000
0
859,594
I had same problem and oliver-zehentleitner's answer in github solved my problem. He said: Maybe You install package with pip for python2 and run with python3, just try to install with pip3 or python3 -m pip install python-binance and then run your script again. I hope this can solve yours too.
0
45,286
false
0
1
Can't find my PYTHONPATH
67,562,437
3
6
0
2
3
1
0.066568
0
I'm currently reading a great book called 'Programming Collective Intelligence' by Toby Segaran (which i highly recommend) The code examples are all written in Python, and as I have already learnt one new language this year (graduating from VB.net to C#) i'm not keen to jump on another learning curve. This leaves my with the issue of translating the python examples into C#. Question is: How critical is it that the code stay in python? Are there thing in python that I can't do in a normal managed statically typed language?
0
python,collective-intelligence
2009-05-14T13:11:00.000
0
863,253
I suggest translating them to C#. I have been porting chapter 2 "Recommendations" to VB.Net. Along the way I'm learning Python as a side-effect. Toby does some amazing things with Python lists. Dealing with the the extra Python libraries is another story. Ndelicious is a close match to pyDelicious, but it is missing a few key features (popular posts!).
0
2,273
false
0
1
Python and Collective Intelligence
986,107
3
6
0
1
3
1
0.033321
0
I'm currently reading a great book called 'Programming Collective Intelligence' by Toby Segaran (which i highly recommend) The code examples are all written in Python, and as I have already learnt one new language this year (graduating from VB.net to C#) i'm not keen to jump on another learning curve. This leaves my with the issue of translating the python examples into C#. Question is: How critical is it that the code stay in python? Are there thing in python that I can't do in a normal managed statically typed language?
0
python,collective-intelligence
2009-05-14T13:11:00.000
0
863,253
The book is about algorithms, not the details of programming, and the language of choice is just to make the examples concrete. As the author says, "The code examples in this book are written in Python... but I provide explanations of all the algorithms so that programmers of other languages can follow." (p. xv) Python is a great language and easy to learn, but I suspect the difficulties in applying ideas from the book will not be in the translating of the code to another language or set of libraries, but in understanding the ideas and modifying the code to suite your needs. I think there are two main reasons to stay with a language you're familiar with: 1) when your code doesn't work, if you're writing in an unfamiliar language, you won't know where to start looking for errors, e.g. if you're like most people you'll even start wondering if it's due to a bug in Python, which it won't be, but you'll wonder and it will distract. 2) There are just natural limits to how much you can remember in a certain length of time; and learning a language at the same time will give you twice as much to remember. It depends though how well you know C#, and what you lose by leaving it.
0
2,273
false
0
1
Python and Collective Intelligence
863,568
3
6
0
20
3
1
1.2
0
I'm currently reading a great book called 'Programming Collective Intelligence' by Toby Segaran (which i highly recommend) The code examples are all written in Python, and as I have already learnt one new language this year (graduating from VB.net to C#) i'm not keen to jump on another learning curve. This leaves my with the issue of translating the python examples into C#. Question is: How critical is it that the code stay in python? Are there thing in python that I can't do in a normal managed statically typed language?
0
python,collective-intelligence
2009-05-14T13:11:00.000
0
863,253
One challenge you'll find is that not only are the algorithms implemented in Python, but the book makes extensive use of Python libraries like BeautifulSoup, Numpy, PIL, and others (see appendix A). I doubt there are any specifics of the algorithms that you couldn't port to another language, but you'll have trouble working through the exercises. Also, to translate the code, you'll have to learn Python at least a little bit, no? I suggest you just dive in and learn Python. You can use IronPython if you have any concern about interoperability with your C# projects.
0
2,273
true
0
1
Python and Collective Intelligence
863,292
3
12
0
2
23
1
0.033321
0
I'm working on a Python program that makes heavy use of eggs (Plone). That means there are 198 directories full of Python code I might want to search through while debugging. Is there a good way to search only the .py files in only those directories, avoiding unrelated code and large binary files?
0
python,grep,plone,zope
2009-05-14T19:58:00.000
0
865,382
And simply because there are not enough answers... If you're developing routinely, it's well worth the effort to install Eclipse with Pydev (or even easier, Aptana Studio - which is a modified Eclipse), in which case the find tools are right there.
0
12,967
false
0
1
How do you grep through code that lives in many different directories?
5,189,472
3
12
0
4
23
1
0.066568
0
I'm working on a Python program that makes heavy use of eggs (Plone). That means there are 198 directories full of Python code I might want to search through while debugging. Is there a good way to search only the .py files in only those directories, avoiding unrelated code and large binary files?
0
python,grep,plone,zope
2009-05-14T19:58:00.000
0
865,382
This problem was the motivation for the creation of collective.recipe.omelette. It is a buildout recipe which can symlink all the eggs from your working set into one directory structure, which you can point your favorite search utility at.
0
12,967
false
0
1
How do you grep through code that lives in many different directories?
5,131,554
3
12
0
2
23
1
0.033321
0
I'm working on a Python program that makes heavy use of eggs (Plone). That means there are 198 directories full of Python code I might want to search through while debugging. Is there a good way to search only the .py files in only those directories, avoiding unrelated code and large binary files?
0
python,grep,plone,zope
2009-05-14T19:58:00.000
0
865,382
Just in case you want a non-commandline OSS solution... I use pycharm. It has built in support for buildout. You point it at a buildout generated bin/instance and it sets the projects external dependencies to all the eggs used by the instance. Then all the IDE's introspection and code navigation work nicely. Goto definition, goto instances, refactoring support and of course search.
0
12,967
false
0
1
How do you grep through code that lives in many different directories?
5,131,426
5
6
0
4
4
0
0.132549
0
Why mod_python is oop but mod_php is not ? Example :We go to www.example.com/dir1/dir2 if you use mod_python apache opens www/dir1.py and calls dir2 method but if you use php module apache opens www/dir1/dir2/index.php
0
php,python,mod-python
2009-05-16T16:01:00.000
0
872,695
I think you have some misconceptions about how HTTP works. Nothing in the http standard requires you to have a certain file as a resource. It is just the way how mod_php works, that for a given path, this path is translated to a php file on the disk of the server, which in turn is interpreted by the compiler. The mod_python module on the other hand is much more generic, it allows you to map any resource to a call to some python object. It just happens that some configurations are available out of the box, to make it easier to start with. In most cases the dispatch of the url is managed by your framework, and how that works is up to the framework implementor. Because of the generic nature of the mod_python module you are also able to access some apache features which are not available in the mod_php module, for instance you may write your own authentication handler, which my not only apply to your python webapp, but also to other apps in your apache as well.
0
2,975
false
0
1
mod_php vs mod_python
872,913
5
6
0
-1
4
0
-0.033321
0
Why mod_python is oop but mod_php is not ? Example :We go to www.example.com/dir1/dir2 if you use mod_python apache opens www/dir1.py and calls dir2 method but if you use php module apache opens www/dir1/dir2/index.php
0
php,python,mod-python
2009-05-16T16:01:00.000
0
872,695
Perhaps I misunderstand your question, but both Python and PHP support both procedural and object-oriented programming. (Though one could argue that Python's support for OO is the stronger of the two.)
0
2,975
false
0
1
mod_php vs mod_python
872,710
5
6
0
0
4
0
0
0
Why mod_python is oop but mod_php is not ? Example :We go to www.example.com/dir1/dir2 if you use mod_python apache opens www/dir1.py and calls dir2 method but if you use php module apache opens www/dir1/dir2/index.php
0
php,python,mod-python
2009-05-16T16:01:00.000
0
872,695
in PHP you can program your web pages the top-to-bottom scripts, procedural programming and function calls, OOP. this is the main reason why PHP was first created, and how it evolved. mod_php is just a module for web servers to utilize PHP as a preprocessor. so it just passes HTTP information and the PHP script to PHP interpreter. the PHP way of web page creation is do what you want; write a top-to-bottom script, define functions in different files and include those and call functions, or write your app in OOP, you can also use many full-featured frameworks today to make sure your application design and structure meets today best practices and design patterns. I'm new to Python, and am not familiar with web programming with python. but as much as I know, python was not created to make web programming easier. it was intended to be a general purpose programming language, so although it might be possible to write simple top-to-bottom scripts in python and run them as web page responses (I'm not sure if such thing is possible), it is not the pythonic way, and so I think developers of the mod_python wanted web programming in python to be in a pythonic way.
0
2,975
false
0
1
mod_php vs mod_python
873,885
5
6
0
8
4
0
1.2
0
Why mod_python is oop but mod_php is not ? Example :We go to www.example.com/dir1/dir2 if you use mod_python apache opens www/dir1.py and calls dir2 method but if you use php module apache opens www/dir1/dir2/index.php
0
php,python,mod-python
2009-05-16T16:01:00.000
0
872,695
Let's talk about mod_python vs. mod_php. Since the Python language is NOT specifically designed for serving web pages, mod_python must do some additional work. Since the PHP language IS specifically designed to serve web pages, mod_php simply starts a named PHP module. In the case of mod_python (different from mod_fastcgi or mod_wsgi), the designer of mod_python decided that the best way to invoke Python is to call a method of an object defined in a module. Hopefully, that method of that object will write the headers and web page content to stdout. In the case of mod_wsgi, the designer decided that the best way to invoke Python is to call a function (or callable object) in a module. Hopefully that function will use the supplied object to create header and return a list strings with the web page content. In the case of mod_php, they just invoke the module because PHP modules are designed to serve web pages. The program runs and the result of that run is a page of content; usually HTML. The reason mod_php works one way, mod_python works another and mod_wsgi works a third way is because they're different. Written by different people with different definitions of the way to produce a web page. The php page can be object-oriented. A mod_wsgi function may be a callable object or it may be a simplef unction. Those are design choices. The mod_python requirement for a class is a design choice made by the designer of mod_python. The reason "why" is never useful. The reason "why" is because someone decided to design it that way.
0
2,975
true
0
1
mod_php vs mod_python
873,822
5
6
0
4
4
0
0.132549
0
Why mod_python is oop but mod_php is not ? Example :We go to www.example.com/dir1/dir2 if you use mod_python apache opens www/dir1.py and calls dir2 method but if you use php module apache opens www/dir1/dir2/index.php
0
php,python,mod-python
2009-05-16T16:01:00.000
0
872,695
Because mod_python is abstracting the URL into a "RPC-like" mechanism. You can achieve the same in PHP. I always did it by hand, but I am pretty sure there are prepackaged pear modules for this. Note the mod_python behavior is not forcibly "the best". It all amounts to the type of design you want to give to your application, and how it behaves to the clients. As far as I see, the mod_python approach assumes that for every URL you have a function, like mapping the module structure into a URL tree. This is technically not a particularly nice approach, because there's a tight correlation between the technology you are using (mod_python) and the URL layout of your application. On the reason why, theres' no reason. Some people like one food, and some other like another. Design is, in some cases, a matter of taste and artistic choices, not only technical restrains.
0
2,975
false
0
1
mod_php vs mod_python
872,824