Search Results

Search found 6 results on 1 pages for 'jkp'.

Page 1/1 | 1 

  • How can I use pywin32 with a virtualenv without having to include the host environment's site-packag

    - by jkp
    I'm working with PyInstaller under Python 2.6, which is only partially supported due to the mess MS have created with their manifest nonense which now affects Python since it is now MSVC8 compiled. The problem is that the manifest embedding support relies on the pywin32 extensions in order to build which is a pain because without including the host's site-packages folder when I create the virtualenv (kinda defeats the point in a build environment) I cannot find a way to install the required extensions so they are accessible to PyInstaller. Has anyone found a solution to this issue?

    Read the article

  • How should I unit test a code-generator?

    - by jkp
    This is a difficult and open-ended question I know, but I thought I'd throw it to the floor and see if anyone had any interesting suggestions. I have developed a code-generator that takes our python interface to our C++ code (generated via SWIG) and generates code needed to expose this as WebServices. When I developed this code I did it using TDD, but I've found my tests to be brittle as hell. Because each test essentially wanted to verify that for a given bit of input code (which happens to be a C++ header) I'd get a given bit of outputted code I wrote a small engine that reads test definitions from XML input files and generates test cases from these expectations. The problem is I dread going in to modify the code at all. That and the fact that the unit tests themselves are a: complex, and b: brittle. So I'm trying to think of alternative approaches to this problem, and it strikes me I'm perhaps tackling it the wrong way. Maybe I need to focus more on the outcome, IE: does the code I generate actually run and do what I want it to, rather than, does the code look the way I want it to. Has anyone got any experiences of something similar to this they would care to share?

    Read the article

  • Is it possible to load a new Applescript scripting addition whilst my script is running?

    - by jkp
    According to various documents and discussions this used to be possible: you needed a block something like this in your script: try tell me to «event ascrgdut» end try tell me to doTheFunkyNewThing The event corresponds to hidden event with the undocumented C constant kUpdateAEUT (see here for the declaration of the constant) which should force the scripting additions to be reloaded. I've written a scripting addition and played around with this method of getting it to load but I have had no luck at all. I can only make it load by starting my script after the extension has been installed. Does anyone know if there is a way to make this work? Has this functionality been disabled in more recent OS X releases? I'm using OS X 10.6.2 FWIW.

    Read the article

  • Memory management with Objective-C Distributed Objects: my temporary instances live forever!

    - by jkp
    I'm playing with Objective-C Distributed Objects and I'm having some problems understanding how memory management works under the system. The example given below illustrates my problem: Protocol.h #import <Foundation/Foundation.h> @protocol DOServer - (byref id)createTarget; @end Server.m #import <Foundation/Foundation.h> #import "Protocol.h" @interface DOTarget : NSObject @end @interface DOServer : NSObject < DOServer > @end @implementation DOTarget - (id)init { if ((self = [super init])) { NSLog(@"Target created"); } return self; } - (void)dealloc { NSLog(@"Target destroyed"); [super dealloc]; } @end @implementation DOServer - (byref id)createTarget { return [[[DOTarget alloc] init] autorelease]; } @end int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; DOServer *server = [[DOServer alloc] init]; NSConnection *connection = [[NSConnection new] autorelease]; [connection setRootObject:server]; if ([connection registerName:@"test-server"] == NO) { NSLog(@"Failed to vend server object"); } else [[NSRunLoop currentRunLoop] run]; [pool drain]; return 0; } Client.m #import <Foundation/Foundation.h> #import "Protocol.h" int main() { unsigned i = 0; for (; i < 3; i ++) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; id server = [NSConnection rootProxyForConnectionWithRegisteredName:@"test-server" host:nil]; [server setProtocolForProxy:@protocol(DOServer)]; NSLog(@"Created target: %@", [server createTarget]); [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; [pool drain]; } return 0; } The issue is that any remote objects created by the root proxy are not released when their proxy counterparts in the client go out of scope. According to the documentation: When an object’s remote proxy is deallocated, a message is sent back to the receiver to notify it that the local object is no longer shared over the connection. I would therefore expect that as each DOTarget goes out of scope (each time around the loop) it's remote counterpart would be dellocated, since there is no other reference to it being held on the remote side of the connection. In reality this does not happen: the temporary objects are only deallocate when the client application quits, or more accurately, when the connection is invalidated. I can force the temporary objects on the remote side to be deallocated by explicitly invalidating the NSConnection object I'm using each time around the loop and creating a new one but somehow this just feels wrong. Is this the correct behaviour from DO? Should all temporary objects live as long as the connection that created them? Are connections therefore to be treated as temporary objects which should be opened and closed with each series of requests against the server? Any insights would be appreciated.

    Read the article

  • How do I create a gradient button on an iPhone?

    - by jkp
    How can I create a button that looks like the one found in the screenshot below on an iPhone with the 3.0 SDK? It's a button that shows when connecting to a host iTunes library from the iTunes remote. Is it a case of writing a custom control or is this a stock style?

    Read the article

  • Python soap using soaplib (server) and suds (client)

    - by Celso Axelrud
    This question is related to: http://stackoverflow.com/questions/1751027/python-soap-server-client In the case of soap with python, there are recommendation to use soaplib (http://wiki.github.com/jkp/soaplib) as soap server and suds (https://fedorahosted.org/suds/) as soap client. My target is to create soap services in python that can be consumed by several clients (java, etc). I tried the HelloWorld example from soaplib (http://trac.optio.webfactional.com/wiki/HelloWorld). It works well when the client is also using soaplib. Then, I tried to use suds as client consuming the HelloWorld services and it fail. -Why this is happening? Does soaplib server has problems to consumed by different clients? Here the code for the server: from soaplib.wsgi_soap import SimpleWSGISoapApp from soaplib.service import soapmethod from soaplib.serializers.primitive import String, Integer, Arraycode class HelloWorldService(SimpleWSGISoapApp): @soapmethod(String,Integer,_returns=Array(String)) def say_hello(self,name,times): results = [] for i in range(0,times): results.append('Hello, %s'%name) return results if __name__=='__main__': from cherrypy.wsgiserver import CherryPyWSGIServer #from cherrypy._cpwsgiserver import CherryPyWSGIServer # this example uses CherryPy2.2, use cherrypy.wsgiserver.CherryPyWSGIServer for CherryPy 3.0 server = CherryPyWSGIServer(('localhost',7789),HelloWorldService()) server.start() This is the soaplib client: from soaplib.client import make_service_client from SoapServerTest_1 import HelloWorldService client = make_service_client('http://localhost:7789/',HelloWorldService()) print client.say_hello("Dave",5) Results: >>> ['Hello, Dave', 'Hello, Dave', 'Hello, Dave', 'Hello, Dave', 'Hello, Dave'] This is the suds client: from suds.client import Client url = 'http://localhost:7789/HelloWordService?wsdl' client1 = Client(url) client1.service.say_hello("Dave",5) Results: >>> Unhandled exception while debugging... Traceback (most recent call last): File "C:\Python25\Lib\site-packages\RTEP\Sequencing\SoapClientTest_1.py", line 10, in <module> client1.service.say_hello("Dave",5) File "c:\python25\lib\site-packages\suds\client.py", line 537, in __call__ return client.invoke(args, kwargs) File "c:\python25\lib\site-packages\suds\client.py", line 597, in invoke result = self.send(msg) File "c:\python25\lib\site-packages\suds\client.py", line 626, in send result = self.succeeded(binding, reply.message) File "c:\python25\lib\site-packages\suds\client.py", line 658, in succeeded r, p = binding.get_reply(self.method, reply) File "c:\python25\lib\site-packages\suds\bindings\binding.py", line 158, in get_reply result = unmarshaller.process(nodes[0], resolved) File "c:\python25\lib\site-packages\suds\umx\typed.py", line 66, in process return Core.process(self, content) File "c:\python25\lib\site-packages\suds\umx\core.py", line 48, in process return self.append(content) File "c:\python25\lib\site-packages\suds\umx\core.py", line 63, in append self.append_children(content) File "c:\python25\lib\site-packages\suds\umx\core.py", line 140, in append_children cval = self.append(cont) File "c:\python25\lib\site-packages\suds\umx\core.py", line 61, in append self.start(content) File "c:\python25\lib\site-packages\suds\umx\typed.py", line 77, in start found = self.resolver.find(content.node) File "c:\python25\lib\site-packages\suds\resolver.py", line 341, in find frame = Frame(result, resolved=known, ancestry=ancestry) File "c:\python25\lib\site-packages\suds\resolver.py", line 473, in __init__ resolved = type.resolve() File "c:\python25\lib\site-packages\suds\xsd\sxbasic.py", line 63, in resolve raise TypeNotFound(qref) TypeNotFound: Type not found: '(string, HelloWorldService.HelloWorldService, )'

    Read the article

1