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
Old desktop programmer wants to create S+S project
2,428,452
0
1
174
1
php,python,ruby-on-rails,programming-languages,saas
If you want a 'desktop component' that is available for you to do development on whenever your internet is out, you could really choose any of those technologies. You can always have a local server (like apache) running on your machine, as well as a local sql database, though if your database contains a large amount of data you may need to scale it down. Ruby on Rails may be the easiest for you to get started with, though, since it comes packaged with WEBrick (a ruby library that provides HTTP services), and SQLite, a lightweight SQL database management system. Ruby on Rails is configured by default to use these.
0
0
0
0
2010-03-11T19:38:00.000
3
0
false
2,428,077
0
0
1
3
I have an idea for a product that I want to be web-based. But because I live in a part of the world where the internet is not always available, there needs to be a client desktop component that is available for when the internet is down. Also, I have been a SQL programmer, a desktop application programmer using dBase, VB and Pascal, and I have created simple websites using HTML and website creation tools, such as Frontpage. So from my research, I think I have the following options; PHP, Ruby on Rails, Python or .NET for the programming side. MySQL for the DB. And Apache, or possibly IIS, for the webserver. I will probably start with a local ISP provider for the cloud servce. But then maybe move to something more "robust" and universal in the future, ie. Amazon, or Azure, or something along that line. My question then is this. What would you recommend for something like this? I'm sure that I have not listed all of the possibilities, but the ones I have researched and thought of. Thanks everyone, Craig
Issues running python scripts in Command Prompt (Specifically with command line arguments)?
2,437,395
4
4
1,347
0
python,scripting,command-prompt
Check assoc and ftype. If properly set, you can run a .py with arguments. > assoc .py .py=Python.File > ftype Python.File Python.File="C:\Python26\python.exe" "%1" %* Depending on how your Python was installed, these may or may not be in place. You can set them with assoc and ftype. > assoc .py=Python.File > ftype Python.File="C:\Python26\python.exe" "%1" %* Also, if .py is included in the PATHEXT environment variable, you can run .py files without the trailing .py. > set PATHEXT=%PATHEXT%;.py > django-admin startproject helloworld
0
0
0
0
2010-03-13T03:31:00.000
2
0.379949
false
2,437,167
0
0
1
2
I am trying to run my python scripts in the command-prompt without calling python.exe first. I am specifically doing this in relation to running django-admin.py. I have C:\Python26 and C:\Python26\Scripts in my PATH. However, if I try running django-admin.py by doing: django-admin.py startproject helloworld I get the message: Type 'django-admin.py help' for usage. Now, after some experimentation, I realized the problem is that the secondary arguments to these scripts are not being passed for some reason, since I tried it with a some other python scripts I have. I know I could avoid this problem by simply doing: python C:\Python26\Scripts\django-admin.py startproject helloworld But I know it should be possible to run the first command only and get it to work, because I had it working before. I've looked everywhere, and not many places have been helpful so any idea would be useful for me at this point. Update: The .py file associations were set correctly, and the problem is still occuring.
Issues running python scripts in Command Prompt (Specifically with command line arguments)?
4,603,488
1
4
1,347
0
python,scripting,command-prompt
I know this is an old thread, but I have searched for a few weeks for this very same problem and found nothing. Today, however, I tried something new: If you are using Windows 7, do not use Command Prompt for scripting purposes. Instead, use the Windows PowerShell located at: All Programs -> Accessories -> Windows PowerShell -> Windows PowerShell. In there you can run the command django-admin.py startproject mysite if you added the correct paths to your environmental paths. BTW, I'm now using Python 2.7 with Django 1.2.4 on Windows 7 Ultimate 32bit.
0
0
0
0
2010-03-13T03:31:00.000
2
0.099668
false
2,437,167
0
0
1
2
I am trying to run my python scripts in the command-prompt without calling python.exe first. I am specifically doing this in relation to running django-admin.py. I have C:\Python26 and C:\Python26\Scripts in my PATH. However, if I try running django-admin.py by doing: django-admin.py startproject helloworld I get the message: Type 'django-admin.py help' for usage. Now, after some experimentation, I realized the problem is that the secondary arguments to these scripts are not being passed for some reason, since I tried it with a some other python scripts I have. I know I could avoid this problem by simply doing: python C:\Python26\Scripts\django-admin.py startproject helloworld But I know it should be possible to run the first command only and get it to work, because I had it working before. I've looked everywhere, and not many places have been helpful so any idea would be useful for me at this point. Update: The .py file associations were set correctly, and the problem is still occuring.
Django migrations--is it possible to use South in the middle of the project?
2,445,802
4
5
561
0
python,mysql,database,django,django-south
Yes. I think it is not too late. I've moved to south in a middle of a project and I am happy with that choice. I think it is a big help for deployment. The initialization of the south app can be done at any moment.
0
0
0
0
2010-03-15T08:07:00.000
3
1.2
true
2,445,761
0
0
1
1
I already started a project, and the models are all synced and everything.
Programming in Python vs. programming in Java
2,495,504
1
34
7,368
0
java,python
Try to find algorithms that you understand well and see how they are implemented in python standard libraries. Persist. :)
0
0
0
0
2010-03-15T12:45:00.000
13
0.015383
false
2,447,118
1
0
1
4
I've been writing Java for the last couple of years , and now I've started to write in python (in addition). The problem is that when I look at my Python code it looks like someone tried to hammer Java code into a python format , and it comes out crappy because - well , python ain't Java. Any tips on how to escape this pattern of "Writing Java in Python"? Thanks!
Programming in Python vs. programming in Java
2,447,141
0
34
7,368
0
java,python
Learn a few other languages. It will help you make the difference between algorithms (the structure of processing, unchanged between languages) and the local syntaxic features of the language. Then you can "write Foo in Bar" for any combination of languages "Foo" and "Bar".
0
0
0
0
2010-03-15T12:45:00.000
13
0
false
2,447,118
1
0
1
4
I've been writing Java for the last couple of years , and now I've started to write in python (in addition). The problem is that when I look at my Python code it looks like someone tried to hammer Java code into a python format , and it comes out crappy because - well , python ain't Java. Any tips on how to escape this pattern of "Writing Java in Python"? Thanks!
Programming in Python vs. programming in Java
2,495,445
0
34
7,368
0
java,python
Eat Python, Sleep Python and Drink Python. That is the only way........
0
0
0
0
2010-03-15T12:45:00.000
13
0
false
2,447,118
1
0
1
4
I've been writing Java for the last couple of years , and now I've started to write in python (in addition). The problem is that when I look at my Python code it looks like someone tried to hammer Java code into a python format , and it comes out crappy because - well , python ain't Java. Any tips on how to escape this pattern of "Writing Java in Python"? Thanks!
Programming in Python vs. programming in Java
2,448,287
3
34
7,368
0
java,python
Definitely not a panacea but I think you should try some code golf in Python. Obviously nobody should write "golfed" code IRL, but finding the most terse way to express something really forces you to exploit the built in functionality of the language.
0
0
0
0
2010-03-15T12:45:00.000
13
0.046121
false
2,447,118
1
0
1
4
I've been writing Java for the last couple of years , and now I've started to write in python (in addition). The problem is that when I look at my Python code it looks like someone tried to hammer Java code into a python format , and it comes out crappy because - well , python ain't Java. Any tips on how to escape this pattern of "Writing Java in Python"? Thanks!
How to customize pickle for django model objects
2,448,188
0
4
2,714
0
python,django,pickle
You can overload the serialization methods. But it would be simpler to put the id and class in a tuple or dict and pickle that.
0
0
0
0
2010-03-15T14:58:00.000
2
0
false
2,448,035
0
0
1
2
My app uses a "per-user session" to allow multiple sessions from the same user to share state. It operates very similarly to the django session by pickling objects. I need to pickle a complex object that refers to django model objects. The standard pickling process stores a denormalized object in the pickle. So if the object changes on the database between pickling and unpickling, the model is now out of date. (I know this is true with in-memory objects too, but the pickling is a convenient time to address it.) Clearly it would be cleaner to store this complex in the database, but it's not practical. The code for it is necessarily changing rapidly as the project evolves. Having to update the database schema every time the object's data model changes would slow the project down a lot. So what I'd like is a way to not pickle the full django model object. Instead just store its class and id, and re-fetch the contents from the database on load. Can I specify a custom pickle method for this class? I'm happy to write a wrapper class around the django model to handle the lazy fetching from db, if there's a way to do the pickling.
How to customize pickle for django model objects
2,448,369
1
4
2,714
0
python,django,pickle
It's unclear what your goal is. "But if I just store the id and class in a tuple then I'm necessarily going back to the database every time I use any of the django objects. I'd like to be able to keep the ones I'm using in memory over the course of a page request." This doesn't make sense, since a view function is a page request and you have local variables in your view function that keep your objects around until you're finished. Further, Django's ORM bas a cache. Finally, the Django-supplied session is the usual place for "in-memory objects" between requests. You shouldn't need to pickle anything.
0
0
0
0
2010-03-15T14:58:00.000
2
1.2
true
2,448,035
0
0
1
2
My app uses a "per-user session" to allow multiple sessions from the same user to share state. It operates very similarly to the django session by pickling objects. I need to pickle a complex object that refers to django model objects. The standard pickling process stores a denormalized object in the pickle. So if the object changes on the database between pickling and unpickling, the model is now out of date. (I know this is true with in-memory objects too, but the pickling is a convenient time to address it.) Clearly it would be cleaner to store this complex in the database, but it's not practical. The code for it is necessarily changing rapidly as the project evolves. Having to update the database schema every time the object's data model changes would slow the project down a lot. So what I'd like is a way to not pickle the full django model object. Instead just store its class and id, and re-fetch the contents from the database on load. Can I specify a custom pickle method for this class? I'm happy to write a wrapper class around the django model to handle the lazy fetching from db, if there's a way to do the pickling.
Python Image Library, Close method
2,449,251
0
0
773
0
python,django,python-imaging-library
Ah, if i only open the orginal image once and create the thumbnail after resizing then the problem is solved
0
0
0
0
2010-03-15T17:28:00.000
1
1.2
true
2,449,115
0
0
1
1
I have been using pil for the first time today. And I wanted to resize an image assuming it was larger than 800x600 and also create a thumbnail. I could do either of these tasks separately but not together in one method (I am doing a custom save method in django admin). This returns a "cannot identify image file" error message. The error is on the line "image = Image.open(self.photo)" after "#if image is size is greatet than 800 x 600 then resize image." I thought this may be because the image is already open, but if i remove the line I still get issues. So I thought I could try closing after creating a thumbnail and then reopening. But I couldn't find a close method....
How to create a custom admin configuration panel in Django?
2,455,815
0
2
4,970
0
python,django,panel,admin
The automatically generated administration area created by Django is for data maintenance. It provides forms to edit data in your models. If it doesn't "handle this feature", then it sounds like your "configuration panel" (configuration panel should let me choose some basic options like highlighting some news, setting a showcase banner, and so on) does not have any data model. If you define a model with basic options like highlighting some news, setting a showcase banner, and so on then the Django admin will update rows in the model. You can then use the model data to configure your application. If -- for some reason -- you don't want to put this in the database, then there will never be an automatically generated administration area created by Django.
0
0
0
0
2010-03-16T14:13:00.000
3
0
false
2,455,018
0
0
1
1
I would like to create a configuration panel for the homepage of the web-app I'm designing with Django. This configuration panel should let me choose some basic options like highlighting some news, setting a showcase banner, and so on. Basically I don't need an app with different rows, but just a panel page with some configuration options. The automatically generated administration area created by Django doesn't seem to handle this feature as far as I can see, so I'm asking you for some directions. Any hint is highly appreciated. Thank you in advance. Matteo
Checkboxes with pylons
2,457,303
0
1
1,306
0
python,pylons
I'm assuming that "I can only get the first value" means you've got a series of checkboxes with the same value for the 'name' attribute within your form? Now, if that's the case and you're wanting a list of boolean values based on whether or not the boxes are checked or not, you'll need to do two things: First, when you define your form elements using form encode on your checkbox, set it up such that a missing value on a checkbox element returns 'False.' This way, as the browser won't send a value over unless a checkbox is "on", you validation coerces the missing value to False. class Registration(formencode.Schema): box = formencode.validators.StringBoolean(if_missing=False) Next, assuming you want a list returned, you'll not be able to name all of your elements the same. Pylons supports a nested structure, though. Look at formencode.variabledecode.NestedVariables. In short, you'll need to define a NestedVariables instance as one of your class attributes and your form 'name' attributes will need to change in order to contain explicit indexes. Edit.. here's a complete example I did real quick: import logging import pprint import formencode from pylons import request, response, session, tmpl_context as c, url from pylons.controllers.util import abort, redirect from pylons.decorators import validate from testproj.lib.base import BaseController, render log = logging.getLogger(__name__) class CheckList(formencode.Schema): box = formencode.validators.StringBoolean(if_missing=False) hidden = formencode.validators.String() class EnclosingForm(formencode.Schema): pre_validators = [formencode.NestedVariables()] boxes = formencode.ForEach(CheckList()) class MyformController(BaseController): def index(self): schema = EnclosingForm() v = schema.to_python(dict(request.params)) # Return a rendered template #return render('/myform.mako') # or, return a response response.content_type = 'text/plain' return pprint.pformat(v) And then the query string? boxes-0.box=true&boxes-0.hidden=hidden&boxes-1.box=true& boxes-1.hidden=hidden&boxes-2.hidden=hidden And lastly, the response: {'boxes': [{'box': True, 'hidden': u'hidden'}, {'box': True, 'hidden': u'hidden'}, {'box': False, 'hidden': u'hidden'}]} HTH
1
0
0
0
2010-03-16T18:11:00.000
1
0
false
2,456,926
0
0
1
1
I have been trying to add some check boxes in a pylons mako. However I don't know how to get their values in the controller. It seems that it can only get the first value of the check boxes. I tried using form encode but i got several errors. Is there an easier way to do this? Thanks
Giving users a "reputation system" - Should I...?
2,458,468
6
8
550
0
python,django,web-applications
In Django, I'd suggest having a property on the User (or Profile) model that calculates a user's reputation on-demand. Then, cache the reputation with your caching framework and/or store to the database for fast retrieval. This way, in addition to having the records of what impacts reputation, you can change your reputation criteria at will.
0
0
0
0
2010-03-16T21:39:00.000
2
1
false
2,458,355
0
0
1
2
I'm thinking of adding a reputation system to my Django web application; the site is already being used so I'm trying to be careful about my choices. Reputation is generated in all actions that contribute to the site, similar to Stackoverflow's system. I know there are literally millions of ways of implementing this, and this is why I feel quite lost. Two alternatives I am not sure about are: Keep track of reasons why reputation was incremented Ignore reasons in order to reduce complexity of the site and overhead Would be happy with a few pointers, and directions. Would be very much appreciated!
Giving users a "reputation system" - Should I...?
2,458,375
4
8
550
0
python,django,web-applications
keep track of the reasons, IMHO. It surely wouldn't be that complex, and you don't need to store a huge amount of information, just a datetime, point value, command, target, and originator. If the data gets to be too much after some time dump the DB to a backup medium and clear the history.
0
0
0
0
2010-03-16T21:39:00.000
2
0.379949
false
2,458,355
0
0
1
2
I'm thinking of adding a reputation system to my Django web application; the site is already being used so I'm trying to be careful about my choices. Reputation is generated in all actions that contribute to the site, similar to Stackoverflow's system. I know there are literally millions of ways of implementing this, and this is why I feel quite lost. Two alternatives I am not sure about are: Keep track of reasons why reputation was incremented Ignore reasons in order to reduce complexity of the site and overhead Would be happy with a few pointers, and directions. Would be very much appreciated!
web2py or grok (zope) on a big portal,
9,985,357
1
3
1,388
1
python,zope,web2py,zodb,grok
Zope and the ZODB have been used with big applications, but I'd still consider linking Zope with MySQL or something like that for serious large-scale applications. Even though Zope has had a lot of development cycles, it is usually used with another database engine for good reason. As far as I know, the argument applies doubly for web2py.
0
0
0
0
2010-03-17T02:26:00.000
3
0.066568
false
2,459,549
0
0
1
2
I am planning to make some big project (1 000 000 users, approximately 500 request pre second - in hot time). For performance I'm going to use no relational dbms (each request could cost lot of instructions in relational dbms like mysql) - so i can't use DAL. My question is: how web2py is working with a big traffic, is it work concurrently? I'm consider to use web2py or Gork - Zope, How is working zodb(Z Object Database) with a lot of data? Is there some comparison with object-relational postgresql? Could you advice me please.
web2py or grok (zope) on a big portal,
2,459,620
7
3
1,388
1
python,zope,web2py,zodb,grok
First, don't assume that a data abstraction layer will have unacceptable performance, until you actually see it in practice. It is pretty easy to switch to RAW sql if and when you run into a problem. Second, most users who worry about there server technology handling a million users never finish their applications. Pick whatever technology you think will enable you to build the best application in the shortest time. Any technology can be scaled, at the very least, through clustering.
0
0
0
0
2010-03-17T02:26:00.000
3
1
false
2,459,549
0
0
1
2
I am planning to make some big project (1 000 000 users, approximately 500 request pre second - in hot time). For performance I'm going to use no relational dbms (each request could cost lot of instructions in relational dbms like mysql) - so i can't use DAL. My question is: how web2py is working with a big traffic, is it work concurrently? I'm consider to use web2py or Gork - Zope, How is working zodb(Z Object Database) with a lot of data? Is there some comparison with object-relational postgresql? Could you advice me please.
django: search forms and redirect
2,461,426
3
0
726
0
python,django,redirect,search-form
Search queries should probably be GETs, rather than POSTs, because they are not changing anything - they are simply passing parameters to get certain information. POST should be reserved for forms that actually change things in the database, or result in a specific action (eg submitting an email). To reply to your comment, hiding parameters from URLs is not particularly good practice, but if you really think you need to, this is an instance where it's OK not to redirect after the form submission - again, because you're not affecting anything with the POST.
0
0
0
0
2010-03-17T10:15:00.000
1
1.2
true
2,461,364
0
0
1
1
After processing form from POST I should redirect, to prevent user from hitting back. However, I am using form to determine search query on a database, so I need to either pass params to the redirected site or the result of a search. Or maybe there is some other good practice, how to solve this problem? Maybe in this situation I am allowed not to redirect (nothing happens, if user performs search again).
Running a python script in background from a CGI
2,462,349
2
1
1,221
0
python,cgi,backgroundworker
well, short answer: you can't. medium answer: CGI sucks. long answer: CGI works by running your script and returning whatever your script prints to the browser. If your script is still running, the browser will be waiting. If your script launches a background job and returns data to the browser, then the background job can't notify the CGI script because it is already done. You must choose an alternate solution. Save the results of the background job to a file, database, or some other persistent storage, and make the user request that data, using another link in your page, which runs a different code that retrieves the saved results and display them. Another way is to use AJAX techniques in the browser. Write javascript code to do the request to the data in the background. So the browser can still be responsive with other page elements while the script is running.
0
0
0
1
2010-03-17T11:59:00.000
1
0.379949
false
2,461,964
0
0
1
1
I have a python CGI which runs some script in the background and shows the stdout in the html page. I run the script when the user clicks some button in the page. My problem is when the script starts running the page becomes busy and the user can't use the other client side features in the page. What I want is: The script should run in background when the user clicks the button and should notify the CGI when run is complete. Then the CGI show should the stdout of the script run. How can this be done?
Call macro from Python script?
2,466,236
0
1
334
0
python,zope
Maybe you could create a new template including (use-macro) just the macros you want to access from python and then use z3c.pt.pagetemplate.PageTemplateFile() to render it? Actually, it might be possible (and certainly easier) to use chameleon.zpt.template.PageTemplate('<div tal:use-macro="<your-macro-here>" />'), but I've never did this myself.
0
0
0
1
2010-03-17T17:32:00.000
2
1.2
true
2,464,442
0
0
1
2
One of our page templates is made up of a bunch of macros. These items are a bunch of html tables. Now, I want a couple of these tables in a Python script to create a PDF. Is there a way call a macro from a Python script and get back the HTML that is produced? If so, can you explain? Thanks Eric
Call macro from Python script?
2,464,507
0
1
334
0
python,zope
I'd probably use urllib.urlopen(url), pull the data from the page back to python and use BeautifulSoup to pull the table(s) out of the HTML... And then render that to PDF with XHTML2PDF (pisa.ho). There might be a simpler way but for me, this would be the least stressful approach.
0
0
0
1
2010-03-17T17:32:00.000
2
0
false
2,464,442
0
0
1
2
One of our page templates is made up of a bunch of macros. These items are a bunch of html tables. Now, I want a couple of these tables in a Python script to create a PDF. Is there a way call a macro from a Python script and get back the HTML that is produced? If so, can you explain? Thanks Eric
Artificial Intelligence in online game using Google App Engine
2,471,015
2
1
1,026
0
python,google-app-engine,artificial-intelligence
If the game is turn based then it would probably be best to avoid the Cron task and just update the NPCs every time the player moves. I'm not sure how big of a map you are planning on but you may consider even having the player object find the NPCs that are close to it and call their AI routine. That way NPCs that are out of range of a player wouldn't move at all which may save on resources. Not sure if that matter though.
0
1
0
0
2010-03-17T18:59:00.000
3
0.132549
false
2,465,056
0
0
1
3
I am currently in the planning stages of a game for google app engine, but cannot wrap my head around how I am going to handle AI. I intend to have persistant NPCs that will move about the map, but short of writing a program that generates the same XML requests I use to control player actions, than run it on another server I am stuck on how to do it. I have looked at the Task Queue feature, but due to long running processes not being an option on the App engine, I am a little stuck. I intend to run multiple server instances with 200+ persistant NPC entities that I will need to update. Most action is slowly roaming around based on player movements/concentrations, and attacking close range players...(you can probably guess the type of game im developing)
Artificial Intelligence in online game using Google App Engine
2,471,126
2
1
1,026
0
python,google-app-engine,artificial-intelligence
Bear in mind that you can also break up your updates into multiple requests (internally): do a bit of work, redirect to the same handler but different state; do more work; etc. (I'm failing somehow to comment on Peter Recore's answer, which is where this really belongs.) I see that the free service only allows 100k task queue calls/day, so 1 task/NPC would probably use up your resources way too fast. Cron job to do some work/create task queues to update NPCs in appropriately-sized groups? Anyway, just some thoughts; good luck.
0
1
0
0
2010-03-17T18:59:00.000
3
0.132549
false
2,465,056
0
0
1
3
I am currently in the planning stages of a game for google app engine, but cannot wrap my head around how I am going to handle AI. I intend to have persistant NPCs that will move about the map, but short of writing a program that generates the same XML requests I use to control player actions, than run it on another server I am stuck on how to do it. I have looked at the Task Queue feature, but due to long running processes not being an option on the App engine, I am a little stuck. I intend to run multiple server instances with 200+ persistant NPC entities that I will need to update. Most action is slowly roaming around based on player movements/concentrations, and attacking close range players...(you can probably guess the type of game im developing)
Artificial Intelligence in online game using Google App Engine
2,465,142
3
1
1,026
0
python,google-app-engine,artificial-intelligence
Will your game be turn based or real time? Either way, I think you have 2 options to look into. One is to use the Cron feature so you can schedule NPC updates at regular intervals, the other is to stick a "update NPCs" task into the Task Queue every time a human player moves.
0
1
0
0
2010-03-17T18:59:00.000
3
1.2
true
2,465,056
0
0
1
3
I am currently in the planning stages of a game for google app engine, but cannot wrap my head around how I am going to handle AI. I intend to have persistant NPCs that will move about the map, but short of writing a program that generates the same XML requests I use to control player actions, than run it on another server I am stuck on how to do it. I have looked at the Task Queue feature, but due to long running processes not being an option on the App engine, I am a little stuck. I intend to run multiple server instances with 200+ persistant NPC entities that I will need to update. Most action is slowly roaming around based on player movements/concentrations, and attacking close range players...(you can probably guess the type of game im developing)
C/C++ for Core Logic Development of a Web Application?
2,468,907
0
2
390
0
c++,python,c
I don't think you should use a compiled language (at least not c++) for web programming. I thought about doing this once too but remember that for any change you'll have to compile etc. Facebook uses php and it's hip hop application changes php into c++. Maybe you should take a look at that. Of course c++ (or any compiled language) will be faster than an interpreted language, but you also have to take in account the development time of the web site/app. Hope this helps :)
0
0
0
1
2010-03-18T06:03:00.000
3
0
false
2,467,807
0
0
1
1
Can C/C++ be choice of keeping all your logic (business/domain) for web application? Why? I've two resources (cousins) having knowledge on C/C++ and me also good in C/C++, Python, HTML, CSS and JavaScript. We like to utilize our free time to work on our some good ideas we developed together. The ideas require knowledge of web application development. And I'm the only one who has it. Is there a way they developed the core in C/C++ and I do the rest of scripting for front-end development? Thanks.
Bad auto completion with python on pydev?
5,761,144
0
5
1,825
0
python,pydev
Well, as you didn't say what 'garbage' is showing, it's a bit hard to guess, but I believe you mean the __hash__, __str__, etc from the object class (is that it?) If that's the case, this has been dealt in the current nightly build (the '_' methods will still appear, but with lower priority, so, the methods you're probably more interested in are at the top)
0
0
0
1
2010-03-18T13:31:00.000
3
0
false
2,470,121
0
0
1
1
I began learning and loving python about a month ago. Dive into python, django and now Tornado is the path i followed during this time. I chose pydev as an IDE since it seems to be the most up to date and i wanted to come back to eclipse since i'm using Netbeans for php and Java. My question is the following: When i write classes in php or java i declare my methods and properties. I instantiate them somewhere else and use them. The autocompletion works great for java and php but with python, it seems to be always suggesting me a bunch of garbage and never the real object's methods from the class i instantiated. Is it the same for you ? Is it a limitation from pydev ? Am i doing something wrong ? Thank you in advance for pointing me in a direction. Matthieu.
A debugger for IronPython
12,800,514
1
2
337
0
debugging,ironpython
I love Eclipse. I learned it over several years while developing JAVA, and as soon as I found out there was a PyDev plug in that was enough for me. I would recommend seeing if there is a plugin for what ever IDE you are most comfortable with.
0
0
0
0
2010-03-21T14:29:00.000
3
0.066568
false
2,487,410
1
0
1
1
Is there a good debugger for IronPython?
Djangobb problem
2,488,505
2
4
1,302
0
python,django,mod-python
There are two obvious reasons to why this might happen: djangobb_forum is not on your Python path There is no __init__.py in the djangobb_forum folder If the code says from djangobb_forum import ... then you need to have the parent folder of djangobb_forum on your Python path.
0
0
0
0
2010-03-21T18:17:00.000
1
0.379949
false
2,488,142
0
0
1
1
I've installed Djangobb app on my server (Debian, mod_python) by cloning original source. The only things I've changed is database options in settings.py. All needed components are installed - syncdb query was executed right. But, when I'm trying to enter on my forum, it returns me error: ImproperlyConfigured: Error importing middleware django_authopenid.middleware: "No module named djangobb_forum.subscription" I've checked - djangobb_forum/subscription.py exist, so I don't know what can be wrong. Maybe someone had problems like that and know how to fix it? Sorry for my english.
django admin - adding fields on the fly
2,488,729
1
2
515
0
python,django,django-admin,shopping-cart,django-nonrel
Sounds like you want two related models - Item and Option. Item would contain the name of the item, and Option would contain the option - eg size - and the price of that option. You would then set up your admin to use an inline form for Option.
0
0
0
0
2010-03-21T21:04:00.000
3
0.066568
false
2,488,710
0
0
1
1
Basically I am writing a simple shopping cart. Each item can have multiple prices. (i.e. shirts where each size is priced differently). I would like to have a single price field in my admin panel, where when the first price is entered, an additional price field pops up. However I am kind of at a loss as to how to do this. What would be the best way to do this?
Tricky model inheritance - Django
2,489,866
2
14
2,669
0
python,django,inheritance,django-models,django-orm
I agree about the roles solution, as depicted by Alex. What you have is not different subclasses of persons. You have different roles a person can have. But I hear you say: "hey, the ninja can have a property "numberOfStars", while a singer can have a property "highestNote". Same as for the interface: a ninja can have the method throwStar() and disappear(), while a singer can have sing() and getWasted(), and the bass player can have goFunky() and slapPop() What you have here is a case where your data model needs a very loose schema. So loose that, in fact, you have no schema at all. If the singer decides to take the bass and improvise a tune, that's fine. If he wants to act as a ninja, and you call throwStar, it will return an error, because he has no stars, but you could in principle, assign stars to a singer and make him throw stars. What you are venturing in is the world of ontologies, rather than schemas. You have a resource, which is "something" and this something can be some type, have some properties, etc. Presence of some properties can infer the type, or presence of some type can infer other types. You cannot describe this information easily with the simple django data model. What you would need is a context-aware, inferenced graph store, such as AllegroGraph, or implement your hacked up solution using rdflib.
0
0
0
0
2010-03-22T02:01:00.000
4
0.099668
false
2,489,620
0
0
1
2
I think this is a bit tricky, at least for me. :) So I have 4 models Person, Singer, Bassist and Ninja. Singer, Bassist and Ninja inherit from Person. The problem is that each Person can be any of its subclasses. e.g. A person can be a Singer and a Ninja. Another Person can be a Bassist and a Ninja. Another one can be all three. How should I organise my models? Help would be much appreciated!
Tricky model inheritance - Django
16,554,051
1
14
2,669
0
python,django,inheritance,django-models,django-orm
You could make all your professions (Ninja, Bassist....) inherit from Person in the models, and then use the function isinstance in the backend code to distinguish between the professions of a Person.
0
0
0
0
2010-03-22T02:01:00.000
4
0.049958
false
2,489,620
0
0
1
2
I think this is a bit tricky, at least for me. :) So I have 4 models Person, Singer, Bassist and Ninja. Singer, Bassist and Ninja inherit from Person. The problem is that each Person can be any of its subclasses. e.g. A person can be a Singer and a Ninja. Another Person can be a Bassist and a Ninja. Another one can be all three. How should I organise my models? Help would be much appreciated!
Performance Wise, Python VS JAVA For File Based Processing
2,490,299
0
1
1,498
0
java,python,file-io
Performance-wise, for an I/O - syscall bound task such as you're mentioning, it's going to be a wash, most likely, depending a bit on the platform. Java tends to have better CPU usage (partly because a JVM can effectively use multiple cores on a multicore CPU on different threads, with CPython having problems with that; partly because of strong JIT abilities), but typically pays for them with higher RAM footprints (no big deal if you have 64GB of RAM laying around and not much else to do on the machine, say, but often an issue in other circumstances). If you specify the platform (Linux vs Windows vs ...), we might be able to offer more help. Edit: with processing required as light as the OP's mentioned in the Q's edit, there's really nothing either way in the CPU-load part of the task. Unfortunately I don't know what freebsd offers for "directory watching" (like Linux's inotify, etc).
0
1
0
1
2010-03-22T06:07:00.000
1
1.2
true
2,490,291
0
0
1
1
I need to create daemon that will monitor certain directory and will process every file that's written to that particular path. My choice is either java or python. Did you guys have any experience using both technology? what is the best one? EDIT 1: files that will be processed is simple text file (one line with tab separated fields). I just need to move it to buffer and send to further to my php file. EDIT 2: It's for freebsd server
Use URL Fetch of Google App Engine just to call a php script
2,491,775
0
1
658
0
python,google-app-engine
Why not rewrite what your php script does in python? Php is a awful scripting language, and considering your thinking about calling it from inside a very powerful language, why not do it all in python
0
1
0
0
2010-03-22T07:36:00.000
3
0
false
2,490,592
0
0
1
1
I wanto call a PHP script using Google App Engine. I just want to execute the script. The script updates a couple of databases on my webhost. But I guess Google App waits for the response. Is there a way by which I can start the script. The script takes some time and Google App might die during that time.
GAE, Python 2.5, Python 2.6 Side-by-side on windows
2,492,830
0
2
470
0
python,django,google-app-engine
Re virtualenv question above: virtualenv have a parameter --python=PYTHON_EXE that you can point to the interpreter you'd like it to use. Running virtualenv without parameters or with an --help option whill show you which options you may pass it.
0
1
0
0
2010-03-22T10:08:00.000
3
0
false
2,491,280
0
0
1
2
On my development system, I have Python 2.6, Django 1.1 and GAE. I have three projects running on Python 2.6 and Django 1.1. I have 1 project using GAE, Python 2.6 and Django 1.1. I have heard that my set-up for running GAE using Python 2.6 may create some head-scratching problems while deploying it on the production server, because GAE supports only Python 2.5, and using 2.6 is not recommended. Can I develop GAE application using Python 2.6? If not, what should I do? I am using Windows Vista as my development system. Please note : I don't want to disturb my other projects in development, which uses Python 2.6 and Django 1.1.
GAE, Python 2.5, Python 2.6 Side-by-side on windows
2,491,639
0
2
470
0
python,django,google-app-engine
Unless you are using python 2.6 specific syntax/code your application is safe to run on GAE.
0
1
0
0
2010-03-22T10:08:00.000
3
0
false
2,491,280
0
0
1
2
On my development system, I have Python 2.6, Django 1.1 and GAE. I have three projects running on Python 2.6 and Django 1.1. I have 1 project using GAE, Python 2.6 and Django 1.1. I have heard that my set-up for running GAE using Python 2.6 may create some head-scratching problems while deploying it on the production server, because GAE supports only Python 2.5, and using 2.6 is not recommended. Can I develop GAE application using Python 2.6? If not, what should I do? I am using Windows Vista as my development system. Please note : I don't want to disturb my other projects in development, which uses Python 2.6 and Django 1.1.
Python XML + Java XML interoperability
2,492,599
1
2
475
0
java,python,xml,marshalling,interop
As Ignacio says, XML is XML. On the python side, I recommend using lxml, unless you have more specific needs that are better met by another library. If you are restricted to the standard library, look at ElementTree or cElementTree, which are also excellent, and which inspired (and are functionally mostly equivalent to) lxml.etree. Edit: On closer look, it seems you are not just looking for XML, but for XML representations of objects. For this, check out lxml.objectify, or Amara. I haven't tried using them for interoperability with Java, but they're worth a try. If you're just looking for a way to do data exchange, you might also try custom JSON objects.
0
0
1
0
2010-03-22T13:23:00.000
2
1.2
true
2,492,490
0
0
1
1
I need a recommendation for a pythonic library that can marshall python objects to XML(let it be a file). I need to be able read that XML later on with Java (JAXB) and unmarshall it. I know JAXB has some issues that makes it not play nice with .NET XML libraries so a recommendation on something that actually works would be great.
Python or Ruby for webbased Artificial Intelligence?
2,497,026
7
4
3,942
0
python,ruby-on-rails,artificial-intelligence,prolog
The selection of language is completely irrelevant, all other things being equal. If you're trying to do X and there's a library for it in language Y and meshes well with your Web-based framework, then use it. Without knowing more about what specific areas of AI you're interested in, the question is far too vague to be answered with any more specificity.
0
0
0
1
2010-03-22T20:09:00.000
5
1
false
2,495,350
0
0
1
2
A new web application may require adding Artificial Intelligence (AI) in the future, e.g. using ProLog. I know it can be done from a Java environment, but I am wondering about the opportunities with modern web languages like Ruby or Python. The latter is considered to be "more scientific" (at least used in that environment), but using Google there seems to be a preliminary ProLog implementation for both. Any suggestions on modern (open source) web languages (like Python or Ruby) in combination with AI?
Python or Ruby for webbased Artificial Intelligence?
2,498,323
0
4
3,942
0
python,ruby-on-rails,artificial-intelligence,prolog
You could also use Scala (which is a bit functional and runs on the JVW) and the existing Lift framework for web-stuff.
0
0
0
1
2010-03-22T20:09:00.000
5
0
false
2,495,350
0
0
1
2
A new web application may require adding Artificial Intelligence (AI) in the future, e.g. using ProLog. I know it can be done from a Java environment, but I am wondering about the opportunities with modern web languages like Ruby or Python. The latter is considered to be "more scientific" (at least used in that environment), but using Google there seems to be a preliminary ProLog implementation for both. Any suggestions on modern (open source) web languages (like Python or Ruby) in combination with AI?
Keeping track of changes - Django
2,504,441
1
6
1,579
0
python,django,django-models
Quoth my elementary chemistry teacher: "If you don't write it down, it didn't happen", therefore save logs in a file. Since the log information is disjoint from your application data (it's meta-data, actually), keep them separate. You could log to a database table but it should be distinct from your model. Text pickle data is difficult for humans to read, binary pickle data even more so; log in an easily parsed format and the data can be imported into analysis software easily.
0
0
0
0
2010-03-23T23:27:00.000
3
0.066568
false
2,504,386
0
0
1
1
I have various models of which I would like to keep track and collect statistical data. The problem is how to store the changes throughout time. I thought of various alternative: Storing a log in a TextField, open it and update it every time the model is saved. Alternatively pickle a list and store it in a TextField. Save logs on hard drive. What are your suggestions?
What is the Simplest Possible Payment Gateway to Implement? (using Django)
17,987,815
1
18
23,610
0
python,django,payment-gateway,payment-processing
Consider enabling more than one payment gateways. If you add only one, and this gateway fails for some reason you'll start losing money (actually happened to one of the persons I know).
0
0
0
0
2010-03-24T03:05:00.000
5
0.039979
false
2,505,072
0
0
1
2
I'm developing a web application that will require users to either make one time deposits of money into their account, or allow users to sign up for recurring billing each month for a certain amount of money. I've been looking at various payment gateways, but most (if not all) of them seem complex and difficult to get working. I also see no real active Django projects which offer simple views for making payments. Ideally, I'd like to use something like Amazon FPS, so that I can see online transaction logs, refund money, etc., but I'm open to other things. I just want the EASIEST possible payment gateway to integrate with my site. I'm not looking for anything fancy, whatever does the job, and requires < 10 hours to get working from start to finish would be perfect. I'll give answer points to whoever can point out a good one. Thanks! EDIT: This is to accept payments in the US only. I don't need an international payment gateway. And it only needs to support US English.
What is the Simplest Possible Payment Gateway to Implement? (using Django)
2,505,692
2
18
23,610
0
python,django,payment-gateway,payment-processing
I've done successful integrations for both Google Checkout and PayPal ExpressCheckout in Django. Both services have stable, well-developed APIs, and neither one was too difficult to implement. There are good Python libraries already written to do the heavy lifting for you, too.
0
0
0
0
2010-03-24T03:05:00.000
5
0.07983
false
2,505,072
0
0
1
2
I'm developing a web application that will require users to either make one time deposits of money into their account, or allow users to sign up for recurring billing each month for a certain amount of money. I've been looking at various payment gateways, but most (if not all) of them seem complex and difficult to get working. I also see no real active Django projects which offer simple views for making payments. Ideally, I'd like to use something like Amazon FPS, so that I can see online transaction logs, refund money, etc., but I'm open to other things. I just want the EASIEST possible payment gateway to integrate with my site. I'm not looking for anything fancy, whatever does the job, and requires < 10 hours to get working from start to finish would be perfect. I'll give answer points to whoever can point out a good one. Thanks! EDIT: This is to accept payments in the US only. I don't need an international payment gateway. And it only needs to support US English.
Web framework for an application utilizing existing database?
2,512,975
0
1
1,525
1
java,php,python,ruby
There are no clear cut winners when picking a web framework. Each platform you mentioned has its benefits and drawbacks (cost of hardware, professional support, community support, etc.). Depending on your time table, project requirements, and available hardware resources you are probably going to need some different answers.Personally, I would start your investigation with a platform where you and your team are most experienced. Like many of the other posters I can only speak to what I'm actively using now, and in my case it is Java. If Java seems to match your projects requirements, you probably want to go with one of the newer frameworks with an active community. Currently Spring Web MVC, Struts2, and Stripes seem to be fairly popular. These frameworks are mostly, if not totally, independent of the persistence layer, but all integrate well with technologies like hibernate and jpa; although you have to do most, if not all, of the wiring yourself. If you want to take the Java road there are also pre-built application stacks that take care of most of wiring issues for you. For an example you might want to look at Matt Raible's AppFuse. He has built an extensible starter application with many permutations of popular java technologies. If you are interested in the JVM as a platform, you may also want to look at complete stack solutions like Grails, or tools that help you build your stack quickly like Spring Roo. Almost all of the full stack solutions I've seen allow for integration with a legacy database schema. As long as your database is well designed, you should be able to map your tables. The mention of composite keys kind of scares me, but depending on your persistence technology this may or may not be an issue. Hibernate in Java/.NET supports mapping to composite keys, as does GORM in grails (built on hibernate). In almost all cases these mappings are discouraged, but people who build persistence frameworks know you can't always scorch earth and completely recreate your model.
0
0
0
0
2010-03-24T12:11:00.000
8
0
false
2,507,463
0
0
1
2
A legacy web application written using PHP and utilizing MySql database needs to be rewritten completely. However, the existing database structure must not be changed at all. I'm looking for suggestions on which framework would be most suitable for this task? Language candidates are Python, PHP, Ruby and Java. According to many sources it might be challenging to utilize rails effectively with existing database. Also I have not found a way to automatically generate models out of the database. With Django it's very easy to generate models automatically. However I'd appreciate first hand experience on its suitability to work with legacy DBs. The database in question contains all kinds of primary keys, including lots of composite keys. Also I appreciate suggestions of other frameworks worth considering.
Web framework for an application utilizing existing database?
2,507,492
2
1
1,525
1
java,php,python,ruby
I have very good experience with Django. Every time I needed it was up to the task for interfacing with existing database. Autogenerated models are the start, as MySQL is not the strictest with its schema. Not that it will not work only that usually some of the db restrictions are held in app itself.
0
0
0
0
2010-03-24T12:11:00.000
8
0.049958
false
2,507,463
0
0
1
2
A legacy web application written using PHP and utilizing MySql database needs to be rewritten completely. However, the existing database structure must not be changed at all. I'm looking for suggestions on which framework would be most suitable for this task? Language candidates are Python, PHP, Ruby and Java. According to many sources it might be challenging to utilize rails effectively with existing database. Also I have not found a way to automatically generate models out of the database. With Django it's very easy to generate models automatically. However I'd appreciate first hand experience on its suitability to work with legacy DBs. The database in question contains all kinds of primary keys, including lots of composite keys. Also I appreciate suggestions of other frameworks worth considering.
webapp, tipfy or django on google app engine
2,512,079
1
10
2,218
0
python,django,google-app-engine,web-applications,tipfy
I'm still investigating, but I think webapp and tipfy will be a lighter framework than django. Right now, I am using just webapp and the cold start times are already too long. I want to use tipfy for sessions and keep everything else in webapp. What are you trying to optimize for? Speed of development? Easy of programming? Obscure middleware?
0
1
0
0
2010-03-24T19:45:00.000
6
0.033321
false
2,510,903
0
0
1
3
which one are you using on google app engine? what were the reasons behind your decision?
webapp, tipfy or django on google app engine
3,184,831
1
10
2,218
0
python,django,google-app-engine,web-applications,tipfy
I would still prefer Django for its structure and a high support available over internet for it and for the following reasons: Webapp offcourse is light weight, but Django comes with a nice structure which saves a lots of time while working on a large application. Google app engine does provide a good document for working with Webapp but Django has a large community of programmers and thus proves to be a better choice for implementing some complex applications. Django provides a default admin panel, which otherwise would need to be created in Webapp, though Google app provides an admin interface but that is not equivalent of a full fledged customizable admin panel. Webapp itself follows Django for its templates.
0
1
0
0
2010-03-24T19:45:00.000
6
0.033321
false
2,510,903
0
0
1
3
which one are you using on google app engine? what were the reasons behind your decision?
webapp, tipfy or django on google app engine
3,304,317
4
10
2,218
0
python,django,google-app-engine,web-applications,tipfy
Imho.. Django - the only part that's relevant is the templating and maybe the no rel.. Webapp - never tried it after Tipfy - is what I'm using, seems to be more "pylons" like, has a basic apps/modules structure and lots of "helpers" which quite frankly should be in the google.appengine.api Easy to implement templates and routing is nice. Your pretty much left on your own on how to use tipfy and how to structure the application.
0
1
0
0
2010-03-24T19:45:00.000
6
0.132549
false
2,510,903
0
0
1
3
which one are you using on google app engine? what were the reasons behind your decision?
Idiots guide to app engine and memcache
2,514,663
3
2
2,620
0
python,google-app-engine,memcached
If you cache a query, is there an accepted method for ensuring that the cache is cleared/updated when an object stored in that query is updated. Typically you wrap your reads with a conditional to retrieve the value from the main DB if it's not in the cache. Just wrap your updates as well to fill the cache whenever you write the data. That's if you need the results to be as up to date as possible - if you're not so bothered about it being out of date just set an expiry time that is low enough for the application to have to re-request the data from the main DB often enough.
0
1
0
0
2010-03-25T01:20:00.000
3
0.197375
false
2,512,571
0
0
1
2
I am struggling to find a good tutorial or best practices document for the use of memcache in app engine. I'm pretty happy with it on the level presented in the docs. Get an object by ID, checking memcache first, but I'm unclear on things like: If you cache a query, is there an accepted method for ensuring that the cache is cleared/updated when an object stored in that query is updated. What are the effects of using ReferenceProperties ? If a cache a Foo object with a Bar reference. Is my foo.bar in memcache too and in need of clearing down if it gets updated from some other part of my application. I don't expect answers to this here (unless you are feeling particularly generous!), but pointers to things I could read would be very gratefully received.
Idiots guide to app engine and memcache
5,571,331
0
2
2,620
0
python,google-app-engine,memcached
About reference properties, let's say you have MainModel and RefModel with a reference property 'ref' that points to a MainModel instance. Whenever you cal ref_model.ref it does a datastore get operation and retrieves the object from datastore. It does not interact with memcache in any way.
0
1
0
0
2010-03-25T01:20:00.000
3
0
false
2,512,571
0
0
1
2
I am struggling to find a good tutorial or best practices document for the use of memcache in app engine. I'm pretty happy with it on the level presented in the docs. Get an object by ID, checking memcache first, but I'm unclear on things like: If you cache a query, is there an accepted method for ensuring that the cache is cleared/updated when an object stored in that query is updated. What are the effects of using ReferenceProperties ? If a cache a Foo object with a Bar reference. Is my foo.bar in memcache too and in need of clearing down if it gets updated from some other part of my application. I don't expect answers to this here (unless you are feeling particularly generous!), but pointers to things I could read would be very gratefully received.
Django OpenID django-openid-auth Login Error
2,520,867
1
0
577
0
python,django,openid
Are you supplying an email address or URL? OpenID needs a URL and *******@gmail.com is an email address.
0
0
0
0
2010-03-25T23:22:00.000
1
1.2
true
2,520,144
0
0
1
1
I get the following error when attempting to use django-openid-auth OpenID discovery error: No usable OpenID services found for *******@gmail.com I have followed the instructions that come with it, though it seems there is something I am missing. the installation is on my localhost.
Is it possible to detect the browser version from Django server side?
2,522,807
2
1
948
0
python,django
request.env['HTTP_USER_AGENT'] will give the user agent string the browser sent.
0
0
0
0
2010-03-26T11:16:00.000
3
0.132549
false
2,522,774
0
0
1
2
in server side, not browser.
Is it possible to detect the browser version from Django server side?
2,588,289
1
1
948
0
python,django
Unfortunately request.env won't work. However, you can get it through request.META.get("HTTP_USER_AGENT")
0
0
0
0
2010-03-26T11:16:00.000
3
1.2
true
2,522,774
0
0
1
2
in server side, not browser.
Error handling with Python + Pylons
2,526,649
1
3
698
0
python,error-handling,pylons
I use formencode @validate decorator. It is possible to write custom validator for it but the problem with handling exceptions that occur in the model after validation still exists. You could write custom action decorator similar to formencode one which will handle your model exceptions and populate c.form_errors.
0
0
0
0
2010-03-26T20:17:00.000
3
0.066568
false
2,526,458
0
0
1
1
What is the proper way to handle errors with Python + Pylons? Say a user sets a password via a form that, when passed to a model class via the controller, throws an error because it's too short. How should that error be handled so that an error message gets displayed on the web page rather than the entire script terminating to an error page? Should there be any error handling in the controller itself? I hope I am explaining myself clearly. Thank you.
I need a simple command line program to transform XML using an XSL Stylesheet
2,541,765
0
15
23,093
0
java,python,xml,macos,xslt
I have used Saxon 6.5 for years for command line transformations. (Java, XSLT 1) An excellent fallback if a native solution is not available.
0
1
0
0
2010-03-26T20:55:00.000
8
0
false
2,526,681
0
0
1
1
I am on OSX Snow Leopard (10.6.2) I can install anything I need to. I would preferably like a Python or Java solution. I have searched on Google and found lots of information on writing my own program to do this, but this is a just a quick and dirty experiment so I don't want to invest a lot of time on writing a bunch of code to do this, I am sure someone else has done this already. This is off-topic now, do not use this question as an example of why your recommendations request is on topic, it is not. I apologize, but my Google-Foo was failing me the day I asked this 4 years ago!
Standardizing a Release/Tools group on a specific language
2,529,182
-1
4
196
0
python,perl,groovy
First, it's important to note that it is very hard to convince someone they're wrong. He's advocating bash scripts and Perl, due to their universality and simplicity Bash scripts are not simple. The bash programming model is really complex and unfriendly. if statements and expressions, in particular are horrifying. Perl may or may not be simple. Bash is universal. Perl, however, is exactly as universal as Python. Python is pre-installed in almost all Linux distributions. So that argument is specious. The "universality" of bash, Perl and python is exactly the same. The "simplicity", however, is not the same. You won't find it easy to to "prove" or "convince" anyone of this once they've already pronounced Perl as simple. The Situation. If the boss is advocating Perl, and Perl is not the answer, you will find it is very hard to convince someone they're wrong, making this effort nearly impossible. If the boss was just throwing out ideas, then this is just difficult. Quick Hack. An easy thing you can do is to attempt head-to-head comparisons of Python and Perl for some randomly-chosen jobs. You can then have a code walkthrough to demonstrate the relative opacity of Perl compared with the relative clarity of Python. Even this is fraught with terrible dangers. Some folks really think code golf is important. Python loses at code golf. Perl wins. There's nothing worse than "Angry Co-worker with Perl Bias" who will kill you with code-golf solutions that -- because they're smaller -- can baffle management into thinking that they're clearer or "better" on some arbitrary scale. Some folks really think explicit is "wordy" and bad. Python often loses because the assumptions are stated as actual parameter values. Some folks can (and do) complain at having to actually write things down. Read Stack Overflow for all of the Python questions where someone wants to make the try: block go away in a puff of assumptions. If you choose random problems, you may -- accidentally -- chose something for which there's an existing piece of Perl or Python that can be downloaded and installed. A language can win just through an accident of the draw. Rather than a more in-depth comparison of language features. Best Bet The best you can do is the following. Identify what folks value. You can call these "non-functional" requirements. These are quality factors. What are the foundational, core principles? Open, Accessible, Transferrable Skills, Simplicity, Cleanliness, Honesty, Integrity, Thriftiness, Reverence, Patience, Hard Work, A Sense of Perspective, Reef the Main in Winds over 20 kn, etc. This is hard. No sympathy here. Identify the technical use cases. These are "functional" requirements. Which bits of glue and integration there are? This is hard, also. Requirements erupt of out of the woodwork when you do this. Also, when you have a Perl bigot on the team, numerous non-functional requirements will pile into this area. Your manager -- who proposed Perl -- may be the Perl bigot, and the use cases may be difficult to collect in the presence of a Perl bigot. Identify how (a) Perl + Bash vs. (b) Python vs. (c) Java fit this core values and the functional requirements. Note that using Python means you do not need to use Bash as much. My preference, BTW, is to pare Bash down to the rock-bottom minimum. This is a big, difficult job. It's hard to short-cut. If you find that Perl is not the answer and the Perl bigot you need to convince is the manager who proposed Perl in the first place, you may find that convincing someone that they're wrong is very hard. Edit. I am aware that I am forbidden from using the string "Perl Bigot" to describe the manager's potential level of bias toward Perl. I, however, insist on using "Perl Bigot" to describe the manager who proposed Perl. The question provides no information on which to change this. The worst case is that (a) the manager is the Perl Bigot and (b) Perl is not the answer.
0
0
0
1
2010-03-27T02:10:00.000
4
-0.049958
false
2,527,867
0
0
1
2
I'm part of a six-member build and release team for an embedded software company. We also support a lot of developer tools, such as Atlassian's Fisheye, Jira, etc., Perforce, Bugzilla, AnthillPro, and a couple of homebrew tools (like my Django release notes generator). Most of the time, our team just writes little plugins for larger apps (ex: customize workflows in Anthill), long-term utility scripts (package up a release for QA), or things like Perforce triggers (don't let people check into a specific branch unless their change description includes a bug number; authenticate against Active Directory instead of Perforce's internal passwords). That's about the scale of our problems, although we sometimes tackle something slightly more sizable. My boss, who is reasonably technical, has asked us to standardize on one or two languages so we can more easily substitute for each other. He's advocating bash scripts and Perl, due to their universality and simplicity. I can see his point--we mostly do "glue", so why not use "glue" languages rather than saddle ourselves with something designed for much larger projects? Since some of the tools we work with are Java-based, we do need to use something that speaks JVM sometimes. (The path of least resistance for these projects is BeanShell and Groovy.) I feel a tremendous itch toward language advocacy, but I'm trying to avoid saying "We should use Python 'cause I like it and Perl is gross." Instead, I'm trying to come up with a good approach to defining our problem set: what problems do we solve with scripts? Would we benefit from a library of common functions by our team, or are most of our projects more isolated? What is it reasonable to expect my co-workers to learn? What languages give us the most ease of development and ease of modification? Can you folks suggest some useful ways to approach this problem, both for my own thinking process and to help me facilitate some brainstorming among my coworkers?
Standardizing a Release/Tools group on a specific language
2,527,917
4
4
196
0
python,perl,groovy
Google standardized on Python for such tasks (and many more) a bit before I joined the company; as far as I know, huge advantages such as Python's great implementations on the JVM and .NET didn't even play a role in the decision -- it was all about readability. At the time (and to some extent, even now) the theory at Google was that every engineer must be able, at need, to tweak every part of the codebase -- including of course build scripts, spiders (which were in Python at the time), and so forth. Demanding of engineers already proficient in C++ and Java to learn many more "scripting" languages (Python, Perl, Bash, Awk, Sed, and so forth) was simply unconsciounable: one had to be selected. Given that constraint, Python was the clear choice (under other constraints, Perl might also have been -- but I can't see the inevitable mix of Bash, Awk and Sed ever competing on such grounds!_) -- and that's how I ended up working there, a bit later;-). Given that the overall potential of Python vs Ruby vs Perl vs PHP vs Bash + Awk + Sed vs ... is roughly equal, picking one is clearly a winner -- and Python has clean readability, strong implementations on JVM and .NET as big vigorishes. Seriously, I can only think of Javascript (inevitable for client-side work, now rich with strong implementations such as V8) as a possible "competitor" (unfortunately, JS inevitably carries on a lot of baggage for backwards compatibility -- unless you can use a use strict;-like constraint to help on that, it must be an important downside).
0
0
0
1
2010-03-27T02:10:00.000
4
0.197375
false
2,527,867
0
0
1
2
I'm part of a six-member build and release team for an embedded software company. We also support a lot of developer tools, such as Atlassian's Fisheye, Jira, etc., Perforce, Bugzilla, AnthillPro, and a couple of homebrew tools (like my Django release notes generator). Most of the time, our team just writes little plugins for larger apps (ex: customize workflows in Anthill), long-term utility scripts (package up a release for QA), or things like Perforce triggers (don't let people check into a specific branch unless their change description includes a bug number; authenticate against Active Directory instead of Perforce's internal passwords). That's about the scale of our problems, although we sometimes tackle something slightly more sizable. My boss, who is reasonably technical, has asked us to standardize on one or two languages so we can more easily substitute for each other. He's advocating bash scripts and Perl, due to their universality and simplicity. I can see his point--we mostly do "glue", so why not use "glue" languages rather than saddle ourselves with something designed for much larger projects? Since some of the tools we work with are Java-based, we do need to use something that speaks JVM sometimes. (The path of least resistance for these projects is BeanShell and Groovy.) I feel a tremendous itch toward language advocacy, but I'm trying to avoid saying "We should use Python 'cause I like it and Perl is gross." Instead, I'm trying to come up with a good approach to defining our problem set: what problems do we solve with scripts? Would we benefit from a library of common functions by our team, or are most of our projects more isolated? What is it reasonable to expect my co-workers to learn? What languages give us the most ease of development and ease of modification? Can you folks suggest some useful ways to approach this problem, both for my own thinking process and to help me facilitate some brainstorming among my coworkers?
How to change db in django depending on request.get_host()?
5,369,262
0
2
466
0
python,django,django-middleware,django-orm
You can set up one site for each "site", with it's own settings file, listening to it's own socket, using the same codebase. I'm doing that and I can easily support more than 30 concurrent sites on a middle-size server. Maintainability of configurations and startup scripts is the only issue.
0
0
0
0
2010-03-28T08:05:00.000
2
0
false
2,532,268
0
0
1
2
I am creating multisites platform. Anybody can make simple site, with my platform. I plan to use django multidb support. One db for one site. And i need to change db settings depending on request.get_host(). I think that i's not good idea. Prompt other decisions? How it is realised on various designers of sites?
How to change db in django depending on request.get_host()?
2,534,950
1
2
466
0
python,django,django-middleware,django-orm
You might want to reconsider using a separate db for reach site. In reviewing the multi-db source, it looks like you'll run into a few scalability issues, depending on how many sites you want to support: Currently all the databases are set up in settings.py. This could cause a few issues: Each new site would require reloading Django. settings.py could get large. A better approach might to use a single DB and associate the site/account with each record as needed.
0
0
0
0
2010-03-28T08:05:00.000
2
0.099668
false
2,532,268
0
0
1
2
I am creating multisites platform. Anybody can make simple site, with my platform. I plan to use django multidb support. One db for one site. And i need to change db settings depending on request.get_host(). I think that i's not good idea. Prompt other decisions? How it is realised on various designers of sites?
Using Django CMS
30,400,944
2
0
1,502
0
python,django,content-management-system
I would say no. Django CMS is well designed, if you change content frequently. It has nice features to build up a page. But that means it only shows its benefits, when you create a lot pages/subpages and so on. For a simple website that only presents data, without adding new pages/views, Django will suffice. And from my experience, you should at lest be familiar with Views and URLs in order to use Django CMS well. But the same applies to Django itself. Everything else can be found on google. Hope that helps.
0
0
0
0
2010-03-28T12:19:00.000
2
0.197375
false
2,532,840
0
0
1
1
I know python and have just read a basic intro of django. I have to built something like a travel website with real time updates. Will django be sufficent for this? Somebody advised me to look at django-CMS, I couldn't find a very beginner's tutorial there. Should I opt for django-CMS? Also how much of django should i know before i can try out django-cms? Edit: Not too much real time stuff but just updates on the fly, like availibilty etc. Do i really need CMS? Thanks
Accessing php $_SESSION from python (wsgi) - is it possible?
2,534,567
1
8
5,062
0
php,python,session,wsgi
Depends on the PHP app, if it's keeping session data in a database (MySQL maybe) you can just connect to the database and get the data, if it's using native PHP sessions you should look to the session.save_path config setting in php.ini, that's the place where the runtime saves files with the session data. Once you have the data you can parse it to get it unserialized, take a look at how serialize() and unserialize() work in PHP.
0
0
0
1
2010-03-28T20:55:00.000
3
0.066568
false
2,534,525
0
0
1
2
I've got a python/WSGI app which needs to check to see if a user has logged on to a PHP web app. The problem is that the PHP app checks if a user has logged on by comparing a value in the $_SESSION variable to a value in the cookie from the user's browser. I would prefer to avoid changing the behavior of the php app if at all possible. My questions: Is there anyway I can access the session variables from within python? Where should I start to look? Are there any obvious security/performance issues I should be aware of when taking this approach?
Accessing php $_SESSION from python (wsgi) - is it possible?
2,534,558
4
8
5,062
0
php,python,session,wsgi
yep. session (in default) is a regular file. so all what you need is look over session directory and find file with name of session cookie value. then - you have to implement php-like serialize/unserialize and do whatever you want. nope
0
0
0
1
2010-03-28T20:55:00.000
3
0.26052
false
2,534,525
0
0
1
2
I've got a python/WSGI app which needs to check to see if a user has logged on to a PHP web app. The problem is that the PHP app checks if a user has logged on by comparing a value in the $_SESSION variable to a value in the cookie from the user's browser. I would prefer to avoid changing the behavior of the php app if at all possible. My questions: Is there anyway I can access the session variables from within python? Where should I start to look? Are there any obvious security/performance issues I should be aware of when taking this approach?
Thread Synchronization in Django
24,900,469
0
5
5,313
0
python,django,synchronized
Great article Justin, just one thing using python 2.5 makes this way easier In Python 2.5 and later, you can also use the with statement. When used with a lock, this statement automatically acquires the lock before entering the block, and releases it when leaving the block: from future import with_statement # 2.5 only with lock: ... access shared resource
0
0
0
0
2010-03-28T23:05:00.000
4
0
false
2,534,943
0
0
1
1
Is there any way to block a critical area like with Java synchronized in Django?
Pylons: View latest debug message
2,536,493
0
0
90
0
python,debugging,pylons
(On the off-chance that this helps...) Ubuntu's default Terminal program auto-detects URLs. When my pylons programs burp, I just ctrl-click on the link in the console.
0
0
0
0
2010-03-29T07:56:00.000
1
1.2
true
2,536,468
0
0
1
1
Is there a way to view the latest debug message instead of having to copy and paste something like "_debug/view/1269848287" to the browser everytime?
Tornado or Django works with CGI?
3,244,176
5
2
1,611
0
python,django,cgi,webserver,tornado
Main feature of Tornado is that it is high performance web-server written in Python, for creating web applications using Python programming language. Running Tornado as CGI application negates the very reason it exists, because running CGI scripts is expensive in terms of performance, and most probably there is no way to run Tornado as CGI script.
0
1
0
0
2010-03-29T10:02:00.000
2
0.462117
false
2,537,065
0
0
1
1
Tornado is a webserver + framework like Django but for real-time features. On my server I don't have a python module or wsgi module so I thought CGI. Is there a way to get Tornado ( or Django ) works by using CGI folder ? If yes, Could you explain me how do I do that ?
Logging users out of a Django site after N minutes of inactivity
2,539,518
4
28
17,914
0
python,django,authentication
Setting the session cookie age in the django session middleware just sets the expiry time in the set-cookie header passed back to the browser. It's only browser compliance with the expiry time that enforces the "log out". Depending on your reasons for needing the idle log-out, you might not consider browser compliance with the expiry time good enough. In which case you'll need to extend the session middleware to do so. For example you might store an expiry time in your session engine which you update with requests. Depending on the nature of traffic to your site, you may wish to only write back to the session object once in X seconds to avoid excessive db writes.
0
0
0
0
2010-03-29T15:24:00.000
3
0.26052
false
2,539,109
0
0
1
1
I'm working on a website that requires us to log a user out after N minutes of inactivity. Are there any best practices for this using Django?
Access to content of Lotus Notes database without Lotus Notes software installed
2,542,163
3
0
3,704
0
python,lotus-notes,lotus
The short answer is, unfortunately you will need the Notes client installed. There are a few ways to access data from an NSF such as NotesSQL, COM, C/C++, but all rely on the Lotus C API at the core, and you'll need a notes client and a notes ID file to gain access via that API.
0
0
0
0
2010-03-29T22:34:00.000
3
0.197375
false
2,541,702
0
0
1
3
I am looking for a programatic way to access content in a Lotus Notes database (.nsf file) without having Lotus Notes software installed. Python would be preferred but I'm also willing to look at other languages e.g. C/C++ or other means e.g. SQL From what I have read, all of the methods e.g. Python COM access, pyodbc rely on having Lotus Notes server software installed. The problem I am trying to solve is to read the content and look for references (URL's back to a web site that is undergoing maintenance and the addresses in the web site will change) As a start, I want to get a list of references and hope to be able to replace them with the new references to the modified web site. Any ideas on how best to do this welcome :)
Access to content of Lotus Notes database without Lotus Notes software installed
2,551,002
0
0
3,704
0
python,lotus-notes,lotus
Like Ken says, inevitably there has to be a server in the mix. If you're searching for specific text in a Notes / Domino application, and looking to replace it, there's a tool out there which does this: Teamstudio Configurator. Configurator also has an API (written in Lotusscript, which is very like old-skool VB) so you can code a solution pretty quickly. I've done the exact same thing you're doing with an old Domino-based website, using this API. Not the answer you're looking for I guess, but always good to have choices!
0
0
0
0
2010-03-29T22:34:00.000
3
0
false
2,541,702
0
0
1
3
I am looking for a programatic way to access content in a Lotus Notes database (.nsf file) without having Lotus Notes software installed. Python would be preferred but I'm also willing to look at other languages e.g. C/C++ or other means e.g. SQL From what I have read, all of the methods e.g. Python COM access, pyodbc rely on having Lotus Notes server software installed. The problem I am trying to solve is to read the content and look for references (URL's back to a web site that is undergoing maintenance and the addresses in the web site will change) As a start, I want to get a list of references and hope to be able to replace them with the new references to the modified web site. Any ideas on how best to do this welcome :)
Access to content of Lotus Notes database without Lotus Notes software installed
2,607,921
1
0
3,704
0
python,lotus-notes,lotus
If this is a one-time need, you may be able to find sites that will do some simple Domino/Notes hosting for free. If you could put the NSF up to a service like that, you could then use Domino URL's (REST) to extract the data and search for links, etc.
0
0
0
0
2010-03-29T22:34:00.000
3
0.066568
false
2,541,702
0
0
1
3
I am looking for a programatic way to access content in a Lotus Notes database (.nsf file) without having Lotus Notes software installed. Python would be preferred but I'm also willing to look at other languages e.g. C/C++ or other means e.g. SQL From what I have read, all of the methods e.g. Python COM access, pyodbc rely on having Lotus Notes server software installed. The problem I am trying to solve is to read the content and look for references (URL's back to a web site that is undergoing maintenance and the addresses in the web site will change) As a start, I want to get a list of references and hope to be able to replace them with the new references to the modified web site. Any ideas on how best to do this welcome :)
Most secure way to generate a random session ID for a cookie?
2,542,128
4
6
13,882
0
python,cookies,session,security
If the only information in the cookie is an identifier, essentially a label, the only attack you're trying to protect from is an attacker guessing what it is. So use some random bytes. Enough random bytes that it's "unguessable." Then squish the random bytes into something that fits within the confines of which characters you can use in a HTTP cookie. base64 works for this. It's not absolutely optimal, because there are more than 64 cookie-safe characters and it tends to leave trailing == characters which add bytes to the header but not randomness, but that's fine. It works and Python can probably do the base64 encoding faster than anything else we can come up with. If you also want to prepend the user ID to it, that will make things easier to trace and debug, which will probably make your life easier, so go ahead. It doesn't give an attacker any significant advantage. (unless they manage to steal one without being able to otherwise determine what user they're stealing from, which seems unlikely.)
0
0
0
0
2010-03-29T22:42:00.000
8
1.2
true
2,541,742
0
0
1
2
I'm writing my own sessions controller that issues a unique id to a user once logged in, and then verifies and authenticates that unique id at every page load. What is the most secure way to generate such an id? Should the unique id be completely random? Is there any downside to including the user id as part of the unique id?
Most secure way to generate a random session ID for a cookie?
29,989,100
0
6
13,882
0
python,cookies,session,security
I would avoid the random factor completely. What I've generally done is: Generate a sequential session_id (which I store locally). When the user logs in, sign session_id with a private key (I use itsdangerous for this). When I get a request, if the session_id's signature is intact, I proceed, otherwise, 403 (400 would make sense too). Note that I store the session_id locally because I want to be able to expire end sessions prematurely. If your sessions always last a fixed amount of time, and you don't need to end them prematurely, you can simply sign user_id + datetime.now(). This allows completely stateless session management.
0
0
0
0
2010-03-29T22:42:00.000
8
0
false
2,541,742
0
0
1
2
I'm writing my own sessions controller that issues a unique id to a user once logged in, and then verifies and authenticates that unique id at every page load. What is the most secure way to generate such an id? Should the unique id be completely random? Is there any downside to including the user id as part of the unique id?
No matter what I do, django-admin.py is not found, even though it's in my path
2,542,702
5
3
6,085
0
python,django
The python interpreter does not look everywhere on your path to find the script. It does look everywhere for imports, but not for scripts. Try typing django-admin.py, just django-admin.py and not python django-admin.py, and it should work. Windows should find it on the path, then execute it as a python script. OK, If Windows doesn't run Python scripts (i.e. you have set your editor as the default python app), try: python -m django-admin or maybe python -m django-admin.py. The -m argument uses module mode, which checks the path.
0
0
0
0
2010-03-30T03:20:00.000
5
0.197375
false
2,542,674
0
0
1
4
I have added C:\Python26\Lib\site-packages\django\bin to my path, I have started a new cmd session in Windows 7, but when I try to do 'python django-admin.py ...' it says there is no file django-admin.py. When I type path, there is the full path to ...\django\bin. This is driving me nuts. Clearly it's there, but it's not working. Any suggestions?
No matter what I do, django-admin.py is not found, even though it's in my path
2,543,312
4
3
6,085
0
python,django
python -mdjango-admin looks like what you're looking for. -m tells Python to find a module on sys.path and run that module as "the main script" -- which seems exactly your goal!
0
0
0
0
2010-03-30T03:20:00.000
5
0.158649
false
2,542,674
0
0
1
4
I have added C:\Python26\Lib\site-packages\django\bin to my path, I have started a new cmd session in Windows 7, but when I try to do 'python django-admin.py ...' it says there is no file django-admin.py. When I type path, there is the full path to ...\django\bin. This is driving me nuts. Clearly it's there, but it's not working. Any suggestions?
No matter what I do, django-admin.py is not found, even though it's in my path
14,559,937
5
3
6,085
0
python,django
I realize this is old, but came across the same issue. On Windows, your path should include the following: C:\Python27\;C:\Python27\Scripts This is assuming python 2.7.3 is installed and django 1.4.3
0
0
0
0
2010-03-30T03:20:00.000
5
0.197375
false
2,542,674
0
0
1
4
I have added C:\Python26\Lib\site-packages\django\bin to my path, I have started a new cmd session in Windows 7, but when I try to do 'python django-admin.py ...' it says there is no file django-admin.py. When I type path, there is the full path to ...\django\bin. This is driving me nuts. Clearly it's there, but it's not working. Any suggestions?
No matter what I do, django-admin.py is not found, even though it's in my path
2,718,527
0
3
6,085
0
python,django
I had the same problem, and python -mdjango-admin works. but i had to define PYTHONHOME & PYTHONPATH first
0
0
0
0
2010-03-30T03:20:00.000
5
0
false
2,542,674
0
0
1
4
I have added C:\Python26\Lib\site-packages\django\bin to my path, I have started a new cmd session in Windows 7, but when I try to do 'python django-admin.py ...' it says there is no file django-admin.py. When I type path, there is the full path to ...\django\bin. This is driving me nuts. Clearly it's there, but it's not working. Any suggestions?
Pylons: Set global variable for Authkit user
2,543,332
1
0
360
0
python,pylons,authkit
There is no single "logged-in user" if you're serving requests on multiple threads -- by setting a single global variable the threads would trample upon each other and end up very very confused on who "the logged-in user" actually is. There is (at most;-) a single logged-in user per request, so keeping that info in the request object seems vastly preferable;-).
0
0
0
0
2010-03-30T06:52:00.000
1
1.2
true
2,543,315
0
0
1
1
How can I can set a global variable for the username of the logged-in user? At the moment i have the following code in all my controllers to get the username. I rather set it as a global variable if possible. request.environ.get("REMOTE_USER") I tried putting the same code in the app_globals.py file but it gave me the following error message: "No object (name: request) has been registered for this thread"
Overwrite the Soap Envelope in Suds python
2,545,937
3
7
4,252
0
python,xml,soap,suds,envelope
I managed to get this working, the soap envelope is hard coded into bindings.py that is stored in suds.egg installed in your site-packages. I changed the SOAP envelope address to http://www.w3.org/2003/05/soap-envelope. This was compatible with my camera. I was unable to find a command to overwrite this envelope in suds so I hard coded it in to the bindings.py. Thanks for any help
0
0
0
0
2010-03-30T10:09:00.000
4
1.2
true
2,544,331
0
0
1
1
I have a camera and I am trying to connect to it vis suds. I have tried to send raw xml and have found that the only thing stopping the xml suds from working is an incorrect Soap envelope namespace. The envelope namespace is: xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" and I want to rewrite it to: xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" In order to add a namespace in python I try this code: message = Element('Element_name').addPrefix(p='SOAP-ENC', u='www.w3.org/ENC') But when I add the SOAP-ENV to the namespace it doesn't write as it is hardcoded into the suds bindings. Is there a way to overwrite this in suds? Thanks for any help.
Optimization Techniques in Python
2,545,940
6
11
1,942
1
python
ok, not entirely to the point, but before you go and start fixing it, make sure everyone understands the situation. it seems to me that they're putting some pressure on you to fix the "problem". well first of all, when you wrote the application, have they specified the performance requirements? did they tell you that they need operation X to take less than Y secs to complete? Did they specify how many concurrent users must be supported without penalty to the performance? If not, then tell them to back off and that it is iteration (phase, stage, whatever) one of the deployment, and the main goal was the functionality and testing. phase two is performance improvements. let them (with your help obviously) come up with some non functional requirements for the performance of your system. by doing all this, a) you'll remove the pressure applied by the finance team (and i know they can be a real pain in the bum) b) both you and your clients will have a clear idea of what you mean by "performance" c) you'll have a base that you can measure your progress and most importantly d) you'll have some agreed time to implement/fix the performance issues. PS. that aside, look at the indexing... :)
0
0
0
1
2010-03-30T14:07:00.000
9
1
false
2,545,820
0
0
1
3
Recently i have developed a billing application for my company with Python/Django. For few months everything was fine but now i am observing that the performance is dropping because of more and more users using that applications. Now the problem is that the application is now very critical for the finance team. Now the finance team are after my life for sorting out the performance issue. I have no other option but to find a way to increase the performance of the billing application. So do you guys know any performance optimization techniques in python that will really help me with the scalability issue Guys we are using mysql database and its hosted on apache web server on Linux box. Secondly what i have noticed more is the over all application is slow and not the database transactional part. For example once the application is loaded then it works fine but if they navigate to other link on that application then it takes a whole lot of time. And yes we are using HTML, CSS and Javascript
Optimization Techniques in Python
2,546,955
4
11
1,942
1
python
A surprising feature of Python is that the pythonic code is quite efficient... So a few general hints: Use built-ins and standard functions whenever possible, they're already quite well optimized. Try to use lazy generators instead one-off temporary lists. Use numpy for vector arithmetic. Use psyco if running on x86 32bit. Write performance critical loops in a lower level language (C, Pyrex, Cython, etc.). When calling the same method of a collection of objects, get a reference to the class function and use it, it will save lookups in the objects dictionaries (this one is a micro-optimization, not sure it's worth) And of course, if scalability is what matters: Use O(n) (or better) algorithms! Otherwise your system cannot be linearly scalable. Write multiprocessor aware code. At some point you'll need to throw more computing power at it, and your software must be ready to use it!
0
0
0
1
2010-03-30T14:07:00.000
9
1.2
true
2,545,820
0
0
1
3
Recently i have developed a billing application for my company with Python/Django. For few months everything was fine but now i am observing that the performance is dropping because of more and more users using that applications. Now the problem is that the application is now very critical for the finance team. Now the finance team are after my life for sorting out the performance issue. I have no other option but to find a way to increase the performance of the billing application. So do you guys know any performance optimization techniques in python that will really help me with the scalability issue Guys we are using mysql database and its hosted on apache web server on Linux box. Secondly what i have noticed more is the over all application is slow and not the database transactional part. For example once the application is loaded then it works fine but if they navigate to other link on that application then it takes a whole lot of time. And yes we are using HTML, CSS and Javascript
Optimization Techniques in Python
2,546,996
2
11
1,942
1
python
before you can "fix" something you need to know what is "broken". In software development that means profiling, profiling, profiling. Did I mention profiling. Without profiling you don't know where CPU cycles and wall clock time is going. Like others have said to get any more useful information you need to post the details of your entire stack. Python version, what you are using to store the data in (mysql, postgres, flat files, etc), what web server interface cgi, fcgi, wsgi, passenger, etc. how you are generating the HTML, CSS and assuming Javascript. Then you can get more specific answers to those tiers.
0
0
0
1
2010-03-30T14:07:00.000
9
0.044415
false
2,545,820
0
0
1
3
Recently i have developed a billing application for my company with Python/Django. For few months everything was fine but now i am observing that the performance is dropping because of more and more users using that applications. Now the problem is that the application is now very critical for the finance team. Now the finance team are after my life for sorting out the performance issue. I have no other option but to find a way to increase the performance of the billing application. So do you guys know any performance optimization techniques in python that will really help me with the scalability issue Guys we are using mysql database and its hosted on apache web server on Linux box. Secondly what i have noticed more is the over all application is slow and not the database transactional part. For example once the application is loaded then it works fine but if they navigate to other link on that application then it takes a whole lot of time. And yes we are using HTML, CSS and Javascript
Does anyone have any feedback on using Psyco in a wsgi application?
9,439,466
1
2
186
0
python,wsgi
Psyco is dead -- its successor is called PyPy. You are unlikely to get any speed increase with an I/O bound application however.
0
0
0
1
2010-03-30T21:02:00.000
2
0.099668
false
2,548,705
0
0
1
2
Have you tried Psyco in a wsgi application (custom, Pylons, Django...)? What does your set up look like? Did you get measurable results?
Does anyone have any feedback on using Psyco in a wsgi application?
2,553,516
2
2
186
0
python,wsgi
The question you should ask is not did you get measurable results, but does it make your site noticeably faster? Most web applications are not CPU bound, so even if JIT makes them faster, you probably weren't fully utilizing your processor to begin with. It has been a very long time since I played with psyco, but order to get measurable results I would have to simulate thousands of concurrent requests, an unrealistic situation for the average web site. Keep in mind that psyco is not compatible with 64-bit python. The average website doesn't need more than 4gb of ram, but think that ram is generally of more value than CPU cycles.
0
0
0
1
2010-03-30T21:02:00.000
2
1.2
true
2,548,705
0
0
1
2
Have you tried Psyco in a wsgi application (custom, Pylons, Django...)? What does your set up look like? Did you get measurable results?
how to write re-usable views in django?
2,550,450
0
0
151
0
python,django,views
whenever the view needs a particular object from the ORM, it attempts to fetch it using any "id" parameter in several ways (e.g. as a slug, as a database id) (this may be a bad practice...) So... why not just expect a model instance to be passed in as a parameter? Or a QuerySet from which you will take element 0? Then you can combine it with the QuerySet case, and maybe roll it into get_object_or_404. My suggestion is to look at how Django's generic views are written. They're solving the same general class of problems you are. You seem most of the way there, except for the last part.
0
0
0
0
2010-03-31T03:25:00.000
2
0
false
2,550,308
0
0
1
2
These are the techniques that I use regularly to make my views reusable: take the template_name as an argument with a default take an optional extra_context which defaults to empty {} right before the template is rendered the context is updated with the extra_context for further re-usability, call any callable in extra_context.values() whenever the view deals with a queryset, there is a queryset argument with a default whenever the view needs a particular object from the ORM, it attempts to fetch it using any "id" parameter in several ways (e.g. as a slug, as a database id) (this may be a bad practice...) First, should I add anything to my list? Should I remove anything from my list? The items accommodates a large number of cases. However, whenever an app extends a model of another in some way (e.g. adding a field or changing the behavior in some way) I end up writing my own views and only reusing the model. Is this normal? Edit/answering my own question partially: signals: the view should emit a signal when it starts and one before it returns the response
how to write re-usable views in django?
2,550,339
0
0
151
0
python,django,views
I would think that doing all of those puts a large burden on your urlconf to get everything right. Perhaps making a function that takes all that and hardcoding your views to be a glorified wrapper around said function would be better.
0
0
0
0
2010-03-31T03:25:00.000
2
0
false
2,550,308
0
0
1
2
These are the techniques that I use regularly to make my views reusable: take the template_name as an argument with a default take an optional extra_context which defaults to empty {} right before the template is rendered the context is updated with the extra_context for further re-usability, call any callable in extra_context.values() whenever the view deals with a queryset, there is a queryset argument with a default whenever the view needs a particular object from the ORM, it attempts to fetch it using any "id" parameter in several ways (e.g. as a slug, as a database id) (this may be a bad practice...) First, should I add anything to my list? Should I remove anything from my list? The items accommodates a large number of cases. However, whenever an app extends a model of another in some way (e.g. adding a field or changing the behavior in some way) I end up writing my own views and only reusing the model. Is this normal? Edit/answering my own question partially: signals: the view should emit a signal when it starts and one before it returns the response
Django newbie question: can't start a new project
2,553,104
2
0
2,582
0
python,django,django-admin
do you have permission to write to the directory?
0
0
0
0
2010-03-31T13:04:00.000
4
0.099668
false
2,553,088
0
0
1
2
I'm totally new to django, and I'm using its documentation to get help on how to use it but seems like something is missing. i installed django using setup.py install command and i added the ( django/bin ) to system path variable but. i still cant start a new project i use the following syntax to start a project : django-admin.py startproject myNewProject but it says Type 'django-admin.py help' for usage. 1 UPDATES : i use windows vista x64 . i checked the environment variables and i don't have DJANGO_SETTINGS_MODULE variable in there . should i add one ?? and with what value ? do i miss anything ? thank u
Django newbie question: can't start a new project
2,559,610
0
0
2,582
0
python,django,django-admin
check whether you have djagno or not and the it is in python path or not.if using linux go to terminal type python and then try to import django
0
0
0
0
2010-03-31T13:04:00.000
4
0
false
2,553,088
0
0
1
2
I'm totally new to django, and I'm using its documentation to get help on how to use it but seems like something is missing. i installed django using setup.py install command and i added the ( django/bin ) to system path variable but. i still cant start a new project i use the following syntax to start a project : django-admin.py startproject myNewProject but it says Type 'django-admin.py help' for usage. 1 UPDATES : i use windows vista x64 . i checked the environment variables and i don't have DJANGO_SETTINGS_MODULE variable in there . should i add one ?? and with what value ? do i miss anything ? thank u
What should I use - Mako or Django?
2,562,356
4
4
1,845
0
python,django,template-engine,mako
Ask yourself this question: What are you getting out of this project? What do you want to learn? If you want to know the nuts and bolts of a web server the hard way: concoct your own web framework using Mako and other useful building blocks as needed. As @pulegium says, you'll have to choose how to handle the HTTP layer and database layer. If you want to get a website up and running quickly: do use Django. It's well documented and is an all-in-one solution. I've found its admin interface to be a real killer. What Django doesn't provide is tools for deployment; you'll have to write a script or use a deployment solution to update your code on the server. If you want to be more lazy: use Google App Engine. (With the silent agreement to follow the rules of the BigTable, which is quite different from popular relational database systems.) GAE takes care of installation and deployment of your web app, logging, versioning and other stuffs you need to take care of when running a website. You can also use Django on GAE.
0
0
0
0
2010-04-01T17:03:00.000
3
0.26052
false
2,562,167
0
0
1
3
I'm making a website that mail users when a movie or a pc game has released. It isn't too complex - users can sign up, choose movies/music or a genre and save the settings. When the movie/music is released - it mails the user. Some other functionality too but this is the jist. Now, I've been working with Python for a bit but mainly in the area of console apps. For web: what should I use, the web framework Django or the templating engine Mako? I can't seem to decide between the two. :( Thanks
What should I use - Mako or Django?
2,562,185
2
4
1,845
0
python,django,template-engine,mako
Django. Because it takes care for all bits and pieces (url mapping, request object handling etc) and hides the DB access from you as well. If you want you can use SQLite DB so no need for MysQL or other "proper" DBs. If you were using just template engine you'd have to take care of HTTP layer yourself. And the DB stuff as well.
0
0
0
0
2010-04-01T17:03:00.000
3
1.2
true
2,562,167
0
0
1
3
I'm making a website that mail users when a movie or a pc game has released. It isn't too complex - users can sign up, choose movies/music or a genre and save the settings. When the movie/music is released - it mails the user. Some other functionality too but this is the jist. Now, I've been working with Python for a bit but mainly in the area of console apps. For web: what should I use, the web framework Django or the templating engine Mako? I can't seem to decide between the two. :( Thanks
What should I use - Mako or Django?
5,249,036
0
4
1,845
0
python,django,template-engine,mako
I have used mako for some time and have also tried to get to grips with django in google appengine. If you are a python whizz... definitely opt for Mako. I'm finding django frustrating as the syntax doesn't allow me to do really nice pythonic code. I'm going to drop Mako into my appengine project before it's too late!
0
0
0
0
2010-04-01T17:03:00.000
3
0
false
2,562,167
0
0
1
3
I'm making a website that mail users when a movie or a pc game has released. It isn't too complex - users can sign up, choose movies/music or a genre and save the settings. When the movie/music is released - it mails the user. Some other functionality too but this is the jist. Now, I've been working with Python for a bit but mainly in the area of console apps. For web: what should I use, the web framework Django or the templating engine Mako? I can't seem to decide between the two. :( Thanks
Django - Threading in views without hanging the server
2,565,806
2
0
458
0
python,django,multithreading,django-models
But why you need thread? why can't you just do whatever you want to do in django view? If you are using servers like apache with mod-wsgi you should be able to have good control over number of process and threads , so that part shouldn't be your worry or should not be in django views.
0
0
0
0
2010-04-02T07:15:00.000
2
0.197375
false
2,565,484
0
0
1
2
One of my applications in my Django project require each request/visitor to that instance to have their own thread. This might sound confusing, so I'll describe what I'm looking to accomplish in a case based scenario, with steps: User visits application Thread starts Until the thread finishes, that user's server instance hangs Once the thread completes, a response is delivered to the user Other visitors to the site should not be affected by any other users using the application How can I accomplish something like this? If possible, I'd like to find a lightweight solution.
Django - Threading in views without hanging the server
4,045,424
0
0
458
0
python,django,multithreading,django-models
I dread to think why you'd want to do that. Are you sure you're not looking for session variables?
0
0
0
0
2010-04-02T07:15:00.000
2
0
false
2,565,484
0
0
1
2
One of my applications in my Django project require each request/visitor to that instance to have their own thread. This might sound confusing, so I'll describe what I'm looking to accomplish in a case based scenario, with steps: User visits application Thread starts Until the thread finishes, that user's server instance hangs Once the thread completes, a response is delivered to the user Other visitors to the site should not be affected by any other users using the application How can I accomplish something like this? If possible, I'd like to find a lightweight solution.
How use the google maps hand cursor in Python?
2,565,793
0
0
593
0
python,wxpython,cursor
Use two cursors and change them on events as they need to be.
0
0
0
0
2010-04-02T08:43:00.000
2
1.2
true
2,565,776
0
0
1
1
I want to use the google maps hand cursor in Python but I don't know how to do it. I've downloaded the cursor but I only get to use the hand open, I also have a event that "closes" the hand when clicked but I don't know how can I change the style cursor on it. I say this because the google maps hand cursor has two style (the open and the closed hand). If you don't know how to use the other style you can also tell me how can I create another cursor where the close hand is the default style. If I have that, I only change the cursor and it's done. Thanks in advance :)
Eclipse: PyDev installation difficulties
15,892,577
0
0
1,097
0
python,eclipse,pydev
there's an easy way to install plugin for eclipse, download the pydev package zip file (not install it via eclipse update), extract it, and put it into your eclipse/dropins/pydev folder. this is a hidden way to install plugin.
0
1
0
1
2010-04-02T16:48:00.000
1
0
false
2,567,895
0
0
1
1
I'm having difficulty getting PyDev to work. I had an installation of Eclipse for PHP developers (1.2.1.20090918-0703). A month ago, I installed PyDev, and everything worked great. I go to fire it up this morning, and PyDev is gone. There is no option to create a Python project, the Python language editor is missing, etc. Eclipse for PHP does not say that PyDev is installed, so I grab it from the update URL. The version that comes down is 1.5.6. I restart after the installation, and everything works fine again. Sweet. Then, I grab Subclipse 1.0.7. Upon restarting after that installation, PyDev is now gone. It isn't recognizing Python projects or Python files, etc. So I uninstall Subclipse. PyDev is still gone. Uninstalling and reinstalling PyDev again doesn't bring it back. What am I doing wrong? Do I need a different version of Eclipse? UPDATE: I downloaded a fresh copy of Eclipse for Java, did all this over again, and had PyDev working fine. Then, when I downloaded JSEclipse, PyDev again disappeared. This is super frustrating. UPDATE 2: Another fresh copy of Eclipse. This time I downloaded Subclipse first. It worked fine. Then I downloaded JSEclipse, and Subclipse is gone.
How to handle redirects while parsing HTML? - Python
2,574,423
1
1
553
0
python,html,http,forms,screen-scraping
If it uses meta tags then you need to parse the HTML manually. Otherwise mechanize will handle the redirect automatically.
0
0
1
0
2010-04-02T20:42:00.000
2
0.099668
false
2,569,089
0
0
1
1
I'm trying to submit a few forms through a Python script, I'm using the mechanized library. This is so I can implement a temporary API. The problem is that before after submission a blank page is returned informing that the request is being processed, after a few seconds the page is redirected to the final page. I understand if it might sound a bit generic, but I'm not sure what is going on. :) Any ideas?
How to convert tag-and-username-like text into proper links in a twitter message?
2,570,547
0
0
207
0
python,django,twitter
I'm not sure exactly what you're asking, but what's wrong with something like {{ user.get_absolute_url }}? For the tag detail URLs, it really depends on what you're looking for, but you would have to construct the url and view for that yourself.
0
0
0
0
2010-04-03T04:03:00.000
3
0
false
2,570,193
0
0
1
1
I'm writing a twitter-like note-taking web app. In a page the latest 20 notes of the user will be listed, and when the user scroll to the bottom of the browser window more items will be loaded and rendered. The initial 20 notes are part of the generated html of my django template, but the other dynamically loaded items are in json format. I want to know how do I do the tag-and-username converting consistently. Thanks in advance.
Django manage.py can't find an INSTALLED_APP even though the module is in the path
2,574,461
0
0
2,147
0
python,django,django-evolution
You need to add it to your INSTALLED_APPS section of settings.py.
0
0
0
0
2010-04-04T13:04:00.000
4
0
false
2,574,451
0
0
1
4
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APPS, namely django-evolution, saying it's an undefined module. This is despite the fact that I've added the path to django-evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing this module when clearly it's been setup and even added to the path? EDIT: This only happens when running from iPython. When I run from the cmd prompt it works fine. Go figure.
Django manage.py can't find an INSTALLED_APP even though the module is in the path
2,575,989
1
0
2,147
0
python,django,django-evolution
Does your django_evolution have a init.py file in it? Also any folder containing django_evolution needs one.
0
0
0
0
2010-04-04T13:04:00.000
4
0.049958
false
2,574,451
0
0
1
4
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APPS, namely django-evolution, saying it's an undefined module. This is despite the fact that I've added the path to django-evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing this module when clearly it's been setup and even added to the path? EDIT: This only happens when running from iPython. When I run from the cmd prompt it works fine. Go figure.
Django manage.py can't find an INSTALLED_APP even though the module is in the path
8,602,397
0
0
2,147
0
python,django,django-evolution
If you are using virtualenv and ipython is installed at the system level but your app at the env level, it will lead to this. The way out of it is to remove ipython from the system and to install it into your env.
0
0
0
0
2010-04-04T13:04:00.000
4
0
false
2,574,451
0
0
1
4
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APPS, namely django-evolution, saying it's an undefined module. This is despite the fact that I've added the path to django-evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing this module when clearly it's been setup and even added to the path? EDIT: This only happens when running from iPython. When I run from the cmd prompt it works fine. Go figure.
Django manage.py can't find an INSTALLED_APP even though the module is in the path
52,769,162
0
0
2,147
0
python,django,django-evolution
I know this is super old, but in case anyone has this issue, my issue was because I had elevated to root inside my venv. I had initialized my virtual environment, and then upgraded my privileges to root. If deactivate doesn't work and you're root, then you should exit then deactivate, then you can do sudo su and then source myenv/bin/activate. Hope this helps!
0
0
0
0
2010-04-04T13:04:00.000
4
0
false
2,574,451
0
0
1
4
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APPS, namely django-evolution, saying it's an undefined module. This is despite the fact that I've added the path to django-evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing this module when clearly it's been setup and even added to the path? EDIT: This only happens when running from iPython. When I run from the cmd prompt it works fine. Go figure.
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
2,844,890
0
21
30,143
0
python,django,cakephp,web-frameworks,yii
If for the PHP part I would choose CodeIgniter - it doesn't get too much into your way. But it doesn't have any code/view/model generators out of the box, you need to type a bit. But languages other than PHP appear to be more sexy.
0
0
0
1
2010-04-05T13:18:00.000
8
0
false
2,578,540
0
0
1
5
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
10,847,083
4
21
30,143
0
python,django,cakephp,web-frameworks,yii
Codeigniter it's fast and very documented also has a large community to and finaly friendly with the programmer.
0
0
0
1
2010-04-05T13:18:00.000
8
0.099668
false
2,578,540
0
0
1
5
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
7,084,868
0
21
30,143
0
python,django,cakephp,web-frameworks,yii
I am using CodeIgniter 1.7.2 and for complex websites it's very good and powerfull, but it definitely is missing some kind of code generator which will allow for example to build an IT application in one click. I had the impression (from watching a tutorial) that Django has it.
0
0
0
1
2010-04-05T13:18:00.000
8
0
false
2,578,540
0
0
1
5
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting