I have a class that has an output() method which returns a matplotlib Figure instance. I have a decorator I wrote that takes that fig instance and turns it into a Django response object.
My decorator looks like this:
class plot_svg(object):
def __init__(self, view):
self.view = view
def __call__(self, *args, **kwargs):...
I'm writing some code that needs to change function signatures. Right now, I'm using Simionato's FunctionMaker class, which uses the (hacky) inspect module, and does a compile. Unfortunately, this still loses the line and file metadata.
Does anyone know:
If it is possible to overwrite these values in some odd way?
If hacking up a c...
Are there any downsides to UPX-ing my 32-bit Python 2.6.4 development environment EXE/PYD/DLL files?
The reason I'm asking is that I frequently use a custom PY2EXE script that UPX's copies of these files on every build.
Yes, I could get fancy and try to cache UPXed files, but I think a simpler, safer, and higher performance solution wo...
I'm making an app that has a need for reverse searches. By this, I mean that users of the app will enter search parameters and save them; then, when any new objects get entered onto the system, if they match the existing search parameters that a user has saved, a notification will be sent, etc.
I am having a hard time finding solutio...
Note: I am cross-posting this from App Engine group because I got no answers there.
As part of my site about Japan, I have a feature where the user can
get a large PNG for use as desktop background that shows the user's
name in Japanese. After switching my site hosting entirely to App
Engine, I removed this particular feature because...
Hi ALl
Is there a way to find out which process is causing a particular event to occur?
In the inotify-tool version 3.13, in struct_kernel , pid,uid and gid are used but it is not handled in the source code.
Is there any latest patch available for the same.
Please let me know.
...
Hi,
when generating python wrappers with swig the python wrapper classes in the generated python file do not have an explicit self parameter, for example see below:
class PySwigIterator(_object):
def value(*args): return _spatiotemporalnmf.PySwigIterator_value(*args)
def incr(*args): return _spatiotemporalnmf.PySwigIterator_inc...
i am using PyQt but my question is a general Qt one:
I have a QTableWidget that is set up by the function updateTable. It writes the data from DATASET to the table when it is called. Unfortunately this causes my QTableWidget to emit the signal cellChanged() for every cell.
The signal cellChanged() is connected to a function on_tableWid...
I'm recently started to learn Twisted framework and now looking for some cheat sheets/reference cards with basic Twisted stuff. Such as deferreds, callbacks, reactor, protocols, factories, transports, so on.
At the moment found nothing neither on http://refcardz.dzone.com/ nor on http://www.cheat-sheets.org/
Any help appreciated.
...
How can I make sure setup.py compiles projects PO files and include them whenever an sdist is created. This is a Django app and manual process to generate MO files is to run following command in the app's root directory:
django-admin compilemessages
(This means going one level deeper than setup.py)
I would like to avoid manually comp...
I have a list containing a tuples and long integers the list looks like this:
table = [(1L,), (1L,), (1L,), (2L,), (2L,), (2L,), (3L,), (3L,)]
How do i convert the table to look like a formal list?
so the output would be:
table = ['1','1','1','2','2','2','3','3']
For information purposes the data was obtained from a mysql datab...
On a click of a button named "Add Textbox" it calls a function which creates a single textbox using (gtk.Entry) function. So each time i click that button it creates a textbox. I have a submit button which should fetches all the values of the text boxes(say 10 textboxes) generated with the name of "entry". It works for one textbox but no...
$$I need to get the numbers of one line randomly, and put each line in other array,then get the numbers of one col.
I have a big file, more than 400M. In that file, there are 13496*13496 number, means 13496 rows and 13496 cols. I want to read them to a array.
This is my code:
_L1 = [[0 for col in range(13496)] for row in range(13496)]
...
I have an issue with SQLAlchemy apparently committing. A rough sketch of my code:
trans = self.conn.begin()
try:
assert not self.conn.execute(my_obj.__table__.select(my_obj.id == id)).first()
self.conn.execute(my_obj.__table__.insert().values(id=id))
assert not self.conn.execute(my_obj.__table__.select(my_obj.id...
I must be overlooking something terribly obvious. I need to execute a C program, display its output in real time and finally parse its last line, which should be straightforward as the last line printed is always the same.
process = subprocess.Popen(args, shell = True,
stdout = subprocess.PIPE, stderr = subp...
I'm doing some prototyping with OpenCV for a hobby project involving processing of real time camera data. I wonder if it is worth the effort to reimplement this in C or C++ when I have it all figured out or if no significant performance boost can be expected. The program basically chains OpenCV functions, so the main part of the work sho...
Hi,
I am writing a multithreaded socket application in Python using the socket module.
the server listens for connections and when it gets one it spawns a thread for that socket.
the server thread sends some data to the client. but the client is not yet ready to receive it. I thought this would have caused the server to wait until the ...
Hi,
is there a way how to fully load some SQLAlchemy ORM mapped instance (together with its related objects) before detaching it from the Session? I want to send it via pipe into another processs and I don't want to merge it into session in this new process.
Thank you
Jan
...
I have a Pylons web application served by Apache (mod_wsgi, prefork). Because of Apache, there are multiple separate processes running my application code concurrently. Some of the non-critical tasks that the application does I want to defer for processing in background to improve "live" response times. So I'm thinking of task queue, man...
I've refactored how the merged-dictionary (all_classes) below is created, but I'm wondering if it can be more efficient.
I have a dictionary of dictionaries, like this:
groups_and_classes = {'group_1': {'class_A': [1, 2, 3],
'class_B': [1, 3, 5, 7],
'class_c': [1, 2],...