I would like to dynamically create thumbnails based on parameters in the URL. For example, http://mysite.com/images/1234/120x45.jpg would create a 120x45 thumbnail for image id 1234.
The obvious solution to this is to have a django view which does the following:
Look for a previously cached version of the image at this size.
Create a ...
Thank you for registering an account at example.com.
To activate your registration, please visit the following page:
http://example.com/activate/d5544f645c80f8a6c9af934c03a2ee2d7902dc1f/
This page will expire in 7 days.
example.com?????
i click the url,but not active my account.
why????
...
I need a regex in python to find a links html in a larger set of html.
so if I have:
<ul class="something">
<li id="li_id">
<a href="#" title="myurl">URL Text</a>
</li>
</ul>
I would get back:
<a href="#" title="myurl">URL Text</a>
I'd like to do it with a regex and not beautifulsoup or something similar to that. Does anyone ...
Say I have this simple python script:
file = open('C:\\some_text.txt')
print file.readlines()
print file.readlines()
When it is run, the first print prints a list containing the text of the file, while the second print prints a blank list. Not completely unexpected I guess. But is there a way to 'wind back' the file so that I can read...
I want use a model to save the system setting for a django app, So I want to limit the model can only have one record, how to do the limit?
...
I'm trying to find a neat way of summing a list and a list of lists in the same function, so far I've got:
import operator
"""
Fails late for item = ['a', 'b']
"""
def validate(item):
try:
return sum(item) == sum(range(1, 10))
except TypeError:
return sum(reduce(operator.add, item)) == sum(range(1, 10))
"""
...
Hi,
When I run this code and focus on choice it is raise a error. I close
this message but it is come back again. I want to see only one time
this message. How can i do this? What is error in my code ?
Note:
I'm sorry for my English. I know it isn't good.
#! -*- coding:utf-8 -*-
import wx
class MyPanel(wx.Panel):
def __init__(self,...
I'm writing a Python program that, if the user changes settings while running it, needs to be restarted to apply the changed settings. Is there a way of doing this? I'm thinking something along the lines of:
import sys
command_line = ' '.join(sys.argv)
# Now do something with command_line
# Now call my custom exit procedure
Note: I'm ...
I am using the following code and geting some indentation problem
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
I am geting following error
File "E:\Softwares\Django-...
I built a a.py in my mysite file,
a.py:
from django.core.management import setup_environ
from mysite import settings
setup_environ(settings)
from django.contrib.sites.models import Site
domain = Site.objects.get_current().domain
print domain
It prints:
:example.com
How do I change the 'domain' to 127.0.0.1:8000?
...
I have two frames one parent and child.
the parent will invoke the child.
The program should not allow the user to access the parent until the user closes the child
How can i achive it?
Need a solution without hiding the parent
...
I'm writing an application in Python, and I've got a number of universal variables (such as the reference to the main window, the user settings, and the list of active items in the UI) which have to be accessible from all parts of the program1. I only just realized I've named the module globals.py and I'm importing the object which cont...
I have installed networkx and matplotlib packages. How can I generate a power law graph based on degree correlation i.e. graphs with high or low degree of homophily
...
I need a functionality in Django to rotate an image posted by users using a form. I need a method I can maybe put in imageutils.py and then use it in my form.
How can it be achieved?
...
I created a nice RSS application in Python. It took a while and most of the code just does heavy work, like formatting XML, downloading feeds, etc. To the application itself requires very little user interaction, just a initial list of RSS feeds and some parameters.
What would be really nice, is if I was able to have a web front-end ...
I've got a model called Card which has a ManyToMany relationship to
Tag. When I save a Card, I'd like to create a Product as well, which I
want to have the same ManyToMany relationship to tag.
How do I access the instance's tags? self.tags.all() gives an empty
list, while if I check after saving, the card actually has tags. My
code...
Hello everyone,
Can someone tell me how to add a padding to the data to make it acceptable for AES256 encryption algorithm in pycrypto library (Python).
Thanks a lot in advance.. :)
...
if i want to add 10 QPushButton at one time:
NumCount=20
for i in range(NumCount):
btn=QPushButton("%s %s" %("Button" i+1),self)
btn.clicked.connect(self.btnclick)
def btnclick(self):
# here is my question
# how to define which button clicked?
# how to print btn.text?
as stated in the def(btnclick).
...
I have created a python web virtual environment contains all django, pylons related packages. I use the host ubuntu desktop PC at home and I have ubuntu virtual machine running on windows PC laptop.
Both the operating systems are linux only. I will be using the same environment for production that will be ubuntu server.
Is it possible ...
Hello,
I am running test but I want to run 2 functions at the same time. I have a camera and I am telling it to move via suds, I am then logging into the camera via SSH to check the speed the camera is set to. When I check the speed the camera has stopped so no speed is available. Is there a way I can get these functions to run at the s...