I have a feeling the answer is simple and documented, but I'm absolutely missing it:
Is there a way, using Python and webapp through Google App Engine, to pass the id field of a record to the template? I'm fairly new to the app engine, and yes, I have searched all around the Google Documentation to find this.
...
Hey I need to split a large file in python into smaller files that contain only specific lines. How do I do this?
...
When I run this code
from pylab import *
figure()
ax1 = subplot(121)
plot([1, 2, 3], [1, 2, 3])
subplot(122, sharex=ax1, sharey=ax1)
plot([1, 2, 3], [1, 2, 3])
draw()
show()
I get two subplots which are "squished" in the X-dimension. How do I get these subplots such that the height of the Y-axis equals the width of the X-axis, for bo...
I'm creating a set of SQL full database copy scripts using MySQL's INTO OUTFILE and LOAD DATA LOCAL INFILE.
Specifically:
SELECT {columns} FROM {table} INTO OUTFILE '{table}.csv'
LOAD DATA LOCAL INFILE '{table}.csv' REPLACE INTO {table} {columns}
Because of this, I don't need just the tables, I also need the columns for the tables. ...
I'm trying to figure out how to add a series of events to a non-default calendar (and remove some) as a batch, but there's no hint of how to do it in Google's frankly awful documentation.
Has anyone cracked this nut or does anyone know where there is actually useful documentation on using the Google Calendar API?
...
I am trying to perform a calculation on multiple values in the value portion of a list of key:value pairs.
So I have something like:
[('apples', ['254', '234', '23', '33']), ('bananas', ['732', '28']), ('squash', ['3'])]
I'm trying to create a list of y-values that are the averages of those integers above.
What I'm trying to write i...
I've been searching for a opensource solution to suggest a category given a question or text.
For example, "who is Lady Gaga?" would probably return 'Entertainment', 'Music', or 'Celebrity'.
"How many strike out there are for baseball?" would give me 'Baseball', or 'Sport'.
The categorization doesn't have to be perfect but should be s...
How can i get system idle time (no keys pressed - mouse moved) in C or Python?
EDIT: My program suspend a counter when idle time > 10 sec
...
Will this work?
try:
try:
field.value = filter(field.value, fields=self.fields, form=self, field=field)
except TypeError:
field.value = filter(field.value)
except ValidationError, e:
field.errors += e.args
field.value = revert
valid = False
break
Namely, if that first line throws a...
I'm using the python signals library to kill a function if it runs longer than a set period of time.
It works well in my tests but when hosted on the server I get the following error
"signal only works in main thread"
I have set the WSGI signals restriction to be off in my httpd.conf
WSGIRestrictSignal Off
as described
http://code....
I'm attempting to install the PIL library in an Virtual Enviroment that I have created.
Usually to install PIL I'd grab the install, however this won't allow me to choose my virtualenv only my root Python folder (C:/Python26).
I tried both pip install PIL and easy_install PIP but they didn't work. I've also tried downloading the TAR, e...
I am having trouble installing matplotlib on mac os 10.6, so I used macports and installed all dependencies it needed, which is great, but on top of it a new python version. Now I have two python versions and that bothers me. The matplotlib is working fine on the macport python, and the rest of my stuff is with the default python.
What ...
Hi,
How would i go about gathering information about a system in python? Seems most of the commands are made for Unix... Are there any options in windows?
Thanks,
Jake.
...
The app is setup as a basic WSGI application. I'm just trying to call a function before the requestHandler is run.
I would like something very much like the way before_filter works in Rails.
Thanks.
...
I wrote a function that serializes a list of dictionaries as a CSV file using the CSV module. I sometimes want to write out to a file only a subset of each dictionary's keys however. I use the following code:
def dictlist2file(dictrows, filename, fieldnames, delimiter='\t',
lineterminator='\n'):
out_f = open(filename, 'w')
...
I'm using Twisted to implement a server, of sorts. When I test it, the first line it receives is always strange:
Starting Server...
New connection from 192.168.1.140
192.168.1.140: ÿûÿû ÿûÿû'ÿýÿûÿý\NAME Blurr
192.168.1.140: \NAME Blurr
(for both inputs I sent \NAME Blurr.)
This is the code that prints the input:
def lineReceived(s...
Is there a library available to convert a HTML page (text, images, layout elements etc. ) to a PDF file.
I have an HTML page with figures, text and tables with numbers etc. which I want my clients to be able to download as PDF. How do I do this with Python?
...
Here's my view:
def rsvp_list(request, id, template="rsvp/rsvp_list.html"):
rsvp = RSVP.objects.get(id=id)
return render_to_response(template, {
'attendees': rsvp.attendee_set.all().order_by('email__first_name'),
}, context_instance=RequestContext(request))
and here's my template:
{% for attendee in attendees %...
I am calling a constructor in ClassA and want to have the resulting object be of a different class (ClassB) if a certain condition is met. I've tried replacing the first argument to __init__() ('self' in the example below) within __init__() but it doesn't seem to do what I want.
in main:
import ClassA
my_obj = ClassA.ClassA(500)
# un...
Create a string variable that is initialized to your entire name??
Im a little lost
Thanks Kim:)
...