delegation

Tool to generate interface implementation by delegation?

萝らか妹 提交于 2019-12-04 16:57:21
I often need to implement an interface by delegating the implementation to a member of my class. This task is quite tedious because, even though Visual Studio generates stubs for the interface methods, I still have to write the code to delegate the implementation. It doesn't require much thinking, so it could probably be automated by a code generation tool... I'm probably not the first one to think of this, so there must be such a tool already, but I couldn't find anything on Google... Any idea ? EDIT : it seems that ReSharper can do it , but it's pretty expensive... is there a free

Difference between @Delegate and @Mixin AST transformations in Groovy

馋奶兔 提交于 2019-12-04 16:45:22
问题 What's the difference between @Delegate and @Mixin AST transformations in Groovy. Maybe my question has to do with OO and when apply different patterns, but I use both and I can achieve the same behavior. class Person { String name = "Clark" def walk() { "Walk" } } @Mixin(Person) class Superhero { def fly() { "Fly" } } def superman = new Superhero() assert superman.name == "Clark" assert superman.walk() == "Walk" assert superman.fly() == "Fly" class Person { String name = "Clark" def walk() {

Delegating events to a parent view in Backbone

眉间皱痕 提交于 2019-12-04 02:38:43
My view, TuneBook , has several child views of type ClosedTune . I also have separate full page views for each tune, OpenTune . The same events are bound within ClosedTune and OpenTune , so I've designed my app so that they both inherit from a shared 'abstract' view Tune . To make my app more scaleable I would like the events for each ClosedTune to be delegated to TuneBook , but for maintainability I would like the same handlers (the ones stored in Tune ) to be used by TuneBook (although they'd obviously need to be wrapped in some function). The problem I have is, within TuneBook , finding the

Impersonation and Delegation

时光总嘲笑我的痴心妄想 提交于 2019-12-03 20:48:57
I am using impersonation is used to access file on UNC share as below. var ctx = ((WindowsIdentity)HttpContext.Current.User.Identity).Impersonate(); string level = WindowsIdentity.GetCurrent().ImpersonationLevel); On two Windows 2003 servers using IIS6, I am getting different impersonation levels: Delegation on one server and Impersonation on the other server. This causes issues where I am unable to access the UNC share on the server with 'Impersonation' level. What could be causing this difference? I searched through machine.config and IIS settings for the app pool, site and virtual

NSURLSession delegation: How to implement my custom SessionDelegate class accordingly?

霸气de小男生 提交于 2019-12-03 20:45:06
Got a singleton class, so called RequestManager, which shall handle requests made by different modules and background tasks of my application. @interface RequestFactory : NSObject - (void)requestDataWith:(NSString *)token id:(NSString *)id sender:(id<RequestFactoryDelegate>)sender; ... @end Then I got another class, so called SessionDelegate, which shall handle all the callbacks during the request. @interface SessionDelegate : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate> @property (weak, nonatomic) id <RequestFactoryDelegate> delegate; @end My idea is to

ASP.Net web application trying to use Impersonation and Delegation to connect to SQL Server

旧城冷巷雨未停 提交于 2019-12-03 16:02:50
问题 I'm trying to use Impersonation and Delegation in an intranet ASP.Net web-app in order to pass authenticated users' credentials onto a SQL Server. The web server and SQL server are two separate machines, but in the same domain, so Delegation is required. I've done the following: set <authentication mode="Windows"/> and <identity impersonate="true"/> in my web-app's web.config. enabled Constrained Delegation from the web server to the MSSQLSvc service on the SQL Server, in Active Directory.

Emulating membership-test in Python: delegating __contains__ to contained-object correctly

夙愿已清 提交于 2019-12-03 14:54:34
I am used to that Python allows some neat tricks to delegate functionality to other objects. One example is delegation to contained objects. But it seams, that I don't have luck, when I want to delegate __contains __: class A(object): def __init__(self): self.mydict = {} self.__contains__ = self.mydict.__contains__ a = A() 1 in a I get: Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: argument of type 'A' is not iterable What I am making wrong? When I call a.__contains __(1), everything goes smooth. I even tried to define an __iter __ method in A to make A more

Difference between @Delegate and @Mixin AST transformations in Groovy

无人久伴 提交于 2019-12-03 10:39:58
What's the difference between @Delegate and @Mixin AST transformations in Groovy. Maybe my question has to do with OO and when apply different patterns, but I use both and I can achieve the same behavior. class Person { String name = "Clark" def walk() { "Walk" } } @Mixin(Person) class Superhero { def fly() { "Fly" } } def superman = new Superhero() assert superman.name == "Clark" assert superman.walk() == "Walk" assert superman.fly() == "Fly" class Person { String name = "Clark" def walk() { "Walk" } } class Superhero { @Delegate Person person def fly() { "Fly" } } def superman = new

ASP.Net web application trying to use Impersonation and Delegation to connect to SQL Server

断了今生、忘了曾经 提交于 2019-12-03 05:17:45
I'm trying to use Impersonation and Delegation in an intranet ASP.Net web-app in order to pass authenticated users' credentials onto a SQL Server. The web server and SQL server are two separate machines, but in the same domain, so Delegation is required. I've done the following: set <authentication mode="Windows"/> and <identity impersonate="true"/> in my web-app's web.config. enabled Constrained Delegation from the web server to the MSSQLSvc service on the SQL Server, in Active Directory. enabled only Windows Authentication in the website, through IIS. Apparently this should all work, but it

Delegate after subclassing?

空扰寡人 提交于 2019-12-02 18:42:40
问题 I'm sorry, i was not able to formulate a short question for the title.. In case i subclass a class with a delegate protocol and property, does my delegate still need to implement the delegate protocol of the superclass, or do i have to define a new one for the subclass? In my case I subclassed UIImagePickerController : [(UIImagePickerController *)self.myUIImagePickerControllerSubclassInstance setDelegate:self]; When I try to set its delegate to self , from some view controller I get the