There's a requirement in a web app I'm building about the possibility of the user sending join invitations to his friends. These invitations are stored in the database through the Invitation model. The user can send multiple invitations at once.
What do you think is more appropriate: sending all emails at once in the back end view or se...
Hi
I have a 2d array, I would like to set a column to a particular value, my code is below. Is this the best way in python?
rows = 5
cols = 10
data = (rows * cols) *[0]
val = 10
set_col = 5
for row in range(rows):
data[row * cols + set_col - 1] = val
If I want to set a number of columns to a particular value , how could I exten...
Hi, what i want, is to receive advices to define a re-usefull Product model, for a shopping site app, nowadays I know that the store is going to commerce with "clothing", so the product model will have a "season or collections" relationship, but in the future I should use that app to commerce with X product, e.g: "cars" which have "mecha...
The pyplot plot_date function expects pairs of dates and values to be plotted with a certain line style. Is there a recommended approach to plot multiple values or interval data against date/time values?
...
I wanted to use a method as part of my model to count all the occurrences of the object in another table that references it as a foreign key.
Will the below work?
class Tile(models.Model):
#...
def popularity(self):
return PlaylistItem.objects.filter(tile__exact=self.id).count()
And the relevant information from the p...
Hi,
I'm building an application on app Engine and I want to make a form field with multiple choices.
Here is my form (it uses django.newforms from the app engine sdk (django 0.96)) :
from google.appengine.ext.db import djangoforms
from django import newforms
class KeywordForm(djangoforms.ModelForm):
class Meta:
model = Key...
I have a file that contains ~16,000 lines of information on entities. The user is supposed to upload the file using an HTML upload form, then the system handles this by reading line by line and creating then put()'ing entities onto the datastore.
I'm limited by the 30 second request time limit. I have tried a lot of different work-aroun...
Hi, Im using a flash gallery and the settings xml file is stored in /media/xml/gallery.xml
In the gallery.xml file I want to add this snippet of code:
<items>
{% for image in images %}
<item source="{{ MEDIA_URL }}{{ image.image }}" thumb="" description="{{ image.title }}" />
{% endfor %}
</item>
But the source="... rend...
I have had no troubles locally, but pushing a new project to an existing machine (one running plenty of other django apps without trouble) gave this:
OperationalError: unable to open database file
What is more perplexing is:
The sqlite file is read-write for all
This error only happens on some queries! Other's are fine.
In a fresh d...
Does anyone know how I would go about detected what bit version Windows is under Python. I need to know this as a way of using the right folder for Program Files.
Many thanks
...
First, I'll admit this is cross-posted at SuperUser but I decided to also post here as my objective is programming related and this community might have better solution scenarios than just the one I'm thinking of.
I have a Windows 7 computer that is acting as a Media Center so it is always on but not always in use. I would like to be ab...
I'm working on a project that is written in both C++ and python. I have the following line in my configure.ac:
AC_INIT(MILHOUSE, 0.3.6)
which means that in the config.h generated by running configure, i have the following define line:
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.3.6"
I just wanted to kn...
I'm a computer science student doing my bachelor's degree. i'm interested in doing an simple application like an ERP in django. I've got about a month of time don't know where do i start. please do give in your opinion.
...
Hi,
Recently I moved a web app I'm developing from MySQL to PostgreSQL for performance reasons (I need functionality PostGIS provides). Now quite often encounter the following error:
current transaction is aborted, commands ignored until end of transaction block
The server application uses mod_python. The error occurs in the hailing f...
Hello all,
This is Python question. I have a variable A
>>> A
<Swig Object of type 'uint16_t *' at 0x8c66fa0>
>>> help(A)
class PySwigObject(object)
Swig object carries a C/C++ instance pointer
The instance referred by A is a contiguous array uint16[3] and the problem is to gain access to that array from Python.
In Python, how c...
i am getting this error when doing database calls in a sub process using multiprocessing library.
http://pastie.org/811424
InternalError: current transaction is aborted, commands ignored until end of transaction block
this is to a postgres database, using psycopg2 driver in web.py.
how ever if i use threading.Thread instead of multip...
In a comment on this question, I saw a statement that recommended using
result is not None
vs
result != None
I was wondering what the difference is, and why one might be recommended over the other?
Thanks!
...
When I try to read a String from memcached that I set in python:
import memcache
MC_SERVER = "192.168.1.100"
MC_PORT = "11211"
mc = memcache.Client(['%s:%s' % (MC_SERVER, MC_PORT)], debug=0)
mc.set("test_string", "true")
print mc.get("test_string")
Java tells me is doesn't exist and obviously returns null when I try to get it:
impo...
I'm using the pyopencv bindings. This python lib uses boost::python to connect to OopenCV. Now I'm trying to use the SURF class but don't know how to handle the class operator in my python code.
The C++ class is defined as:
void SURF::operator()(const Mat& img, const Mat& mask,
vector<KeyPoint>& keypoints) const
{...}...
Hi, I'm trying to extract contacts programmaticaly from thunderbird in python. Do you know about anything (library, scripts already done,tutorial...) that can help me?
thanks
...