Questions tagged [delegation]

A delegate is a type that references a method

A delegate is a type that references a method. Once a delegate is assigned a method, it behaves exactly like that method. The delegate method can be used like any other method, with parameters and a return value

761 questions
6
votes
2 answers

Java SPNEGO Authentication & Kerberos Constrained Delegation (KCD) to backend service

I have a Java web application which do SPNEGO authentication of clients in a Windows Active Directory environment. To authenticate the user we use code from the good old SPNEGO SourceForge project. String encodedAuthToken = (String)…
Henrik
  • 95
  • 1
  • 7
6
votes
1 answer

When using a Builder Pattern why shouldn't I reuse the builder-object to access the object configuration?

when using a Builder Pattern why shouldn't I reuse the builder-object to access the object configuration? For example: Normal way: ObjectA(ObjectBuilder b) { this.a = b.getA(); } public Object getA(){ return this.a; } But why can't I just…
A.Non
  • 71
  • 1
  • 3
6
votes
1 answer

Calling a Protocol Function from A Selector in Swift

I have a protocol that acts as a delegate between one view and another. The protocol looks (something like) this: protocol MyProtocol: class { func functionOne() } And the protocol is implemented in View2 with something like: extension…
Kenneth
  • 1,035
  • 1
  • 12
  • 26
6
votes
3 answers

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

On page 65 and 66 of Java Concurrency in Practice Brian Goetz lists the following code: @ThreadSafe public class DelegatingVehicleTracker { private final ConcurrentMap locations; private final Map
Ben Weaver
  • 960
  • 1
  • 8
  • 18
6
votes
3 answers

Good Practice: How can I ensure a JavaScript constructor has access to mixin functions?

As part of an RPG game back-end, I want to be able to apply temporary effects to the characters. The nature of these effects could vary quite a lot, but I want to keep the method of defining them very straightforward. I'm using custom event handling…
Traverse
  • 61
  • 3
6
votes
2 answers

update viewcontroller from appdelegate - best practice?

I am playing around with iBeacons implementing CoreLocation methods inside AppDelegate.swift (methods are implemented in AppDelegate to ensure App Background Capabilities) In a SingleView application that comes with "ViewController.swift", what…
Andy
  • 549
  • 1
  • 6
  • 12
6
votes
1 answer

Scala forward or delegate methods to encapsulated object

Is there any possibility to implicitly forward some of class methods to encapsulated object? case class Entity(id: Int, name: String,) { private lazy val lastScan = new LastScan def getLastScanDate = lastScan.getLastScanDate def…
Kamil Lelonek
  • 14,592
  • 14
  • 66
  • 90
6
votes
3 answers

CoffeeScript: Inline call delegation which works with function bindings

I have following CS code snippet: class Ctrl constructor: (@security) -> ... isAuthenticated: -> @security.isAuthenticated() which is translated to following JS: Ctrl = (function() { function Ctrl(security) { …
vucalur
  • 6,007
  • 3
  • 29
  • 46
6
votes
3 answers

SSAS with Kerberos delegation gets connection timeout error

I have a situation where clients connecting to my webservice(that exists on another server) must access SQL Server databases and SSAS servers. It must use the credentials of the client that is calling the service when accessing the SQL Servers and…
TheWommies
  • 4,922
  • 11
  • 61
  • 79
6
votes
0 answers

WinRM - Second Hop without CredSSP

I would like to ask if it is possible to impersonate at "second hop" at WinRM service using only Kerberos (delegation)? CredSSP is no solution for me because I cannot prompt user password .. I'm using Windows 2008 R2, C#, .NET 4.0 ... Scenario: I…
Tomas Olejnik
  • 141
  • 1
  • 5
6
votes
6 answers

Nsnotification or delegation?

I just researched the two, and they both seem to be great means of communication, but nsnotification seems a ton easier to deal with. What are situations where you would want to use delegation rather than nsnotification, and nsnotification rather…
6
votes
1 answer

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

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…
Juergen
  • 12,378
  • 7
  • 39
  • 55
5
votes
2 answers

Kotlin: referring to delegate that is not passed by constructor

I want to use Kotlin delegation in a particular context. The delegate should not be passed in the constructor. I want to keep a reference to the delegate for later use in the code. From within the method that I override, say printMessage(), I still…
Ahmad Shahwan
  • 1,662
  • 18
  • 29
5
votes
1 answer

How do you implement custom delegates in SwiftUI

As an example I have a SwitUI ContentView. The one that comes when you first make the project. import SwiftUI struct ContentView: View { var manager = TestManager() var body: some View { ZStack{ Color(.green) …
runemonster
  • 177
  • 1
  • 11
5
votes
1 answer

Impersonation and delegation (with SQL Server) in ASP.NET

I've written a simple ASP.NET application that works as a frontend for a simple MSSQL database. The application is accessible over the Internet. There are two physical servers involved: a WS2008R2 Active Directory domain controller which is also…
Dai
  • 141,631
  • 28
  • 261
  • 374