Hi, am looking for a way to run django by just using my xampp, and i bumped into this tutorial online
http://jyotirmaya.blogspot.com/2008/11/xampp-python-django.html
according to the author, mod_python 3.3.1 is not supported by python 2.6, but the blog post was created more then a year ago i think. is this thing still true until now? or ...
I'm planning on building a Django log-viewing app with powerful filters. I'd like to enable the user to finely filter the results with some custom (possibly DB-specific) SELECT queries.
However, I dislike giving the user write access to the database. Is there a way to make sure a query doesn't change anything in the database? Like a 'dr...
Possible Duplicate:
To learn python 2 then 3, or 3 from the start?
I am going to start learning Python soon and I am unsure whether or not I should learn Python 2 or 3 (for general programming, no web development). I know this has been asked before but those were old, before Python 3 was stable enough for production. So is it ...
Hi guys, I have a dictionary(python) with key->value (str->int). I have to chose some key due to it's own value. Then bigger this value the key has less posibility to be chosen. For example if key1 has value 2 and key2->1 key1 the attitude should be 2:1.
How can I do this?
...
The module pyfsevents allows Python programs to utilize the Mac OS X FSEvents framework. One can register a path and a callback function, then call the listen() function, which blocks until a file system event happens in the registered path.
pyfsevents.registerpath("/example", callback)
pyfsevents.listen()
I would like to use ...
I want to use buildout for dependency management, and I hear distribute is the new good way to manage installation of your project.
However, easy tutorials to get started seem to be thin on the ground. The most straight forward I've seen is Jacob Kaplan-Moss's Developing Django apps with zc.buildout (my use case is a web application), b...
Basically lets say i have:
>>> a = [1,3,2,2,2]
>>> b = [1,3,2]
I want to see if the all the elements in b, exists within a, and in the same order. So for the above example b would exist within a.
I am kinda hoping theres a really simple one line answer.
...
first, an example:
given a bunch of Person objects with
various attributes (name, ssn, phone,
email address, credit card #, etc.)
now imagine the following simple
website:
uses a person's email address as unique login name
lets users edit their attributes (including their email address)
if this website ha...
Hi,
I receive the following string from one website via mechanize:
'We\x92ve'
I know that \x92 stands for ’ character. I'm trying to convert that string to Unicode:
>> unicode('We\x92ve','utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 2: unexpected code byte
What am I doing wrong?
Edit: The reason I t...
Hello,
with this code:
import wx
class Plugin(wx.Panel):
def __init__(self, parent, *args, **kwargs):
panel = wx.Panel.__init__(self, parent, *args, **kwargs)
self.colorOver = ((89,89,89))
self.colorLeave = ((110,110,110))
self.colorFont = ((145,145,145))
self.SetBackgroundColour(self.colo...
I'm trying to get the status of an Asterisk Server using a python socket but nothing happens.
Here is my code:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = '192.168.1.105'
PORT = 5038
s.connect((HOST, PORT))
params = """Action: login
Events: off
Username: admin
Secret: mypass
Action: status
Action: Logo...
I just tried this python 2.5 snippet to write some XML:
xmldoc = xml.dom.minidom.Document()
feed = xmldoc.createElementNS("http://www.w3.org/2005/Atom", "feed")
xmldoc.appendChild(feed)
print xmldoc.toprettyxml()
I expected the output to look like this:
<?xml version="1.0" ?>
<feed xmlns="http://www.w3.org/2005/Atom" />
Instead I g...
Forgive me for yet another question on Python decorators. I did read through many of them, but I wonder what the best solution to the specific following problem is.
I have written several functions that do some form of gradient descent in numpy/scipy. Given a matrix X, I try to iteratively minimize some distance, d(X, AS), as functions ...
Hi,
Currently I have a code that checks if given element in array is equal = 0 and if so then set the value to 'level' value (temp_board is 2D numpy array, indices_to_watch contains 2D coordinates that should be watched for zeros).
indices_to_watch = [(0,1), (1,2)]
for index in indices_to_watch:
if temp_board[index] == 0...
I have 43 text files that consume "232.2 MB on disk (232,129,355 bytes) for 43 items". what to read them in to memory (see code below). The problem I am having is that each file which is about 5.3mb on disk is causing python to use an additional 100mb of system memory. If check the size of the dict() getsizeof() (see sample of output). W...
hi,
I am trying to interleave two audio files as given in the interleave GStreamer documentation:
gst-launch interleave name=i ! audioconvert ! wavenc ! filesink location=file.wav filesrc location=file1.wav ! \
decodebin ! audioconvert ! "audio/x-raw-int,channels=1" ! queue ! i.sink0 filesrc location=file2.wav ! \
decodebin ! audio...
I'm new to Django (and Python), and am trying to figure out how to conditionalize certain aspects of form validation. In this case, there's a HTML interface to the application where the user can choose a date and a time from widgets. The clean method on the form object takes the values of the time and date fields and turns them back into...
Hi,
I am trying to have a file path like 'C:\Programfiles\file.txt' but i would like to have file.txt be a variable that i can change whenever i need to. I am trying to compare 2 directories then copy files from one to another if they arent already there. i have this code so far.
import os
import shutil
A= set(os.listdir(r"C:\Users\Mor...
Hi,
I am having trouble exchanging my Oauth request token for an Access Token. My Python application successfully asks for a Request Token and then redirects to the Google login page asking to grant access to my website. When I grant access I retrieve a 200 status code but exchanging this authorized request token for an access token giv...
So I simply want to use the delete() from the django.contrib.comments.views.moderation module, but only allowing the users with permission to delete their comments. In order to do this, all I have to do is uncomment #@permission_required("comments.delete_comment"), but I want to be able to do this without modifying the django framework. ...