Title
stringlengths
11
150
A_Id
int64
518
72.5M
Users Score
int64
-42
283
Q_Score
int64
0
1.39k
ViewCount
int64
17
1.71M
Database and SQL
int64
0
1
Tags
stringlengths
6
105
Answer
stringlengths
14
4.78k
GUI and Desktop Applications
int64
0
1
System Administration and DevOps
int64
0
1
Networking and APIs
int64
0
1
Other
int64
0
1
CreationDate
stringlengths
23
23
AnswerCount
int64
1
55
Score
float64
-1
1.2
is_accepted
bool
2 classes
Q_Id
int64
469
42.4M
Python Basics and Environment
int64
0
1
Data Science and Machine Learning
int64
0
1
Web Development
int64
1
1
Available Count
int64
1
15
Question
stringlengths
17
21k
How to connect to a WCF Service with IronPython
783,626
0
2
2,231
0
wcf,ironpython
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
0
0
0
2009-04-23T19:08:00.000
2
0
false
783,120
0
0
1
1
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.
Convincing others of Ruby over Python and PHP
784,667
5
2
1,888
0
python,ruby
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.
0
0
0
1
2009-04-24T05:02:00.000
11
0.090659
false
784,584
0
0
1
9
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
784,633
0
2
1,888
0
python,ruby
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.
0
0
0
1
2009-04-24T05:02:00.000
11
0
false
784,584
0
0
1
9
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
784,656
0
2
1,888
0
python,ruby
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.
0
0
0
1
2009-04-24T05:02:00.000
11
0
false
784,584
0
0
1
9
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,227,135
0
2
1,888
0
python,ruby
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.
0
0
0
1
2009-04-24T05:02:00.000
11
0
false
784,584
0
0
1
9
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
785,273
1
2
1,888
0
python,ruby
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 ..
0
0
0
1
2009-04-24T05:02:00.000
11
0.01818
false
784,584
0
0
1
9
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
785,262
2
2
1,888
0
python,ruby
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.
0
0
0
1
2009-04-24T05:02:00.000
11
0.036348
false
784,584
0
0
1
9
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
785,060
5
2
1,888
0
python,ruby
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.
0
0
0
1
2009-04-24T05:02:00.000
11
0.090659
false
784,584
0
0
1
9
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
784,626
29
2
1,888
0
python,ruby
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.
0
0
0
1
2009-04-24T05:02:00.000
11
1
false
784,584
0
0
1
9
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
784,621
12
2
1,888
0
python,ruby
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.
0
0
0
1
2009-04-24T05:02:00.000
11
1
false
784,584
0
0
1
9
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!
How to design an email system?
787,170
3
3
3,573
0
python,linux,email
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.
0
0
0
1
2009-04-24T14:45:00.000
4
0.148885
false
786,138
0
0
1
2
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?
787,214
0
3
3,573
0
python,linux,email
You might want to try Twisted Mail for implementing your own backend in pure Python.
0
0
0
1
2009-04-24T14:45:00.000
4
0
false
786,138
0
0
1
2
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).
Basic MVT issue in Django
793,167
2
6
539
0
python,django,django-templates
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.
0
0
0
0
2009-04-24T14:46:00.000
3
0.132549
false
786,149
0
0
1
1
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.
Is site-packages appropriate for applications or just libraries?
788,253
0
5
294
0
python
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.
0
0
0
0
2009-04-24T18:22:00.000
5
0
false
787,015
1
0
1
4
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?
787,128
3
5
294
0
python
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.
0
0
0
0
2009-04-24T18:22:00.000
5
0.119427
false
787,015
1
0
1
4
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?
787,200
4
5
294
0
python
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.
0
0
0
0
2009-04-24T18:22:00.000
5
0.158649
false
787,015
1
0
1
4
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?
787,203
0
5
294
0
python
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.
0
0
0
0
2009-04-24T18:22:00.000
5
0
false
787,015
1
0
1
4
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?
Web development with python and sql
789,282
0
1
527
0
python
Google App Engine will provide hosting for free as well as Django and a db..
0
0
0
0
2009-04-25T02:19:00.000
4
0
false
788,083
0
0
1
1
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?
Handling Authorization in web frameworks
789,671
0
0
321
0
python
"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.
0
0
0
0
2009-04-25T18:30:00.000
1
1.2
true
789,468
0
0
1
1
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?
What is the best way to redirect email to a Python script?
789,699
0
2
2,191
0
python,django,email
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.
0
0
0
1
2009-04-25T20:35:00.000
4
0
false
789,685
0
0
1
1
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?
Using Python set type to implement ACL
791,425
2
1
2,877
1
python,set,acl,pickle
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...
0
0
0
0
2009-04-26T10:37:00.000
4
0.099668
false
790,613
0
0
1
2
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
790,662
2
1
2,877
1
python,set,acl,pickle
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.
0
0
0
0
2009-04-26T10:37:00.000
4
0.099668
false
790,613
0
0
1
2
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.
python versus java runtime footprint
35,581,985
1
7
5,256
0
java,python,footprint,memory-footprint
I can't compare memory footprint because it really depends on classes what you load/use. But what I can tell you that Python (IronPython 2.7 in particular) has real memory leak problems. Especially with third party well used ones like Financial. When Java application/server runs without issues with rare cases which could be identified with common tools Python grows in memory constantly. Memory dumps shows that Python itself as well as most of packages don't pay attention for common classes like String and keep them in different parts of the execution modules. It is hard and unwise to go through all these sources and fix all leaks. I was trying a lot to fix the issues but finally gave in and simply restart application when it reaches some memory threshold.
0
0
0
1
2009-04-27T20:49:00.000
1
0.197375
false
795,241
0
0
1
1
Can anyone point to serious comparison of Python runtime footprint versus Java? Thanks, Avraham
python method to extract content (excluding navigation) from an HTML page
796,530
1
8
3,581
0
python,html,parsing,semantics,html-content-extraction
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.
0
0
1
0
2009-04-28T06:40:00.000
5
0.039979
false
796,490
0
0
1
1
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.
Django caching - can it be done pre-emptively?
804,829
4
5
1,876
0
python,django,caching
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.
0
0
0
0
2009-04-28T12:56:00.000
4
0.197375
false
797,773
0
0
1
2
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?
798,462
4
5
1,876
0
python,django,caching
"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.
0
0
0
0
2009-04-28T12:56:00.000
4
0.197375
false
797,773
0
0
1
2
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.
Looking for a PHP and/or Python RAD
801,196
-5
6
3,848
0
php,python,vcl4php
The good news is that you won't miss it as soon as you familiarize yourself with a way of work when the responsibilities are shared. Think it over: really the programmer is the right person to assemble the user interface? I think not even in case of a desktop application. Programmer should write good code, separated display logic, and let all the presentation things to information architects user interface/experience specialists here comes you, to write the code graphic designers sitebuilders The -not so bad- news is that, there is no such tool for PHP and Python.
0
0
0
1
2009-04-29T06:17:00.000
14
-1
false
801,090
0
0
1
5
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
801,278
2
6
3,848
0
php,python,vcl4php
I just remenbered some more tools that might be useful to you, besides WebDev: PHPMaker WaveMaker For Python I'm gonna try the DialogBlocks later this evening.
0
0
0
1
2009-04-29T06:17:00.000
14
0.028564
false
801,090
0
0
1
5
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,256,441
0
6
3,848
0
php,python,vcl4php
Let me elaborate on CodeCharge Studio. I think you still can consider this system. Personally, I've been using it to develop very complex high-load data-base driven CRM applications, with 4.x version it even generates AJAX-based code and autocomplete, ajax-form submittion are piece of cake. With CCS you will need sometimes some tuning, but the tricks are pretty much typical. So, CodeCharge Studio is still a choice for complex applications too.
0
0
0
1
2009-04-29T06:17:00.000
14
0
false
801,090
0
0
1
5
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
4,500,774
1
6
3,848
0
php,python,vcl4php
I don't think Yogi is a PITA. He is discerning and this is very helpful. Since none of these tools quite hit the mark for him when one does it will be the right one and then all of us will benefit from his studied decision.
0
0
0
1
2009-04-29T06:17:00.000
14
0.014285
false
801,090
0
0
1
5
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
801,096
1
6
3,848
0
php,python,vcl4php
Delphi4PHP is the only I know of, back in the old days I also used Macromedia (now Adobe) Dreamweaver to generate some code, and if you set up a live site it kinda acts like a RAD IDE. Kinda. For Python, I asked a similar question a couple of hours ago, I'm also interested in knowing such tool.
0
0
0
1
2009-04-29T06:17:00.000
14
0.014285
false
801,090
0
0
1
5
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.
Python "Task Server"
1,556,571
1
4
2,958
0
python
You can have a look at celery
0
1
0
0
2009-04-30T02:19:00.000
5
0.039979
false
805,120
0
0
1
2
My question is: which python framework should I use to build my server? Notes: This server talks HTTP with it's clients: GET and POST (via pyAMF) Clients "submit" "tasks" for processing and, then, sometime later, retrieve the associated "task_result" submit and retrieve might be separated by days - different HTTP connections The "task" is a lump of XML describing a problem to be solved, and a "task_result" is a lump of XML describing an answer. When a server gets a "task", it queues it for processing The server manages this queue and, when tasks get to the top, organises that they are processed. the processing is performed by a long running (15 mins?) external program (via subprocess) which is feed the task XML and which produces a "task_result" lump of XML which the server picks up and stores (for later Client retrieval). it serves a couple of basic HTML pages showing the Queue and processing status (admin purposes only) I've experimented with twisted.web, using SQLite as the database and threads to handle the long running processes. But I can't help feeling that I'm missing a simpler solution. Am I? If you were faced with this, what technology mix would you use?
Python "Task Server"
805,126
0
4
2,958
0
python
It seems any python web framework will suit your needs. I work with a similar system on a daily basis and I can tell you, your solution with threads and SQLite for queue storage is about as simple as you're going to get. Assuming order doesn't matter in your queue, then threads should be acceptable. It's important to make sure you don't create race conditions with your queues or, for example, have two of the same job type running simultaneously. If this is the case, I'd suggest a single threaded application to do the items in the queue one by one.
0
1
0
0
2009-04-30T02:19:00.000
5
0
false
805,120
0
0
1
2
My question is: which python framework should I use to build my server? Notes: This server talks HTTP with it's clients: GET and POST (via pyAMF) Clients "submit" "tasks" for processing and, then, sometime later, retrieve the associated "task_result" submit and retrieve might be separated by days - different HTTP connections The "task" is a lump of XML describing a problem to be solved, and a "task_result" is a lump of XML describing an answer. When a server gets a "task", it queues it for processing The server manages this queue and, when tasks get to the top, organises that they are processed. the processing is performed by a long running (15 mins?) external program (via subprocess) which is feed the task XML and which produces a "task_result" lump of XML which the server picks up and stores (for later Client retrieval). it serves a couple of basic HTML pages showing the Queue and processing status (admin purposes only) I've experimented with twisted.web, using SQLite as the database and threads to handle the long running processes. But I can't help feeling that I'm missing a simpler solution. Am I? If you were faced with this, what technology mix would you use?
What is the best way to access stored procedures in Django's ORM
3,675,814
0
34
43,756
0
python,sql,django,stored-procedures,django-models
I guess the improved raw sql queryset support in Django 1.2 can make this easier as you wouldn't have to roll your own make_instance type code.
0
0
0
0
2009-04-30T05:03:00.000
7
0
false
805,393
0
0
1
2
I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it?
What is the best way to access stored procedures in Django's ORM
806,302
6
34
43,756
0
python,sql,django,stored-procedures,django-models
Don't. Seriously. Move the stored procedure logic into your model where it belongs. Putting some code in Django and some code in the database is a maintenance nightmare. I've spent too many of my 30+ years in IT trying to clean up this kind of mess.
0
0
0
0
2009-04-30T05:03:00.000
7
1
false
805,393
0
0
1
2
I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it?
Python regex for finding contents of MediaWiki markup links
809,900
1
3
1,132
0
python,regex,mediawiki
RegExp: \w+( \w+)+(?=]]) input [[Alexander of Paris|poet named Alexander]] output poet named Alexander input [[Alexander of Paris]] output Alexander of Paris
0
0
1
0
2009-05-01T01:11:00.000
4
0.049958
false
809,837
0
0
1
1
If I have some xml containing things like the following mediawiki markup: " ...collected in the 12th century, of which [[Alexander the Great]] was the hero, and in which he was represented, somewhat like the British [[King Arthur|Arthur]]" what would be the appropriate arguments to something like: re.findall([[__?__]], article_entry) I am stumbling a bit on escaping the double square brackets, and getting the proper link for text like: [[Alexander of Paris|poet named Alexander]]
I want to make a temporary answerphone which records MP3s
813,139
5
2
335
0
python,voip
I use twilio, very easy, very fun.
0
0
0
0
2009-05-01T20:25:00.000
4
0.244919
false
813,114
0
0
1
1
An artistic project will encourage users to ring a number and leave a voice-mail on an automated service. These voice-mails will be collected and edited into a half-hour radio show. I want to make a temporary system (with as little as possible programming) which will: Allow me to establish a public telephone number (preferably in the UK) Allow members of the public to call in and receive a short pre-recorded message Leave a message of their own after the beep. At the end of the project I'd like to be able to download and convert the recorded audio into a format that I can edit with a free audio-editor. I do not mind paying to use a service if it means I can get away with doing less programming work. Also it's got to be reliable because once recorded it will be impossible to re-record the audio clips. Once set up the whole thing will run for at most 2 weeks. I'm a python programmer with some basic familiarity with VOIP, however I'd prefer not to set up a big complex system like Asterisk since I do not ever intend to use the system again once the project is over. Whatever I do has to be really simple and disposable. Also I have access to Linux and FreeBSD systems (no Windows, sorry). Thanks!
If I want to use a pylons app with Apache, should I use mod_wsgi or proxy to paste?
814,005
8
4
1,341
0
python,apache2,pylons,mod-wsgi
Nginx with mod_wsgi requires the use of a non-blocking asynchronous framework and setup and isn't likely to work out of box with Pylons. I usually go with the proxy route to a stand-alone Pylons process using the PasteScript#cherrypy WSGI server (as its higher performing than the Paste#http one, though it won't recycle threads if you have leaks...). If you're set on using Apache and its your server (so you can compile and run Apache mod_wsgi), I'd suggest using that setup as its less maintenance to effectively utilize multiple cores. With a proxy setup, you'd have to use the mod_proxy_balancer with multiple paste processes to effectively utilize multiple cores/cpus. If you're deploying to someone else's Apache (shared hosting), mod_proxy is generally the easier solution as its stock in Apache 2.2 and above. Personally, I usually deploy with nginx + proxy to multiple paster processes.
0
0
0
0
2009-05-02T01:37:00.000
2
1.2
true
813,943
0
0
1
1
Or should I be using a totally different server?
Google App Engine - design considerations about cron tasks
815,113
3
1
1,473
1
python,database,google-app-engine,cron
I think you'll find that snapshotting every user's state every hour isn't something that will scale well no matter what your framework. A more ordinary environment will disguise this by letting you have longer running tasks, but you'll still reach the point where it's not practical to take a snapshot of every user's data, every hour. My suggestion would be this: Add a 'last snapshot' field, and subclass the put() function of your model (assuming you're using Python; the same is possible in Java, but I don't know the syntax), such that whenever you update a record, it checks if it's been more than an hour since the last snapshot, and if so, creates and writes a snapshot record. In order to prevent concurrent updates creating two identical snapshots, you'll want to give the snapshots a key name derived from the time at which the snapshot was taken. That way, if two concurrent updates try to write a snapshot, one will harmlessly overwrite the other. To get the snapshot for a given hour, simply query for the oldest snapshot newer than the requested period. As an added bonus, since inactive records aren't snapshotted, you're saving a lot of space, too.
0
1
0
0
2009-05-02T13:54:00.000
3
0.197375
false
814,896
0
0
1
1
I'm developing software using the Google App Engine. I have some considerations about the optimal design regarding the following issue: I need to create and save snapshots of some entities at regular intervals. In the conventional relational db world, I would create db jobs which would insert new summary records. For example, a job would insert a record for every active user that would contain his current score to the "userrank" table, say, every hour. I'd like to know what's the best method to achieve this in Google App Engine. I know that there is the Cron service, but does it allow us to execute jobs which will insert/update thousands of records?
Python/Ruby as mobile OS
816,248
14
10
3,120
0
python,ruby,mobile,operating-system,dynamic-languages
In general it's all of these things. Memory, speed, and probably most importantly programmer familiarity. Apple has a huge investment in Objective C, Java is known by basically everyone, and C# is very popular as well. If you're trying for mass programmer appeal it makes sense to start with something popular, even if it's sort of boring. There aren't really any technical requirements stopping it. We could write a whole Ruby stack and let the programmer re-implement the slow bits in C and it wouldn't be that big of a deal. It would be an investment for whatever company is making the mobile OS, and at the end of the day I'm not sure they gain as much from this. Finally, it's the very beginning of mobile devices. In 5 years I wouldn't be at all surprised to see a much wider mobile stack.
1
0
0
1
2009-05-03T03:09:00.000
13
1.2
true
816,212
0
0
1
9
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
Python/Ruby as mobile OS
817,560
0
10
3,120
0
python,ruby,mobile,operating-system,dynamic-languages
webOS -- the new OS from Palm, which will debut on the Pre -- has you write apps against a webkit runtime in JavaScript. Time will tell how successful it is, but I suspect it will not be the first to go down this path. As mobile devices become more powerful, you'll see dynamic languages become more prevalent.
1
0
0
1
2009-05-03T03:09:00.000
13
0
false
816,212
0
0
1
9
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
Python/Ruby as mobile OS
816,228
0
10
3,120
0
python,ruby,mobile,operating-system,dynamic-languages
Memory is also a significant factor. It's easy to eat memory in Python, unfortunately.
1
0
0
1
2009-05-03T03:09:00.000
13
0
false
816,212
0
0
1
9
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
Python/Ruby as mobile OS
1,077,315
0
10
3,120
0
python,ruby,mobile,operating-system,dynamic-languages
There is a linux distribution for OpenMoko Freerunner called SHR. Most of its settings and framework code is written in python and... well, it isn't very fast. It is bearable, but it was planned from the beginning to rewrite it in Vala. On the other side, my few smallish apps work fast enough (with the only drawback having big startup time) to consider python to develop user applications. For the record: Freerunner has ARM-something 400MHz and 128MB of RAM. I guess that once mobile devices cross 1GHz, languages like Python will be fast enough for middle-level stuff too (the low-level being the kernel).
1
0
0
1
2009-05-03T03:09:00.000
13
0
false
816,212
0
0
1
9
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
Python/Ruby as mobile OS
816,225
1
10
3,120
0
python,ruby,mobile,operating-system,dynamic-languages
I think that performance concerns may be part of, but not all of, the reason. Mobile devices do not have very powerful hardware to work with. I am partly unsure about this, though.
1
0
0
1
2009-05-03T03:09:00.000
13
0.015383
false
816,212
0
0
1
9
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
Python/Ruby as mobile OS
816,233
1
10
3,120
0
python,ruby,mobile,operating-system,dynamic-languages
One of the most pressing matters is garbage collection. Garbage collection often times introduce unpredictable pauses in embedded machines which sometimes need real time performance. This is why there is a Java Micro Edition which has a different garbage collector which reduces pauses in exchange for a slower program. Refcounting garbage collectors (like the one in CPython) are also less prone to pauses but can explode when data with many nested pointers (like a linked list) get deleted.
1
0
0
1
2009-05-03T03:09:00.000
13
0.015383
false
816,212
0
0
1
9
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
Python/Ruby as mobile OS
816,266
0
10
3,120
0
python,ruby,mobile,operating-system,dynamic-languages
There are many reasons. Among them: business reasons, such as software lock-in strategies, efficiency: dynamic languages are usually perceived to be slower (and in some cases really are slower, or at least provide a limit to the amount of optimsation you can do. On a mobile device, optimising code is necessary much more often than on a PC), and tend to use more memory, which is a significant issue on portable devices with limited memory and little cache,, keeping development simple: a platform that supports say Python and Ruby and Java out of the box: means thrice the work to write documentation and provide support, divides development effort into three; it takes longer for helpful material to appear on the web and there are less developers who use the same language as you on your platform, requires more storage on the device to support all these languages, management need to be convinced. I've always felt that the merits of Java are easily explained to a non-technical audience. .Net and Obj-C also seem a very natural choice for a Microsoft and Apple platform, respectively.
1
0
0
1
2009-05-03T03:09:00.000
13
0
false
816,212
0
0
1
9
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
Python/Ruby as mobile OS
816,219
1
10
3,120
0
python,ruby,mobile,operating-system,dynamic-languages
Jailbroken iPhones can have python installed, and I actually use python very frequently on mine.
1
0
0
1
2009-05-03T03:09:00.000
13
0.015383
false
816,212
0
0
1
9
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
Python/Ruby as mobile OS
816,217
0
10
3,120
0
python,ruby,mobile,operating-system,dynamic-languages
I suspect the basic reason is a combination of security and reliability. You don't want someone to be easily able to hack the phone, and you want to have some control over what's being installed.
1
0
0
1
2009-05-03T03:09:00.000
13
0
false
816,212
0
0
1
9
I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language. What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic language? I understand that at a low level they would not cut it but C or C++ would be fine for that and Python, for example, could be the layer on top to interact with it. I mean, there is Jython or CPython. I was just wondering why we do not see more dynamic language support in today's mobile OS's.
save an image with selenium & firefox
827,891
3
9
9,916
0
python,selenium
To do this the way you want (to actually capture the content sent down to the browser) you'd need to modify Selenium RC's proxy code (see ProxyHandler.java) and store the files locally on the disk in parallel to sending the response back to the browser.
0
0
1
0
2009-05-03T09:51:00.000
5
0.119427
false
816,704
0
0
1
2
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 selenium methods for doing just that), but i want the original image. i don't mind fiddling with the clicking menu options etc. but i couldn't found how. thanks
save an image with selenium & firefox
816,777
-1
9
9,916
0
python,selenium
How about going to the image URL and then taking a screenshot of the page? Firefox displays the image in full screen. Hope this helps..
0
0
1
0
2009-05-03T09:51:00.000
5
-0.039979
false
816,704
0
0
1
2
i'm trying to save an image from a website using selenium server & python client. i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session. the workaround i found so far is to save the page's screenshot (there are 2 selenium methods for doing just that), but i want the original image. i don't mind fiddling with the clicking menu options etc. but i couldn't found how. thanks
Letting users upload Python scripts for execution
818,405
3
12
1,115
0
python,cgi
Yes. Allow them to script their client, not your server.
0
0
0
1
2009-05-04T00:20:00.000
6
0.099668
false
818,402
0
0
1
4
I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I either need a solution to ensure a user couldn't compromise any other files or inject malicious code via their uploaded script or a solution for client-side execution of the game. Any suggestions? (I'm looking for a solution that will work with my Python scripts)
Letting users upload Python scripts for execution
818,558
4
12
1,115
0
python,cgi
Along with other safeguards, you can also incorporate human review of the code. Assuming part of the experience is reviewing other members' solutions, and everyone is a python developer, don't allow new code to be activated until a certain number of members vote for it. Your users aren't going to approve malicious code.
0
0
0
1
2009-05-04T00:20:00.000
6
0.132549
false
818,402
0
0
1
4
I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I either need a solution to ensure a user couldn't compromise any other files or inject malicious code via their uploaded script or a solution for client-side execution of the game. Any suggestions? (I'm looking for a solution that will work with my Python scripts)
Letting users upload Python scripts for execution
819,227
1
12
1,115
0
python,cgi
PyPy is probably a decent bet on the server side as suggested, but I'd look into having your python backend provide well defined APIs and data formats and have the users implement the AI and logic in Javascript so it can run in their browser. So the interaction would look like: For each match/turn/etc, pass data to the browser in a well defined format, provide a javascript template that receives the data and can implement logic, and provide web APIs that can be invoked by the client (browser) to take the desired actions. That way you don't have to worry about security or server power.
0
0
0
1
2009-05-04T00:20:00.000
6
0.033321
false
818,402
0
0
1
4
I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I either need a solution to ensure a user couldn't compromise any other files or inject malicious code via their uploaded script or a solution for client-side execution of the game. Any suggestions? (I'm looking for a solution that will work with my Python scripts)
Letting users upload Python scripts for execution
878,455
0
12
1,115
0
python,cgi
Have an extensive API for the users and strip all other calls upon upload (such as import statements). Also, strip everything that has anything to do with file i/o. (You might want to do multiple passes to ensure that you didn't miss anything.)
0
0
0
1
2009-05-04T00:20:00.000
6
1.2
true
818,402
0
0
1
4
I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I either need a solution to ensure a user couldn't compromise any other files or inject malicious code via their uploaded script or a solution for client-side execution of the game. Any suggestions? (I'm looking for a solution that will work with my Python scripts)
Extract domain name from a host name
828,397
1
18
14,503
0
python,dns,hostname
Your algorithm is the right one. Since zone cuts are not reflected in the domain name (you see domain cuts - the dots - but not zone cuts), it is the only correct one. An approximate algorithm is to use a list of zones, like the one mentioned by Alnitak. Remember that these static lists are not authoritative, they lack many registries, they are stale, etc.
0
0
0
0
2009-05-05T16:17:00.000
3
0.066568
false
825,694
0
0
1
1
Is there a programatic way to find the domain name from a given hostname? given -> www.yahoo.co.jp return -> yahoo.co.jp The approach that works but is very slow is: split on "." and remove 1 group from the left, join and query an SOA record using dnspython when a valid SOA record is returned, consider that a domain Is there a cleaner/faster way to do this without using regexps?
how to get the n-th record of a datastore query
827,149
3
1
845
0
python,google-app-engine,google-cloud-datastore,custompaging
There is no efficient way to do this - in any DBMS. In every case, you have to at least read sequentially through the index records until you find the nth one, then look up the corresponding data record. This is more or less what fetch(count, offset) does in GAE, with the additional limitation of 1000 records. A better approach to this is to keep a 'bookmark', consisting of the value of the field you're ordering on for the last entity you retrieved, and the entity's key. Then, when you want to continue from where you left off, you can add the field's value as the lower bound of an inequality query, and skip records until you match or exceed the last one you saw. If you want to provide 'friendly' page offsets to users, what you can do is to use memcache to store an association between a start offset and a bookmark (order_property, key) tuple. When you generate a page, insert or update the bookmark for the entity following the last one. When you fetch a page, use the bookmark if it exists, or generate it the hard way, by doing queries with offsets - potentially multiple queries if the offset is high enough.
0
1
0
0
2009-05-05T20:14:00.000
2
1.2
true
826,724
0
0
1
1
Suppose that I have the model Foo in GAE and this query: query = Foo.all().order('-key') I want to get the n-th record. What is the most efficient way to achieve that? Will the solution break if the ordering property is not unique, such as the one below: query = Foo.all().order('-color') edit: n > 1000 edit 2: I want to develop a friendly paging mechanism that shows pages available (such as Page 1, Page 2, ... Page 185) and requires a "?page=x" in the query string, instead of a "?bookmark=XXX". When page = x, the query is to fetch the records beginning from the first record of that page.
Should my python web app use unicode for all strings?
1,440,981
1
6
806
0
python,django,web-applications,unicode,pylons
Using Unicode internally is a good way to avoid problems with non-ASCII characters. Convert at the boundaries of your application (incoming data to unicode, outgoing data to UTF-8 or whatever). Pylons can do the conversion for you in many cases: e.g. controllers can safely return unicode strings; SQLAlchemy models may declare Unicode columns. Regarding string literals in your source code: the u prefix is usually not necessary. You can safely mix str objects containing ASCII with unicode objects. Just make sure all your string literals are either pure ASCII or are u"unicode".
0
0
0
0
2009-05-05T23:39:00.000
4
0.049958
false
827,415
0
0
1
2
I see some frameworks like Django using unicode all over the place so it seems like it might be a good idea. On the other hand, it seems like a big pain to have all these extra 'u's floating around everywhere. What will be a problem if I don't do this? Are there any issues that will come up if I do do this? I'm using Pylons right now as my framework.
Should my python web app use unicode for all strings?
829,155
3
6
806
0
python,django,web-applications,unicode,pylons
What will be a problem if I don't do this? I'm a westerner living in Japan, so I've seen first-hand what is needed to work with non-ASCII characters. The problem if you don't use Unicode strings is that your code will be a frustration to the parts of the world that use anything other than A-Z. Our company has had a great deal of frustration getting certain web software to do Japanese characters without making a total mess of it. It takes a little effort for English speakers to appreciate how great Unicode is, but it really is a terrific bit of work to make computers accessible to all cultures and languages. "Gotchas": Make sure your output web pages state the encoding in use properly (e.g. using content-encoding header), and then encode all Unicode strings properly at output. Python 3 Unicode strings is a great improvement to do this right. Do everything with Unicode strings, and only convert to a specific encoding at the last moment, when doing output. Other languages, such as PHP, are prone to bugs when manipulating Unicode in e.g. UTF-8 form. Say you have to truncate a Unicode string. If it's in UTF-8 form internally, there's a risk you could chop off a multi-byte character half-way through, resulting in rubbish output. Python's use of Unicode strings internally makes it harder to make these mistakes.
0
0
0
0
2009-05-05T23:39:00.000
4
0.148885
false
827,415
0
0
1
2
I see some frameworks like Django using unicode all over the place so it seems like it might be a good idea. On the other hand, it seems like a big pain to have all these extra 'u's floating around everywhere. What will be a problem if I don't do this? Are there any issues that will come up if I do do this? I'm using Pylons right now as my framework.
How to measure Django cache performance?
828,826
2
5
3,032
0
python,django,postgresql,caching,memcached
Short answer : If you have enougth ram, memcached will be always faster. You can't really benchhmark memcached vs. database cache, just keep in mind that the big bottleneck with servers is disk access, specially write access. Anyway, disk cache is better if you have many objects to cache and long time expiration. But for this situation, if you want gig performances, it is better to generate your pages statically with a python script and deliver them with ligthtpd or nginx. For memcached, you could adjust the amount of ram dedicated to the server.
0
0
0
0
2009-05-06T08:56:00.000
5
0.07983
false
828,702
0
0
1
3
I have a rather small (ca. 4.5k pageviews a day) website running on Django, with PostgreSQL 8.3 as the db. I am using the database as both the cache and the sesssion backend. I've heard a lot of good things about using Memcached for this purpose, and I would definitely like to give it a try. However, I would like to know exactly what would be the benefits of such a change: I imagine that my site may be just not big enough for the better cache backend to make a difference. The point is: it wouldn't be me who would be installing and configuring memcached, and I don't want to waste somebody's time for nothing or very little. How can I measure the overhead introduced by using the db as the cache backend? I've looked at django-debug-toolbar, but if I understand correctly it isn't something you'd like to put on a production site (you have to set DEBUG=True for it to work). Unfortunately, I cannot quite reproduce the production setting on my laptop (I have a different OS, CPU and a lot more RAM). Has anyone benchmarked different Django cache/session backends? Does anybody know what would be the performance difference if I was doing, for example, one session-write on every request?
How to measure Django cache performance?
2,105,437
0
5
3,032
0
python,django,postgresql,caching,memcached
Just try it out. Use firebug or a similar tool and run memcache with a bit of RAM allocation (e.g. 64mb) on the test server. Mark your average loading results seen in firebug without memcache, then turn caching on and mark new results. That's done as easy as it said. The results usually shocks people, because the perfomance raises up very nicely.
0
0
0
0
2009-05-06T08:56:00.000
5
0
false
828,702
0
0
1
3
I have a rather small (ca. 4.5k pageviews a day) website running on Django, with PostgreSQL 8.3 as the db. I am using the database as both the cache and the sesssion backend. I've heard a lot of good things about using Memcached for this purpose, and I would definitely like to give it a try. However, I would like to know exactly what would be the benefits of such a change: I imagine that my site may be just not big enough for the better cache backend to make a difference. The point is: it wouldn't be me who would be installing and configuring memcached, and I don't want to waste somebody's time for nothing or very little. How can I measure the overhead introduced by using the db as the cache backend? I've looked at django-debug-toolbar, but if I understand correctly it isn't something you'd like to put on a production site (you have to set DEBUG=True for it to work). Unfortunately, I cannot quite reproduce the production setting on my laptop (I have a different OS, CPU and a lot more RAM). Has anyone benchmarked different Django cache/session backends? Does anybody know what would be the performance difference if I was doing, for example, one session-write on every request?
How to measure Django cache performance?
829,260
5
5
3,032
0
python,django,postgresql,caching,memcached
At my previous work we tried to measure caching impact on site we was developing. On the same machine we load-tested the set of 10 pages that are most commonly used as start pages (object listings), plus some object detail pages taken randomly from the pool of ~200000. The difference was like 150 requests/second to 30000 requests/second and the database queries dropped to 1-2 per page. What was cached: sessions lists of objects retrieved for each individual page in object listing secondary objects and common content (found on each page) lists of object categories and other categorising properties object counters (calculated offline by cron job) individual objects In general, we used only low-level granular caching, not the high-level cache framework. It required very careful design (cache had to be properly invalidated upon each database state change, like adding or modifying any object).
0
0
0
0
2009-05-06T08:56:00.000
5
1.2
true
828,702
0
0
1
3
I have a rather small (ca. 4.5k pageviews a day) website running on Django, with PostgreSQL 8.3 as the db. I am using the database as both the cache and the sesssion backend. I've heard a lot of good things about using Memcached for this purpose, and I would definitely like to give it a try. However, I would like to know exactly what would be the benefits of such a change: I imagine that my site may be just not big enough for the better cache backend to make a difference. The point is: it wouldn't be me who would be installing and configuring memcached, and I don't want to waste somebody's time for nothing or very little. How can I measure the overhead introduced by using the db as the cache backend? I've looked at django-debug-toolbar, but if I understand correctly it isn't something you'd like to put on a production site (you have to set DEBUG=True for it to work). Unfortunately, I cannot quite reproduce the production setting on my laptop (I have a different OS, CPU and a lot more RAM). Has anyone benchmarked different Django cache/session backends? Does anybody know what would be the performance difference if I was doing, for example, one session-write on every request?
design for handling exceptions - google app engine
833,840
0
6
1,603
0
python,google-app-engine,exception-handling,web-applications
Ad. #4: I usually treat query strings as non-essential. If anything is wrong with query string, I'd just present bare resource page (as if no query was present), possibly with some information to user what was wrong with the query string. This leads to the problem similar to your #3: how did the user got into this wrong query? Did my application produce wrong URL somewhere? Or was it outdated link in some external service, or saved bookmark? HTTP_REFERER might contain some clue, but of course is not authoritative, so I'd log the problematic query (with some additional HTTP headers) and try to investigate the case.
0
1
0
0
2009-05-06T16:51:00.000
2
0
false
830,597
0
0
1
1
I'm developing a project on google app engine (webapp framework). I need you people to assess how I handle exceptions. There are 4 types of exceptions I am handling: Programming exceptions Bad user input Incorrect URLs Incorrect query strings Here is how I handle them: I have subclassed the webapp.requesthandler class and overrode the handle_exceptions method. Whenever an exception occurs, I take the user to a friendly "we're sorry" page and in the meantime send a message with the traceback to the admins. On the client side I (will) use js and also validate on the server side. Here I figure (as a coder with non-web experience) in addition to validate inputs according to programming logic (check: cash input is of the float type?) and business rules (check: user has enough points to take that action?), I also have to check against malicious intentions. What measures should I take against malicious actions? I have a catch-all URL that handles incorrect URLs. That is to say, I take the user to a custom "page does not exist" page. Here I have no problems, I think. Incorrect query strings presumably raise exceptions if left to themselves. If an ID does not exist, the method returns None (an exception is on the way). if the parameter is inconvenient, the code raises an exception. Here I think I must raise a 404 and take the user to the custom "page does not exist" page. What should I do? What are your opinions? Thanks in advance..
PDF Tables of Arbitrary (within reason) Width
837,011
1
2
600
0
python,pdf,xhtml,latex
The stand alone program : wkhtmltopdf is exactly what I needed. The PDF rendering of XHTML is the best of seen from a free tool.
0
0
0
0
2009-05-07T02:57:00.000
3
1.2
true
832,693
0
0
1
1
I know PDF generation has been discussed a lot here; however, I've yet to find what I need. I'm trying to generate PDF reports (mainly tables) from python. Yes I've tried ReportLab and Pisa. Both had column content "break out" in circumstances I didn't think were unreasonable and unrealistic to encounter in production. When I say reasonable I mean 8 - 12 columns of differing widths. Not 80 - 1200 or some such. I don't need a native python solution as I will be able to have my script launch off the linux command line. I have these reports working in XHTML and they look more or less perfect ... I'd prefer to leverage them. What I'm asking is: does anyone know of a tool I can use that will render tables of arbitrary (again within reason) size in PDF with quality near XHTML browser rendering? I'd like to use something like PrinceXML; however the size of this project doesn't justify the expense of such a tool. As an aside I have tried to do what I need in Latex , something I'm not apposed to but if that is a good idea I'd appreciate an example. Regards, and thanks in advance.
authentication method
840,803
1
0
1,626
0
java,python,authentication,encryption,hash
Let me just add a few random thoughts/comments to your proposals. RSA: Since you are mainly interested in authentication, I assume you'd want to use RSA signatures. This would imply that each user needs his own privat key. To me that sounds a little bit like overkill, especially when user and server already share common secrets (i.e., passwords). Using SHA256 is a good approach. I have some problems to understand why you include a salt, since a salt is commonly use to avoid that an attacker precomputes hashes of dictionaries. To be clear: dicitionary attacks are a problem here. An attacker could try to hash messages with all passwords from a dictionary. Just he has to reapeat this attack for each user and can't reuse precomputed values. One way to make such an attack a little more difficult is called key strengthening, e.g. by reapeatedly hashing the result n times and hence forcing an attacker to perform more work during a dictionary attack. I completely agree that HMAC is better than just SHA-256. After all HMAC was designed for authentication. I'm not sure why you want to hash the message before computing the HMAC. HMAC does that for you. Encryption does not always provide authentication. This is specially in cases when the attacker learns the plaintext, as he does in your case. He might be able to exploit properties of the encryption mode to manipulate the ciphertext an know exactly how the resulting plaintext will look like (E.g. the CBC mode allows these kind of manipulations). Your previous proposal (HMAC) is preferable. Finally, if you can setup an SSL connection between user and server, as others suggest: this would be a much safer solution, since not even the dicionary attack mentioned above would be possible.
0
0
0
1
2009-05-07T14:22:00.000
4
0.049958
false
834,932
0
0
1
3
I am writing a server-client application to receive user message and publish it. Thinking about authentication method. Asymmetric encryption, probably RSA. Hash (salt+password+'msg'+'userid'), SHA256 HMAC, SHA256. seems to be more secured than the method 2. Also involve hashing the password and msg data. Symmetric Encryption of the 'msg' with static password stored on both sides, probably AES. There is no need for encryption as the msg would be publish online anyway. So I am more lean to the HMAC or PKI method. I'm using java to send the request (including whatever authentication method to be implemented) www.mysite.com/foo?userid=12345&msg=hello&token=abc1234 python on the server side to receive request and make sure the request is from the valid user. The problems are in integration and make sure both sides understand each other's authentication token. It is a big factor for me. And the availability of the libraries available on both language are taken into account as well. Or I can choose to rewrite the server side into java. (Why not python? The client side application need to be in java) What do you think? EDIT: I would not treat this as a web application. The application does not serve any webpage. Most of the operations are not related to the web. Just the client-server communication go through internet. And sending POST/GET via HTTP is what I thought of as the simpler albeit insecure way to do it. Feel free to suggest me any other alternative. SSL is a secure way for encryption. But it does not prevent attacker from sending message to the server impose as the user. Anyone can initiate a HTTPS connection. And the content of the communication does not need to be encrypted. It will be published online by the server anyway. What I need is a way to authenticate the message and sender. For now I am lean to HMAC algorithm. RSA would be more secure but it comes with more developer efforts as well. Will see how it goes. Thank you.
authentication method
836,074
2
0
1,626
0
java,python,authentication,encryption,hash
Can't you just use standard SSL sockets to secure the connection, validate the user with a password, and then send the message to be published? If there won't be many clients, you can even use a self-signed certificate and put it in a KeyStore in the client app, that way you won't need to buy a certificate from Verisign or anyone else. If you are storing the user's password hash on the server (as I think you should otherwise how are you going to validate the user's password), then you can first reproduce that hash on the client side (let's assume you hash user+pass) and then append that to the message and hash the result. You send the user id, hash and message to the server. On the server side you receive a request with a user id, you retrieve the user's password (the server only has stored the hash of user+pass), you append that to the message and hash it again, and compare it against the hash in the request. If it matches, the user can publish the message. Oh and you should use HTTP POST, instead of sending data on the URL. The server should not accept data on the URL for the publish request.
0
0
0
1
2009-05-07T14:22:00.000
4
0.099668
false
834,932
0
0
1
3
I am writing a server-client application to receive user message and publish it. Thinking about authentication method. Asymmetric encryption, probably RSA. Hash (salt+password+'msg'+'userid'), SHA256 HMAC, SHA256. seems to be more secured than the method 2. Also involve hashing the password and msg data. Symmetric Encryption of the 'msg' with static password stored on both sides, probably AES. There is no need for encryption as the msg would be publish online anyway. So I am more lean to the HMAC or PKI method. I'm using java to send the request (including whatever authentication method to be implemented) www.mysite.com/foo?userid=12345&msg=hello&token=abc1234 python on the server side to receive request and make sure the request is from the valid user. The problems are in integration and make sure both sides understand each other's authentication token. It is a big factor for me. And the availability of the libraries available on both language are taken into account as well. Or I can choose to rewrite the server side into java. (Why not python? The client side application need to be in java) What do you think? EDIT: I would not treat this as a web application. The application does not serve any webpage. Most of the operations are not related to the web. Just the client-server communication go through internet. And sending POST/GET via HTTP is what I thought of as the simpler albeit insecure way to do it. Feel free to suggest me any other alternative. SSL is a secure way for encryption. But it does not prevent attacker from sending message to the server impose as the user. Anyone can initiate a HTTPS connection. And the content of the communication does not need to be encrypted. It will be published online by the server anyway. What I need is a way to authenticate the message and sender. For now I am lean to HMAC algorithm. RSA would be more secure but it comes with more developer efforts as well. Will see how it goes. Thank you.
authentication method
837,532
0
0
1,626
0
java,python,authentication,encryption,hash
RSA protocol is generally used to setup a key exchange for a faster encryption means. That's how SSL works. If the security requirements for your applications are so sensitive that you require PKI, then it should be said (without any intent to be harsh) that if you need to ask about it on SO, then its probably something you shouldn't attempt to do (given that generally successful attacks on secure channels attack weakpoints of the implementation). As Chochos has suggested, what's wrong with simply using the existing SSL infrastructure in Java and your server to set up a secure https connection and then simply pass the user password from client to the server?
0
0
0
1
2009-05-07T14:22:00.000
4
0
false
834,932
0
0
1
3
I am writing a server-client application to receive user message and publish it. Thinking about authentication method. Asymmetric encryption, probably RSA. Hash (salt+password+'msg'+'userid'), SHA256 HMAC, SHA256. seems to be more secured than the method 2. Also involve hashing the password and msg data. Symmetric Encryption of the 'msg' with static password stored on both sides, probably AES. There is no need for encryption as the msg would be publish online anyway. So I am more lean to the HMAC or PKI method. I'm using java to send the request (including whatever authentication method to be implemented) www.mysite.com/foo?userid=12345&msg=hello&token=abc1234 python on the server side to receive request and make sure the request is from the valid user. The problems are in integration and make sure both sides understand each other's authentication token. It is a big factor for me. And the availability of the libraries available on both language are taken into account as well. Or I can choose to rewrite the server side into java. (Why not python? The client side application need to be in java) What do you think? EDIT: I would not treat this as a web application. The application does not serve any webpage. Most of the operations are not related to the web. Just the client-server communication go through internet. And sending POST/GET via HTTP is what I thought of as the simpler albeit insecure way to do it. Feel free to suggest me any other alternative. SSL is a secure way for encryption. But it does not prevent attacker from sending message to the server impose as the user. Anyone can initiate a HTTPS connection. And the content of the communication does not need to be encrypted. It will be published online by the server anyway. What I need is a way to authenticate the message and sender. For now I am lean to HMAC algorithm. RSA would be more secure but it comes with more developer efforts as well. Will see how it goes. Thank you.
datastore transaction restrictions
838,960
0
3
384
1
python,google-app-engine,transactions,google-cloud-datastore
After a through research, I have found that a distributed transaction layer that provides a solution to the single entity group restriction has been developed in userland with the help of some google people. But so far, it is not released and is only available in java.
0
1
0
0
2009-05-07T20:55:00.000
3
1.2
true
836,992
0
0
1
1
in my google app application, whenever a user purchases a number of contracts, these events are executed (simplified for clarity): user.cash is decreased user.contracts is increased by the number contracts.current_price is updated. market.no_of_transactions is increased by 1. in a rdms, these would be placed within the same transaction. I conceive that google datastore does not allow entities of more than one model to be in the same transaction. what is the correct approach to this issue? how can I ensure that if a write fails, all preceding writes are rolled back? edit: I have obviously missed entity groups. Now I'd appreciate some further information regarding how they are used. Another point to clarify is google says "Only use entity groups when they are needed for transactions. For other relationships between entities, use ReferenceProperty properties and Key values, which can be used in queries". does it mean I have to define both a reference property (since I need queriying them) and a parent-child relationship (for transactions)? edit 2: and finally, how do I define two parents for an entity if the entity is being created to establish an n-to-n relationship between 2 parents?
How do I invoke Python code from Ruby?
837,862
-1
5
6,499
0
python,ruby
For python code to run the interpreter needs to be launched as a process. So system() is your best option. For calling the python code you could use RPC or network sockets, got for the simplest thing which could possibly work.
0
1
0
1
2009-05-07T21:59:00.000
5
-0.039979
false
837,256
0
0
1
2
Does a easy to use Ruby to Python bridge exist? Or am I better off using system()?
How do I invoke Python code from Ruby?
837,296
2
5
6,499
0
python,ruby
I don't think there's any way to invoke Python from Ruby without forking a process, via system() or something. The language run times are utterly diferent, they'd need to be in separate processes anyway.
0
1
0
1
2009-05-07T21:59:00.000
5
0.07983
false
837,256
0
0
1
2
Does a easy to use Ruby to Python bridge exist? Or am I better off using system()?
Using Sql Server with Django in production
843,500
4
52
48,333
1
python,sql-server,django,pyodbc
We are using django-mssql in production at our company. We too had an existing system using mssql. For me personally it was the best design decision I have ever made because my productivity increased dramatically now that I can use django . I submitted a patch but when I started using django-mssql and did a week or two of testing.Since then (October 2008) we run our system on django and it runs solid. I also tried pyodbc but I did not like to much. We are running a repair system where all transactions run through this system 40 heavy users. If you have more questions let me know.
0
0
0
0
2009-05-09T06:45:00.000
7
0.113791
false
842,831
0
0
1
2
Has anybody got recent experience with deploying a Django application with an SQL Server database back end? Our workplace is heavily invested in SQL Server and will not support Django if there isn't a sufficiently developed back end for it. I'm aware of mssql.django-pyodbc and django-mssql as unofficially supported back ends. Both projects seem to have only one person contributing which is a bit of a worry though the contributions seem to be somewhat regular. Are there any other back ends for SQL Server that are well supported? Are the two I mentioned here 'good enough' for production? What are your experiences?
Using Sql Server with Django in production
843,476
1
52
48,333
1
python,sql-server,django,pyodbc
Haven't used it in production yet, but my initial experiences with django-mssql have been pretty solid. All you need are the Python Win32 extensions and to get the sqlserver_ado module onto your Python path. From there, you just use sql_server.pyodbc as your DATABASE_ENGINE. So far I haven't noticed anything missing, but I haven't fully banged on it yet either.
0
0
0
0
2009-05-09T06:45:00.000
7
0.028564
false
842,831
0
0
1
2
Has anybody got recent experience with deploying a Django application with an SQL Server database back end? Our workplace is heavily invested in SQL Server and will not support Django if there isn't a sufficiently developed back end for it. I'm aware of mssql.django-pyodbc and django-mssql as unofficially supported back ends. Both projects seem to have only one person contributing which is a bit of a worry though the contributions seem to be somewhat regular. Are there any other back ends for SQL Server that are well supported? Are the two I mentioned here 'good enough' for production? What are your experiences?
Performing a getattr() style lookup in a django template
844,828
2
50
25,291
0
python,django,django-templates
I ended up adding a method to the model in question, and that method can be accessed like an attribute in the template. Still, i think it would be great if a built in tag allowed you to dynamically lookup an attribute, since this is a problem a lot of us constantly have in our templates.
0
0
0
0
2009-05-10T05:15:00.000
6
0.066568
false
844,746
0
0
1
1
Python's getattr() method is useful when you don't know the name of a certain attribute in advance. This functionality would also come in handy in templates, but I've never figured out a way to do it. Is there a built-in tag or non-built-in tag that can perform dynamic attribute lookups?
Default filter in Django admin
920,320
3
105
42,742
0
python,django,django-admin
Note that if instead of pre-selecting a filter value you want to always pre-filter the data before showing it in the admin, you should override the ModelAdmin.queryset() method instead.
0
0
0
0
2009-05-12T07:52:00.000
17
0.035279
false
851,636
0
0
1
2
How can I change the default filter choice from 'ALL'? I have a field named as status which has three values: activate, pending and rejected. When I use list_filter in Django admin, the filter is by default set to 'All' but I want to set it to pending by default.
Default filter in Django admin
1,560,919
2
105
42,742
0
python,django,django-admin
I know that is not the best solution, but i changed the index.html in the admin template, line 25 and 37 like this: 25: <th scope="row"><a href="{{ model.admin_url }}{% ifequal model.name "yourmodelname" %}?yourflag_flag__exact=1{% endifequal %}">{{ model.name }}</a></th> 37: <td><a href="{{ model.admin_url }}{% ifequal model.name "yourmodelname" %}?yourflag__exact=1{% endifequal %}" class="changelink">{% trans 'Change' %}</a></td>
0
0
0
0
2009-05-12T07:52:00.000
17
0.023525
false
851,636
0
0
1
2
How can I change the default filter choice from 'ALL'? I have a field named as status which has three values: activate, pending and rejected. When I use list_filter in Django admin, the filter is by default set to 'All' but I want to set it to pending by default.
How to establish communication between flex and python code build on Google App Engine
854,403
0
0
1,782
0
python,apache-flex,google-app-engine
Do a HTTP post from Flex to your AppEngine app using the URLRequest class.
0
1
1
0
2009-05-12T19:11:00.000
2
0
false
854,353
0
0
1
1
I want to communicate using flex client with GAE, I am able to communicate using XMl from GAE to FLex but how should I post from flex3 to python code present on App Engine. Can anyone give me a hint about how to send login information from Flex to python Any ideas suggest me some examples.....please provide me some help Regards, Radhika
Running django on OSX
856,033
5
1
1,602
0
python,django,macos
Unless you are planning on going to production with OS X you might not want to bother. If you must do it, go straight to mod_wsgi. Don't bother with mod_python or older solutions. I did mod_python on Apache and while it runs great now, it took countless hours to set up. Also, just to clarify something based on what you said: You're not going to find a mapping between the url path (like /polls) and a script that is being called. Django doesn't work like that. With Django your application is loaded into memory waiting for requests. Once a request comes in it gets dispatched through the url map that you created in urls.py. That boils down to a function call somewhere in your code. That's why for a webserver like Apache you need a module like mod_wsgi, which gives your app a spot in memory in which to live. Compare that with something like CGI where the webserver executes a specific script on demand at a location that is physically mapped between the url and the filesystem. I hope that's helpful and not telling you something you already knew. :)
0
1
0
0
2009-05-12T23:29:00.000
4
0.244919
false
855,408
0
0
1
2
I've just completed the very very nice django tutorial and it all went swimmingly. One of the first parts of the tutorial is that it says not to use their example server thingie in production, my first act after the tutorial was thus to try to run my app on apache. I'm running OSX 10.5 and have the standard apache (which refuses to run python) and MAMP (which begrudgingly allows it in cgi-bin). The problem is that I've no idea which script to call, in the tutorial it was always localhost:8000/polls but I've no idea how that's meant to map to a specific file. Have I missed something blatantly obvious about what to do with a .htaccess file or does the tutorial not actually explain how to use it somewhere else?
Running django on OSX
856,986
2
1
1,602
0
python,django,macos
Yet another option is to consider using a virtual machine for your development. You can install a full version of whatever OS your production server will be running - say, Debian - and run your Apache and DB in the VM. You can connect to the virtual disk in the Finder, so you can still use TextMate (or whatever) on OSX to do your editing. I've had good experiences doing this via VMWare Fusion.
0
1
0
0
2009-05-12T23:29:00.000
4
0.099668
false
855,408
0
0
1
2
I've just completed the very very nice django tutorial and it all went swimmingly. One of the first parts of the tutorial is that it says not to use their example server thingie in production, my first act after the tutorial was thus to try to run my app on apache. I'm running OSX 10.5 and have the standard apache (which refuses to run python) and MAMP (which begrudgingly allows it in cgi-bin). The problem is that I've no idea which script to call, in the tutorial it was always localhost:8000/polls but I've no idea how that's meant to map to a specific file. Have I missed something blatantly obvious about what to do with a .htaccess file or does the tutorial not actually explain how to use it somewhere else?
How to save django FileField to user folder?
2,424,900
5
3
5,337
0
python,django,django-models,upload
If you added a user field to the model, and have that attribute set before you performed an upload, then you could get the user in to your upload_location function via the instance attribute.
0
0
0
0
2009-05-13T14:16:00.000
3
0.321513
false
858,213
0
0
1
1
I've got a model like this def upload_location(instance, filename): return 'validate/%s/builds/%s' % (get_current_user(), filename) class MidletPair(models.Model): jad_file = models.FileField(upload_to = upload_location) jar_file = models.FileField(upload_to = upload_location) upload_to=tempfile.gettempdir() How can I get the current user in upload_location()... ? Side note: Looking up django stuff is confusing as theres a lot of pre-1.0 stuff around on the net.
Getting the template name in django template
859,951
2
8
4,840
0
python,django
Templates are just strings not file names. Probably your best option is to monkey patch render_to_response and/or direct_to_template and copy the filename arg into the context.
0
0
0
0
2009-05-13T17:34:00.000
3
0.132549
false
859,319
0
0
1
1
For debugging purposes, I would like to have a variable in all my templates holding the path of the template being rendered. For example, if a view renders templates/account/logout.html I would like {{ template_name }} to contain the string templates/account/logout.html. I don't want to go and change any views (specially because I'm reusing a lot of apps), so the way to go seems to be a context processor that introspects something. The question is what to introspect. Or maybe this is built in and I don't know about it?
Beginning Windows Mobile 6.1 Development With Python
864,988
1
0
1,216
0
python,windows-mobile,mobile-phones
Can't help you much with Python\CE but if you want a great db for mobile devices SQLLite will do the job for you. If you do a quick google you'll find there are libraries for connecting to SQLLite with Python too.
1
0
0
0
2009-05-14T18:17:00.000
1
0.197375
false
864,887
0
0
1
1
I've wanted to get into Python development for awhile and most of my programming experience has been in .NET and no mobile development. I recently thought of a useful app to make for my windows mobile phone and thought this could be a great first Python project. I did a little research online and found PyCe which I think is what I would need to get started on the app? Can anyone with some experience in this area point me in the right direction? What to download to get started, what lightweight database I could use, etc? Thanks in advance!
Visual Editor for Django Templates?
875,985
1
20
10,614
0
python,django,django-templates
Kind of an oblique answer, but if being able to use tools like Dreamweaver on your templates is important to you, you may find you like Genshi better than Django Templates, and it's easy enough to switch your template engine. Genshi is an XML templating language that is one of the inheritors of the Zope TAL family. Your template file is a valid XML file, so you can open it in any XML aware tool. Personally, once I got used to using XML templates, I couldn't go back, but they are slower to process ( an xml parser has to run behind the scenes ) and they require valid XHTML in your output which can be a good or a bad thing. ( Invalid user submitted html content for example would need to be forced clean using something like Beautiful Soup or ElementTree ).
0
0
0
0
2009-05-16T09:34:00.000
6
0.033321
false
872,065
0
0
1
2
Is there a tool out there for visually building Django templates? Thanks
Visual Editor for Django Templates?
874,222
2
20
10,614
0
python,django,django-templates
There's no WYSIWYG tool like Dreamweaver. But highligting is possible. I am using Kate to edit my templates. For instance when you comment in Django template it inserts {% comment %}.
0
0
0
0
2009-05-16T09:34:00.000
6
0.066568
false
872,065
0
0
1
2
Is there a tool out there for visually building Django templates? Thanks
editing a wav files using python
877,551
1
4
25,153
0
python,audio
You will need to come up with some threshold value of a minimum number of consecutive zeros before you cut them. Otherwise you'll be removing perfectly valid zeros from the middle of normal audio data. You can iterate through the wave file, copying any non-zero values, and buffering up zero values. When you're buffering zeroes and eventually come across the next non-zero, if the buffer has fewer samples that the threshold, copy them over, otherwise discard it. Python is not a great tool for this sort of task though. :(
0
0
0
0
2009-05-17T20:54:00.000
6
0.033321
false
875,476
1
0
1
1
Between each word in the wav file I have full silence (I checked with Hex workshop and silence is represented with 0's). How can I cut the non-silence sound? I'm programming using python. Thanks!
Python learning environment
879,227
2
3
536
0
python
Not sure what you mean. For development First choice: idle -- you already have it. Second choice: Komodo Edit -- very easy to use, but not as directly interactive as idle. For deploying applications, that depends on your application. If you're building desktop applications or web applications, you still use similar tools. I prefer using Komodo Edit for big things (either desktop or web) because it's a nice IDE. What are you asking about? Development tools or final deployment of a finished product?
0
0
0
0
2009-05-18T18:53:00.000
5
0.07983
false
879,218
1
0
1
2
I'm looking to get up to speed on Python, is it worth working locally via the ActivePython interface, then progressing to a website that supports one of the standard frameworks (Django or Pylons) OR utilize the Google Apps environment? I want to stay as interactive as possible - making feedback/learning easier.
Python learning environment
879,231
2
3
536
0
python
I would just start locally. Django and Pylons add another layer of complexity to the edit/feedback loop. Unless your primary focus is to make python websites, just stick with an editor and the console.
0
0
0
0
2009-05-18T18:53:00.000
5
0.07983
false
879,218
1
0
1
2
I'm looking to get up to speed on Python, is it worth working locally via the ActivePython interface, then progressing to a website that supports one of the standard frameworks (Django or Pylons) OR utilize the Google Apps environment? I want to stay as interactive as possible - making feedback/learning easier.
SQLAlchemy - Database hits on every request?
890,202
3
0
967
1
python,sqlalchemy
For a user login and basic permission tokens in a simple web application I will definitely store that in a cookie-based session. It's true that a few SELECTs per request is not a big deal at all, but then again if you can get some/all of your web requests to execute from cached data with no DB hits at all, that just adds that much more scalability to an app which is planning on receiving a lot of load. The issue of the user token being changed on the database is handled in two ways. One is, ignore it - for a lot of use cases its not that big a deal for the user to log out and log back in again to get at new permissions that have been granted elsewhere (witness unix as an example). The other is that all mutations of the user row are filtered through a method that also resets the state within the cookie-based session, but this is only effective if the user him/herself is the one initiating the changes through the browser interface. If OTOH neither of the above use cases apply to you, then you probably need to stick with a little bit of database access built into every request.
0
0
0
0
2009-05-19T08:11:00.000
4
0.148885
false
881,517
0
0
1
4
I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to check the permissions of the user it has stored. I'm fairly new to the web application development world, but from my understanding, hitting the database for something like this on every request isn't efficient. Or is this considered a normal thing to do? The only thing I've thought of so far is pulling up this data once, and storing what's relevant (most of the data isn't even required on every request). However, this brings up the problem of what's supposed to happen if this user record happens to be removed in the interim. Any ideas on how best to manage this?
SQLAlchemy - Database hits on every request?
881,535
1
0
967
1
python,sqlalchemy
It's a Database, so often it's fairly common to "hit" the Database to pull the required data. You can reduce single queries if you build up Joins or Stored Procedures.
0
0
0
0
2009-05-19T08:11:00.000
4
0.049958
false
881,517
0
0
1
4
I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to check the permissions of the user it has stored. I'm fairly new to the web application development world, but from my understanding, hitting the database for something like this on every request isn't efficient. Or is this considered a normal thing to do? The only thing I've thought of so far is pulling up this data once, and storing what's relevant (most of the data isn't even required on every request). However, this brings up the problem of what's supposed to happen if this user record happens to be removed in the interim. Any ideas on how best to manage this?
SQLAlchemy - Database hits on every request?
882,021
3
0
967
1
python,sqlalchemy
"hitting the database for something like this on every request isn't efficient." False. And, you've assumed that there's no caching, which is also false. Most ORM layers are perfectly capable of caching rows, saving some DB queries. Most RDBMS's have extensive caching, resulting in remarkably fast responses to common queries. All ORM layers will use consistent SQL, further aiding the database in optimizing the repetitive operations. (Specifically, the SQL statement is cached, saving parsing and planning time.) " Or is this considered a normal thing to do?" True. Until you can prove that your queries are the slowest part of your application, don't worry. Build something that actually works. Then optimize the part that you can prove is the bottleneck.
0
0
0
0
2009-05-19T08:11:00.000
4
0.148885
false
881,517
0
0
1
4
I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to check the permissions of the user it has stored. I'm fairly new to the web application development world, but from my understanding, hitting the database for something like this on every request isn't efficient. Or is this considered a normal thing to do? The only thing I've thought of so far is pulling up this data once, and storing what's relevant (most of the data isn't even required on every request). However, this brings up the problem of what's supposed to happen if this user record happens to be removed in the interim. Any ideas on how best to manage this?
SQLAlchemy - Database hits on every request?
882,171
2
0
967
1
python,sqlalchemy
You are basically talking about caching data as a performance optimization. As always, premature optimization is a bad idea. It's hard to know where the bottlenecks are beforehand, even more so if the application domain is new to you. Optimization adds complexity and if you optimize the wrong things, you not only have wasted the effort, but have made the necessary optimizations harder. Requesting user data usually is usually a pretty trivial query. You can build yourself a simple benchmark to see what kind of overhead it will introduce. If it isn't a significant percentage of your time-budget, just leave it be. If you still want to cache the data on the application server then you have to come up with a cache invalidation scheme. Possible schemes are to check for changes from the database. If you don't have a lot of data to cache, this really isn't significantly more efficient than just reloading it. Another option is to just time out cached data. This is a good option if instant visibility of changes isn't important. Another option is to actively invalidate caches on changes. This depends on whether you only modify the database through your application and if you have a single application server or a clustered solution.
0
0
0
0
2009-05-19T08:11:00.000
4
0.099668
false
881,517
0
0
1
4
I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to check the permissions of the user it has stored. I'm fairly new to the web application development world, but from my understanding, hitting the database for something like this on every request isn't efficient. Or is this considered a normal thing to do? The only thing I've thought of so far is pulling up this data once, and storing what's relevant (most of the data isn't even required on every request). However, this brings up the problem of what's supposed to happen if this user record happens to be removed in the interim. Any ideas on how best to manage this?
Auto-tab between fields on Django admin site
881,692
1
0
435
0
python,django,django-admin,field
Sure it's possible, but it will need some javascript. You'd want to bind an event to the keypress event on each field, and when it fires test the length of the text entered so far - if it matches, move the focus onto the next field.
0
0
0
0
2009-05-19T08:17:00.000
2
0.099668
false
881,536
0
0
1
1
I have an inline on a model with data with a fixed length, that has to be entered very fast, so I was thinking about a way of "tabbing" through fields automatically when the field is filled... Could that be possible?
Custom ordering in Django
883,645
0
39
29,554
0
python,django,django-models
It depends on where you want to use it. If you want to use it in your own templates, I would suggest to write a template-tag, that will do the ordering for you In it, you could use any sorting algorithm you want to use. In admin I do custom sorting by extending the templates to my needs and loading a template-tag as described above
0
0
0
0
2009-05-19T15:49:00.000
4
0
false
883,575
0
0
1
2
How do you define a specific ordering in Django QuerySets? Specifically, if I have a QuerySet like so: ['a10', 'a1', 'a2']. Regular order (using Whatever.objects.order_by('someField')) will give me ['a1', 'a10', 'a2'], while I am looking for: ['a1', 'a2', 'a10']. What is the proper way to define my own ordering technique?
Custom ordering in Django
889,445
37
39
29,554
0
python,django,django-models
@Jarret's answer (do the sort in Python) works great for simple cases. As soon as you have a large table and want to, say, pull only the first page of results sorted in a certain way, this approach breaks (you have to pull every single row from the database before you can do the sort). At that point I would look into adding a denormalized "sort" field which you populate from the "name" field at save-time, that you can sort on at the DB-level in the usual way.
0
0
0
0
2009-05-19T15:49:00.000
4
1
false
883,575
0
0
1
2
How do you define a specific ordering in Django QuerySets? Specifically, if I have a QuerySet like so: ['a10', 'a1', 'a2']. Regular order (using Whatever.objects.order_by('someField')) will give me ['a1', 'a10', 'a2'], while I am looking for: ['a1', 'a2', 'a10']. What is the proper way to define my own ordering technique?
Does Django scale?
886,309
6
1,204
203,038
0
python,django,web-applications,scalability
Note that if you're expecting 100K users per day, that are active for hours at a time (meaning max of 20K+ concurrent users), you're going to need A LOT of servers. SO has ~15,000 registered users, and most of them are probably not active daily. While the bulk of traffic comes from unregistered users, I'm guessing that very few of them stay on the site more than a couple minutes (i.e. they follow google search results then leave). For that volume, expect at least 30 servers ... which is still a rather heavy 1,000 concurrent users per server.
0
0
0
0
2009-05-20T05:07:00.000
29
1
false
886,221
0
0
1
8
I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn. I'm building a prototype for an idea and wasn't thinking too much about the future. Development speed was the main factor, and I already knew Python. I knew the migration to Google App Engine would be easier should I choose to do so in the future. I heard Django was "nice". Now that I'm getting closer to thinking about publishing my work, I start being concerned about scale. The only information I found about the scaling capabilities of Django is provided by the Django team (I'm not saying anything to disregard them, but this is clearly not objective information...). My questions: What's the "largest" site that's built on Django today? (I measure size mostly by user traffic) Can Django deal with 100,000 users daily, each visiting the site for a couple of hours? Could a site like Stack Overflow run on Django?
Does Django scale?
33,579,299
6
1,204
203,038
0
python,django,web-applications,scalability
I don't think the issue is really about Django scaling. I really suggest you look into your architecture that's what will help you with your scaling needs.If you get that wrong there is no point on how well Django performs. Performance != Scale. You can have a system that has amazing performance but does not scale and vice versa. Is your application database bound? If it is then your scale issues lay there as well. How are you planning on interacting with the database from Django? What happens when you database cannot process requests as fast as Django accepts them? What happens when your data outgrows one physical machine. You need to account for how you plan on dealing with those circumstances. Moreover, What happens when your traffic outgrows one app server? how you handle sessions in this case can be tricky, more often than not you would probably require a shared nothing architecture. Again that depends on your application. In short languages is not what determines scale, a language is responsible for performance(again depending on your applications, different languages perform differently). It is your design and architecture that makes scaling a reality. I hope it helps, would be glad to help further if you have questions.
0
0
0
0
2009-05-20T05:07:00.000
29
1
false
886,221
0
0
1
8
I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn. I'm building a prototype for an idea and wasn't thinking too much about the future. Development speed was the main factor, and I already knew Python. I knew the migration to Google App Engine would be easier should I choose to do so in the future. I heard Django was "nice". Now that I'm getting closer to thinking about publishing my work, I start being concerned about scale. The only information I found about the scaling capabilities of Django is provided by the Django team (I'm not saying anything to disregard them, but this is clearly not objective information...). My questions: What's the "largest" site that's built on Django today? (I measure size mostly by user traffic) Can Django deal with 100,000 users daily, each visiting the site for a couple of hours? Could a site like Stack Overflow run on Django?
Does Django scale?
35,997,907
4
1,204
203,038
0
python,django,web-applications,scalability
Even-though there have been a lot of great answers here, I just feel like pointing out, that nobody have put emphasis on.. It depends on the application If you application is light on writes, as in you are reading a lot more data from the DB than you are writing. Then scaling django should be fairly trivial, heck, it comes with some fairly decent output/view caching straight out of the box. Make use of that, and say, redis as a cache provider, put a load balancer in front of it, spin up n-instances and you should be able to deal with a VERY large amount of traffic. Now, if you have to do thousands of complex writes a second? Different story. Is Django going to be a bad choice? Well, not necessarily, depends on how you architect your solution really, and also, what your requirements are. Just my two cents :-)
0
0
0
0
2009-05-20T05:07:00.000
29
0.027579
false
886,221
0
0
1
8
I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn. I'm building a prototype for an idea and wasn't thinking too much about the future. Development speed was the main factor, and I already knew Python. I knew the migration to Google App Engine would be easier should I choose to do so in the future. I heard Django was "nice". Now that I'm getting closer to thinking about publishing my work, I start being concerned about scale. The only information I found about the scaling capabilities of Django is provided by the Django team (I'm not saying anything to disregard them, but this is clearly not objective information...). My questions: What's the "largest" site that's built on Django today? (I measure size mostly by user traffic) Can Django deal with 100,000 users daily, each visiting the site for a couple of hours? Could a site like Stack Overflow run on Django?
Does Django scale?
887,363
283
1,204
203,038
0
python,django,web-applications,scalability
We're doing load testing now. We think we can support 240 concurrent requests (a sustained rate of 120 hits per second 24x7) without any significant degradation in the server performance. That would be 432,000 hits per hour. Response times aren't small (our transactions are large) but there's no degradation from our baseline performance as the load increases. We're using Apache front-ending Django and MySQL. The OS is Red Hat Enterprise Linux (RHEL). 64-bit. We use mod_wsgi in daemon mode for Django. We've done no cache or database optimization other than to accept the defaults. We're all in one VM on a 64-bit Dell with (I think) 32Gb RAM. Since performance is almost the same for 20 or 200 concurrent users, we don't need to spend huge amounts of time "tweaking". Instead we simply need to keep our base performance up through ordinary SSL performance improvements, ordinary database design and implementation (indexing, etc.), ordinary firewall performance improvements, etc. What we do measure is our load test laptops struggling under the insane workload of 15 processes running 16 concurrent threads of requests.
0
0
0
0
2009-05-20T05:07:00.000
29
1
false
886,221
0
0
1
8
I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn. I'm building a prototype for an idea and wasn't thinking too much about the future. Development speed was the main factor, and I already knew Python. I knew the migration to Google App Engine would be easier should I choose to do so in the future. I heard Django was "nice". Now that I'm getting closer to thinking about publishing my work, I start being concerned about scale. The only information I found about the scaling capabilities of Django is provided by the Django team (I'm not saying anything to disregard them, but this is clearly not objective information...). My questions: What's the "largest" site that's built on Django today? (I measure size mostly by user traffic) Can Django deal with 100,000 users daily, each visiting the site for a couple of hours? Could a site like Stack Overflow run on Django?
Does Django scale?
4,272,991
2
1,204
203,038
0
python,django,web-applications,scalability
Spreading the tasks evenly, in short optimizing each and every aspect including DBs, Files, Images, CSS etc. and balancing the load with several other resources is necessary once your site/application starts growing. OR you make some more space for it to grow. Implementation of latest technologies like CDN, Cloud are must with huge sites. Just developing and tweaking an application won't give your the cent percent satisfation, other components also play an important role.
0
0
0
0
2009-05-20T05:07:00.000
29
0.013792
false
886,221
0
0
1
8
I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn. I'm building a prototype for an idea and wasn't thinking too much about the future. Development speed was the main factor, and I already knew Python. I knew the migration to Google App Engine would be easier should I choose to do so in the future. I heard Django was "nice". Now that I'm getting closer to thinking about publishing my work, I start being concerned about scale. The only information I found about the scaling capabilities of Django is provided by the Django team (I'm not saying anything to disregard them, but this is clearly not objective information...). My questions: What's the "largest" site that's built on Django today? (I measure size mostly by user traffic) Can Django deal with 100,000 users daily, each visiting the site for a couple of hours? Could a site like Stack Overflow run on Django?
Does Django scale?
887,463
5
1,204
203,038
0
python,django,web-applications,scalability
Another example is rasp.yandex.ru, Russian transport timetable service. Its attendance satisfies your requirements.
0
0
0
0
2009-05-20T05:07:00.000
29
0.034469
false
886,221
0
0
1
8
I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn. I'm building a prototype for an idea and wasn't thinking too much about the future. Development speed was the main factor, and I already knew Python. I knew the migration to Google App Engine would be easier should I choose to do so in the future. I heard Django was "nice". Now that I'm getting closer to thinking about publishing my work, I start being concerned about scale. The only information I found about the scaling capabilities of Django is provided by the Django team (I'm not saying anything to disregard them, but this is clearly not objective information...). My questions: What's the "largest" site that's built on Django today? (I measure size mostly by user traffic) Can Django deal with 100,000 users daily, each visiting the site for a couple of hours? Could a site like Stack Overflow run on Django?
Does Django scale?
25,727,705
5
1,204
203,038
0
python,django,web-applications,scalability
I develop high traffic sites using Django for the national broadcaster in Ireland. It works well for us. Developing a high performance site is more than about just choosing a framework. A framework will only be one part of a system that is as strong as it's weakest link. Using the latest framework 'X' won't solve your performance issues if the problem is slow database queries or a badly configured server or network.
0
0
0
0
2009-05-20T05:07:00.000
29
0.034469
false
886,221
0
0
1
8
I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn. I'm building a prototype for an idea and wasn't thinking too much about the future. Development speed was the main factor, and I already knew Python. I knew the migration to Google App Engine would be easier should I choose to do so in the future. I heard Django was "nice". Now that I'm getting closer to thinking about publishing my work, I start being concerned about scale. The only information I found about the scaling capabilities of Django is provided by the Django team (I'm not saying anything to disregard them, but this is clearly not objective information...). My questions: What's the "largest" site that's built on Django today? (I measure size mostly by user traffic) Can Django deal with 100,000 users daily, each visiting the site for a couple of hours? Could a site like Stack Overflow run on Django?
Does Django scale?
26,828,032
4
1,204
203,038
0
python,django,web-applications,scalability
The problem is not to know if django can scale or not. The right way is to understand and know which are the network design patterns and tools to put under your django/symfony/rails project to scale well. Some ideas can be : Multiplexing. Inversed proxy. Ex : Nginx, Varnish Memcache Session. Ex : Redis Clusterization on your project and db for load balancing and fault tolerance : Ex : Docker Use third party to store assets. Ex : Amazon S3 Hope it help a bit. This is my tiny rock to the mountain.
0
0
0
0
2009-05-20T05:07:00.000
29
0.027579
false
886,221
0
0
1
8
I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I wasn't sure, and PHP seemed like a huge hassle to learn. I'm building a prototype for an idea and wasn't thinking too much about the future. Development speed was the main factor, and I already knew Python. I knew the migration to Google App Engine would be easier should I choose to do so in the future. I heard Django was "nice". Now that I'm getting closer to thinking about publishing my work, I start being concerned about scale. The only information I found about the scaling capabilities of Django is provided by the Django team (I'm not saying anything to disregard them, but this is clearly not objective information...). My questions: What's the "largest" site that's built on Django today? (I measure size mostly by user traffic) Can Django deal with 100,000 users daily, each visiting the site for a couple of hours? Could a site like Stack Overflow run on Django?