Search Results

Search found 40165 results on 1607 pages for 'function pointers'.

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

  • JavaScript Loop and wait for function

    - by Fluidbyte
    I have a simple single-dimension array, let's say: fruits = ["apples","bananas","oranges","peaches","plums"]; I can loop thru with with $.each() function: $.each(fruits, function(index, fruit) { showFruit(fruit); }); but I'm calling to another function which I need to finish before moving on to the next item. So, if I have a function like this: function showFruit(fruit){ $.getScript('some/script.js',function(){ // Do stuff }) } What's the best way to make sure the previous fruit has been appended before moving on?

    Read the article

  • Why can't I call this function (javascript/jquery)

    - by Ankur
    This is driving me nuts .... I have written a function function seraliseQuery(){ for(var i=1; i<=variables;i++){ alert(queryPreds[i]+" - "+queryObjs[i]); } } I just want to be able to call it from my other function $(".object").click( function() { // code removed seraliseQuery(); }); The error I get is "the function serialiseQuery() is undefined". Everything is within $(document).ready( function() { // code goes here }

    Read the article

  • Pointer to a C++ class member function as a global function's parameter?

    - by marcin1400
    I have got a problem with calling a global function, which takes a pointer to a function as a parameter. Here is the declaration of the global function: int lmdif ( minpack_func_mn fcn, void *p, int m, int n, double *x, double *fvec, double ftol) The "minpack_func_mn" symbol is a typedef for a pointer to a function, defined as: typedef int (*minpack_func_mn)(void *p, int m, int n, const double *x, double *fvec, int iflag ); I want to call the "lmdif" function with a pointer to a function which is a member of a class I created, and here is the declaration of this class function: int LT_Calibrator::fcn(void *p, int m, int n, const double *x, double *fvec,int iflag) I am calling a global function like this: info=lmdif(&LT_Calibrator::fcn, 0, m, n, x, fvec, ftol) Unfortunately, I get a compiler error, which says: "error C2664: 'lmdif' : cannot convert parameter 1 from 'int (__thiscall LT_Calibrator::* )(void *,int,int,const double *,double *,int)' to 'minpack_func_mn' 1 There is no context in which this conversion is possible" Is there any way to solve that problem?

    Read the article

  • Create a callback function within a custom jQuery function

    - by Thomas
    I'm not sure how to approach this as I am fairly new to jQuery. I'm wanting to create a callback function within a custom function. Here's my example: function doSomething() { var output = 'output here'; // Do something here // This is where I want to create the callback function and pass output as a parameter } I want the callback function to be accessible by any number of scripts (e.g. more than one script can access this callback). This function (doSomething) is not part of a plugin but rather part of another callback function itself. I've also created a var within the function and want to pass that through the callback function as well. How can I do this?

    Read the article

  • Undefined function in php

    - by Bidyut
    I wrote three methods in a class and one is calling another, but when I call the function outside through the object, it is showing an undefined function error for the second function. Here's my code: function resize_image(){ } function image_resize(){ $a = resize_image(); } When I run this, it shows resize_image() as undefined. Here's the error: Fatal error: Call to undefined function resize_image() in /home/vacayge/public_html/Major/Alpha1/classes/cUserImages.php on line 2090

    Read the article

  • Actionscript: Switching back into previous function from event handler function

    - by J.Ded.
    I need to return to my original function after capturing an event (downloading something) with another function. The original function needs to return a value, which depends on the downloaded data. So, I'd like to pause original function for the time needed for the download and the eventhandler function to complete it's work, and resume it afterwards. The obvious way is to set a flag value (both the original function and the eventhandler are within the same class) and make the original function check it until the eventhandler function changes the flag. But that would be wasteful, and my AS is slow enough already:) [other parts of the application utilise some heavy graphics]. Is there another way? Like an event that gets captured "in the middle" of the function? Or some other form of flow control?

    Read the article

  • Caller property of JS for "foo = function()" style of coding

    - by arvind
    I want to use the property of "caller" for a function which is defined here It works fine for this style of function declaration function g() { alert(g.caller.name) // f } function f() { alert(f.caller.name) // undefined g() } f() JSfiddle for this But then my function declaration is something like g = function() { alert(g.caller.name) // expected f, getting undefined } f = function() { alert("calling f") alert(f.caller.name) // undefined g() } f() and I am getting undefined (basically not getting anything) JSfiddle for this Is there any way that I can use the caller property without having to rewrite my code? Also, I hope I have not made any mistakes in usage and function declaration since I am quite new to using JS.

    Read the article

  • R programming function without ()

    - by Mark Kennedy
    So, I Have the following very simple map.r file. I'm trying to have the user type "click" in interactive mode and then have the function . Since it's a function, the user has to type "click()" how can I make it so that they only have to the word (w/o parentheses), and then have that function do something with the img. So the user types: mydist("image.pnm") click //And then the function click does what it's supposed to mydist <- function(mapfile) { img <- read.pnm(mapfile) plot(img) } click <- function() { //Prompt user to click on img }

    Read the article

  • Call by Reference Function in C

    - by Chad
    Hello everyone, I would just like a push in the right direction here with my homework assignment. Here is the question: (1) Write a C function called input which returns void, this function prompts the user for input of two integers followed by a double precision value. This function reads these values from the keyboard and finds the product of the two integers entered. The function uses call by reference to communicate the values of the three values read and the product calculated back to the main program. The main program then prints the three values read and the product calculated. Provide test results for the input: 3 5 23.5. Do not use arrays or global variables in your program. And here is my code: #include <stdio.h> #include <stdlib.h> void input(int *day, int *month, double *k, double *pro); int main(void){ int i,j; double k, pro; input(&i, &j, &k, &pro); printf("%f\n", pro); return 0; } void input(int *i, int *j, double *k, double *pro){ int x,y; double z; double product; scanf("%d", &x); scanf("%d", &y); scanf("%f", &z); *pro += (x * y * z); } I can't figure out how to reference the variables with pointers really, it is just not working out for me. Any help would be great!

    Read the article

  • Laptop Function Key Dysfunctional

    - by Kanini
    My laptop has Windows Vista installed in it. Everytime, I switch on the computer, the function key seems to be enabled automatically. So, when I press i, 5 is displayed and so on and so forth. Now, I have checked and ensured that Function is key is not locked due to a faulty keyboard or coke spilling on it and suchlike. I am able to get out of it with the following key combination Fn + Ctrl + Ins (Num Lk) However, the next time I switch on my PC, the Function key is automatically enabled. Also, if my computer goes to sleep mode and comes back, it is enabled again. Anything that I can do to change this behaviour?

    Read the article

  • Excel VBA Function runtime error 1004: Application-defined or object-defined error

    - by music2myear
    I'm trying to learn functions for the purpose of simplifying and reusing code whenever necessary. I began by turning something I use pretty often into a function: Returning the integer value of the last non-blank row in a spreadsheet. Function FindLastDataLine(strColName As String) As Long FindLastDataLine = Range(strColName).Offset(Rows.Count - 1, 0).End(xlUp).Row End Function Sub PracticeMacro() intItemCount = FindLastDataLine("A:A") MsgBox ("There are " & intItemCount & " rows of data in column A.") End Sub When I run this I recieve the runtime error '1004' "Application-defined or object-defined error" which Help helpfully defines as "someone else's fault" to quote not quite verbatim. Where might I be going wrong?

    Read the article

  • I want to use blur function instead mouseup function

    - by yossi
    I have the Demo Table which I can click on the cell(td tag) and I can change the value on it.direct php DataBase. to do that I need to contain two tags.1 - span. 2 - input. like the below. <td class='Name'> <span id="spanName1" class="text" style="display: inline;"> Somevalue </span> <input type="text" value="Somevalue" class="edittd" id="inputName1" style="display: none; "> </td> to control on the data inside the cell I use in jquery .mouseup function. mouseup work but also make truble. I need to replace it with blur function but when I try to replace mouseup with blur the program thas not work becose, when I click on the cell I able to enter the input tag and I can change the value but I can't Successful to Leave the tag/field by clicking out side the table, which alow me to update the DataBase you can see that Demo with blur Here. what you advice me to do? $(".edittd").mouseup(function() { return false; }); //************* $(document).mouseup(function() { $('#span' + COLUME + ROW).show(); $('#input'+ COLUME + ROW ).hide(); VAL = $("#input" + COLUME + ROW).val(); $("#span" + COLUME + ROW).html(VAL); if(STATUS != VAL){ //******ajax code //dataString = $.trim(this.value); $.ajax({ type: "POST", dataType: 'html', url: "./public/php/ajax.php", data: 'COLUME='+COLUME+'&ROW='+ROW+'&VAL='+VAL, //{"dataString": dataString} cache: false, success: function(data) { $("#statuS").html(data); } }); //******end ajax $('#statuS').removeClass('statuSnoChange') .addClass('statuSChange'); $('#statuS').html('THERE IS CHANGE'); $('#tables').load('TableEdit2.php'); } else { //alert(DATASTRING+'status not true'); } });//End mouseup function I change it to: $(document).ready(function() { var COLUMES,COLUME,VALUE,VAL,ROWS,ROW,STATUS,DATASTRING; $('td').click(function() { COLUME = $(this).attr('class'); }); //**************** $('tr').click(function() { ROW = $(this).attr('id'); $('#display_Colume_Raw').html(COLUME+ROW); $('#span' + COLUME + ROW).hide(); $('#input'+ COLUME + ROW ).show(); STATUS = $("#input" + COLUME + ROW).val(); }); //******************** $(document).blur(function() { $('#span' + COLUME + ROW).show(); $('#input'+ COLUME + ROW ).hide(); VAL = $("#input" + COLUME + ROW).val(); $("#span" + COLUME + ROW).html(VAL); if(STATUS != VAL){ //******ajax code //dataString = $.trim(this.value); $.ajax({ type: "POST", dataType: 'html', url: "./public/php/ajax.php", data: 'COLUME='+COLUME+'&ROW='+ROW+'&VAL='+VAL, //{"dataString": dataString} cache: false, success: function(data) { $("#statuS").html(data); } }); //******end ajax $('#statuS').removeClass('statuSnoChange') .addClass('statuSChange'); $('#statuS').html('THERE IS CHANGE'); $('#tables').load('TableEdit2.php'); } else { //alert(DATASTRING+'status not true'); } });//End mouseup function $('#save').click (function(){ var input1,input2,input3,input4=""; input1 = $('#input1').attr('value'); input2 = $('#input2').attr('value'); input3 = $('#input3').attr('value'); input4 = $('#input4').attr('value'); $.ajax({ type: "POST", url: "./public/php/ajax.php", data: "input1="+ input1 +"&input2="+ input2 +"&input3="+ input3 +"&input4="+ input4, success: function(data){ $("#statuS").html(data); $('#tbl').hide(function(){$('div.success').fadeIn();}); $('#tables').load('TableEdit2.php'); } }); }); }); Thx

    Read the article

  • "Initializing" the pointer in the separate function in C

    - by pechenie
    I need to do a simple thing, which I used to do many times in Java, but I'm stuck in C (pure C, not C++). The situation looks like this: int *a; void initArray( int *arr ) { arr = malloc( sizeof( int ) * SIZE ); } int main() { initArray( a ); // a is NULL here! what to do?! return 0; } I have some "initializing" function, which SHOULD assign a given pointer to some allocated data (doesn't matter). How should I give a pointer to a function in order to this pointer will be modified, and then can be used further in the code (after that function call returns)? Thanx for help.

    Read the article

  • FORTRAN function returning an array causes a segfault (calling from C++)

    - by Dane Larsen
    Basically, here's my problem. I'm calling someone else's FORTRAN functions from my C++ code, and it's giving me headaches. Some code: function c_error_message() character(len = 255) :: c_error_message errmsg(1:9) = 'ERROR MSG' return end That's the FORTRAN function. My first question is: Is there anything in there that would cause a segfault? If not, then second: What does that return? A pointer? I'm trying to call it with the following C statement: char *e = c_error_message_(); That causes a segfault. c_error_message(); That too causes a segfault. I declared c_error_message_() earlier on with the following code: extern"C" { char* c_error_message_(); } Would declaring a function with a different return type than the actual return type cause a segfault? I'm at a loss. Thanks for any replies.

    Read the article

  • Set argument pointer to point to new memory inside a function (without returning it) IN C

    - by user321605
    Hello, Hopefully my title was descriptive enough to attract the right help. I want to write a function that will return 1 thing, and modify a provided pointer in another. My current function declaration is . . . char * afterURL replaceURLS(char * body) What I want to do is copy all of body's data into a new string, and set body to point to this new data. I then want afterURL to point to a location within the new string. My issue is getting the actual pointer that is passed in to this function to point to the new data. Thanks in advance! Rob

    Read the article

  • Make Your Mouse Pointers Left-hand Friendly

    - by Matthew Guay
    It’s a right-centric world, with everything from pencils to computer mice expecting you to be right-handed.  Here’s how you can train your mouse and cursors in Windows 7 and Vista to respect your left-handedness. Using your Left Hand the Right Way It’s easy to switch your mouse to left-handed mode.  Enter “mouse” in your Start menu search, and select the first entry. Check the “Switch primary and secondary buttons” box to make your mouse more left-hand friendly.  Now your primary select button is your right button, and the secondary button (commonly referred to as right-click) is the left button. But, it can still be awkward to select items on screen with your left hand using the default cursors.  MSDN has a free set of cursors designed for left-handed users, that can fix this problem for you.  These cursors are exactly like the default Aero cursors in Windows 7 and Vista, except they are reversed to make them better for left-handed use. The cursors are available in 3 sizes: normal, large, and extra large.  The normal ones are the same size as the default ones in Windows 7; feel free to choose the other sizes if you prefer them.  Click each link to download all 6 cursors for your size (link below). Click “I Agree” after selecting the cursors to accept the license agreement and download them. Once you have all 6 cursors downloaded, select the Pointers tab in the Mouse Properties dialog.  Click the cursor to change, and then click Browse to select the new cursor. Browse to the folder you downloaded your new cursors to, select the correct cursor, and click Open. Do this for each of the 6 cursors to be changed.  Strangely, the Busy cursor (the spinning blue orb) is a static cursor, so you may not wish to change it.  All the other ones look and act like their standard counterparts. Here’s the cursors to be changed, and their equivalents in the default cursors: Normal Select: aero_arrow_left.cur Help Select: aero_helpsel_left.cur Working in Background: aero_working_left.ani Busy: aero_busy_left.cur Handwriting: aero_pen_left.cur Link Select: aero_link_left.cur After changing all the cursors, click Save As… to save this mouse scheme so you can easily select it in the future.  Finally click Ok to close the Mouse Properties dialog and accept the changes. Now your pointers will be easier to use left-handed! Conclusion Whether you’re right-handed or left-handed, you can enjoy the Aero cursors in Windows 7 or Vista in the way that works best for you.  Unfortunately, many mice are still designed for right-handed people, but this trick will help you make the best out of your mouse. We included all of the 6 cursors for you in a zip file you can download Here. This will make it easier for you to get them all together without having to download them individually. Link Download Left-Handed Mouse Pointers from MSDN Similar Articles Productive Geek Tips Prevent Themes From Modifying Icons and Cursors in Windows 7How To Personalize Windows 7 StarterShow Two Time Zones in Your Outlook 2007 CalendarMake Mouse Navigation Faster in WindowsWhy Doesn’t Tab Work for Drop-down Controls in Firefox on OS X? TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Microsoft’s “How Do I ?” Videos Home Networks – How do they look like & the problems they cause Check Your IMAP Mail Offline In Thunderbird Follow Finder Finds You Twitter Users To Follow Combine MP3 Files Easily QuicklyCode Provides Cheatsheets & Other Programming Stuff

    Read the article

  • VBA Public Function to Excel

    - by Sugih
    Dear sir , I have create below function Option Explicit Public Function fyi(x As Double, f As String) As String Application.Volatile Dim data As Double Dim post(5) post(1) = "Ribu " post(2) = "Juta " post(3) = "Milyar " post(4) = "Trilyun " post(5) = "Ribu Trilyun " Dim part As String Dim text As String Dim cond As Boolean Dim i As Integer If (x < 0) Then fyi = " " Exit Function End If If (x = 0) Then fyi = "Nol" Exit Function End If If (x < 2000) Then cond = True End If text = " " If (x >= 1E+15) Then fyi = "Nilai Terlalu Besar" Exit Function End If For i = 4 To 1 Step -1 data = Int(x / (10 ^ (3 * i))) If (data 0) Then part = fyis(data, cond) text = text & part & post(i) End If x = x - data * (10 ^ (3 * i)) Next text = text & fyis(x, False) fyi = text & f End Function Function fyis(ByVal y As Double, ByVal conds As Boolean) As String Dim datas As Double Dim posts(2) posts(1) = "Puluh" posts(2) = "Ratus" Dim parts As String Dim texts As String 'Dim conds As Boolean Dim j As Integer Dim value(9) value(1) = "Se" value(2) = "Dua " value(3) = "Tiga " value(4) = "Empat " value(5) = "Lima " value(6) = "Enam " value(7) = "Tujuh " value(8) = "Delapan " value(9) = "Sembilan " texts = " " For j = 2 To 1 Step -1 datas = Int(y / 10 ^ j) If (datas 0) Then parts = value(datas) If (j = 1 And datas = 1) Then y = y - datas * 10 ^ j If (y = 1) Then posts(j) = "belas" Else value(y) = "Se" End If texts = texts & value(y) & posts(j) fyis = texts Exit Function Else texts = texts & parts & posts(j) End If End If y = y - datas * 10 ^ j Next If (conds = False) Then value(1) = "Satu " End If texts = texts & value(y) fyis = texts End Function but when I return to Excel and type '=fyi(500,"USD") it return to #name? please do me favor to inform me how to solve Rgds, Sugih

    Read the article

  • "Decompile" Javascript function? *ADVANCED*

    - by caesar2k
    [1] Ok, I don't even know how to call this, to be honest. So let me get some semi-pseudo code, to show what I'm trying to do. I'm using jquery to get an already existing script declared inside the page, inside a createDocument() element, from an AJAX call. GM_xmlhttprequest({ ... load:function(r){ var doc = document_from_string(r.responseText); script_content = $('body script:regex(html, local_xw_sig)', doc).html(); var scriptEl = document.createElement('script'); scriptEl.type = 'text/javascript'; scriptEl.innerHTML = script_content; // good till here (function(sc){ eval(sc.innerHTML); // not exactly like this, but you get the idea, errors alert('wont get here ' + local_xw_sig); // local_xw_sig is a global "var" inside the source })(scriptEl); } }); so far so good, the script indeed contains the source from the entire script block. Now, inside this "script_content", there are auto executing functions, like $(document).ready(function(){...}) that, everything I "eval" the innerHTML, it executes this code, halting my encapsulated script. like variables that doesn't exist, etc removing certain parts of the script using regex isn't really an option... what I really wanted is to "walk" inside the function. like do a (completely fictional): script = eval("function(){" + script_content + "};"); alert(script['local_xw_sig']); // a03ucc34095cw3495 is there any way to 'disassemble' the function, and be able to reach the "var"s inside of it? like this function: function hello(){ var message = "hello"; } alert(hello.message); // message = var inside the function is it possible at all? or I will have to hack my way using regex? ;P [2] also, is there any way I can access javascript inside a document created with "createDocument"?

    Read the article

  • How can I invoke a function in bash shell script

    - by sufery
    !/bin/bash one_func(){ echo 'abcd' } echo $(one_func) echo one_func the end I just wonder the distinction calling the function between $(one_function) and one_function in bash shell script. When I set the variable "PS1" in ~/.bashrc, I can't invoke the function by one_func e: export PS1="\n[\e[31m]\$(one_func)" it work export PS1="\n[\e[31m]one_func" it doesn't work

    Read the article

  • Function Pointer

    - by Shaista Naaz
    How is that function pointer better than if-else or switch case? Is it because function pointer helps callback functions and thus promotes asynchronous implementation?

    Read the article

  • Decayed multidimensional array return from function

    - by paul simmons
    related to http://stackoverflow.com/questions/2520535/gcc-multi-dim-array-or-double-pointer-for-warning-free-compile , is there a way to return so-called "decayed array pointer" from a function? in summary (suppose 2 dim array) returning int (*a)[5] format rather than int** format? as far as I see, when returned int** pointer is sent to another function waiting (int*)[] parameter, it is not working correctly.

    Read the article

  • Call c++ function pointer from c#

    - by Sam
    Is it possible to call a c(++) static function pointer like this typedef int (*MyCppFunc)(void* SomeObject); from c#? void CallFromCSharp(MyCppFunc funcptr, IntPtr param) { funcptr(param); } I need to be able to callback from c# into some old c++ classes. C++ is managed, but the classes are not ref classes (yet). So far I got no idea how to call a c++ function pointer from c#, is it possible?

    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

  • jQuery plugin, return value from function

    - by Marius
    Hello there, Markup: <input type="text" name="email" /> Code: $(':text').focusout(function(){ $(this).validate(function(){ $(this).attr('name'); }); }); Plugin: (function($){ $.fn.validate = function(type) { return this.each(function(type) { if (type == 'email') { matches = this.val().match('/.+@.+\..{2,7}/'); (matches != null) ? alert('valid') : alert('invalid'); } /*else if (type == 'name') { } else if (type == 'age') { } else if (type == 'text') { }*/ else { alert('total failure'); } }); }; })(jQuery); The problem is that when I execute the code above, it runs the plugin as if type was a string: "function(){ $(this).attr('name'); });" instead of executing it as a function. How do I solve this? Thank you for your time. Kind regards, Marius

    Read the article

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