Search Results

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

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

  • Why callback functions needs to be static when declared in class

    - by Dave17
    I was trying to declare a callback function in class and then somewhere i read the function needs to be static but It didn't explain why? #include <iostream> using std::cout; using std::endl; class Test { public: Test() {} void my_func(void (*f)()) { cout << "In My Function" << endl; f(); //Invoke callback function } static void callback_func() {cout << "In Callback function" << endl;} }; int main() { Test Obj; Obj.my_func(t.callback_func); }

    Read the article

  • Jquery callback function executes over and over again...

    - by Pandiya Chendur
    This my jquery function, function getRecordspage(curPage, pagSize) { // code here $(".pager").pagination(strarr[1], { callback: function() { getRecordspage(2, 5);},current_page: curPage - 1, items_per_page:'5', num_display_entries: '5', next_text: 'Next', prev_text: 'Prev', num_edge_entries: '1' }); } and i call this jquery function, <script type="text/javascript"> $(document).ready(function() { getRecordspage(1, 5); }); </script> As you see my It works fine for 1st time and my callback function is configured to the current function itself... when it gets called the callback gets executed over and over again.... How can i prevent this? Any suggestion....

    Read the article

  • handle when callback to a dealloced delegate?

    - by athanhcong
    Hi all, I implemented the delegate-callback pattern between two classes without retaining the delegate. But in some cases, the delegate is dealloced. (My case is that I have a ViewController is the delegate object, and when the user press back button to pop that ViewController out of the NavigationController stack) Then the callback method get BAD_EXE: if (self.delegate != nil && [self.delegate respondsToSelector:selector]) { [self.delegate performSelector:selector withObject:self withObject:returnObject]; } I know the delegate-callback pattern is implemented in a lot of application. What is your solution for this?

    Read the article

  • empty() not a valid callback?

    - by user151841
    I'm trying to use empty() in array mapping in php. I'm getting errors that it's not a valid callback. $ cat test.php <? $arrays = array( 'arrEmpty' => array( '','','' ), ); foreach ( $arrays as $key => $array ) { echo $key . "\n"; echo array_reduce( $array, "empty" ); var_dump( array_map("empty", $array) ); echo "\n\n"; } $ php test.php arrEmpty Warning: array_reduce(): The second argument, 'empty', should be a valid callback in /var/www/authentication_class/test.php on line 12 Warning: array_map(): The first argument, 'empty', should be either NULL or a valid callback in /var/www/authentication_class/test.php on line 13 NULL Shouldn't this work? Long story: I'm trying to be (too?) clever and checking that all array values are not empty strings.

    Read the article

  • how to callback a lua function from a c function

    - by pierr
    Hi, I have a c function test_callback accepting a point to a function as the parameter and It will "callback" that function. //typedef int(*data_callback_t)(int i); int test_callback(data_callback_t f) { f(3); } int datacallback(int a ) { printf("called back %d\n",a); return 0; } //example test_callback(datacallback); // print : called back 3 Now, I want to wrap test_callback so that they can be called from lua, suppose the name is lua_test_callback ;and also the input parameter to it would be a lua function. How should I achieve this goal? function lua_datacallback (a ) print "hey , this is callback in lua" ..a end lua_test_callback(lua_datacallback) //expect to get "hey this is callback in lua 3 "

    Read the article

  • c++ to vb.net , problem with callback function

    - by johan
    I'm having a hard time here trying to find a solution for my problem. I'm trying to convert a client API funktion from C++ to VB.NET, and i think have some problems with the callback function. parts of the C++ code: typedef struct{ BYTE m_bRemoteChannel; BYTE m_bSendMode; BYTE m_nImgFormat; // =0 cif ; = 1 qcif char *m_sIPAddress; char *m_sUserName; char *m_sUserPassword; BOOL m_bUserCheck; HWND m_hShowVideo; }CLIENT_VIDEOINFO, *PCLIENT_VIDEOINFO; CPLAYER_API LONG __stdcall MP4_ClientStart(PCLIENT_VIDEOINFO pClientinfo,void(CALLBACK *ReadDataCallBack)(DWORD nPort,UCHAR *pPacketBuffer,DWORD nPacketSize)); void CALLBACK ReadDataCallBack(DWORD nPort,UCHAR *pPacketBuffer,DWORD nPacketSize) { TRACE("%d\n",nPacketSize); } ..... aa5.m_sUserName = "123"; aa5.m_sUserPassword="w"; aa5.m_bUserCheck = TRUE; MP4_ClientSetTTL(64); nn1 = MP4_ClientStart(&aa5,ReadDataCallBack); if (nn1 == -1) { MessageBox("error"); return; } SDK description: MP4_ClientStart This function starts a connection. The format of the call is: LONG __stdcall MP4_ClientStart(PCLIENT_VIDEOINFO pClientinfo, void(*ReadDataCallBack)(DWORD nChannel,UCHAR *pPacketBuffer,DWORD nPacketSize)) Parameters pClientinfo holds the information. of this connection. nChannel holds the channel of card. pPacketBuffer holds the pointer to the receive buffer. nPacketSize holds the length of the receive buffer. Return Values If the function succeeds the return value is the context of this connection. If the function fails the return value is -1. Remarks typedef struct{ BYTE m_bRemoteChannel; BYTE m_bSendMode; BYTE m_bImgFormat; char *m_sIPAddress; char *m_sUserName; char *m_sUserPassword; BOOL m_bUserCheck; HWND m_hShowVideo; } CLIENT_VIDEOINFO, * PCLIENT_VIDEOINFO; m_bRemoteChannel holds the channel which the client wants to connect to. m_bSendMode holds the network mode of the connection. m_bImgFormat : Image format, 0 is main channel video, 1 is sub channel video m_sIPAddress holds the IP address of the server. m_sUserName holds the user’s name. m_sUserPassword holds the user’s password. m_bUserCheck holds the value whether sends the user’s name and password or not. m_hShowVideo holds Handle for this video window. If m_hShowVideo holds NULL, the client can be record only without decoder. If m_bUserCheck is FALSE, we will send m_sUserName and m_sUserPassword as NULL, else we will send each 50 bytes. The length of m_sIPAddress and m_sUserName must be more than 50 bytes. ReadDataCallBack: When the library receives a packet from a server, this callback is called. My VB.Net code: Imports System.Runtime.InteropServices Public Class Form1 Const WM_USER = &H400 Public Structure CLIENT_VIDEOINFO Public m_bRemoteChannel As Byte Public m_bSendMode As Byte Public m_bImgFormat As Byte Public m_sIPAddress As String Public m_sUserName As String Public m_sUserPassword As String Public m_bUserCheck As Boolean Public m_hShowVideo As Long 'hWnd End Structure Public Declare Function MP4_ClientSetNetPort Lib "hikclient.dll" (ByVal dServerPort As Integer, ByVal dClientPort As Integer) As Boolean Public Declare Function MP4_ClientStartup Lib "hikclient.dll" (ByVal nMessage As UInteger, ByVal hWnd As System.IntPtr) As Boolean <DllImport("hikclient.dll")> Public Shared Function MP4_ClientStart(ByVal Clientinfo As CLIENT_VIDEOINFO, ByRef ReadDataCallBack As CALLBACKdel) As Long End Function Public Delegate Sub CALLBACKdel(ByVal nPort As Long, <MarshalAs(UnmanagedType.LPArray)> ByRef pPacketBuffer As Byte(), ByVal nPacketSize As Long) Public Sub CALLBACK(ByVal nPort As Long, <MarshalAs(UnmanagedType.LPArray)> ByRef pPacketBuffer As Byte(), ByVal nPacketSize As Long) End Sub Public mydel As New CALLBACKdel(AddressOf CALLBACK) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Clientinfo As New CLIENT_VIDEOINFO() Clientinfo.m_bRemoteChannel = 0 Clientinfo.m_bSendMode = 0 Clientinfo.m_bImgFormat = 0 Clientinfo.m_sIPAddress = "193.168.1.100" Clientinfo.m_sUserName = "1" Clientinfo.m_sUserPassword = "a" Clientinfo.m_bUserCheck = False Clientinfo.m_hShowVideo = Me.Handle 'Nothing MP4_ClientSetNetPort(850, 850) MP4_ClientStartup(WM_USER + 1, Me.Handle) MP4_ClientStart(Clientinfo, mydel) End Sub End Class here is some other examples of the code in: C# http://blog.csdn.net/nenith1981/archive/2007/09/17/1787692.aspx VB ://read.pudn.com/downloads70/sourcecode/graph/250633/MD%E5%AE%A2%E6%88%B7%E7%AB%AF%28VB%29/hikclient.bas__.htm ://read.pudn.com/downloads70/sourcecode/graph/250633/MD%E5%AE%A2%E6%88%B7%E7%AB%AF%28VB%29/Form1.frm__.htm Delphi ://read.pudn.com/downloads91/sourcecode/multimedia/streaming/349759/Delphi_client/Unit1.pas__.htm

    Read the article

  • PHP callback function not being called

    - by Industrial
    Hi everyone, I've got the following code: function _callback_memcache_failure($host, $port) { print "memcache '$host:$port' failed"; } $this->memcache = new Memcache; $this->memcache->addServer('192.168.1.35', '11211', 0, 50, 10, TRUE, _callback_memcache_failure('192.168.1.35','11211')); The server is online and running (verified!), but the Failure callback function is being called at each connection. Why is that? Reference: PHP documentation: Memcache::addServer - failure_callback Allows the user to specify a callback function to run upon encountering an error. The callback is run before failover is attempted. The function takes two parameters, the hostname and port of the failed server .

    Read the article

  • Replace the callback for a GtkItem created from a GtkItemFactoryEntry

    - by rampion
    I'm writing a plugin that's modifying an existing UI. One thing I want to do is change what an existing menu item does. This is all using the Gtk library. The menu item (a GtkItem) is created from a GtkItemFactoryEntry (which is out of my control), and has its current behaviour defined by the callback in the GtkItemFactoryEntry. I can get handle on the menu item using gtk_item_factory_get_widget() and attach further actions to the menu item using gtk_signal_connect(), but I can't seem to disconnect the original callback using gtk_signal_disconnect() or gtk_signal_disconnect_by_func(). Is there any way I can remove or replace the original callback?

    Read the article

  • JTwitter OAuth with callback authorisation

    - by RenegadeAndy
    Hey guys. I am writing an App using JTwitter however I need to authenticate in order to not have the 150 requests per minute on the public api. Jtwitter seems to support OAuth however I have some questions. My app will be running behind a company firewall - so the URL wont be accessible outside of the company's network - will callback authorisation work, and does anybody have an example of using callback authorisation using OAuth in JTwitter - because I cannot work it out in order to try it. Cheers, Andy

    Read the article

  • Can I somehow know which replacement is taking place from within a callback of preg_replace_callback

    - by jayarjo
    I'm using preg_replace_callback to substitute particular tokens within the string. But apart from actual token I need to know as well whether that token was first, second or third in a subject string. Is there any way to access that info? I found an argument $count in preg_replace_callback definition (http://php.net/manual/en/function.preg-replace-callback.php), which counts replacements, but I'm not sure if it is accessible from within callback. Any example of the usage in described context?

    Read the article

  • google oauth callback

    - by Ben None
    Setting oauth with some providers is always kind of weird; currently hitting a problem concerning the callback, i had made everything work very nicely with google, getting redirected back specifying the callback url in both the get_request_token and redirect url param oauth_callback= but it then for some reason stopped redirecting, i'm currently stuck with the pin to specify over at google. I seeking explanations about this, if anybody went through the same kind of problem. thx

    Read the article

  • Cannot set textbox value in Callback handler in asp.net

    - by user102533
    I am using ASP.NET Callbacks (that implements the ICallbackEventHandler) and in the handler, I try to set a value of the text box: txtName.text = "Test"; but this value is not set. Is this a limitation with callback? It appears I cannot do much in a callback handler other than sending back a string to the client side (ofcourse I can access the Session etc)

    Read the article

  • Rails callback for the equivalent of "after_new"

    - by Joe Cairns
    Right now I cant find a way to generate a callback between lines 1 and 2 here: f = Foo.new f.some_call f.save! Is there any way to simulate what would be effectively an after_new callback? Right now I'm using after_initialize but there are potential performance problems with using that since it fires for a lot of different events.

    Read the article

  • How to implement callback methods inside classes (PHP)

    - by sombe
    I need to use a class callback method on an array inside another method (the callback function belongs to the class). class Database { public function escape_string_for_db($string){ return mysql_real_escape_string($string); } public function escape_all_array($array){ return array_filter($array,"$this->escape_string_for_db"); } } Is this the right way to go about that? (I mean, in terms of the second parameter passed to array_filter)

    Read the article

  • How to implement callback functions inside classes (PHP)

    - by sombe
    I need to use a class callback method on an array inside another method (the callback function belongs to the class). class Database { public function escape_string_for_db($string){ return mysql_real_escape_string($string); } public function escape_all_array($array){ return array_filter($array,"$this->escape_string_for_db"); } } Is this the right way to go about that? (I mean, in terms of the second parameter passed to array_filter)

    Read the article

  • c++ callback syntax in a class

    - by Mr Bell
    I am trying to figure out the syntax to register a callback with this 3rd party software. I think it is probably a basic question, I just am not too familiar with c++. They have a method for registering a callback function so their code can call a function in my code when an event happens. They provided a working example that registers the callback from the main file, but I want to know how to do it when working inside a class Their method signature: smHTRegisterHeadPoseCallback(smEngineHandle engine_handle, void *user_data, smHTHeadPoseCallback callback_fun); Working example from the main file: void STDCALL receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVideoFrame video_frame) { ... } void main() { ... smHTRegisterHeadPoseCallback(engine_handle,0,receiveHeadPose) ... } But I want to use this from my class MyClass.h class FaceEngine { public: void STDCALL receiveFaceData(void *, smEngineFaceData face_data, smCameraVideoFrame video_frame); ... MyClass.cpp void FaceEngine::Start(void) { rc = smHTRegisterFaceDataCallback(hFaceAPIEngine,0,&FaceEngine::receiveFaceData); ... Results in this compiler error: Error 1 error C2664: 'smHTRegisterFaceDataCallback' : cannot convert parameter 3 from 'void (__stdcall FaceEngine::* )(void *,smEngineFaceData,smCameraVideoFrame)' to 'smHTFaceDataCallback' d:\stuff\programming\visual studio 2008\projects\tut02_vertices\faceengine.cpp 43 Beard If my question isn't clear please let me know how I can clarify.

    Read the article

  • Perform function in attr() callback?

    - by Jared
    Hello, Not sure if I am doing this correctly or not. Here is my JS: var currentIMG; $( '.leftMenuProductButton' ).hover ( function () { currentIMG = $("#swapImg").attr("src"); var swapIMG = $(this).next(".menuPopup").attr("id"); $("#swapImg").css("opacity", 0).attr("src", productImages[swapIMG], function(){ $("#swapImg").fadeTo("slow", 1); }); }, function () { $("#swapImg").stop().attr("src",currentIMG); }); What I am trying to do is Set a IMG Opacity to 0 (#swapImg), replace it's SRC, then fade it back in. So I am trying to fade it back in using a callback from the attr(). If I am doing this incorrectly, can someone please explain a better way to do this? The reason I am trying to do it in the callback is that I need the fadeTo to only occur after the new image is fully loaded, otherwise it does a bit of a flash. I am using jquery 1.4, and according to http://jquery14.com/day-01/jquery-14 it appears you can do a callback in the attr() method.

    Read the article

  • Call stored procedure using Spring SimpleJdbcCall with callback

    - by MFIhsan
    I have an Oracle Stored procedure that takes CLOB input and REFCURSOR output. I invoke the SP via Spring SimpleJdbcCall passing in a RowMapper to map the results. However, since the result set is large, I need to provide callback feature to the client. I can't quite figure out how to add callback for an SP call using Spring - both with and without SimpleJdbcCall. One thought I have is to pass-in a RowCallbackHandler. Will this work or is there a better way to solve this problem? Any help here is appreciated. private Map<String, Object> arguments = ...; SimpleJdbcCall jdbcCall = new SimpleJdbcCall(this.jdbcTemplate) .withCatalogName(this.packageName) .withProcedureName(this.storedProcName) .withoutProcedureColumnMetaDataAccess() .declareParameters(this.outputParameters.toArray(new SqlOutParameter[]{})); if(!isEmpty(inputParameters)) { jdbcCall.declareParameters(inputParameters.toArray(new SqlParameter[]{})); } this.outputParameters.add(new SqlOutParameter(outputParamName, VARCHAR, rowMapper)); jdbcCall.execute(arguments);

    Read the article

  • Specify an inline callback function as an argument.

    - by Matthias Vance
    LS, Let me first explain what I'm trying to achieve using some pseudo-code (JavaScript). // Declare our function that takes a callback as as an argument, and calls the callback with true. B(func) { func(true); } // Call the function B(function(bool success) { /* code that uses success */ }); I hope this says it all. If not, please comment on my question so I can write a little more to clarify my issue. What I want is to have code like this in C++. I have tried to use lambda functions, but I was unable to specify a parameter type for those. Kind regards, Matthias Vance

    Read the article

  • Facebook RESTful API require_login() callback

    - by skidding
    Hi, I'm trying to authenticate a user through the RESTful API (not Connect) but I can't since the callback system does not work for me. I have a local app that creates the Facebook API object with my key and secret, then calls the Facebook API require_login() method; I am sent to Facebook login, I login, and then I am sent to http://www.facebook.com/login.php?auth_token=<...>, where there's another login with just a field for password (not username), I write it again, and after that I am redirected to normal Facebook home. What am I doing wrong? I have set the callback URL in the Facebook app proprieties. Does it have anything to do with the fact that it's localhost? Thanks!

    Read the article

  • jQuery.ajax success callback function not executed

    - by Frank Michael Kraft
    I have a JavaScript Ajax call (jQuery.ajax), that does not execute the success callback function. $.ajax({ url: target, contentType: 'application/json; charset=utf-8', type: 'POST', // type: 'GET', dataType: 'jsonp', error: function (xhr, status) { alert(status); }, success: function (result) { alert("Callback done!"); // grid.dataBind(result.results); // grid.dataBind(result); } }); I see in firebug, that the request is posted and the correct result in terms of the json is returned as expected. What is wrong?

    Read the article

  • Javascript callback for multiple ajax calls

    - by Jisaak
    My lack of javascript knowledge is getting me in trouble again. I think this should be a fairly easy problem to fix but I cant figure it out. Situation: I want to make three ajax calls in a click event. Each ajax call does a distinct operation and returns back data that is needed for a final callback. The calls themselves are not dependent on one another, they can all go at the same time, however I would like to have a final callback when all three are complete. $('#button').click(function() { fun1(); fun2(); fun3(); //now do something else when the requests have done their 'sucess' callbacks. }); var fun1= (function() { $.ajax({/*code*/}); }); var fun2 = (function() { $.ajax({/*code*/}); }); var fun3 = (function() { $.ajax({/*code*/}); });

    Read the article

  • WCF Callback Contract Fiddler Debugging

    - by DavyMac23
    I'm trying to debug a WCF self-hosted service utilizing callbacks. Every 1/2 I make a callback to a SL3 app to display the latest changes (yes, there are tons of changes every 1/2 second). There are 3 services, one has new data every 1/2 second, one has new data every second, and another has new data every hour. I've set all of my timeouts, Send, Receive, Open and Close to 2 days 23 hours and 23 minutes, but I still get time out errors on the service side when I go to issue the callback. I'm using Fiddler and I notice that my service that has new data every hour is still showing up every 10 seconds. Fiddlier shows a Body length of -1, then 10 seconds later it changes to 0 and the response is HTTP 200, but the overall elapsed time is 10 seconds. What's going on here?

    Read the article

  • Rails Cache Sweeper and Model Callback Firing

    - by Topher Fangio
    Hey guys, I have the following classes: class Vigil < ActiveRecord::Base after_update :do_something_cool private def do_something_cool # Sweet code here end end class NewsFeedObserver < ActionController::Caching::Sweeper observe Vigil def after_update # Create a news feed entry end end Everything works as expected. The after_update in the sweeper requires that the do_something_cool method in the model has finished before it can run properly. The problem is that the after_update in the sweeper is being called before (or perhaps at the same time as) the do_something_cool callback and it's causing problems. Does anyone know how to force the after_update in the sweeper to fire after the model callback? Is there better way to achieve this?

    Read the article

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