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 limit rate of requests to web services in Python?
401,390
2
18
17,294
0
python,web-services,rate-limiting
Queuing may be overly complicated. A simpler solution is to give your class a variable for the time the service was last called. Whenever the service is called (!1), set waitTime to delay - Now + lastcalltime. delay should be equal to the minimum allowable time between requests. If this number is positive, sleep for that long before making the call (!2). The disadvantage/advantage of this approach is that it treats the web service requests as being synchronous. The advantage is that it is absurdly simple and easy to implement. (!1): Should happen right after receiving a response from the service, inside the wrapper (probably at the bottom of the wrapper). (!2): Should happen when the python wrapper around the web service is called, at the top of the wrapper. S.Lott's solution is more elegant, of course.
0
0
1
0
2008-12-30T19:30:00.000
6
0.066568
false
401,215
1
0
1
3
I'm working on a Python library that interfaces with a web service API. Like many web services I've encountered, this one requests limiting the rate of requests. I would like to provide an optional parameter, limit, to the class instantiation that, if provided, will hold outgoing requests until the number of seconds specified passes. I understand that the general scenario is the following: an instance of the class makes a request via a method. When it does, the method emits some signal that sets a lock variable somewhere, and begins a countdown timer for the number of seconds in limit. (In all likelihood, the lock is the countdown timer itself.) If another request is made within this time frame, it must be queued until the countdown timer reaches zero and the lock is disengaged; at this point, the oldest request on the queue is sent, and the countdown timer is reset and the lock is re-engaged. Is this a case for threading? Is there another approach I'm not seeing? Should the countdown timer and lock be instance variables, or should they belong to the class, such that all instances of the class hold requests? Also, is this generally a bad idea to provide rate-limiting functionality within a library? I reason since, by default, the countdown is zero seconds, the library still allows developers to use the library and provide their own rate-limiting schemes. Given any developers using the service will need to rate-limit requests anyway, however, I figure that it would be a convenience for the library to provide a means of rate-limiting. Regardless of placing a rate-limiting scheme in the library or not, I'll want to write an application using the library, so suggested techniques will come in handy.
How to store a dictionary on a Django Model?
402,387
2
66
73,533
0
python,django,django-models,orm,persistence
Think it over, and find the commonalities of each data set... then define your model. It may require the use of subclasses or not. Foreign keys representing commonalities aren't to be avoided, but encouraged when they make sense. Stuffing random data into a SQL table is not smart, unless it's truly non-relational data. If that's the case, define your problem and we may be able to help.
0
0
0
0
2008-12-31T03:18:00.000
14
0.028564
false
402,217
0
0
1
1
I need to store some data in a Django model. These data are not equal to all instances of the model. At first I thought about subclassing the model, but I’m trying to keep the application flexible. If I use subclasses, I’ll need to create a whole class each time I need a new kind of object, and that’s no good. I’ll also end up with a lot of subclasses only to store a pair of extra fields. I really feel that a dictionary would be the best approach, but there’s nothing in the Django documentation about storing a dictionary in a Django model (or I can’t find it). Any clues?
Please advise on Ruby vs Python, for someone who likes LISP a lot
405,577
0
21
5,716
0
python,ruby,lisp
pick the most popular one for your domain so your work gets the most visibility. some might say ruby/rails for web, python for everything else. picking a language just because its like lisp is really not appropriate for a professional.
0
0
0
1
2009-01-01T17:12:00.000
12
0
false
405,165
0
0
1
6
I am a C++ developer, slowly getting into web development. I like LISP a lot but don't like AllegroCL and web-frameworks available for LISP. I am looking for more freedom and ability to do cool hacks on language level. I don't consider tabs as a crime against nature. Which one is closer to LISP: Python or Ruby? I can't seem to be able to choose from Python and Ruby: they seem very similar but apparently Ruby is more functional and object-oriented, which are good things, while Python is more like Perl: a simple scripting language. Do I have the right impression? PS - This might seem like a flame bait but it's not really, I'm just trying not to go crazy from OCD about switching from RoR to Python/Django and back.
Please advise on Ruby vs Python, for someone who likes LISP a lot
405,382
3
21
5,716
0
python,ruby,lisp
I am a Pythonista; however, based on your requirements, especially the "cool hacks on the language level", I would suggest you work on Ruby. Ruby is more flexible in the Perl way and you can do a lot of hacks; Python is targeted towards readability, which is a very good thing, and generally language hacks are a little frowned upon. Ruby's basic types can be modified in a hackish way that typically prototype languages allow, while Python's basic types are more suited for subclassing. By the way, I would add a minor correction: both Ruby and Python are very, very object-oriented, and neither is intended to be used for quick-and-dirty scripts the Perl way. Among the two, Ruby is syntactically more similar to Perl than Python.
0
0
0
1
2009-01-01T17:12:00.000
12
0.049958
false
405,165
0
0
1
6
I am a C++ developer, slowly getting into web development. I like LISP a lot but don't like AllegroCL and web-frameworks available for LISP. I am looking for more freedom and ability to do cool hacks on language level. I don't consider tabs as a crime against nature. Which one is closer to LISP: Python or Ruby? I can't seem to be able to choose from Python and Ruby: they seem very similar but apparently Ruby is more functional and object-oriented, which are good things, while Python is more like Perl: a simple scripting language. Do I have the right impression? PS - This might seem like a flame bait but it's not really, I'm just trying not to go crazy from OCD about switching from RoR to Python/Django and back.
Please advise on Ruby vs Python, for someone who likes LISP a lot
405,317
1
21
5,716
0
python,ruby,lisp
If you need Unicode support, remember to check how well supported it is. AFAIK, Python's support for Unicode is better than Ruby's, especially since Python 3.0. On the other hand, Python 3 is still missing some popular packages and 3rd party libraries, so that might play against.
0
0
0
1
2009-01-01T17:12:00.000
12
0.016665
false
405,165
0
0
1
6
I am a C++ developer, slowly getting into web development. I like LISP a lot but don't like AllegroCL and web-frameworks available for LISP. I am looking for more freedom and ability to do cool hacks on language level. I don't consider tabs as a crime against nature. Which one is closer to LISP: Python or Ruby? I can't seem to be able to choose from Python and Ruby: they seem very similar but apparently Ruby is more functional and object-oriented, which are good things, while Python is more like Perl: a simple scripting language. Do I have the right impression? PS - This might seem like a flame bait but it's not really, I'm just trying not to go crazy from OCD about switching from RoR to Python/Django and back.
Please advise on Ruby vs Python, for someone who likes LISP a lot
405,474
0
21
5,716
0
python,ruby,lisp
I'm a Rubyist who chose the language based on very similar criteria. Python is a good language and I enjoy working with it too, but I think Ruby is somewhat more Lispy in the degree of freedom it gives to the programmer. Python seems to impose its opinions a little bit more (which can be a good thing, but isn't according to our criteria here). Python certainly isn't more Perlish— Ruby is essentially a Smalltalk/Perl mashup (some of its less-used features are pulled directly from Perl), whereas Python is only distantly related to either.
0
0
0
1
2009-01-01T17:12:00.000
12
0
false
405,165
0
0
1
6
I am a C++ developer, slowly getting into web development. I like LISP a lot but don't like AllegroCL and web-frameworks available for LISP. I am looking for more freedom and ability to do cool hacks on language level. I don't consider tabs as a crime against nature. Which one is closer to LISP: Python or Ruby? I can't seem to be able to choose from Python and Ruby: they seem very similar but apparently Ruby is more functional and object-oriented, which are good things, while Python is more like Perl: a simple scripting language. Do I have the right impression? PS - This might seem like a flame bait but it's not really, I'm just trying not to go crazy from OCD about switching from RoR to Python/Django and back.
Please advise on Ruby vs Python, for someone who likes LISP a lot
405,310
8
21
5,716
0
python,ruby,lisp
Both Ruby and Python are fairly distant from the Lisp traditions of immutable data, programs as data, and macros. But Ruby is very nearly a clone of Smalltalk (and I hope will grow more like Smalltalk as the Perlish cruft is deprecated), and Smalltalk, like Lisp, is a language that takes one idea to extremes. Based on your desire to do cool hacks on the language level I'd go with Ruby, as it inherits a lot of the metaprogramming mindset from Smalltalk, and that mindset is connected to the Lisp tradition.
0
0
0
1
2009-01-01T17:12:00.000
12
1
false
405,165
0
0
1
6
I am a C++ developer, slowly getting into web development. I like LISP a lot but don't like AllegroCL and web-frameworks available for LISP. I am looking for more freedom and ability to do cool hacks on language level. I don't consider tabs as a crime against nature. Which one is closer to LISP: Python or Ruby? I can't seem to be able to choose from Python and Ruby: they seem very similar but apparently Ruby is more functional and object-oriented, which are good things, while Python is more like Perl: a simple scripting language. Do I have the right impression? PS - This might seem like a flame bait but it's not really, I'm just trying not to go crazy from OCD about switching from RoR to Python/Django and back.
Please advise on Ruby vs Python, for someone who likes LISP a lot
405,228
12
21
5,716
0
python,ruby,lisp
Speaking as a "Rubyist", I'd agree with Kiv. The two languages both grant a nice amount of leeway when it comes to programming paradigms, but are also have benefits/shortcomings. I think that the compromises you make either way are a lot about your own programming style and taste. Personally, I think Ruby can read more like pseudo-code than Python. First, Python has active whitespace, which while elegant in the eyes of many, doesn't tend to enter the equation when writing pseudo-code. Also, Ruby's syntax is quite flexible. That flexibility causes a lot of quirks that can confuse, but also allows code that's quite expressive and pretty to look at. Finally, I'd really say that Ruby feels more Perl-ish to me. That's partly because I'm far more comfortable with it, so I can hack out scripts rather quickly. A lot of Ruby's syntax was borrowed from Perl though, and I haven't seen much Python code that feels similar (though again, I have little experience with Python). Depending on the approach to web programming you'd like to take, I think that the types of web frameworks available in each language could perhaps be a factor in deciding as well. I'd say try them both. You can get a working knowledge of each of them in an afternoon, and while you won't be writing awesome Ruby or Python, you can probably establish a feel for each, and decide which you like more. Update: I think your question should actually be two separate discussions: one with Ruby, one with Python. The comparisons are less important because you start debating the merits of the differences, as opposed to which language will work better for you. If you have questions about Ruby, I'd be more than happy to answer as best I can.
0
0
0
1
2009-01-01T17:12:00.000
12
1
false
405,165
0
0
1
6
I am a C++ developer, slowly getting into web development. I like LISP a lot but don't like AllegroCL and web-frameworks available for LISP. I am looking for more freedom and ability to do cool hacks on language level. I don't consider tabs as a crime against nature. Which one is closer to LISP: Python or Ruby? I can't seem to be able to choose from Python and Ruby: they seem very similar but apparently Ruby is more functional and object-oriented, which are good things, while Python is more like Perl: a simple scripting language. Do I have the right impression? PS - This might seem like a flame bait but it's not really, I'm just trying not to go crazy from OCD about switching from RoR to Python/Django and back.
Interested in Collective Programming for the web -- Ruby or Python or PHP?
7,620,095
0
0
2,360
0
php,python,ruby,artificial-intelligence,recommendation-engine
I happen to know a world-class expert in machine learning. He likes Prolog, especially for the higher level logic of the system. Hadn't even heard anyone mention that in a long time. Personally, I like Java. But if you're going to do intensive machine learning, you should be concerned about the speed of math processing. C++ for the math, in my view.
0
0
0
1
2009-01-04T00:49:00.000
5
0
false
410,183
0
0
1
4
For something like a personal recommendation system, machine learning type of stuff on a website, what language would be best?
Interested in Collective Programming for the web -- Ruby or Python or PHP?
636,664
-2
0
2,360
0
php,python,ruby,artificial-intelligence,recommendation-engine
I recently did some research into this for a project at my day job. It was for a recommendation system and the options were php,perl or python. PHP was out almost immediately, there were no good 3rd party open source libraries and the language itself is not as well suited to any kind of complex real programming. Python had a few libraries that i wanted to try out and Perl didn't, so I went with Python. In the end, none of those libraries were useful to me but besides library support I prefer python personally anyway so that was the right decision. Because your question is very vague I can only suggest that you don't use PHP and select the language based on library support for your specific problem area and your comfort in that language. I would say that library support is the biggest factor in your decision and language familiarity/preference is a close second.
0
0
0
1
2009-01-04T00:49:00.000
5
-0.07983
false
410,183
0
0
1
4
For something like a personal recommendation system, machine learning type of stuff on a website, what language would be best?
Interested in Collective Programming for the web -- Ruby or Python or PHP?
636,639
0
0
2,360
0
php,python,ruby,artificial-intelligence,recommendation-engine
All of the points that Bill Karwin have brought up are entirely valid: You should really operate in what you are most comfortable with. If that isn't a factor, I would personally suggest Ruby. It's an incredibly powerful language that draws a lot of commonalities with Lisp and is probably just as good, if not better, for AI programming for all the same reasons Lisp was: it's an extremely dynamic, self-modifiable language. As an added benefit Ruby has a really nice standard library including some great libs like the distributed computed library "dRuby".
0
0
0
1
2009-01-04T00:49:00.000
5
0
false
410,183
0
0
1
4
For something like a personal recommendation system, machine learning type of stuff on a website, what language would be best?
Interested in Collective Programming for the web -- Ruby or Python or PHP?
410,193
16
0
2,360
0
php,python,ruby,artificial-intelligence,recommendation-engine
The language you know best would be best. I mean that half-seriously. Given the brief description of your project, there's no reason to believe any of the languages you list would be any better or worse than the others. Those three languages are adequate for approximately similar tasks, so you should pick the one you are most comfortable with and proceed. Any other recommendations would be advocacy for one language or the other, with no real basis on which to evaluate them. Your description is just too vague.
0
0
0
1
2009-01-04T00:49:00.000
5
1
false
410,183
0
0
1
4
For something like a personal recommendation system, machine learning type of stuff on a website, what language would be best?
PyGreSQL vs psycopg2
413,259
5
13
15,364
1
python,postgresql
For what it's worth, django uses psycopg2.
0
0
0
0
2009-01-05T14:21:00.000
5
1.2
true
413,228
0
0
1
4
What is the difference between these two apis? Which one faster, reliable using Python DB API? Upd: I see two psql drivers for Django. The first one is psycopg2. What is the second one? pygresql?
PyGreSQL vs psycopg2
413,508
0
13
15,364
1
python,postgresql
psycopg2 is partly written in C so you can expect a performance gain, but on the other hand, a bit harder to install. PyGreSQL is written in Python only, easy to deployed but slower.
0
0
0
0
2009-01-05T14:21:00.000
5
0
false
413,228
0
0
1
4
What is the difference between these two apis? Which one faster, reliable using Python DB API? Upd: I see two psql drivers for Django. The first one is psycopg2. What is the second one? pygresql?
PyGreSQL vs psycopg2
592,846
4
13
15,364
1
python,postgresql
"PyGreSQL is written in Python only, easy to deployed but slower." PyGreSQL contains a C-coded module, too. I haven't done speed tests, but they're not likely to be much different, as the real work will happen inside the database server.
0
0
0
0
2009-01-05T14:21:00.000
5
0.158649
false
413,228
0
0
1
4
What is the difference between these two apis? Which one faster, reliable using Python DB API? Upd: I see two psql drivers for Django. The first one is psycopg2. What is the second one? pygresql?
PyGreSQL vs psycopg2
413,537
2
13
15,364
1
python,postgresql
Licensing may be an issue for you. PyGreSQL is MIT license. Psycopg2 is GPL license. (as long as you are accessing psycopg2 in normal ways from Python, with no internal API, and no direct C calls, this shouldn't cause you any headaches, and you can release your code under whatever license you like - but I am not a lawyer).
0
0
0
0
2009-01-05T14:21:00.000
5
0.07983
false
413,228
0
0
1
4
What is the difference between these two apis? Which one faster, reliable using Python DB API? Upd: I see two psql drivers for Django. The first one is psycopg2. What is the second one? pygresql?
Django and units conversion
413,549
1
1
3,399
0
python,django
It depends on how you want to use it. Let's say you have length value and two possible units, cm and mm. If you want only to print the value later, you can always print it as [value] [unit]. However, if you want to do some calculations with the value, for instance, calculate the area, you need to convert the values to the same units. So you have to define unit conversion table anyway. I would convert the units to the same internal unit before I store them in the database, rather than converting them every time I use them. I would add a model for units and physical quantities only if there are too many of them and the conversion is really tricky. Such a model could work as a converter. But for simple cases, like mm⇒cm or inch⇒cm, a static conversion table would suffice.
0
0
0
0
2009-01-05T15:27:00.000
3
0.066568
false
413,446
0
0
1
1
I need to store some values in the database, distance, weight etc. In my model, I have field that contains quantity of something and IntegerField with choices option, that determines what this quantity means (length, time duration etc). Should I create a model for units and physical quantity or should I use IntegerField that contains the type of unit?
What does "|" sign mean in a Django template?
417,273
-3
8
4,913
0
python,django,django-templates
It's a bitwise "or". It means escape if the property doesn't exist/is null.
0
0
0
0
2009-01-06T16:44:00.000
3
-0.197375
false
417,265
0
0
1
1
I often see something like that: something.property|escape something is an object, property is it's string property. escape - i don't know :) What does this mean? And what min python version it is used in? EDIT: The question was asked wrongly, it said "What does | mean in Python", so the bitwise or answers are correct, but irrelevant, please do not downvote them
How do you query the set of Users in Google App Domain within your Google App Engine project?
426,287
0
1
1,636
0
python,google-app-engine,google-apps,gql,gqlquery
Yeah, there's no way to get information about people who haven't logged into your application.
0
1
0
0
2009-01-07T04:33:00.000
4
0
false
419,197
0
0
1
1
If you have a Google App Engine project you can authenticate based on either a) anyone with a google account or b) a particular google app domain. Since you can connect these two entities I would assume there is some way to query the list of users that can be authenticated. The use case is outputting a roster of all members in an organization to a web page running on Google App Engine. Any thoughts?
Getting selected value from drop down box in a html form without submit
7,284,763
0
1
13,168
0
javascript,python,html,google-app-engine,drop-down-menu
The problem with using onchange is that not all users are using a mouse. If you have a combo-box and change the value with the keyboard, you'd never be able to get past the first value without the form submitting. ~Cyrix
0
0
1
0
2009-01-07T11:05:00.000
4
0
false
419,908
0
0
1
1
How to get the text of selected item from a drop down box element in html forms? (using python) How can I store the value to a variable, when I select one item from the drop down box using mouse? (ie. without using a submit button) This is for a application which I am doing in app engine which only supports Python.
Which software for intranet CMS - Django or Joomla?
1,062,921
0
3
14,680
0
python,django,content-management-system,joomla
Thanks for that. The system has been chosen behind my back by higher management. It's SilverStripe. Slow Admin interface No experienced programmer in the company knowing this product Implemented by a graphic designer who's leaving in about two weeks, but "he can do consulting as he's going to be a freelancer" I'm not happy at all Thanks again.
0
0
0
0
2009-01-08T11:12:00.000
9
0
false
423,916
0
0
1
6
In my company we are thinking of moving from wiki style intranet to a more bespoke CMS solution. Natural choice would be Joomla, but we have a specific architecture. There is a few hundred people who will use the system. System should be self explainable (easier than wiki). We use a lot of tools web, applications and integrated within 3rd party software. The superior element which is a glue for all of them is API. In example for the intranet tools we do use Django, but it's used without ORM, kind of limited to templates and url - every application has an adequate methods within our API. We do not use the Django admin interface, because it is hardly dependent on ORM. Because of that Joomla may be hard to integrate. Every employee should be able to edit most of the pages, authentication and privileges have to be managed by our API. How hard is it to plug Joomla to use a different authentication process? (extension only - no hacks) If one knows Django better than Joomla, should Django be used?
Which software for intranet CMS - Django or Joomla?
428,028
0
3
14,680
0
python,django,content-management-system,joomla
Thank you for all the answers. Plone option cancelled on today's meeting. Using Joomla will involve quite a lot of coding to make it act as the rest of the intranet. I think that writing a CMS in Django (with "stealing" some code from existing cms solutions) will win. Newforms are very interesting and it shouldn't be that hard (I wrote already a CMS system in PHP build on my own framework - used on about 15 sites)
0
0
0
0
2009-01-08T11:12:00.000
9
0
false
423,916
0
0
1
6
In my company we are thinking of moving from wiki style intranet to a more bespoke CMS solution. Natural choice would be Joomla, but we have a specific architecture. There is a few hundred people who will use the system. System should be self explainable (easier than wiki). We use a lot of tools web, applications and integrated within 3rd party software. The superior element which is a glue for all of them is API. In example for the intranet tools we do use Django, but it's used without ORM, kind of limited to templates and url - every application has an adequate methods within our API. We do not use the Django admin interface, because it is hardly dependent on ORM. Because of that Joomla may be hard to integrate. Every employee should be able to edit most of the pages, authentication and privileges have to be managed by our API. How hard is it to plug Joomla to use a different authentication process? (extension only - no hacks) If one knows Django better than Joomla, should Django be used?
Which software for intranet CMS - Django or Joomla?
424,091
0
3
14,680
0
python,django,content-management-system,joomla
Django CMS way of work requires using a built-in ORM model and an admin interface.
0
0
0
0
2009-01-08T11:12:00.000
9
0
false
423,916
0
0
1
6
In my company we are thinking of moving from wiki style intranet to a more bespoke CMS solution. Natural choice would be Joomla, but we have a specific architecture. There is a few hundred people who will use the system. System should be self explainable (easier than wiki). We use a lot of tools web, applications and integrated within 3rd party software. The superior element which is a glue for all of them is API. In example for the intranet tools we do use Django, but it's used without ORM, kind of limited to templates and url - every application has an adequate methods within our API. We do not use the Django admin interface, because it is hardly dependent on ORM. Because of that Joomla may be hard to integrate. Every employee should be able to edit most of the pages, authentication and privileges have to be managed by our API. How hard is it to plug Joomla to use a different authentication process? (extension only - no hacks) If one knows Django better than Joomla, should Django be used?
Which software for intranet CMS - Django or Joomla?
424,377
2
3
14,680
0
python,django,content-management-system,joomla
Joomla! has authentication plugins; you can write your own without hacking the core. When someone attempts to log into your site, it will go through all published authentication plugins (in the order you set) until one returns true. If you only want to use one method, unpublish all of the other plugins except for your custom one. Also, Joomla! already has a plugin for LDAP if your system supports this. The part that may be more difficult would be managing specific privileges through the API. Joomla! currently lacks group level access control; it currently has permission level access control (Editors, Publishers, Administrators, etc...).
0
0
0
0
2009-01-08T11:12:00.000
9
0.044415
false
423,916
0
0
1
6
In my company we are thinking of moving from wiki style intranet to a more bespoke CMS solution. Natural choice would be Joomla, but we have a specific architecture. There is a few hundred people who will use the system. System should be self explainable (easier than wiki). We use a lot of tools web, applications and integrated within 3rd party software. The superior element which is a glue for all of them is API. In example for the intranet tools we do use Django, but it's used without ORM, kind of limited to templates and url - every application has an adequate methods within our API. We do not use the Django admin interface, because it is hardly dependent on ORM. Because of that Joomla may be hard to integrate. Every employee should be able to edit most of the pages, authentication and privileges have to be managed by our API. How hard is it to plug Joomla to use a different authentication process? (extension only - no hacks) If one knows Django better than Joomla, should Django be used?
Which software for intranet CMS - Django or Joomla?
2,631,681
1
3
14,680
0
python,django,content-management-system,joomla
If you use FLEXIcontent and FLEXiaccess you can get granular level permissions on Joomla
0
0
0
0
2009-01-08T11:12:00.000
9
0.022219
false
423,916
0
0
1
6
In my company we are thinking of moving from wiki style intranet to a more bespoke CMS solution. Natural choice would be Joomla, but we have a specific architecture. There is a few hundred people who will use the system. System should be self explainable (easier than wiki). We use a lot of tools web, applications and integrated within 3rd party software. The superior element which is a glue for all of them is API. In example for the intranet tools we do use Django, but it's used without ORM, kind of limited to templates and url - every application has an adequate methods within our API. We do not use the Django admin interface, because it is hardly dependent on ORM. Because of that Joomla may be hard to integrate. Every employee should be able to edit most of the pages, authentication and privileges have to be managed by our API. How hard is it to plug Joomla to use a different authentication process? (extension only - no hacks) If one knows Django better than Joomla, should Django be used?
Which software for intranet CMS - Django or Joomla?
423,947
8
3
14,680
0
python,django,content-management-system,joomla
Django isn't a CMS. If you want to build an application then you'd use Django (by the sound of your post you understand that though). If you just want to be able to edit/store content and have permissions for your users - a CMS would be the way to go. I really don't know anything about Joomla though. It should be easy enough to mock up a hack to do whatever authentication you need - even if that's just a POST directly to the server. Django will take a long time to get up to the point where you're using it for the purposes you mention. The admin interface will need to be used (or you're building a CMS from scratch) - which means creating models to model the content you already own. Then you have to customise each model page, and 'plug in' whatever authentication system you want. Lot of work.
0
0
0
0
2009-01-08T11:12:00.000
9
1.2
true
423,916
0
0
1
6
In my company we are thinking of moving from wiki style intranet to a more bespoke CMS solution. Natural choice would be Joomla, but we have a specific architecture. There is a few hundred people who will use the system. System should be self explainable (easier than wiki). We use a lot of tools web, applications and integrated within 3rd party software. The superior element which is a glue for all of them is API. In example for the intranet tools we do use Django, but it's used without ORM, kind of limited to templates and url - every application has an adequate methods within our API. We do not use the Django admin interface, because it is hardly dependent on ORM. Because of that Joomla may be hard to integrate. Every employee should be able to edit most of the pages, authentication and privileges have to be managed by our API. How hard is it to plug Joomla to use a different authentication process? (extension only - no hacks) If one knows Django better than Joomla, should Django be used?
PyObjc vs RubyCocoa for Mac development: Which is more mature?
426,733
3
8
2,518
0
python,ruby,cocoa,pyobjc,ruby-cocoa
Both are roughly equal, I'd say. Better in some places, worse in others. But I wouldn't recommend learning Cocoa with either. Like Chris said, Cocoa requires some understanding of Objective-C. I like Ruby better than Objective-C, but I still don't recommend using it to learn Cocoa. Once you have a solid foundation (no pun intended) in Cocoa/Objective-C, then the bridges can be useful to you.
0
0
0
1
2009-01-09T00:16:00.000
5
0.119427
false
426,607
0
0
1
3
I've been wanting to have a play with either Ruby or Python while at the same time I've been wanting to do a bit of Cocoa programming. So I thought the best way to achieve both these goals is to develop something using either a Ruby or Python to Objective-C bridge (PyObjc or RubyCocoa). I know that ideally to get the best learning experience I would learn each techonology independently but I don't have the time. :) So my question is which is a more mature platform, PyObc or RubyCocoa, main things I am looking for: Documentation of API Tutorials Tools Supportive Community Completness of Cocoa API avaialble through the bridge Regarding point 5 I don't expect that the entire Cocoa API will be availble through either bridge but I need to have enough Cocoa APIs available to develop a functioning application.
PyObjc vs RubyCocoa for Mac development: Which is more mature?
426,703
12
8
2,518
0
python,ruby,cocoa,pyobjc,ruby-cocoa
While you say you "don't have time" to learn technologies independently the fastest route to learning Cocoa will still be to learn it in its native language: Objective-C. Once you understand Objective-C and have gotten over the initial learning curve of the Cocoa frameworks you'll have a much easier time picking up either PyObjC or RubyCocoa.
0
0
0
1
2009-01-09T00:16:00.000
5
1
false
426,607
0
0
1
3
I've been wanting to have a play with either Ruby or Python while at the same time I've been wanting to do a bit of Cocoa programming. So I thought the best way to achieve both these goals is to develop something using either a Ruby or Python to Objective-C bridge (PyObjc or RubyCocoa). I know that ideally to get the best learning experience I would learn each techonology independently but I don't have the time. :) So my question is which is a more mature platform, PyObc or RubyCocoa, main things I am looking for: Documentation of API Tutorials Tools Supportive Community Completness of Cocoa API avaialble through the bridge Regarding point 5 I don't expect that the entire Cocoa API will be availble through either bridge but I need to have enough Cocoa APIs available to develop a functioning application.
PyObjc vs RubyCocoa for Mac development: Which is more mature?
3,930,584
1
8
2,518
0
python,ruby,cocoa,pyobjc,ruby-cocoa
ObjectiveC is nowhere near as much fun or as productive as either Python or Ruby. That is why people want to pick a python or ruby with good Objective C access. Advising them to learn Objective C first misses the point imo. I have really good things to say about pyobjc. Its ability to interoperate painlessly with Objective C frameworks is superb. I have less experience with Ruby Cocoa and that was partly because when I last looked it didn't seem to have as clean and relatively painless interoperability. I feel hesitant about MacRuby because it seems to go too far. In pyobjc you can write plain python and only subclass/use Foundation and Cocoa objects when you really want/mean to. From what I understand of MacRuby it is a Ruby on top of Cocoa. So a string is always an NSString. I am less happy with that. YMMV.
0
0
0
1
2009-01-09T00:16:00.000
5
0.039979
false
426,607
0
0
1
3
I've been wanting to have a play with either Ruby or Python while at the same time I've been wanting to do a bit of Cocoa programming. So I thought the best way to achieve both these goals is to develop something using either a Ruby or Python to Objective-C bridge (PyObjc or RubyCocoa). I know that ideally to get the best learning experience I would learn each techonology independently but I don't have the time. :) So my question is which is a more mature platform, PyObc or RubyCocoa, main things I am looking for: Documentation of API Tutorials Tools Supportive Community Completness of Cocoa API avaialble through the bridge Regarding point 5 I don't expect that the entire Cocoa API will be availble through either bridge but I need to have enough Cocoa APIs available to develop a functioning application.
Measure load time for python cgi script?
428,832
1
2
653
0
python,html,css,browser,cgi
with that much html to render I would also consider the speed of the computer. you can test this by saving the html file and opening it from your local hard drive :)
0
0
0
1
2009-01-09T16:19:00.000
2
0.099668
false
428,704
0
0
1
2
I use python cgi for our intranet application. When I measure time, the script takes 4s to finish. But after that, it still takes another 11s to show the screen in the browser. The screen is build with tables (size: 10 KB, 91 KB uncompressed) and has a large css file (5 KB, 58 KB uncompressed). I used YSlow and did as much optimization as suggested. Gzipping etc. Firebug Net says: 11s for the file. How do I measure where these last 11 seconds are needed for? Is it just the size of the HTML, or the table structure? Anyone more ideas for tweaking?
Measure load time for python cgi script?
428,767
1
2
653
0
python,html,css,browser,cgi
I think I'd grab a copy of Ethereal and watch the TCP connection between the browser and the script, if I were concerned about whether the server is not getting its job done in an acceptable amount of time. If you see the TCP socket close before that 11s gap, you know that your issue is entirely on the browser side. If the TCP close comes well into the 11s gap, then you're going to have to do some debugging on the http server side. I think that Ethereal has changed it's name to WireShark. Whatever it is calling itself recently, it's a must-have tool for this sort of work. I was using it just the other day to find out why I couldn't connect to my virtualized http server.
0
0
0
1
2009-01-09T16:19:00.000
2
0.099668
false
428,704
0
0
1
2
I use python cgi for our intranet application. When I measure time, the script takes 4s to finish. But after that, it still takes another 11s to show the screen in the browser. The screen is build with tables (size: 10 KB, 91 KB uncompressed) and has a large css file (5 KB, 58 KB uncompressed). I used YSlow and did as much optimization as suggested. Gzipping etc. Firebug Net says: 11s for the file. How do I measure where these last 11 seconds are needed for? Is it just the size of the HTML, or the table structure? Anyone more ideas for tweaking?
Syncing Django users with Google Apps without monkeypatching
605,174
1
1
428
0
python,django,google-apps,monkeypatching
Have you considered subclassing the User model? This may create a different set of problems, and is only available with newer releases (not sure when the change went in, I'm on trunk).
0
0
0
0
2009-01-09T19:49:00.000
4
0.049958
false
429,443
0
0
1
3
I am writing a Django app, and I would like an account to be created on our Google Apps hosted email using the Provisioning API whenever an account is created locally. I would solely use signals, but since I would like the passwords to be synchronized across sites, I have monkeypatched User.objects.create_user and User.set_password using wrappers to create Google accounts and update passwords respectively. Monkeypatching seems to be frowned upon, so I would to know, is there a better way to accomplish this?
Syncing Django users with Google Apps without monkeypatching
959,044
0
1
428
0
python,django,google-apps,monkeypatching
Monkeypatching is definitely bad. Hard to say anything since you've given so little code/information. But I assume you have the password in cleartext at some point (in a view, in a form) so why not sync manually then?
0
0
0
0
2009-01-09T19:49:00.000
4
0
false
429,443
0
0
1
3
I am writing a Django app, and I would like an account to be created on our Google Apps hosted email using the Provisioning API whenever an account is created locally. I would solely use signals, but since I would like the passwords to be synchronized across sites, I have monkeypatched User.objects.create_user and User.set_password using wrappers to create Google accounts and update passwords respectively. Monkeypatching seems to be frowned upon, so I would to know, is there a better way to accomplish this?
Syncing Django users with Google Apps without monkeypatching
749,860
0
1
428
0
python,django,google-apps,monkeypatching
Subclassing seems the best route, as long as you can change all of your code to use the new class. I think that's supported in the latest release of Django.
0
0
0
0
2009-01-09T19:49:00.000
4
0
false
429,443
0
0
1
3
I am writing a Django app, and I would like an account to be created on our Google Apps hosted email using the Provisioning API whenever an account is created locally. I would solely use signals, but since I would like the passwords to be synchronized across sites, I have monkeypatched User.objects.create_user and User.set_password using wrappers to create Google accounts and update passwords respectively. Monkeypatching seems to be frowned upon, so I would to know, is there a better way to accomplish this?
when to delete user's session
432,200
1
1
988
0
python,session
A cron job to clean up any expired session data in the database is a good thing. Depending on how long your sessions last, and how big your database is, you might want to cleanup more often than once per day. But one cleanup pass per day is usually fine.
0
0
0
0
2009-01-11T01:23:00.000
3
0.066568
false
432,115
0
0
1
3
I'm writing a webapp that will only be used by authenticated users. Some temporary databases and log files will be created during each user session. I'd like to erase all these temp files when the session is finished. Obviously, a logout or window close event would be sufficient to close the session, but in some cases the user may keep the browser open long after he's finished. Another approach would be to time user sessions or delete the temp files during routine maintenance. How do you go about it?
when to delete user's session
432,126
1
1
988
0
python,session
User sessions should have a timeout value and should be closed when the timeout expires or the user logs out. Log out is an obvious time to do this and the time out needs to be there in case the user navigates away from your application without logging out.
0
0
0
0
2009-01-11T01:23:00.000
3
1.2
true
432,115
0
0
1
3
I'm writing a webapp that will only be used by authenticated users. Some temporary databases and log files will be created during each user session. I'd like to erase all these temp files when the session is finished. Obviously, a logout or window close event would be sufficient to close the session, but in some cases the user may keep the browser open long after he's finished. Another approach would be to time user sessions or delete the temp files during routine maintenance. How do you go about it?
when to delete user's session
432,170
0
1
988
0
python,session
Delete User's Session during: 1) Logout 2) Automatic timeout (the length of the timeout can be set through the web.config) 3) As part of any other routine maintenance methods you already have running by deleting any session information which hasn't been accessed for some defined period of time (likely shorter than your automatic timeout length because if it was the same length it should already be taken care of)
0
0
0
0
2009-01-11T01:23:00.000
3
0
false
432,115
0
0
1
3
I'm writing a webapp that will only be used by authenticated users. Some temporary databases and log files will be created during each user session. I'd like to erase all these temp files when the session is finished. Obviously, a logout or window close event would be sufficient to close the session, but in some cases the user may keep the browser open long after he's finished. Another approach would be to time user sessions or delete the temp files during routine maintenance. How do you go about it?
Installing certain packages using virtualenv
436,427
0
2
3,218
0
python,virtualenv,buildout
The other option (one I've used) is to easy_install Django after you've created the virtual environment. This is easily scripted. The penalty you pay is waiting for Django installation in each of your virtual environments. I'm with Toby, though: Unless there's a compelling reason why you have to have a separate copy of Django in each virtual environment, you should just consider installing it in your main Python area, and allowing each virtual environment to use it from there.
0
0
0
0
2009-01-12T04:05:00.000
5
0
false
434,407
1
0
1
2
So, I want to start using virtualenv this year. I like the no-site-packages option, that is nice. However I was wondering how to install certain packages into each virtualenv. For example, lets say I want to install django into each virtualenv... is this possible, and if so, how? Does buildout address this? Well it's not so much django, more like the django applications... I dont mind installing a version of django into each virtualenv... i was just wondering if there was some intermediate option to 'no-site-packages'
Installing certain packages using virtualenv
434,445
2
2
3,218
0
python,virtualenv,buildout
If you want django to be installed on EACH virtualenv, you might as well install it in the site-packages directory? Just a thought.
0
0
0
0
2009-01-12T04:05:00.000
5
0.07983
false
434,407
1
0
1
2
So, I want to start using virtualenv this year. I like the no-site-packages option, that is nice. However I was wondering how to install certain packages into each virtualenv. For example, lets say I want to install django into each virtualenv... is this possible, and if so, how? Does buildout address this? Well it's not so much django, more like the django applications... I dont mind installing a version of django into each virtualenv... i was just wondering if there was some intermediate option to 'no-site-packages'
For Python support, what company would be best to get hosting from?
434,598
0
14
9,246
0
python,web-hosting,wsgi
I've been pretty happy with Dreamhost, and of course Google AppEngine.
0
0
0
0
2009-01-12T06:07:00.000
9
0
false
434,580
0
0
1
3
I want to be able to run WSGI apps but my current hosting restricts it. Does anybody know a company that can accommodate my requirements?
For Python support, what company would be best to get hosting from?
435,197
0
14
9,246
0
python,web-hosting,wsgi
Google App engine and OpenHosting.com Have virtual server by OpenHosting, they are ultra fast with support and have very high uptime.
0
0
0
0
2009-01-12T06:07:00.000
9
0
false
434,580
0
0
1
3
I want to be able to run WSGI apps but my current hosting restricts it. Does anybody know a company that can accommodate my requirements?
For Python support, what company would be best to get hosting from?
22,368,517
0
14
9,246
0
python,web-hosting,wsgi
I use AWS micro server, 1 year free and after that you can get a 3 year reserved which works out to about $75/yr :) The micro server has only 20MB/sec throughput, ~600MB of ram, and a slower CPU. I run a few Mezzanine sites on mine and it seems fine.
0
0
0
0
2009-01-12T06:07:00.000
9
0
false
434,580
0
0
1
3
I want to be able to run WSGI apps but my current hosting restricts it. Does anybody know a company that can accommodate my requirements?
What should "value_from_datadict" method of a custom form widget return?
437,360
0
5
4,106
0
python,django,django-forms
The Django source says Given a dictionary of data and this widget's name, returns the value of this widget. Returns None if it's not provided. Reading the code, I see that Django's separate Date and Time widgets are both subclasses of Input, subclasses of Widget, which appears to work with simple Strings.
0
0
0
0
2009-01-12T20:40:00.000
2
0
false
436,944
1
0
1
1
I'm trying to build my own custom django form widgets (putting them in widgets.py of my project directory). What should the value "value_from_datadict()" return? Is it returning a string or the actual expected value of the field? I'm building my own version of a split date/time widget using JQuery objects, what should each part of the widget return? Should the date widget return a datetime and the time widget return a datetime? What glue code merges the two values together?
Is there a way to automatically generate a list of columns that need indexing?
438,700
4
5
620
1
python,mysql,database,django,django-models
No. Adding indexes willy-nilly to all "slow" queries will also slow down inserts, updates and deletes. Indexes are a balancing act between fast queries and fast changes. There is no general or "right" answer. There's certainly nothing that can automate this. You have to measure the improvement across your whole application as you add and change indexes.
0
0
0
0
2009-01-13T10:36:00.000
2
0.379949
false
438,559
0
0
1
1
The beauty of ORM lulled me into a soporific sleep. I've got an existing Django app with a lack of database indexes. Is there a way to automatically generate a list of columns that need indexing? I was thinking maybe some middleware that logs which columns are involved in WHERE clauses? but is there anything built into MySQL that might help?
Re-creating threading and concurrency knowledge in increasingly popular languages
442,312
1
7
573
0
java,python,ruby,multithreading,concurrency
This is not flame bait, but IMHO Java has one of the simpler and more restricted models for threading and concurrency available. That's not necessarily a bad thing, but at the level of granularity it offers it means that the perspective it gives you of what concurrency is and how to deal with it is inherently limited if you have a "java centric" view (as someone else put it). If you're serious about concurrency, then it's worth exploring other languages precisely because different models and idioms exist. Some of the hottest areas are lock-free programming (you'll see a lot of it, but often done badly, in C++) and functional programming (which has been around for a while but arguably, is becoming increasingly relevant. A prime example in the case of concurrency is probably Erlang).
0
0
0
0
2009-01-13T17:52:00.000
5
0.039979
false
440,036
1
0
1
3
I am primarily a Java developer, and I've been reading a lot of in-depth work on threads and concurrency. Many very smart people (Doug Lea, Brian Goetz, etc) have authored books on these topics and made contributions to new concurrency libraries for Java. As I start to learn more about Python, Ruby, and other languages, I'm wondering: does all of that work have to be re-created for these languages? Will there be, or does there need to be, a "Doug Lea of Python," or a "Brian Goetz of Ruby," who make similarly powerful contributions to the concurrency features of those languages? Does all of this concurrency work done in Java have to be re-created for future languages? Or will the work done in Java establish lessons and guidance for future languages?
Re-creating threading and concurrency knowledge in increasingly popular languages
463,249
3
7
573
0
java,python,ruby,multithreading,concurrency
I think the answer is both yes and no. Java arguably has the most well-defined memory model and execution semantics of the most commonly used imperative languages (Java, C++, Python, Ruby, etc). In some sense, other languages either lack this completely or are playing catch-up (if that's even possible given the immaturity of the threading models). C++ is probably the notable exception - it has been treading the same ground for C++0x and has possibly gone beyond the current state of the Java model from my impression. I say no because the communities are not isolated. Many of the guys working on this stuff are involved (at least from a guidance point of view, if not from a direct hand in the specs) in more than one language. So, there is a lot of crosstalk between guys working on JMM and guys working on C++0x specs as they are essentially solving the same problems with many of the same underlying drivers (from the hardware guys at the bottom and the users at the top). And I'm pretty sure there is cross-talk at some level between the JVM / CLR camps as well. As others have mentioned, there are also other models for concurrency: actors in Erlang and Scala, agents/STM in Clojure, FP's rise in F#, Scala, Haskell, the CCR and PLINQ stuff in CLR land, etc. It's an exciting time right now! We can use as many concurrency experts as we can find I think.... :)
0
0
0
0
2009-01-13T17:52:00.000
5
0.119427
false
440,036
1
0
1
3
I am primarily a Java developer, and I've been reading a lot of in-depth work on threads and concurrency. Many very smart people (Doug Lea, Brian Goetz, etc) have authored books on these topics and made contributions to new concurrency libraries for Java. As I start to learn more about Python, Ruby, and other languages, I'm wondering: does all of that work have to be re-created for these languages? Will there be, or does there need to be, a "Doug Lea of Python," or a "Brian Goetz of Ruby," who make similarly powerful contributions to the concurrency features of those languages? Does all of this concurrency work done in Java have to be re-created for future languages? Or will the work done in Java establish lessons and guidance for future languages?
Re-creating threading and concurrency knowledge in increasingly popular languages
440,086
11
7
573
0
java,python,ruby,multithreading,concurrency
The basic principles of concurrent programming existed before java and were summarized in those java books you're talking about. The java.util.concurrent library was similarly derived from previous code and research papers on concurrent programming. However, some implementation issues are specific to Java. It has a specified memory model, and the concurrent utilities in Java are tailored to the specifics of that. With some modification those can be ported to other languages/environments with different memory model characteristics. So, you might need a book to teach you the canonical usage of the concurrency tools in other languages but it wouldn't be reinventing the wheel.
0
0
0
0
2009-01-13T17:52:00.000
5
1
false
440,036
1
0
1
3
I am primarily a Java developer, and I've been reading a lot of in-depth work on threads and concurrency. Many very smart people (Doug Lea, Brian Goetz, etc) have authored books on these topics and made contributions to new concurrency libraries for Java. As I start to learn more about Python, Ruby, and other languages, I'm wondering: does all of that work have to be re-created for these languages? Will there be, or does there need to be, a "Doug Lea of Python," or a "Brian Goetz of Ruby," who make similarly powerful contributions to the concurrency features of those languages? Does all of this concurrency work done in Java have to be re-created for future languages? Or will the work done in Java establish lessons and guidance for future languages?
What is the best approach to implement configuration app with Django?
448,110
0
4
1,916
0
python,django,configuration,django-models,django-admin
I think you'll have trouble if you make other apps depend (at interpretation/app-loading time) on values set in your config app. Can you use some kind of placeholder value in Python code at interpretation time, and then pull in the real config data on the post_syncdb signal?
0
0
0
0
2009-01-14T09:11:00.000
3
0
false
442,355
0
0
1
1
I need to program kind of configuration registry for Django-based application. Requirements: Most likely param_name : param_value structure Editable via admin interface Has to work with syncdb. How to deal with a situation in which other apps depend on configuration model and the model itself has not been initialized yet in DB? Let's say I would like to have configurable model fields properties, i.e. the default value setting? Any ideas or suggestions would be appreciated.
cascading forms in Django/else using any Pythonic framework
443,155
1
3
612
0
python,django
I would also suggest considering getting a mapping of all data once instead of requesting subfield values one by one. Unless the subfield choices change frequently (states/cities change?) or huge in numbers (>1000) this should offer best performance and it is less complex. You don't even need to create a seperate view, just include a chunk of JavaScript (a JSON mapping more precisely) with your response containing the form.
0
0
0
0
2009-01-14T11:04:00.000
2
0.099668
false
442,596
0
0
1
1
Can anyone point to an example written in Python (django preferred) with ajax for cascading forms? Cascading Forms is basically forms whose field values change if and when another field value changes. Example Choose Country, and then States will change...
Has anyone tracked down whether IronPython or IronRuby will support Attributes?
592,844
0
1
316
0
ironpython,ironruby
We're looking at attribute support again for a .NET interop-focused release in the near future. Keep an eye on [email protected] for an updates.
0
0
0
1
2009-01-14T17:49:00.000
3
0
false
443,996
0
0
1
1
I have scanned 'the Google' and have not found the definitive answer on whether the Iron* languages (any or all) will end up with Attribute support.. Anyone? Thanks - Jon
GAE - How to live with no joins?
446,471
13
13
2,112
1
python,google-app-engine,join,google-cloud-datastore
If you look at how the SQL solution you provided will be executed, it will go basically like this: Fetch a list of friends for the current user For each user in the list, start an index scan over recent posts Merge-join all the scans from step 2, stopping when you've retrieved enough entries You can carry out exactly the same procedure yourself in App Engine, by using the Query instances as iterators and doing a merge join over them. You're right that this will not scale well to large numbers of friends, but it suffers from exactly the same issues the SQL implementation has, it just doesn't disguise them as well: Fetching the latest 20 (for example) entries costs roughly O(n log n) work, where n is the number of friends.
0
1
0
0
2009-01-15T06:07:00.000
4
1
false
445,827
0
0
1
2
Example Problem: Entities: User contains name and a list of friends (User references) Blog Post contains title, content, date and Writer (User) Requirement: I want a page that displays the title and a link to the blog of the last 10 posts by a user's friend. I would also like the ability to keep paging back through older entries. SQL Solution: So in sql land it would be something like: select * from blog_post where user_id in (select friend_id from user_friend where user_id = :userId) order by date GAE solutions i can think of are: Load user, loop through the list of friends and load their latest blog posts. Finally merge all the blog posts to find the latest 10 blog entries In a blog post have a list of all users that have the writer as a friend. This would mean a simple read but would result in quota overload when adding a friend who has lots of blog posts. I don't believe either of these solutions will scale. Im sure others have hit this problem but I've searched, watched google io videos, read other's code ... What am i missing?
GAE - How to live with no joins?
446,477
1
13
2,112
1
python,google-app-engine,join,google-cloud-datastore
"Load user, loop through the list of friends and load their latest blog posts." That's all a join is -- nested loops. Some kinds of joins are loops with lookups. Most lookups are just loops; some are hashes. "Finally merge all the blog posts to find the latest 10 blog entries" That's a ORDER BY with a LIMIT. That's what the database is doing for you. I'm not sure what's not scalable about this; it's what a database does anyway.
0
1
0
0
2009-01-15T06:07:00.000
4
0.049958
false
445,827
0
0
1
2
Example Problem: Entities: User contains name and a list of friends (User references) Blog Post contains title, content, date and Writer (User) Requirement: I want a page that displays the title and a link to the blog of the last 10 posts by a user's friend. I would also like the ability to keep paging back through older entries. SQL Solution: So in sql land it would be something like: select * from blog_post where user_id in (select friend_id from user_friend where user_id = :userId) order by date GAE solutions i can think of are: Load user, loop through the list of friends and load their latest blog posts. Finally merge all the blog posts to find the latest 10 blog entries In a blog post have a list of all users that have the writer as a friend. This would mean a simple read but would result in quota overload when adding a friend who has lots of blog posts. I don't believe either of these solutions will scale. Im sure others have hit this problem but I've searched, watched google io videos, read other's code ... What am i missing?
Porting library from Java to Python
2,746,114
0
6
1,699
0
java,python
I've used Java2Python. It's not too bad, you still need to understand the code as it doesn't do everything correctly, but it does help.
0
0
0
0
2009-01-15T19:23:00.000
7
0
false
448,095
1
0
1
6
I'm about to port a smallish library from Java to Python and wanted some advice (smallish ~ a few thousand lines of code). I've studied the Java code a little, and noticed some design patterns that are common in both languages. However, there were definitely some Java-only idioms (singletons, etc) present that are generally not-well-received in Python-world. I know at least one tool (j2py) exists that will turn a .java file into a .py file by walking the AST. Some initial experimentation yielded less than favorable results. Should I even be considering using an automated tool to generate some code, or are the languages different enough that any tool would create enough re-work to have justified writing from scratch? If tools aren't the devil, are there any besides j2py that can at least handle same-project import management? I don't expect any tool to match 3rd party libraries from one language to a substitute in another.
Porting library from Java to Python
448,137
9
6
1,699
0
java,python
If it were me, I'd consider doing the work by hand. A couple thousand lines of code isn't a lot of code, and by rewriting it yourself (rather than translating it automatically), you'll be in a position to decide how to take advantage of Python idioms appropriately. (FWIW, I worked Java almost exclusively for 9 years, and I'm now working in Python, so I know the kind of translation you'd have to do.)
0
0
0
0
2009-01-15T19:23:00.000
7
1.2
true
448,095
1
0
1
6
I'm about to port a smallish library from Java to Python and wanted some advice (smallish ~ a few thousand lines of code). I've studied the Java code a little, and noticed some design patterns that are common in both languages. However, there were definitely some Java-only idioms (singletons, etc) present that are generally not-well-received in Python-world. I know at least one tool (j2py) exists that will turn a .java file into a .py file by walking the AST. Some initial experimentation yielded less than favorable results. Should I even be considering using an automated tool to generate some code, or are the languages different enough that any tool would create enough re-work to have justified writing from scratch? If tools aren't the devil, are there any besides j2py that can at least handle same-project import management? I don't expect any tool to match 3rd party libraries from one language to a substitute in another.
Porting library from Java to Python
448,330
2
6
1,699
0
java,python
Jython's not what you're looking for in the final solution, but it will make the porting go much smoother. My approach would be: If there are existing tests (unit or otherwise), rewrite them in Jython (using Python's unittest) Write some characterization tests in Jython (tests that record the current behavior) Start porting class by class: For each class, subclass it in Jython and port the methods one by one, making the method in the superclass abstract After each change, run the tests! You'll now have working Jython code that hopefully has minimal dependencies on Java. Run the tests in CPython and fix whatever's left. Refactor - you'll want to Pythonify the code, probably simplifying it a lot with Python idioms. This is safe and easy because of the tests. I've this in the past with great success.
0
0
0
0
2009-01-15T19:23:00.000
7
0.057081
false
448,095
1
0
1
6
I'm about to port a smallish library from Java to Python and wanted some advice (smallish ~ a few thousand lines of code). I've studied the Java code a little, and noticed some design patterns that are common in both languages. However, there were definitely some Java-only idioms (singletons, etc) present that are generally not-well-received in Python-world. I know at least one tool (j2py) exists that will turn a .java file into a .py file by walking the AST. Some initial experimentation yielded less than favorable results. Should I even be considering using an automated tool to generate some code, or are the languages different enough that any tool would create enough re-work to have justified writing from scratch? If tools aren't the devil, are there any besides j2py that can at least handle same-project import management? I don't expect any tool to match 3rd party libraries from one language to a substitute in another.
Porting library from Java to Python
448,245
3
6
1,699
0
java,python
I would write it again by hand. I don't know of any automated tools that would generate non-disgusting looking Python, and having ported Java code to Python myself, I found the result was both higher quality than the original and considerably shorter. You gain quality because Python is more expressive (for example, anonymous inner class MouseAdapters and the like go away in favor of simple first class functions), and you also gain the benefit of writing it a second time. It also is considerably shorter: for example, 99% of getters/setters can just be left out in favor of directly accessing the fields. For the other 1% which actually do something you can use property(). However as David mentioned, if you don't ever need to read or maintain the code, an automatic translator would be fine.
0
0
0
0
2009-01-15T19:23:00.000
7
0.085505
false
448,095
1
0
1
6
I'm about to port a smallish library from Java to Python and wanted some advice (smallish ~ a few thousand lines of code). I've studied the Java code a little, and noticed some design patterns that are common in both languages. However, there were definitely some Java-only idioms (singletons, etc) present that are generally not-well-received in Python-world. I know at least one tool (j2py) exists that will turn a .java file into a .py file by walking the AST. Some initial experimentation yielded less than favorable results. Should I even be considering using an automated tool to generate some code, or are the languages different enough that any tool would create enough re-work to have justified writing from scratch? If tools aren't the devil, are there any besides j2py that can at least handle same-project import management? I don't expect any tool to match 3rd party libraries from one language to a substitute in another.
Porting library from Java to Python
448,213
3
6
1,699
0
java,python
Automatic translators (f2c, j2py, whatever) normally emit code you wouldn't want to touch by hand. This is fine when all you need to do is use the output (for example, if you have a C compiler and no Fortran compiler, f2c allows you to compile Fortran programs), but terrible when you need to do anything to the code afterwards. If you intend to use this as anything other than a black box, translate it by hand. At that size, it won't be too hard.
0
0
0
0
2009-01-15T19:23:00.000
7
0.085505
false
448,095
1
0
1
6
I'm about to port a smallish library from Java to Python and wanted some advice (smallish ~ a few thousand lines of code). I've studied the Java code a little, and noticed some design patterns that are common in both languages. However, there were definitely some Java-only idioms (singletons, etc) present that are generally not-well-received in Python-world. I know at least one tool (j2py) exists that will turn a .java file into a .py file by walking the AST. Some initial experimentation yielded less than favorable results. Should I even be considering using an automated tool to generate some code, or are the languages different enough that any tool would create enough re-work to have justified writing from scratch? If tools aren't the devil, are there any besides j2py that can at least handle same-project import management? I don't expect any tool to match 3rd party libraries from one language to a substitute in another.
Porting library from Java to Python
448,188
6
6
1,699
0
java,python
Code is always better the second time you write it anyway.... Plus a few thousand lines of Java can probably be translated into a few hundred of Python.
0
0
0
0
2009-01-15T19:23:00.000
7
1
false
448,095
1
0
1
6
I'm about to port a smallish library from Java to Python and wanted some advice (smallish ~ a few thousand lines of code). I've studied the Java code a little, and noticed some design patterns that are common in both languages. However, there were definitely some Java-only idioms (singletons, etc) present that are generally not-well-received in Python-world. I know at least one tool (j2py) exists that will turn a .java file into a .py file by walking the AST. Some initial experimentation yielded less than favorable results. Should I even be considering using an automated tool to generate some code, or are the languages different enough that any tool would create enough re-work to have justified writing from scratch? If tools aren't the devil, are there any besides j2py that can at least handle same-project import management? I don't expect any tool to match 3rd party libraries from one language to a substitute in another.
How do I create a webpage with buttons that invoke various Python scripts on the system serving the webpage?
449,199
0
25
38,798
0
python,windows,web-services,cgi
When setting this up, please be careful to restrict access to the scripts that take some action on your web server. It is not sufficient to place them in a directory where you just don't publish the URL, because sooner or later somebody will find them. At the very least, put these scripts in a location that is password protected. You don't want just anybody out there on the internet being able to run your scripts.
0
0
1
0
2009-01-15T22:58:00.000
9
0
false
448,837
0
0
1
2
I'm a hobbyist (and fairly new) programmer who has written several useful (to me) scripts in python to handle various system automation tasks that involve copying, renaming, and downloading files amongst other sundry activities. I'd like to create a web page served from one of my systems that would merely present a few buttons which would allow me to initiate these scripts remotely. The problem is that I don't know where to start investigating how to do this. Let's say I have a script called: file_arranger.py What do I need to do to have a webpage execute that script? This isn't meant for public consumption, so anything lightweight would be great. For bonus points, what do I need to look into to provide the web user with the output from such scripts? edit: The first answer made me realize I forgot to include that this is a Win2k3 system.
How do I create a webpage with buttons that invoke various Python scripts on the system serving the webpage?
449,062
1
25
38,798
0
python,windows,web-services,cgi
A simple cgi script (or set of scripts) is all you need to get started. The other answers have covered how to do this so I won't repeat it; instead, I will stress that using plain text will get you a long way. Just output the header (print("Content-type: text/plain\n") plus print adds its own newline to give you the needed blank line) and then run your normal program. This way, any normal output from your script gets sent to the browser and you don't have to worry about HTML, escaping, frameworks, anything. "Do the simplest thing that could possibly work." This is especially appropriate for non-interactive private administrative tasks like you describe, and lets you use identical programs from a shell with a minimum of fuss. Your driver, the page with the buttons, can be a static HTML file with single-button forms. Or even a list of links. To advance from there, look at the logging module (for example, sending INFO messages to the browser but not the command line, or easily categorizing messages by using different loggers, by configuring your handlers), and then start to consider template engines and frameworks. Don't output your own HTML and skip to using one of the many existing libraries—it'll save a ton of headache even spending a bit of extra time to learn the library. Or at the very least encapsulate your output by effectively writing your own mini-engine.
0
0
1
0
2009-01-15T22:58:00.000
9
0.022219
false
448,837
0
0
1
2
I'm a hobbyist (and fairly new) programmer who has written several useful (to me) scripts in python to handle various system automation tasks that involve copying, renaming, and downloading files amongst other sundry activities. I'd like to create a web page served from one of my systems that would merely present a few buttons which would allow me to initiate these scripts remotely. The problem is that I don't know where to start investigating how to do this. Let's say I have a script called: file_arranger.py What do I need to do to have a webpage execute that script? This isn't meant for public consumption, so anything lightweight would be great. For bonus points, what do I need to look into to provide the web user with the output from such scripts? edit: The first answer made me realize I forgot to include that this is a Win2k3 system.
Python Path
450,545
0
2
1,226
0
python
Remember that in addition to setting PYTHONPATH in your system environment, you'll also want to assign DJANGO_SETTINGS_MODULE.
0
0
0
0
2009-01-16T12:33:00.000
3
0
false
450,290
1
0
1
1
I am installing active python, django. I really dont know how to set the python path in vista environment system. first of all will it work in vista.
No module named MySQLdb
28,278,997
5
493
804,257
1
python,django,python-2.x
Go to your project directory with cd. source/bin/activate (activate your env. if not previously). Run the command easy_install MySQL-python
0
0
0
0
2009-01-18T09:13:00.000
32
0.03124
false
454,854
0
0
1
5
I am using Python version 2.5.4 and install MySQL version 5.0 and Django. Django is working fine with Python, but not MySQL. I am using it in Windows Vista.
No module named MySQLdb
58,246,337
6
493
804,257
1
python,django,python-2.x
I personally recommend using pymysql instead of using the genuine MySQL connector, which provides you with a platform independent interface and could be installed through pip. And you could edit the SQLAlchemy URL schema like this: mysql+pymysql://username:passwd@host/database
0
0
0
0
2009-01-18T09:13:00.000
32
1
false
454,854
0
0
1
5
I am using Python version 2.5.4 and install MySQL version 5.0 and Django. Django is working fine with Python, but not MySQL. I am using it in Windows Vista.
No module named MySQLdb
38,310,817
93
493
804,257
1
python,django,python-2.x
if your python version is 3.5, do a pip install mysqlclient, other things didn't work for me
0
0
0
0
2009-01-18T09:13:00.000
32
1
false
454,854
0
0
1
5
I am using Python version 2.5.4 and install MySQL version 5.0 and Django. Django is working fine with Python, but not MySQL. I am using it in Windows Vista.
No module named MySQLdb
58,825,148
2
493
804,257
1
python,django,python-2.x
None of the above worked for me on an Ubuntu 18.04 fresh install via docker image. The following solved it for me: apt-get install holland python3-mysqldb
0
0
0
0
2009-01-18T09:13:00.000
32
0.012499
false
454,854
0
0
1
5
I am using Python version 2.5.4 and install MySQL version 5.0 and Django. Django is working fine with Python, but not MySQL. I am using it in Windows Vista.
No module named MySQLdb
72,496,371
0
493
804,257
1
python,django,python-2.x
For CentOS 8 and Python3 $ sudo dnf install python3-mysqlclient -y
0
0
0
0
2009-01-18T09:13:00.000
32
0
false
454,854
0
0
1
5
I am using Python version 2.5.4 and install MySQL version 5.0 and Django. Django is working fine with Python, but not MySQL. I am using it in Windows Vista.
Advice on Python/Django and message queues
714,637
6
44
20,229
0
python,django,message-queue
Stompserver is a good option. It's lightweight, easy to install and easy to use from Django/python. We have a system using stompserver in production for sending out emails and processing other jobs asynchronously. Django saves the emails to the database, a model.post_save handler in Django sends an event to stompserver and stompserver passes the event to a consumer process which does the asynchronous task (sends the email). It scales up quite nicely because you can add consumer processes at runtime - two consumers can send twice as many emails, and the consumers can be on seperate machines. One slight complication is that each consumer needs its own named queue so Django needs to know how many consumers are available and send events to each queue in a round-robin way. (Two consumers listening on the same queue will both get each message = duplication). If you only want one consumer process then this isn't an issue. We previously had processes which polled the database continuously for jobs but found that it was adding a lot of load to the system, even when nothing needed to be processed.
0
0
0
0
2009-01-18T10:42:00.000
8
1
false
454,944
0
0
1
4
I have an application in Django, that needs to send a large number of emails to users in various use cases. I don't want to handle this synchronously within the application for obvious reasons. Has anyone any recommendations for a message queuing server which integrates well with Python, or they have used on a Django project? The rest of my stack is Apache, mod_python, MySQL.
Advice on Python/Django and message queues
3,696,792
1
44
20,229
0
python,django,message-queue
Is there anything wrong is solving this using the mail infrastructure? Like, every app server running their own mail daemons which will queue any locally submitted mail, which forward to a centralized mail server which can do the mail heavy lifting?
0
0
0
0
2009-01-18T10:42:00.000
8
0.024995
false
454,944
0
0
1
4
I have an application in Django, that needs to send a large number of emails to users in various use cases. I don't want to handle this synchronously within the application for obvious reasons. Has anyone any recommendations for a message queuing server which integrates well with Python, or they have used on a Django project? The rest of my stack is Apache, mod_python, MySQL.
Advice on Python/Django and message queues
454,996
0
44
20,229
0
python,django,message-queue
If you already have MySQL installed, you could create a table to use as a "todo list" of sorts. Threads synchronously add jobs to the table, and a batched task removes jobs as they're completed. That way, there's no need to install and learn more software, and it should work fine as a persistent job store so long as you're not sending lots of email (like >10/sec).
0
0
0
0
2009-01-18T10:42:00.000
8
0
false
454,944
0
0
1
4
I have an application in Django, that needs to send a large number of emails to users in various use cases. I don't want to handle this synchronously within the application for obvious reasons. Has anyone any recommendations for a message queuing server which integrates well with Python, or they have used on a Django project? The rest of my stack is Apache, mod_python, MySQL.
Advice on Python/Django and message queues
456,389
1
44
20,229
0
python,django,message-queue
Just add the emails to a database, and then write another script ran by some task scheduler utility (cron comes to mind) to send the emails.
0
0
0
0
2009-01-18T10:42:00.000
8
0.024995
false
454,944
0
0
1
4
I have an application in Django, that needs to send a large number of emails to users in various use cases. I don't want to handle this synchronously within the application for obvious reasons. Has anyone any recommendations for a message queuing server which integrates well with Python, or they have used on a Django project? The rest of my stack is Apache, mod_python, MySQL.
Cropping pages of a .pdf file
459,639
0
23
40,532
0
python,pdf,pypdf2,pypdf
Acrobat Javascript API has a setPageBoxes method, but Adobe doesn't provide any Python code samples. Only C++, C# and VB.
0
0
0
0
2009-01-19T10:43:00.000
7
0
false
457,207
0
0
1
2
I was wondering if anyone had any experience in working programmatically with .pdf files. I have a .pdf file and I need to crop every page down to a certain size. After a quick Google search I found the pyPdf library for python but my experiments with it failed. When I changed the cropBox and trimBox attributes on a page object the results were not what I had expected and appeared to be quite random. Has anyone had any experience with this? Code examples would be well appreciated, preferably in python.
Cropping pages of a .pdf file
459,523
0
23
40,532
0
python,pdf,pypdf2,pypdf
You can convert the PDF to Postscript (pstopdf or ps2pdf) and than use text processing on the Postscript file. After that you can convert the output back to PDF. This works nicely if the PDFs you want to process are all generated by the same application and are somewhat similar. If they come from different sources it is usually to hard to process the Postscript files - the structure is varying to much. But even than you migt be able to fix page sizes and the like with a few regular expressions.
0
0
0
0
2009-01-19T10:43:00.000
7
0
false
457,207
0
0
1
2
I was wondering if anyone had any experience in working programmatically with .pdf files. I have a .pdf file and I need to crop every page down to a certain size. After a quick Google search I found the pyPdf library for python but my experiments with it failed. When I changed the cropBox and trimBox attributes on a page object the results were not what I had expected and appeared to be quite random. Has anyone had any experience with this? Code examples would be well appreciated, preferably in python.
Is there a better layout language than HTML for printing?
458,353
14
15
6,190
0
python,qt,layout,printing,gpl
There's LaTeX. Not sure if that falls into the "as easy to use as html" category, but it's not hard.
0
0
0
0
2009-01-19T17:05:00.000
10
1
false
458,340
0
0
1
1
I'm using Python and Qt 4.4 and I have to print some pages. Initially I thought I'd use HTML with CSS to produce those pages. But HTML has some limitations. Now the question is: is there anything that's better than HTML but just (or almost) as easy to use? Additionally, it should be GPL-compatible. Edit: kdgregory & Mark G: The most obvious limitation is that I can't specify the printer margins. There is another problem: How do I add page numbers? Jeremy French: One thing I have to print is a list of all the products someone ordered which can spread over a few pages.
Python with Netbeans 6.5
462,107
1
1
263
0
python,netbeans,project
Python support is in beta, and as someone who works with NB for a past 2 years, I can say that even a release versions are buggy and sometimes crashes. Early Ruby support was also very shaky.
0
0
0
0
2009-01-20T16:37:00.000
1
0.197375
false
462,068
0
0
1
1
Can you give me some links or explain how to configure an existing python project onto Netbeans? I'm trying it these days and it continues to crash also code navigation doesn't work well and I've problems with debugging. Surely these problems are related to my low eperience about python and I need support also in trivial things as organizing source folders, imports ecc,, thank you very much. Valerio
Django missing translation of some strings. Any idea why?
463,928
11
9
2,057
0
python,django,internationalization,translation
The fuzzy marker is added to the .po file by makemessages. When you have a new string (with no translations), it looks for similar strings, and includes them as the translation, with the fuzzy marker. This means, this is a crude match, so don't display it to the user, but it could be a good start for the human translator. It isn't a Django behavior, it comes from the gettext facility.
0
0
0
0
2009-01-21T00:38:00.000
2
1
false
463,714
0
0
1
1
I have a medium sized Django project, (running on AppEngine if it makes any difference), and have all the strings living in .po files like they should. I'm seeing strange behavior where certain strings just don't translate. They show up in the .po file when I run make_messages, with the correct file locations marked where my {% trans %} tags are. The translations are in place and look correct compared to other strings on either side of them. But when I display the page in question, about 1/4 of the strings simply don't translate. Digging into the relevant generated .mo file, I don't see either the msgid or the msgstr present. Has anybody seen anything similar to this? Any idea what might be happening? trans tags look correct .po files look correct no errors during compile_messages
unit testing for an application server
465,422
1
3
1,357
0
python,unit-testing,twisted
I think you chose the wrong direction. It's true that the Trial docs is very light. But Trial is base on unittest and only add some stuff to deal with the reactor loop and the asynchronous calls (it's not easy to write tests that deal with deffers). All your tests that are not including deffer/asynchronous call will be exactly like normal unittest. The Trial command is a test runner (a bit like nose), so you don't have to write test suites for your tests. You will save time with it. On top of that, the Trial command can output profiling and coverage information. Just do Trial -h for more info. But in any way the first thing you should ask yourself is which kind of tests do you need the most, unit tests, integration tests or system tests (black-box). It's possible to do all with Trial but it's not necessary allways the best fit.
0
1
0
1
2009-01-21T09:15:00.000
4
0.049958
false
464,543
0
0
1
3
I wrote an application server (using python & twisted) and I want to start writing some tests. But I do not want to use Twisted's Trial due to time constraints and not having time to play with it now. So here is what I have in mind: write a small test client that connects to the app server and makes the necessary requests (the communication protocol is some in-house XML), store in a static way the received XML and then write some tests on those static data using unitest. My question is: Is this a correct approach and if yes, what kind of tests are covered with this approach? Also, using this method has several disadvantages, like: not being able to access the database layer in order to build/rebuild the schema, when will the test client going to connect to the server: per each unit test or before running the test suite?
unit testing for an application server
464,870
1
3
1,357
0
python,unit-testing,twisted
"My question is: Is this a correct approach?" It's what you chose. You made a lot of excuses, so I'm assuming that your pretty well fixed on this course. It's not the best, but you've already listed all your reasons for doing it (and then asked follow-up questions on this specific course of action). "correct" doesn't enter into it anymore, so there's no answer to this question. "what kind of tests are covered with this approach?" They call it "black-box" testing. The application server is a black box that has a few inputs and outputs, and you can't test any of it's internals. It's considered one acceptable form of testing because it tests the bottom-line external interfaces for acceptable behavior. If you have problems, it turns out to be useless for doing diagnostic work. You'll find that you need to also to white-box testing on the internal structures. "not being able to access the database layer in order to build/rebuild the schema," Why not? This is Python. Write a separate tool that imports that layer and does database builds. "when will the test client going to connect to the server: per each unit test or before running the test suite?" Depends on the intent of the test. Depends on your use cases. What happens in the "real world" with your actual intended clients? You'll want to test client-like behavior, making connections the way clients make connections. Also, you'll want to test abnormal behavior, like clients dropping connections or doing things out of order, or unconnected.
0
1
0
1
2009-01-21T09:15:00.000
4
1.2
true
464,543
0
0
1
3
I wrote an application server (using python & twisted) and I want to start writing some tests. But I do not want to use Twisted's Trial due to time constraints and not having time to play with it now. So here is what I have in mind: write a small test client that connects to the app server and makes the necessary requests (the communication protocol is some in-house XML), store in a static way the received XML and then write some tests on those static data using unitest. My question is: Is this a correct approach and if yes, what kind of tests are covered with this approach? Also, using this method has several disadvantages, like: not being able to access the database layer in order to build/rebuild the schema, when will the test client going to connect to the server: per each unit test or before running the test suite?
unit testing for an application server
464,596
0
3
1,357
0
python,unit-testing,twisted
haven't used twisted before, and the twisted/trial documentation isn't stellar from what I just saw, but it'll likely take you 2-3 days to implement correctly the test system you describe above. Now, like I said I have no idea about Trial, but I GUESS you could probably get it working in 1-2 days, since you already have a Twisted application. Now if Trial gives you more coverage in less time, I'd go with Trial. But remember this is just an answer from a very cursory look at the docs
0
1
0
1
2009-01-21T09:15:00.000
4
0
false
464,543
0
0
1
3
I wrote an application server (using python & twisted) and I want to start writing some tests. But I do not want to use Twisted's Trial due to time constraints and not having time to play with it now. So here is what I have in mind: write a small test client that connects to the app server and makes the necessary requests (the communication protocol is some in-house XML), store in a static way the received XML and then write some tests on those static data using unitest. My question is: Is this a correct approach and if yes, what kind of tests are covered with this approach? Also, using this method has several disadvantages, like: not being able to access the database layer in order to build/rebuild the schema, when will the test client going to connect to the server: per each unit test or before running the test suite?
Templates within templates. How to avoid rendering twice?
468,751
2
1
561
0
python,django,django-templates
"This seems wasteful" Why does it seem that way? Every template is a mix of tags and text. In your case some block of text has already been visited by a template engine. So what? Once it's been transformed it's just text and passes through the next template engine very, very quickly. Do you have specific performance problems? Are you not meeting your transaction throughput requirements? Is there a specific problem? Is the code too complex? Is it hard to maintain? Does it break all the time? I think your solution is adequate. I'm not sure template tags in dynamic content is good from a debugging point of view, but from a basic "template rendering" point of view, it is fine.
0
0
0
0
2009-01-22T11:22:00.000
2
1.2
true
468,736
0
0
1
1
I've got a CMS that takes some dynamic content and renders it using a standard template. However I am now using template tags in the dynamic content itself so I have to do a render_to_string and then pass the results of that as a context variable to render_to_response. This seems wasteful. What's a better way to do this?
Using a java library from python
477,533
6
41
60,373
0
java,python,jython
Wrap your Java-Code in a Container (Servlet / EJB). So you don´t loose time in the vm-startup and you go the way to more service-oriented. For the wraping you can use jython (only make sense if you are familiar with python) Choose a communication-protocoll in which python and java can use: json (see www.json.org) rmi (Python: JPype) REST SOAP (only for the brave) Choose something you or your partners are familliar with!
0
0
0
0
2009-01-25T00:41:00.000
6
1
false
476,968
0
0
1
1
I have a python app and java app. The python app generates input for the java app and invokes it on the command line. I'm sure there must be a more elegant solution to this; just like using JNI to invoke C code from Java. Any pointers? (FYI I'm v. new to Python) Clarification (at the cost of a long question: apologies) The py app (which I don't own) takes user input in the form of a number of configuration files. It then interprits these and farms work off to a number of (hidden) tools via a plugin mechanism. I'm looking to add support for the functionality provided by the legacy Java app. So it doesn't make sense to call the python app from the java app and I can't run the py app in a jython environment (on the JVM). Since there is no obvious mechanism for this I think the simple CL invocation is the best solution.
Inventory Control Across Multiple Servers .. Ideas?
487,660
1
0
1,492
0
python,tracking,inventory
One possibility would be to expose a web service interface on your inventory management system that allows the transactions used by the web shopfront to be accessed remotely. With a reasonably secure VPN link or ssh tunnel type arrangement, the web shopfront could get stock levels, place orders or execute searches against the inventory system. Notes: You would still have to add a reasonable security layer to the inventory service in case the web shopfront was compromised. You would have to make sure your inventory management application and server was big enough to handle the load, or could be reasonably easily scaled so it could do so. Your SLA for the inventory application would need to be good enough to support the web shopfront. This probably means some sort of hot failover arrangement.
0
0
0
0
2009-01-28T13:39:00.000
3
1.2
true
487,642
0
0
1
3
We currently have an inventory management system that was built in-house. It works great, and we are constantly innovating it. This past Fall, we began selling products directly on one of our websites via a Shopping Cart checkout. Our inventory management system runs off a server in the office, while the three websites we currently have (only one actually sells things) runs off an outside source, obviously. See my problem here? Basically, I am trying to think of ways I can create a central inventory control system that allows both the internal software and external websites to communicate so that inventory is always up to date and we are not selling something we don't have. Our internal inventory tracking works great and flows well, but I have no idea on how I would implement a solid tracking system that can communicate between the two. The software is all written in Python, but it does not matter as I am mostly looking for ideas and methods on how would this be implemented. Thanks in advance for any answers, and I hope that made sense .. I can elaborate.
Inventory Control Across Multiple Servers .. Ideas?
487,674
0
0
1,492
0
python,tracking,inventory
I don't see the problem... You have an application running on one server that manages your database locally. There's no reason a remote server can't also talk to that database. Of course, if you don't have a database and are instead using a homegrown app to act as some sort of faux-database, I recommend that you refactor to use something sort of actual DB sooner rather than later.
0
0
0
0
2009-01-28T13:39:00.000
3
0
false
487,642
0
0
1
3
We currently have an inventory management system that was built in-house. It works great, and we are constantly innovating it. This past Fall, we began selling products directly on one of our websites via a Shopping Cart checkout. Our inventory management system runs off a server in the office, while the three websites we currently have (only one actually sells things) runs off an outside source, obviously. See my problem here? Basically, I am trying to think of ways I can create a central inventory control system that allows both the internal software and external websites to communicate so that inventory is always up to date and we are not selling something we don't have. Our internal inventory tracking works great and flows well, but I have no idea on how I would implement a solid tracking system that can communicate between the two. The software is all written in Python, but it does not matter as I am mostly looking for ideas and methods on how would this be implemented. Thanks in advance for any answers, and I hope that made sense .. I can elaborate.
Inventory Control Across Multiple Servers .. Ideas?
706,707
0
0
1,492
0
python,tracking,inventory
I'm not sure if there is any one really good solution for your problem. I think the way you are doing it now works fine, but if you don't agree then I don't know what to tell you.
0
0
0
0
2009-01-28T13:39:00.000
3
0
false
487,642
0
0
1
3
We currently have an inventory management system that was built in-house. It works great, and we are constantly innovating it. This past Fall, we began selling products directly on one of our websites via a Shopping Cart checkout. Our inventory management system runs off a server in the office, while the three websites we currently have (only one actually sells things) runs off an outside source, obviously. See my problem here? Basically, I am trying to think of ways I can create a central inventory control system that allows both the internal software and external websites to communicate so that inventory is always up to date and we are not selling something we don't have. Our internal inventory tracking works great and flows well, but I have no idea on how I would implement a solid tracking system that can communicate between the two. The software is all written in Python, but it does not matter as I am mostly looking for ideas and methods on how would this be implemented. Thanks in advance for any answers, and I hope that made sense .. I can elaborate.
How can I order objects according to some attribute of the child in sqlalchemy?
1,227,979
1
3
595
1
python,sqlalchemy
I had the same question as the parent when using the ORM, and GHZ's link contained the answer on how it's possible. In sqlalchemy, assuming BlogPost.comments is a mapped relation to the Comments table, you can't do: session.query(BlogPost).order_by(BlogPost.comments.creationDate.desc()) , but you can do: session.query(BlogPost).join(Comments).order_by(Comments.creationDate.desc())
0
0
0
0
2009-01-29T16:01:00.000
2
0.099668
false
492,223
0
0
1
1
Here is the situation: I have a parent model say BlogPost. It has many Comments. What I want is the list of BlogPosts ordered by the creation date of its' Comments. I.e. the blog post which has the most newest comment should be on top of the list. Is this possible with SQLAlchemy?
Best opensource IDE for building applications on Google App Engine?
498,183
0
15
11,377
0
python,google-app-engine,ide
For my recent GAE project I tried both eclipse with pydev and intellij with its python plugin. I use intellij for my "real" work and so I found it to be the most natural and easy to use, personally. It is not open source, but if you already have a license it is no extra cost. I found the eclipse plugin to be very good as well. You don't get as much intellisense as you would with java, but I was very impressed with what you do get from a dynamically typed language.
0
1
0
0
2009-01-30T14:03:00.000
10
0
false
495,579
0
0
1
5
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Best opensource IDE for building applications on Google App Engine?
497,470
0
15
11,377
0
python,google-app-engine,ide
I've been using gedit and am pretty happy with it, there is a couple of good plugins that make life easier (e.g. Class Browser). I tried eclipse but its just not the same experience you get with Java.
0
1
0
0
2009-01-30T14:03:00.000
10
0
false
495,579
0
0
1
5
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Best opensource IDE for building applications on Google App Engine?
495,783
6
15
11,377
0
python,google-app-engine,ide
Netbeans has some very nice tools for Python development
0
1
0
0
2009-01-30T14:03:00.000
10
1
false
495,579
0
0
1
5
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Best opensource IDE for building applications on Google App Engine?
498,484
6
15
11,377
0
python,google-app-engine,ide
I use pydev on eclipse, and works well for django too!
0
1
0
0
2009-01-30T14:03:00.000
10
1
false
495,579
0
0
1
5
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Best opensource IDE for building applications on Google App Engine?
496,385
2
15
11,377
0
python,google-app-engine,ide
VIM(there's enough plug-ins to make it IDE -like) Komodo IDE($$) Eclipse w/Pydev Net Beans with Python support WingIDE($$) SPE(Stani's Python Editor)
0
1
0
0
2009-01-30T14:03:00.000
10
0.039979
false
495,579
0
0
1
5
Looking to dabble with GAE and python, and I'd like to know what are some of the best tools for this - thanks!
Django Admin app or roll my own?
496,123
17
21
11,322
0
python,django,django-admin
It really depends on the project I guess. While you can do everything in the admin, when your app gets more complex using the admin gets more complex too. And if you want to make your app really easy to manage you want control over every little detail, which is not really possible with the admin app. I guess you should see it like this: Using django admin: save time writing it, lose time using it. Rolling your own admin: lose time writing it, save time using it.
0
0
0
0
2009-01-30T15:22:00.000
7
1.2
true
495,879
0
0
1
5
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Django Admin app or roll my own?
500,093
1
21
11,322
0
python,django,django-admin
I'd recommend enabling the admin site on just about every type of project. The cost of setting it up is pretty low, and it gives you a reasonably convenient mechanism for inspecting and modifying your site. If your site has mostly a one way flow of information, from webmaster to visitors, then the admin site is probably all you need. If, however, your site has a richer interaction among its users, you will need to compose django views that can enable that interaction while also limiting access to what users can really do.
0
0
0
0
2009-01-30T15:22:00.000
7
0.028564
false
495,879
0
0
1
5
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Django Admin app or roll my own?
3,842,185
1
21
11,322
0
python,django,django-admin
I'd go with the Django admin functionality, over writing your own. You can customize the Django admin by adding your own templates for the admin, your own widgets, etc. I'm working on a project with a very customized Django admin. If we had decided to write it by hand, it would have taken 4 times as long to get done. I just can't see a scenario where you would want to write your own.
0
0
0
0
2009-01-30T15:22:00.000
7
0.028564
false
495,879
0
0
1
5
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Django Admin app or roll my own?
498,068
3
21
11,322
0
python,django,django-admin
I found sadly, that the while the django admin app saves a lot of time at first, it becomes a hinderence later on, as your costumer demands more features that are not easily integrated with the default admin interface. You might endup with two kinds of admin tools: the django admin (for apps that require simple data entry), and your custom rolled admin interface for other applications that require a richer interface.
0
0
0
0
2009-01-30T15:22:00.000
7
0.085505
false
495,879
0
0
1
5
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Django Admin app or roll my own?
498,061
17
21
11,322
0
python,django,django-admin
I would use Django's admin app, for a number of reasons. First, writing an administration app may be quite tricky and take some time if you want to do it right, and django.contrib.admin is for free and works out of the box. Second, it is really well designed and very nice to work with (even for non-technical users). Third, it covers a lot of the common cases and it doesn't seem wise to waste time on rewriting it until you are really sure you cannot do otherwise. Fourth, it isn't really so difficult to customize. For example, adding akismet mark-as-spam and mark-as-ham buttons was really a piece of cake.
0
0
0
0
2009-01-30T15:22:00.000
7
1
false
495,879
0
0
1
5
I'm just starting to use Django for a personal project. What are the pros and cons of using the built-in Admin application versus integrating my administrative functions into the app itself (by checking request.user.is_staff)? This is a community wiki because it could be considered a poll.
Is Django a good choice for a security critical application?
499,505
1
22
8,593
0
python,django,security
You should not rely the security of the application on the framework. even though Django does come in with a pretty good number of measures against classical security issues, it can not guarantee that your application will be secure, you need much more than a programming Framework to get a security critical application. I'd say yes, Django is a good choice as long as you know its powers and limitations and are aware of the security flaws of every application.
0
0
0
0
2009-01-31T10:46:00.000
7
0.028564
false
498,630
0
0
1
7
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
498,707
17
22
8,593
0
python,django,security
Probably the reason behind Java is not in the in the security. I think Java is more used in large development companies and banks usually resort to them for their development needs (which probably are not only related to the web site but creep deeper in the backend). So, I see no security reasons, mostly cultural ones.
0
0
0
0
2009-01-31T10:46:00.000
7
1
false
498,630
0
0
1
7
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
498,798
30
22
8,593
0
python,django,security
Actually, the security in Java and Python is the same. Digest-only password handling, cookies that timeout rapidly, careful deletion of sessions, multi-factor authentication. None of this is unique to a Java framework or a Python framework like Django. Django, indeed, has a security backend architecture that allows you to add your own LDAP (or AD) connection, possibly changing the digest technique used. Django has a Profile model where you can keep additional authentication factors. Django offers a few standard decorators for view function authorization checking. Since Python is so flexible, you can trivially write your own decorator functions to layer in different or additional authentication checking. Security is a number of first-class features in Django.
0
0
0
0
2009-01-31T10:46:00.000
7
1.2
true
498,630
0
0
1
7
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
499,599
8
22
8,593
0
python,django,security
The reasons for building banking apps in Java are not related to security, at least IMHO. They are related to: Java is the COBOL of the 21st century, so there is a lot of legacy code that would have to be rewritten and that takes time. Basically banking apps are old apps, they were built in java some ten years ago and nobody wants to throw all the old code away (which BTW is almost always a bad decision), some people believe that a static typed language is somewhat "safer" than the dynamic typed language. This is, IMHO, not true (take for instance collections prior to Java 5).
0
0
0
0
2009-01-31T10:46:00.000
7
1
false
498,630
0
0
1
7
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
499,670
4
22
8,593
0
python,django,security
I find your connection between Java and banking wrong ended. Most Banking Software has terrible security. And much banking software is written in Java. Does ths mean Java makes it more difficult to write secure software than other languages? Probably it's not Java's fault that there is so little quality security (and safety) wise in Banking software. Actually, like the other posters mention, the choice of your Language usually has very little consequences for your security - unless you select one of the few languages where only hotshot coders can write secure code in (C and PHP come to mind). Many huge E-Commerce sites are written in Python, Ruby and Perl using various frameworks. And I would argue that the security requirements for merchants are much higher than the requirements of the banking industry. That is because merchants have to provide security and good user experience, while banking customers are willing to put up with unusable interfaces SecureID tokens and whatever. So yes: Django is up to the task.
0
0
0
0
2009-01-31T10:46:00.000
7
0.113791
false
498,630
0
0
1
7
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?
Is Django a good choice for a security critical application?
499,065
0
22
8,593
0
python,django,security
Are you referring to the fact that the complete application is built in Java, or just the part you see in your browser? If the latter, the reason is probably because in the context of webpages, Java applets can be downloaded and run.
0
0
0
0
2009-01-31T10:46:00.000
7
0
false
498,630
0
0
1
7
Is Django a good choice for a security critical application? I am asking this because most of the online banking software is built using Java. Is there any real reason for this?