I have a lost of sentences generated from http://www.ywing.net/graphicspaper.php, a random computer graphics paper title generator, some of example sentences sorted are as following:
Abstract Ambient Occlusion using Texture Mapping
Abstract Ambient Texture Mapping
Abstract Anisotropic Soft Shadows
Abstract Approximation
Abstract Appr...
Hello I have a problem when grouping the OpenCV's functions in functions of my own and getting segmentation fault.
Even with code as simple as this
def acquire_imagen():
capture = cv.CaptureFromCAM( 0 )
img = cv.QueryFrame( capture )
return img
img = acquire_image()
print img[0,0]
If I call the same instructions outside the fun...
I've written the following code to do a binary search for a value, target, in a list or tuple, collection.
def binary(collection, target):
"""Binary search
Takes a sorted list or tuple, collection, then searches for target
Returns -1 if item isn't found. """
length = len(collection)
minimum = 0
maximum = length -...
I have a list of lists that looks something like this:
data = [['seq1', 'ACTAGACCCTAG'],
['sequence287653', 'ACTAGNACTGGG'],
['s9', 'ACTAGAAACTAG']]
I write the information to a file like this:
for i in data:
for j in i:
file.write('\t')
file.write(j)
file.write('\n')
The output looks lik...
I need to quickly look up words for a web application that I am writing in Django. I was thinking of putting each character of the word in an integerfield of its own, indexed by position.
class Word(models.Model):
word = models.CharField(max_length=5)
length = models.IntegerField()
c0 = models.IntegerField(blank=True, null...
I've written a Django application which interacts with a third-party API (Disqus, although this detail is unimportant) via a Python wrapper. When the service is unavailable, the Python wrapper raises an exception.
The best way for the application to handle such exceptions is to suppress them so that the rest of the page's content can st...
How can I convert a Javascript variable (not JSON format) into a python variable?
Example Javascript variable:
{
title: "TITLE",
name: "NAME",
active: false,
info: {
key1: "value1",
dict1: {
sub_key1: "sub_value1",
sub_key2: "sub_value2",
},
dict2: {
su...
I am planning to do email-registration-activation on my site which will be launched very soon. I have just started looking at django-registration and I am open to other email-registration-activation system available on django.
My only requirement is that for my site, I don't actually use usernames. Rather, user logs in with their email...
Hi am trying to learn web development using python. I have some previous experience using php but as such am a total amateur. I am using web2py after dabbling around with django,pylons,turbogears stuff etc and find myself quite productive with the framework. However I want to know what is the entire process in web development. I mean , t...
I have a Django application with a custom management command in one of the apps. If I log in over SSH I can run it without any problems with
python manage.py sitedir/mycommand
However, if I try to run the command as a oneliner from my local box like this:
ssh myserver python manage.py sitedir/mycommand
I get an ImportError li...
Hello
Is there anyway I can parse a website by just viewing the content as displayed to the user in his browser? That is, instead of downloading "page.htm"l and starting to parse the whole page with all the HTML/javascript tags, I will be able to retrieve the version as displayed to users in their browsers. I would like to "crawl" websi...
import telnetlib
def telNetCall():
host = "10.200.1.23"
user = "me"
password = "matrix"
telnet = telnetlib.Telnet(host)
telnet.read_until('Username: ', 3)
telnet.write(user + '\r')
telnet.read_until('Password: ', 3)
telnet.write(password + '\r')
telnet.write("sh log"+ "\r\n")
telnet.write(...
I have a model that has multiple text properties - title, short and long description etc. I want to have multilanguage site so I need a way to easy by able to add new languages and translations for this field for every item. What is the best way to achieve this?
...
Hi,
I'm building an app using facebook likes, under GAE with python.
I'd like do different actions if user likes the page or not:
page_url=url
if user likes page_url:
#do something
else:
#do something else
I'm interested in checking if the user already likes the page, not in the action of clicking the like button.
Also I'd l...
Hi,
Can someone tell me, how I can access all contacts relating to a specific group? I'm new to Django and did this (according to the docs):
def view_group(request, group_id):
groups = Group.objects.all()
group = Group.objects.get(pk=group_id)
contacts = group.contacts.all()
return render_to_response('manage/view_group...
Basically, me and a friend of mine are just planning to work on a Python project which would have GUI interface, and enable file transfer over and remote file listing. We have most of the tools which we are going to use, Glade, Python etcetera.
I just want to know if I should use an IDE or not.
I've heard only good things about Anjuta,...
The code I'm tring to get should look something like this:
send: 'GET /xml/atom.xml HTTP/1.0\r\nHost: diveintomark.org\r\nUser-Agent: Python-urllib/1.17\r\n\r\n'
reply: 'HTTP/1.1 410 Gone\r\n'
header: Date: Sat, 11 Sep 2010 11:47:19 GMT
header: Server: Apache
header: Content-Length: 307
header: Connection: close
header: C...
I am trying to use the google appengine python SKD from my ubuntu lucid. I have already compiled python2.5. But when I execute any "dev_appserver.py" command with it I get the following error:
Traceback (most recent call last):
File "dev_appserver.py", line 69, in <module>
run_file(__file__, globals())
File "dev_appserver.py", ...
Fairly simple; I've got the data I want out of the excel file, but can't seem to find anything inside the XLRD readme that explains how to go from this:
xldate:40397.007905092592
number:10000.0
text:u'No'
number:0.1203
number:0.096000000000000002
number:0.126
to their respective python datatypes. Any ideas?
...
I want to implement a simple VersionedModel base model class for my app engine app. I'm looking for a pattern that does not involve explicitly choosing fields to copy.
I am trying out something like this, but it is to hacky for my taste and did not test it in the production environment yet.
class VersionedModel(BaseModel):
is_histo...