return

unable to return to main() from a method reading standard input stream

I am basically trying to return from a method which reads user input from the standard input stream. Since the user has the option to quit the application, I am trying to figure out the best way to do this exit. Ideally I will be able to return from begin() and let main() finish, thus quiting the applicaiton. public static void main(Str...

How to name a method that has an out parameter?

Hi, What is the common preference to name a method that has an out parameter inside? Usually I use Get as a prefix to mention that the method returns a value (like GetMyBusiness). But what if there is an out parameter that will be set after the method call? Should the method name mention this and focus only the return value? thanks...

Should a servlet explicitly return at the end of doGet/doPost?

Is there any difference between explicitly returning at the end of doGet or doPost-methods, and just letting the method return "by itself"? public void doGet(HttpSerlvetRequest req, HttpServletResponse resp) { <my code here> return; } public void doGet(HttpSerlvetRequest req, HttpServletResponse resp) { <my code here> } ...

Returning a structure array using pointers

typedef struct unit_class_struct { char *name; } person; person * setName() { person * array; array = malloc (2 * sizeof(person)); array->name = strdup("Robert"); array++; array->name = strdup("Jose"); return array; } int main() { person *array; arra...

EXSLT func:return problems in xsl:for-each "loop" and func:function

My problem: I have a wealth of atom RSS feed files which have many different atom entries in them and a few overlapping entries between files. I need to find and return an entry based on a URL from any one of the RSS feeds. Technologies: This code is being run through PHP 5.2.10's XLSTProcessor extension, which uses XSLT 1, has support ...

How to return string from a char function

I want the function getCategory() to return "invalid" , instead of printing the word "invalid" (i.e instead of using printf ) when input to the function is invalid (i.e.when either height or weight are lower then zero). please help: #include<stdio.h> #include<conio.h> char getCategory(float height,float weight) { char invalid = '\0'; ...

How can I make the 'return character' for a text with several lines in an xml tag, which I parse then put in a UItableView?

I want to display in a UItableViewCell, text like line1 line2 I get it from an xml tag like line1 line2 I've tried a lot of things, like: <br/> (also &lt;br&gt;), \n which only displays "line1 \n line2", <![CDATA[<br >]]> which only displays "line1 <br> line2". Thanks for the help ...

calling an outside function in python

I am trying to return (execute) a function from another file in an if statement. I have read that the return statement will not work, I was hoping someone would know what statement would allow me to call an outside function. The function creates a sandbox but if one exists I want to pass the if statement. This is a small snippet of cod...

Return more than a single value from a WebService

I have to return a lot of values back to my windows application from my webService. But how would I return more than just a single string/int/boolean from my WebService to my Application. How would I return a collection, keyValuePair, or even better, a DataSet? Or is this just imposible? thank you :) ...

PHP function to return a reference a variable

I'm trying to write a function that will return a reference to a PDO object. The reason for wanting a reference is if, for some reason, the PDO object gets called twice in one page load, it will just return the same object rather than initializing a new one. This isn't silly, is it? :/ function &getPDO() { var $pdo; if (!$pdo) ...

java return statement

Hi, I have a question about the following code private void printTree(Node node){ if(node==null) return; printTree(node.left); System.out.print(node.data+" "); printTree(node.right); } I don't really get the point of 'return;' statement there. It looks like if node is null, code returns nothing. but then without that ...

Simple question about return statement in Java

I took this from an online MIT courseware discussion (pdf warning): public class Human { private String name; ... public Human(String name) { this.name = name; } public String getName() { return String; } } public class Student extends Human { private String username; public Student(String name, String username) { ...

Jquery: wait for callback before returning

Hello, I have a javascript function which asks for some ajax data and gets back a JSON object. Then it should return the object. The problem is that I don't know how to make the function return from the Ajax callback. Of course myFunction: function() { $.get(myUrl, function(data) { return data; }); } does not work, be...

getting a program to return immediately at the command line so it's not tied to the shell that launched it

Hi everyone, Some programs return immediately when launched from the command line, Firefox for example. Most utilities (and all the programs I've written) are tied to the shell that created them. If you control-c the command line, the program's dead. What do you have to add to a program or a shell script to get the return-immediately b...

Running external subprocesses and reading return code

I'm creating a python script to sort a lot of images (game screenshots). I found a way to do that in imagemagick : I know that, if a specific square of the image is the same as the reference crop, then the image is of category one. If not, I check for another crop and another category, and if that doesn't fit either, I put the image in ...

PHP | Remove element from array with reordering?

Hey Folks, how can I remove an element of an array, and reorder afterwards? <?php $c = array( 0=>12,1=>32 ); unset($c[0]); // will return sth. like array( 1=>32 ); ?> How can I do a "rearrange" like pointing the 1 to 0 after delete (automatically)? Thanks! ...

How to return an array from jQuery ajax success function properly?

Hi, I have this code: TheObject = { getArray: function(){ var groups = new Array; $.ajax({ type: "POST", url: "link.php", success: function (data){ var counter = 0; $('g',data).each(function(){ var group_name = $(...

C: Returning a void versus returning a double * from a subfunction

I'm working on trying to speed up some general data processing in C. I've written several subroutines of the form: double *do_something(double *arr_in, ...) { double *arr_out; arr_out = malloc(...) for (...) { do the something on arr_in and put into arr_out } return arr_out; } I like this style because it's eas...

How to redirect user to the page they were just at without them noticing?

The website viewer would be at page A, click a link that sends then to page B, but I want them to return to page A without them noticing. When they click the link it changes the layout the viewer is browsing the site with, so the redirection code shouldn't erase or undo the cookies or whatever are stored with the link click. Thanks! E...

iPhone NSURLConnection: connectionDidFinishLoading - how to return a string to the calling method.

Hi Guys, Could you please help me? I have reviewed similar stackoverflow questions/answers to this but I am still stumped. I'm a beginner and I'm really struggling with this. With the iPhone, I can download XML from a URL but I cannot store the result string in a NSString variable and see it from the calling function. I have the follo...