Search Results

Search found 23968 results on 959 pages for 'tail call'.

Page 107/959 | < Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >

  • Javascript: can I call a function in an external file from the main page ?

    - by Patrick
    hi, I'm loading from my main page an external js file, with a function. I have a flash file in the main page invoking the javascript function. Everything worked very well until when the javascript code was in the main file, but when I moved javascript to an external file the function seems not called anymore. So... there is no way to move the javascript code to an external file ? Or any other solution ? thanks

    Read the article

  • In PHP can I check a boolean on a function call?

    - by Chris
    I have a function which checks the passed value and returns false or true, if false I want it to add something to an array. The code I've written is below. if(!check_input($_POST['username'])){ $errors[] = "Username"; } Right now it adds to my array anyway, regardless of what is entered in the form. Is the way I've written that the correct way to check if the return from check_input() is false? I've checked the function's logic by altering the returns to echoes and it's returning the correct value, I'm just not sure if I'm checking it wrong. I'd previously attempted to write it as $X=check_input etc, and then if(check_value == false) but that doesn't seem to give me the desired result either. Hmmm a quick pointer please!

    Read the article

  • Why would one write global code inside a function definition-call pair?

    - by ssg
    I see examples where JavaScript code including jQuery and jslint use the notation below: (function(){ // do something })(); instead of: // do something I first thought this is just for local scoping, i.e. creating local variables for the code block without polluting global namespace. But I've seen instances without any local variables at all too. What am I missing here?

    Read the article

  • Call a non member function on an instance before is constructed.

    - by Tom
    Hi everyone. I'm writing a class, and this doubt came up. Is this undef. behaviour? On the other hand, I'm not sure its recommended, or if its a good practice. Is it one if I ensure no exceptions to be thrown in the init function? //c.h class C{ float vx,vy; friend void init(C& c); public: C(); }; //c.cpp C::C() { init(*this); } void init(C& c) //throws() to ensure no exceptions ? { c.vx = 0; c.vy = 0; } Thanks in advance

    Read the article

  • Call a non member funcion on an instance before is constructed.

    - by Tom
    Hi everyone. I'm writing a class, and this doubt came up. Is this undef. behaviour? On the other hand, I'm not sure its recommended, or if its a good practice. Is it one if I ensure no exceptions to be thrown in the init function? //c.h class C{ float vx,vy; friend void init(C& c); public: C(); ~C(); }; //c.cpp C::C() { init(*this); } void init(C& c) //throws() to ensure no exceptions ? { c.vx = 0; c.vy = 0; } Thanks in advance

    Read the article

  • how do i call methods from another class in android?

    - by Phani Gargey
    I have two classes in question. Both extend Activity. Class A public void displayinfo() { setContentView(R.layout.dynamicinfo); //Add some buttons dynamically here //do some processing // move on to Class B } In Class B: I want to go back to Class A state in UI if BACK button is pressed. Class B //Register a listener for this button Backbutton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { Log.i("setOnClickListener", "Pressed Back Button "); Toast.makeText(mycontext, "Pressed Back Button", Toast.LENGTH_SHORT).show(); //HERE I want to go back class's function in UI as well as restoring the sttae for that screen. } how do I do that? I looked around some questions. they did not answer clearly what I am looking for.hence the posting. thanks.I think I was adding my own Back button on the Layout I created in the Class B's UI Screen --not using the regular "Back" button on the key board. May be that was the problem.

    Read the article

  • How to call AJAX API function from Windows App?

    - by stiopa
    Some company is providing me with web-based API for using their services. I have no problem calling this API functions from within web brower: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://someaddress.com?&key=somekey"></script> <script type="text/javascript"> var object = new SomeObject(); object.SomeFunction(); </script> </head> I am interested in return value of SomeFunction(). How would I get this return value from windows application?

    Read the article

  • Why does this MSDN example for Func<> delegate have a superfluous Select() call?

    - by Dan
    The MSDN gives this code example in the article on the Func Generic Delegate: Func<String, int, bool> predicate = ( str, index) => str.Length == index; String[] words = { "orange", "apple", "Article", "elephant", "star", "and" }; IEnumerable<String> aWords = words.Where(predicate).Select(str => str); foreach (String word in aWords) Console.WriteLine(word); I understand what all this is doing. What I don't understand is the Select(str => str) bit. Surely that's not needed? If you leave it out and just have IEnumerable<String> aWords = words.Where(predicate); then you still get an IEnumerable back that contains the same results, and the code prints the same thing. Am I missing something, or is the example misleading?

    Read the article

  • How can I call a Perl package I define in the same file?

    - by Robert S. Barnes
    I need to define some modules and use them all in the same file. No, I can't change the requirement. I would like to do something like the following: { package FooObj; sub new { ... } sub add_data { ... } } { package BarObj; use FooObj; sub new { ... # BarObj "has a" FooObj my $self = ( myFoo => FooObj->new() ); ... } sub some_method { ... } } my $bar = BarObj->new(); However, this results in the message: Can't locate FooObj.pm in @INC ... BEGIN failed... How do I get this to work?

    Read the article

  • Why does the onclick function run on onclick, but not when I call it manually?

    - by Codemonkey
    This is my code // Register onclick var old_onclick = link.onclick; link.onclick = function() { astr_track_action(param); if(typeof(old_onclick) == "function") old_onclick(); } And this is the html <a onclick="alert('hello!');" href="http://www.google.com?acme=link&foo=bar">To google!</a> When I click the link, the alert pops up. But when I override the onclick with my JS code, the alert does not pop up. Any ideas? Edit: I just want to add, I have debugged and confirmed that old_onclick() is run, but no alert message shows up. Edit: Here is the full code from the loop start. I don't see how it's relevant, but it was requested: for(var i = 0; i < document.links.length; i++) { var link = document.links[i]; var eventlink = link.href.split("acme="); if(eventlink.length > 1) { var param = eventlink[1].split("&")[0]; var newlink = link.href; // Register onclick var old_onclick = link.onclick; link.onclick = function() { astr_track_action(param); if(typeof(old_onclick) == "function") old_onclick(); }

    Read the article

  • why can't I call methods on a for-yield expression?

    - by 1984isnotamanual
    Say I have some scala code like this: // outputs 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 println( squares ) def squares = { val s = for ( count <- 1 to 10 ) yield { count * count } s.mkString(", "); } Why do I have to use the temporary val s? I tried this: def squares = for ( count <- 1 to 10 ) yield { count * count }.mkString(", ") That fails to compile with this error message: error: value mkString is not a member of Int def squares = for ( count <- 1 to 10 ) yield { count * count }.mkString(", ") Shouldn't mkString be called on the collection returned by the for loop?

    Read the article

  • Can we call methods of non-static classes without an object in Java?

    - by ask
    In Java, the wrapper class Integer has the static method parseInt() which is used like this: Integer.parseInt(). I thought only methods of static classes could be called like this (ie. Class.doMethod()). All non-static classes need objects to be instantiated to use their methods. I checked the API, and apparently Integer is declared as public final Integer - not static. Someone please help me understand this.

    Read the article

  • Why can't i call Contains method from my array?

    - by xbnevan
    Arrrg!I am running into what i feel is a dumb issue with a simple script i'm writing in powershell. I am invoking a sql command that is calling a stored proc, with the results i put it a array. The results look something like this: Status ProcessStartTime ProcessEndTime ------ ---------------- -------------- Expired May 22 2010 8:31PM May 22 2010 8:32PM What i'm trying to do is if($s.Contains("Expired")) , report failed. Simple...? :( Problem i'm running into is it looks like Contains method is not being loaded as i get an error like this: Method invocation failed because [System.Object[]] doesn't contain a method named 'Contains'. At line:1 char:12 + $s.Contains <<<< ("Expired") + CategoryInfo : InvalidOperation: (Contains:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound So, what can i do to stop powershell from unrolling it to string? Actual ps script below - $s = @(Invoke-Sqlcmd -Query "USE DB GO exec Monitor_TEST_ps 'EXPORT_RUN',NULL,20 " ` -ServerInstance "testdb002\testdb_002") if ($s.Contains("Expired")) { Write-Host "Expired found, FAIL." } else { Write-Host "Not found, OK." }

    Read the article

  • Can func get the lineno who call itself? (C/C++)

    - by kingkai
    Hi, I've a problem , as the following code discribe itself. 1 #include<stdlib.h> 2 #include<stdio.h> 3 void log() 4 { 5 printf("Log [Line:%d]\n",__LINE__); 6 } 7 int main() 8 { 9 log(); 10 log(); 11 } The expected result is Log [Line:9] Log [Line:10] But, the fact is Log [Line:5] Log [Line:5] No surprising, LINE has been substituted at the pre-process stage as 5. My Question is, how to design the log function to get the expected result? Thanks!

    Read the article

  • How can I call a method given only its name?

    - by mfolnovich
    I'm trying to have method void run( string method ) which would run method in that class. For example: class Foo { public: void run( string method ) { // this method calls method *method* from this class } void bar() { printf( "Function bar\n" ); } void foo2() { printf( "Function foo2\n" ); } } Foo foo; int main( void ) { foo.run( "bar" ); foo.run( "foo2" ); } this would print: Function bar Function foo2 Thanks! :)

    Read the article

  • Need to call Silverlight Handler event and then serverside event on Page submit.

    - by Shivkant
    I have a Silverlight control on page which has a upload control. the silverlight exposes some events such as StartUpload() = To start the file upload, StopUpload() = To stop the file upload if running, CheckFileStatus() = to check the status of the file upload. The page has aspx Submit button with onclientclick event and ocClick event. <asp:Button ID="btn_upload" Text="External Upload" runat="server" OnClientClick="Javascript:StartUpload();" OnClick="btn_upload_Click" /> When I click on the aspx Submit Button, the file selected in Silverlight control should be uploaded and after the completion of upload, the Server side event should get called. I tried for it but was not able to do so. Please help me out!....

    Read the article

  • cant get ajax response (JSON) to call 'success' function?

    - by Haroldo
    for some reason the success function isnt being called? javscript: $.ajax({ type: 'POST', url: 'http://localhost/hf_latest_desktop/st_pages/user_area/acc_buttons/pass_change/pass_change_ajax.php', data: data, dataType: 'json', success: function(e){ console.log(e); if(e.status == 'success'){ alert('your password has been changed!'); } if(e.status == 'error1'){ alert('please fill in all inputs!'); } if(e.status == 'error2'){ alert('password incorrect!'); } if(e.status == 'error3'){ alert('change failed!'); } } }); php file ajax is calling to: <?php session_start(); session_cache_limiter('nocache'); header('Expires: ' . gmdate('r', 0)); header('Content-type: application/json'); $status = 'error1'; //for sake of example ?> {'status':'<?php echo $status; ?>'}

    Read the article

  • C++ & C#, how to create wrapper dll in C++ for C# to call instance function in C++ dll?

    - by 5YrsLaterDBA
    Received an unmanaged C++ dll with instance functions which need to be called from my C#. need to write a wrapper C++ dll to bridge the C# and original C++ dll as suggested by experts here. it is new to me and want to learn from you. Header file of the original C++ dll likes this: class EXPORT_MACRO NB_DPSM { private: string sFileNameToAnalyze ; public: NB_DPSM(void); ~NB_DPSM(void); void setFileNameToAnalyze(string FileNameToAnalyze) ; int WriteGenbenchData(string& message) ; }; Start from a Class Library project template or CLR Empty Project template? What's the wrapper code should look like? Anywhere has step by step example for this? thanks,

    Read the article

  • Is it faster to compute values in a query, call a Scalar Function (decimal(28,2) datatype) 4 times,

    - by Pulsehead
    I have a handful of queries I need to write in SQL Server 2005. Each Query will be calculating 4 unit cost values based on a handful of (up to 11) fields. Any time I want 1 of these 4 unit cost values, I'll want all 4. Which is quicker? Computing in the SQL Query ((a+b+c+d+e+f+g+h+i)/(j+k)), calling ComputeScalarUnitCost(datapoint.ID) 4 times, or joining to ComputeUnitCostTable(datapoint.ID) one time?

    Read the article

  • Recursive MySQL function call eats up too much memory and dies.

    - by kylex
    I have the following recursive function which works... up until a point. Then the script asks for more memory once the queries exceed about 100, and when I add more memory, the script typically just dies (I end up with a white screen on my browser). public function returnPArray($parent=0,$depth=0,$orderBy = 'showOrder ASC'){ $query = mysql_query("SELECT *, UNIX_TIMESTAMP(lastDate) AS whenTime FROM these_pages WHERE parent = '".$parent."' AND deleted = 'N' ORDER BY ".$orderBy.""); $rows = mysql_num_rows($query); while($row = mysql_fetch_assoc($query)){ // This uses my class and places the content in an array. MyClass::$_navArray[] = array( 'id' => $row['id'], 'parent' => $row['parent'] ); MyClass::returnPArray($row['id'],($depth+1)); } $i++; } Can anyone help me make this query less resource intensive?

    Read the article

< Previous Page | 103 104 105 106 107 108 109 110 111 112 113 114  | Next Page >