Hi
I have a tcp server which uses the select call to multiplex reading from clients.
I have a client class (MClient) which manages the decoding of incoming data packets
while(1)
rlist, wlist, xlist = select( input_sockets, output_sockets, [] , 1)
for insock in rlist: #any clients????
if insock is server_socket:
...
I've found that under some circumstances the Eclipse python debugger can be unreliable. For example, when stepping through a memory-hungry Python program I've found that after a certain point the debugger fails to respond. The entire process hangs with 100% cpu load.
I've heard (unconfirmed) reports from developers that when this occur...
The following problem occurs on a machine running Ubuntu 10.04 with the 2.6.32-22-generic kernel: Setting a limit for the Resident Set Size (RSS) of a process does not seem to have any effect. I currently set the limit in Python with the following code:
import resource
# (100, 100) is the (soft, hard) limit. ~100kb.
resource.setrlimit(r...
Related (for the no-association-object use case): http://stackoverflow.com/questions/1889251/sqlalchemy-many-to-many-relationship-on-a-single-table
Building a many-to-many relationship is easy. Building a many-to-many relationship on the same table is almost as easy, as documented in the above question.
Building a many-to-many relation...
Hello,
I am trying to replace a variable stored in another file using regular expression. The code I have tried is:
r = re.compile(r"self\.uid\s*=\s*('\w{12})'")
for line in fileinput.input(['file.py'], inplace=True):
print line.replace(r.match(line), sys.argv[1]),
The format of the variable in the file is:
self.uid = '027FC8E...
Hi new to django but I'm having issues with the stylesheets (CSS) of pages.
my settings.py contains
MEDIA_ROOT = ''
MEDIA_URL = ''
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates'),
)
please can someone help me shed some light on what I need to do to get the CSS styles working in my templates
Thanks
...
I'm looking for a way to simulate browser resources expansion behavior.
The flow I'm trying to address is the following:
Access an initial URL (e.g. http://example.dmn/index.htm)
Parse the html response received (e.g. index.htm)
Find the resources that a browser will fetch as a result of the index parsing, e.g.:
Images
Flash
...
Hi SO, I could use a little help in AppEngine land...
Using the [Python] API I create relationships like this example from the docs:
class Author(db.Model):
name = db.StringProperty()
class Story(db.Model):
author = db.ReferenceProperty(Author)
story = db.get(story_key)
author_name = story.author.name
As I understand it, t...
Is there no sane way to peform a scripted install of binary python packages for windows? Unfortunately it seems like several essential windows python packages like pywin32 and py2exe are only available as EXE's not MSI's (and as far as I know only the latter are scriptable). Easy_install/pip also seems no use since they apparently only f...
Hi,
I have a file on server which is viewed by the client asynchronously as and when required .
The file is going to get modified on server side . Also updates are reflected in browser also
In my views.py the code is :
def showfiledata(request):
somecommand ="ls -l > /home/tazim/webexample/templates/tmp.txt"
with open("/h...
Hi, in Python script, for every method definition in some C++ code of the form:
return_value ClassName::MethodName(args)
{MehodBody}
I need to extract three parts: the class name, the method name and the method body for further processing. Finding and extracting the ClassName and MethodName is easy, but is there any simple way to ex...
So I have a table with a datestamp and two fields that I want to make sure that they are unique in the last month.
table.id
table.datestamp
table.field1
table.field2
There should be no duplicate record with the same field1 + 2 compound value in the last month.
The steps in my head are:
Group by the two fields
Look back over the las...
I have a dialog created in PyQt. It's purpose and functionality don't matter.
The init is:
class MyDialog(QWidget, ui_module.Ui_Dialog):
def __init__(self, parent=None):
super(MyDialog, self).__init__(parent)
self.setupUi(self)
self.installEventFilter(self)
self.setWindowFlags(Qt.Dialog | Qt....
I like the idea of sqlite's manifest typing / type affinity:
http://www.sqlite.org/datatype3.html
Essentially, if I set a column's affinity as 'numeric', it will duck type integers or floats to store them as such, but still allow me to store strings if I want to. Seems to me this is the best 'default' type for a column when i'm not su...
Hello,
I am trying to understand the advantages of the module Multiprocessing over Threading. I know that Multiprocessing get's around the Global Interpreter Lock, but what other advantages are there, and can threading not do the same thing?
...
I write a python class which makes asynchronous method calls using D-Bus. When my reply_handler is called, it stores data in list. This list can be used by another class methods at the same time. Is it safe or I can use only synchronized data structures like Queue class?
...
Possible Duplicate:
is python slower than java/C#?
Ignoring all the characteristics of each languages and focusing SOLELY on speed, which language is better performance-wise?
You'd think this would be a rather simple question to answer, but I haven't found a decent one.
I'm aware that some types of operations may be faster w...
Hi i'm wondering if i can send a custom header like "yadayadayad" to the server with the pycurl requsest ?
Thanks :)
...
I have a user logged in.
How can i extend/renew expiry date of session received from the request ?
Thanks in advance!
...
I'm desperately trying to successfully install psycopg2 but keep running into errors. The latest one seems to involve it not being to find "stdarg.h" (see code below). However I can see with my own eyes that a file called stdarg.h exists at /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h (where it claims it can't find anything) so I...