callback

jetpack/xpcom async input stream: detect close

I write a small Jetpack extension that starts a server using Cc["@mozilla.org/network/server-socket;1"]. I read from a connected client asynchronously using: conn.istream.asyncWait(conn, 0, 0, null); The documentation says that the callback is invoked when data arrives AND when the stream is closed: https://developer.mozilla.org/en/XPCO...

jquery callback function scope

when i use jquery to create an element(a div, for example) in a callback function, it doesn't allow me to manipulate the newly created element outside the callback function, how can I get around this? here is the example: $.get('menu.xml',function(data){ //create a new element with an ID called "#newElement" }) //I can't select the ...

Appending the jQuery callback function when extending the library

Short version: I'm extending a jQuery object function that is intended to take 0-3 arguments and pass them off as the second to fourth arguments into jQuery.animate. Except, I want to isolate the callback and put in another function call at the end of it. I'm extending the jQuery library the ordinary way, through jQuery.fn.newfunction...

WCF / Web Service: Databinding? Callback? Async? I'm not sure...

I'm not sure what the correct method or name to do what I want to do is called, or how it's implemented. My aim is to setup a client that can be updated from the server without a call to the server. Basically, the following scenario: Client(1) calls Web Service (GetListOfProducts) Server returns an array (A, B, C, D) to Client(1). Cli...

Validate that WCF Callback Client is still listening

I've setup an example in which a client calls a WCF service that has a Callback registered. It all works perfectly, but I want to test the scenario in which the client is closed, but the Service is still doing it's thing. Then when it comes time for the Service to call back to the client, I get an error because the client ain't there a...

Rails3: Base#after_update has been deprecated

I see the warning: DEPRECATION WARNING: Base#after_update has been deprecated, please use Base.after_update :method instead. (called from <class:City> at /home/petrushka/webdev/my_app/app/models/city.rb:4) What should I write instead of def after_update .... end ...

Cocoa Callback Design : Best Practice

I am writing the middleware for a cocoa application, and am debating over how exactly to design callbacks for many long running processes. When the UI will call a function which executes for a long time, it needs to provide a delegate to allow at least: Report of Success (with return value) Report of Failure (with error value) Report ...

What does "OperationContext.Current.GetCallbackChannel" actually do?

What does OperationContext.Current.GetCallbackChannel actually do? How does it identify each and every client? I'm facing a problem in my WCF service. If more than two users get connected to the service all the "interesting Changes" i'm sending from service to the clients are going to the second joined user. For ex, If A, B, C, D joins...

Is this a valid jquery callback function call?

I executing a function like this, <script type="text/javascript"> $(document).ready(function() { getEntities("Clients/GetClients", 0, formatClientsResult); var maxvalues = $("#HfId").val(); $(".pager").pagination(maxvalues, { callback: getEntities("Clients/GetClients", formatClientsResult), ...

Can I throw C++ exceptions from legacy C callbacks?

I have C++ code that uses some C libraries. The C libraries take C language callbacks. I wrote a callback in my C++ code and now I somehow need to report error from it (but it returns void). I wonder if I can throw an exception from a C callback that is used from C++ code? This is very difficult for me to understand. Thanks, Boda Cydo....

segmentation fault when i access member variables using a callback function

I have a class, in which i declare a static function. I register this function as the callback function for another library. Now, inside this function, i dereference the callback data to the class pointer and invoke a particular non-static member. The invocation succeeds and the control comes into the non-static member function. But ins...

Callbacks / Events in C#

Heya guys, Iv'e pretty new to C# ATM and I seem to be having trouble with Jabber-Net Im trying to create a basic chat application that will connect users via Jaber Services, the issues im having are with the Callbacks. The main error I seem to get is about the "Event required but used like 'type'", or something along those lines.. Im...

How do I get the source element in the AjaxOptions OnComplete function with MVC Ajax.BeginForm

As the title, I need something along the lines of... using (Ajax.BeginForm("MyAction", new AjaxOptions { OnComplete = "function() { mySucessFunction(this); }" })) <script> function mySucessFunction(srcElem) { alert(srcElem.id); } </script> An...

How can I pass a parameter to the callback of a jQuery ajax request?

I need to pass extra variables to a jQuery, ajax callback function. For example, given: while (K--) { $.get ( "BaseURL" + K, function (zData, K) {ProcessData (zData, K); } ); } function ProcessData (zData, K) { console.log (K); } ProcessData() will report 0 every time (or whatever the last value of K ...

Keeping track of dependency property value changes at global level

Hi, I am having a number of controls in my application(which user can add to canvas), each having various properties(mostly dependency properties). User can change its properties through property grid(like color, text etc.). I have save functionality implemented, so if user makes any change in canvas we ask him to save the document bef...

Can we end a callback function in Jquery from outside the function

Hi, I am using the time-ticker function by David Walsh. I did manage to return false from within the callback function, whenever I had to create a new instance, and wrote a new instance altogether. But it would be far more clean code if I could somehow update the call back function form within. Please let me know, even if it is something...

C#: passing parameters to callbacks

I have a fairly generic class (Record) that I have added a callback handler to, so I can do something like the following. record.Save(AfterSaveMethod); Which also returns the identity number of the record created. The issue I have now is that I have this nested save routine in a loop, and I need to use/pass the i variable! for (int ...

make javascript function callback-ish

Hi, i'm having a javascript function using jquery: my.namespace.loadSomeStuff = function() { $.get('/Services/loadStuff', function(c){ $("#stuffDiv").html(c); }); }; and am trying to write unit tests for this. now, since this function is not really returning anything and loading some stuff asynchronous using jquery's...

Generic callback mechanism overloads success handler as a means for flow control - code smell?

I'm fairly new on a project and ran across an interesting design paradigm for some asynchronous calls we make to the database (variables and function name altered): private void OnLogin(object selectedInitialState, AsyncEventCompletedCallback<EmptyAsyncEventArgs> userCallback, object userState) ...

jQuery get source element in callback

$('.myElem').live('click', function() { $(this).hide(500, function() { $(this).siblings('.myOtherElem').show(); }); }); The above doesn't work because $(this) is no longer in correct scope in the callback. How do I pass my original source element into the callback? ...