Search Results

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

Page 1/94 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • jquery animation callback - how to pass parameters to callback

    - by Hans
    I´m building a jquery animation from a multidimensional array, and in the callback of each iteration i would like to use an element of the array. However somehow I always end up with last element of the array instead of all different elements. html: <div id="square" style="background-color: #33ff33; width: 100px; height: 100px; position: absolute; left: 100px;"></div> javascript: $(document).ready(function () { // Array with Label, Left pixels and Animation Lenght (ms) LoopArr = new Array( new Array(['Dog', 50, 500]), new Array(['Cat', 150, 5000]), new Array(['Cow', 200, 1500]) ); $('#square').click(function() { for (x in LoopArr) { $("#square").animate({ left: LoopArr[x][0][1] }, LoopArr[x][0][2], function() { alert (LoopArr[x][0][0]); }); } }); }); ` Current result: Cow, Cow, Cow Desired result: Dog, Cat, Cow How can I make sure the relevant array element is returned in the callback?

    Read the article

  • Supplying a callback to Jeditable

    - by pjmorse
    Summary: When I try supplying a onsubmit or onreset callback to Jeditable, I get Object [function] has no method 'apply' errors. How I got here: I've been working on a rails plugin to supply Jeditable and jWYSIWYG for in-place WYSIWYG editing. Development is driven by a Rails project I'm working on which asks for specific functions. One of the options I added was the ability to trigger Jeditable's edit mode using a button instead of clicking on the editable text itself, following the pattern suggested in this answer. The next step, though, is to hide the button while in edit mode, and reveal it again when leaving edit mode. The hide is easy enough; I just added a line to the triggering function which sends .toggle() to the button. Reveal is trickier. I figure I need to .toggle() again on submit or cancel, and helpfully, Jeditable offers onsubmit and onreset callbacks. However, when I try using those callbacks, I get this Object [something] has no method 'apply' errors. What I'm trying: Because this is in the context of a Rails helper, the actual mechanics are a little more involved than this, but the upshot is that I'm trying to follow this pattern, handing Jeditable this in the args: "onsubmit":"showTrigger", and then including this script: function showTrigger(settings, original) { $(".edit_trigger[id='element_id']").toggle(); } However, on submitting changes or canceling an edit, I get the error Object showTrigger has no method 'apply' ...as described above. I also tried sending in a function directly as the "onsubmit" argument (i.e. "onsubmit": "function(settings, original){$(\".edit_trigger[id='element_id']\").toggle();}" and then I just get Object function(settings, original){$(\".edit_trigger[id='element_id']\").toggle();} has no method 'apply' instead. There must be something wrong with how I'm handing in this callback. Any ideas? ETA: This answer suggests to me that somehow I'm providing a string to Jeditable when it expects a function instead. However, because I'm working within the context of a Rails helper, I'm not at all sure how to fix that - the "showTrigger" bit is set as a Ruby variable in the helper, and although window.showTrigger() is defined when the window is loaded, I don't know how to designate that function within a Ruby variable such that it will be recognized as a function at page load time.

    Read the article

  • Receiving an object in a unmanaged callback function

    - by Daniel Baulig
    Eg. I have following delegate method I want to use as a callback function with unmanaged code: public delegate void Callback(IntPtr myObject); Callback callback; I register it in the following way: [DllImport("a.dll")] public static void registerCallback(IntPtr callbackFunction, IntPtr anObject); // ... this.myObject = new MyClass(); this.objectPin = GCHandle.Alloc(this.myObject, GCHandleType.Pinned); registerCallback(Marshal.GetFunctionPointerForDelegate(callback), objectPin.AddrOfPinnedObject()); Now whenever the callback function is called it will have a Pointer/Handle of an object of the MyClass class. I could use Marshal.PtrToStructure to convert this to an object of MyClass. However, what I would like to have is that the delegate definition already contains the class MyClass. eg.: public delegate void Callback(MyClass myObject); I tried this, but it will not work. I also tried the following, which did not work: public delegate void Callback([MarshalAs(UnmanagedType.IUnknown)]MyClass myObject); I suppose I would need something like "UnmarshalAs" at this point, but sadly this is not available. Any suggestions how I could get lost of that IntPtr in my callback function and get a it packed up as a regular, managed MyClass object?

    Read the article

  • Twitter's Bootstrap 2.x popover callback can't focus on element

    - by mozgras
    I've modified bootstrap's popover function to include a callback which works great. But in the callback I cannot programmatically focus on the first form field. Strange, because I can manipulate other elements in the callback function as well as focus on the element at other points. Here's the code to add a callback which I got from another SO question (http://stackoverflow.com/a/14727204/1596547): var tmp = $.fn.popover.Constructor.prototype.show; $.fn.popover.Constructor.prototype.show = function () { tmp.call(this); if (this.options.callback) { this.options.callback(); } } Here's the popover code: $('#a-editor-btn').popover({ html: true, placement: 'bottom', callback: function(){ $('#a-form-point').focus(); //nothing happens console.log('hello'); // works . . }, content: $('#a-form').html() }).parent().delegate('button#insert-point-btn', 'click', function() { insertPoint(); }).delegate('.a-form','keypress', function(e) { if ( e.which == 13 ) { insertPoint(); } });

    Read the article

  • Python objects as userdata in ctypes callback functions

    - by flight
    The C function myfunc operates on a larger chunk of data. The results are returned in chunks to a callback function: int myfunc(const char *data, int (*callback)(char *result, void *userdata), void *userdata); Using ctypes, it's no big deal to call myfunc from Python code, and to have the results being returned to a Python callback function. This callback work fine. myfunc = mylib.myfunc myfunc.restype = c_int myfuncFUNCTYPE = CFUNCTYPE(STRING, c_void_p) myfunc.argtypes = [POINTER(c_char), callbackFUNCTYPE, c_void_p] def mycb(result, userdata): print result return True input="A large chunk of data." myfunc(input, myfuncFUNCTYPE(mycb), 0) But, is there any way to give a Python object (say a list) as userdata to the callback function? In order to store away the result chunks, I'd like to do e.g.: def mycb(result, userdata): userdata.append(result) userdata=[] But I have no idea how to cast the Python list to a c_void_p, so that it can be used in the call to myfunc. My current workaround is to implement a linked list as a ctypes structure, which is quite cumbersome.

    Read the article

  • pb with callback in the python optparse module

    - by PierrOz
    Hi Guys, I'm playing with Python 2.6 and its optparse module. I would like to convert one of my arguments to a datetime through a callback but it fails. Here is the code: def parsedate(option, opt_str, value, parser): option.date = datetime.strptime(value, "%Y/%m/%d") def parse_options(args): parser = OptionParser(usage="%prog -l LOGFOLDER [-e]", version="%prog 1.0") parser.add_option("-d", "--date", action="callback", callback="parsedate", dest="date") global options (options, args) = parser.parse_args(args) print option.date.strftime() if __name__ == "__main__": parse_options(sys.argv[1:]) I get an error File: optparse.py in _check_callback "callback not callable". I guess I'm doing something wrong in the way I define my callback but what ? and why ? Can anyone help ?

    Read the article

  • jquery callback function

    - by kusanagi
    i use recaptcha Recaptcha.create("xxx", "recaptcha", { theme: 'clean', tabindex: 0, callback: $("#id").focus }); i want to use callback to focus some field, but it doesn't work, only callback: f works function f() { $("#FIO").focus(); } what is the problem?

    Read the article

  • javascript callback after loop

    - by RobertPitt
    Hey guys, Iv'e just started a new Wordpress blog and i have started to build the JavaScript base! the issue im having is funnction a fucntion that loops several variables and includes the required JS libraries, what i need to do is execute the callback when the loop is finished! Heres my code! var Utilities = { Log : function(item) { if(console && typeof console.log == 'function') { //Chrome console.log(item); } }, LoadLibraries : function(callback) { $.each(Wordpress.required,function(i,val){ //Load the JS $.getScript(Wordpress.theme_root + '/js/plugins/' + val + '/' + val + '.js',function(){ // %/js/plugins/%/%.js Utilities.Log('library Loaded: ' + val); }); }); callback(); } } And the usage is like so! Utilities.LoadLibraries(function(){ Utilities.Log('All loaded'); }); Above you see the execution of callback() witch is being executed before the files are in the dom! i need this called at the end of every library inclusion!

    Read the article

  • How to structure javascript callback so that function scope is maintained properly

    - by Chetan
    I'm using XMLHttpRequest, and I want to access a local variable in the success callback function. Here is the code: function getFileContents(filePath, callbackFn) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { callbackFn(xhr.responseText); } } xhr.open("GET", chrome.extension.getURL(filePath), true); xhr.send(); } And I want to call it like this: var test = "lol"; getFileContents("hello.js", function(data) { alert(test); }); Here, test would be out of the scope of the callback function, since only the enclosing function's variables are accessible inside the callback function. What is the best way to pass test to the callback function so the alert(test); will display test correctly?

    Read the article

  • Wrong sessionID being used in callback, but only on one particular computer

    - by user210119
    I am writing a Python/Django web application that uses OAuth (for the TwitterAPI, not that it should matter). I am storing a session ID in my login function, and then after using OAuth to get the user's token, I try to retrieve the sessionID in my callback function. The callback function then always fails(throws an exception) because it can't find the OAuth token in the session. Through the debugger, I am able to determine that the session ID that the server is using is incorrect - it does not match the session ID that was stored in the login function. It's therefore unsurprising that the Oauth tokens were not there. The session that appears in the callback was the same one each time (until I tried deleting it - see "things I've tried below"), and it started out as an old session, with some data in it that is from a different django app running on the same server that I hadn't touched in a couple weeks. Here's the kicker: everything I described is an issue only on our production server, and only when connecting to it from my computer. Let me clarify: this only happens with my particular laptop. I can connect to the app just fine from someone else's computer. Other people cannot connect with their accounts on my computer. Furthmore, I can connect just fine to the app when it is running on my localhost using the built-in django webserver, just not to the production server. My setup: my server and local box are running= Django 1.2.0 and Python 2.6.5. My local box is running Snow Leopard and the Django webserver, the server is running Ubuntu, Apache2, and mod-wsgi. For sessions, I am using Django's default session backend (DB). Things I have tried, all to no avail: logging in with a different account, including new accounts that have never OAuthed to this app before Clearing cookies, using incognito mode, using a different web browser on my same computer. Each time, upon inspecting my cookies, the sessionID matched the sessionID in the login function and was different from the sessionID in the callback. deleting the session in the database that appears in the callback function, (the one that appeared to be old data). The callback function still fails, and the sessionID it appears to be using is now a new one using a different session backend (DB-cache, flat file, etc...) restarting the server, my computer, etc. My first question on StackOverflow, so bear with me if I didn't quite follow local conventions. I am just at a loss as to what to even look for - what are the things that could possibly be causing sessions to not work on my particular computer, and (so far!) only my particular computer?

    Read the article

  • IE event callback object JavaScript

    - by Randy Hall
    I may be WAY off on my terminology, so please feel free to correct me. Perhaps this is why I cannot seem to find anything relevant. No libraries, please. I have an event handler, which invokes a callback function. Fancy, right? In IE<9 the this object in the handler is the window. I don't know why, or how to access the correct object. if (document.addEventListener){ element.addEventListener(event, callback, false); } else { element.attachEvent('on' +event, callback); } This part DOES WORK. This part doesn't: function callback(event){ console.log(this); } this in IE is returning [object Window], whereas it returns the element that called the callback function in every other browser. This is cut down significantly from my full script, but this should be everything that's relevant. EDIT This link provided by @metadings How to reference the caller object ("this") using attachEvent is very close. However, there are still two issues. 1) I need to get both the event object and the DOM element calling this function. 2) This event is handled delegation style: there may be child DOM elements firing the event, meaning event.target is not necessarily (and in my case, not typically) the element with the listener.

    Read the article

  • javascript: execute a bunch of asynchronous method with one callback

    - by Samuel Michelot
    I need to execute a bunch of asynchronous methods (client SQLite database), and call only one final callback. Of course, the ugly way is: execAll : function(callBack) { asynch1(function() { asynch2(function() { ... asynchN(function() { callBack(); }) }) }); } But I know there are better ways to do it. Intuitively I would detect when all call back has been called with a counter to call the final callback. I think this is a common design-pattern, so if someone could point me in the right direction... Thanks in advance !

    Read the article

  • Trouble in ActiveX multi-thread invoke javascript callback routine

    - by code0tt
    everyone. I'm get some trouble in ActiveX programming with ATL. I try to make a activex which can async-download files from http server to local folder and after download it will invoke javascript callback function. My solution: run a thread M to monitor download thread D, when D is finish the job, M is going to terminal themself and invoke IDispatch inferface to call javascript function. **************** THERE IS MY CODE: **************** /* javascript code */ funciton download() { var xfm = new ActiveXObject("XFileMngr.FileManager.1"); xfm.download( 'http://somedomain/somefile','localdev:\\folder\localfile',function(msg){alert(msg);}); } /* C++ code */ // main routine STDMETHODIMP CFileManager::download(BSTR url, BSTR local, VARIANT scriptCallback) { CString csURL(url); CString csLocal(local); CAsyncDownload download; download.Download(this, csURL, csLocal, scriptCallback); return S_OK; } // parts of CAsyncDownload.h typedef struct tagThreadData { CAsyncDownload* pThis; } THREAD_DATA, *LPTHREAD_DATA; class CAsyncDownload : public IBindStatusCallback { private: LPUNKNOWN pcaller; CString csRemoteFile; CString csLocalFile; CComPtr<IDispatch> spCallback; public: void onDone(HRESULT hr); HRESULT Download(LPUNKNOWN caller, CString& csRemote, CString& csLocal, VARIANT callback); static DWORD __stdcall ThreadProc(void* param); }; // parts of CAsyncDownload.cpp void CAsyncDownload::onDone(HRESULT hr) { if(spCallback) { TRACE(TEXT("invoke callback function\n")); CComVariant vParams[1]; vParams[0] = "callback is working!"; DISPPARAMS params = { vParams, NULL, 1, 0 }; HRESULT hr = spCallback->Invoke(0, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); if(FAILED(hr)) { CString csBuffer; csBuffer.Format(TEXT("invoke failed, result value: %d \n"),hr); TRACE(csBuffer); }else { TRACE(TEXT("invoke was successful\n")); } } } HRESULT CAsyncDownload::Download(LPUNKNOWN caller, CString& csRemote, CString& csLocal, VARIANT callback) { CoInitializeEx(NULL, COINIT_MULTITHREADED); csRemoteFile = csRemote; csLocalFile = csLocal; pcaller = caller; switch(callback.vt){ case VT_DISPATCH: case VT_VARIANT:{ spCallback = callback.pdispVal; } break; default:{ spCallback = NULL; } } LPTHREAD_DATA pData = new THREAD_DATA; pData->pThis = this; // create monitor thread M HANDLE hThread = CreateThread(NULL, 0, ThreadProc, (void*)(pData), 0, NULL); if(!hThread) { delete pData; return HRESULT_FROM_WIN32(GetLastError()); } WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); CoUninitialize(); return S_OK; } DWORD __stdcall CAsyncDownload::ThreadProc(void* param) { LPTHREAD_DATA pData = (LPTHREAD_DATA)param; // here, we will create http download thread D // when download job is finish, call onDone method; pData->pThis->onDone(S_OK); delete pData; return 0; } **************** CODE FINISH **************** OK, above is parts of my source code, if I call onDone method in sub-thread, I will get OLE ERROR(-2147418113 (8000FFFF) Catastrophic failure.). Did I miss something? please help me to figure it out.

    Read the article

  • Modal dialog blocks wcf callback

    - by Bjarne
    I am working on an application that relies strongly on a wcf request/callback pattern. That is, it uses a service which exposes a number of methods, and for each method there is a callback on which the result is returned. In the client, I wish to open a modal dialog, make a request on the server and then wait for the result on the callback. But I never get a callback since the UI thread is blocked by the modal dialog. Has anyone worked with a similar pattern? I would hate to have more threads in the client, and I also don't like the idea of 'simulating' a modal dialog.

    Read the article

  • Callback Timer function in C++

    - by user3596609
    I am trying to implement a callback timer function in C++ which should do a callback after a timeout. I am listening on a socket and then waiting for messages on it. so if I have something like getMessages() and I want to pass the timer function in it as an argument. So how can it be implemented that after the receive of a message, the timer is started and the callback happens if there is a timeout before the next messages arrives. I am new to callback functions. Any help is greatly appreciated. Thanks!

    Read the article

  • C++ invalid reference problem

    - by Karol
    Hi all, I'm writing some callback implementation in C++. I have an abstract callback class, let's say: /** Abstract callback class. */ class callback { public: /** Executes the callback. */ void call() { do_call(); }; protected: /** Callback call implementation specific to derived callback. */ virtual void do_call() = 0; }; Each callback I create (accepting single-argument functions, double-argument functions...) is created as a mixin using one of the following: /** Makes the callback a single-argument callback. */ template <typename T> class singleArgumentCallback { protected: /** Callback argument. */ T arg; public: /** Constructor. */ singleArgumentCallback(T arg): arg(arg) { } }; /** Makes the callback a double-argument callback. */ template <typename T, typename V> class doubleArgumentCallback { protected: /** Callback argument 1. */ T arg1; /** Callback argument 2. */ V arg2; public: /** Constructor. */ doubleArgumentCallback(T arg1, V arg2): arg1(arg1), arg2(arg2) { } }; For example, a single-arg function callback would look like this: /** Single-arg callbacks. */ template <typename T> class singleArgFunctionCallback: public callback, protected singleArgumentCallback<T> { /** Callback. */ void (*callbackMethod)(T arg); public: /** Constructor. */ singleArgFunctionCallback(void (*callback)(T), T argument): singleArgumentCallback<T>(argument), callbackMethod(callback) { } protected: void do_call() { this->callbackMethod(this->arg); } }; For user convenience, I'd like to have a method that creates a callback without having the user think about details, so that one can call (this interface is not subject to change, unfortunately): void test3(float x) { std::cout << x << std::endl; } void test5(const std::string& s) { std::cout << s << std::endl; } make_callback(&test3, 12.0f)->call(); make_callback(&test5, "oh hai!")->call(); My current implementation of make_callback(...) is as follows: /** Creates a callback object. */ template <typename T, typename U> callback* make_callback( void (*callbackMethod)(T), U argument) { return new singleArgFunctionCallback<T>(callbackMethod, argument); } Unfortunately, when I call make_callback(&test5, "oh hai!")->call(); I get an empty string on the standard output. I believe the problem is that the reference gets out of scope after callback initialization. I tried using pointers and references, but it's impossible to have a pointer/reference to reference, so I failed. The only solution I had was to forbid substituting reference type as T (for example, T cannot be std::string&) but that's a sad solution since I have to create another singleArgCallbackAcceptingReference class accepting a function pointer with following signature: void (*callbackMethod)(T& arg); thus, my code gets duplicated 2^n times, where n is the number of arguments of a callback function. Does anybody know any workaround or has any idea how to fix it? Thanks in advance!

    Read the article

  • Java RMI timeout in callback

    - by sakra
    We are using Java RMI for communication. An RMI client passes a processing request and an object with a callback method to an RMI server. The server invokes the callback when it is done with processing. The setup is similar to the one described in RMI Callbacks. Occasionally we are getting a "read time out" exception in the server upon invoking the callback method. The callback thread stalls for about a minute before the exception is raised. java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: java.net.SocketTimeoutException: Read timed out at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:286) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132) at $Proxy2.finished(Unknown Source) at com.unrisk.db.grid.GridTask.invokeCallback(com.unrisk.db.grid.GridTask:1292) at com.unrisk.db.grid.GridTask.invokeCallbacks(com.unrisk.db.grid.GridTask:1304) at com.unrisk.db.service.tasks.EquityMDTask.afterRun(com.unrisk.db.service.tasks.EquityMDTask:276) at com.unrisk.db.grid.GridTask.run(com.unrisk.db.grid.GridTask:720) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:237) at java.io.DataInputStream.readByte(DataInputStream.java:248) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:228) ... 12 more We are using Sun Java JDK 1.6.0_18 under Windows Server 2003 32-bit. Is it possible to work around the connection problems by tuning RMI related system properties?

    Read the article

  • AJAX Callback and Javascript class variables assignments

    - by Gianluca
    I am trying to build a little javascript class for geocoding addresses trough Google Maps API. I am learning Javascript and AJAX and I still can't figure out how can I initialize class variables trough a callback: // Here is the Location class, it takes an address and // initialize a GClientGeocoder. this.coord[] is where we'll store lat/lng function Location(address) { this.geo = new GClientGeocoder(); this.address = address; this.coord = []; } // This is the geoCode function, it geocodes object.address and // need a callback to handle the response from Google Location.prototype.geoCode = function(geoCallback) { this.geo.getLocations(this.address, geoCallback); } // Here we go: the callback. // I made it a member of the class so it would be able // to handle class variable like coord[]. Obviously it don't work. Location.prototype.geoCallback = function(result) { this.coord[0] = result.Placemark[0].Point.coordinates[1]; this.coord[1] = result.Placemark[0].Point.coordinates[0]; window.alert("Callback lat: " + this.coord[0] + "; lon: " + this.coord[1]); } // Main function initialize() { var Place = new Location("Tokyo, Japan"); Place.geoCode(Place.geoCallback); window.alert("Main lat: " + Place.coord[0] + " lon: " + Place.coord[1]); } google.setOnLoadCallback(initialize); Thank you for helping me out!

    Read the article

  • WCF Service timeout in Callback

    - by Muckers Mate
    I'm trying to get to grips with WCF, in particular writing a WCF Service application with callback. I've setup the service, together with the callback contract but when the callback is called, the app is timing out. Essentially, from a client I'm setting a property within the service class. The Setter of this property, if it fails validation fires a callback and, well, this is timing out. I realise that this is probably to it not being an Asynchronous calback, but can someone please show me how to resolve this? Thanks // The call back (client-side) interface public interface ISAPUploadServiceReply { [OperationContract(IsOneWay = true)] void Reply(int stateCode); } // The Upload Service interface [ServiceContract(CallbackContract = typeof(ISAPUploadServiceReply))] public interface ISAPUploadService { int ServerState { [OperationContract] get; [OperationContract(IsOneWay=true)] set; And the implementation... public int ServerState { get { return serverState; } set { if (InvalidState(Value)) { var to = OperationContext.Current.GetCallbackChannel<ISAPUploadServiceReply>(); to.Reply(eInvalidState); } else serverState = value; } }

    Read the article

  • WCF Callback Contract InvalidOperationException: Collection has been modified

    - by mrlane
    We are using a WCF service with a Callback contract. Communication is Asynchronous. The service contract is defined as: [ServiceContract(Namespace = "Silverlight", CallbackContract = typeof(ISessionClient),SessionMode = SessionMode.Allowed)] public interface ISessionService With a method: [OperationContract(IsOneWay = true)] void Send(Message message); The callback contract is defined as [ServiceContract] public interface ISessionClient With methods: [OperationContract(IsOneWay = true, AsyncPattern = true)] IAsyncResult BeginSend(Message message, AsyncCallback callback, object state); void EndSend(IAsyncResult result); The implementation of BeginSend and EndSend in the callback channel are as follows: public void Send(ActionMessage actionMessage) { Message message = Message.CreateMessage(_messageVersion, CommsSettings.SOAPActionReceive, actionMessage, _messageSerializer); lock (LO_backChannel) { try { _backChannel.BeginSend(message, OnSendComplete, null); } catch (Exception ex) { _hasFaulted = true; } } } private void OnSendComplete(IAsyncResult asyncResult) { lock (LO_backChannel) { try { _backChannel.EndSend(asyncResult); } catch (Exception ex) { _hasFaulted = true; } } } We are getting an InvalidOperationException: "Collection has been modified" on _backChannel.EndSend(asyncResult) seemingly randomly, and we are really out of ideas about what is causing this. I understand what the exception means, and that concurrency issues are a common cause of such exceptions (hence the locks), but it really doesn't make any sense to me in this situation. The clients of our service are Silverlight 3.0 clients using PollingDuplexHttpBinding which is the only binding available for Silverlight. We have been running fine for ages, but recently have been doing a lot of data binding, and this is when the issues started. Any help with this is appreciated as I am personally stumped at this time.

    Read the article

  • google chrome extension update text after response callback

    - by Jerome
    I am writing a Google Chrome extension. I have reached the stage where I can pass messages back and forth readily but I am running into trouble with using the response callback. My background page opens a message page and then the message page requests more information from background. When the message page receives the response I want to replace some of the standard text on the message page with custom text based on the response. Here is the code: chrome.extension.sendRequest({cmd: "sendKeyWords"}, function(response) { keyWordList=response.keyWordsFound; var keyWords=""; for (var i = 0; i FIRST QUESTION: This all seems to work fine but the text on the page doesn't change. I am almost certainly because the callback completes after the page is finished loading and the rest of the code finishes before the callback completes, too. How do I update the page with the new text? Can I listen for the callback to complete or something like that? SECOND QUESTION: The procedure I am pursuing first opens the message page and then the message page requests the keyword list from background. Since I always want the keyword list, it makes more sense to just send it when I create the tab. Can I do that? Here is the code from background that opens the message page: //when request from detail page to open message page chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { if(request.cmd == "openMessage") { console.log("Received Request to Open Message, Profile Score: "+request.keyWordsFound.length); keyWordList=request.keyWordsFound; chrome.tabs.create({url: request.url}, function(tab){ msgTabId=tab.id; //needed to determine if message tab has later been closed chrome.tabs.executeScript(tab.id, {file: "message.js"}); }); console.log("Opening Message"); } });

    Read the article

  • Issue with Callback method and maintaining CultureInfo and ASP.Net HttpRuntime

    - by Little Larry Sellers
    Hi All, Here is my issue. I am working on an E-commerce solution that is deployed to multiple European countries. We persist all exceptions within the application to SQL Server and I have found that there are records in the DB that have a DateTime in the future! We define the culture in the web.config, for example pt-PT, and the format expected is DD-MM-YYYY. After debugging I found the issue with these 'future' records in the DB is because of Callback methods we use. For example, in our Caching architecture we use Callbacks, as such - CacheItemRemovedCallback ReloadCallBack = new CacheItemRemovedCallback(OnRefreshRequest); When I check the current threads CultureInfo, on these Callbacks it is en-US instead of pt-PT and also the HttpContext is null. If an exception occurs on the Callback our exception manager reports it as MM-DD-YYYY and thus it is persisted to SQL Server incorrectly. Unfortunately, in the exception manager code, we use DateTime.Now, which is fine if it is not a callback. I can't change this code to be culture specific due to it being shared across other verticals. So, why don't callbacks into ASP.Net maintain context? Is there any way to maintain it on this callback thread? What are the best practices here? Thanks.

    Read the article

  • callback on a variable which is inside a .each() loop

    - by Stoic
    I have this function, which is doing an asynchronous call to FB.api method. Now, i am looping over some data and capturing result of the above method call successfully. However, I am using a .each loop and I really can not figure out how to place my callback in this method, so that the outer method is only executed once. Here are the functions I am using: ask_for_perms($(this).val(),function(result) { $('#some-div').html('<a onclick = "get_perms(result);" >get perms</a>'); }); function ask_for_perms(perms_requested,cb) { var request = []; $.each(perms_requested,function(i,permission) { FB.api({ method: 'users.hasAppPermission', ext_perm: permission }, function(response) { if (response == 0) request.push(permission); request.join(','); cb(request); // cb is called many times here. }); }); } I am trying to return the request string from ask_for_perms function. Can anyone suggest me on where to place a proper callback to ask_for_perms. Right now, however, it works for me, but the callback is being called many times since it is inside a for loop. referencing: returning a variable from the callback of a function

    Read the article

  • jQuery animate callback - doesn't complete, no callback?

    - by Mark
    This jsbin demonstrates my problem: http://jsbin.com/aqute4/edit I'm using jQuery animate to kick down some non-css properties ala: http://james.padolsey.com/javascript/fun-with-jquerys-animate/ However, the animate gets very close to the final number, but never actually reaches it! The callback doesn't happen. I need the callback to run. Thanks in advance!

    Read the article

  • OAuth Callback procedure for mobile devices

    - by behrk2
    Hello, I am designing a Netflix Application for BlackBerry mobile devices. I am currently working on the OAuth. I am at the point where I can generate a Netflix login page in an embedded browser field in my application. After the user signs in, Netflix will send the user from the login page to a specified callback url. The callback url will also contain an authorized token, which is then needed to send back to Netflix. My question is: How am I supposed to do this on a mobile device? Is there a procedure set in place? I am unsure how I can extract the authorized token from the callback URL and send it back to my application. From my research, it does not appear that Netflix will provide a PIN/verifier for the user to then type into the application... Does anyone have any ideas? Thanks...

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >