Hello,
I am using templates with django. I am having a problem where the Context is not being rendered. The meta_k is null. The meta_description is not.
t = get_template('projects.html')
html = t.render(Context({
'completed': completed,
'current':current,
'description': sp.description,
'project_tit...
I learned Django following django book and the document. In the django book exmaple, the project is called mysite and there's an app called book inside this project. So in this case, the app is called "book". I've no problem with it.
My confusion arises in front of reusable apps. Reusable apps usually reside outside the project. For exa...
I have been working on developing this analytical tool to help interpret and analyze a database that is bundled within the package. It is very important for us to secure the database in a way that can only be accessed with our software. What is the best way of achieving it in Python?
I am aware that there may not be a definitive soluti...
Is it possible to programmatically retrieve any of the YAML parameters during run-time? Are they stored in the environment somewhere?
Good example would be to automatically find the application version and to add it as a comment in the landing HTML page.
...
I have the following Python code:
data = ['1', '4.6', 'txt']
funcs = [int, float, str]
How to call every function with data in corresponding index as an argument to the function?
Now I'm using the code:
result = []
for i, func in enumerate(funcs):
result.append(func(data[i]))
map(funcs, data) don't work with tuple of function...
As a part of some unit testing code that I'm writing, I wrote the following function. The purpose of which is to determine if 'a' could be rounded to 'b', regardless of how accurate 'a' or 'b' are.
def couldRoundTo(a,b):
"""Can you round a to some number of digits, such that it equals b?"""
roundEnd = len(str(b))
if a == b:...
I was trying to write an answer to this question and was quite surprised to find out that there is no find method for lists, lists have only the index method (strings have find and index).
Can anyone tell me the rationale behind that?
Why strings have both?
...
def LCS(word_list1, word_list2):
m = len(word_list1)
n = len(word_list2)
print m
print n
C = [[0] * (n+1) for i in range(m+1)] # IndentationError: unindent does not match any outer indentation level
print C
i=0
j=0
for word in word_list1:
j=0
for word in word_list2:
i...
I'm building a Django site. I need to model many different product categories such as TV, laptops, women's apparel, men's shoes, etc.
Since different product categories have different product attributes, each category has its own separate Model: TV, Laptop, WomensApparel, MensShoes, etc.
And for each Model I created a ModelForm. Hence ...
Hi,
I need to generate C structs and arrays from data stored in a db table, and alternately parse similar info. I use both ruby and python for this task, and was wondering if anyone heard of a module/lib that handles this for either/both languages? I could do this on my own with some string processing, but wanted to check if there's a k...
Hi!
I would like to extend the Queue.PriorityQueue described here: http://docs.python.org/library/queue.html#Queue.PriorityQueue
The queue will hold work packages with a priority. Workers will get work packages and process them. I want to make the following additions:
Workers have a priority too. When multiple workers are idle the on...
I'm using mechanize to fill out a form that has a series of rows. Each row is an <input type="checkbox"> followed by <td>name of the checkbox</td>. How do I read the name so I know whether to check the box?
Thanks
...
Trying to imitate Excel's SUMPRODUCT function:
SUMPRODUCT(v1, v2, ..., vN) =
v1[0]*v2[0]*...*vN[0] + v1[1]*v2[1]*...*vN[1] + ... + v1[n]*v2[n]*...*vN[n]
where n is the number of elements in each vector.
This is similar to dot product, but for multiple vectors. I read the very detailed discussion of the regular dot product, but I ...
I initially had a GladeXML object error. But I solved it after reading this post --> http://stackoverflow.com/questions/2668618/python-glade-could-not-create-gladexml-object
I've tried both the solutions mentioned there. However the window still doesn't appear.
...
I'm trying to setup a socket that won't block on accept(...), using the following code:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(("127.0.0.1", 1234))
event = win32event.CreateEvent(None, True, False, None)
win32file.WSAEventSelect(sock.fileno(), event, win32file.FD_ACCEPT)
sock.listen(5)
rc = win32event.WaitFor...
Hi
I want to develop a tool that does the following things.
take in a live voice recording
produce a real time spectrogram
show the time-domain signal
output few values extracted from the spectral analysis
All of these have to be kept updated in a window as the voice is recorded.
I have worked with numpy. But I'm completely new to...
I'm trying to get Python to a read line from a .txt file and write the elements of the first line into a list.
The elements in the file were separated with a TAB so I used split("\t") to separate the elements.
Because the .txt file has a lot of elements I saved the data found in each line into a separate list
(data from the first lin...
Starting with a class like this:
class FooClass(object):
@staticmethod
def static_method(x):
print x
normally, I would call the static method of the class with:
FooClass.static_method('bar')
Is it possible to invoke this static method having just the class name and the method name?
class_name = 'FooClass'
method_n...
i'm trying the solve problem update status using facebook API with pyfacebook
so i look at here http://stackoverflow.com/questions/1907662/update-facebook-pages-status-using-pyfacebook
and i think doesn't work anymore
well, finally i solve the problem
#!/usr/bin/python
import facebook
# Replace these with your app's credentials
api_key ...
a = [5, 66, 7, 8, 9, ...]
Is it possible to make an iteration instead of writing like this?
a[1] - a[0]
a[2] - a[1]
a[3] - a[2]
a[4] - a[3]
...
Thank you!
...