Recently in a project I am working on, I needed to store callbacks in a static member array, like so:
class Example {
private static $_callbacks = array(
'foo'=>array('Example','do_foo'),
'bar'=>array('Example','do_bar')
);
private static function do_foo() { }
private static function do_bar() { }
}
To c...
I want to run the method process_images asynchronously after_save with Delayed::Job. However, when I try:
after_save lambda { send_later(:process_images) }
I get a NoMethodError: You have a nil object when you didn't expect it!. (self.send_later(:process_images) work either)
...
Hello,
below code says I can not convert from void to bool, thats ok but how can I define a callback for a fired event in CAB ?
internal bool IsÖrtlichkeitFocused()
{
return this.WorkItem.EventTopics[EventTopicNames.IsOertlichkeitFocusChanged].Fire(this, new EventArgs<bool?>(null), this.WorkItem, PublicationScope.WorkItem); ...
From this example we can call back server from JavaScript without post back , but i want to make CallServer method to return the result and i try it as below
string callBackReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "function(result) {alert(result);response = result;}", "context", "function(result) {resp...
Hello,
I'd like to call my app from my driver when an interesting event happens in the Windows kernel. I need to be able to pass at least 4 bytes of data back to user mode. How to achieve this? These events might happen quite, but not too, often, so I don't want to build a queue system and use IOCTLs.
I was thinking of something like t...
Lets take qsort()'s comparison callback function as an example
int (*compar)(const void *, const void *)
What happens when the result of the comparison function depends on the current value of a variable? It appears my only two options are to use a global var (yuck) or to wrap each element of the unsorted array in a struct that conta...
Now here's a fun problem. I have an object array as the following:
objRequests = [
{
url: "/cgi-bin/script1.cgi",
dest: "#div1"
},
{
url: "/cgi-bin/script1.cgi",
dest: "#div2"
}
];
Now, I iterate through these objects to load some information from the server at particular addresses using jQuery's $....
I'm designing a method for an input handler class. Here is some pseudo code...
void InputHandler::ScanEvents( boost::function1< void, std::string& > &func ) {
// Scan keys, determining string to pass
// If string found, call func with string as its argument on object tied to func
}
I'm not exactly sure how to implement this, o...
I am appending content to a list using:
$('a.ui-icon-cart').click(function(){
$(this).closest('li').clone().appendTo('#cart ul');
});
I want to perform further functions to the appended content (change class, apply animations etc)
How can I perform a callback on this function that will allow me to perform functions on th...
We are creating a gadget for the opensocial API 0.7.
In some functions we have to decide, if the viewer is the owner.
We couldn't use the usual function for this purpose:
return gadgets.util.getUrlParameters().viewer == gadgets.util.getUrlParameters().owner;
so we had to create a workaround and get the information via a DataRequest.
Th...
Hi. I have tons of files dumped into a few different folders. I've tried organizing them several times, unfortunatly, there is no organization structure that consistently makes sense for all of them.
I finally decided to write myself an application that I can add tags to files with, then the organization can be custom to the actual orga...
I have some Javascript code containing calls to jQuery.get(). I'm passing a callback to receive the response from the server.
In Firefox 3.5 (Windows and Linux) and IE8, the callback is called reliably. In IE6, it's never called.
I've tried jQuery 1.3 and 1.4 -- same result.
Is there some setting in IE6 that could cause such a probl...
Hi,
I'm writing a presentation app which is supposed to present on the 2nd display in extended mode.
For that I want to have a "Start presentation" button which reflects the actual state of external display connections: it should be gray and non-clickable if no external displays are connected. And it should be enabled if there is at le...
I'm fairly new to the callback-style of programming in javascript.
Is there a way to force code to wait until a function call finishes via a callback?
Let me explain.
The following function takes a number and returns a result based upon it.
function get_expensive_thing(n) {
return fetch_from_disk(n);
}
So far, easy enough.
But what ...
I'm trying to wait and then get a message when all images in an array have completed loading (using .complete), per the answer here. As such I set up an infinite loop like the below. however, when I run this I get an error that checkForAllImagesLoaded() is not defined. This code is being run through a bookmarklet, and as such it's all ...
I want to do some cleanup in a view when the activity is being destroyed. Is there any way to get a callback in the View when the activity is being destroyed? I tried using onDetachedFromWindow, but I'm not sure whether it is correct thing to do.
...
How can I know that a callback event has fired? I have to perform an activity after the callback event has fired, should I put the code inside the callback function or is there some other way to know when the callback has fired? Even if I put the code of the activity after the statement making the javascript request I cant be sure that t...
instead of writing code in the standard way:
$.get('test.xml',function(){
//manipulate the code here
})
I wanted to write the code this way to make things easier:
$.get('test.xml',callback(data));
function callback(data){
//manipulate with the data below...
}
but error show "data is undefined", how can i fix this?
...
I'm using core animation to transition between different view states in my application. However, I need to find a way to perform different tasks after the animations finish. I understand I can implement a delegate method and use the
- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag;
callback, however there's no ...
Can I have two different clients listening to the same WCF callback and have them both receive the same data without having to do the processing twice?
...