I have a very simple charting component which takes integer on the x/y axis. My problem is that I need to represent date/float on this chart. So I though I could distribute proportionally dates on a scale. In other words, let's say I have the following date : 01/01/2008, 02/01/2008 and 31/12/2008. The algorithm would return 0, 16.667, an...
I was wondering if I have a couple of models which both include fields like "meta_keywords" or "slug" which have to do with the web page the model instance will be displayed on, whether it would be advisable to break those page metadata elements out into their own class, say PageMeta, and have my other models subclass those via multiple ...
I'd just like to know the best way of listing all integer factors of a number, given a dictionary of its prime factors and their exponents.
For example if we have {2:3, 3:2, 5:1} (2^3 * 3^2 * 5 = 360)
Then I could write:
for i in range(4):
for j in range(3):
for k in range(1):
print 2**i * 3**j * 5**k
But here I've got 3 ...
I'm attempting to plot a particular line over an original image (an array) that i have. Basically, I have an angle and offset (measured from the center of the image) that I want to plot the line over. The problem is, I'm not exactly sure how to do this. I can write a really complicated piece of code to do this, but I'm wondering if there...
Is it possible to map a URL pattern (regular expression or some other mapping) to a single RequestHandler? If so how can I accomplish this?
Ideally I'd like to do something like this:
application=WSGIApplication([('/*',MyRequestHandler),])
So that MyRequestHandler handles all requests made. Note that I'm working on a proof of concep...
Hi,
Actually I want to develop a GUI app which displays a given mathematical equation. And when you click upon a particular variable in the equation to signify that it is the unknown variable ie., to be calculated. The equation transforms itself to evaluate the required unknown variable.
for eg:
a = (b+c*d)/e
Let us suppose that ...
in how many way i traverse dictionary in python???
...
Hello everyone,
I'm playing around with Django's admin module, but I've seemed to run into a bit of a bump that's more of an annoyance than an error. I have my modules setup using names like UserData and Status, so Django's admin panel likes to try to call each row in UserData a user datas and each status a statuss. Is there any way I c...
I'm a PHP guy on my first day in Python-land, trying to convert a php site to python (learning experience), and I'm hurting for advice. I never thought it would be so hard to use multi-dimensional arrays or dictionaries as you pythoners call them.
So I can create multi-dimensional arrays using this, but i can't loop it in a django templ...
Can anyone tell me how many places there are optimized in Python's bytecode?
I was trying to de-compile Python's bytecode these days,but I found that in Python's version 2.5 there are a lot of optimization.For example: to this code
a,b,c=([],[],[])#build list
the non-optimized bytecode before version2.5 is like that:
BUILD_LIST_0
BUI...
I have a string, example:
s = "this is a string, a"
where ','(comma) will always be the 3rd last character, aka s[-3].
I am thinking of ways to remove the ',' but can only think of converting the string into a list, deleting it, and converting it back to a string. This however seems a bit too much for simple task.
How can i accompl...
hi,
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 th...
How do I reference a file relatively to a package's directory?
My directory structure is:
/foo
package1/
resources/
__init__.py
package2/
resources/
__init__.py
script.py
script.py imports packages package1 and package2. Although the packages can be imported by any other script on the syste...
Possible Duplicate:
Python 2.x gotchas and landmines
Today I was bitten again by mutable default arguments after many years. I usually don't use mutable default arguments unless needed, but I think with time I forgot about that. Today in the application I added tocElements=[] in a PDF generation function's argument list and n...
how we configure django with SQLAlchemy??
...
Hello,
I would like the symbols in matplotlib chart to be organized in several lines.
For example, I would like to convert this chart:
http://img44.imageshack.us/img44/5082/beforeu.png
into something like this:
http://img41.imageshack.us/img41/4760/afterw.png
...
I've created a two wheeled robot based on the braitenberg vehicle. Our robots have two wheels and a PolygonDisk body(Much like kepera and e-puck robots). I would like to add a camera to the front of the robot. The problem then becomes how to control the camera and how to keep pointing it in the right direction(same direction as the robot...
I wrote a program to click on an application automatically at scheduled time using Win32, using MOUSE_DOWN and MOUSE_UP. It usually works well, except I found that I need to put in a
sleep 0.1
between the MOUSE_DOWN and MOUSE_UP. (using Ruby, which allows sleeping a fraction of a second).
Without the sleep, sometimes the click doe...
How can I do thing like this in python?
foo = somevalue
previous = next = 0
for (i=1; i<objects.length(); i++) {
if (objects[i]==foo){
previous = objects[i-1]
next = objects[i+1]
}
}
...
Hi,
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?
...