Search Results

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

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

  • I have made two template classes,could any one tell me if these things are useful?

    - by soul
    Recently i made two template classes,according to the book "Modern C++ design". I think these classes are useful but no one in my company agree with me,so could any one tell me if these things are useful? The first one is a parameter wrapper,it can package function paramters to a single dynamic object.It looks like TypeList in "Modern C++ design". You can use it like this: some place of your code: int i = 7; bool b = true; double d = 3.3; CParam *p1 = CreateParam(b,i); CParam *p2 = CreateParam(i,b,d); other place of your code: int i = 0; bool b = false; double d = 0.0; GetParam(p1,b,i); GetParam(p2,i,b,d); The second one is a generic callback wrapper,it has some special point compare to other wrappers: 1.This template class has a dynamic base class,which let you use a single type object represent all wrapper objects. 2.It can wrap the callback together with it's parameters,you can excute the callback sometimes later with the parameters. You can use it like this: somewhere of your code: void Test1(int i) { } void Test2(bool b,int i) { } CallbackFunc * p1 = CreateCallback(Test1,3); CallbackFunc * p2 = CreateCallback(Test2,false,99); otherwhere of your code: p1->Excute(); p2->Excute(); Here is a part of the codes: parameter wrapper: class NullType; struct CParam { virtual ~CParam(){} }; template<class T1,class T2> struct CParam2 : public CParam { CParam2(T1 &t1,T2 &t2):v1(t1),v2(t2){} CParam2(){} T1 v1; T2 v2; }; template<class T1> struct CParam2<T1,NullType> : public CParam { CParam2(T1 &t1):v1(t1){} CParam2(){} T1 v1; }; template<class T1> CParam * CreateParam(T1 t1) { return (new CParam2<T1,NullType>(t1)); } template<class T1,class T2> CParam * CreateParam(T1 t1,T2 t2) { return (new CParam2<T1,T2>(t1,t2)); } template<class T1,class T2,class T3> CParam * CreateParam(T1 t1,T2 t2,T3 t3) { CParam2<T2,T3> t(t2,t3); return new CParam2<T1,CParam2<T2,T3> >(t1,t); } template<class T1> void GetParam(CParam *p,T1 &t1) { PARAM1(T1)* p2 = dynamic_cast<CParam2<T1,NullType>*>(p); t1 = p2->v1; } callback wrapper: #define PARAM1(T1) CParam2<T1,NullType> #define PARAM2(T1,T2) CParam2<T1,T2> #define PARAM3(T1,T2,T3) CParam2<T1,CParam2<T2,T3> > class CallbackFunc { public: virtual ~CallbackFunc(){} virtual void Excute(void){} }; template<class T> class CallbackFunc2 : public CallbackFunc { public: CallbackFunc2():m_b(false){} CallbackFunc2(T &t):m_t(t),m_b(true){} T m_t; bool m_b; }; template<class M,class T> class StaticCallbackFunc : public CallbackFunc2<T> { public: StaticCallbackFunc(M m):m_m(m){} StaticCallbackFunc(M m,T t):CallbackFunc2<T>(t),m_m(m){} virtual void Excute(void){assert(CallbackFunc2<T>::m_b);CallMethod(CallbackFunc2<T>::m_t);} private: template<class T1> void CallMethod(PARAM1(T1) &t){m_m(t.v1);} template<class T1,class T2> void CallMethod(PARAM2(T1,T2) &t){m_m(t.v1,t.v2);} template<class T1,class T2,class T3> void CallMethod(PARAM3(T1,T2,T3) &t){m_m(t.v1,t.v2.v1,t.v2.v2);} private: M m_m; }; template<class M> class StaticCallbackFunc<M,void> : public CallbackFunc { public: StaticCallbackFunc(M method):m_m(method){} virtual void Excute(void){m_m();} private: M m_m; }; template<class C,class M,class T> class MemberCallbackFunc : public CallbackFunc2<T> { public: MemberCallbackFunc(C *pC,M m):m_pC(pC),m_m(m){} MemberCallbackFunc(C *pC,M m,T t):CallbackFunc2<T>(t),m_pC(pC),m_m(m){} virtual void Excute(void){assert(CallbackFunc2<T>::m_b);CallMethod(CallbackFunc2<T>::m_t);} template<class T1> void CallMethod(PARAM1(T1) &t){(m_pC->*m_m)(t.v1);} template<class T1,class T2> void CallMethod(PARAM2(T1,T2) &t){(m_pC->*m_m)(t.v1,t.v2);} template<class T1,class T2,class T3> void CallMethod(PARAM3(T1,T2,T3) &t){(m_pC->*m_m)(t.v1,t.v2.v1,t.v2.v2);} private: C *m_pC; M m_m; }; template<class T1> CallbackFunc *CreateCallback(CallbackFunc *p,T1 t1) { CParam2<T1,NullType> t(t1); return new StaticCallbackFunc<CallbackFunc *,CParam2<T1,NullType> >(p,t); } template<class C,class T1> CallbackFunc *CreateCallback(C *pC,void(C::*pF)(T1),T1 t1) { CParam2<T1,NullType>t(t1); return new MemberCallbackFunc<C,void(C::*)(T1),CParam2<T1,NullType> >(pC,pF,t); } template<class T1> CParam2<T1,NullType> CreateCallbackParam(T1 t1) { return CParam2<T1,NullType>(t1); } template<class T1> void ExcuteCallback(CallbackFunc *p,T1 t1) { CallbackFunc2<CParam2<T1,NullType> > *p2 = dynamic_cast<CallbackFunc2<CParam2<T1,NullType> > *>(p); p2->m_t.v1 = t1; p2->m_b = true; p->Excute(); }

    Read the article

  • Integrating CKFinder with InnovaStudio WYSIWYG Editor

    - by Sonny
    I use InnovaStudio WYSIWYG Editor, and I am trying to replace InnovaStudio's Asset Manager with CKFinder. There's a line in the editor configuration for what URL to use for the asset manager. I have pointed it at CKFinder. The part I can't get to work is getting the field to populate with the double-clicked file's path from CKFinder. It appears to use the 'func' parameter to specify the callback function. The URL I'm calling is: /common/ckfinder/ckfinder.html?action=js&func=setAssetValue The InnovaStudio WYSIWYG Editor provides the setAssetValue(v) callback function for setting the field value. The v parameter should hold the URL. CKFinder pops up as expected when it's invoked, but neither double-clicking the thumbnails nor using the "select" option in the context menu works. The normal/expected behavior is that CKFinder closes and the target field is populated with the URL for the selected asset. Additional Info: The InnovaStudio WYSIWYG Editor has a "popup" for adding an image or flash file to the content. This pop-up is in an iframe. When it calls CKFinder (or it's own asset manager), that is also in an iframe. It appears that CKFinder is looking in the scope of the main window rather than the image/flash iframe that actually contains the field that needs to be populated.

    Read the article

  • fullcalendar : updating option function callbacks after init

    - by Paul Maneesilasan
    Ok, so I have a problem with setting options whose values are callback functions when I try to set them after plugin initialization. I think this would be a common behavior, to dynamically set event callback after init'ing the calendar. Here is a snipit of code: $(document).ready(function() { $('#calendar').fullCalendar({ editable: false ,events:[{"title":"meeting.title","start":"2010-05-21 15:58:16 UTC"},{"title":"meeting.title","start":"2010-05-24 15:58:16", "url":"http://google.com"}] /* ,eventClick: function(event) { if (event.url) { window.open(event.url); return false; } } */ }); $('#calendar').fullCalendar('options', 'eventClick', function(event) { if (event.url) { window.open(event.url); return false; } }); }); You can see that I have setting the eventClick function as an init option commented out. If I do it that way, it works fine. However if I try to set it after the init, it doesn't work :( Is the some other way to do this? Or am I stuck with having to set the behavior upfront?

    Read the article

  • Is it possible to use boost::bind to effectively concatenate functions?

    - by Catskul
    Assume that I have a boost::function of with an arbitrary signature called type CallbackType. Is it possible to use boost::bind to compose a function that takes the same arguments as the CallbackType but calls the two functors in succession? Hypothetical example using a magic template: Template<typename CallbackType> class MyClass { public: CallbackType doBoth; MyClass( CallbackType callback ) { doBoth = bind( magic<CallbackType>, protect( bind(&MyClass::alert, this) ), protect( callback ) ); } void alert() { cout << "It has been called\n"; } }; void doIt( int a, int b, int c) { cout << "Doing it!" << a << b << c << "\n"; } int main() { typedef boost::function<void (int, int, int)> CallbackType; MyClass<CallbackType> object( boost::bind(doIt) ); object.doBoth(); return 0; }

    Read the article

  • How do I make custom functions chain-able with jQuery's?

    - by sergio
    I need a "callfront" or "precall" (the opposite of "callback" ¿?) to add in MANY places before an animation occurs in an existing plugin, To be used like e.g. $(some_unpredictable_obj).preFunct().animate(… The problem is, as I said they are MANY places, and all of them are different animations, on different objects. I can TELL where all of them occur, but I don't want to add over and over the same code. I actually have to add both a function before and after those animations, but I think I can use the callback for all of them. In a perfect world, I'd like to replace every animate(property, duration) by preFunct().animate(property,duration).postFunct() preFunct and postFunct don't need parameters, since they are always the same action, on the same object. This could be an amazing addition to "jQuery" (an easy way to jQuerize custom functions to be added to the normal chain (without messing with queues) I found this example but it will act on the applied element, and I don't want that because, as I said above, all the original animations to be added to are on different elements. I also found jQuery.timing, but it looks cooler the chain-able function :) Thanks.

    Read the article

  • Javascript Closures, Callbacks, This and That

    - by nazbot
    I am having some trouble getting a callback function to work. Here is my code: SomeObject.prototype.refreshData = function() { var read_obj = new SomeAjaxCall("read_some_data", { }, this.readSuccess, this.readFail); } SomeObject.prototype.readSuccess = function(response) { this.data = response; this.someList = []; for (var i = 0; i < this.data.length; i++) { var systemData = this.data[i]; var system = new SomeSystem(systemData); this.someList.push(system); } this.refreshList(); } Basically SomeAjaxCall is making an ajax request for data. If it works we use the callback 'this.readSuccess' and if it fails 'this.readFail'. I have figured out that 'this' in the SomeObject.readSuccess is the global this (aka the window object) because my callbacks are being called as functions and not member methods. My understanding is that I need to use closures to keep the 'this' around, however, I have not been able to get this to work. If someone is able show me what I should be doing I would appreciate it greatly. I am still wrapping my head around how closures work and specifically how they would work in this situation. Thanks!

    Read the article

  • Wrapping ASP.NET Client Callbacks

    - by Ricardo Peres
    Client Callbacks are probably the less known (and I dare say, less loved) of all the AJAX options in ASP.NET, which also include the UpdatePanel, Page Methods and Web Services. The reason for that, I believe, is it’s relative complexity: Get a reference to a JavaScript function; Dynamically register function that calls the above reference; Have a JavaScript handler call the registered function. However, it has some the nice advantage of being self-contained, that is, doesn’t need additional files, such as web services, JavaScript libraries, etc, or static methods declared on a page, or any kind of attributes. So, here’s what I want to do: Have a DOM element which exposes a method that is executed server side, passing it a string and returning a string; Have a server-side event that handles the client-side call; Have two client-side user-supplied callback functions for handling the success and error results. I’m going to develop a custom control without user interface that does the registration of the client JavaScript method as well as a server-side event that can be hooked by some handler on a page. My markup will look like this: 1: <script type="text/javascript"> 1:  2:  3: function onCallbackSuccess(result, context) 4: { 5: } 6:  7: function onCallbackError(error, context) 8: { 9: } 10:  </script> 2: <my:CallbackControl runat="server" ID="callback" SendAllData="true" OnCallback="OnCallback"/> The control itself looks like this: 1: public class CallbackControl : Control, ICallbackEventHandler 2: { 3: #region Public constructor 4: public CallbackControl() 5: { 6: this.SendAllData = false; 7: this.Async = true; 8: } 9: #endregion 10:  11: #region Public properties and events 12: public event EventHandler<CallbackEventArgs> Callback; 13:  14: [DefaultValue(true)] 15: public Boolean Async 16: { 17: get; 18: set; 19: } 20:  21: [DefaultValue(false)] 22: public Boolean SendAllData 23: { 24: get; 25: set; 26: } 27:  28: #endregion 29:  30: #region Protected override methods 31:  32: protected override void Render(HtmlTextWriter writer) 33: { 34: writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID); 35: writer.RenderBeginTag(HtmlTextWriterTag.Span); 36:  37: base.Render(writer); 38:  39: writer.RenderEndTag(); 40: } 41:  42: protected override void OnInit(EventArgs e) 43: { 44: String reference = this.Page.ClientScript.GetCallbackEventReference(this, "arg", "onCallbackSuccess", "context", "onCallbackError", this.Async); 45: String script = String.Concat("\ndocument.getElementById('", this.ClientID, "').callback = function(arg, context, onCallbackSuccess, onCallbackError){", ((this.SendAllData == true) ? "__theFormPostCollection.length = 0; __theFormPostData = ''; WebForm_InitCallback(); " : String.Empty), reference, ";};\n"); 46:  47: this.Page.ClientScript.RegisterStartupScript(this.GetType(), String.Concat("callback", this.ClientID), script, true); 48:  49: base.OnInit(e); 50: } 51:  52: #endregion 53:  54: #region Protected virtual methods 55: protected virtual void OnCallback(CallbackEventArgs args) 56: { 57: EventHandler<CallbackEventArgs> handler = this.Callback; 58:  59: if (handler != null) 60: { 61: handler(this, args); 62: } 63: } 64:  65: #endregion 66:  67: #region ICallbackEventHandler Members 68:  69: String ICallbackEventHandler.GetCallbackResult() 70: { 71: CallbackEventArgs args = new CallbackEventArgs(this.Context.Items["Data"] as String); 72:  73: this.OnCallback(args); 74:  75: return (args.Result); 76: } 77:  78: void ICallbackEventHandler.RaiseCallbackEvent(String eventArgument) 79: { 80: this.Context.Items["Data"] = eventArgument; 81: } 82:  83: #endregion 84: } And the event argument class: 1: [Serializable] 2: public class CallbackEventArgs : EventArgs 3: { 4: public CallbackEventArgs(String argument) 5: { 6: this.Argument = argument; 7: this.Result = String.Empty; 8: } 9:  10: public String Argument 11: { 12: get; 13: private set; 14: } 15:  16: public String Result 17: { 18: get; 19: set; 20: } 21: } You will notice two properties on the CallbackControl: Async: indicates if the call should be made asynchronously or synchronously (the default); SendAllData: indicates if the callback call will include the view and control state of all of the controls on the page, so that, on the server side, they will have their properties set when the Callback event is fired. The CallbackEventArgs class exposes two properties: Argument: the read-only argument passed to the client-side function; Result: the result to return to the client-side callback function, set from the Callback event handler. An example of an handler for the Callback event would be: 1: protected void OnCallback(Object sender, CallbackEventArgs e) 2: { 3: e.Result = String.Join(String.Empty, e.Argument.Reverse()); 4: } Finally, in order to fire the Callback event from the client, you only need this: 1: <input type="text" id="input"/> 2: <input type="button" value="Get Result" onclick="document.getElementById('callback').callback(callback(document.getElementById('input').value, 'context', onCallbackSuccess, onCallbackError))"/> The syntax of the callback function is: arg: some string argument; context: some context that will be passed to the callback functions (success or failure); callbackSuccessFunction: some function that will be called when the callback succeeds; callbackFailureFunction: some function that will be called if the callback fails for some reason. Give it a try and see if it helps!

    Read the article

  • Callback Error when using Sharepoint PeopleEditor

    - by BeraCim
    Hi all: I'm getting a "There was an error in the callback" error when clicking on the check names button of the PeopleEditor in Sharepoint. I didn't do anything fancy. All I did was just to create a PeopleEditor in the C# code and add it to a Panel, and let the aspx page renders it. The address book (the button next to the check names button) works. But everytime when I enter something in the PeopleEditor and click the check names button, I get that error. I had a look at my aspx page, and I'm getting the feeling that I'm missing some sort of Javascript library. I have JQuery library included in my aspx page, but thats about it. Does anyone know what might be wrong? [UPDATE] The PeopleEditor is appended to a panel, which is displayed when the value of a dropdown list changes. Thanks.

    Read the article

  • jQuery 1 minute countdown with milliseconds and callback

    - by Josh
    I'm trying to figure out a way to display a simple countdown that displays 1:00:00 whereby 1 = minutes, 00 = seconds, and 00 = milliseconds. I've found loads of jQuery countdowns on the interwebs, but none of the contain the ability to display milliseconds natively, and I really don't want to dig through thousands of lines of code to try and find a way to hack it in there myself. Is this something that would be pretty easy to whip up? I'm also hoping to have the ability to add a callback to the end of the countdown (0:00:00) so that when it finishes, I can run another function.

    Read the article

  • Facebook Graph Api doesn't redirect to my callback

    - by Pentium10
    I am following the steps to do the authorization as described here, but I am not redirected to my callback url. I get the following five steps after calling the first one: https://graph.facebook.com/oauth/authorize?display=touch&client_id=...&redirect_uri=... https://www.facebook.com/connect/uiserver.php?display=touch&client_id=...&redirect_uri=...&next=https://graph.facebook.com/oauth/authorize_success?display=touch&client_id=...&redirect_uri=...&type=web_server&cancel_url=https://graph.facebook.com/oauth/authorize_cancel?display=touch&client_id=...&redirect_uri=...&method=permissions.request&return_session=1 http://www.facebook.com/ http://touch.facebook.com/?w2m http://touch.facebook.com/login.php?next=http://touch.facebook.com/?w2m&cancel=http://touch.facebook.com/?w2m&fbconnect=0&r39c26cf0&refid=108 As you see the 5th steps just displays the login screen. If I log in, or I am already logged in I am presented with the home page. I use my application key, and the connect url of the app I've setup in FB Developers page. What I am doing wrong, why I am not redirected to my url?

    Read the article

  • jQuery Plugin for TinyMCE callback

    - by SomewhereThere
    I am using the jQuery plugin from the jQuery build of TinyMCE. This simplified code initializes the editor: $('textarea.tinymce').tinymce({ script_url : '../js/libraries/tiny_mce/tiny_mce.js' }); This loads tiny_mce.js via AJAX. I have code that I want to run once this file is loaded. I essentially want to specify a callback function, but there is no mention of this in the documentation for the plugin. Any ideas? I would be up for adding the functionality if it is not there but I cannot find an uncompressed version of the plugin.

    Read the article

  • setting jQuery .data() within .getJSON callback

    - by hackmaster.a
    I'm doing a couple of .getJSON calls and if any one of them succeeds, I'm trying to set a bool to true so I can then do some other stuff elsewhere on the page. I was trying to use jquery's .data() function, but I don't seem able to set it from inside the .getJSON callback. for example: $('#citations_button').data('citations', false); $.getJSON(apaurl, function(data) { $('#apacite').html("<td class=\"bibInfoLabel\">APA Citation</td><td class=\"bibInfoData\">"+data+"</td>"); $('#citations_button').data('citations', true); }, "html"); // other .getJSONs look like above... console.log("citations? "+$('#citations_button').data('citations')); prints false, even when I know the data came through. I thought this would work since .data() uses the cache to store the key/value pair. how can i flag successes?? appreciate any assistance!!

    Read the article

  • jQuery $.ajax success must be a callback function?

    - by b. e. hollenbeck
    I've created a wrapper function for jQuery's $.ajax() method so I can pass different dataTypes and post variables - like so: function doPost(dType, postData, uri){ $.ajax({ url: SITE_URL + uri, dataType: dType, data: postData, success: function(data){ return data; }); } The problem I'm having is getting the data (which is always JSON) back out. I've tried setting a var ret before the $.ajax() function call and setting it as ret = data in the success function. Am I being stupid about this? If I don't set a success function, will the $.ajax simply return the data? Or is it just success: return data? Or does success require a callback function to handle the data, which could just be return data?

    Read the article

  • tinyMCE setup callback versus onAddEditor

    - by Matthew Manela
    When you initialize a tinyMCE editor I have noticed two different ways to get called when the editor is created. One way is using the setup callback that is part of tinyMCE.init: tinyMCE.init({ ... setup : function(ed) { // do things with editor ed } }); The other way is to hook up to the onAddEditor event: tinyMCE.onAddEditor.add(function(mgr,ed) { // do things with editor ed }); What are the differences between using these two methods? Is the editor in a different state in one versus the other? For example, are things not yet loaded if I try to access properties on the editor object. What are reasons to use one over the other?

    Read the article

  • How to callback the new list id jQuery UI: sortable

    - by PARyGuy
    Hi, I'm trying to use the sortable widget for my site. I have a mini scheduling app that I'd like to display a list of appointments for the week sorted by days. For this example we'll use only two days ( 2 lists ). If I wanted to drag an appointment (list item) from day 2 over to day 1, is there a way I can callback the id of list 1 after I dragged an item to it? I can find the id of the parent list upon page load but I can't seem to be able to pull the new id after sort. Is this even possible? <script type="text/javascript"> $(function() { $("#day1, #day2").sortable({ connectWith: '.sortable' }).disableSelection(); }); </script>

    Read the article

  • jQuery ajax callback function not working

    - by Harish Kurup
    I am using Symfony PHP Framework to create web application, and using symfony Forms to create the HTML forms. I am trying to load the data in Select element using Ajax, for that i am using jQuery's Ajax functions. It is working fine as it sends and gets the response correctly(status as 200), but not calling the Callback function in some browsers such as IE,Chrome and Safari.It works fine in Firefox and Opera. the Code that is not working, $.ajax({ type: 'POST', url: 'form/ajax', async: true, cache: false, dataType : 'json', data: 'id='+ids, success: function(jsonData){ alert("ok go"); } }); the alert "OK Go" is not called in Chrome,IE and Safari But $.ajax({ type: 'POST', url: 'form/ajax', async: true, cache: false, dataType : 'json', data: 'id='+ids, success: alert("ok go"); }); this works, but as per the project i want the JSON data to load in my Select element. is there any thing wrong in the return JSON format or the bug in the jQuery Ajax functions, please help.

    Read the article

  • how do you hook up a callback event when using jquery ui tabs in ajax mode

    - by ooo
    Here is my html code using jquery ui tabs. As you can see, for the third tab, i am loading remotely through a feature built into jquery ui tabs where you just put a link in and it retrieves it remotely. My one open issue is that i would like a callback method when its done retrieving /Tracker/DailyTracker. is this possible? <div id="tabs"> <ul> <li><a href="#tab1">1</a></li> <li><a href="#tab2">2</a></li> <li><a href="/Tracker/DailyTracker"><span>3</span></a></li>

    Read the article

  • ajax error callback is called before firing the action in Symfony 2

    - by Beginner
    I'm trying to write an application with Symfony and I'm new to it. I have an ajax call in this application. The problem is that it always fires error call back . I put breakpoint in netbeans IDE and can see that error callback is fired before firing the specified action in the url property of ajax. action code: public function userNameExistsAction() { return 'success'; } javascript: $('#register_submit').click(function(){ var path = '/symfony/web/app_dev.php/account/userNameExists'; //var userName = $('#register_userName').val(); $.ajax({ url: path, type: 'GET', success: function(){ alert('success');}, error: function() { console.log('error'); } }); }); Any help is appreciated in advance.

    Read the article

  • Trigger a form submit from within an AJAX callback using jQuery

    - by Yarin
    I want to perform an ajax request right before my form is submitted. I want to trigger the form submit from my ajax callback, but when I try to trigger the submit, I get the following error: Uncaught TypeError: Property 'submit' of object # is not a function Here is the entire code: <form method="post" action="http://www.google.com" > <input type="text" name="email" id="test" size="20" /> <input id="submit" name="submit" type="submit" value="Submit" /> </form> <script> function do_ajax() { var jqxhr = $.get("#", function(){ $('form').submit(); }); } $(function() { $('#submit').click(function (e) { e.preventDefault(); do_ajax(); }); }); </script> Stumped.

    Read the article

  • Sending parameters to jquery callback

    - by KhanS
    I am making a jquery call from a javascript method. I want a parameter to be sent to my call back method. I am using a handler(ashx) to make jquery call, the handler is getting invoked by the callback is not getting fired. Below is the code function MyButtonClick(){ var myDiv = "divname"; $.post("MyHandler.ashx", { tgt: 1 }, myDiv, CustomCallBack); } function CustomCallBack(data, result) { debugger; //SomeCode } } Handler code(ashx file) public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int tgt = Convert.ToInt32(context.Request["tgt"]); if (tgt == 1) { context.Response.Write("Some text"); } }

    Read the article

  • Html5 - Callback when media is ready on iPad wont work

    - by Kap
    I'm trying to add a callback to a HTML5 audio element on an iPad. I added an eventlistener to the element, the myOtherThing() starts but there is no sound. If I pause and the play the sound again the audio starts. This works in chrome. Does anyone have an idea how I can do this? myAudioElement.src = "path_to_file"; addEventListener("canplay", function(){ myAudioElement.play(); myOtherThing.start(); }); SOLVED Just wanted to share my solution here, just in case someone else needs it. As far as I understand the iPad does not trigger any events without user interactions. So to be able to use "canply", "playing" and all the other events you need to use the built in media controller. Once you press play in that controller, the events gets triggered. After that you can use your custom interface.

    Read the article

  • Scrapy Not Returning Additonal Info from Scraped Link in Item via Request Callback

    - by zoonosis
    Basically the code below scrapes the first 5 items of a table. One of the fields is another href and clicking on that href provides more info which I want to collect and add to the original item. So parse is supposed to pass the semi populated item to parse_next_page which then scrapes the next bit and should return the completed item back to parse Running the code below only returns the info collected in parse If I change the return items to return request I get a completed item with all 3 "things" but I only get 1 of the rows, not all 5. Im sure its something simple, I just can't see it. class ThingSpider(BaseSpider): name = "thing" allowed_domains = ["somepage.com"] start_urls = [ "http://www.somepage.com" ] def parse(self, response): hxs = HtmlXPathSelector(response) items = [] for x in range (1,6): item = ScrapyItem() str_selector = '//tr[@name="row{0}"]'.format(x) item['thing1'] = hxs.select(str_selector")]/a/text()').extract() item['thing2'] = hxs.select(str_selector")]/a/@href').extract() print 'hello' request = Request("www.nextpage.com", callback=self.parse_next_page,meta={'item':item}) print 'hello2' request.meta['item'] = item items.append(item) return items def parse_next_page(self, response): print 'stuff' hxs = HtmlXPathSelector(response) item = response.meta['item'] item['thing3'] = hxs.select('//div/ul/li[1]/span[2]/text()').extract() return item

    Read the article

  • jquery calendarpicker callback pass querystring

    - by user577318
    Trying to use this CalendarPicker source and docs here: http://bugsvoice.com/applications/bugsVoice/site/test/calendarPickerDemo.jsp I need to be able to pass the date selected as query string variable of "searchdate" and reload page also updating current date for calendarPicker with querystring date on page reload. This is what I have so far: jQuery(document).ready(function() { var calendarPicker = jQuery("#calendarpicker").calendarPicker({ monthNames:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], years:0, months:6, days:5, showDayArrows:true, callback:function(cal) { // Simple output to test calendar date change jQuery("#output").html("Selected date: " + cal.currentDate.getFullYear()+"-"+cal.currentDate.getMonth()+"-"+cal.currentDate.getDate() ); // Not working well since it also includes arrows from datepicker as selectors jQuery(".calDay").children().click(function() { window.location.href="mysite.com?searchdate="+cal.currentDate.getFullYear()+"-"+cal.currentDate.getMonth()+"-"+cal.currentDate.getDate(); }); } }); Any help greatly appreciated. Can this be done with ajax? I am attempting to update a table of events by datepicker.

    Read the article

  • Getting 'this' pointer inside dependency property changed callback

    - by mizipzor
    I have the following dependency property inside a class: class FooHolder { public static DependencyProperty CurrentFooProperty = DependencyProperty.Register( "CurrentFoo", typeof(Foo), typeof(FooHandler), new PropertyMetadata(OnCurrentFooChanged)); private static void OnCurrentFooChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FooHolder holder = (FooHolder) d.Property.Owner; // <- something like this // do stuff with holder } } I need to be able to retrieve a reference to the class instance in which the changed property belongs. This is since FooHolder has some event handlers that needs to be hooked/unhooked when the value of the property is changed. The property changed callback must be static, but the event handler is not.

    Read the article

  • Supervisor callback for child normal exit

    - by Aler
    I am creating a test app where is one supervisor with simple_one_for_one strategy and many worker children added dynamically to it. How to implement callback (or receive a message) in supervisor that will be called when child exit normally? Main goal is to notify some other process that all supervised worker processes are done and it's time to show final report. How to design such kind of behavior? Should I create my own behavior that combine supervisor and gen_server, or there is a way to do this with standard otp behaviors?

    Read the article

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