Search Results

Search found 9872 results on 395 pages for 'preg replace callback'.

Page 36/395 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • Extending a jquery plugins event callback

    - by Greg J
    I'm extending the functionality of a jquery plugin (foo) with another jquery plugin (bar). Essentially, the first plugin specifies an onReady(): var foo = $.foo({ onReady: function() { alert('foo'); }}); Foo is sent to bar as a parameter to bar: var bar = $.bar(foo); I want bar to be able to hook into foo's onReady event: (function($) { $.extend({ bar: function(foo) { var foo = foo; // How to do alert('bar') when foo.onready is called? } }); })(jQuery); I can override foo's onready event: foo.onready = function() { alert('bar'); } But I don't want to override it, I want to extend it so that I'll see both alerts when foo is ready. Thanks in advance!

    Read the article

  • Adding dynamic controls to Silverlight application after WCF Service Asynchronous Callback

    - by Birk
    I'm trying to add some dynamic controls to my Silverlight page after a WCF call. When I try to add a control to I get an error: Object reference not set to an instance of an object. Here is a simplified version of my code: using edm = SilverlightBusinessApplication.ServiceRefrence; public partial class ListWCF : Page { edm.ServiceClient EdmClient = new ServiceClient(); public ListWCF() { EdmClient.GetTestCompleted += EdmGetTestCompleted; EdmClient.GetTestAsync(); } private void EdmGetTestCompleted(object sender, edm.GetTestCompletedEventArgs e) { //This is where I want to add my controls Button b = new Button(); LayoutRoot.Children.Add(b); //Error: Object reference not set to an instance of an object } } Is it not possible to modify the page after it has been loaded? What am I missing? Thanks

    Read the article

  • CALayer: callback when animation ends?

    - by carloe
    Hi All, I have been running into some issues with animating multiple CALayers at the same time, and was hoping someone could point me in the right direction. My app contains an array of CALayer. The position of each layer is set to (previousLayer.position.y + previousLayer.bounds.height), which basically lays them out similar to a table. I then have a method that, every-time it is called, adds a new layer to the stack and sets its Y position is set to 0. The Y positions of all other layers in the array are then offset by the height of the new layer (essentially pushing all old layers down). What I am having problems with is preventing the adding of new layers until the previous animation has completed. Is there a way to tell when an implicit animation has finished? Or alternatively, if I use CABasicAnimation and animationDidFinish, is there a way to tell which object finished animating when animationDidFinish is called?

    Read the article

  • Specifying a callback in Matlab after any runtime error

    - by JmG
    Is there a way to specify code to be run whenever an error occurs in Matlab? Googling I came across RunTimeErrorFcn and daqcallback, but I believe these are specific to the Data Acquisition Toolbox. I want something for when I just trip over a bug, like an access to an unassigned variable. (I use a library called PsychToolbox that takes over the GPU, so I want to be able to clear its screen before returning to the command prompt.)

    Read the article

  • Will HTML5 replace silverlight?

    - by Nasser Hadjloo
    A while ago I read a news here, that Microsoft changed its strategy for silverlight and will replace it with HTML5. As it is a controversial discussion, some guys from Microsoft and other corporation wrote about it and some agreed and some don't? As it is important to be aware of near future of tools that you are using, what do you think, Will Microsoft replace Silverlight with HTML5 or not? I myself believe that it will happen in 2012, the time that HTML5 released completely, and Microsoft are releasing VS2012.

    Read the article

  • Thread used for ServiceConnection callback (Android)

    - by Jannick
    Hi I'm developing an activity that binds to a local service (in onCreate of the activity): bindService(new Intent(this, CommandService.class), svcConn, BIND_AUTO_CREATE); I would like to be able to call methods through the IBinder in my lifecycle methods, but can not be sure that onServiceConnected have been called prior to these. I'm thinking of handling this by adding a queue of sorts in the ServiceConnection implementation, so that the method calls (Command pattern) will be executed once the connection is established. My questions are then: Is this stupid, any better ways? :) Are there any specification for which thread will be used to execute the ServiceConnection callbacks? More to the point, do I need to worry about synchronizing a queue datastructure? Edit - something like: public void onServiceConnected(ComponentName name, IBinder service) { dispatchService = (DispatchAsync)service; for(ExecutionTask task : queue){ dispatchService.execute(task.getCommand(), task); } }

    Read the article

  • On Render Callback For G+ Button

    - by Michael Robinson
    How might I go about performing an action only when a G+ button has finished rendering? Facebook allows one to do this using the following: FB.XFBML.parse(document, function() { alert('rendering done'); }); I've perused Google's documentation, but didn't see anything helpful. Currently my workaround is to monitor the G+ element until certain elements have been added, then perform my action: (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; po.onload = function() { var awaitRender = function(element) { if (element.firstChild && element.firstChild.firstChild && element.firstChild.firstChild.tagName.toUpperCase() === 'IFRAME') { alert('rendered!'); } else { window.setTimeout(function() { awaitRender(element) }, 100); } }; var buttons = document.getElementsByClassName('googleplus-button'); for(var i = 0; i < buttons.length; i++) { awaitRender(buttons[i]); } } var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); I'd like to know please, if there is either: A correct way one should do this for G+ buttons A better implementation that what I've hacked together above

    Read the article

  • use callback function to report stack backtrace

    - by user353394
    Assume I have the following: typedef struct { char *name; char binding; int address; } Fn_Symbol //definition of function symbol static Fn_Symbol *fnSymbols; //array of function symbols in a file statc int total; //number of symbol functions in the array and file static void PrintBacktrace(int sigum, siginfo_t * siginfo, void *context) { printf("\nSignal received %d (%s)\n", signum, strsignal(signum)); const int eip_index = 14; void *eip = (void *)((struct ucontext *)context)->uc_mcontext.gregs[eip_index]; printf("Error at [%p] %s (+0x%x), eip, fnName, offset from start); //????? exit(0); } I have this so far, but what is the best way using the fnSymbols static global pointer to identify the function where the error occured and then back trace through the stack to identify each calling function by address, name, and offset?

    Read the article

  • Template render callback

    - by Zsolt Németh
    I'm using Handlebar's {{#each}} to render out my collection to the DOM. After each item is rendered, I want to run a script on these elements. I'm trying to find a callabck function wich fires only once, when the whole render is completed. Meteor's Template.rendered() run's each time a new item is inserted, so it runs as many times as much item I have in my collection. Is there any solution for this? Thanks a lot!

    Read the article

  • Using callback functions for error handling in C

    - by Earlz
    Hi, I have been thinking about the difficulty incurred with C error handling.. like who actually does if(printf("hello world")==-1){exit(1);} But you break common standards by not doing such verbose, and usually useless coding. Well what if you had a wrapper around the libc? like so you could do something like.. //main... error_catchall(my_errors); printf("hello world"); //this will automatically call my_errors on an error of printf ignore=1; //this makes it so the function will return like normal and we can check error values ourself if(fopen.... //we want to know if the file opened or not and handle it ourself. } int my_errors(){ if(ignore==0){ _exit(1); //exit if we aren't handling this error by flagging ignore } return 0; //this is called when there is an error anywhere in the libc } ... I am considering making such a wrapper as I am synthesizing my own BSD licensed libc(so I already have to touch the untouchable..), but I would like to know what people think about it.. would this actually work in real life and be more useful than returning -1?

    Read the article

  • returning opengl display callback in D

    - by Max
    I've written a simple hello world opengl program in D, using the converted gl headers here. My code so far: import std.string; import c.gl.glut; Display_callback display() { return Display_callback // line 7 { return; // just display a blank window }; } // line 10 void main(string[] args) { glutInit(args.length, args); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowSize(800,600); glutCreateWindow("Hello World"); glutDisplayFunc(display); glutMainLoop(); } My problem is with the display() function. glutDisplayFunc() expects a function that returns a Display_callback, which is typedef'd as typedef GLvoid function() Display_callback;. When I try to compile, dmd says line 7: found '{' when expecting ';' following return statement line 10: unrecognized declaration How do I properly return the Display_callback here? Also, how do I change D strings and string literals into char*? My calls to glutInit and glutCreateWindow don't like the D strings they're getting. Thanks for your help.

    Read the article

  • Model callback failure in CakePHP

    - by Benedikt R.
    Hi! Can someone confirm a save process misbehaviour in the AppModel for the method beforeSave( )? This method doesn't seem to be executed before saving a data set. I can remember of reading something about a bug in a current version (btw, I am using 1.3.1). Best regards, Beendikt

    Read the article

  • scope of variables in JavaScript callback functions

    - by Ethan
    I expected the code below to alert "0" and "1", but it alert "2" twice. I don't the reason. Don't know if it is a problem of jQuery. Also, please help me to edit title and tags of this post if they are inaccurate. <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(function() { for (var i=0; i<2; i++) { $.get('http://www.google.com/', function() { alert(i); }); } }); </script> </head> <body> </body> </html>

    Read the article

  • Replace XML Bullet Points Found in Feed in Classic ASP

    - by StevieB
    Hey I am currently reading in a XML file which contains bullet list in the following container i.e. ? the average pension contribution rate for executive directors . I am having a problem with symbol directly before the text of each bullet point I want to remove it i.e Replace(text,"old","new") but i cant seem to find what value that bullet point actually is to replace of that makes sense. Thanks

    Read the article

  • How to set variable before callback is called?

    - by user1995327
    I'm trying to design a webpage... I have a function that I call get all info needed for an idividuals home page. A snippet of the codes is: exports.getHomePageData = function(userId, cb) { var pageData = {}; pageData.userFullName = dbUtil.findNameByUserId(userId, function(err){ if (err) cb(err); }); pageData.classes = dbUtil.findUserClassesByUserId(userId, function(err){ if (err) cb(err); }); cb(pageData); } The problem I'm having is the cb(pageData) is being called before I even finish setting the elements. I've seen that people use the async library to solve this but I was wondering if there was any other way for me to do it without needing more modules... Thanks!

    Read the article

  • How to protect a form HTML/PHP with JS callback to AS3

    - by Jk_
    Hi guys, I'm developing a Flash website (as3) where I need to be able to upload directly to YouTube by using the DATA API. However in order to do so, I had to use a proper HTML form on top of my flash object. Why? Because of the Browser Based Upload restictions. I first hide the form using JQuery and with a little CSS the form is display just where I want it. Within flash I use ExternalInterface.call() to show/hide the form when I need it! ExternalInterface.call("YTUploader.showIt"); The upload process is working great my only problem is that the form can be displayed easily... You just need a tool like firebug and you can use the form wherever you want on my flash app. So I was wandering which will be the best way to 'protect' this form or the best way to limit its access. Any advices will be appreciated. Thanks for your time. Jk.

    Read the article

  • jquery ajax callback out of the function scope

    - by vasion
    function checkauth(){ jQuery.getJSON("/users/checkauthjson", null, function(xhr){ if(xhr.success){ return true;}else{ return false;} }); } Obviously, that does not work, but it illustrates what i want to achieve. I want checkauth to return a value which is checked against an ajax server script. How do i do this?

    Read the article

  • Callback function and function pointer trouble in C++ for a BST

    - by Brendon C.
    I have to create a binary search tree which is templated and can deal with any data types, including abstract data types like objects. Since it is unknown what types of data an object might have and which data is going to be compared, the client side must create a comparison function and also a print function (because also not sure which data has to be printed). I have edited some C code which I was directed to and tried to template, but I cannot figure out how to configure the client display function. I suspect variable 'tree_node' of class BinarySearchTree has to be passed in, but I am not sure how to do this. For this program I'm creating an integer binary search tree and reading data from a file. Any help on the code or the problem would be greatly appreciated :) Main.cpp #include "BinarySearchTreeTemplated.h" #include <iostream> #include <fstream> #include <string> using namespace std; /*Comparison function*/ int cmp_fn(void *data1, void *data2) { if (*((int*)data1) > *((int*)data2)) return 1; else if (*((int*)data1) < *((int*)data2)) return -1; else return 0; } static void displayNode() //<--------NEED HELP HERE { if (node) cout << " " << *((int)node->data) } int main() { ifstream infile("rinput.txt"); BinarySearchTree<int> tree; while (true) { int tmp1; infile >> tmp1; if (infile.eof()) break; tree.insertRoot(tmp1); } return 0; } BinarySearchTree.h (a bit too big to format here) http://pastebin.com/4kSVrPhm

    Read the article

  • jQuery password strength plugin callback validation method

    - by jmorhardt
    I'm using a a jQuery plugin to evaluate password strength. It gives a graphical representation for the user to see how secure the password is. I'd like to use it to validate the field as well. The plugin works by assessing the password and giving it a score. I want to be able to verify that the user has entered a password of at least a certain score. The code is hosted on jQuery's site here: http://plugins.jquery.com/project/pstrength. The documentation states that there is a way to add a rule and do custom validation. I'm not sure where to start. The inline documentation states: * === Changelog === * Version 2.1 (18/05/2008) * Added a jQuery method to add a new rule: jQuery('input[@type=password]').pstrength.addRule(name, method, score, active) And later in the code there's this method: jQuery.extend(jQuery.fn.pstrength, { 'addRule': function (name, method, score, active) { digitalspaghetti.password.addRule(name, method, score, active); return true; }, 'changeScore': function (rule, score) { digitalspaghetti.password.ruleScores[rule] = score; return true; }, 'ruleActive': function (rule, active) { digitalspaghetti.password.rules[rule] = active; return true; } }); If anybody has seen an example of how to do this I'd appreciate a pointer in the right direction. Thanks!

    Read the article

  • eregi replace replacement

    - by apis17
    hi, since eregi replace was deprecated on version 5.3 i want to make my program compatible with new version of php http://php.net/manual/en/function.eregi-replace.php so, i'm trying to use preg_replace like this preg_replace(",",'','20,000.00'); but come with error i'm familiar with eregi_replace(',','','20,000.00'); i'm not familiar with regex expression. what is the best replacement for eregi_replace?

    Read the article

  • Getting camera preview data without using a preview callback

    - by velocipedestrian
    I have an app that does some processing to camera preview frames before displaying them to the user. I'm currently using preview callbacks to access the image data, but the problem I have is that the onPreviewFrame() function stops getting called if you start recording video using a MediaRecorder, and I want the processing to continue when video is being recorded. I've tried doing the following: public static Bitmap convertViewToBitmap(View view) { Bitmap bitmap = Bitmap.createBitmap(view.getWidth(),view.getHeight(), Bitmap.Config.ARGB_8888); view.draw(new Canvas(bitmap)); return bitmap; } to convert the preview surface to a bitmap, but when I pass the preview SurfaceView to the function it returns an all-black bitmap (it works when I test it on normal views though). Is there any other way I can access the image data if preview callbacks are not available?

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >