Q_Id
int64 337
49.3M
| CreationDate
stringlengths 23
23
| Users Score
int64 -42
1.15k
| Other
int64 0
1
| Python Basics and Environment
int64 0
1
| System Administration and DevOps
int64 0
1
| Tags
stringlengths 6
105
| A_Id
int64 518
72.5M
| AnswerCount
int64 1
64
| is_accepted
bool 2
classes | Web Development
int64 0
1
| GUI and Desktop Applications
int64 0
1
| Answer
stringlengths 6
11.6k
| Available Count
int64 1
31
| Q_Score
int64 0
6.79k
| Data Science and Machine Learning
int64 0
1
| Question
stringlengths 15
29k
| Title
stringlengths 11
150
| Score
float64 -1
1.2
| Database and SQL
int64 0
1
| Networking and APIs
int64 0
1
| ViewCount
int64 8
6.81M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
779,989 | 2009-04-23T01:41:00.000 | 0 | 0 | 1 | 0 | python,logging,methodology | 2,043,176 | 7 | false | 0 | 0 | Python's logging library are thread-safe for single process threads. | 3 | 11 | 0 | My question is simple: what to write into a log.
Are there any conventions?
What do I have to put in?
Since my app has to be released, I'd like to have friendly logs, which could be read by most people without asking what it is.
I already have some ideas, like a timestamp, a unique identifier for each function/method, etc..
I'd like to have several log levels, like tracing/debugging, informations, errors/warnings.
Do you use some pre-formatted log resources?
Thank you | What to write into log file? | 0 | 0 | 0 | 3,663 |
781,466 | 2009-04-23T12:20:00.000 | 10 | 0 | 1 | 0 | python,http,python-3.x,virtualhost | 781,474 | 2 | false | 0 | 0 | Virtual hosts work by obeying the Host: header in the HTTP request.
Just read the headers of the request, and take action based on the value of the Host: header | 1 | 3 | 0 | I am writing an rather simple http web server in python3. The web server needs to be simple - only basic reading from config files, etc. I am using only standard libraries and for now it works rather ok.
There is only one requirement for this project, which I can't implement on my own - virtual hosts. I need to have at least two virtual hosts, defined in config files. The problem is, that I can't find a way how can I implement them in python. Does anyone have any guides, articles, maybe some simple implementation how can this be done?
I would be grateful for any help. | Python3 Http Web Server: virtual hosts | 1 | 0 | 1 | 3,802 |
783,023 | 2009-04-23T18:45:00.000 | 0 | 0 | 0 | 0 | python,wxpython | 783,439 | 2 | false | 0 | 1 | This sounds like a use case for wxTimerEvent instead of wxIdleEvent. When there is processing to do call wxTimerEvent.Start(). When there isn't any to do, call wxTimerEvent.Stop() and call your methods to do processing from EVT_TIMER.
(note: i use from wxWidghets for C++ and am not familiar with wxPython but I assume they have a similar API) | 1 | 3 | 0 | I defined an handler for EVT_IDLE that does a certain background task for me. (That task is to take completed work from a few processes and integrate it into some object, making a visible change in the GUI.)
The problem is that when the user is not moving the mouse or doing anything, EVT_IDLE doesn't get called more than once. I would like this handler to be working all the time. So I tried calling event.RequestMore() at the end of the handler. Works, but now it takes a whole lot of CPU. (I'm guessing it's just looping excessively on that task.)
I'm willing to limit the number of times the task will be carried out per second; How do I do that?
Or do you have another solution in mind? | wxPython: Using EVT_IDLE | 0 | 0 | 0 | 1,623 |
783,120 | 2009-04-23T19:08:00.000 | 0 | 0 | 0 | 0 | wcf,ironpython | 783,626 | 2 | false | 1 | 1 | Is your WCF service interface available in a shared assembly? If so, you could look at using the ChannelFactory to create your client proxy dynamically (instead of using the generated C# proxy). With that method you can supply all the details of the endpoint when you create the ChannelFactory and you won't require any configuration in your .config file. | 1 | 2 | 0 | Has anyone done this? I've tried generating a c# proxy class and connecting through it, but I cannot figure out how to get IronPython to use the generated app.config file that defines the endpoint. It tries to connect, but I just get an error about no default endpoint. I would ideally like to make the connection using only IronPython code and not use the proxy class, if possible. The binding for the service I am trying to connect to is a NetTcpBinding if that makes any difference. | How to connect to a WCF Service with IronPython | 0 | 0 | 0 | 2,231 |
783,189 | 2009-04-23T19:27:00.000 | 2 | 1 | 1 | 0 | python | 783,207 | 1 | true | 0 | 0 | I'm not sure what you're trying to do, but if you're looking for something that can say 'this is valid English' or 'this is valid Finnish', then you're looking at a class of problems that is quite likely unsolvable.
If not, then use a dictionary and/or letter frequencies and Bayesian analysis to determine whether or not given text is English-like or Finnish-like. If you're trying to auto-detect a language, this is likely the best route, although you'll run into problems with mixed-language text. | 1 | 0 | 0 | Is there an easy-to-use python module that'd do english or finnish text validation?
It'd be ok if I could just check the words exist in user-defined dictionary and possibly checking that the grammar is somewhat okay.
I am planning to implement a fancy validation for a directory contents I did while ago back. This involves some simple stuff like checking that the config scripts won't crash and does it all well. It's all quite easy otherwise.
For the validator I should just be able to input whole files or strings of unicode text. | English and/or Finnish text validation | 1.2 | 0 | 0 | 152 |
783,531 | 2009-04-23T21:07:00.000 | 2 | 0 | 1 | 1 | python,windows,backgrounding | 783,541 | 6 | false | 0 | 0 | cron it on linux; schedule it on windows [control panel > scheduled tasks > Add scheduled task] | 3 | 26 | 0 | I have a script that checks something on my PC every 5 minutes and I don't want Python to show on my task tray. I use Windows as my operating system.
Is there any way to make Python run in the background and force it to not show in my task tray? | How to run a python script in the background? | 0.066568 | 0 | 0 | 42,798 |
783,531 | 2009-04-23T21:07:00.000 | 5 | 0 | 1 | 1 | python,windows,backgrounding | 783,559 | 6 | false | 0 | 0 | Just another option you have:
You can create a shortcut to your Python script, then right-click the shortcut --> Properties --> Shortcut tab
There is a drop-down box under the Run option which lets you run the command minimized. | 3 | 26 | 0 | I have a script that checks something on my PC every 5 minutes and I don't want Python to show on my task tray. I use Windows as my operating system.
Is there any way to make Python run in the background and force it to not show in my task tray? | How to run a python script in the background? | 0.16514 | 0 | 0 | 42,798 |
783,531 | 2009-04-23T21:07:00.000 | -6 | 0 | 1 | 1 | python,windows,backgrounding | 783,544 | 6 | true | 0 | 0 | Look for Schedule Tasks in the control panel. | 3 | 26 | 0 | I have a script that checks something on my PC every 5 minutes and I don't want Python to show on my task tray. I use Windows as my operating system.
Is there any way to make Python run in the background and force it to not show in my task tray? | How to run a python script in the background? | 1.2 | 0 | 0 | 42,798 |
784,584 | 2009-04-24T05:02:00.000 | 5 | 1 | 0 | 0 | python,ruby | 784,667 | 11 | false | 1 | 0 | Devil's advocate maybe...
Everything's an object.
This is a feature of Ruby, but it is not self-explanatory as to why this is a benefit. You would need to pre-prepare an argument for why that is a benefit. When convincing somebody of something's superiority, always think in terms of showing the benefits, not the features.
Python and Ruby are easier to read and write.
This is a very big claim to make, and I would not be comfortable making such a claim without a substantial amount of credible objective third party evidence supporting this. If not, and I suspect such a claim really couldn't be backed up, I would play it safe and avoid making such a claim. Making a claim this substantial, but only backing it up with personal opinion or anecdotal evidence would not be a good idea.
Ruby has many conveniences, which
makes it easier to read and write. Eg:
Optional brackets, and being able to
open built-ins, allows for things like
2.days.from_now
Again, you will need to think benefits, not features. It may be true that it has optional brackets, but you cannot just mention a feature, you have to explain its benefit - why that feature is a better idea than any other approach. Personally I am not sure that 'optional' syntax is ever a good idea, and would need a fair bit of evidence to convince me that it was.
GitHub and RubyForge are fantastic resources for finding,
releasing, and collaborating on
software.
That's good. There are also similar resources for languages other than Ruby - again, you will need to not only mention the existence of these but explain how they are better than the alternatives.
Good luck. | 9 | 2 | 0 | G'day folks. I'm trying to introduce Ruby at work, and a few people are interested. However, I've been asked to present the benefits of Ruby over Python and PHP.
I've broken this down into 2 parts:
1) show Python and Ruby's advantages over PHP;
2) show Ruby's advantages over Python.
The first is easy. I'll explain things like:
Everything's an object.
Python and Ruby are easier to read and write.
For the second, I'm thinking of:
Ruby has many conveniences, which makes it easier to read and write. Eg: Optional brackets, and being able to open built-ins, allows for things like 2.days.from_now
RSpec is miles ahead of Python's TDD and BDD frameworks.
GitHub and RubyForge are fantastic resources for finding, releasing, and collaborating on software.
Do you have any suggestions? I'm all ears! | Convincing others of Ruby over Python and PHP | 0.090659 | 0 | 0 | 1,888 |
784,584 | 2009-04-24T05:02:00.000 | 0 | 1 | 0 | 0 | python,ruby | 784,633 | 11 | false | 1 | 0 | All 3 languages have their place. As with any programming task you must pick the language best suited for the task. Python has list comprehensions, php is much better when embedding and generating html. Ruby is a great language too. One of the things I have found myself using in ruby a few times is the 'a'...'zzzzz' to generate all possible strings of size 1 - 5. They all have their advantages and are all better than the others at particular tasks. | 9 | 2 | 0 | G'day folks. I'm trying to introduce Ruby at work, and a few people are interested. However, I've been asked to present the benefits of Ruby over Python and PHP.
I've broken this down into 2 parts:
1) show Python and Ruby's advantages over PHP;
2) show Ruby's advantages over Python.
The first is easy. I'll explain things like:
Everything's an object.
Python and Ruby are easier to read and write.
For the second, I'm thinking of:
Ruby has many conveniences, which makes it easier to read and write. Eg: Optional brackets, and being able to open built-ins, allows for things like 2.days.from_now
RSpec is miles ahead of Python's TDD and BDD frameworks.
GitHub and RubyForge are fantastic resources for finding, releasing, and collaborating on software.
Do you have any suggestions? I'm all ears! | Convincing others of Ruby over Python and PHP | 0 | 0 | 0 | 1,888 |
784,584 | 2009-04-24T05:02:00.000 | 0 | 1 | 0 | 0 | python,ruby | 784,656 | 11 | false | 1 | 0 | If you are inclined towards a language or a software then you will tend to see only the goodies compared to others. If you want to do real comparison then comapre pros and cons and see if Ruby is clear winner in terms of what you want to achieve with that language in your company. If you do this and your company see benefits of Ruby then surely they will use. | 9 | 2 | 0 | G'day folks. I'm trying to introduce Ruby at work, and a few people are interested. However, I've been asked to present the benefits of Ruby over Python and PHP.
I've broken this down into 2 parts:
1) show Python and Ruby's advantages over PHP;
2) show Ruby's advantages over Python.
The first is easy. I'll explain things like:
Everything's an object.
Python and Ruby are easier to read and write.
For the second, I'm thinking of:
Ruby has many conveniences, which makes it easier to read and write. Eg: Optional brackets, and being able to open built-ins, allows for things like 2.days.from_now
RSpec is miles ahead of Python's TDD and BDD frameworks.
GitHub and RubyForge are fantastic resources for finding, releasing, and collaborating on software.
Do you have any suggestions? I'm all ears! | Convincing others of Ruby over Python and PHP | 0 | 0 | 0 | 1,888 |
784,584 | 2009-04-24T05:02:00.000 | 0 | 1 | 0 | 0 | python,ruby | 1,227,135 | 11 | false | 1 | 0 | This kind of post gives Ruby programmers a bad name. Ruby is Beethoven, Python is Bach. If you prefer one style to the other, fine, but don't try to argue the superiority of one over the other. | 9 | 2 | 0 | G'day folks. I'm trying to introduce Ruby at work, and a few people are interested. However, I've been asked to present the benefits of Ruby over Python and PHP.
I've broken this down into 2 parts:
1) show Python and Ruby's advantages over PHP;
2) show Ruby's advantages over Python.
The first is easy. I'll explain things like:
Everything's an object.
Python and Ruby are easier to read and write.
For the second, I'm thinking of:
Ruby has many conveniences, which makes it easier to read and write. Eg: Optional brackets, and being able to open built-ins, allows for things like 2.days.from_now
RSpec is miles ahead of Python's TDD and BDD frameworks.
GitHub and RubyForge are fantastic resources for finding, releasing, and collaborating on software.
Do you have any suggestions? I'm all ears! | Convincing others of Ruby over Python and PHP | 0 | 0 | 0 | 1,888 |
784,584 | 2009-04-24T05:02:00.000 | 1 | 1 | 0 | 0 | python,ruby | 785,273 | 11 | false | 1 | 0 | Actually no one ever conviced me (at least directly), to use one programming language or another.
I used to have a certain need for clearness (if you might call it that way) and some other criteria, a language and its ecosystem should meet. And you definitively will end up using some stdlib, and third-party resources, so you might want to look into them as well (and use them as arguments).
I am a fan of both, ruby and python (and these languages conviced me both by their design, their constant progress and their communities). The general notion of a scripting language makes them equally appealing. I found gem to be one of the slowest software I ever used. And personally, I think pythons stdlib is better organized than rubys. But I like Ruby Mixins, they are elegant and safe a lot of time.
In short: You could point your colleagues interest to some current hot spots, where coding is just hard, then show some alternatives in ruby. Rake is a great tool as well, demonstrate it ... Just be rationally passionate about it .. The rest will come .. | 9 | 2 | 0 | G'day folks. I'm trying to introduce Ruby at work, and a few people are interested. However, I've been asked to present the benefits of Ruby over Python and PHP.
I've broken this down into 2 parts:
1) show Python and Ruby's advantages over PHP;
2) show Ruby's advantages over Python.
The first is easy. I'll explain things like:
Everything's an object.
Python and Ruby are easier to read and write.
For the second, I'm thinking of:
Ruby has many conveniences, which makes it easier to read and write. Eg: Optional brackets, and being able to open built-ins, allows for things like 2.days.from_now
RSpec is miles ahead of Python's TDD and BDD frameworks.
GitHub and RubyForge are fantastic resources for finding, releasing, and collaborating on software.
Do you have any suggestions? I'm all ears! | Convincing others of Ruby over Python and PHP | 0.01818 | 0 | 0 | 1,888 |
784,584 | 2009-04-24T05:02:00.000 | 2 | 1 | 0 | 0 | python,ruby | 785,262 | 11 | false | 1 | 0 | You're going to have a tough sell over python. GitHub is written in Ruby, not for ruby per se, by the way.
For python one has BitBucket (even though I do prefer git), as well as pypi.
Correct me if I'm wrong, but it sounds like you haven't looked at python code all that much. (I've written buckets of both python and Ruby by the way) I find it much more readable, especially when you're working on code that's not your own.
Anyways, not really answering your question, and don't really want to contribute more to the flame war. | 9 | 2 | 0 | G'day folks. I'm trying to introduce Ruby at work, and a few people are interested. However, I've been asked to present the benefits of Ruby over Python and PHP.
I've broken this down into 2 parts:
1) show Python and Ruby's advantages over PHP;
2) show Ruby's advantages over Python.
The first is easy. I'll explain things like:
Everything's an object.
Python and Ruby are easier to read and write.
For the second, I'm thinking of:
Ruby has many conveniences, which makes it easier to read and write. Eg: Optional brackets, and being able to open built-ins, allows for things like 2.days.from_now
RSpec is miles ahead of Python's TDD and BDD frameworks.
GitHub and RubyForge are fantastic resources for finding, releasing, and collaborating on software.
Do you have any suggestions? I'm all ears! | Convincing others of Ruby over Python and PHP | 0.036348 | 0 | 0 | 1,888 |
784,584 | 2009-04-24T05:02:00.000 | 5 | 1 | 0 | 0 | python,ruby | 785,060 | 11 | false | 1 | 0 | If you really want to show Ruby is better (assuming it is for your application!), why not try writing a small app from scratch in front of them? It doesn't have to be big, but something relavent to what you'll eventually be using it for is a good idea.
Write the app in all three languages including any configuration for the server (I'm assuming you're writing a web app here using DJango / Rails / PHP right?) and show how much faster you are, how much cleaner the code is etc. ...assuming it is ;-)
You can finish up by asking them what they'd like to add to it and then try adding that feature if it's a small change. Nothing like a bit of audience participation - people like applauding themselves. If you get them involved they're more likely to accept the winner.
For the record, I've tried all three and would agree that both Ruby and Python seem to result in cleaner code. I'd go for Python over Ruby though - there was something clunky about the syntax of Ruby when I tried it that I just didn't experience with Python. | 9 | 2 | 0 | G'day folks. I'm trying to introduce Ruby at work, and a few people are interested. However, I've been asked to present the benefits of Ruby over Python and PHP.
I've broken this down into 2 parts:
1) show Python and Ruby's advantages over PHP;
2) show Ruby's advantages over Python.
The first is easy. I'll explain things like:
Everything's an object.
Python and Ruby are easier to read and write.
For the second, I'm thinking of:
Ruby has many conveniences, which makes it easier to read and write. Eg: Optional brackets, and being able to open built-ins, allows for things like 2.days.from_now
RSpec is miles ahead of Python's TDD and BDD frameworks.
GitHub and RubyForge are fantastic resources for finding, releasing, and collaborating on software.
Do you have any suggestions? I'm all ears! | Convincing others of Ruby over Python and PHP | 0.090659 | 0 | 0 | 1,888 |
784,584 | 2009-04-24T05:02:00.000 | 29 | 1 | 0 | 0 | python,ruby | 784,626 | 11 | false | 1 | 0 | If your goal is to show why language X is better than language Y, you're stuck in subjective-land where there are no right answers.
No, Ruby is not better than PHP or Python. It might be more suited for a given purpose, and for that you can give specific examples. PHP is a poor choice for writing an SMTP server; Ruby and Python will serve you better (in fact, in Python it can be done in just a few lines, can't speak for Ruby though). On the other hand, PHP is better suited than Ruby for writing a one-off, short backend for an email submission form. The code is short, easy to maintain, quick to write, etc.
PHP has an absolutely huge developer base, making programmers easy to find, which comes in handy if you ever want to out-source any aspect of the development chain. On the other hand, it's also terrifically easy to write horrible code in PHP, and there is more than enough of that going around.
Python has a much larger user base than Ruby, and indeed is the primary language that RedHat uses for developing system tools. So if you're on a RedHat derived server (and statistically, chances are pretty good that you are if you're using Linux) then Python is guaranteed to be already in-place and working properly, etc.
In short, weigh the benefits, make a decision, but don't assume that people will agree with you; after all it's just an opinion.
Edit
It just occurred to me that I failed to state the whole point: you shouldn't be trying to convince other people that they should use Ruby over Python/PHP. Instead you should be trying to determine whether you should use Ruby over Python/PHP.
You can't go fact-finding like this having already determined what the answer will be -- that's not helpful. Instead you should be gathering information on the benefits and drawbacks of each language and weighing that against the requirements of your company. Once you come to a conclusion, you'll already have a preponderance of evidence showing it was the correct one. | 9 | 2 | 0 | G'day folks. I'm trying to introduce Ruby at work, and a few people are interested. However, I've been asked to present the benefits of Ruby over Python and PHP.
I've broken this down into 2 parts:
1) show Python and Ruby's advantages over PHP;
2) show Ruby's advantages over Python.
The first is easy. I'll explain things like:
Everything's an object.
Python and Ruby are easier to read and write.
For the second, I'm thinking of:
Ruby has many conveniences, which makes it easier to read and write. Eg: Optional brackets, and being able to open built-ins, allows for things like 2.days.from_now
RSpec is miles ahead of Python's TDD and BDD frameworks.
GitHub and RubyForge are fantastic resources for finding, releasing, and collaborating on software.
Do you have any suggestions? I'm all ears! | Convincing others of Ruby over Python and PHP | 1 | 0 | 0 | 1,888 |
784,584 | 2009-04-24T05:02:00.000 | 12 | 1 | 0 | 0 | python,ruby | 784,621 | 11 | false | 1 | 0 | Hmm, as an active programmer in all three languages I simply can't agree with the sentiment that either is better than the other. Sure, Python and Ruby are more object-oriented, but that's not a requirement to be better, it's only a convenience. You can't beat the community of PHP and the legacy (for good and for bad) of code, nor ignore the direction PHP is taking for the future, the mass of support, the distributed servers ready for it, and so on.
If you want to focus on syntax, then all three have their strong and weak points. If you want to talk about back-end technology, then as all three are moving active open-source projects, there really is no winner.
Except, you, the programmer, who can mix and choose what best suits you. Remember that even if you think Ruby is the best thing since NAND gates it doesn't mean others follow. And remember also that we're all different; some people actually like Java and .Net, just like others love LISP. We're all different, and I doubt any of the Ruby/Python/PHP contenders are any better than the other. Sorry. | 9 | 2 | 0 | G'day folks. I'm trying to introduce Ruby at work, and a few people are interested. However, I've been asked to present the benefits of Ruby over Python and PHP.
I've broken this down into 2 parts:
1) show Python and Ruby's advantages over PHP;
2) show Ruby's advantages over Python.
The first is easy. I'll explain things like:
Everything's an object.
Python and Ruby are easier to read and write.
For the second, I'm thinking of:
Ruby has many conveniences, which makes it easier to read and write. Eg: Optional brackets, and being able to open built-ins, allows for things like 2.days.from_now
RSpec is miles ahead of Python's TDD and BDD frameworks.
GitHub and RubyForge are fantastic resources for finding, releasing, and collaborating on software.
Do you have any suggestions? I'm all ears! | Convincing others of Ruby over Python and PHP | 1 | 0 | 0 | 1,888 |
785,327 | 2009-04-24T10:30:00.000 | 0 | 0 | 0 | 0 | python,twitter,dump,social-graph | 817,451 | 3 | true | 0 | 0 | There was a company offering a dump of the social graph, but it was taken down and no longer available. As you already realized - it is kind of hard, as it is changing all the time.
I would recommend checking out their social_graph api methods as they give the most info with the least API calls. | 1 | 3 | 1 | What ready available algorithms could I use to data mine twitter to find out the degrees of separation between 2 people on twitter.
How does it change when the social graph keeps changing and updating constantly.
And then, is there any dump of twitter social graph data which I could use rather than making so many API calls to start over. | Twitter Data Mining: Degrees of separation | 1.2 | 0 | 0 | 2,436 |
785,810 | 2009-04-24T13:18:00.000 | 2 | 1 | 0 | 1 | python,linux,perl,process | 785,836 | 3 | false | 0 | 0 | If you are fork()ing the child, you will know it's PID.
From within the parent you can then parse the files in /proc/<PID/ to check the memory and CPU usage, albeit only for as long as the child process is running. | 2 | 2 | 0 | Is there a way to generically retrieve process stats using Perl or Python? We could keep it Linux specific.
There are a few problems: I won't know the PID ahead of time, but I can run the process in question from the script itself. For example, I'd have no problem doing:
./myscript.pl some/process/I/want/to/get/stats/for
Basically, I'd like to, at the very least, get the memory consumption of the process, but the more information I can get the better (like run time of the process, average CPU usage of the process, etc.)
Thanks. | Is there a way to retrieve process stats using Perl or Python? | 0.132549 | 0 | 0 | 4,760 |
785,810 | 2009-04-24T13:18:00.000 | 1 | 1 | 0 | 1 | python,linux,perl,process | 785,855 | 3 | false | 0 | 0 | A common misconception is that reading /proc is like reading /home. /proc is designed to give you the same information with one open() that 20 similar syscalls filling some structure could provide. Reading it does not pollute buffers, send innocent programs to paging hell or otherwise contribute to the death of kittens.
Accessing /proc/foo is just telling the kernel "give me information on foo that I can process in a language agnostic way"
If you need more details on what is in /proc/{pid}/ , update your question and I'll post them. | 2 | 2 | 0 | Is there a way to generically retrieve process stats using Perl or Python? We could keep it Linux specific.
There are a few problems: I won't know the PID ahead of time, but I can run the process in question from the script itself. For example, I'd have no problem doing:
./myscript.pl some/process/I/want/to/get/stats/for
Basically, I'd like to, at the very least, get the memory consumption of the process, but the more information I can get the better (like run time of the process, average CPU usage of the process, etc.)
Thanks. | Is there a way to retrieve process stats using Perl or Python? | 0.066568 | 0 | 0 | 4,760 |
786,138 | 2009-04-24T14:45:00.000 | 3 | 1 | 0 | 0 | python,linux,email | 787,170 | 4 | false | 1 | 0 | A few thousand emails per hour isn't really that much, as long as your outgoing mail server is willing to accept them in a timely manner.
I would send them using a local mta, like postfix, or exim (which would then send them through your outgoing relay if required). That service is then responsible for the mail queues, retries, bounces, etc. If your looking for more "mailing list" features, try adding mailman into the mix. It's written in python, and you've probably seen it, as it runs tons of internet mailing lists. | 2 | 3 | 0 | I am working for a company that provides customer support to its clients. I am trying to design a system that would send emails automatically to clients when some event occurs. The system would consist of a backend part and a web interface part. The backend will handle the communication with a web interface (which will be only for internal use to change the email templates) and most important it will check some database tables and based on those results will send emails ... lots of them.
Now, I am wondering how can this be designed so it can be made scalable and provide the necessary performance as it will probably have to handle a few thousands emails per hours (this should be the peek). I am mostly interested about how would this kind of architecture should be thought in order to be easily scaled in the future if needed.
Python will be used on the backend with Postgres and probably whatever comes first between a Python web framework and GWT on the frontend (which seems the simplest task). | How to design an email system? | 0.148885 | 0 | 0 | 3,573 |
786,138 | 2009-04-24T14:45:00.000 | 0 | 1 | 0 | 0 | python,linux,email | 787,214 | 4 | false | 1 | 0 | You might want to try Twisted Mail for implementing your own backend in pure Python. | 2 | 3 | 0 | I am working for a company that provides customer support to its clients. I am trying to design a system that would send emails automatically to clients when some event occurs. The system would consist of a backend part and a web interface part. The backend will handle the communication with a web interface (which will be only for internal use to change the email templates) and most important it will check some database tables and based on those results will send emails ... lots of them.
Now, I am wondering how can this be designed so it can be made scalable and provide the necessary performance as it will probably have to handle a few thousands emails per hours (this should be the peek). I am mostly interested about how would this kind of architecture should be thought in order to be easily scaled in the future if needed.
Python will be used on the backend with Postgres and probably whatever comes first between a Python web framework and GWT on the frontend (which seems the simplest task). | How to design an email system? | 0 | 0 | 0 | 3,573 |
786,149 | 2009-04-24T14:46:00.000 | 2 | 0 | 0 | 0 | python,django,django-templates | 793,167 | 3 | false | 1 | 0 | Context processors and RequestContext (see Tyler's answer) are the way to go for data that is used on every page load. For data that you may need on various views, but not all (especially data that isn't really related to the primary purpose of the view, but appears in something like a navigation sidebar), it often makes most sense to define a custom template tag for retrieving the data. | 1 | 6 | 0 | I have a Django website as follows:
site has several views
each view has its own template to show its data
each template extends a base template
base template is the base of the site, has all the JS/CSS and the basic layout
So up until now it's all good. So now we have the master head of the site (which exists in the base template), and it is common to all the views.
But now I want to make it dynamic, and add some dynamic data to it. On which view do I do this? All my views are basically render_to_response('viewtemplate.html', someContext). So how do add a common view to a base template?
Obviously I will not duplicate the common code to each separate view...
I think I'm missing something fundamental in the MVT basis of Django. | Basic MVT issue in Django | 0.132549 | 0 | 0 | 539 |
786,691 | 2009-04-24T16:46:00.000 | 2 | 0 | 0 | 0 | python,vector | 786,758 | 2 | false | 0 | 0 | I don't believe there is anything standard (but I could be wrong, I don't keep up with python that closely).
It's very easy to implement though, and you may want to build on top of the numpy array as a container for it anyway, which gives you lots of good (and efficient) bits and pieces. | 1 | 6 | 1 | I quickly checked numPy but it looks like it's using arrays as vectors? I am looking for a proper Vector3 type that I can instance and work on. | Is there a Vector3 type in Python? | 0.197375 | 0 | 0 | 12,341 |
787,015 | 2009-04-24T18:22:00.000 | 0 | 0 | 1 | 0 | python | 788,253 | 5 | false | 1 | 0 | If you can turn part of the application to a library and provide an API, then site-packages is a good place for it. This is actually how many python applications do it.
But from user or administrator point of view that isn't actually the problem. The problem is how we can manage the installed stuff. After I have installed it, how can I upgrade and uninstall it?
I use Fedora. If I use the python that came with it, I don't like installing things to site-packages outside the RPM system. In some cases I have built rpm myself to install it.
If I build my own python outside RPM, then I naturally want to use python's mechanisms to manage it.
Third way is to use something like easy_install to install such thing for example as a user to home directory.
So
Allow packaging to distributions.
Allow selecting the python to use.
Allow using python installed by distribution where you don't have permissions to site-packages.
Allow using python installed outside distribution where you can use site-packages. | 4 | 5 | 0 | I'm in a bit of a discussion with some other developers on an open source project. I'm new to python but it seems to me that site-packages is meant for libraries and not end user applications. Is that true or is site-packages an appropriate place to install an application meant to be run by an end user? | Is site-packages appropriate for applications or just libraries? | 0 | 0 | 0 | 294 |
787,015 | 2009-04-24T18:22:00.000 | 3 | 0 | 1 | 0 | python | 787,128 | 5 | false | 1 | 0 | The program run by the end user is usually somewhere in their path, with most of the code in the module directory, which is often in site-packages.
Many python programs will have a small script located in the path, which imports the module, and calls a "main" method to run the program. This allows the programmer to do some upfront checks, and possibly modify sys.path if needed to find the needed module. This can also speed up load time on larger programs, because only files that are imported will be run from bytecode. | 4 | 5 | 0 | I'm in a bit of a discussion with some other developers on an open source project. I'm new to python but it seems to me that site-packages is meant for libraries and not end user applications. Is that true or is site-packages an appropriate place to install an application meant to be run by an end user? | Is site-packages appropriate for applications or just libraries? | 0.119427 | 0 | 0 | 294 |
787,015 | 2009-04-24T18:22:00.000 | 4 | 0 | 1 | 0 | python | 787,200 | 5 | false | 1 | 0 | We do it like this.
Most stuff we download is in site-packages. They come from pypi or Source Forge or some other external source; they are easy to rebuild; they're highly reused; they don't change much.
Must stuff we write is in other locations (usually under /opt, or c:\opt) AND is included in the PYTHONPATH.
There's no great reason for keeping our stuff out of site-packages. However, our feeble excuse is that our stuff changes a lot. Pretty much constantly. To reinstall in site-packages every time we think we have something better is a bit of a pain.
Since we're testing out of our working directories or SVN checkout directories, our test environments make heavy use of PYTHONPATH.
The development use of PYTHONPATH bled over into production. We use a setup.py for production installs, but install to an alternate home under /opt and set the PYTHONPATH to include /opt/ourapp-1.1. | 4 | 5 | 0 | I'm in a bit of a discussion with some other developers on an open source project. I'm new to python but it seems to me that site-packages is meant for libraries and not end user applications. Is that true or is site-packages an appropriate place to install an application meant to be run by an end user? | Is site-packages appropriate for applications or just libraries? | 0.158649 | 0 | 0 | 294 |
787,015 | 2009-04-24T18:22:00.000 | 0 | 0 | 1 | 0 | python | 787,203 | 5 | false | 1 | 0 | Site-packages is for libraries, definitely.
A hybrid approach might work: you can install the libraries required by your application in site-packages and then install the main module elsewhere. | 4 | 5 | 0 | I'm in a bit of a discussion with some other developers on an open source project. I'm new to python but it seems to me that site-packages is meant for libraries and not end user applications. Is that true or is site-packages an appropriate place to install an application meant to be run by an end user? | Is site-packages appropriate for applications or just libraries? | 0 | 0 | 0 | 294 |
787,330 | 2009-04-24T19:57:00.000 | 2 | 0 | 0 | 1 | python,aptana | 14,819,410 | 7 | false | 0 | 0 | To add the current Python version on Mac:
Add new interpreter via Aptana Studio 3/Preferences/PyDev/Interpreter-Python.
Give it name (check version using the Terminal and then python or /usr/bin/python.
Then add the path (2.7 in my case): /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
If you install your own (2.6 in my case) use the following path instead:
/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
Don't forget to hit the "Apply" button... | 2 | 2 | 0 | How do I get python to work with aptana studio?
I've downloaded a bunch of stuff, but none of them seem to give me a straight text editor where I can interpret code into an executable type thing. I know there's interactive mode in IDLE, but I want to actually use an editor. So I downloaded the pydev extensions for Aptana studio, but it wants me to configure a python interpreter (so I guess it actually doesn't have one). Where can I find a straight python interpreter that will work with this? or another IDE? | How to install Python on mac os x and windows with Aptana Studio? | 0.057081 | 0 | 0 | 3,309 |
787,330 | 2009-04-24T19:57:00.000 | 0 | 0 | 0 | 1 | python,aptana | 788,002 | 7 | false | 0 | 0 | On Mac OS X Leopard and Tiger, Python is already installed.
On Mac, I've tried a few editor. Textmate is my current choice. If you're looking for a free one, I really liked Xcode. But you'll have to run your script from the command line.
If you want a cross-platform environment, you could try Eclipse and the pydev extension. So you don't get lost between the two platform. | 2 | 2 | 0 | How do I get python to work with aptana studio?
I've downloaded a bunch of stuff, but none of them seem to give me a straight text editor where I can interpret code into an executable type thing. I know there's interactive mode in IDLE, but I want to actually use an editor. So I downloaded the pydev extensions for Aptana studio, but it wants me to configure a python interpreter (so I guess it actually doesn't have one). Where can I find a straight python interpreter that will work with this? or another IDE? | How to install Python on mac os x and windows with Aptana Studio? | 0 | 0 | 0 | 3,309 |
787,812 | 2009-04-24T22:32:00.000 | 2 | 0 | 1 | 1 | python,librsvg,rsvg | 787,960 | 1 | true | 0 | 0 | No longer relevant. Installed the entire package, and got rsvg that way. | 1 | 4 | 0 | I need rsvg support in Python 2.5.2. It appears that I have to install all 199 deps along with the package python-gnome2-desktop, which doesn't sound fun at all.
Alternatives? | How to install python-rsvg without python-gnome2-desktop on Ubuntu 8.10? | 1.2 | 0 | 0 | 3,929 |
787,849 | 2009-04-24T23:45:00.000 | 2 | 0 | 1 | 0 | python | 787,995 | 7 | false | 0 | 0 | Also, right now the 2.x branch is the most supported one, so I would also say that it's a good reason to start with that version.
And when the moment comes, you can always switch to Python 3. | 3 | 2 | 0 | I am just learning python on my ubuntu 8.04 machine which comes with
python 2.5 install. Is 2.5 too dated to continue learning? How much
of 2.5 version is still valid python code in the newer version? | python 2.5 dated? | 0.057081 | 0 | 0 | 434 |
787,849 | 2009-04-24T23:45:00.000 | 2 | 0 | 1 | 0 | python | 788,020 | 7 | false | 0 | 0 | Python 2.5 is fine. There are still plenty of people on Python 2.4 and 2.3. | 3 | 2 | 0 | I am just learning python on my ubuntu 8.04 machine which comes with
python 2.5 install. Is 2.5 too dated to continue learning? How much
of 2.5 version is still valid python code in the newer version? | python 2.5 dated? | 0.057081 | 0 | 0 | 434 |
787,849 | 2009-04-24T23:45:00.000 | 3 | 0 | 1 | 0 | python | 787,903 | 7 | false | 0 | 0 | I don't have any statistics but my impression is that Python 2.5 is the version most in use today. It is certainly not "dated" - I still use Python 2.5 and I expect that I will be using it for weeks or months yet to come.
If you have Python 2.6 available, though, I would suggest upgrading, as it's still fairly similar to Python 2.5 but will put you in better position for using Python 3. | 3 | 2 | 0 | I am just learning python on my ubuntu 8.04 machine which comes with
python 2.5 install. Is 2.5 too dated to continue learning? How much
of 2.5 version is still valid python code in the newer version? | python 2.5 dated? | 0.085505 | 0 | 0 | 434 |
788,083 | 2009-04-25T02:19:00.000 | 0 | 0 | 0 | 0 | python | 789,282 | 4 | false | 1 | 0 | Google App Engine will provide hosting for free as well as Django and a db.. | 1 | 1 | 0 | I need to build a web site with the following features:
1) user forum where we expect light daily traffic
2) database backend for users to create profiles, where they can log in
and upload media (pictures)
3) users can uses their profile to buy content from an online inventory
4) create web pages, shopping carts etc for online inventory
5) secure online credit card processing
I am very familiar with python but not with python web frameworks. I do know
some SQL. How do I get started developing something like this? Is Django
a good alternative?
Not programming related per se: Where do you recommend I get web hosting with a domain
name for an application like this? | Web development with python and sql | 0 | 0 | 0 | 527 |
788,102 | 2009-04-25T02:36:00.000 | 1 | 0 | 1 | 1 | python,blender | 788,143 | 4 | false | 0 | 0 | Personally, I was setting my PATH environment variable so that Blender would find the most appropriate version of Python first. | 2 | 3 | 0 | How do I point Blender to the version of python I have installed | Blender- python | 0.049958 | 0 | 0 | 1,821 |
788,102 | 2009-04-25T02:36:00.000 | 5 | 0 | 1 | 1 | python,blender | 7,134,809 | 4 | false | 0 | 0 | Blender 2.5x now comes bundled with its own python, this is un-modified, only included to so users don't have to match their system versions of python.
If you remove this python/ directory blender will look for python on the system, matching the version it was compiled with. (3.2, 3.3 etc, minor point releases are all inter compatible).
If you want to point to a non-standard python path you can set PYTHONHOME environment variable - python documents how this works (nothing specific to blender). | 2 | 3 | 0 | How do I point Blender to the version of python I have installed | Blender- python | 0.244919 | 0 | 0 | 1,821 |
788,411 | 2009-04-25T06:59:00.000 | 0 | 1 | 0 | 1 | python,process,daemon | 66,500,807 | 20 | false | 0 | 0 | I was looking for an answer on this and in my case, came to mind a very easy and very good solution, in my opinion (since it's not possible to exist a false positive on this, I guess - how can the timestamp on the TXT be updated if the program doesn't do it):
--> just keep writing on a TXT the current timestamp in some time interval, depending on your needs (here each half hour was perfect).
If the timestamp on the TXT is outdated relatively to the current one when you check, then there was a problem on the program and it should be restarted or what you prefer to do. | 1 | 121 | 0 | I have a python daemon running as a part of my web app/ How can I quickly check (using python) if my daemon is running and, if not, launch it?
I want to do it that way to fix any crashes of the daemon, and so the script does not have to be run manually, it will automatically run as soon as it is called and then stay running.
How can i check (using python) if my script is running? | Check to see if python script is running | 0 | 0 | 0 | 189,116 |
789,468 | 2009-04-25T18:30:00.000 | 0 | 0 | 0 | 0 | python | 789,671 | 1 | true | 1 | 0 | "Is it possible to work with 'identity' object at entire framework?"
"But it is really tough to define "Identity" as an object due to its complex nature. "
Until you define identity, yes, it's difficult to work with.
Identity has to be positively specified. Leaving it so vague that "It may contain anything, that is specific to application" means you can't ever get started writing anything useful because you're too worried that "someday someone might invent a concept of identity that you can't handle".
Stop worrying. Identity is well defined and is not complex. HTTP and other protocols define "authorization" (really authentication) with usernames, passwords and realms. And that's all you really need.
Do what Django does: allow someone to add a "Profile" with additional facts about the person. The Profile is not central to identify and authentication. It's not central to authorization. But anyone can add "Profile" stuff for their specific application.
Do not write one model that does everything.
Write one model that works and someone can add to. | 1 | 0 | 0 | I want to write a simple web framework myself using WSGI, Python. I am in study to understand the authorization system.
The system needs to be more modular and abstract enough to add new system into the project as a plug-in. User may use DB or distributed key/value pair, bigtable, etc to store their information.
Lets say, these sort of stuffs are containers or providers which can be written as plug-ins into the system.
I want to define very higher level IDENTITY to the user who logged in. "Identity" is the right word, used by the many frameworks. But it is really tough to define "Identity" as an object due to its complex nature. It may contain anything, that is specific to application. But, when we writing the application, the application shall take care, what is in the identity. But as a framework, it doesn't care about what is identity.
Authentication shall be separated from authorization.
Users, Group, Role/Permissions can be designed as a plug-ins. The idea behind this concept is, write a good framework (atleast for me for research) with enough space for plug-ins and allow the application developers write the portable code which suites the application.
Is it possible to work with 'identity' object at entire framework? | Handling Authorization in web frameworks | 1.2 | 0 | 0 | 321 |
789,598 | 2009-04-25T19:48:00.000 | 2 | 1 | 1 | 0 | c++,python,distribution,embedded-language | 789,669 | 2 | false | 0 | 0 | It shouldn't be too difficult to write a script for that. Check out the zipfile.PyZipFile class and it's writepy method. | 1 | 3 | 0 | I am using Python as a plug-in scripting language for an existing C++ application. I am able to embed the python interpreter as stated in the Python documentation. Everything works successfully with the initialization and de-initialization of the interpreter. I am, however, having trouble loading modules because I have not been able to zip up the standard library in to a zip file (normally PythonXX.zip, corresponding to the version number of the python dll).
What is the simplest way to zip up all of the standard library after optimized bytecode compiling? I'm looking for a simple script or command to do so for me, as I really don't want to do this by hand.
Any ideas?
Thanks! | What is the easiest way to build Python26.zip for embedded distribution? | 0.197375 | 0 | 0 | 845 |
789,685 | 2009-04-25T20:35:00.000 | 0 | 1 | 0 | 0 | python,django,email | 789,699 | 4 | false | 1 | 0 | but I don't really think it is
feasible to actually support all these
emails account normally through a
webmail program
I think that your base assumption here is incorrect. You see, most 'webmail' programs are just frontends (or clients) to the backend mail system (postfix etc). You will need to see how your webhost is set up. There is no reason why you can not create these accounts programmatically and then let them use a normal webmail interface like SquirrelMail or RoundCube. For instance, my webhost (bluehost) allows me 2500 email accounts - I am not sure how many yours allows - but I can upgrade to unlimited for a few extra dollars a month. I think that using the builtin email handling facility is a more robust way to go. | 1 | 2 | 0 | I'd like to provide a functionality for users of my website to get assigned an email address upon registration (such as [email protected]) but I don't really think it is feasible to actually support all these emails account normally through a webmail program. I am also not sure if my webhost would be cool with it. What I'd really want is to be able to have a seamless integration of this email into the bigger system that the website is, as it is mostly going to be for intra-site messaging but we want to allow users to put actual email addresses. So what I would like to do instead is have a catch-all account under mydomain and have this email look at incoming mail, see who it was meant to be sent to, and add a message for the user in the system.
So, the questions are:
1) Is this the right approach? How expensive would it be to get a host that would allow me to just assign emails to at will to my domain? I am currently using WebFaction's shared hosting.
2) If it is an okay approach, what is the best way to route this catch all account to my python script? I have read about .forward but I am not very good at UNIX stuff. Once I figure that out, how would I get the script to be in the "Django environment" so I can use Django's model functionality to add the new messages to the user?
3) Is there anything Django can do to make this any easier?
4) Are there any tools in Python to help me parse the email address? How do they work? | What is the best way to redirect email to a Python script? | 0 | 0 | 0 | 2,191 |
789,718 | 2009-04-25T21:02:00.000 | 0 | 1 | 1 | 0 | python,oop | 789,746 | 4 | false | 0 | 0 | Python is a language that supports object oriented coding, but it deliberately isn't a pure OO language. As you correctly mention, Python classes, even user defined ones, haven't always derived from a single base class.
Functions are the basic unit of functionality in Python, so it makes sense for the core operations (random sample: str, dir, print, hash) to look like functions. | 2 | 4 | 0 | (I'm sure this is a FAQ, but also hard to google)
Why does Python use abs(x) instead of x.abs?
As far as I see everything abs() does besides calling x.__abs__ could just as well be implemented in object.abs()
Is it historical, because there hasn't always been a root class? | Why builtin functions instead of root class methods? | 0 | 0 | 0 | 635 |
789,718 | 2009-04-25T21:02:00.000 | 1 | 1 | 1 | 0 | python,oop | 789,724 | 4 | false | 0 | 0 | I think you are looking a typical example where a language designer decides that readability and terseness trump purist constructs. | 2 | 4 | 0 | (I'm sure this is a FAQ, but also hard to google)
Why does Python use abs(x) instead of x.abs?
As far as I see everything abs() does besides calling x.__abs__ could just as well be implemented in object.abs()
Is it historical, because there hasn't always been a root class? | Why builtin functions instead of root class methods? | 0.049958 | 0 | 0 | 635 |
789,953 | 2009-04-25T23:49:00.000 | 0 | 1 | 1 | 1 | python,localization | 790,078 | 2 | false | 0 | 0 | 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. | 1 | 1 | 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. | Locales and temperature/length conversion | 0 | 0 | 0 | 355 |
790,560 | 2009-04-26T09:36:00.000 | 5 | 0 | 1 | 0 | python | 791,093 | 3 | false | 0 | 0 | No, Python's internals take great care to make built-in types NOT mutable -- very different design choices from Ruby's. It's not possible to make object "monkeypatchable" without deeply messing with the C-coded internals and recompiling the Python runtime to make a very different version (this is for the classic CPython, but I believe exactly the same principle holds for other good implementations such as Jython and IronPython, just s/C/Java/ and S/C/C#/ respectively;-). | 2 | 4 | 0 | Is it possible to add a method to an object class, and use it on all objects? | Object class override or modify | 0.321513 | 0 | 0 | 1,826 |
790,560 | 2009-04-26T09:36:00.000 | 0 | 0 | 1 | 0 | python | 790,574 | 3 | false | 0 | 0 | >>> object.test = "Test"
Traceback (most recent call last):
File "", line 1, in
TypeError: can't set attributes of built-in/extension type 'object'
Doesn't look like it. (Python 2.5.1) | 2 | 4 | 0 | Is it possible to add a method to an object class, and use it on all objects? | Object class override or modify | 0 | 0 | 0 | 1,826 |
790,613 | 2009-04-26T10:37:00.000 | 2 | 0 | 0 | 0 | python,set,acl,pickle | 791,425 | 4 | false | 1 | 0 | Me, I'd stick with keeping persistent info in the relational DB in a form that's independent from a specific programming language used to access it -- much as I love Python (and that's a lot), some day I may want to access that info from some other language, and if I went for Python-specific formats... boy would I ever regret it... | 2 | 1 | 0 | Currently I have tables like: Pages, Groups, GroupPage, Users, UserGroup. With pickled sets I can implement the same thing with only 3 tables: Pages, Groups, Users.
set seems a natural choice for implementing ACL, as group and permission related operations can be expressed very naturally with sets. If I store the allow/deny lists as pickled sets, it can eliminate few intermediate tables for many-to-many relationship and allow permission editing without many database operations.
If human readability is important, I can always use json instead of cPickle for serialization and use set when manipulating the permission list in Python. It is highly unlikely that permissions will ever be edited directly using SQL. So is it a good design idea?
We're using SQLAlchemy as ORM, so it's likely to be implemented with PickleType column. I'm not planning to store the whole pickled "resource" recordset, only the set object made out of "resource" primary key values. | Using Python set type to implement ACL | 0.099668 | 1 | 0 | 2,877 |
790,613 | 2009-04-26T10:37:00.000 | 2 | 0 | 0 | 0 | python,set,acl,pickle | 790,662 | 4 | false | 1 | 0 | You need to consider what it is that a DBMS provides you with, and which of those features you'll need to reimplement.
The issue of concurrency is a big one. There are a few race conditions to be considered (such as multiple writes taking place in different threads and processes and overwriting the new data), performance issues (write policy? What if your process crashes and you lose your data?), memory issues (how big are your permission sets? Will it all fit in RAM?).
If you have enough memory and you don't have to worry about concurrency, then your solution might be a good one. Otherwise I'd stick with a databases -- it takes care of those problems for you, and lots of work has gone into them to make sure that they always take your data from one consistent state to another. | 2 | 1 | 0 | Currently I have tables like: Pages, Groups, GroupPage, Users, UserGroup. With pickled sets I can implement the same thing with only 3 tables: Pages, Groups, Users.
set seems a natural choice for implementing ACL, as group and permission related operations can be expressed very naturally with sets. If I store the allow/deny lists as pickled sets, it can eliminate few intermediate tables for many-to-many relationship and allow permission editing without many database operations.
If human readability is important, I can always use json instead of cPickle for serialization and use set when manipulating the permission list in Python. It is highly unlikely that permissions will ever be edited directly using SQL. So is it a good design idea?
We're using SQLAlchemy as ORM, so it's likely to be implemented with PickleType column. I'm not planning to store the whole pickled "resource" recordset, only the set object made out of "resource" primary key values. | Using Python set type to implement ACL | 0.099668 | 1 | 0 | 2,877 |
790,711 | 2009-04-26T11:53:00.000 | 1 | 0 | 1 | 0 | indentation,python-idle,code-editor | 53,364,383 | 8 | false | 0 | 0 | By default, IDLE has it on Shift-Left Bracket. However, if you want, you can customise it to be Shift-Tab by clicking Options --> Configure IDLE --> Keys --> Use a Custom Key Set --> dedent-region --> Get New Keys for Selection
Then you can choose whatever combination you want. (Don't forget to click apply otherwise all the settings would not get affected.) | 6 | 45 | 0 | If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE. | How to remove tab indent from several lines in IDLE? | 0.024995 | 0 | 0 | 170,386 |
790,711 | 2009-04-26T11:53:00.000 | 52 | 0 | 1 | 0 | indentation,python-idle,code-editor | 790,740 | 8 | false | 0 | 0 | If you're using IDLE, you can use Ctrl+] to indent and Ctrl+[ to unindent. | 6 | 45 | 0 | If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE. | How to remove tab indent from several lines in IDLE? | 1 | 0 | 0 | 170,386 |
790,711 | 2009-04-26T11:53:00.000 | 48 | 0 | 1 | 0 | indentation,python-idle,code-editor | 790,788 | 8 | false | 0 | 0 | If you're using IDLE, and the Norwegian keyboard makes Ctrl-[ a problem, you can change the key.
Go Options->Configure IDLE.
Click the Keys tab.
If necessary, click Save as New Custom Key Set.
With your custom key set, find "dedent-region" in the list.
Click Get New Keys for Selection.
etc
I tried putting in shift-Tab and that worked nicely. | 6 | 45 | 0 | If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE. | How to remove tab indent from several lines in IDLE? | 1 | 0 | 0 | 170,386 |
790,711 | 2009-04-26T11:53:00.000 | 8 | 0 | 1 | 0 | indentation,python-idle,code-editor | 34,186,944 | 8 | false | 0 | 0 | in pythonwin,
SHIFT + TAB works | 6 | 45 | 0 | If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE. | How to remove tab indent from several lines in IDLE? | 1 | 0 | 0 | 170,386 |
790,711 | 2009-04-26T11:53:00.000 | 6 | 0 | 1 | 0 | indentation,python-idle,code-editor | 41,728,365 | 8 | false | 0 | 0 | For IDLE, select the lines, then open the "Format" menu. (Between "Edit" and "Run" if you're having trouble finding it.) This will also give you the keyboard shortcut, for me it turned out that dedent shortcut was "Ctrl+[" | 6 | 45 | 0 | If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE. | How to remove tab indent from several lines in IDLE? | 1 | 0 | 0 | 170,386 |
790,711 | 2009-04-26T11:53:00.000 | 32 | 0 | 1 | 0 | indentation,python-idle,code-editor | 790,713 | 8 | false | 0 | 0 | Depends on your editor.
Have you tried Shift+Tab? | 6 | 45 | 0 | If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE. | How to remove tab indent from several lines in IDLE? | 1 | 0 | 0 | 170,386 |
791,098 | 2009-04-26T16:11:00.000 | 2 | 0 | 1 | 0 | python | 791,116 | 4 | true | 0 | 0 | Use globals()['do_on_' + platform] instead of the getattr call and your original idea should work whether this is inside a package or not. | 1 | 2 | 0 | I need to make one function in a module platform-independent by offering several implementations, without changing any files that import it. The following works:
do_it = getattr(__import__(__name__), "do_on_" + sys.platform)
...but breaks if the module is put into a package.
An alternative would be an if/elif with hard-coded calls to the others in do_it().
Anything better? | How to offer platform-specific implementations of a module? | 1.2 | 0 | 0 | 1,942 |
792,629 | 2009-04-27T08:19:00.000 | 7 | 1 | 1 | 0 | python,build-process,build-automation | 792,646 | 12 | false | 0 | 0 | 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. | 6 | 18 | 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. | Is Python the right hammer for this nail? (build script) | 1 | 0 | 0 | 9,281 |
792,629 | 2009-04-27T08:19:00.000 | 4 | 1 | 1 | 0 | python,build-process,build-automation | 792,636 | 12 | false | 0 | 0 | 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? | 6 | 18 | 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. | Is Python the right hammer for this nail? (build script) | 0.066568 | 0 | 0 | 9,281 |
792,629 | 2009-04-27T08:19:00.000 | 9 | 1 | 1 | 0 | python,build-process,build-automation | 792,663 | 12 | false | 0 | 0 | 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). | 6 | 18 | 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. | Is Python the right hammer for this nail? (build script) | 1 | 0 | 0 | 9,281 |
792,629 | 2009-04-27T08:19:00.000 | 1 | 1 | 1 | 0 | python,build-process,build-automation | 792,676 | 12 | false | 0 | 0 | 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. | 6 | 18 | 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. | Is Python the right hammer for this nail? (build script) | 0.016665 | 0 | 0 | 9,281 |
792,629 | 2009-04-27T08:19:00.000 | 3 | 1 | 1 | 0 | python,build-process,build-automation | 793,354 | 12 | false | 0 | 0 | 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? | 6 | 18 | 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. | Is Python the right hammer for this nail? (build script) | 0.049958 | 0 | 0 | 9,281 |
792,629 | 2009-04-27T08:19:00.000 | 1 | 1 | 1 | 0 | python,build-process,build-automation | 792,680 | 12 | false | 0 | 0 | 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 :) | 6 | 18 | 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. | Is Python the right hammer for this nail? (build script) | 0.016665 | 0 | 0 | 9,281 |
793,125 | 2009-04-27T11:31:00.000 | 0 | 0 | 1 | 0 | python,d,ctypes | 4,884,444 | 1 | false | 0 | 0 | In this case Windows dlls should work just fine. I'm not sure about the situation on Linux, there are some issues with shared libraries which will be addressed as soon as the 64 bit port of dmd is finished.
Note that you have to export your functions as extern(C) or extern(Windows) to access them from ctypes. | 1 | 1 | 0 | I've been playing around with the rather excellent ctypes library in Python recently. What i was wondering is, is it possible to create shared D libraries and call them in the same way. I'm assuming i would compile the .so files using the -fPIC with dmd or gdc and call them the same way using the ctypes library.
Has anyone tried this ? It looks as if shared libs on UNIX are partially supported.
Many thanks,
Al. | Calling gdc/dmd shared libraries from Python using ctypes | 0 | 0 | 0 | 482 |
794,132 | 2009-04-27T15:48:00.000 | 1 | 0 | 1 | 0 | python | 794,157 | 7 | true | 0 | 0 | I've asked myself the same question, albeit while doing 2D geometry stuff.
The answer I found for myself was that if I was planning to write a larger library, with more functions and whatnot, go ahead and return the Point, or in your case the Coord3D object. If it's just a hacky implementation, the tuple will get you going faster. In the end, it's just what you're going to do with it, and is it worth the effort. | 3 | 11 | 0 | I am developing in python a file class that can read and write a file, containing a list of xyz coordinates. In my program, I already have a Coord3D class to hold xyz coordinates.
My question is relative to the design of a getCoordinate(index) method. Should I return a tuple of floats, or a Coord3D object?
In the first case, I get very low coupling, but then I will probably have to instantiate a Coord3D object with the obtained values anyway, although outside of the file class. In the second case, I will have the file class tightly coupled with the Coord3D class.
Please note that I think there's not a huge difference between the two solutions, but I would like to read your answer and the reason behind it.
Edit: to recap the answers I got until now, it looks like there's no clearcut choice. It has been said (appropriately) that python is not Java, and you don't need a specialized class for everything just because you need it by language architecture. In my case, however, I have the following conditions:
I am working on a library, where the Coord3D object is used as is. Using it would increase the cohesiveness of my library, as the data types will be uniformly used.
The Coord3D object has state and behavior. Indeed, the Coord3D object aggregate the coordinates and the units in a single entity. Operations among Coord3D objects will keep into account the potentially different units, and act accordingly.
I can put centralize control code into the Coord3D class instantiation to refuse, for example, arrays of length 4, or non units. If I use a tuple, I cannot perform this check. Moreover, if a method accepts a Coord3D, is sort of guaranteed that it's well formed upfront (you could be bold and check for isinstance, or check the interface). A tuple can contain invalid data. Although python approach to error handling is done where the trouble happen, a class preventing me to have an xyz coordinate made out of three strings is somehow beneficial (correct me if wrong, please)
On the other hand, using a tuple has the following advantages:
Less occupation of resources, quite critical in case of huge
Simpler design. More classes means more complex design. A tuple is a standard data type which is well understood and can be unpacked easily. A personalized class is not.
Using a tuple, the XYZFile class is totally decoupled from the rest of the library (because it does not use the Coord3D object). This means that it can be reused totally as an independent entity.
further comments very welcome! | Returning an object vs returning a tuple | 1.2 | 0 | 0 | 7,405 |
794,132 | 2009-04-27T15:48:00.000 | 2 | 0 | 1 | 0 | python | 794,200 | 7 | false | 0 | 0 | The more fundamental question is "why do you have Coord3D class?" Why not just use a tuple?
The general advice most of us give to Python n00bz is "don't invent new classes until you have to."
Does your Coord3D have unique methods? Perhaps you need a new class. Or -- perhaps -- you only need some functions that operate on tuples.
Does your Coord3D have changeable state? Hardly likely. An immutable tuple starts to look like a better representation than a new class. | 3 | 11 | 0 | I am developing in python a file class that can read and write a file, containing a list of xyz coordinates. In my program, I already have a Coord3D class to hold xyz coordinates.
My question is relative to the design of a getCoordinate(index) method. Should I return a tuple of floats, or a Coord3D object?
In the first case, I get very low coupling, but then I will probably have to instantiate a Coord3D object with the obtained values anyway, although outside of the file class. In the second case, I will have the file class tightly coupled with the Coord3D class.
Please note that I think there's not a huge difference between the two solutions, but I would like to read your answer and the reason behind it.
Edit: to recap the answers I got until now, it looks like there's no clearcut choice. It has been said (appropriately) that python is not Java, and you don't need a specialized class for everything just because you need it by language architecture. In my case, however, I have the following conditions:
I am working on a library, where the Coord3D object is used as is. Using it would increase the cohesiveness of my library, as the data types will be uniformly used.
The Coord3D object has state and behavior. Indeed, the Coord3D object aggregate the coordinates and the units in a single entity. Operations among Coord3D objects will keep into account the potentially different units, and act accordingly.
I can put centralize control code into the Coord3D class instantiation to refuse, for example, arrays of length 4, or non units. If I use a tuple, I cannot perform this check. Moreover, if a method accepts a Coord3D, is sort of guaranteed that it's well formed upfront (you could be bold and check for isinstance, or check the interface). A tuple can contain invalid data. Although python approach to error handling is done where the trouble happen, a class preventing me to have an xyz coordinate made out of three strings is somehow beneficial (correct me if wrong, please)
On the other hand, using a tuple has the following advantages:
Less occupation of resources, quite critical in case of huge
Simpler design. More classes means more complex design. A tuple is a standard data type which is well understood and can be unpacked easily. A personalized class is not.
Using a tuple, the XYZFile class is totally decoupled from the rest of the library (because it does not use the Coord3D object). This means that it can be reused totally as an independent entity.
further comments very welcome! | Returning an object vs returning a tuple | 0.057081 | 0 | 0 | 7,405 |
794,132 | 2009-04-27T15:48:00.000 | 1 | 0 | 1 | 0 | python | 794,208 | 7 | false | 0 | 0 | Returning an object would be the best practice and would give you a better overall software design. I would recommend doing that
But still, keep in mind that creating/returning an object will take more processing time. It could change something if you do this operation a LOT and in that case you might need to think about it... | 3 | 11 | 0 | I am developing in python a file class that can read and write a file, containing a list of xyz coordinates. In my program, I already have a Coord3D class to hold xyz coordinates.
My question is relative to the design of a getCoordinate(index) method. Should I return a tuple of floats, or a Coord3D object?
In the first case, I get very low coupling, but then I will probably have to instantiate a Coord3D object with the obtained values anyway, although outside of the file class. In the second case, I will have the file class tightly coupled with the Coord3D class.
Please note that I think there's not a huge difference between the two solutions, but I would like to read your answer and the reason behind it.
Edit: to recap the answers I got until now, it looks like there's no clearcut choice. It has been said (appropriately) that python is not Java, and you don't need a specialized class for everything just because you need it by language architecture. In my case, however, I have the following conditions:
I am working on a library, where the Coord3D object is used as is. Using it would increase the cohesiveness of my library, as the data types will be uniformly used.
The Coord3D object has state and behavior. Indeed, the Coord3D object aggregate the coordinates and the units in a single entity. Operations among Coord3D objects will keep into account the potentially different units, and act accordingly.
I can put centralize control code into the Coord3D class instantiation to refuse, for example, arrays of length 4, or non units. If I use a tuple, I cannot perform this check. Moreover, if a method accepts a Coord3D, is sort of guaranteed that it's well formed upfront (you could be bold and check for isinstance, or check the interface). A tuple can contain invalid data. Although python approach to error handling is done where the trouble happen, a class preventing me to have an xyz coordinate made out of three strings is somehow beneficial (correct me if wrong, please)
On the other hand, using a tuple has the following advantages:
Less occupation of resources, quite critical in case of huge
Simpler design. More classes means more complex design. A tuple is a standard data type which is well understood and can be unpacked easily. A personalized class is not.
Using a tuple, the XYZFile class is totally decoupled from the rest of the library (because it does not use the Coord3D object). This means that it can be reused totally as an independent entity.
further comments very welcome! | Returning an object vs returning a tuple | 0.028564 | 0 | 0 | 7,405 |
795,241 | 2009-04-27T20:49:00.000 | 1 | 1 | 0 | 0 | java,python,footprint,memory-footprint | 35,581,985 | 1 | false | 1 | 0 | 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. | 1 | 7 | 0 | Can anyone point to serious comparison of Python runtime footprint versus Java?
Thanks,
Avraham | python versus java runtime footprint | 0.197375 | 0 | 0 | 5,256 |
795,405 | 2009-04-27T21:42:00.000 | 3 | 1 | 1 | 0 | python,multithreading | 797,218 | 2 | false | 0 | 0 | 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. | 1 | 6 | 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. | Is there an easy way to tell how much time is spent waiting for the Python GIL? | 0.291313 | 0 | 0 | 536 |
796,319 | 2009-04-28T05:16:00.000 | 17 | 1 | 0 | 1 | python,shell | 796,344 | 8 | false | 0 | 0 | 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. | 8 | 109 | 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. | Strengths of Shell Scripting compared to Python | 1 | 0 | 0 | 63,953 |
796,319 | 2009-04-28T05:16:00.000 | 9 | 1 | 0 | 1 | python,shell | 4,980,553 | 8 | false | 0 | 0 | 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. | 8 | 109 | 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. | Strengths of Shell Scripting compared to Python | 1 | 0 | 0 | 63,953 |
796,319 | 2009-04-28T05:16:00.000 | 5 | 1 | 0 | 1 | python,shell | 9,188,834 | 8 | false | 0 | 0 | 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. | 8 | 109 | 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. | Strengths of Shell Scripting compared to Python | 0.124353 | 0 | 0 | 63,953 |
796,319 | 2009-04-28T05:16:00.000 | 36 | 1 | 0 | 1 | python,shell | 814,425 | 8 | false | 0 | 0 | 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. | 8 | 109 | 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. | Strengths of Shell Scripting compared to Python | 1 | 0 | 0 | 63,953 |
796,319 | 2009-04-28T05:16:00.000 | 58 | 1 | 0 | 1 | python,shell | 797,341 | 8 | false | 0 | 0 | "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. | 8 | 109 | 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. | Strengths of Shell Scripting compared to Python | 1 | 0 | 0 | 63,953 |
796,319 | 2009-04-28T05:16:00.000 | 7 | 1 | 0 | 1 | python,shell | 796,348 | 8 | false | 0 | 0 | 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. | 8 | 109 | 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. | Strengths of Shell Scripting compared to Python | 1 | 0 | 0 | 63,953 |
796,319 | 2009-04-28T05:16:00.000 | 11 | 1 | 0 | 1 | python,shell | 3,074,616 | 8 | false | 0 | 0 | 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! | 8 | 109 | 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. | Strengths of Shell Scripting compared to Python | 1 | 0 | 0 | 63,953 |
796,319 | 2009-04-28T05:16:00.000 | 95 | 1 | 0 | 1 | python,shell | 796,343 | 8 | true | 0 | 0 | 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. | 8 | 109 | 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. | Strengths of Shell Scripting compared to Python | 1.2 | 0 | 0 | 63,953 |
796,490 | 2009-04-28T06:40:00.000 | 1 | 0 | 0 | 0 | python,html,parsing,semantics,html-content-extraction | 796,530 | 5 | false | 1 | 0 | What is meaningful and what is not, it depends on the semantic of the page. If the semantics is crappy, your code won't "guess" what is meaningful. I use readability, which you linked in the comment, and I see that on many pages I try to read it does not provide any result, not talking about a decent one.
If someone puts the content in a table, you're doomed. Try readability on a phpbb forum you'll see what I mean.
If you want to do it, go with a regexp on <p></p>, or parse the DOM. | 1 | 8 | 0 | Of course an HTML page can be parsed using any number of python parsers, but I'm surprised that there don't seem to be any public parsing scripts to extract meaningful content (excluding sidebars, navigation, etc.) from a given HTML doc.
I'm guessing it's something like collecting DIV and P elements and then checking them for a minimum amount of text content, but I'm sure a solid implementation would include plenty of things that I haven't thought of. | python method to extract content (excluding navigation) from an HTML page | 0.039979 | 0 | 1 | 3,581 |
797,771 | 2009-04-28T12:55:00.000 | 4 | 0 | 1 | 0 | python | 797,799 | 8 | false | 0 | 0 | if the variable name is "__secret" and the class name is "MyClass" you can access it like this on an instance named "var"
var._MyClass__secret
The convention to suggest/emulate protection is to name it with a leading underscore: self._protected_variable = 10
Of course, anybody can modify it if it really wants. | 2 | 51 | 0 | How do I access a private attribute of a parent class from a subclass (without making it public)? | Python "protected" attributes | 0.099668 | 0 | 0 | 71,482 |
797,771 | 2009-04-28T12:55:00.000 | 101 | 0 | 1 | 0 | python | 797,814 | 8 | true | 0 | 0 | My understanding of Python convention is
_member is protected
__member is private
Options for if you control the parent class
Make it protected instead of private
since that seems like what you really
want
Use a getter (@property def
_protected_access_to_member...) to limit the protected access
If you don't control it
Undo the name mangling. If you
dir(object) you will see names
something like _Class__member which is
what Python does to leading __ to
"make it private". There isn't
truly private in python. This is probably considered evil. | 2 | 51 | 0 | How do I access a private attribute of a parent class from a subclass (without making it public)? | Python "protected" attributes | 1.2 | 0 | 0 | 71,482 |
797,773 | 2009-04-28T12:56:00.000 | 4 | 0 | 0 | 0 | python,django,caching | 804,829 | 4 | false | 1 | 0 | I have no proof, but I've read BeautifulSoup is slow and consumes a lot of memory. You may want to look at using the lxml module instead. lxml is supposed to be much faster and efficient, and can do much more than BeautifulSoup.
Of course, the parsing probably isn't your bottleneck here; the external I/O is.
First off, use memcached!
Then, one strategy that can be used is as follows:
Your cached object, called A, is stored in the cache with a dynamic key (A_<timestamp>, for example).
Another cached object holds the current key for A, called A_key.
Your app would then get the key for A by first getting the value at A_key
A periodic process would populate the cache with the A_<timestamp> keys and upon completion, change the value at A_key to the new key
Using this method, all users every 5 minutes won't have to wait for the cache to be updated, they'll just get older versions until the update happens. | 2 | 5 | 0 | I have a Django view, which receives part of its data from an external website, which I parse using urllib2/BeautifulSoup.
This operation is rather expensive so I cache it using the low-level cache API, for ~5 minutes. However, each user which accesses the site after the cached data expires will receive a significant delay of a few seconds while I go to the external site to parse the new data.
Is there any way to load the new data lazily so that no user will ever get that kind of delay? Or is this unavoidable?
Please note that I am on a shared hosting server, so keep that in mind with your answers.
EDIT: thanks for the help so far. However, I'm still unsure as to how I accomplish this with the python script I will be calling. A basic test I did shows that the django cache is not global. Meaning if I call it from an external script, it does not see the cache data going on in the framework. Suggestions?
Another EDIT: coming to think of it, this is probably because I am still using local memory cache. I suspect that if I move the cache to memcached, DB, whatever, this will be solved. | Django caching - can it be done pre-emptively? | 0.197375 | 0 | 0 | 1,876 |
797,773 | 2009-04-28T12:56:00.000 | 4 | 0 | 0 | 0 | python,django,caching | 798,462 | 4 | false | 1 | 0 | "I'm still unsure as to how I accomplish this with the python script I will be calling. "
The issue is that your "significant delay of a few seconds while I go to the external site to parse the new data" has nothing to do with Django cache at all.
You can cache it everywhere, and when you go to reparse the external site, there's a delay. The trick is to NOT parse the external site while a user is waiting for their page.
The trick is to parse the external site before a user asks for a page. Since you can't go back in time, you have to periodically parse the external site and leave the parsed results in a local file or a database or something.
When a user makes a request you already have the results fetched and parsed, and all you're doing is presenting. | 2 | 5 | 0 | I have a Django view, which receives part of its data from an external website, which I parse using urllib2/BeautifulSoup.
This operation is rather expensive so I cache it using the low-level cache API, for ~5 minutes. However, each user which accesses the site after the cached data expires will receive a significant delay of a few seconds while I go to the external site to parse the new data.
Is there any way to load the new data lazily so that no user will ever get that kind of delay? Or is this unavoidable?
Please note that I am on a shared hosting server, so keep that in mind with your answers.
EDIT: thanks for the help so far. However, I'm still unsure as to how I accomplish this with the python script I will be calling. A basic test I did shows that the django cache is not global. Meaning if I call it from an external script, it does not see the cache data going on in the framework. Suggestions?
Another EDIT: coming to think of it, this is probably because I am still using local memory cache. I suspect that if I move the cache to memcached, DB, whatever, this will be solved. | Django caching - can it be done pre-emptively? | 0.197375 | 0 | 0 | 1,876 |
798,389 | 2009-04-28T14:54:00.000 | -1 | 0 | 1 | 0 | python,refactoring | 2,398,941 | 5 | false | 0 | 0 | i was confuse in this question too,i have found a search helper help me to find the call hierarchy in another way. not very good but better than donot have. sorry about my english.
ps.IDE eclipse+pydev | 1 | 19 | 0 | I'm digging into a huge legacy Python class that has a lot of methods. I eventually break complex ones into smaller pieces so the amount of methods increases even more. I wonder if there is a tool that can scan the Python code and build some kind of dependency diagram for its methods.
I define method x() to be a dependency of method y() if x() is called at least once in y().
I could use such a tool to isolate (if possible) subsets of class methods that have no external dependencies (all their dependencies are methods from the same subset).
I'm planning to move some functionality into other classes and I think that such an approach would help me to decide which parts to extract from the initial huge class.
Edit: I would really like a command-line tool. | Python tool that builds a dependency diagram for methods of a class | -0.039979 | 0 | 0 | 10,338 |
798,413 | 2009-04-28T14:58:00.000 | 2 | 1 | 0 | 1 | python,perl,domainkeys,dkim | 798,508 | 6 | false | 0 | 0 | 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? | 1 | 6 | 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 | How to call a Perl script from Python, piping input to it? | 0.066568 | 0 | 0 | 13,888 |
800,769 | 2009-04-29T03:37:00.000 | 0 | 0 | 1 | 0 | python,user-interface,python-3.x | 800,794 | 6 | false | 0 | 1 | Just use whichever editor you are most comfortable with.
The "leading space as logic" and duck typing mean that there is a limited amount of syntax checking and re-factoring an editor can reasonably do (or is required!) with python source.
If you dont have a favorite editor then just use the "idle" editor which comes with most python distributions.
If you were talking about a GUI design tool then you need to choose among the several supported GUIs (Tk, WxWindows etc. etc.) before you choose your design tool. | 4 | 3 | 0 | I would like to start learning Python (zero past experience). I am a bit inclined to start with Python 3.0. However, I am not sure if at this time there exists a GUI editor that would be compatible with Python 3.0. I've tried installing Glade, but the one I've got works only with Python 2.5. What could I possibly use with Python 3.0?
Any suggestions are welcomed.
Thanks! | About GUI editor that would be compatible with Python 3.0 | 0 | 0 | 0 | 1,811 |
800,769 | 2009-04-29T03:37:00.000 | 1 | 0 | 1 | 0 | python,user-interface,python-3.x | 800,824 | 6 | false | 0 | 1 | There are many useful libraries (not to mention educational material, cookbook snippets, etc.) that have yet to be ported to Python 3.0, so I recommend using Python 2.x for now (where, currently, 5 <= x <= 6). Doubly so if you're a beginner to Python. Triply so if you're actually planning on releasing some software--many systems do not ship with Python 3.0.
Python 3.0 is not radically different from the Python 2.x series; what you learn in Python 2 will very much still apply to Python 3. Searching Python 3.0 here on SO reveals many threads in which the majority declare that they're not moving to Python 3.0 anytime soon. | 4 | 3 | 0 | I would like to start learning Python (zero past experience). I am a bit inclined to start with Python 3.0. However, I am not sure if at this time there exists a GUI editor that would be compatible with Python 3.0. I've tried installing Glade, but the one I've got works only with Python 2.5. What could I possibly use with Python 3.0?
Any suggestions are welcomed.
Thanks! | About GUI editor that would be compatible with Python 3.0 | 0.033321 | 0 | 0 | 1,811 |
800,769 | 2009-04-29T03:37:00.000 | 0 | 0 | 1 | 0 | python,user-interface,python-3.x | 800,941 | 6 | false | 0 | 1 | WING 3.2 beta work in python 3.
ricnar | 4 | 3 | 0 | I would like to start learning Python (zero past experience). I am a bit inclined to start with Python 3.0. However, I am not sure if at this time there exists a GUI editor that would be compatible with Python 3.0. I've tried installing Glade, but the one I've got works only with Python 2.5. What could I possibly use with Python 3.0?
Any suggestions are welcomed.
Thanks! | About GUI editor that would be compatible with Python 3.0 | 0 | 0 | 0 | 1,811 |
800,769 | 2009-04-29T03:37:00.000 | 0 | 0 | 1 | 0 | python,user-interface,python-3.x | 800,918 | 6 | false | 0 | 1 | The only GUI toolkit currently available in Python3.0 is Tkinter, and I don't think there are any Python3.0 GUI-builders available yet. | 4 | 3 | 0 | I would like to start learning Python (zero past experience). I am a bit inclined to start with Python 3.0. However, I am not sure if at this time there exists a GUI editor that would be compatible with Python 3.0. I've tried installing Glade, but the one I've got works only with Python 2.5. What could I possibly use with Python 3.0?
Any suggestions are welcomed.
Thanks! | About GUI editor that would be compatible with Python 3.0 | 0 | 0 | 0 | 1,811 |
800,849 | 2009-04-29T04:17:00.000 | 2 | 0 | 0 | 0 | python,user-interface,ide,wxpython,tkinter | 17,740,395 | 8 | false | 0 | 1 | I use Eclipse with PyDev as my Python IDE (Which is probably not the best solution out there, but it is quite decent)
For GUI developement, I have used wxGlade for a mid-sized project and found it to be quite easy to use one you've grasped the concepts of WxPython. The XML generation is very useful for separating actual GUI design from program logic.
All of the these are free. | 2 | 43 | 0 | I have a little experience developing small command-line applications with Python. I want to move on to developing GUIs with Python. From the available GUI toolkits for Python, the ones I feel the most inclined to are wxPython and Tkinter; but I don't want to code all of the GUI by myself all of the time.
Are there any good GUI IDEs for any of these toolkits? It doesn't need to be free or open source. | Nice IDE with GUI designer for wxPython or Tkinter | 0.049958 | 0 | 0 | 70,190 |
800,849 | 2009-04-29T04:17:00.000 | 0 | 0 | 0 | 0 | python,user-interface,ide,wxpython,tkinter | 801,176 | 8 | false | 0 | 1 | I've used wxGlade for a few mission-critical apps. If you're a little weak in wx, it can be rough, but once you get used to it, its a great tool. | 2 | 43 | 0 | I have a little experience developing small command-line applications with Python. I want to move on to developing GUIs with Python. From the available GUI toolkits for Python, the ones I feel the most inclined to are wxPython and Tkinter; but I don't want to code all of the GUI by myself all of the time.
Are there any good GUI IDEs for any of these toolkits? It doesn't need to be free or open source. | Nice IDE with GUI designer for wxPython or Tkinter | 0 | 0 | 0 | 70,190 |
801,090 | 2009-04-29T06:17:00.000 | -5 | 1 | 0 | 0 | php,python,vcl4php | 801,196 | 14 | false | 1 | 0 | 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. | 5 | 6 | 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. | Looking for a PHP and/or Python RAD | -1 | 0 | 0 | 3,848 |
801,090 | 2009-04-29T06:17:00.000 | 2 | 1 | 0 | 0 | php,python,vcl4php | 801,278 | 14 | false | 1 | 0 | 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. | 5 | 6 | 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. | Looking for a PHP and/or Python RAD | 0.028564 | 0 | 0 | 3,848 |
801,090 | 2009-04-29T06:17:00.000 | 0 | 1 | 0 | 0 | php,python,vcl4php | 1,256,441 | 14 | false | 1 | 0 | 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. | 5 | 6 | 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. | Looking for a PHP and/or Python RAD | 0 | 0 | 0 | 3,848 |
801,090 | 2009-04-29T06:17:00.000 | 1 | 1 | 0 | 0 | php,python,vcl4php | 4,500,774 | 14 | false | 1 | 0 | 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. | 5 | 6 | 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. | Looking for a PHP and/or Python RAD | 0.014285 | 0 | 0 | 3,848 |
801,090 | 2009-04-29T06:17:00.000 | 1 | 1 | 0 | 0 | php,python,vcl4php | 801,096 | 14 | false | 1 | 0 | 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. | 5 | 6 | 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. | Looking for a PHP and/or Python RAD | 0.014285 | 0 | 0 | 3,848 |
801,432 | 2009-04-29T08:28:00.000 | 0 | 0 | 1 | 0 | c#,winforms,ironpython | 801,447 | 5 | false | 0 | 0 | IronRuby comes with a command line interpreter. Doesn't IronPython also have one? If so, the source code would be a good start :)
Oh, and if it doesn't, be sure to look at the IronRuby interpreter, because both languages are based on the DLR and are therefore similar enough to learn from both. | 1 | 0 | 0 | I'd like to add "IDLE-like functionality" to C# WinForms application, but I don't quite have an idea how to do that and couldn't find anything useful with Google.
So basically I want interactive command line interface, where user could enter some Python code and execute it (not just expressions, should be possible to define new functions).
So, where to start? Are there any good tutorials or samples available? | How to create IDLE -like functionality to WinForms application | 0 | 0 | 0 | 975 |
801,515 | 2009-04-29T09:01:00.000 | 0 | 0 | 0 | 0 | python,informix | 823,474 | 2 | false | 0 | 0 | Does other way to connect to database work?
Can you use (configure in control panel) ODBC? If ODBC works then you can use Python win32 extensions (ActiveState distribution comes with it) and there is ODBC support. You can also use Jython which can work with ODBC via JDBC-ODBC bridge or with Informix JDBC driver. | 2 | 1 | 0 | I have downloaded & installed the latest Python InformixDB package, but when I try to import it from the shell, I am getting the following error in the form of a Windows dialog box!
"A procedure entry point sqli_describe_input_stmt could not be located in the dynamic link isqlit09a.dll"
Any ideas what's happening?
Platform: Windows Vista (Biz Edition), Python 2.5. | Why Python informixdb package is throwing an error! | 0 | 1 | 0 | 435 |
801,515 | 2009-04-29T09:01:00.000 | 1 | 0 | 0 | 0 | python,informix | 803,958 | 2 | false | 0 | 0 | Which version of IBM Informix Connect (I-Connect) or IBM Informix ClientSDK (CSDK) are you using? The 'describe input' function is a more recent addition, but it is likely that you have it.
Have you been able to connect to any Informix DBMS from the command shell? If not, then the suspicion must be that you don't have the correct environment. You would probably need to specify $INFORMIXDIR (or %INFORMIXDIR% - I'm going to omit '$' and '%' sigils from here on); you would need to set INFORMIXSERVER to connect successfully; you would need to have the correct directory (probably INFORMIXDIR/bin on Windows; on Unix, it would be INFORMIXDIR/lib and INFORMIXDIR/lib/esql or INFORMIXDIR/lib/odbc) on your PATH. | 2 | 1 | 0 | I have downloaded & installed the latest Python InformixDB package, but when I try to import it from the shell, I am getting the following error in the form of a Windows dialog box!
"A procedure entry point sqli_describe_input_stmt could not be located in the dynamic link isqlit09a.dll"
Any ideas what's happening?
Platform: Windows Vista (Biz Edition), Python 2.5. | Why Python informixdb package is throwing an error! | 0.099668 | 1 | 0 | 435 |
801,931 | 2009-04-29T11:31:00.000 | 5 | 1 | 0 | 1 | python,architecture,containers,notifications | 802,084 | 5 | true | 0 | 0 | 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? | 2 | 4 | 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. | Notifying container object: best practices | 1.2 | 0 | 0 | 403 |
801,931 | 2009-04-29T11:31:00.000 | 3 | 1 | 0 | 1 | python,architecture,containers,notifications | 802,031 | 5 | false | 0 | 0 | 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. | 2 | 4 | 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. | Notifying container object: best practices | 0.119427 | 0 | 0 | 403 |
802,499 | 2009-04-29T14:02:00.000 | 8 | 0 | 1 | 0 | c++,python,winapi,enumeration | 803,056 | 7 | false | 0 | 0 | Control Panel uses Win32 COM api, which is the official method (see Google Groups, Win32)
Never rely on registry. | 1 | 9 | 0 | When I say "installed application", I basically mean any application visible in [Control Panel]->[Add/Remove Programs].
I would prefer to do it in Python, but C or C++ is also fine. | How can I enumerate/list all installed applications in Windows XP? | 1 | 0 | 0 | 33,683 |
802,578 | 2009-04-29T14:21:00.000 | 7 | 0 | 1 | 0 | java,python,keyword,final | 802,622 | 11 | false | 0 | 0 | There is no such thing. In general, the Python attitude is "if you don't want this modified, just don't modify it". Clients of an API are unlikely to just poke around your undocumented internals anyway.
You could, I suppose, work around this by using tuples or namedtuples for the relevant bits of your model, which are inherently immutable. That still doesn't help with any part of your model that has to be mutable of course. | 2 | 78 | 0 | I couldn't find documentation on an equivalent of Java's final in Python, is there such a thing?
I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for this. | `final` keyword equivalent for variables in Python? | 1 | 0 | 0 | 83,113 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.