Search Results

Search found 2328 results on 94 pages for 'callback'.

Page 10/94 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • help understanding the concept of javascript callbacks with node.js, especially in loops

    - by Mr JSON
    hi I am just starting with node.js. I have done a little ajax stuff but nothing too complicated so callbacks are still kind of over my head. I looked at async but all I need is to run a few functions sequentially. I basically have something that pulls some json from an api, creates a new one and then does something with that. obviously i can't just run it because it runs everything at once and has an empty json. mostly they have to go sequentially but if while pulling a json from the api it can pull other json while it's waiting that is fine. I just got confused when putting the callback in a loop. what do I do with the index? i think i have seen some places that use callback inside the loop as kind of a recusive function and don't use for loops at all. simple examples would help alot thanks!

    Read the article

  • Interface(s) inheriting other interface(s) in WCF services.

    - by avance70
    In my solution there's a few WCF services, each of them implementing it's own callback interface. Let's say they are called: Subscribe1, with ISubscribe1 and ICallback1, etc. It happens there are a few methods shared among ICallbacks, so I made a following interface: interface ICallback { [OperationContract] CommonlyUsedMethod(); } and i inherited it in all: ICallback1 : ICallback, ICallback2 : ICallback, etc. And deleted the CommonlyUsedMethod() from all callback interfaces. Now, on the service-side code, everything compiles fine and services can start working as usual. But, when I updated the service references for the client, CommonlyUsedMethod() dissapeared from the reference.cs file (the ISubscribeCallback part), and could no longer be used to send data to back to the client.

    Read the article

  • How can I push a string from one client connected to a WCF service to another connected as well?

    - by Sergio Tapia
    Here's what I have so far: IService: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; namespace ServiceLibrary { [ServiceContract(SessionMode = SessionMode.Allowed, CallbackContract = typeof(IServiceCallback))] public interface IService { [OperationContract(IsOneWay = false, IsInitiating = true, IsTerminating = false)] void Join(string userName); } interface IServiceCallback { [OperationContract(IsOneWay = true)] void UserJoined(string senderName); } } Service: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; namespace ServiceLibrary { [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)] public class Service:IService { IServiceCallback callback = null; public void Join(string userName) { callback = OperationContext.Current.GetCallbackChannel<IServiceCallback>(); } } } Just a simple string passed from one client to another.

    Read the article

  • OAuth + Twitter on Android: Callback fails

    - by Samuh
    My Android application uses Java OAuth library, found here for authorization on Twitter. I am able to get a request token, authorize the token and get an acknowlegement but when the browser tries the call back url to reconnect with my application, it does not use the URL I provide in code, but uses the one I supplied while registering with Twitter. Note: 1. When registering my application with twitter, I provided a hypothetical call back url:http://abz.xyc.com and set the application type as browser. 2. I provided a callback url in my code "myapp" and have added an intent filter for my activity with Browsable category and data scheme as "myapp". 3. URL called when authorizing does contain te callback url, I specified in code. Any idea what I am doing wrong here? Relevant Code: public class FirstActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); OAuthAccessor client = defaultClient(); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(client.consumer.serviceProvider.userAuthorizationURL + "?oauth_token=" + client.requestToken + "&oauth_callback=" + client.consumer.callbackURL)); startActivity(i); } OAuthServiceProvider defaultProvider() { return new OAuthServiceProvider(GeneralRuntimeConstants.request_token_URL, GeneralRuntimeConstants.authorize_url, GeneralRuntimeConstants.access_token_url); } OAuthAccessor defaultClient() { String callbackUrl = "myapp:///"; OAuthServiceProvider provider = defaultProvider(); OAuthConsumer consumer = new OAuthConsumer(callbackUrl, GeneralRuntimeConstants.consumer_key, GeneralRuntimeConstants.consumer_secret, provider); OAuthAccessor accessor = new OAuthAccessor(consumer); OAuthClient client = new OAuthClient(new HttpClient4()); try { client.getRequestToken(accessor); } catch (Exception e) { e.printStackTrace(); } return accessor; } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); Uri uri = this.getIntent().getData(); if (uri != null) { String access_token = uri.getQueryParameter("oauth_token"); } } } // Manifest file <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".FirstActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="myapp"/> </intent-filter> </activity> </application>

    Read the article

  • How to use the callback method with a c++ directshow sample grabber

    - by Mr Bell
    I have a sample grabber hooked into my directshow graph, based on this example http://msdn.microsoft.com/en-us/library/dd407288(VS.85).aspx the problem is that it uses one shot and buffers. I want to continuously grab samples, and i'd rather have a callback than i guess polling for the samples. How do use the SetCallback method? SetCallback(ISampleGrabberCB *pCallback, long WhichMethodToCallback) how do I point pCallback to my own method?

    Read the article

  • Calling matlab callback/function handle from Java

    - by jakob
    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 Java, and 2) invoke it from Java possibly using the com.mathworks.jmi.Matlab class. Thanks, jakob

    Read the article

  • Callback for camera shutter open event

    - by Raj
    Hi all, I have been working around in UIImagePickerController and am struck with a problem where I need to get the precise moment when the camera shutter opens in UIImagePickerController when the source type is set to camera (UIImagePickerControllerSourceTypeCamera). I have done some googling around and have realized that no one had such strange requirement! I looked around the docs of UIImagePickerController and UIImagePickerControllerDelegate hoping to get some delegate method / callback indicating the camera shutter open event, but did not find any. Any suggestions? Thanks for any help, Raj Pawan

    Read the article

  • jQuery.getScript: data variable in callback undefined

    - by Hannes
    I'm trying to load an external JavaScript using jQuery's getScript(), like this: $.getScript("http://api.recaptcha.net/js/recaptcha_ajax.js", function(data) { window.alert(data); }); but as the alert window shows, the data variable in the callback function is undefined, unlike promised in http://docs.jquery.com/Ajax/jQuery.getScript#urlcallback. Anyone know why this might be? Thanks.

    Read the article

  • D3.js transition callback on frame

    - by brenjt
    Does anyone know how I could accomplish a per frame callback for a transition with D3. Here is and example of what I am doing currently. link.transition() .duration(duration) .attr("d", diagonal) .each("end",function(e) { if(e.target.id == current) show_tooltip(e.target) }); This currently calls the anonymous function for each element at the end of the animation. I would like to call it for every frame.

    Read the article

  • Accessing array values in jQuery ajax callback function

    - by gibberish
    Values are received through a jQuery AJAX callback, but I've been unsuccessful getting at the values. Here's the ajax call: $.ajax({ type: "POST", url: "ajax/ax_all_ajax_fns.php", data: 'request=edit_timecard_entry&staff_id='+staff_id+'&tid='+tid, success: function(data){ alert(data); } } Here's the code sent out by ax_all_ajax_fns.php: $staff_id = $_POST['staff_id']; $t_id = $_POST['tid']; $rCard = mysql_query("SELECT `staff_id`, `date`, `project_id`, `project_num`, `task_desc`, `hours` FROM `timecards` WHERE `t_id`='$t_id'"); $aCard = mysql_fetch_assoc($rCard); print_r($aCard); // echo $aCard; Of course, I don't want the information print_r'd, I want it echoed. The print_r was used to demonstrate that the correct data was sent out by the PHP script, and it is echoed successfully in the alert() box in the success function. So the correct data is being returned, and (if correctly formatted) it is viewable. The data returned in this way looks like this in the alert() popup: Array ( [staff_id] => 51 [date] => 2012-10-18 [project_id] => 0 [project_num => 49 [task_desk] => This is a task [hours] => 3.30 ) But when I use echo to output the $aCard array and then try to break it down inside the success function of the ajax call, I can't figure out how to get at the values. My attempts have consistently returned values of "undefined". In the success function, in place of alert(data);, I've tried this: var tce_staff_id = data['staff_id']; alert(tce_staff_id); and this: var tce_staff_id = data.staff_id; alert(tce_staff_id); What am I missing? UPDATE: Thanks to Martin S. for information re json_encode() PHP instruction. I've modified the ajax script as follows: echo json_encode($aCard); I now get THIS result from alert(data); in the success function: {"staff_id":"51","date":"2012-10-18","project_id":"0","project_num":"49","task_desc":"This is a task","hours":"3.30"} However, the following returns "undefined": alert(data.staff_id); alert(data[0].staff_id); var test = data.staff_id; alert(test); Can anyone see what I'm missing? All above code comes immediately after alert(data) inside the success callback of the ajax function. alert(data) DOES work and displays the desired data, as above.

    Read the article

  • C# multiple asynchronous HttpRequest with one callback

    - by aepheus
    I want to make 10 asynchronous http requests at once and only process the results when all have completed and in a single callback function. I also do not want to block any threads using WaitAll (it is my understanding that WaitAll blocks until all are complete). I think I want to make a custom IAsyncResult which will handle multiple calls. Am I on the right track? Are there any good resources or examples out there that describe handling this?

    Read the article

  • Twitter API - oauth gem - not getting callback

    - by haries
    I redirect the user of my application to Twitter for oauth style authentication using my app's request_token. The user is able to enter username and password on Twitter's page BUT then, instead of calling back my application, Twitter displays a page You've successfully granted access to MyAppName! Simply return to MyAppName and enter the following PIN to complete the process. 123456 Why is this happening? I have set the callback url in my app's settings. Thanks

    Read the article

  • GWT - Reusing Callback Class

    - by moorsu
    My custom callback class implements AsyncCallback (like MyAsyncCallback implements AsyncCallback) and planning use single instance of MyAsyncCallback for multiple rpc method executions. Is this approach safe?. Or should have to create new instance of MyAsyncCallback for every interaction from browser to server?. I am kind of tired of seeing so many anonymous AsyncCallback code blocks. Thanks for your input

    Read the article

  • JQuery will not set a higher scoped object in callback

    - by user344666
    Hello, I have a jquery callback function. In that function I want it to change the value of a varible that is in a higher scope, for somereason it is not doing that. Here is the code. Thanks function add() { var returnedData = { my_id: 0 }; $.post("add_event.php", { event : toSendText }, function(data) {returnedData.my_id = 5;}, "json"); if(add_page == true){ alert(returnedData.my_id); window.open('content-list.php?cal_id='); } }

    Read the article

  • javascript JSONP callback function not defined

    - by bitsMix
    ( function restoreURL() { function turnLongURL(data) { window.location = data.url; } var shortUrl = window.location.href; var url = "http://json-longurl.appspot.com/?url=" + shortUrl + "&callback=turnLongURL"; var script = document.createElement('script'); script.setAttribute('src', url); document.getElementsByTagName('head')[0].appendChild(script); })(); code is above, but the firebug told me, turnLongURL is not defined why is that?

    Read the article

  • Lift session valid ajax callback from a static javascript

    - by ChrisJamesC
    I am currently implementing a graph visualisation tool using lift on the server side and d3 ( a javascript visualisation framework) for all the visualisation. The problem I have is that in the script I want to get session dependent data from the server. So basically, my objective is to write lift-valid ajax callbacks in a static js script. Here is what I tried so far: What I have tried so far If you feel that the best solution is one that I already tried feel free to post a detailed answer telling me how to use it exactly and how it completely solves my problem. REST interface Usually what one would do to get data from a javascript function in lift is to create a REST interface. However this interface will not be linked to any session. This is the solution I got from my previous question: Get json data in d3 from lift snippet Give function as argument of script Another solution would be to give the ajaxcallback as an argument of the main script called to generate my graph. However I expect to have a lot of callbacks and I don't want to have to mess with the arguments of my script. Write the ajax callback in another script using lift and call it from the main script This solution, which is similar to a hidden text input is probably the more likely to work. However it is not elegant and it would mean that I would have to load a lot of scripts on load, which is not really conveniant. Write the whole script in lift and then serve it to the client This solution can be elegant, however my script is very long and I would really prefer that it remainss static. What I want On client side While reviewing the source code of my webpage I found that the callback for an ajaxSelect is: <select onchange="liftAjax.lift_ajaxHandler('F966066257023LYKF4=' + encodeURIComponent(this.value), null, null, null)" name="F96606625703QXTSWU" id="node_delete" class="input"> Moreover, there is a variable containing the state of the page in the end of the webpage: var lift_page = "F96606625700QRXLDO"; So, I am wondering if it is possible to simulate that my ajaxcall is valid using this liftAjax.lift_ajaxHandler function. However I don't know the exact synthax to use. On server side Since I "forged" a request on client side, I would now like to get the request on client side and to dispatch it to the correct function. This is where the LiftRules.dispatch object seems the best solution: when it is called, all the session management has been made (the request is authentified and linked to a session), however I don't know how to write the correct piece of code in the append function. Remark In lift all names of variables are changed to a random string in order to increase the security, I would like to have the same behavior in my application even if that will probably mean that I will have to "give" the javascript these values. However an array of 15 string values is still a better tradeoff than 15 functions as argument of a javascript function.

    Read the article

  • callback pattern

    - by robUK
    Hello, gcc 4.4.3 c89 I am creating a client server application and I will need to implement some callback functions. However, I am not too experienced in callbacks. And I am wondering if anyone knowns some good reference material to follow when designing callbacks. Is there any design patterns that are used for c. I did look at some patterns but there where all c++. Many thanks for any suggestions,

    Read the article

  • What Is The Callback Method When A Daemon Application Exists

    - by ChloeRadshaw
    I need to be able to create a little daemon application that will keep running until the machine is restarted or the process is forcefully killed. Is there a callback I can implement to get called when the application is exiting (either by force or at system shutdown) I am not creating a Windows form but a daemon application - I have serached google with no luck

    Read the article

  • How to create an after_save callback on runtime

    - by dorelal
    I am using ruby on rails 2.3.5 . I have user instance. On run time depending on certain conditions I want to add an after_save callback just for this instance. The other issue is that this after_save should take a block or a proc as parameter. What I want is something like this. This is psuedo code. user = User.first proc = Proc.new do puts 'this is foo' end user.after_save proc

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >