Suppose this is my URL route:
(r'^test/?$','hello.life.views.test'),
How do I make it so that people can do .json, .xml, and it would pass a variable to my views.test, so that I know to make json or xml?
...
I'm looking to reimplement some Tcl code that uses the socket -server construct [1].
What's the best option in Python for a small, industrial strength multi-user network-based server that includes event loop processing/integration?
[1] http://www.tcl.tk/man/tcl8.4/TclCmd/socket.htm
...
Hello,
I have a message box pop up when a certain operation is being executed sort of "wait..." window and I want to have a "loading" *.gif animation there to lighten up the mood :)
Anyways I can't seem to figure out how to make this work. What i have now is a code where img_wait is a gif but it wont animate. It only shows first frame....
suppose I have a python list or a python 1-d array (represented in numpy). assume that there is a contiguous stretch of elements how can I find the start and end coordinates (i.e. indices) of the stretch of non-zeros in this list or array? for example,
a = [0, 0, 0, 0, 1, 2, 3, 4]
nonzero_coords(a) should return [4, 7]. for:
b = ...
The PyQt4 QTableWidget has both cellPressed and cellClicked signals. From the name, and the little experimentation I did with them, they appear to do exactly the same thing. Is there a difference between the two?
...
New to this library (no more familiar with BeautifulSoup either, sadly), trying to do something very simple (search by inline style):
<td style="padding: 20px">blah blah </td>
I just want to select all tds where style="padding: 20px", but I can't seem to figure it out. All the examples show how to select td, such as:
for col in page....
Ok, so I'm learning about sizers in wxPython and I was wondering if it was possible to do something like:
==============================================
|WINDOW TITLE _ [] X|
|============================================|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
I'm newbie for python, I'm having task so I need to scan wifi and send the data to the server, the below is the format which i have to send, this work fine when enter manually in browser url text box,
http://223.56.124.58:8080/ppod-web/ProcessRawData?data={"userId":"2220081127-14","timestamp":"2010-04-12 10:54:24","wifi":{"ssid":"guest...
Hi Guys,
I'm playing with Python 2.6 and its optparse module. I would like to convert one of my arguments to a datetime through a callback but it fails.
Here is the code:
def parsedate(option, opt_str, value, parser):
option.date = datetime.strptime(value, "%Y/%m/%d")
def parse_options(args):
parser = OptionParser(usage="%p...
Hi folks,
I'm looking for a way to read in c++ a text file containing numpy arrays and put the data into vector< vector< ... > > , can anyone help me out please ?
Thanks a lot.
Archy
EDIT: format of the text file
[[[ 0 1] [ 2 3] [ 4 5] [ 6 7] [ 8 9]] [[10 11] [12 13] [14 15] [16 17] [18 19]] [[20 21] [22 23] [24 25] [26 27] [28 29]] ...
Hello,
I have a test suite to perform smoke tests. I have all my script stored in various classes but when I try and run the test suite I can't seem to get it working if it is in a class. The code is below: (a class to call the tests)
from alltests import SmokeTests
class CallTests(SmokeTests):
def integration(self):
...
I need to display a piece of HTML only if a variable value appears in a list. I know that Django 1.2 has an 'in' operator. But I am working on a Google App Engine app. Is there a workaround I can use?
...
I am quite new to SQLAlchemy, or even database programming, maybe my question is too simple.
Now I have two class/table:
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = Column(String(40))
...
class Computer(Base):
__tablename__ = 'comps'
id = Column(Integer, primary_key=Tr...
In python the function random() generates a random float uniformly in the semi-open range [0.0, 1.0). In principle can it ever generate 0.0 (i.e. zero) and 1.0 (i.e. unity)? What is the scenario in practicality?
...
How would gmail have implemented this feature?
What technologies go behind enabling such features? Is it related to natural language processing?
Any pointers or programming resource would be useful?
It could be language neutral or specific to any language?It could be in Java/Python.
Do you think they do something with antlr etc., to achi...
I'm trying to write a very simple program, I want to print out the sum of all the multiples of 3 and 5 below 100, but, an error keeps accuring, saying "invalid literal for int() with base 10:" my program is as follows:
sum = ""
sum_int = int(sum)
for i in range(1, 101):
if i % 5 == 0:
sum += i
elif i % 3 == 0:
s...
An odd error here, perhaps someone can help track down source as it's attempting to extend the Django CMS project & attempts to use uses some logic written as part of that project which I'm not fully clear on. In short, using:
urls.py
======================
from django.conf.urls.defaults import *
from cmsplugin_flat_news.models import N...
System OSX or Linux
I'm trying to automate my work flow at work, each week I receive an excel file, which I convert to a csv.
An example is:
,,L1,,,L2,,,L3,,,L4,,,L5,,,L6,,,L7,,,L8,,,L9,,,L10,,,L11,
Title,r/t,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,neede d,actual,Inst,needed,actual,Inst,needed,actua...
I feel suddenly uneasy of not being able to perform this operation easily. It could be that I'm tired, or that there's really no way (google didn't help), but...
if you have a list in python, and want to extract element at indices say 1, 2 and 5 into a new list, how do you do ?
This is how I did it, but I'm not very satisfied
>>> a
[1...
A volunteer job requires us to convert a large number of LaTeX documents into ePub format. It's a series of open-source fiction book which has so far only been produced only on paper via a print on demand service. We'd like to be able to offer the book to users of book-reader devices (such as Kindle) which require the ePub format for bes...