All..
I have a Django site and to access it all the users have to go through the login page.
My question is when a user is given a access through the login page to enter the site.Does Django logs the username in any of the Django internal tables....
Thanks.......
...
class Content(models.Model):
.....stuff here
class Score(models.Model):
content = models.OneToOneField(Content, primary_key=True)
real_score = models.IntegerField(default=0)
This is my database schema. As you can see, each Content has a score.
How do I do this:
Select all from Content where Content's Score is 1?
...
I've tried everything and haven't got an AIM bot to work, I've tried on two servers and they all return this error: "struct.error: unpack requires a string argument of length 10"
List includes:
pyaimt
oscar demo w/ twisted words
howie
larvotto
None of them work, does anyone know where to find a good example bot?
...
Assuming I have some embedded python code containing a function foo, what is the best way to get a reference to that function (for use with PyObject_CallObject)?
One way is to have some function register each function along with the function name either manually or through use of reflection. This seems like overkill.
Another way is to ...
So if I do
import MySQLdb
conn = MySQLdb.connect(...)
cur = conn.cursor()
cur.execute("SELECT * FROM HUGE_TABLE")
print "hello?"
print cur.fetchone()
It looks to me that MySQLdb gets the entire huge table before it gets to the "print".
I previously assumed it did some sort of "cursor/state" lazy retrieval in the background,
but...
Python newb here looking for some assistance...
For a variable number of dicts in a python list like:
list_dicts = [
{'id':'001', 'name':'jim', 'item':'pencil', 'price':'0.99'},
{'id':'002', 'name':'mary', 'item':'book', 'price':'15.49'},
{'id':'002', 'name':'mary', 'item':'tape', 'price':'7.99'},
{'id':'003', 'name':'john', 'item':'pe...
I would like to be able to compare a binary file X to a directory of other binary files and find which other file is most similar to X. The nature of the data is such that identical chunks will exist between files, but possibly shifted in location. The files are all 1MB in size, and there are about 200 of them. I would like to be hav...
I have a python program that uses a custom-built DLL. This DLL crashes due to a stack overflow. This overflow is not due to a recursive function gone bad, but to large allocations on the stack using alloca().
I want to increase stack size to get rid of this error. Is there any way to do this?
...
Hello,
Sorry if you feel like this has been asked but I have read the related questions and being quite new to Python I could not find how to write this request in a clean manner.
For now I have this minimal Python code:
from mechanize import Browser
from BeautifulSoup import BeautifulSoup
import re
import urllib2
br = Browser()
b...
What is the most efficient method to store a Python dictionary on the disk? The only methods I know of right now are plain-text and the pickle module.
Edit: Sorry for not being very clear. By efficient I meant fastest execution speed. The dictionary will contain mutable objects that will hold information to be parsed and modified.
...
1.5hr of coding in their smaller than by bedroom office with 4 desks lol. Afterward, while destressing at a bar, I refactored it a bit. objective was:
develop a mechanism to define a schema for json objects and validate against it
coerce data to schema types if possible, in case an int came in as a float or str
develop mechanism to co...
I want to draw two plots describing the color distribution of the dynamic image. I tried to build all these three share the same axes but failed. And the plot flashes not displays continuously. Thanks.
import wx
import sys, time, os, gc
import wx.lib.colourselect as cs
import matplotlib.cm as cm
import numpy as npy
import matplotlib.py...
I'm having a strange issue when using subprocess.Popen.communicate(). For background, I want to execute an application from my python script. When I run the program from the command line, I do it like this (UNIX):
$ echo "input text" | /path/to/myapp
From my script, I also want to pipe the input into the application. So, I tried t...
Hello!
So I'm aware of the big ammount of general-purpose scripting languages like Ruby, Python, Perl, maybe even PHP, etc. that actually claim being usable for creating desktop applications too.
I think my question can be answered clearly
Are there actually companies using a special scripting language only to create their applicatio...
Hello,
I am trying to scrap some data from a website.
The scripts I am trying to write, should get the content of the page:
http://www.atpworldtour.com/Rankings/Singles.aspx
Should simulate the user going trough every option for Additional Standings and the dates and simulate clicking on Go then after fetching the data should use the...
I want to build something similar to Tunatic or Midomi (try them out if you're not sure what they do) and I'm wondering what algorithms I'd have to use; The idea I have about the workings of such applications is something like this:
have a big database with several songs
for each song in 1. reduce quality / bit-rate (to 64kbps for inst...
sentence = "The quick brown fox jumped over the lazy dog."
characters = {}
for character in sentence:
characters[character] = characters.get(character,0) + 1
print(characters)
I don't understand what characters.get(character,0) + 1 is doing, rest all seems pretty straightforward.
Thanks
...
This is the best algorithm I could come up with after struggling with a couple of Project Euler's questions.
def get_primes(n):
numbers = set(range(n, 1, -1))
primes = []
while numbers:
p = numbers.pop()
primes.append(p)
numbers.difference_update(set(range(p*2, n+1, p)))
return primes
>>> timeit....
i have been in the RDBMS world for many years now but wish to explore the whole nosql movement. so here's my first question:
is it bad practice to have the possibility of duplicate keys? for example, an address book keyed off of last name (most probably search item?) could have multiple entities. is it bad practice to use the last na...
There're tons of apps/widgets for PHP function reference and even for Ruby but I'm shocked to find there is nothing available for a popular language like Python (besides the official online documentation ofcourse).
Is there really not a single handy reference widget/app available for Python? I have 'Pocket Reference' book, but a dashbo...