callback

My C Program provides a callback function for a hook. How can I keep it alive, un-kludgily?

Currently, I'm spawning a message box with a OS-library function (Windows.h), which magically keeps my program alive and responding to calls to the callback function. What alternative approach could be used to silently let the program run forever? Trapping 'Ctrl-c' or SIGINT and subsequently calling RemoveHook() for a clean exit would ...

Can someone explain callback/event firing

In a previous SO question it was recommended to me to use callback/event firing instead of polling. Can someone explain this in a little more detail, perhaps with references to online tutorials that show how this can be done for Java based web apps. Thanks. ...

Variable scope for PHP callback functions

Hi, In response to another question I asked about regular expressions, I was told to use the *preg_replace_callback* function (http://stackoverflow.com/questions/959017/) as a solution to my problem. This works great, but now I have a question relating to variable scope in callback functions. The function that parses the text is part o...

Function.createCallback doesn't pass context correctly in FireFox

I've discovered what seems to be a bug in how the MS AJAX library interacts with FireFox -- but maybe I'm just doing it wrong. I've got a script that looks something like this: dowork({ value: "some value", currentRetry: 0 }); // Try to connect at least 10 times, with a second in-between retries.. function dowork(request) ...

Passing $(this) to jQuery fadeOut callback

I know I need to use a callback so that html() doesn't happen until after fadeOut(), but inside the fadeOut() callback I don't have access to $(this) from .hover. I tried passing the selection using var point, but it's not working. if(!$.browser.msie) { points = $("div.point"); } else { points = $("div.flash"); } Problem Area: $(p...

C# app to C++ dll back to the C# app via callbacks

Hi all, I'm writing a C# application that calls a C++ dll. This dll is a device driver for an imaging system; when the image is being acquired, a preview of the image is available from the library on a line-by-line basis. The C++ dll takes a callback to fill in the preview, and that callback consists basically of the size of the final...

WCF Nested Call-back

The backgound: I am trying to forward the server-side ApplyChangeFailed event that is fired by a Sync Services for ADO 1.0 DBServerSyncProvider to the client. All the code examples for Sync Services conflict resolution do not use WCF, and when the client connects to the server database directly, this problem does not exist. My DBServerSy...

C# The best way to callback a client application with interim results from a pool of threads.

I have written a C# library which has a method to count words from multiple passages of text in parrallel. The passages of text are given as character streams where there is a random delay each time getnextchar() is called. My library method has to take an array of these character streams and return a combined word-frequency count. To...

Waiting for JSON data to be parsed

Is there a way to wait for jQuery's getJSON method? I want to parse the data, recieved with this function and just return false/true if a specific string is contained. But due to the asynchronous data processing this seems not to be that easy. Here is a code snippet: contained = false; $.getJSON(URL, function ( data ) { $.each( da...

Using a C++ class member function as a C callback function

I have a C library that needs a callback function to be registered to customize some processing. Type of the callback function is int a(int *, int *). I am writing C++ code similar to the following and try to register a C++ class function as the callback function: class A { public: A(); ~A(); int e(int *k, int *j); }; A::A(...

Calling matlab callback/function handle from Java

How do I pass a matlab function handle to a Java object and invoke it from within Java (that is, I want Java to tell matlab when it is ready with a calculation). I am trying to use the com.mathworks.jmi.Matlab class for evaluating Matlab expressions in the Java object, but I can't see how to 1) transfer the callback funcktion handle to J...

Getting matlab timer to update matlab GUIDE gui?

I have a matlab timer object. It is updating a global variable FOO once per second. I have a matlab GUIDE GUI, with a couple of controls, and a single plot frame. The plot frame gets updated by some of the GUI controls, and it gets updated by the timer object. Basically, there are two global variable FOO and BAR. The timer updates F...

If I call a flash function at the same time as a href link will flash function always be executed?

Hi all, I have the following code in page1.php : <a href="page2.php" onClick="javascript:callFlash();">Go to page</a> This calls a function in a Flash movie on page1.php and opens page2.php. My question is this: Can I be sure that the flash function will always be called and finish executing before page2.php is called? (The flash f...

How to perform Callbacks in Objective-C

I am a beginner programmer in Objective-C. Can anyone please tell me how to perform call back functions in Objective-C. I would just like to see some completed examples and I should understand it. Thanks a lot ...

use succes or complete in ajaxcall

Hello, My question is that I want to know what the difference is in the ajaxcall below If I substitute complete for success I get an empty responseText as the error says and with complete it works like it is supposed to Is it that success returns sooner then complete?? $("#formnaw").submit(function(){ var fnc = invoerFnc.attr("...

How can I access ActiveRecord Associations in class callbacks in rails?

Updated Appears to be a precedence error and nothing to do with the question I originally asked. See discussion below. Original question Is it possible to use active record associations in callbacks? I've tested this code in the console and it works fine as long as it isn't in a callback. I'm trying to create callbacks that pull ...

Can I use private instance methods as callbacks?

My particular scenario involves doing some text transformation using regular expressions within a private method. The private method calls preg_replace_callback, but is seems that callbacks need to be public on objects, so I'm stuck breaking out of the private world and exposing implementation details when I'd rather not. So, in a nutsh...

How do I write a jquery function that accepts a callback as a parameter

I Have the following function. function ChangeDasPanel(controllerPath, postParams) { $.post(controllerPath, postParams, function(returnValue) { $('#DasSpace').hide("slide", { direction: "right" }, 1000, function() { $('#DasSpace').contents().remove(); $('#DasSpace').append(returnValue).css("displ...

Monkeypatching a method call in Python

How do I put off attribute access in Python? Let's assume we have: def foo(): ... class Bar: ... bar = Bar() Is it possible to implement Bar so that any time bar is accessed, a value returned by the callback foo() would be provided? bar name already exists in the context. That's why it's access semantic...

How do I use callbacks to load a JavaScript function inside a ModalBox?

I am using Wildbit's ModalBox to load an external page in a modal window. I'm trying to get a datepicker JS script to run inside of this modal window, but it just...won't work. I know ModalBox has callback functions, which allow you to execute a function after the modal window has loaded; for example: Modalbox.show(url, {afterLoad: fun...