python

Serving secure Django pages with HTTPS

What is the proper deployment configuration for a Django application that needs some pages served with HTTPS and others with HTTP? I want to use HTTPS for the pages that involve registration and inputting passwords. I want to use HTTP for all other pages. ...

Can 2 objects have the same key name?

Hello, I wonder if 2 objects can have the same key name? They wouldn't be the same class. Thanks! ...

looking for blog application with image metadata handling

I'm working on a simple blog + image gallery website. As the purpose of the image gallery is to display artwork, I'd like to attach a variety of metadata to each image -- e.g. year and type of materials used. That's easy enough to do in itself, but I also want the user to be able to insert those images into his blogposts. I'm not really ...

Python & HTML: Make user login to use website

I'm creating a website with a database search functionality, but I want to make the user login or create a account first to use the search functionality. How do I do this? And what is the easiest way to carry the login session forward. I.E. the user only has to login once to do many searches. ...

R, python or octave: empirical quantile (inverse cdf) with confidence intervals?

I'm looking for a built-in function that returns the sample quantile and an estimated confidence interval in something other than MATLAB (MATLAB's ecdf does this). I'm guessing R has this built-in and I just haven't found it yet. If you have any standalone code to do this, you could also point to it here, though I hope to find somethin...

How to package a python program

Hello, Im new to python programming.Im writing a simple command line based twitter app,and i have to use external libraries like simplejson,tweepy etc. Is there a way i can package my python program to include these libraries as well,so that when i distribute this program, the user doesnt have to install the required libraries first him...

google page rank get in python

I need google page rank get in python. There i can officially extract it? i mean i can parse some thing like this http://www.prchecker.info But there these sites get data officially from google? or may i can use some python seo libs for this? ...

How do I step through/debug a python web application?

I can't seem to find any information on debugging a python web application, specifically stepping through the execution of a web request. is this just not possible? if no, why not? ...

Why does python use two underscores for certain things?

I'm fairly new to actual programming languages, and Python is my first one. I know my way around Linux a bit, enough to get a summer job with it (I'm still in high school), and on the job, I have a lot of free time which I'm using to learn Python. One thing's been getting me though. What exactly is different in Python when you have expr...

How can I do dynamic class generation in Python? (or would a series of if/elses be better)

Hey guys! So, I'm writing something and I've come into a roadblock on how to do it (and what is the proper way of doing things). SO, explaining the situation will help be better understand the problem, and hopefully someone will know the answer :) Here it goes: Basically, I'm writing up some dynamic forms in Python (more specifically D...

Shifting thinking from CakePHP to Django - a monolithic views file?

I'm trying to get started with Django, and have previously worked with CakePHP, and so my MVC background comes out of that. I'm aware of Django's slightly different MTV architecture, and am fine with the monolithic model files - multiple classes in one file I can handle just fine. But I'm confused about how to do the views (which are r...

Array broadcasting with numpy

How do I write the following loop using Python's implicit looping? def kl(myA, myB, a, b): lots of stuff that assumes all inputs are scalars x, y = meshgrid(inclusive_arange(0.0, xsize, 0.10),\ inclusive_arange(0.0, ysize, 0.10)) for j in range(x.shape[0]): for i in range(x.shape[1]): z[j, i] = kl(x[j, ...

Issue with passing paramters to a class method in Python

Hi, I have been playing with Python for the past week and I running into a problem with passing 4 parameters to a class method. Here is the class method defined within it's class: class Line: locx0 = 0 locy0 = 0 locx1 = 0 locy1 = 0 def __init__(self): print'<<Line __init__()>>' def setLineCoordinates...

Django Piston Content Type Always Null

I had django-piston working a week ago but recently I'm unable to call any web services. Below is a simple example. I have a 'test' service that returns 'yes' if there is a content type and 'no' if content type is null. I've done this because I get HTTP 500 errors when I do a POST and try to parse my parameters via 'data = request.data'....

GUI for the Linux and Windows platforms - Python CRUD app

Hello, i'm looking for a basic CRUD (create-read-update-delete) app in Python, with some line-by-line display grid to browse through a file's records and select individual records from there. It probably already exists but i couldn't find anything yet. Thanks ...

Python SOAP to MS WebService(SharePoint)(GetListItems)

Hello, I am attempting to pull list Items from a sharepoint server(via python/suds) and am having some difficulty with making queries to GetListItems. If i provide no other parameters to GetListItems other than the list Name, it will return all the items in the default view for that List. I want to query a specific set of items(ID=15)...

How can I tell where my python script is hanging?

So I'm debugging my python program and have encountered a bug that makes the program hang, as if in an infinite loop. Now, I had a problem with an infinite loop before, but when it hung up I could kill the program and python spat out a helpful exception that told me where the program terminated when I sent it the kill command. Now, howev...

How do I get this page programatically?

Here is the page THE LINK TO LYRICS SITE If I use normal method, all I get is the "http://lyricsvip.com" and not the lyrics. ...

Python and ElementTree: return "inner XML" excluding parent element

In Python 2.6 using ElementTree, what's a good way to fetch the XML (as a string) inside a particular element, like what you can do in HTML and javascript with innerHTML? Here's a simplified sample of the XML node I am starting with: <label attr="foo" attr2="bar">This is some text <a href="foo.htm">and a link</a> in embedded HTML</lab...

fullscreen matplotlib figures

I am visualising numpy arrays with imshow from pyplot, and would like to see just the array data in a fullscreen display with no toolbars or window borders. Running with "ipython -pylab" and then calling imshow() and show() gives me a window but pressing "f" does not toggle fullscreen mode. Is there a function call to toggle fullscreen ...