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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Django without shell access
| 886,561 | 1 | 0 | 702 | 0 |
python,django,shell
|
It is possible.
Usually you will develop your application locally (where shell access is nice to have) and publish your work to your server. All you need for this is FTP access and some way to import a database dump from your development database (often hosters provide an installation of phpMyAdmin for this).
python (I assume via mod_python)
From my experience, you are most certainly wrong with that assumption. Many low-cost providers claim to support python but in fact provide only an outdated version that can be used with CGI scripts. This setup will have a pretty low performance for Django apps.
| 0 | 1 | 0 | 0 |
2009-05-20T07:07:00.000
| 2 | 0.099668 | false | 886,526 | 0 | 0 | 1 | 1 |
Is it possible to run django without shell access? My hoster supports the following for 5€/month:
python (I assume via mod_python)
mysql
There is no shell nor cronjob support, which costs additional 10€/month, so I'm trying to avoid it.
I know that Google Apps also work without shell access, but I assume that is possible because of their special configuration.
|
Satchmo donations
| 901,050 | 3 | 2 | 253 | 0 |
python,django,e-commerce,satchmo
|
It looks like the satchmo_cart_details_query signal is the way to go about doing this. It allows you to add a price change value (in my case, donation amount) to a cart item
I'll post the full solution if anyone is interested
| 0 | 0 | 0 | 1 |
2009-05-21T08:46:00.000
| 1 | 1.2 | true | 891,934 | 0 | 0 | 1 | 1 |
Can anyone share some pointers on building a Donations module for Satchmo? I'm comfortable customizing Satchmo's product models etc but unable to find anything related to Donations
I realize it's possible to create a Donations virtual product but as far as I can tell this still requires setting the amount beforehand ($5, $10 etc). I want users to be able to donate arbitrary amounts
|
Send emails from Google App Engine
| 892,427 | 2 | 0 | 1,502 | 0 |
python,django,google-app-engine,mail-server
|
The example code for the remote APi gives you an interactive console from which you can access any of the modules in your application. I see no requirement that they be only datastore operations.
| 0 | 1 | 0 | 0 |
2009-05-21T10:31:00.000
| 2 | 0.197375 | false | 892,266 | 0 | 0 | 1 | 1 |
I have a web server with Django, hosted with Apache server. I would like to configure Google App Engine for the email server. My web server should be able to use Google App Engine, when it makes any email send using EmailMessage or sendmail infrastructure of Google Mail API.
I learnt that by using Remote API, I can access Google App Engine server from my main web server. However, I could not access the Mail APIs supported by Google App Engine.
Is the Remote API strictly for Datastore? If so, can only the DB read from it and no other API calls can?
|
Using python to develop web application
| 895,439 | 0 | 17 | 23,044 | 0 |
python
|
Lookup Django.
| 0 | 0 | 0 | 0 |
2009-05-21T21:58:00.000
| 9 | 0 | false | 895,420 | 0 | 0 | 1 | 1 |
I have been doing some work in python, but that was all for stand alone applications. I'm curious to know whether any offshoot of python supports web development?
Would some one also suggest a good tutorial or a website from where I can pick up some of the basics of web development using python?
|
Django App Dependency Cycle
| 895,984 | 2 | 26 | 7,969 | 0 |
python,django,dependencies
|
Normally I advocate for splitting functionality into smaller apps, but a circular dependence between models reflects such a tight integration that you're probably not gaining much from the split and might just consider merging the apps. If that results in an app that feels too large, there may be a way to make the split along a different axis, resulting in a more sane dependency graph.
| 0 | 0 | 0 | 0 |
2009-05-21T22:05:00.000
| 4 | 0.099668 | false | 895,454 | 0 | 0 | 1 | 2 |
I am in the middle of developing a Django application, which has quite complicated models (it models a university - courses, modules, lectures, students etc.)
I have separated the project into apps, to make the whole thing more organised (apps are courses, schools, people, modules and timeperiods). I am having a problem whereby a model in one app may depend on a model in another - so I must import it. The second app then in turn depends on a model in the first, so there is a cycle and Python throws up an error.
How do people deal with this? I understand that apps should be relatively "independent", but in a system like this it doesn't make sense, for example, to use ContentTypes to link students to a module.
Does anyone have a similar project that could comment on this case?
|
Django App Dependency Cycle
| 896,090 | 3 | 26 | 7,969 | 0 |
python,django,dependencies
|
If you're seeing circular model dependency I'm guessing that one of three things is happening:
You've defined an inverse relationship to one that's already defined (for instance both course has many lectures and lecture has one course) which is redundant in django
You have a model method in the wrong app
You're providing functionality in a model method that ought to be in a manager
Maybe you could show us what's happening in these models and we can try to figure out why the problem is arising. Circular model dependency is rarely an indication that you need to combine two apps - it's more likely (though not definitely the case) that there's a problem with one of your model definitions.
p.s. I am working on a similar django application, but my app structure is probably quite different to your's. I'd be happy to give you a high-level description of it if you're interested.
| 0 | 0 | 0 | 0 |
2009-05-21T22:05:00.000
| 4 | 0.148885 | false | 895,454 | 0 | 0 | 1 | 2 |
I am in the middle of developing a Django application, which has quite complicated models (it models a university - courses, modules, lectures, students etc.)
I have separated the project into apps, to make the whole thing more organised (apps are courses, schools, people, modules and timeperiods). I am having a problem whereby a model in one app may depend on a model in another - so I must import it. The second app then in turn depends on a model in the first, so there is a cycle and Python throws up an error.
How do people deal with this? I understand that apps should be relatively "independent", but in a system like this it doesn't make sense, for example, to use ContentTypes to link students to a module.
Does anyone have a similar project that could comment on this case?
|
How to change default django User model to fit my needs?
| 3,902,915 | 0 | 14 | 12,241 | 0 |
python,django,django-models
|
There are anumber of ways to do this, but here's what I'd do: I'd allow a user to enter an email, username (which must contain at least one letter and no @ symbols) or mobile number. Then, when I validate it:
Check for the presence of @. If so, set it as the user's email, hash it appropriately and set it as their username as well.
Check to see if it's only numbers, dashes and +. Then, strip the appropriate characters and store it as both mobile number and username (if you're storing the mobile number in another model for SMS purposes or something).
If it's not either, just set it as username.
I'd also validate the user/phone/email field similarly on login and look in the appropriate place so that if, say, a user signs up with their mobile number and then changes their username (for some other purpose), they can still sign in with their mobile number.
| 0 | 0 | 0 | 0 |
2009-05-22T05:01:00.000
| 5 | 0 | false | 896,421 | 0 | 0 | 1 | 3 |
The default Django's User model has some fields, and validation rules, that I don't really need. I want to make registration as simple as possible, i.e. require either email or username, or phone number - all those being unique, hence good as user identifiers.
I also don't like default character set for user name that is validated in Django user model. I'd like to allow any character there - why not?
I used user-profile django application before to add a profile to user - but this time I'd rather make the class mimimal. But I still want to use the User class, as it gives me an easy way to have parts of site restricted only for users logged in.
How do I do it?
|
How to change default django User model to fit my needs?
| 898,052 | 0 | 14 | 12,241 | 0 |
python,django,django-models
|
You face a bit of a dilemma which really has two solutions if you're committed to avoiding the profile-based customization already pointed out.
Change the User model itself, per Daniel's suggestions
Write a CustomUser class, subclassing User or copying its functionality.
The latter suggestion means that you would have to implement some things that User does automatically manually, but I wonder whether that's as bad as it sounds, especially if you're at the beginning of your project. All you'd have to do is rewrite a middle-ware class and some decorators.
Of course, I don't think this buys you anything that 1 won't get you, except that your project shouldn't break if you svn update your django. It may avoid some of the compatibility problems with other apps, but my guess is most problems will exist either way.
| 0 | 0 | 0 | 0 |
2009-05-22T05:01:00.000
| 5 | 0 | false | 896,421 | 0 | 0 | 1 | 3 |
The default Django's User model has some fields, and validation rules, that I don't really need. I want to make registration as simple as possible, i.e. require either email or username, or phone number - all those being unique, hence good as user identifiers.
I also don't like default character set for user name that is validated in Django user model. I'd like to allow any character there - why not?
I used user-profile django application before to add a profile to user - but this time I'd rather make the class mimimal. But I still want to use the User class, as it gives me an easy way to have parts of site restricted only for users logged in.
How do I do it?
|
How to change default django User model to fit my needs?
| 898,313 | 10 | 14 | 12,241 | 0 |
python,django,django-models
|
Rather than modify the User class directly or do subclassing, you can also just repurpose the existing fields.
For one site I used the "first_name" field as the "publicly displayed name" of a user and stuff a slugified version of that into the "username" field (for use in URLs). I wrote a custom auth backend to allow people to log in using their "public name" or their email address, and I enforce the uniqueness of both of those at registration time. This plays nicely with other reusable apps and doesn't introduce extra tables or queries.
For another site I didn't want usernames at all, just unique emails. In order to satisfy Django's need for a unique username, I just hashed the email address and used that as the username (you have to base64-encode the hash to squeeze it under 30 characters). Custom auth backend to allow login with email.
If backwards-compatibility weren't an issue, there are a lot of improvements I'd love to see made to django.contrib.auth and the User model to make them more flexible. But there's quite a lot you can do inside the current constraints with a little creativity.
| 0 | 0 | 0 | 0 |
2009-05-22T05:01:00.000
| 5 | 1.2 | true | 896,421 | 0 | 0 | 1 | 3 |
The default Django's User model has some fields, and validation rules, that I don't really need. I want to make registration as simple as possible, i.e. require either email or username, or phone number - all those being unique, hence good as user identifiers.
I also don't like default character set for user name that is validated in Django user model. I'd like to allow any character there - why not?
I used user-profile django application before to add a profile to user - but this time I'd rather make the class mimimal. But I still want to use the User class, as it gives me an easy way to have parts of site restricted only for users logged in.
How do I do it?
|
Django shopping cart/basket solution (or should I DIM)?
| 899,393 | 3 | 1 | 3,617 | 0 |
python,django,e-commerce,shopping-cart
|
Since you asked: if your needs are that limited, it does sound like a DIY situation to me. I don't see what's so fiddly about it; what complexity there is is all in the pricing formula, and you're planning to supply that either way. Add in Django's built-in session support and you're most of the way there.
| 0 | 0 | 0 | 0 |
2009-05-22T15:19:00.000
| 2 | 1.2 | true | 898,426 | 0 | 0 | 1 | 1 |
I'm about to build a site that has about half a dozen fairly similar products. They're all DVDs so they fit into a very "fixed" database very well. I was going to make a DVD model. Tag them up. All very simple. All very easy.
But we need to be able to sell them. The current site outsources the whole purchasing system but that's not going to fly on the new site. We want to integrate everything right up until the payment (for both UX reasons plus we get to customise the process a lot more).
The other problem with the outsourced problem is it doesn't account for people that don't need to pay VAT (sales tax) or for the fact you get a discounts if you buy more than one of the same thing, or more than one SKU at the same time.
So I've been looking around.
Satchmo looks like a whole mini-framework. It has listing options that I just don't need with the quantities of SKUs I'm dealing with.
django-cart has been re-hashed as of March but it looks pretty abandoned since then.
I'm looking for something that will let me:
pass it a model instances, a price and a quantity
apply a quantities formula based on the number of unique SKUs and copies in the same title
list what's in the cart on every page
That's about it (but it's quite fiddly, nevertheless). I can handle the final order processing nonsense.
Or am I just being silly?
Should I just get on and Do It Myself? If that's your vote, I've never built a cart before so are there any considerations that are not obvious to somebody who has only used shopping carts before?
|
How to embed a Poll in a Web Page
| 903,112 | 1 | 1 | 552 | 0 |
javascript,python,cross-domain
|
Make your app into a Google Gadget, Open Social gadget, or other kind of gadgets -- these are all designed to be embeddable into third-party pages with as little fuss as possible.
| 0 | 0 | 1 | 0 |
2009-05-24T04:53:00.000
| 2 | 0.099668 | false | 903,104 | 0 | 0 | 1 | 1 |
I want to create a simple online poll application. I have created a backend in python that handles vote tracking, poll display, results display and admin setup. However, if I wanted a third party to be able to embed the poll in their website, what would be the recommended way of doing so? I would love to be able to provide a little javascript to drop into the third parties web page, but I can't use javascript because it would require a cross-domain access. What approach would provide an easy general solution for third parties?
|
Is there any library to find out urls of embedded flvs in a webpage?
| 905,451 | 0 | 1 | 382 | 0 |
python,download,flv
|
if the embed player makes use of some variable where the flv path is set then you can download it, if not.. I doubt you find something to do it "automaticly" since every site make it's own player and identify the file by id not by path, which makes hard to know where the flv file is.
| 0 | 0 | 1 | 0 |
2009-05-25T05:07:00.000
| 2 | 0 | false | 905,403 | 0 | 0 | 1 | 1 |
I'm trying to write a script which can automatically download gameplay videos. The webpages look like dota.sgamer.com/Video/Detail/402 and www.wfbrood.com/movie/spl2009/movie_38214.html, they have flv player embedded in the flash plugin.
Is there any library to help me find out the exact flv urls? or any other ideas to get it?
Many thanks for your replies
|
Syntax Highlight for Mako in Eclipse or TextMate?
| 923,030 | 2 | 12 | 5,178 | 0 |
python,templates,mako
|
What I ended up doing was naming my Mako Templates with .html suffix and thus getting the usual HTML syntax highlighting etc. that I am used to. Alternatively I could have associated .mako suffix with the HTML handler. While this does not address Mako specifically, it was enough for me, since I find most of the template is plain HTML anyway.
| 0 | 0 | 0 | 1 |
2009-05-28T19:34:00.000
| 7 | 0.057081 | false | 922,771 | 0 | 0 | 1 | 3 |
Does anyone know of a syntax highlight for Mako templates for Eclipse or for TextMate?
I know that there is a .mako syntax highlighter for the default text editor in Ubuntu.
|
Syntax Highlight for Mako in Eclipse or TextMate?
| 30,838,894 | 0 | 12 | 5,178 | 0 |
python,templates,mako
|
Windows (menu) > Preference > General > Editor > File Associations
Add *.mako in File Types (upper box) and add Html editor in Associated editor (lower box)
Windows (menu) > Preference > General > Editor > Content Types
Under Text find HTML and add *.mako in File associations.
| 0 | 0 | 0 | 1 |
2009-05-28T19:34:00.000
| 7 | 0 | false | 922,771 | 0 | 0 | 1 | 3 |
Does anyone know of a syntax highlight for Mako templates for Eclipse or for TextMate?
I know that there is a .mako syntax highlighter for the default text editor in Ubuntu.
|
Syntax Highlight for Mako in Eclipse or TextMate?
| 8,544,623 | 1 | 12 | 5,178 | 0 |
python,templates,mako
|
You can go to:
Preferences->General->Editors->File Associations.
Click to add a new file type and type *.mak and click OK.
In File types click on *.mak and under Associated editors add HTML editor(default), Text Editor, Text Editor(studio) and Web Browser.
This colors the text, works OK for me :)
P.S. Be sure to have the Aptana plugin installed.
| 0 | 0 | 0 | 1 |
2009-05-28T19:34:00.000
| 7 | 0.028564 | false | 922,771 | 0 | 0 | 1 | 3 |
Does anyone know of a syntax highlight for Mako templates for Eclipse or for TextMate?
I know that there is a .mako syntax highlighter for the default text editor in Ubuntu.
|
Stackless installation and configuration with DJango
| 925,645 | 0 | 1 | 1,142 | 0 |
django,stackless,python-stackless
|
I think the solution would be to point eclipse at your 2.5 stackless installation unless you have a very good reason to use 2.6 over 2.5?
...or recompile for 2.6 and add it to your 2.6 installation.
| 0 | 0 | 0 | 0 |
2009-05-29T11:42:00.000
| 2 | 0 | false | 925,616 | 0 | 0 | 1 | 2 |
I am trying to run a DJango Command Extension which uses stackless.
I have installed Stackless Python (compiled with python 2.5) so whenever I type python2.5 at the console it fires up indicating that the version is
Python 2.5.2 Stackless 3.1b3 060516 (python-2.52:72942, May 26 2009, 23:07:34)
[GCC 4.3.3] on linux2
But in my eclipse I have configured my django application to run with python2.6. Specifically in the PyDev settings. So obviously when I mention import stackless it says that there is no such package.
The problem is even if I add the '/usr/local/lib/python2.5/site-packages' directory it does not import stackless.
What is the solution to this issue ?
|
Stackless installation and configuration with DJango
| 4,507,213 | 0 | 1 | 1,142 | 0 |
django,stackless,python-stackless
|
Choose Window->preferencess in eclipse menu
pydev->interpeter-Python
choose tab forsed biltins
press new, type "stackless"
| 0 | 0 | 0 | 0 |
2009-05-29T11:42:00.000
| 2 | 0 | false | 925,616 | 0 | 0 | 1 | 2 |
I am trying to run a DJango Command Extension which uses stackless.
I have installed Stackless Python (compiled with python 2.5) so whenever I type python2.5 at the console it fires up indicating that the version is
Python 2.5.2 Stackless 3.1b3 060516 (python-2.52:72942, May 26 2009, 23:07:34)
[GCC 4.3.3] on linux2
But in my eclipse I have configured my django application to run with python2.6. Specifically in the PyDev settings. So obviously when I mention import stackless it says that there is no such package.
The problem is even if I add the '/usr/local/lib/python2.5/site-packages' directory it does not import stackless.
What is the solution to this issue ?
|
Configure Apache to recover from mod_python errors
| 928,519 | 1 | 0 | 281 | 0 |
python,django,apache,mod-python
|
As a workaround, and assuming you are free to install new Apache modules on the server, you might try one of
mod_scgi
mod_fastcgi
mod_wsgi
instead. I use SCGI to connect an nginx frontend webserver to my Django apps, which highlights a major benefit (decoupling from the webserver). All of these packages are available in Debian, probably on RHELx as well.
| 0 | 0 | 0 | 0 |
2009-05-29T15:23:00.000
| 1 | 0.197375 | false | 926,579 | 0 | 0 | 1 | 1 |
I am hosting a Django app on Apache using mod_python. Occasionally, I get some cryptic mod_python errors, usually of the ImportError variety, although not usually referring to the same module. The thing is, these seem to come up for a single forked subprocess, while the others operate fine, even when I force behavior that requires using the module that the problem process has errored on. Once the process encounters the error, it will always just serve the same traceback every time Apache chooses it to handle a request. (This is also a hassle, since my users don't necessarily report the error on the first occurrence, and once the process encounters the error.)
I know more about configuring Django than configuring Apache, but that won't get me anywhere since the request never reaches Django for processing. Ideally, I should solve the root problem, and that might involve my code, project, or machine configuration, but until then, I need help diagnosing and mitigating the problem.
Is there any way to configure the Apache logs to include a subprocess id?
Is there any way to force a subprocess to respawn if it has hit an error?
Are there any known issues relating to this that I should know about?
|
How do I access the child classes of an object in django without knowing the name of the child class?
| 929,073 | 0 | 84 | 34,203 | 0 |
python,django,many-to-many
|
You can achieve this looking for all the fields in the parent that are an instance of django.db.models.fields.related.RelatedManager. From your example it seems that the child classes you are talking about are not subclasses. Right?
| 0 | 0 | 0 | 0 |
2009-05-30T04:52:00.000
| 8 | 0 | false | 929,029 | 0 | 0 | 1 | 2 |
In Django, when you have a parent class and multiple child classes that inherit from it you would normally access a child through parentclass.childclass1_set or parentclass.childclass2_set, but what if I don't know the name of the specific child class I want?
Is there a way to get the related objects in the parent->child direction without knowing the child class name?
|
How do I access the child classes of an object in django without knowing the name of the child class?
| 929,128 | 24 | 84 | 34,203 | 0 |
python,django,many-to-many
|
In Python, given a ("new-style") class X, you can get its (direct) subclasses with X.__subclasses__(), which returns a list of class objects. (If you want "further descendants", you'll also have to call __subclasses__ on each of the direct subclasses, etc etc -- if you need help on how to do that effectively in Python, just ask!).
Once you have somehow identified a child class of interest (maybe all of them, if you want instances of all child subclasses, etc), getattr(parentclass,'%s_set' % childclass.__name__) should help (if the child class's name is 'foo', this is just like accessing parentclass.foo_set -- no more, no less). Again, if you need clarification or examples, please ask!
| 0 | 0 | 0 | 0 |
2009-05-30T04:52:00.000
| 8 | 1 | false | 929,029 | 0 | 0 | 1 | 2 |
In Django, when you have a parent class and multiple child classes that inherit from it you would normally access a child through parentclass.childclass1_set or parentclass.childclass2_set, but what if I don't know the name of the specific child class I want?
Is there a way to get the related objects in the parent->child direction without knowing the child class name?
|
Ironpython console disappears instantly
| 951,508 | 1 | 0 | 218 | 0 |
.net,.net-2.0,ironpython
|
i have found the way....
.NET 2.0 and .Net 3.0 do not have SP1.
So either version of .Net with SP1 will make Ironpython work...yippee
| 0 | 0 | 0 | 0 |
2009-05-30T06:13:00.000
| 3 | 1.2 | true | 929,141 | 1 | 0 | 1 | 3 |
I installed ironpython 2.0 in the windows xp professional box and it requires .Net framework 2.0 service pack 2 or later. The windows box has it. But still the console disappears. There is issue in either of them.
Need help?
|
Ironpython console disappears instantly
| 930,888 | 1 | 0 | 218 | 0 |
.net,.net-2.0,ironpython
|
The same result
Iropython requires .NET 2.0 sp1 or later
There is no error infact...
I suppose Ironpython is not finding the .Net libraries where it is supposed to be.
If the control panel\Add remove programs shows the .Net framework, does this mean they are installed. I am asking this question coz in forums no body has talked about checking the control panel thing; however, they either talk about checking Registry or %systemroot%\Microsoft .net\Framework and check for Mscorlib.dll in the respective version folder.
Well, I have found the .dll file for .net 2.0 and .net 1.1 but not for .net 3.0
If .net 3.0 is not installed, then the reason for failure of ironpython is sp1 for .net 2.0 is not installed.
Also, i checked the registry information at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\policy\v2.0
and found that .NEt 2.0, the orignal version is installed
however, I found .net 3.0 in .NETFramework folder, but not in policy folder. And in that folder, there is no such folder like v3.0 where the value is set such and such.
| 0 | 0 | 0 | 0 |
2009-05-30T06:13:00.000
| 3 | 0.066568 | false | 929,141 | 1 | 0 | 1 | 3 |
I installed ironpython 2.0 in the windows xp professional box and it requires .Net framework 2.0 service pack 2 or later. The windows box has it. But still the console disappears. There is issue in either of them.
Need help?
|
Ironpython console disappears instantly
| 929,197 | 0 | 0 | 218 | 0 |
.net,.net-2.0,ironpython
|
What happens if you open a command prompt and run ipy from there?
Run (From the command prompt) ipy -X:ExceptionDetail
This will hopefully give more info.
Also have a look in the Windows Event Log (Application) for any errors related to IPY.
Update If you have no error recorded, try running another .Net program to see if it is a general problem. Uninstalling the Framework and reinstalling the Framework would be the next step to try.
Cheers,
Davy
| 0 | 0 | 0 | 0 |
2009-05-30T06:13:00.000
| 3 | 0 | false | 929,141 | 1 | 0 | 1 | 3 |
I installed ironpython 2.0 in the windows xp professional box and it requires .Net framework 2.0 service pack 2 or later. The windows box has it. But still the console disappears. There is issue in either of them.
Need help?
|
Equivalent for Python's lambda functions in Java?
| 41,144,957 | 1 | 23 | 12,221 | 0 |
java,python,function,lambda
|
With the release of Java 8, lambda-expression is now available.
And the lambda function in java is actually "more powerful" than the python ones.
In Python, lambda-expression may only have a single expression for its body, and no return statement is permitted. In Java, you can do something like this: (int a, int b) -> { return a * b; }; and other optional things as well.
Java 8 also introduces another interface called the Function Interface. You might want to check that out as well.
| 0 | 0 | 0 | 1 |
2009-05-30T15:49:00.000
| 7 | 0.028564 | false | 929,988 | 0 | 0 | 1 | 1 |
Can someone please tell me if there is an equivalent for Python's lambda functions in Java?
|
Is there a Python equivalent to the PHP function htmlspecialchars()?
| 931,442 | -1 | 20 | 12,591 | 0 |
php,python,html-entities,htmlspecialchars
|
If you are using django 1.0 then your template variables will already be encoded and ready for display. You also use the safe operator {{ var|safe }} if you don't want it globally turned on.
| 0 | 0 | 0 | 1 |
2009-05-31T05:58:00.000
| 8 | -0.024995 | false | 931,423 | 1 | 0 | 1 | 1 |
Is there a similar or equivalent function in Python to the PHP function htmlspecialchars()? The closest thing I've found so far is htmlentitydefs.entitydefs().
|
Different styles for Windows forms in Ironpython
| 931,629 | 0 | 0 | 706 | 0 |
winforms,ironpython
|
As an interface designer, it's important to use an many standard windows controls as possible. The more your app looks like the microsoft ones users are used to, they will become more comfortable with it quicker.
A good example is how out of place iTunes and Safari look in windows. My tip is to just keep it with the windows look.
| 1 | 0 | 0 | 0 |
2009-05-31T07:44:00.000
| 2 | 0 | false | 931,580 | 0 | 0 | 1 | 1 |
I want to change the look of my Ironpython windows forms, Is it possible to change the style of the form and for example make it more like a Mac?
thank you
|
Packaging script source files in IronPython and IronRuby
| 933,988 | 0 | 3 | 520 | 0 |
c#,python,ruby,ironpython,ironruby
|
IronPython 2.0 has a sample compiler called PYC on Codeplex.com/ironpython which can create DLL's (and applications if you need them too).
IronPython 2.6 has a newer version of PYC under Tools\script.
Cheers,
Davy
| 0 | 0 | 0 | 1 |
2009-06-01T07:14:00.000
| 3 | 0 | false | 933,822 | 0 | 0 | 1 | 2 |
Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find the embedded resources?
|
Packaging script source files in IronPython and IronRuby
| 934,609 | 1 | 3 | 520 | 0 |
c#,python,ruby,ironpython,ironruby
|
You could add custom import hook that looks for embedded resources when an import is executed. This is slightly complex and probably not worth the trouble.
A better technique would be to fetch all of the embedded modules at startup time, execute them with the ScriptEngine and put the modules you have created into the sys.modules dictionary associated with the engine. This automatically makes them available for import by Python code executed by the engine.
| 0 | 0 | 0 | 1 |
2009-06-01T07:14:00.000
| 3 | 0.066568 | false | 933,822 | 0 | 0 | 1 | 2 |
Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find the embedded resources?
|
How does Spring for Python compare with Spring for Java
| 10,500,205 | 0 | 18 | 16,197 | 0 |
java,python,spring
|
Good stuff. I have used Spring Java, Spring Dot Net and now starting with Spring Python. Python has always been pretty easy to use for programmers; I think, especially since it's easy to write. I found Spring Dot Net to be a bit confusing, but both Spring Java and Python seem to be similar. I'm sure they have their differences, but so far at least I'm not all so confused with the Python implementation of Spring.
| 0 | 0 | 0 | 0 |
2009-06-02T16:39:00.000
| 3 | 0 | false | 940,564 | 0 | 0 | 1 | 1 |
I am an avid fan of the Spring framework for Java (by Rod Johnson).
I am learning Python and was excited to find about Spring for Python.
I would be interested in hearing the community's views on the comparison of
these two flavours of Spring. How well does it fit Python's paradigms etc.
|
How to construct a web file browser?
| 943,612 | 0 | 2 | 552 | 0 |
javascript,python,html,web-applications
|
set "Indexes" option to the directory in the apache config.
To learn how to build webapps in python, learn django.
| 0 | 0 | 1 | 0 |
2009-06-02T20:11:00.000
| 4 | 0 | false | 941,638 | 0 | 0 | 1 | 2 |
Goal: simple browser app, for navigating files on a web server, in a tree view.
Background: Building a web site as a learning experience, w/ Apache, mod_python, Python code. (No mod_wsgi yet.)
What tools should I learn to write the browser tree? I see JavaScript, Ajax, neither of which I know. Learn them? Grab a JS example from the web and rework? Can such a thing be built in raw HTML? Python I'm advanced beginner but I realize that's server side.
If you were going to build such a toy from scratch, what would you use? What would be the totally easy, cheesy way, the intermediate way, the fully professional way?
No Django yet please -- This is an exercise in learning web programming nuts and bolts.
|
How to construct a web file browser?
| 941,664 | 1 | 2 | 552 | 0 |
javascript,python,html,web-applications
|
If you want to make interactive browser, you have to learn JS and ajax.
If you want to build only browser based on links, python would be enough.
| 0 | 0 | 1 | 0 |
2009-06-02T20:11:00.000
| 4 | 0.049958 | false | 941,638 | 0 | 0 | 1 | 2 |
Goal: simple browser app, for navigating files on a web server, in a tree view.
Background: Building a web site as a learning experience, w/ Apache, mod_python, Python code. (No mod_wsgi yet.)
What tools should I learn to write the browser tree? I see JavaScript, Ajax, neither of which I know. Learn them? Grab a JS example from the web and rework? Can such a thing be built in raw HTML? Python I'm advanced beginner but I realize that's server side.
If you were going to build such a toy from scratch, what would you use? What would be the totally easy, cheesy way, the intermediate way, the fully professional way?
No Django yet please -- This is an exercise in learning web programming nuts and bolts.
|
Publish feeds using Django
| 1,095,528 | 0 | 0 | 619 | 0 |
python,django,rss
|
I've been banging my head against this one for a while. It seems that the django rss system need a "datetime" object instead of just the date (since it wants a time zone, and the date object doesn't have a time, let alone a time zone...)
I might be wrong though, but it's something that I've found via the error logs.
| 0 | 0 | 0 | 0 |
2009-06-03T14:12:00.000
| 3 | 1.2 | true | 945,001 | 0 | 0 | 1 | 1 |
I'm publishing a feed from a Django application.
I subclassed django.contrib.syndication.feeds.Feed, everything works fine, except the date that doesn't get published on the feed.
Here's the method I've created on my Feed class
def item_pubdate(self, item):
return item.date
this method never gets called....
|
How to I reload global vars on every page refresh in DJango
| 947,486 | 6 | 0 | 371 | 0 |
python,django
|
Simple: Don't use global objects.
If you want an object inside the view, instantiate it inside the view, not as global. That way it will be collected after the view ends.
| 0 | 0 | 0 | 0 |
2009-06-03T21:43:00.000
| 1 | 1 | false | 947,436 | 0 | 0 | 1 | 1 |
Here is my problem. DJango continues to store all the global objects after the first run of a script. For instance, an object you instantiate in views.py globally will be there until you restart the app server. This is fine unless your object is tied to some outside resource that may time out. Now the way I was thinking to correct was some sort of factory method that checks if the object is instantiated and creates it if it's not, and then returns it. However, the this fails because the object exists there since the last page request, so a factory method is always returning the object that was instantiated during the first request.
What I am looking for is a way to trigger something to happen on a per request basis. I have seen ways of doing this by implementing your own middleware, but I think that is overkill. Does anyone know of some reserved methods or some other per request trigger.
|
method for creating a unique validation key/number
| 948,500 | 0 | 2 | 1,123 | 0 |
python,django,validation
|
Well, you can always use a GUID. As you said it would be stored as a valid key.
| 0 | 0 | 0 | 0 |
2009-06-04T03:42:00.000
| 3 | 0 | false | 948,493 | 0 | 0 | 1 | 1 |
I'm using django for a web-magazine with subscriber-content. when a user purchases a subscription, the site will create a validation key, and send it to the user email address.
The validation key would be added to a list of "valid keys" until it is used.
What is the best method for creating a simple yet unique key? Can someone suggest a standard python library for key-creation/validation/ect?
This might be a very simple question, but I'm very new. ;)
|
Use Django Framework with Website and Stand-alone App
| 950,874 | 4 | 1 | 1,344 | 0 |
python,django
|
Yes, you can use the same database.
Some people use Django on top of a PHP application for its admin functionality, or to build newer features with Django and its ORM.
What I'm trying to say is that if you're putting data from your crawl into the same place that you will let Django store its data, you can access them as long as you create Django models for each table.
However, I don't see why the crawler can't be written within Django itself. I've written some non web based apps (a crawler and an aggregator) in Django and it works quite well.
| 0 | 0 | 0 | 0 |
2009-06-04T14:03:00.000
| 2 | 0.379949 | false | 950,790 | 0 | 0 | 1 | 1 |
I'm planning on writing a web crawler and a web-based front end for it (or, at least, the information it finds). I was wondering if it's possible to use the Django framework to let the web crawler use the same MySQL backend as the website (without making the web crawler a "website" in it's self).
|
mounting an s3 bucket in ec2 and using transparently as a mnt point
| 6,308,720 | 0 | 4 | 8,589 | 1 |
python,django,amazon-s3,amazon-ec2
|
I'd suggest using a separately-mounted EBS volume. I tried doing the same thing for some movie files. Access to S3 was slow, and S3 has some limitations like not being able to rename files, no real directory structure, etc.
You can set up EBS volumes in a RAID5 configuration and add space as you need it.
| 0 | 1 | 0 | 0 |
2009-06-05T16:39:00.000
| 5 | 0 | false | 956,904 | 0 | 0 | 1 | 1 |
I have a webapp (call it myapp.com) that allows users to upload files. The webapp will be deployed on Amazon EC2 instance. I would like to serve these files back out to the webapp consumers via an s3 bucket based domain (i.e. uploads.myapp.com).
When the user uploads the files, I can easily drop them in into a folder called "site_uploads" on the local ec2 instance. However, since my ec2 instance has finite storage, with a lot of uploads, the ec2 file system will fill up quickly.
It would be great if the ec2 instance could mount and s3 bucket as the "site_upload" directory. So that uploads to the EC2 "site_upload" directory automatically end up on uploads.myapp.com (and my webapp can use template tags to make sure the links for this uploaded content is based on that s3 backed domain). This also gives me scalable file serving, as request for files hits s3 and not my ec2 instance. Also, it makes it easy for my webapp to perform scaling/resizing of the images that appear locally in "site_upload" but are actually on s3.
I'm looking at s3fs, but judging from the comments, it doesn't look like a fully baked solution. I'm looking for a non-commercial solution.
FYI, The webapp is written in django, not that that changes the particulars too much.
|
How can I create a variable that is scoped to a single request in app engine?
| 972,243 | 2 | 0 | 211 | 0 |
python,google-app-engine
|
If you're using the 'webapp' framework included with App Engine (or, actually, most other WSGI-baesd frameworks), a new RequestHandler is instantiated for each request. Thus, you can use class variables on your handler class to store per-request data.
| 0 | 1 | 0 | 0 |
2009-06-08T00:08:00.000
| 4 | 0.099668 | false | 963,080 | 0 | 0 | 1 | 3 |
I'm creating a python app for google app engine and I've got a performance problem with some expensive operations that are repetitive within a single request. To help deal with this I'd like to create a sort of mini-cache that's scoped to a single request. This is as opposed to a session-wide or application-wide cache, neither of which would make sense for my particular problem.
I thought I could just use a python global or module-level variable for this, but it turns out that those maintain their state between requests in non-obvious ways.
I also don't think memcache makes sense because it's application wide.
I haven't been able to find a good answer for this in google's docs. Maybe that's because it's either a dumb idea or totally obvious, but it seems like it'd be useful and I'm stumped.
Anybody have any ideas?
|
How can I create a variable that is scoped to a single request in app engine?
| 963,706 | 0 | 0 | 211 | 0 |
python,google-app-engine
|
use local list to store data and do a model.put at end of your request processing. save multiple db trips
| 0 | 1 | 0 | 0 |
2009-06-08T00:08:00.000
| 4 | 0 | false | 963,080 | 0 | 0 | 1 | 3 |
I'm creating a python app for google app engine and I've got a performance problem with some expensive operations that are repetitive within a single request. To help deal with this I'd like to create a sort of mini-cache that's scoped to a single request. This is as opposed to a session-wide or application-wide cache, neither of which would make sense for my particular problem.
I thought I could just use a python global or module-level variable for this, but it turns out that those maintain their state between requests in non-obvious ways.
I also don't think memcache makes sense because it's application wide.
I haven't been able to find a good answer for this in google's docs. Maybe that's because it's either a dumb idea or totally obvious, but it seems like it'd be useful and I'm stumped.
Anybody have any ideas?
|
How can I create a variable that is scoped to a single request in app engine?
| 963,107 | 1 | 0 | 211 | 0 |
python,google-app-engine
|
Module variables may (or may not) persist between requests (the same app instance may or may not stay alive between requests), but you can explicitly clear them (del, or set to None, say) at the start of your handling a request, or when you know you're done with one. At worst (if your code is peculiarly organized) you need to set some function to always execute at every request start, or at every request end.
| 0 | 1 | 0 | 0 |
2009-06-08T00:08:00.000
| 4 | 0.049958 | false | 963,080 | 0 | 0 | 1 | 3 |
I'm creating a python app for google app engine and I've got a performance problem with some expensive operations that are repetitive within a single request. To help deal with this I'd like to create a sort of mini-cache that's scoped to a single request. This is as opposed to a session-wide or application-wide cache, neither of which would make sense for my particular problem.
I thought I could just use a python global or module-level variable for this, but it turns out that those maintain their state between requests in non-obvious ways.
I also don't think memcache makes sense because it's application wide.
I haven't been able to find a good answer for this in google's docs. Maybe that's because it's either a dumb idea or totally obvious, but it seems like it'd be useful and I'm stumped.
Anybody have any ideas?
|
Can't seem to get list() working
| 965,860 | 0 | 0 | 275 | 0 |
python,django,google-app-engine,list
|
There is no specific change "inherent" in appengine with respect to common aspects like lists. It is as just the same, plain python.
| 0 | 0 | 0 | 0 |
2009-06-08T08:47:00.000
| 3 | 0 | false | 963,932 | 1 | 0 | 1 | 1 |
I am trying to convert a set object to list...for example "p=list('abc')" is not working.
any ideas or is it inherent in appengine
|
What's the official way of storing settings for Python programs?
| 966,074 | 12 | 65 | 43,088 | 0 |
python,settings
|
Just one more option, PyQt. Qt has a platform independent way of storing settings with the QSettings class. Underneath the hood, on windows it uses the registry and in linux it stores the settings in a hidden conf file. QSettings works very well and is pretty seemless.
| 0 | 0 | 0 | 0 |
2009-06-08T16:13:00.000
| 13 | 1 | false | 965,694 | 1 | 0 | 1 | 6 |
Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another?
|
What's the official way of storing settings for Python programs?
| 965,795 | 35 | 65 | 43,088 | 0 |
python,settings
|
Depends on the predominant intended audience.
If it is programmers who change the file anyway, just use python files like settings.py
If it is end users then, think about ini files.
| 0 | 0 | 0 | 0 |
2009-06-08T16:13:00.000
| 13 | 1.2 | true | 965,694 | 1 | 0 | 1 | 6 |
Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another?
|
What's the official way of storing settings for Python programs?
| 965,733 | -1 | 65 | 43,088 | 0 |
python,settings
|
why would Guido blessed something that is out of his scope? No there is nothing particular blessed.
| 0 | 0 | 0 | 0 |
2009-06-08T16:13:00.000
| 13 | -0.015383 | false | 965,694 | 1 | 0 | 1 | 6 |
Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another?
|
What's the official way of storing settings for Python programs?
| 965,742 | 0 | 65 | 43,088 | 0 |
python,settings
|
It is more of convenience. There is no official way per say. But using XML files would make sense as they can be manipulated by various other applications/libraries.
| 0 | 0 | 0 | 0 |
2009-06-08T16:13:00.000
| 13 | 0 | false | 965,694 | 1 | 0 | 1 | 6 |
Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another?
|
What's the official way of storing settings for Python programs?
| 965,913 | 4 | 65 | 43,088 | 0 |
python,settings
|
It depends largely on how complicated your configuration is. If you're doing a simple key-value mapping and you want the capability to edit the settings with a text editor, I think ConfigParser is the way to go.
If your settings are complicated and include lists and nested data structures, I'd use XML or JSON and create a configuration editor.
For really complicated things where the end user isn't expected to change the settings much, or is more trusted, just create a set of Python classes and evaluate a Python script to get the configuration.
| 0 | 0 | 0 | 0 |
2009-06-08T16:13:00.000
| 13 | 0.061461 | false | 965,694 | 1 | 0 | 1 | 6 |
Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another?
|
What's the official way of storing settings for Python programs?
| 965,730 | 6 | 65 | 43,088 | 0 |
python,settings
|
I am not sure that there is an 'official' way (it is not mentioned in the Zen of Python :) )- I tend to use the Config Parser module myself and I think that you will find that pretty common. I prefer that over the python file approach because you can write back to it and dynamically reload if you want.
| 0 | 0 | 0 | 0 |
2009-06-08T16:13:00.000
| 13 | 1 | false | 965,694 | 1 | 0 | 1 | 6 |
Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another?
|
Eclipse + local CVS + PyDev
| 969,236 | 1 | 4 | 2,673 | 0 |
python,eclipse,cvs,pydev
|
I tried Eclipse+Subclipse and Eclipse+Bazaar plugin. Both work very well, but I have found that Tortoise versions of those version source control tools are so good that I resigned from Eclipse plugins. On Windows Tortoise XXX are my choice. They integrate with shell (Explorer or TotalCommander), changes icon overlay if file is changed, shows log, compare revisions etc. etc.
| 0 | 1 | 0 | 0 |
2009-06-09T09:43:00.000
| 8 | 0.024995 | false | 969,121 | 1 | 0 | 1 | 4 |
I tried several Python IDEs (on Windows platform) but finally I found only Eclipse + PyDev meeting my needs. This set of tools is really comfortable and easy to use. I'm currently working on a quite bigger project. I'd like to have a possibility to use CVS or any other version control system which would be installed on my local harddrive (I recently moved my house and don't have yet an access to internet.)
It doesn't matter for me if it'd be CVS - can also be any other version control system. It'd be great if it will be not too hard to configure with Eclipse. Can anyone give me some possible solution? Any hints?
Regards and thanks in advance for any clues. Please forgive my English ;)
|
Eclipse + local CVS + PyDev
| 969,642 | 4 | 4 | 2,673 | 0 |
python,eclipse,cvs,pydev
|
Last time I tried this, Eclipse did not support direct access to local repositories in the same way that command line cvs does because command line cvs has both client and server functionality whereas Eclipse only has client functionality and needs to go through (e.g.) pserver, so you would probably need to have a cvs server running.
Turns out that I didn't really need it anyway as Eclipse keeps its own history of all changes so I only needed to do an occasional manual update to cvs at major milestones.
[Eventually I decided not to use cvs at all with Eclipse under Linux as it got confused by symlinks and started deleting my include files when it "synchronised" with the repository.]
| 0 | 1 | 0 | 0 |
2009-06-09T09:43:00.000
| 8 | 1.2 | true | 969,121 | 1 | 0 | 1 | 4 |
I tried several Python IDEs (on Windows platform) but finally I found only Eclipse + PyDev meeting my needs. This set of tools is really comfortable and easy to use. I'm currently working on a quite bigger project. I'd like to have a possibility to use CVS or any other version control system which would be installed on my local harddrive (I recently moved my house and don't have yet an access to internet.)
It doesn't matter for me if it'd be CVS - can also be any other version control system. It'd be great if it will be not too hard to configure with Eclipse. Can anyone give me some possible solution? Any hints?
Regards and thanks in advance for any clues. Please forgive my English ;)
|
Eclipse + local CVS + PyDev
| 976,961 | 0 | 4 | 2,673 | 0 |
python,eclipse,cvs,pydev
|
I recently moved my house and don't have yet an access to internet.
CVS and SVN are the Centralized Version control systems. Rather than having to install them on your local system just for single version control, you could use DVCS like Mercurial or Git.
When you clone a Mercurial Repository, you have literally all versions of all the repo files available locally.
| 0 | 1 | 0 | 0 |
2009-06-09T09:43:00.000
| 8 | 0 | false | 969,121 | 1 | 0 | 1 | 4 |
I tried several Python IDEs (on Windows platform) but finally I found only Eclipse + PyDev meeting my needs. This set of tools is really comfortable and easy to use. I'm currently working on a quite bigger project. I'd like to have a possibility to use CVS or any other version control system which would be installed on my local harddrive (I recently moved my house and don't have yet an access to internet.)
It doesn't matter for me if it'd be CVS - can also be any other version control system. It'd be great if it will be not too hard to configure with Eclipse. Can anyone give me some possible solution? Any hints?
Regards and thanks in advance for any clues. Please forgive my English ;)
|
Eclipse + local CVS + PyDev
| 969,134 | 1 | 4 | 2,673 | 0 |
python,eclipse,cvs,pydev
|
If you don't mind a switch to Subversion, Eclipse has its SubClipse plugin.
| 0 | 1 | 0 | 0 |
2009-06-09T09:43:00.000
| 8 | 0.024995 | false | 969,121 | 1 | 0 | 1 | 4 |
I tried several Python IDEs (on Windows platform) but finally I found only Eclipse + PyDev meeting my needs. This set of tools is really comfortable and easy to use. I'm currently working on a quite bigger project. I'd like to have a possibility to use CVS or any other version control system which would be installed on my local harddrive (I recently moved my house and don't have yet an access to internet.)
It doesn't matter for me if it'd be CVS - can also be any other version control system. It'd be great if it will be not too hard to configure with Eclipse. Can anyone give me some possible solution? Any hints?
Regards and thanks in advance for any clues. Please forgive my English ;)
|
users module errors in Google App Engine
| 14,879,943 | 1 | 1 | 444 | 0 |
python,google-app-engine
|
Actually not my answer, but from the OP, that didn't act on S. Lott's comment:
It works now! but I didnt change anything actually, seems like Google need time to update its database for app engine. like 20 mins.
| 0 | 1 | 0 | 0 |
2009-06-09T12:48:00.000
| 1 | 0.197375 | false | 969,877 | 0 | 0 | 1 | 1 |
I want to use user service of my domain in google App, but...
Is it possible to solve this problem by my side?
Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 501, in __call__
handler.get(*groups)
File "/base/data/home/apps/myapp2009/1.334081739634584397/helloworld.py", line 13, in get
self.redirect(users.create_login_url(self.request.uri))
File "/base/python_lib/versions/1/google/appengine/api/users.py", line 176, in create_login_url
raise NotAllowedError
NotAllowedError
|
Threads in Java and Python
| 971,025 | 0 | 6 | 2,528 | 0 |
java,python,multithreading
|
Just a sidestep about point 1 here, because Java Thread priorities might not work as one would expect.
From the SCJP guide:
Because thread-scheduling priority behaviour is not guaranteed, use thread priorities as a way to improve the efficiency of your program, but just be sure your program doesn't depend on that behaviour for correctness.
| 0 | 0 | 0 | 0 |
2009-06-09T15:49:00.000
| 6 | 0 | false | 970,909 | 1 | 0 | 1 | 1 |
i have few questions about threads in Python and Java...
Is it possible to give priorities to Python threads, as it is in Java?
How can I kill, stop, suspend and interrupt thread in Python?
Thread groups - what are they really for? Does Python support them too?
Synchronization - in Java we use simply keyword synchorinized for a method, object...What about Python?
Tnx!
|
Django - Website Home Page
| 972,004 | 11 | 20 | 11,919 | 0 |
python,django
|
There's no real rule for this, But one thing I like to do is actually arrange for the index access to redirect to another spot. If you prefer, though, you can just give the index page a plain view.
That said, It's probably a good idea to keep all your code in an actual app, so that you can refactor it more easily, and so that it appears on the python path as a normal module. Putting views in the project rather than an app seems to cause more headaches than it solves.
| 0 | 0 | 0 | 0 |
2009-06-09T19:18:00.000
| 3 | 1.2 | true | 971,983 | 0 | 0 | 1 | 1 |
I've been having a look at Django and, from what I've seen, it's pretty darn fantastic. I'm a little confused, however, how I go about implementing a "home page" for my website? Would it be a separate app, or just a view within the project, or what?
|
wget Vs urlretrieve of python
| 975,759 | 0 | 9 | 37,225 | 0 |
python,urllib2,wget
|
There shouldn't be a difference really. All urlretrieve does is make a simple HTTP GET request. Have you taken out your data processing code and done a straight throughput comparison of wget vs. pure python?
| 0 | 0 | 1 | 0 |
2009-06-10T10:18:00.000
| 10 | 0 | false | 974,741 | 0 | 0 | 1 | 5 |
I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size.
The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec.
But, just to play around I was also using python to build my urlparser.
Downloading via Python's urlretrieve is damm slow, possible 4 times as slow as wget. The download rate is 500kb/sec. I use HTMLParser for parsing the href tags.
I am not sure why is this happening. Are there any settings for this.
Thanks
|
wget Vs urlretrieve of python
| 976,135 | 0 | 9 | 37,225 | 0 |
python,urllib2,wget
|
Please show us some code. I'm pretty sure that it has to be with the code and not on urlretrieve.
I've worked with it in the past and never had any speed related issues.
| 0 | 0 | 1 | 0 |
2009-06-10T10:18:00.000
| 10 | 0 | false | 974,741 | 0 | 0 | 1 | 5 |
I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size.
The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec.
But, just to play around I was also using python to build my urlparser.
Downloading via Python's urlretrieve is damm slow, possible 4 times as slow as wget. The download rate is 500kb/sec. I use HTMLParser for parsing the href tags.
I am not sure why is this happening. Are there any settings for this.
Thanks
|
wget Vs urlretrieve of python
| 2,350,655 | 0 | 9 | 37,225 | 0 |
python,urllib2,wget
|
You can use wget -k to engage relative links in all urls.
| 0 | 0 | 1 | 0 |
2009-06-10T10:18:00.000
| 10 | 0 | false | 974,741 | 0 | 0 | 1 | 5 |
I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size.
The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec.
But, just to play around I was also using python to build my urlparser.
Downloading via Python's urlretrieve is damm slow, possible 4 times as slow as wget. The download rate is 500kb/sec. I use HTMLParser for parsing the href tags.
I am not sure why is this happening. Are there any settings for this.
Thanks
|
wget Vs urlretrieve of python
| 7,782,898 | 1 | 9 | 37,225 | 0 |
python,urllib2,wget
|
Since python suggests using urllib2 instead of urllib, I take a test between urllib2.urlopen and wget.
The result is, it takes nearly the same time for both of them to download the same file.Sometimes, urllib2 performs even better.
The advantage of wget lies in a dynamic progress bar to show the percent finished and the current download speed when transferring.
The file size in my test is 5MB.I haven't used any cache module in python and I am not aware of how wget works when downloading big size file.
| 0 | 0 | 1 | 0 |
2009-06-10T10:18:00.000
| 10 | 0.019997 | false | 974,741 | 0 | 0 | 1 | 5 |
I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size.
The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec.
But, just to play around I was also using python to build my urlparser.
Downloading via Python's urlretrieve is damm slow, possible 4 times as slow as wget. The download rate is 500kb/sec. I use HTMLParser for parsing the href tags.
I am not sure why is this happening. Are there any settings for this.
Thanks
|
wget Vs urlretrieve of python
| 974,809 | 1 | 9 | 37,225 | 0 |
python,urllib2,wget
|
Maybe you can wget and then inspect the data in Python?
| 0 | 0 | 1 | 0 |
2009-06-10T10:18:00.000
| 10 | 0.019997 | false | 974,741 | 0 | 0 | 1 | 5 |
I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size.
The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec.
But, just to play around I was also using python to build my urlparser.
Downloading via Python's urlretrieve is damm slow, possible 4 times as slow as wget. The download rate is 500kb/sec. I use HTMLParser for parsing the href tags.
I am not sure why is this happening. Are there any settings for this.
Thanks
|
python not starting properly
| 974,834 | 1 | 0 | 139 | 0 |
python,windows,django-admin
|
you can't run a command that isn't in your path. it should be set globally when you installed python.
type 'set' at a dos prompt and look at the PATH variable. c:\python25 (or whever you installed python) has to be in that variable ie PATH=c:\windows;c:\python25;... etc
if it isn't in PATH then you or the installer missed the part where you needed to set it. It can be done from the 'Environment Variables' button in the 'System' control panel.
| 0 | 0 | 0 | 0 |
2009-06-10T10:42:00.000
| 4 | 0.049958 | false | 974,821 | 1 | 0 | 1 | 3 |
I have installed python and django in my system that uses win vista. Now when I go to command prompt and type python or django-admin.py both are not working. Every time I need to set the path to the python folder manually. But i have seen these commands running even without setting path. So how do i make it to run properly?
|
python not starting properly
| 974,848 | 0 | 0 | 139 | 0 |
python,windows,django-admin
|
Either use the system control panel to set the PATH environment variable that applies permanently or
Reinstall Python as a system administrator so that the installer can set the registry and environment variables for you.
If you install the "just for me" option, then you have to set the PATH variable in the control panel.
| 0 | 0 | 0 | 0 |
2009-06-10T10:42:00.000
| 4 | 1.2 | true | 974,821 | 1 | 0 | 1 | 3 |
I have installed python and django in my system that uses win vista. Now when I go to command prompt and type python or django-admin.py both are not working. Every time I need to set the path to the python folder manually. But i have seen these commands running even without setting path. So how do i make it to run properly?
|
python not starting properly
| 975,292 | 0 | 0 | 139 | 0 |
python,windows,django-admin
|
In your path, I think you need to have both the location of the Python install and the Python\Scripts folder. For example, on XP, I have C:\Python25;C:\Python25\Scripts. Can you verify that you have both?
| 0 | 0 | 0 | 0 |
2009-06-10T10:42:00.000
| 4 | 0 | false | 974,821 | 1 | 0 | 1 | 3 |
I have installed python and django in my system that uses win vista. Now when I go to command prompt and type python or django-admin.py both are not working. Every time I need to set the path to the python folder manually. But i have seen these commands running even without setting path. So how do i make it to run properly?
|
Thinking in AppEngine
| 979,391 | 1 | 6 | 1,022 | 1 |
java,python,google-app-engine,data-modeling
|
The non relational database design essentially involves denormalization wherever possible.
Example: Since the BigTable doesnt provide enough aggregation features, the sum(cash) option that would be in the RDBMS world is not available. Instead it would have to be stored on the model and the model save method must be overridden to compute the denormalized field sum.
Essential basic design that comes to mind is that each template has its own model where all the required fields to be populated are present denormalized in the corresponding model; and you have an entire signals-update-bots complexity going on in the models.
| 0 | 1 | 0 | 0 |
2009-06-10T16:13:00.000
| 4 | 0.049958 | false | 976,639 | 0 | 0 | 1 | 2 |
I'm looking for resources to help migrate my design skills from traditional RDBMS data store over to AppEngine DataStore (ie: 'Soft Schema' style). I've seen several presentations and all touch on the the overarching themes and some specific techniques.
I'm wondering if there's a place we could pool knowledge from experience ("from the trenches") on real-world approaches to rethinking how data is structured, especially porting existing applications. We're heavily Hibernate based and have probably travelled a bit down the wrong path with our data model already, generating some gnarly queries which our DB is struggling with.
Please respond if:
You have ported a non-trivial application over to AppEngine
You've created a common type of application from scratch in AppEngine
You've done neither 1 or 2, but are considering it and want to share your own findings so far.
|
Thinking in AppEngine
| 978,757 | 1 | 6 | 1,022 | 1 |
java,python,google-app-engine,data-modeling
|
The timeouts are tight and performance was ok but not great, so I found myself using extra space to save time; for example I had a many-to-many relationship between trading cards and players, so I duplicated the information of who owns what: Card objects have a list of Players and Player objects have a list of Cards.
Normally storing all your information twice would have been silly (and prone to get out of sync) but it worked really well.
In Python they recently released a remote API so you can get an interactive shell to the datastore so you can play with your datastore without any timeouts or limits (for example, you can delete large swaths of data, or refactor your models); this is fantastically useful since otherwise as Julien mentioned it was very difficult to do any bulk operations.
| 0 | 1 | 0 | 0 |
2009-06-10T16:13:00.000
| 4 | 0.049958 | false | 976,639 | 0 | 0 | 1 | 2 |
I'm looking for resources to help migrate my design skills from traditional RDBMS data store over to AppEngine DataStore (ie: 'Soft Schema' style). I've seen several presentations and all touch on the the overarching themes and some specific techniques.
I'm wondering if there's a place we could pool knowledge from experience ("from the trenches") on real-world approaches to rethinking how data is structured, especially porting existing applications. We're heavily Hibernate based and have probably travelled a bit down the wrong path with our data model already, generating some gnarly queries which our DB is struggling with.
Please respond if:
You have ported a non-trivial application over to AppEngine
You've created a common type of application from scratch in AppEngine
You've done neither 1 or 2, but are considering it and want to share your own findings so far.
|
Is it more efficient to parse external XML or to hit the database?
| 978,590 | 3 | 1 | 856 | 0 |
python,mysql,xml,django,parsing
|
Consuming the webservices is more efficient because there are a lot more things you can do to scale your webservices and webserver (via caching, etc.). By consuming the middle layer, you also have the options to change the returned data format (e.g. you can decide to use JSON rather than XML). Scaling database is much harder (involving replication, etc.) so in general, reduce hits on DB if you can.
| 0 | 0 | 1 | 0 |
2009-06-10T23:09:00.000
| 9 | 0.066568 | false | 978,581 | 0 | 0 | 1 | 9 |
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
|
Is it more efficient to parse external XML or to hit the database?
| 978,717 | 0 | 1 | 856 | 0 |
python,mysql,xml,django,parsing
|
It depends from case to case, you'll have to measure (or at least make an educated guess).
You'll have to consider several things.
Web service
it might hit database itself
it can be cached
it will introduce network latency and might be unreliable
or it could be in local network and faster than accessing even local disk
DB
might be slow since it needs to access disk (although databases have internal caches, but those are usually not targeted)
should be reliable
Technology itself doesn't mean much in terms of speed - in one case database parses SQL, in other XML parser parses XML, and database is usually acessed via socket as well, so you have both parsing and network in either case.
Caching data in your application if applicable is probably a good idea.
| 0 | 0 | 1 | 0 |
2009-06-10T23:09:00.000
| 9 | 0 | false | 978,581 | 0 | 0 | 1 | 9 |
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
|
Is it more efficient to parse external XML or to hit the database?
| 978,603 | 1 | 1 | 856 | 0 |
python,mysql,xml,django,parsing
|
There is not enough information to be able to say for sure in the general case. Why don't you do some tests and find out? Since it sounds like you are using python you will probably want to use the timeit module.
Some things that could effect the result:
Performance of the web service you are using
Reliability of the web service you are using
Distance between servers
Amount of data being returned
I would guess that if it is cacheable, that a cached version of the data will be faster, but that does not necessarily mean using a local RDBMS, it might mean something like memcached or an in memory cache in your application.
| 0 | 0 | 1 | 0 |
2009-06-10T23:09:00.000
| 9 | 0.022219 | false | 978,581 | 0 | 0 | 1 | 9 |
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
|
Is it more efficient to parse external XML or to hit the database?
| 978,773 | 0 | 1 | 856 | 0 |
python,mysql,xml,django,parsing
|
As a few people have said, it depends, and you should test it.
Often external services are slow, and caching them locally (in a database in memory, e.g., with memcached) is faster. But perhaps not.
Fortunately, it's cheap and easy to test.
| 0 | 0 | 1 | 0 |
2009-06-10T23:09:00.000
| 9 | 0 | false | 978,581 | 0 | 0 | 1 | 9 |
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
|
Is it more efficient to parse external XML or to hit the database?
| 979,028 | -1 | 1 | 856 | 0 |
python,mysql,xml,django,parsing
|
It sounds like you essentially want to cache results, and are wondering if it's worth it. But if so, I would NOT use a database (I assume you are thinking of a relational DB): RDBMSs are not good for caching; even though many use them. You don't need persistence nor ACID.
If choice was between Oracle/MySQL and external web service, I would start with just using service.
Instead, consider real caching systems; local or not (memcache, simple in-memory caches etc).
Or if you must use a DB, use key/value store, BDB works well. Store response message in its serialized form (XML), try to fetch from cache, if not, from service, parse. Or if there's a convenient and more compact serialization, store and fetch that.
| 0 | 0 | 1 | 0 |
2009-06-10T23:09:00.000
| 9 | -0.022219 | false | 978,581 | 0 | 0 | 1 | 9 |
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
|
Is it more efficient to parse external XML or to hit the database?
| 978,864 | 0 | 1 | 856 | 0 |
python,mysql,xml,django,parsing
|
Test definitely. As a rule of thumb, XML is good for communicating between apps, but once you have the data inside of your app, everything should go into a database table. This may not apply in all cases, but 95% of the time it has for me. Anytime I ever tried to store data any other way (ex. XML in a content management system) I ended up wishing I would have just used good old sprocs and sql server.
| 0 | 0 | 1 | 0 |
2009-06-10T23:09:00.000
| 9 | 0 | false | 978,581 | 0 | 0 | 1 | 9 |
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
|
Is it more efficient to parse external XML or to hit the database?
| 978,857 | 4 | 1 | 856 | 0 |
python,mysql,xml,django,parsing
|
Everyone is being very polite in answering this question: "it depends"... "you should test"... and so forth.
True, the question does not go into great detail about the application and network topographies involved, but if the question is even being asked, then it's likely a) the DB is "local" to the application (on the same subnet, or the same machine, or in memory), and b) the webservice is not. After all, the OP uses the phrases "external service" and "display on your own site." The phrase "parsing it once or however many times you need to each day" also suggests a set of data that doesn't exactly change every second.
The classic SOA myth is that the network is always available; going a step further, I'd say it's a myth that the network is always available with low latency. Unless your own internal systems are crap, sending an HTTP query across the Internet will always be slower than a query to a local DB or DB cluster. There are any number of reasons for this: number of hops to the remote server, outage or degradation issues that you can't control on the remote end, and the internal processing time for the remote web service application to analyze your request, hit its own persistence backend (aka DB), and return a result.
Fire up your app. Do some latency and response times to your DB. Now do the same to a remote web service. Unless your DB is also across the Internet, you'll notice a huge difference.
It's not at all hard for a competent technologist to scale a DB, or for you to completely remove the DB from caching using memcached and other paradigms; the latency between servers sitting near each other in the datacentre is monumentally less than between machines over the Internet (and more secure, to boot). Even if achieving this scale requires some thought, it's under your control, unlike a remote web service whose scaling and latency are totally opaque to you. I, for one, would not be too happy with the idea that the availability and responsiveness of my site are based on someone else entirely.
Finally, what happens if the remote web service is unavailable? Imagine a world where every request to your site involves a request over the Internet to some other site. What happens if that other site is unavailable? Do your users watch a spinning cursor of death for several hours? Do they enjoy an Error 500 while your site borks on this unexpected external dependency?
If you find yourself adopting an architecture whose fundamental features depend on a remote Internet call for every request, think very carefully about your application before deciding if you can live with the consequences.
| 0 | 0 | 1 | 0 |
2009-06-10T23:09:00.000
| 9 | 1.2 | true | 978,581 | 0 | 0 | 1 | 9 |
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
|
Is it more efficient to parse external XML or to hit the database?
| 978,607 | 1 | 1 | 856 | 0 |
python,mysql,xml,django,parsing
|
It depends - who is calling the web service? Is the web service called every time the user hits the page? If that's the case I'd recommend introducing a caching layer of some sort - many web service API's throttle the amount of hits you can make per hour.
Whether you choose to parse the cached XML on the fly or call the data from a database probably won't matter (unless we are talking enterprise scaling here). Personally, I'd much rather make a simple SQL call than write a DOM Parser (which is much more prone to exceptional scenarios).
| 0 | 0 | 1 | 0 |
2009-06-10T23:09:00.000
| 9 | 0.022219 | false | 978,581 | 0 | 0 | 1 | 9 |
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
|
Is it more efficient to parse external XML or to hit the database?
| 978,593 | 6 | 1 | 856 | 0 |
python,mysql,xml,django,parsing
|
First off -- measure. Don't just assume that one is better or worse than the other.
Second, if you really don't want to measure, I'd guess the database is a bit faster (assuming the database is relatively local compared to the web service). Network latency usually is more than parse time unless we're talking a really complex database or really complex XML.
| 0 | 0 | 1 | 0 |
2009-06-10T23:09:00.000
| 9 | 1 | false | 978,581 | 0 | 0 | 1 | 9 |
I was wondering when dealing with a web service API that returns XML, whether it's better (faster) to just call the external service each time and parse the XML (using ElementTree) for display on your site or to save the records into the database (after parsing it once or however many times you need to each day) and make database calls instead for that same information.
|
Vim, Python, and Django autocompletion (pysmell?)
| 10,666,285 | 2 | 48 | 19,878 | 0 |
python,django,vim
|
Today, you not need special extentions for django autocomplete in vim. Make sure that you have vim with python support.
To check it, type in xterm:
vim --version|grep python
output:
+python -python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs ... ...
To make work autocomplete, add this lines in your .vimrc:
autocmd FileType python set omnifunc=pythoncomplete#Complete
if has("python")
python import sys,os
python sys.path.append('/home/sergey/workspace/django')
python os.environ['DJANGO_SETTINGS_MODULE'] = 'djangoProject.settings'
endif
where:
sys.path.append is path to your django workspace directory
djangoProject is name of your django project, which is going just after '/home/sergey/workspace/django'
Finally, save it and restart vim. Now, after '.', you press default ctrl-x ctrl-o to get your autocomplete.
| 0 | 0 | 0 | 0 |
2009-06-10T23:35:00.000
| 5 | 0.07983 | false | 978,643 | 0 | 0 | 1 | 2 |
Does anyone know how to set up auto completion to work nicely with python, django, and vim?
I've been trying to use pysmell, but I can't seem to get it set up correctly (or maybe I don't know how it works). Right now, I run pysmell in the django directory (I'm using the trunk) and move the resulting tags to my project directory, then I also run pysmell in the project directory. Vim doesn't pick up the django tags, though, and they don't get auto completed.
Does anyone know how to set up auto completion in vim so that it will complete the long django functions (like get_object_or_404) as well as classes/functions in my own code? I have poked around on google but haven't found any good resources.
Thanks.
|
Vim, Python, and Django autocompletion (pysmell?)
| 978,766 | 3 | 48 | 19,878 | 0 |
python,django,vim
|
I've had good luck with exuberant-ctags for this.
I use this macro in my vimrc:
execute 'map :!/usr/bin/exuberant-ctags -f '.&tags.' --recurse '.$_P4ROOT.' '
You'll want to modify that slightly, so that it includes your python /site-packages/django/ directory as well as your own code.
Then, hit F2 inside vim to update the tags, and use the regular vim tag bindings to navigate.
| 0 | 0 | 0 | 0 |
2009-06-10T23:35:00.000
| 5 | 0.119427 | false | 978,643 | 0 | 0 | 1 | 2 |
Does anyone know how to set up auto completion to work nicely with python, django, and vim?
I've been trying to use pysmell, but I can't seem to get it set up correctly (or maybe I don't know how it works). Right now, I run pysmell in the django directory (I'm using the trunk) and move the resulting tags to my project directory, then I also run pysmell in the project directory. Vim doesn't pick up the django tags, though, and they don't get auto completed.
Does anyone know how to set up auto completion in vim so that it will complete the long django functions (like get_object_or_404) as well as classes/functions in my own code? I have poked around on google but haven't found any good resources.
Thanks.
|
Finding rendered HTML element positions using WebKit (or Gecko)
| 980,098 | 3 | 2 | 3,938 | 0 |
python,html,perl,rendering,rendering-engine
|
lxml isn't going to help you at all. It isn't concerned about front-end rendering at all.
To accurately work out how something renders, you need to render it. For that you need to hook into a browser, spawn the page and run some JS on the page to find the DOM element and get its attributes.
It's totally possible but I think you should start by looking at how website screenshot factories work (as they'll share 90% of the code you need to get a browser launching and showing the right page).
You may want to still use lxml to inject your javascript into the page.
| 0 | 0 | 0 | 0 |
2009-06-11T08:57:00.000
| 7 | 0.085505 | false | 980,058 | 0 | 0 | 1 | 1 |
I would like to get the dimensions (coordinates) for all the HTML elements of a webpage as they are rendered by a browser, that is the positions they are rendered at. For example, (top-left,top-right,bottom-left,bottom-right)
Could not find this in lxml. So, is there any library in Python that does this? I had also looked at Mechanize::Mozilla in Perl but, that seems difficult to configure/set-up.
I think the best way to do this for my requirement is to use a rendering engine - like WebKit or Gecko.
Are there any perl/python bindings available for the above two rendering engines? Google searches for tutorials on how to "plug-in" to the WebKit rendering engine is not very helpful.
|
Get original path from django filefield
| 981,666 | 2 | 1 | 1,174 | 0 |
python,django,file,forms,field
|
I think that is not possible, most browsers at least firefox3.0 do not allow fullpath to be seen, so even from JavaScript side you can not get full path
If you could get full path you can send it to server, but I think you will have to be satisfied with file name
| 0 | 0 | 0 | 0 |
2009-06-11T14:17:00.000
| 1 | 1.2 | true | 981,371 | 0 | 0 | 1 | 1 |
My django app accepts two files (in this case a jad and jar combo). Is there a way I can preserve the folders they came from?
I need this so I can check later that they came from the same path.
(And later on accept a whole load of files and be able to work out which came from the same folder).
|
Experiences of creating Social Network site in Django
| 990,440 | -1 | 13 | 5,087 | 0 |
python,django
|
Are you saying that a random survey of some posted Django apps (not Django itself) reveals that some people post code that doesn't meet your standards of quality?
Isn't that universally true of all code posted everywhere on the internet?
A random survey of any code in any language for any framework will turn up quality issues.
What's your real question? Do you think this phenomena will somehow rub off on you and taint your code with their lack of quality?
| 0 | 0 | 0 | 0 |
2009-06-12T13:17:00.000
| 2 | -0.099668 | false | 986,594 | 0 | 0 | 1 | 1 |
I plan to sneak in some Python/Django to my workdays and a possible social network site project seems like a good possibility.
Django itself seems excellent, but I am skeptical about the quality of large amount of Django apps that seem to be available.
I would like to hear what kind of experiences you may have had with Django in creating social network type sites. Any experiences in using any of the Django powered social network "frameworks" would also be welcome.
|
Python LDAP Authentication from remote web server
| 991,550 | 0 | 0 | 2,571 | 0 |
python,active-directory,ldap,webserver
|
There are quite a few components between your hosted django application and your internal AD. You will need to test each to see if everything in the pathways between them is correct.
So your AD server is sitting behind your firewall. Your firewall has ip "a.b.c.d" and all traffic to the firewall ip on port 389 is forwarded to the AD server. I would recommend that you change this to a higher more random port on your firewall, btw. Less scans there.
With the shell access you can test to see if you can reach your network. Have your firewall admin check the firewall logs while you try one of the following (or something similar with python) :
check the route to your firewall (this might not work if webfaction blocks this, otherwise you will see a list of hosts along which your traffic will pass - if there is a firewall on the route somewhere you will see that your connection is lost there as this is dropped by default on most firewalls):
tracert a.b.c.d
do a telnet to your firewall ip on port 389 (the telnet test will allow your firewall admin to see the connection attempts coming in on port 389 in his log. If those do arrive, that means that external comm should work fine):
telnet a.b.c.d 389
Similarly, you need to check that your AD server receives these requests (check your logs) and as well can respond to them. Perhaps your AD server is not set up to talk to the firewall ?
| 0 | 0 | 1 | 0 |
2009-06-13T10:09:00.000
| 2 | 0 | false | 990,459 | 0 | 0 | 1 | 1 |
I have a django application hosted on webfaction which now has a static/private ip.
Our network in the office is obviously behind a firewall and the AD server is running behind this firewall. From inside the network i can authenticate using python-ldap with the AD's internal IP address and the port 389 and all works well.
When i move this to the hosted webserver i change the ip address and port that has been openend up on our firewall. For simplicity the port we opened up is 389 however the requests to authenticate always timeout. When logged into webfaction and running python from the shell and querying the ipaddress i get webfactional's general ip address rather than my static ip.
Is this whats happening when i try and auth in django? the request comes from the underlying ip address that python is running on rather than the static ip that my firewall is expecting?
Im fairly clueless to all this networking and port mapping so any help would be much appreciated!
Hope that makes sense?
|
Which template technology should I use with CherryPy?
| 994,184 | 3 | 11 | 8,175 | 0 |
python,templates,template-engine,cherrypy
|
I like Genshi.
One reason that I like it is simply that the XML syntax looks much cleaner to me when mixed with HTML versus the text-level syntax of the other popular templating engines. For example, it's nice to be able to stick a py:for attribute on to output a table versus nesting messy #if or whatever lines.
Another reason is that because it's based on XML and treats your HTML as XML, it guarantees that your markup is syntactically correct -- i.e. that tags are closed and properly nested, special characters are properly escaped, etc.. Other templating engines will simply treat your HTML as text and output whatever you give it without the extra santity checks.
The main disadvantage of Genshi is that it is much slower than the faster text-based engines. However, its performance should be good enough for most sites. Unless you have a site that has a special need to render text/HTML at a super fast rate, the readability and syntax checking that Genshi provides probably outweigh the performance hit.
| 0 | 0 | 0 | 0 |
2009-06-14T15:33:00.000
| 6 | 0.099668 | false | 993,029 | 0 | 0 | 1 | 1 |
I'm in the process of building a web application using cherrypy.
What template technology do you recommend I use?
|
Customize login in Google App Engine
| 995,085 | 2 | 2 | 4,081 | 0 |
python,google-app-engine,authentication,registration
|
You can't customize the login page. Allowing you to do so would introduce the possibility of XSS vulnerabilities, as well as making it harder for users to identify a legitimate login page.
If you want to provide for federated login, you may want to simply redirect users to an interstitial page that allows them to pick standard Google login, or one of a number of other services.
| 0 | 0 | 0 | 0 |
2009-06-15T08:03:00.000
| 3 | 0.132549 | false | 994,965 | 0 | 0 | 1 | 1 |
I need to add few more options for login and therefore need to customize create_login_url with some HTML code.
Is there a way to add on your code in default login screen of Google?
Environment: Python (Google App Engine)
I want to continue having the default Google ext class Users behavior in place.
|
python web framework large project
| 2,246,687 | 1 | 4 | 2,101 | 1 |
python,frameworks,web-frameworks
|
I would absolutely recommend Repoze.bfg with SQLAlchemy for what you describe. I've done projects now in Django, TurboGears 1, TurboGears 2, Pylons, and dabbled in pure Zope3. BFG is far and away the framework most designed to accomodate a project growing in ways you don't anticipate at the beginning, but is far more lightweight and pared down than Grok or Zope 3. Also, the docs are the best technical docs of all of them, not the easiest, but the ones that answer the hard questions you're going to encounter the best. I'm currently doing a similar thing where we are overhauling a bunch of legacy databases into a new web deliverable app and we're using BFG, some Pylons, Zope 3 adapters, Genshi for templating, SQLAlchemy, and Dojo for the front end. We couldn't be happier with BFG, and it's working out great. BFGs classes as views that are actually zope multi-adapters is absolutely perfect for being able to override only very specific bits for certain domain resources. And the complete lack of magic globals anywhere makes testing and packaging the easiest we've had with any framework.
ymmv!
| 0 | 0 | 0 | 0 |
2009-06-16T18:21:00.000
| 7 | 0.028564 | false | 1,003,131 | 0 | 0 | 1 | 4 |
I need your advices to choose a Python Web Framework for developing a large project:
Database (Postgresql)will have at least 500 tables, most of them with a composite primary
key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements are coming.
Will a ORM be helpful?
|
python web framework large project
| 1,003,329 | 2 | 4 | 2,101 | 1 |
python,frameworks,web-frameworks
|
Depending on what you want to do, you actually have a few possible frameworks :
[Django] Big, strong (to the limit of what a python framework can be), and the older in the race. Used by a few 'big' sites around the world ([Django sites]). Still is a bit of an overkill for almost everything and with a deprecated coding approach.
[Turbogears] is a recent framework based on Pylons. Don't know much about it, but got many good feedbacks from friends who tried it.
[Pylons] ( which Turbogears2 is based on ). Often saw at the "PHP of Python" , it allow very quick developements from scratch. Even if it can seem inappropriate for big projects, it's often the faster and easier way to go.
The last option is [Zope] ( with or without Plone ), but Plone is way to slow, and Zope learning curve is way too long ( not even speaking in replacing the ZODB with an SQL connector ) so if you don't know the framework yet, just forget about it.
And yes, An ORM seem mandatory for a project of this size. For Django, you'll have to handle migration to their database models (don't know how hard it is to plug SQLAlchemy in Django). For turbogears and Pylons, the most suitable solution is [SQLAlchemy], which is actually the most complete ( and rising ) ORM for python. For zope ... well, nevermind
Last but not least, I'm not sure you're starting on a good basis for your project. 500 tables on any python framework would scare me to death. A boring but rigid language such as java (hibernate+spring+tapestry or so) seem really more appropriate.
| 0 | 0 | 0 | 0 |
2009-06-16T18:21:00.000
| 7 | 0.057081 | false | 1,003,131 | 0 | 0 | 1 | 4 |
I need your advices to choose a Python Web Framework for developing a large project:
Database (Postgresql)will have at least 500 tables, most of them with a composite primary
key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements are coming.
Will a ORM be helpful?
|
python web framework large project
| 1,003,173 | 8 | 4 | 2,101 | 1 |
python,frameworks,web-frameworks
|
Yes. An ORM is essential for mapping SQL stuff to objects.
You have three choices.
Use someone else's ORM
Roll your own.
Try to execute low-level SQL queries and pick out the fields they want from the result set. This is -- actually -- a kind of ORM with the mappings scattered throughout the applications. It may be fast to execute and appear easy to develop, but it is a maintenance nightmare.
If you're designing the tables first, any ORM will be painful. For example, "composite primary key" is generally a bad idea, and with an ORM it's almost always a bad idea. You'll need to have a surrogate primary key. Then you can have all the composite keys with indexes you want. They just won't be "primary".
If you design the objects first, then work out tables that will implement the objects, the ORM will be pleasant, simple and will run quickly, also.
| 0 | 0 | 0 | 0 |
2009-06-16T18:21:00.000
| 7 | 1 | false | 1,003,131 | 0 | 0 | 1 | 4 |
I need your advices to choose a Python Web Framework for developing a large project:
Database (Postgresql)will have at least 500 tables, most of them with a composite primary
key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements are coming.
Will a ORM be helpful?
|
python web framework large project
| 1,003,161 | 12 | 4 | 2,101 | 1 |
python,frameworks,web-frameworks
|
Django has been used by many large organizations (Washington Post, etc.) and can connect with Postgresql easily enough. I use it fairly often and have had no trouble.
| 0 | 0 | 0 | 0 |
2009-06-16T18:21:00.000
| 7 | 1 | false | 1,003,131 | 0 | 0 | 1 | 4 |
I need your advices to choose a Python Web Framework for developing a large project:
Database (Postgresql)will have at least 500 tables, most of them with a composite primary
key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements are coming.
Will a ORM be helpful?
|
Number of visitors in Django
| 1,004,658 | -2 | 3 | 4,771 | 0 |
python,django
|
Edit: Added some more information about why I present this answer here. I found chartbeat when I tried to answer this same question for my django based site. I don't work for them.
Not specifically Django, but chartbeat.com is very interesting to add to a website as well.
django-tracking is great, +1 for that answer, etc.
Couple of things I could not do with django-tracking, that chartbeat helped with; tracked interactions with completely cached pages which never hit the django tracking code and pages not delivered through django (e.g. wordpress, etc.)
| 0 | 0 | 0 | 0 |
2009-06-16T18:50:00.000
| 4 | -0.099668 | false | 1,003,302 | 0 | 0 | 1 | 1 |
In Django, how can I see the number of current visitors? Or how do I determine the number of active sessions?
Is this a good method?
use django.contrib.sessions.models.Session, set the expiry time short. Every time when somebody does something on the site, update expiry time. Then count the number of sessions that are not expired.
|
How to distinguish field that requires null=True when blank=True is set in Django models?
| 1,005,209 | 2 | 2 | 381 | 0 |
python,django,django-models
|
null=True is used to tell that in DB value can be NULL
blank=True is only for django , so django doesn't raise error if field is blank e.g. in admin interface
so blank=True has nothing to do with DB
NULL requirement will vary from DB to DB, and it is upto you to decide if you want some column NULL or not
| 0 | 0 | 0 | 0 |
2009-06-17T04:57:00.000
| 2 | 0.197375 | false | 1,005,187 | 0 | 0 | 1 | 1 |
Some model fields such as DateTimeField require null=True option when blank=True option is set.
I'd like to know which fields require that (maybe dependent on backend DBMS), and there is any way to do this automatically.
|
Redeclare .net classes in IronPython
| 1,040,151 | 0 | 1 | 324 | 0 |
c#,ironpython,monkeypatching
|
You can monkey-patch from IronPython, but IPy is the only environment that will respect your changes; i.e. if you tried to mock out File.Create from IronPython, this would work fine for any IPy code, but if you called a C# method which called File.Create, it would get the real one, not the mock.
| 1 | 0 | 0 | 1 |
2009-06-17T18:08:00.000
| 3 | 0 | false | 1,008,686 | 0 | 0 | 1 | 2 |
Can anyone tell me if its possible to redeclare a C# class in IronPython? If I have a C# class, would I be able to monkey-patch it from IronPython?
|
Redeclare .net classes in IronPython
| 3,155,159 | 0 | 1 | 324 | 0 |
c#,ironpython,monkeypatching
|
You cannot monkey patch from IronPython. IronPython treats all .NET classes just like CPython treats built-in types: they cannot be monkey patched. IronRuby on the other hand does support this.
| 1 | 0 | 0 | 1 |
2009-06-17T18:08:00.000
| 3 | 1.2 | true | 1,008,686 | 0 | 0 | 1 | 2 |
Can anyone tell me if its possible to redeclare a C# class in IronPython? If I have a C# class, would I be able to monkey-patch it from IronPython?
|
What to learn for RIA
| 1,011,396 | 2 | 1 | 2,163 | 0 |
python,silverlight,html,ria
|
You should focus on “HTML5” where “HTML5” is the new “Ajax” buzzword aka. the “Open Web Platform”—not just the HTML 5 spec itself.
Flash, Silverlight and JavaFX are all single-vendor plug-in offerings but “HTML5” is a multi-vendor browser-native thing.
If you want to an IDE workflow, you can use the Google Web Toolkit to have a Java workflow that targets the browser-native plug-inless feature set. Unfortunately, there’s no GWT-like Python system yet.
| 0 | 0 | 0 | 0 |
2009-06-18T06:59:00.000
| 6 | 1.2 | true | 1,011,168 | 1 | 0 | 1 | 2 |
I am planning to build a RIA about a year from now (when my current contract ends). What technology would you recommend investing time in?
I will need good cross browser/platform support for video, music, and canvas.
And ideally I would like to leverage my Python skills.
Silverlight looks interesting because I could use Python through .NET. But I'm on Linux so I'd always be a 2nd class citizen. And it has a low install base.
Flash on the other hand has a large install base.
And I'm not sure about JavaFX because of the Oracle deal.
Or should I hold my hopes out for HTML 5?
Thanks!
|
What to learn for RIA
| 1,011,196 | 2 | 1 | 2,163 | 0 |
python,silverlight,html,ria
|
If you have a year to prepare I recommend that you research all the technologies you can. Build the hello worlds for the different platforms. Then build the SAME simple RIA on each candidate framework to get a good feel for the differences. Obviously you will not uncover every little gotcha, but the gross architectures and styles will be evident.
| 0 | 0 | 0 | 0 |
2009-06-18T06:59:00.000
| 6 | 0.066568 | false | 1,011,168 | 1 | 0 | 1 | 2 |
I am planning to build a RIA about a year from now (when my current contract ends). What technology would you recommend investing time in?
I will need good cross browser/platform support for video, music, and canvas.
And ideally I would like to leverage my Python skills.
Silverlight looks interesting because I could use Python through .NET. But I'm on Linux so I'd always be a 2nd class citizen. And it has a low install base.
Flash on the other hand has a large install base.
And I'm not sure about JavaFX because of the Oracle deal.
Or should I hold my hopes out for HTML 5?
Thanks!
|
Configuring Django to use SQLAlchemy
| 45,878,579 | 0 | 29 | 30,261 | 1 |
python,django,sqlalchemy,configure
|
There are many benefits of using SQLAlchemy instead of Django ORM, but consider developing a built-in-Django choice of SQLAlchemy
(to have something called a production ready)
By the way, Django ORM is going better - in Django 1.11 they added UNION support (a SQL basic operator), so maybe some day there will be no need to change ORM.
| 0 | 0 | 0 | 0 |
2009-06-18T08:31:00.000
| 5 | 0 | false | 1,011,476 | 0 | 0 | 1 | 1 |
How can I configure Django with SQLAlchemy?
|
How to get links on a webpage using mechanize and open those links
| 1,012,022 | 2 | 3 | 8,097 | 0 |
python,mechanize
|
The Browser object in mechanize has a links method that will retrieve all the links on the page.
| 0 | 0 | 1 | 0 |
2009-06-18T10:32:00.000
| 2 | 0.197375 | false | 1,011,975 | 0 | 0 | 1 | 1 |
I want to use mechanize with python to get all the links of the page, and then open the links.How can I do it?
|
Sandboxing in Linux
| 1,029,301 | 0 | 16 | 7,104 | 0 |
python,c,linux,security,sandbox
|
I think your solutions must concentrate on analyzing the source code. I don't know any tools, and I think this would be pretty hard with C, but, for example, a Pascal program which doesn't include any modules would be pretty harmless in my opinion.
| 0 | 1 | 0 | 1 |
2009-06-19T19:35:00.000
| 12 | 0 | false | 1,019,707 | 0 | 0 | 1 | 3 |
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications.
So I need to create some kind of sandbox for the apps. At the most basic level, I'd like to restrict access to the file system to some specified directories. I cannot use chroot jails directly, since the web app is not running as a privileged user. I guess a suid executable which sets up the jail would be an option.
The uploaded programs would be rather small, so they should execute quickly (a couple of seconds at most). Hence, I can kill the process after a preset timeout, but how do I ensure that it doesn't spawn new processes? Or if I can't, is killing the entire pgid a reliable method?
What would be the best way to go about this - other than "don't do it at all"? :) What other glaring security problems have I missed?
FWIW, the web app will be written in Python.
|
Sandboxing in Linux
| 1,019,986 | -2 | 16 | 7,104 | 0 |
python,c,linux,security,sandbox
|
About the only chance you have is running a VirtualMachine and those can have vulnerabilities. If you want your machine hacked in the short term just use permissions and make a special user with access to maybe one directory. If you want to postpone the hacking to some point in the future then run a webserver inside a virtual machine and port forward to that. You'll want to keep a backup of that because you'll probably have that hacked in under an hour and want to restart a fresh copy every few hours. You'll also want to keep an image of the whole machine to just reimage the whole thing once a week or so in order to overcome the weekly hackings. Don't let that machine talk to any other machine on your network. Blacklist it everywhere. I'm talking about the virtual machine and the physical machine IP addresses. Do regular security audits on any other machines on your other machines on the network. Please rename the machines IHaveBeenHacked1 and IHaveBeenHacked2 and prevent access to those in your hosts lists and firewalls.
This way you might stave off your level of hackage for a while.
| 0 | 1 | 0 | 1 |
2009-06-19T19:35:00.000
| 12 | -0.033321 | false | 1,019,707 | 0 | 0 | 1 | 3 |
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications.
So I need to create some kind of sandbox for the apps. At the most basic level, I'd like to restrict access to the file system to some specified directories. I cannot use chroot jails directly, since the web app is not running as a privileged user. I guess a suid executable which sets up the jail would be an option.
The uploaded programs would be rather small, so they should execute quickly (a couple of seconds at most). Hence, I can kill the process after a preset timeout, but how do I ensure that it doesn't spawn new processes? Or if I can't, is killing the entire pgid a reliable method?
What would be the best way to go about this - other than "don't do it at all"? :) What other glaring security problems have I missed?
FWIW, the web app will be written in Python.
|
Sandboxing in Linux
| 15,609,095 | 0 | 16 | 7,104 | 0 |
python,c,linux,security,sandbox
|
Spawning a new VM under KVM or qemu to compile and run the code looks like the way to go. Running the code under jail/LXC can compromise the machine if it exploits the unsecured parts of the OS like networking code. Advantage of running under a VM are obvious. One can only hack the VM but not the machine itself. But the side effect is you need lots of resources (CPU and Memory) to spawn a VM for each request.
| 0 | 1 | 0 | 1 |
2009-06-19T19:35:00.000
| 12 | 0 | false | 1,019,707 | 0 | 0 | 1 | 3 |
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications.
So I need to create some kind of sandbox for the apps. At the most basic level, I'd like to restrict access to the file system to some specified directories. I cannot use chroot jails directly, since the web app is not running as a privileged user. I guess a suid executable which sets up the jail would be an option.
The uploaded programs would be rather small, so they should execute quickly (a couple of seconds at most). Hence, I can kill the process after a preset timeout, but how do I ensure that it doesn't spawn new processes? Or if I can't, is killing the entire pgid a reliable method?
What would be the best way to go about this - other than "don't do it at all"? :) What other glaring security problems have I missed?
FWIW, the web app will be written in Python.
|
Python database application framework and tools
| 1,021,195 | 0 | 9 | 9,831 | 1 |
python,frame
|
just FYI, for PyQT, the book has a chapter 15 with Databases, It looks good. and the book has something with data and view etc. I have read it and I think it's well worth your time:)
| 0 | 0 | 0 | 0 |
2009-06-20T02:22:00.000
| 6 | 0 | false | 1,020,775 | 0 | 0 | 1 | 1 |
I have been building business database applications such as finance, inventory and other business requirement applications. I am planning to shift to Python. What would be the tools to start with best. I would need to do master, transaction forms, processing (back end), reports and that sort of thing. The database would be postgress or mysql. As I am new to Python I understand that I need besides Python the ORM and also a framework. My application is not a web site related but it could also be need to be done over the web if needed.
How to choose the initial setup of tool combinations?
|
Package for creating and validating HTML forms in Python? - to be used in Google Appengine
| 1,021,454 | 0 | 1 | 355 | 0 |
python,html,google-app-engine,forms
|
AppEngine includes Django's form framework (or a variation thereof), which I find very nice. It also plays well with your ORM (i.e. getting forms for models is very DRY). The only potential problem is the lack of client-side validation.
| 0 | 0 | 0 | 0 |
2009-06-20T11:01:00.000
| 3 | 0 | false | 1,021,411 | 0 | 0 | 1 | 1 |
Is there a well maintained package available in Python for creating and validating HTML forms? I will deploying it finally on Google Appengine.
|
Deploying Django
| 1,022,932 | 2 | 2 | 537 | 0 |
python,ruby-on-rails,django
|
Python is all that is needed.
I think there is a cPanel plugin which allows your users to create and deploy Django applications, so if you have a VPS or Reseller account, or your host is running cPanel, you could simply tell them to install it. If I find the link to the plugin I will post it here.
| 0 | 0 | 0 | 0 |
2009-06-21T01:00:00.000
| 5 | 0.07983 | false | 1,022,914 | 0 | 0 | 1 | 1 |
When finding web hosting for Rails apps, the hoster must have support for ruby on rails -- that is evident. What about hosting for Django? What support does the hoster need to provide? Python, or more than just Python?
This might seem like an obvious question, but I'm new to web development frameworks so I must ask :)
|
What's the best way to implement web service for ajax autocomplete
| 1,025,027 | 1 | 2 | 1,169 | 0 |
python,ajax,autocomplete,trie
|
I would use the first option. 'KISS' - (Keep It Simple Stupid).
For small amounts of data there shouldn't be much latency. We run the same kind of thing for a name search and results appear pretty quickly on a few thousand rows.
Hope that helps,
Josh
| 0 | 0 | 0 | 0 |
2009-06-21T23:31:00.000
| 2 | 0.099668 | false | 1,025,018 | 1 | 0 | 1 | 1 |
I'm implementing a "Google Suggest" like autocomplete feature for tag searching using jQuery's autocomplete.
I need to provide a web service to jQuery giving it a list of suggestions based on what the user has typed. I see 2 ways of implementing the web service:
1) just store all the tags in a database and search the DB using user input as prefix. This is simple, but I'm concerned about latency.
2) Use an in-process trie to store all the tags and search it for matching results. As everything will be in-process, I expect this to have much lower latency. But there are several difficulties:
-What's a good way to initialize the trie on process start up? Presumable I'll store the tag data in a DB and retrieve them and turn them into a trie when I frist start up the process. But I'm not sure how. I'm using Python/Django.
-When a new tag is created by a user, I need to insert the new tag into the trie. But let's say I have 5 Django processes and hence 5 tries, how do I tell the other 4 tries that they need to insert a new tag too?
-How to make sure the trie is threadsafe as my Django processes will be threaded (I'm using mod_wsgi). Or do I not have to worry about threadsafty because of Python's GIL?
-Any way I can store the tag's frequency of use within the trie as well? How do I tell when does the tag's string end and when does the frequency start - eg. if I store apple213 into the trie, is it "apple" with frequency 213 or is it "apple2" with frequency 13??
Any help on the issues above or any suggestions on a different approach would be really appreciated.
|
Call program from within a browser without using a webserver
| 1,025,846 | 1 | 2 | 2,904 | 0 |
python,html,browser
|
If you want an an HTML page to have some sort of server-side programming then you will need a webserver of some sort to do the processing.
My suggestion would be to get a web server running on your development box, or try to accomplish what you need to do with a local desktop application or script.
| 0 | 0 | 0 | 0 |
2009-06-22T07:03:00.000
| 7 | 0.028564 | false | 1,025,817 | 0 | 0 | 1 | 3 |
Is there a way to call a program (Python script) from a local HTML page?
I have a YUI-colorpicker on that page and need to send its value to a microcontroller via rs232. (There is other stuff than the picker, so I can't code an application instead of an HTML page.)
Later, this will migrate to a server, but I need a fast and easy solution now.
Thanks.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.