I've been going through some old code, where I came across some custom defined delegates, which are used thus:
private delegate void ListenDelegate(UdpClient listener, bool multicast);
private void ListenOn(UdpClient listener, bool multicast)
{
new ListenDelegate(_ListenLoop).BeginInvoke(listener, multicast, null, nu...
Ok, maybe the title isn't the most descriptive thing in the world, but this problem is killing me. What I'm trying to do is create an ActionLinkFor helper method, like so:
public ActionResult Index()
{
// Does Stuff
}
public ActionResult SomeAction(int param1)
{
// Does Stuff
}
These are two action methods. Action methods can h...
Does anyone show how to set the delegate properly for this without interface builder?
http://www.gauravv.com/2009/12/29/iphone-development-tip-custom-uinavigationbar/
...
I have a method (getAllTeams:) that initiates an HTTP request using the ASIHTTPRequest library.
NSURL *httpURL = [[[NSURL alloc] initWithString:@"/api/teams" relativeToURL:webServiceURL] autorelease];
ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:httpURL] autorelease];
[request setDelegate:self];
[request startAsynchr...
We have a system where we need to dynamically change what happens at the end of a set of steps.
We're doing this using a delegate. However the methods that we need to call at the end of the set of steps have different signatures.
We have a choice at the moment to either do this using a standard delegate signature (probably copying the ev...
Is there anyway in C# to call a method based on a Enum and/or class?
Say if I were to call
Controller<Actions.OnEdit, Customer>(customer);
Could I do something like this then?
public void Controller<TAction, TParam>(TParam object)
{
Action<TParam> action = FindLocalMethodName(TAction);
action(object);
}
private Action<T> Fi...
I have started to use MSpec for BDD, and since long ago I use Moq as my mocking framework. However, they both define It, which means I can't have using Moq and using Machine.Specifications in the same code file without having to specify the namespace explicitly each time I use It. Anyone who's used MSpec knows this isn't really an option...
Is there a way to implement delegation in Java for Android? Or does the activity class automatically ? My friend is an iPhone programmer, so he uses delegation in the form of an HelloWorldAppDelegate. How could delegation be implemented in Android?
...
Hi
The Facebook connect code is eluding me a bit.
I have no problem doing a login, and a wall post, however, I simply can not
figure out how the delegate methods for the FBDialog andFBStreamDialog is supposed to work.
- (void)postToWall {
FBStreamDialog *dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.delegate = s...
Hi,
I am writing a parser, which call some functions dependent on some value.
I can implement this logic with simple switch like this
switch(some_val)
{
case 0:
func0();
break;
case 1:
func1();
break;
}
or with delegates and dictionary like this
delegate v...
A domain model collection (normally a List or IEnumerable) is delegated to a ViewModel.
Thats means my CustomerViewModel has a order collection of type List or IEnumerable.
No change in the list is recognized by the bound control. But with ObservableCollection it is.
This is a problem in the MVVM design pattern.
How do you cope with ...
Hi , for example , when you playing game , you are play in the game UIView
and when you exit your game and return to the game root menu,
there're a 'exit' button on the game UIView
I wanna click this button to release self view and go back to the main menu
how to do this?
...
I'm writing a wrapper class around a TcpClient which raises an event when data arrives. I'm using BeginRead and EndRead, but when the parent form handles the event, it's not running on the UI thread. I do I need to use delegates and pass the context into the callback? I thought that callbacks were a way to avoid this...
void ReadCallbac...
I have created a user control that contains a button.
I am using this control on my winform which will be loaded at run time after fetching data from database.
Now I need to remove a row from a datatable on the Click event of that button.
The problem is that how do I capture that event in my form. Currently it goes in that user control...
This used to work for me but is now not working anymore and I can't figure out why. I have in-app purchase setup in my app. I confirmed that I have a correct set of product identifiers, matched by corresponding in-app purchase items in itunesconnect. The call goes out to Apple view [productRequest start], but I never get a response ba...
I don't understand the concept of delegation is used in XCode. When a new project is created, an app delegate and a view controller are created, but what does the app delegate do? How does main.m know to call the delegate?
...
I have two functions:
double fullFingerPrinting(string location1, string location2, int nGrams)
double AllSubstrings(string location1, string location2, int nGrams)
I want to go in a loop and activate each function in its turn, and after each function I also want to print the name of the function, how can I do that?
...
I have a table which may contain other inner tables (it's not possible to edit generated markup). I want to create a delegate function for row mouseenter and mouseleave which only triggers for the associated main table rows (and not inner tables rows), as following:
$("#tableid").delegate("tr", "mouseenter mouseleave", function(e) {
...
A user has sent in a crash report with the stack trace listed below (I have not been able to reproduce the crash myself, but every other crash this user has reported has been a valid bug, even when I couldn't reproduce the effect). The application is a reference-counted Objective-C/Cocoa app.
If I am interpreting it correctly, the cras...
What advantage is there to implementing the four delegate methods:
(void)controllerWillChangeContent:(NSFetchedResultsController *)controller
(void)controller:(NSFetchedResultsController *)controller didChangeSection:(id )sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
(void)controller:(NSFet...