callback

Return a value from an ajax call to parent function

I have a function where I need to return a url that I am getting via an ajax call. var heatmap = new google.maps.ImageMapType({ getTileUrl: function(coord, zoom) { var tileURL; $.get('getimage.php', { zoom: zoom, x: coord.x, y: coord.y }, function(data) { if(data.status) { tileURL=data.image; } },...

jQuery b is undefined during animate callback

Hi - I'm making a slider and this is the meat of my code; $('#slider a').click(function () { elem.filter(this.hash).addClass("active").animate({"right":"0"}, 3000, function() { elem.filter(activeElem).removeClass("active"); activeElem = elem.filter(thi...

Casting void *user_data to object

how do I cast void *something to an object in standard C++? Specifically I want want to cast void *userdata to std::map<String, void*> Is this possible? I am trying: //void *user_data is a parameter of this function (callback) std::map <String, void*> user_data_n; //this line is ok user_data_n = static_cast<std::map<String, void *>>(*u...

Callback with thickbox in an iframe

I'm loading a page in Wordpress (on the same domain with thickbox, the page that is being loaded also uses another jQuery plugin to change the scrollbar), I cant seem to get it to do a callback to load the all the content , it leaves out the area that jQuery instantiated on that iframed page. I've scoured the net and I am having trouble...

Passing data into a callback, is data guaranteed to be received?

Hello, my question is: having a piece of code like that (communication via callback contract) private void BroadcastMessage(DataEventArgs e) { DataEventHandler temp = DataEvent; if (temp != null) { foreach (DataEventHandler handler in temp.GetInvocationList()) { handler.BeginInvoke(this, e, EndAs...

Avoiding repetition when using callback functions and asynchronous requests

I am writing some Javascript/jQuery code that requires me to make lots of requests to various APIs. I have come across this problem many times and this is just a basic example of one instance of it. The code makes an asynchronous request to a server and then if a condition with the returned data is not met, the code makes another reque...

Event lost in ajax callback

I'm have a Rails 3 app that uses Prototype. I create a form with: =form_for :appt, :url => { :controller => "appts", :action => 'create' }, :html => { :id => "apptform" }, :remote => true do |f| That controller returns some json: render :json => @appt Some javascript waits til the dom is loaded, then sets some observers: document...

after_add callback for has_one

This seems to be an inconsistency between has_many and has_one. The has_many association allows you to specify an after_add callback that is called after an object has been added to the collection. class Person has_many :parents, :after_add => { puts "Added new parent" } # allowed has_one :car, :after_add => { puts "Added car" } #...

spring two-way rmi callback from server executing on client side

On the server-side I have a ListenerManager which fires callbacks to its Listeners. The manager is exported using a Spring RmiServiceExporter On the client-side I have a proxy to the manager created by an RmiProxyFactoryBean, and a Listener implementation registered through this proxy with the manager on the server side. So far so good...

Android - Anything similar to the iPhone SDK Delegate Callbacks?

I just switched over from iPhone to Android and am looking for something similar to where in the iPhone SDK, when a class finishes a certain task, it calls delegate methods in objects set as it's delegates. I don't need too many details. I went through the docs and didn't find anything (the closest I got was "broadcast intents" which se...

NSFetchedResultscontroller Callbacks not received in NSObject Class

Hi all, I have a class, @interface OnlineDataModel : TTModel < NSFetchedResultsControllerDelegate > { ... Where TTModel is, @interface TTModel : NSObject < TTModel > { ... OnlineDataModel class is Singleton, so its object never expires. I am performing the Fetch operation within this class and setting the delegate of the ...

Question about multiple callbacks occurring at the same time

I have a thread watching for file system events on Mac OS X. If I copy 100 files into a folder that is being watched, I obviously get multiple file system events, and therefore multiple callback calls. I'm wondering if these callback calls are processed one after another? Or does each event invoke an OS thread, which in turn calls the ca...

generator/block to iterator/stream conversion

Basically I want to convert this: def data(block: T => Unit) to a Stream (dataToStream is a hypothetical function that do this conversion): val dataStream: Stream[T] = dataToStream(data) I suppose this problem could be resolved by continuations: // let's assume that we don't know how data is implemented // we just know that it gen...

Invalid use of class in C++?

hi im trying to pass some values to a class but it wont let me it says invalid use of class 'Figure' im trying to send 3 values x,y,z and thats all but it wont let me heres what im trying to do... here is the main.cpp and the function that calls the class Figure for (j = 0; j < num_elems; j++) { /* grab and element from the file ...

object deallocation before audioPlayerDidFinishPlaying callback

Run into an interesting problem and not sure how to manage it. What would be the best way to handle the AVAudioPlayer callback method, audioPlayerDidFinishPlaying, if, for example, an instance of AVAudioPlayer is created with a callback for when the audio has finished but the object containing the AVAudioPlayer (and callback) is dealloc...

How do I Pull in errors when attempting to tweet from an iOS app using the Twitter+OAuth API?

How do I properly setup the callback method for a status update using the Twitter+OAuth API? (http://github.com/bengottlieb/Twitter-OAuth-iPhone) Right now I'm using the following to determine if a request succeeded: - (void)requestSucceeded:(NSString *)connectionIdentifier { NSLog(@"Statuses Sent"); //[loadingActionSheet dismissWithCl...

Pass a callback in ExternalInterface

I want to call a Javascript function from Flash, which I can do with ExternalInterface, but the Javascript function takes a callback. Is there a way to give it a Flash callback? I've thought of something like this: ExternalInterface.addCallback("foo", function(){...}); ExternalInterface.call("theFunction", "foo"); But that wouldn't w...

How to get data from jquery callback to parent function

Hi, I'm using the jquery ui drag/drop code. Upon a drop a getJSON request gets executed to check the new data and update the database. This works fine, until my backend return an error, because I can't cancel the drop from within the anonymous function. If there's an error the backend returns json that looks like this: {"result":0} ...

Disable keydown during animation

Hi, I'm using the following code to enable the user to show or hide a photo description (#photoinfo) and a menu (.slidetable) using the up and down arrow keys. If one of these two divs is already open, pressing the opposite arrow closes that div before opening the other. $(document).unbind('keypress'); $(document).keydown(function(even...

Dwr callback "data" object length

I'm using dwr to handle ajax calls to a java backend, I'm returning a Map in java, and I need to know its size in javascript when it returns in a callback function. Is there a way to do that? ...