external access to instances

2007-10-11 Thread Ladislav Andel
Hello, I have an application which is running in a loop(client/server app using twisted and reactor) and where are kept list of instances in memory. Each instance has it's own loop and it periodically sends requests to given network endpoints. I would like to use a tool(module) which accesses thi

Re: ~ bit-wise unary operator

2007-09-26 Thread Ladislav Andel
Wow, so many answers :). Thank you, guys :). Lada Michal Bozon wrote: > cau, > maybe int is represented internally as a signed integer > > you can use numpy types: > > >>>> import numpy >>>> ~ numpy.uint16(7978) >>>> > 57557 &g

~ bit-wise unary operator

2007-09-26 Thread Ladislav Andel
Hello, why ~ bit-wise unary operator returns -(x+1) and not bit inversion of the given integer? example: a = 7978 a = ~a python returns -7979 but I need to get back 57557 as in C language. which is also in binary 000100101010 and inverted 111011010101 Is here any other operator or do I

Re: comparing two lists

2007-08-27 Thread Ladislav Andel
I have learnt a lot from your example and used it for my purpose. Thank you, it very helped me. Lada Peter Otten wrote: > Ladislav Andel wrote: > > >> need to be stopped before deleting any instance from items. >> So I need to call stopLoop method in the given item in it

Re: comparing two lists

2007-08-24 Thread Ladislav Andel
Peter Otten wrote: > Ladislav Andel wrote: > > >> Peter Otten wrote: >> >>> Ladislav Andel wrote: >>> >>> >>> >>>> what would be the most efficient way to do following? >>>> >>>>

Re: comparing two lists

2007-08-23 Thread Ladislav Andel
Peter Otten wrote: > Ladislav Andel wrote: > > >> Peter Otten wrote: >> >>> Ladislav Andel wrote: >>> >>> >>> >>>> what would be the most efficient way to do following? >>>> >>>>

Re: comparing two lists

2007-08-23 Thread Ladislav Andel
Well, I know it's quite ugly what I did to the code, but any improvements are welcome. Actually, it doesn't work as it should yet. The items should stay the same as at the beginning. I say in one sentence what I want to achieve: Synchronized items with dblist. It should remove hosts from items whi

Re: comparing two lists

2007-08-23 Thread Ladislav Andel
Peter Otten wrote: > Ladislav Andel wrote: > > >> what would be the most efficient way to do following? >> >> I have a list of dictionaries taken from DB e.g. >> dblist = [{'id:1, 'host':'google.com','ip_address':'1.

Re: comparing two lists

2007-08-23 Thread Ladislav Andel
[EMAIL PROTECTED] wrote: > On Aug 23, 11:27 am, Ladislav Andel <[EMAIL PROTECTED]> wrote: > >> Hi, >> what would be the most efficient way to do following? >> >> I have a list of dictionaries taken from DB e.g. >> dblist = [{'id:1, 'host

comparing two lists

2007-08-23 Thread Ladislav Andel
Hi, what would be the most efficient way to do following? I have a list of dictionaries taken from DB e.g. dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'}, {'id:3, 'host':'yahoo.com','ip_address':'5.6.7.8'}, {'id:9, 'host':'msn.com','ip_address':'11.3.2.3'}] and list of object in

Re: twisted - locking threads when deferToThread is used

2007-08-08 Thread Ladislav Andel
And here is the code: from twisted.internet import reactor, defer, threads from siptest import siptest_f from twisted.internet.threads import deferToThread test_opts = {'username':'test','transport':'udp','localport':'5085','password':'test'} domain = ['sip.1und1.de', 'sip.babble.net'] class

Re: twisted - locking threads when deferToThread is used

2007-08-08 Thread Ladislav Andel
Chris Mellon wrote: > On 8/8/07, Chris Mellon <[EMAIL PROTECTED]> wrote: > >> On 8/8/07, Ladislav Andel <[EMAIL PROTECTED]> wrote: >> >>> Hi, >>> I'm writing an application which will be periodically testing servers. >>> I will

twisted - locking threads when deferToThread is used

2007-08-08 Thread Ladislav Andel
Hi, I'm writing an application which will be periodically testing servers. I will have a global list of these servers(domain names) and need to do few tasks. 1) DNS checks - I will use asynchronous twisted-names for it - in case there is a difference comparing to the list it should update the list

Re: display image through cgi python html

2007-07-24 Thread Ladislav Andel
Thanks for quick reply. Yes, that's the hint I needed. Lada Marc 'BlackJack' Rintsch wrote: > On Tue, 24 Jul 2007 11:58:47 +0200, Ladislav Andel wrote: > > >> Here is what I have in image.cgi but it is incorrect and i'm not able to >> find it on

display image through cgi python html

2007-07-24 Thread Ladislav Andel
Hi, I'm trying to display image through my cgi script in HTML page via Can you give me an example, please? What should be in the cgi script to display it? Here is what I have in image.cgi but it is incorrect and i'm not able to find it on the web. #!/usr/bin/python print "Content-Type: image/p

Re: lists and dictionaries

2007-07-17 Thread Ladislav Andel
en server-name = Yes. In newlist should be the server name Asterisk though. how could I make a new list of dictionaries which would look like: [{'transports': ['udp','tcp'], 'service_domain': 'dp0.example.com', 'ip_addr': '1.2.3.4',

Re: lists and dictionaries

2007-07-12 Thread Ladislav Andel
Thank you to all of you guys. It's exactly I was looking for. Lada Bart Ogryczak wrote: > On 12 jul, 04:49, anethema <[EMAIL PROTECTED]> wrote: > >>> li = [ {'index': 0, 'transport': 'udp', 'service_domain': >>> 'dp0.example.com'}, >>> {'index': 1, 'transport': 'udp', 'service_domain

Re: lists and dictionaries

2007-07-12 Thread Ladislav Andel
Thank you to all of you guys. It's exactly I was looking for. > You provide scant information for this task. For example, is the > new list ordered or unordered? Can the list corresponding to the > 'transports' key contain duplicates? > unordered is fine.. I will be storing it in DB from that

lists and dictionaries

2007-07-11 Thread Ladislav Andel
Hi, I have a list of dictionaries. e.g. [{'index': 0, 'transport': 'udp', 'service_domain': 'dp0.example.com'}, {'index': 1, 'transport': 'udp', 'service_domain': 'dp1.example.com'}, {'index': 0, 'transport': 'tcp', 'service_domain': 'dp0.example.com'}, {'index': 1, 'transport': 'tcp', 'service_dom