delegation

Delegate after subclassing?

偶尔善良 提交于 2019-12-02 11:41:55
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 following warning: warning: Semantic Issue: Sending 'ViewController *' to parameter of incompatible type 'id

delegate not being called

。_饼干妹妹 提交于 2019-12-02 09:21:48
问题 I have subclass a UITableViewCell as follows: @class MyCell; @protocol MyCellDelegate - (void) viewController:(MyCell*)viewCon userId:(NSNumber*)uid andType:(NSString*)type; @end @interface MyCell : UITableViewCell <MHLazyTableImageCell>{ id <MyCellDelegate> delegate; NSNumber * mid; NSNumber * uid; } - (IBAction) star:(id) sender; - (IBAction) reply:(id) sender; - (IBAction) message:(id) sender; - (void) showMenu; @property (nonatomic, retain) id <ConvoreCellDelegate> delegate; @property

Delegated event handler without jQuery

不羁的心 提交于 2019-12-02 06:46:20
Made this example: https://jsfiddle.net/d8ak0edq/2/ document.getElementById('outer').oncontextmenu = function() { return false; }; outer = document.getElementById('outer'); outer.addEventListener('mousedown', foo); function foo(evt) { if (evt.which === 1) { evt.target.style.backgroundColor = 'red'; } else if (evt.which === 3) { evt.target.style.backgroundColor = 'blue'; } } /* $outer = $('#outer'); $outer.on('mousedown', 'div', foo); function foo(evt) { if (evt.which === 1) { $(this).css('background-color', 'red'); } else if (evt.which === 3) { $(this).css('background-color', 'blue'); } } */

Swing: Delegate events to child components of transformed parent

有些话、适合烂在心里 提交于 2019-12-02 04:41:28
问题 I've got a custom component GameViewCanvas extends JPanel that will hold a number of tiles (800x800 textures). Now in GameViewCanvas I've overridden the paint() method, so that it will paint the children on a transformed canvas (zoom, panning and rotation). I now want to delegate events like MouseEvent and MouseMotionEvent to the respective children - the problem of course being that Swing has no idea where the children are on the actual frame. I thought I might be able to just override a

delegate not being called

只愿长相守 提交于 2019-12-02 03:14:25
I have subclass a UITableViewCell as follows: @class MyCell; @protocol MyCellDelegate - (void) viewController:(MyCell*)viewCon userId:(NSNumber*)uid andType:(NSString*)type; @end @interface MyCell : UITableViewCell <MHLazyTableImageCell>{ id <MyCellDelegate> delegate; NSNumber * mid; NSNumber * uid; } - (IBAction) star:(id) sender; - (IBAction) reply:(id) sender; - (IBAction) message:(id) sender; - (void) showMenu; @property (nonatomic, retain) id <ConvoreCellDelegate> delegate; @property (nonatomic, retain) NSNumber * mid; @property (nonatomic, retain) NSNumber * uid; the delegate is called

What is delegation? When would I want to use it?

限于喜欢 提交于 2019-12-01 17:01:09
In OOP, a term delegation is mentioned. How is this modelled in a class? I searched on yahoo etc but got links to delegates. Imagine you have the classes Car and Engine : public class Car { private Engine engine = new Engine(); //or inject it externally public void start() { engine.start(); } } In this example the Car delegates to the underlying Engine . The user of the car cannot directly start the engine (unless he is a mechanic). But he can tell the car to start, and the car in turn tells the engine to start. You'd want to use it whenever you use object composition and you need to use a

Javascript Delegation performance considerations

怎甘沉沦 提交于 2019-12-01 04:41:29
问题 I looked for threads on performance increase using delegation mechanism. I am talking about simple javascript, without jQuery or other tools/libraries. Every element spawns events in the DOM tree, and they travel throughout it with bubbling mechanism. Delegation works avoiding to create an event handler for each element, but catching more events in a single handler. Also, stopping bubbling, the handler can avoid the event to further propagate, if already correctly handled. Thus it would

How does DelegatingVehicleTracker (p. 65 Goetz) return a “live” view?

血红的双手。 提交于 2019-12-01 04:30:39
On page 65 and 66 of Java Concurrency in Practice Brian Goetz lists the following code: @ThreadSafe public class DelegatingVehicleTracker { private final ConcurrentMap<String, Point> locations; private final Map<String, Point> unmodifiableMap; public DelegatingVehicleTracker(Map<String, Point> points) { locations = new ConcurrentHashMap<String, Point>(points); unmodifiableMap = Collections.unmodifiableMap(locations); } public Map<String, Point> getLocations() { return unmodifiableMap; } public Point getLocation(String id) { return locations.get(id); } public void setLocation(String id, int x,

How do I configure IIS so that the user's domain credentials are used when connecting to SQL server?

怎甘沉沦 提交于 2019-11-30 20:12:32
We've recently released the latest version of our intranet application, which now uses windows authentication as standard, and needs to be able to connect to a configured SQL server with the end-user's domain credentials. Lately we've found that on a couple of customer deployments, although IIS can see the user's domain credentials, it will not pass these on to SQL server. Instead, it seems to use the anonymous account. This is in spite of following all the correct steps (changing the directory security to Win Auth, updating Web.Config to use Win Auth and denying anonymous users). I've been

ASP.NET passing along Windows Authentication credentials

痴心易碎 提交于 2019-11-30 18:16:09
I've got an ASP.NET web application which uses Windows Authentication. This application needs to connect to another ASP.NET web service (which also uses Windows Authentication) and use the same credentials that it received from the user's browser. Can this be done and how? I don't believe you can do this without Kerberos Authentication. You can't delegate credentials to another system. I think this will start to set you on the right track. 来源: https://stackoverflow.com/questions/1600521/asp-net-passing-along-windows-authentication-credentials