from Tkinter import *
from tkMessageBox import *
class Gui:
def __init__(self, root):
self.container = Frame(root)
self.container.grid()
self.inputText = Text(self.container, width=50, height=8)
self.outputText = Text(self.container, width=50, height=8, bg='#E0E0E0', state=DISABLED)
self.inputText.grid(row=0, column=0)
self...
I'm trying to recurse over a list (eg. [True, [[True, False], [False, [False, True]]]]) using Python. I know that the list length will always be 2 and both values will be boolean. I'd like to take those values and substitute them back into the list until there are only 2 values left (or 1 boolean value). Any help would be much appreci...
I’m trying to implement a SOAP webservice in Python 2.6 using the suds library. That is working well, but I’ve run into a problem when trying to parse the output with lxml.
Suds returns a suds.sax.text.Text object with the reply from the SOAP service. The suds.sax.text.Text class is a subclass of the Python built-in Unicode class. In es...
We have hundreds of thousands of tasks that need to be run at a variety of arbitrary intervals, some every hour, some every day, and so on. The tasks are resource intensive and need to be distributed across many machines.
Right now tasks are stored in a database with an "execute at this time" timestamp. To find tasks that need to be exe...
Hi folks,
I'm thinking of adding a reputation system to a web application, the site is already being used so I'm trying to be careful about my choices.
I'm developing in Django/Python, thought this would be important.
Reputation is generated in all actions that contribute to the site, similar to Stackoverflow's system.
I know there a...
I joined two tables together and what I like to do is concatenate multi vaule in one records without duplicated value.
Input Table
Table name: TAXLOT_ZONE
TID ZONE
1 A
1 A
1 B
1 C
2 D
2 D
2 E
3 A
3 B
4 C
5 D
Desirable output table looks like;
table name: Taxlot_zone_out
TID ZONE
1 A, B...
Consider I have an array of elements out of which I want to create a new 'iterable' which on every next applies a custom 'transformation'. What's the proper way of doing it under python 2.x?
For people familiar with Java, the equivalent is Iterables#transform from google's collections framework.
Ok as for a dummy example (coming from J...
Is there a way to abort a python write operation in such a way that the OS doesn't feel it's necessary to flush the unwritten data to the disc?
I'm writing data to a USB device, typically many megabytes. I'm using 4096 bytes as my block size on the write, but it appears that Linux caches up a bunch of data early on, and write it out to ...
This has been discussed on StackOverflow before - I am trying to find a good way to find the absolute path of a file object, but I need it to be robust to os.chdir(), so cannot use
f = file('test')
os.path.abspath(f.name)
Instead, I was wondering whether the following is a good solution - basically extending the file class so that on...
I have a list of books titles:
"The Hobbit: 70th Anniversary Edition"
"The Hobbit"
"The Hobbit (Illustrated/Collector Edition)[There and Back Again]"
"The Hobbit: or, There and Back Again"
"The Hobbit: Gift Pack"
and so on...
I thought that if I normalised the titles somehow, it would be easier to implement an automated way to kno...
Specifically, I want to create a backup of a list, then make some changes to that list, append all the changes to a third list, but then reset the first list with the backup before making further changes, etc, until I'm finished making changes and want to copy back all the content in the third list to the first one. Unfortunately, it see...
Is there a project that can log errors in requests to Django on Google App Engine to the datastore (like django-db-log or django.crashlog)?
Thanks!
...
Is there any form of short-time Fourier transform with corresponding inverse transform built into SciPy or NumPy or whatever?
There's the pyplot specgram function in matplotlib, which calls ax.specgram(), which calls mlab.specgram(), which calls _spectral_helper():
#The checks for if y is x are so that we can use the same function to
...
Hi,
If I have a file myfile.py, which imports Class1 from file.py and file.py contains imports to different classes in file2.py, file3.py, file4.py.
In my myfile.py, can I access these classes or do I need to again import file2.py, file3.py etc...
My question is whether python automatically add all the imports included in the file I i...
Since functions are values in Python, how do I determine if the variable is a function?
For example:
boda = len # boda is the length function now
if ?is_var_function(boda)?:
print "Boda is a function!"
else:
print "Boda is not a function!"
Here hypothetical ?is_var_function(x)? should return true if x is a callable function, an...
Hi,
I am planning to make some big project (1 000 000 users, approximately 500 request pre second - in hot time).
For performance I'm going to use no relational dbms (each request could cost lot of instructions in relational dbms like mysql) - so i can't use DAL.
My question is:
how web2py is working with a big traffic, is it work c...
Hi everybody. Consider something like:
struct Parameter
{
int a;
Parameter(){a = 0;}
void setA(int newA){a = newA;}
};
struct MyClass
{
void changeParameter(Parameter &p){ p.setA(-1);}
};
Well, let's fast forward, and imagine I already wrapped those classes, exposing everything to python, and imagine also I instantiate...
How can it be that this test case
import unittest
class PropTest(unittest.TestCase):
def test(self):
class C():
val = 'initial val'
def get_p(self):
return self.val
def set_p(self, prop):
if prop == 'legal val':
self.val = prop
...
Dear Everyone
I am interested to perform kmeans clustering on a list of words with the distance measure being Leveshtein.
1) I know there are a lot of frameworks out there, including scipy and orange that has a kmeans implementation. However they all require some sort of vector as the data which doesn't really fit me.
2) I need a good...
Hello folks. I've been getting lots of answers from stackoverflow now that I'm in Django just by searching. Now I hope my question will also create some value for everybody.
In choosing Django, I was hoping there was some similar mechanism to the way you can do partials in ROR. This was going to help me in two ways. One was in gener...