return

Is it bad practice to use return inside a void method?

Imagine the following code: void DoThis() { if (!isValid) return; DoThat(); } void DoThat() { Console.WriteLine("DoThat()"); } Is it OK to use a return inside a void method? Does it have any performance penalty? Or it would be better to write a code like this: void DoThis() { if (isValid) { DoThat(); ...

vbs to get data from api call

Hi there, Here's an issue on retrieving returned api call data. I found that Request.Form("param2") not working. Eg: inside .vbs script that run in a windows server, I do an api call to external script. Then the api script return a string data. Eg: param1=baby;param2=banana;param3=haha I found that inside .vbs, if I use request.form,...

How to pinpoint where a long function returns

Suppose there is a function with 1000 code of line named LongFunction, and we used it: bool bSuccess = LongFunction(); assert(bSuccess); Here I got an assert when debugging, and I know there is something wrong with LongFunction, so I need to find where the function meet problems and returns: I could probably debug it step by step, i...

Make a parent function return in ActionScript3? (or make addEventListener return)

Basically I've got a code which should load a lot of images so I need a function to load them. The problem is that addEventListener requires a function which it will call when the event have been raised. I need to find a way to either make the loadImage function return ONLY after the event was raised or make the function raised in addE...

vbscript return empty data

Hi there, I am using vbscript .vbs in windows scheduler. Sample code: objWinHttp.Open "POST", http://bla.com/blabla.asp, false objWinHttp.Send CallHTTP= objWinHttp.ResponseText strRESP= CallHTTP(strURL) WScript.Echo "after doInstallNewSite: " & strRESP Problem: blabla.asp is handling a task that need around 1-2 minute to complete...

How to return TRUE|FALSE from class in PHP

Hey there! I was wondering why my php program is not returning the correct TRUE FALSE value when the class is included elsewhere it goes something like this source: signup.php class signup { function buildProfile() { if($logic){ $this->success = TRUE; }else{ $this->success = FALSE; ...

mySQL query fails when read from file or web

This is driving me nuts! I have created a query. The query is written to Windows file for future connection to the remote database. Upon the connection using cURL, my local script uses cURL to send the query. I assemble variables using build_http_query. The cURL works just fine but the query fails. Every time. mySQL complains that qu...

can constructors actually return Strings?

Hi all, I have a class called ArionFileExtractor in a .java file of the same name. public class ArionFileExtractor { public String ArionFileExtractor (String fName, String startText, String endText) { String afExtract = ""; // Extract string from fName into afExtract in code I won't show here return afExtract; } Howeve...

PHP No return from a function in another file...

I have one file with a form, that includes another to process that form. The file with the form calls a function in the included file to write data to the database, and then I return an $insert_id from that post so I can reference it in the output. For example, when you fill out the form on the page, the data is sent to the db from a s...

How do I wrap this C function, with multiple arguments, with ctypes?

Hi everyone! I have the function prototype here: extern "C" void __stdcall__declspec(dllexport) ReturnPulse(double*,double*,double*,double*,double*); I need to write some python to access this function that is in a DLL. I have loaded the DLL, but each of the double* is actually pointing to a variable number of doubles (an array), and ...

How to return a value into webpage

Hello: I have a simple webpage that displays the credit balance for calling cards. So far without any problems, with HTML, PHP and mysql, I was able to retrieve the balance from a data base. But I have to display the result in ANOTHER PAGE, wich looks akward because the page must reload. Can I just load this value into a pre-drawed...

Change "return key" in an iPhone WebApp textbox

I am creating an iPhone webapp with a textbox and would like to change the return key to "search". When you click on the textbox, the keyboard pops up and the return key on the bottom right of the keyboard displays "return" by default. However if you go to google.com on your iPhone and click on the search textbox the return key on the ...

Linq to SQL: Multi-table join return type not generated by dbml

Hello, I'm trying to figure out the best way to handle a simple problem: I have a simple LINQ join to two tables. I know how to return the type for one table, since it is the same as the generated dbml class. However, what if I want to return data from both tables- isn't there a way to return both and use their relationships? Do I rea...

Why does explicit return make a difference in a Proc?

def foo f = Proc.new { return "return from foo from inside proc" } f.call # control leaves foo here return "return from foo" end def bar b = Proc.new { "return from bar from inside proc" } b.call # control leaves bar here return "return from bar" end puts foo # prints "return from foo from inside proc" puts bar # prints ...

Making a for X in Y loop return whatever is returned by the statements it contains

Hi all, The following statement... content_tag(:li, concept.title) ...returns something like: <li>"My big idea"</li> The following method definition, when called, returns the same: def list_of_concepts(part) content_tag(:li, concept.title) end As does... def list_of_concepts(part) content_tag(:li, part.concepts.first.title) ...

Returning pointer to a local structure

Is it safe to return the pointer to a local struct in C? I mean is doing this struct myStruct* GetStruct() { struct myStruct *str = (struct myStruct*)malloc(sizeof(struct myStruct)); //initialize struct members here return str; } safe? Thanks. ...

JS: Math.random for array

Learning JS this week. Is it possible to use Math.random to return a random value in an array? Does that value be a string and still work? ...

assembly return

a small portion of my code swi r6,r0,LCD_ CONT addi r10,r0,6 firstdelay: addi r10,r10,-1 bnei r10,firstdelay swi r0,r0,LCD_ CONT addi r10,r0,30 seconddelay: addi r10,r10,-1 bnei r10,seconddelay swi r5,r0,LCD_DATA i have to delay multiple times throughout the program but want to keep it small. id like to write ...

C++: Does return statement copy values

I am wondering about this because of scope issues. For example, consider the code typedef struct { int x1;/*top*/ int x2;/*bottom*/ int id; } subline_t; subline_t subline(int x1, int x2, int id) { subline_t t = { x1, x2, id }; return t; } int main(){ subline_t line = subline(0,0,0); //is line garbage or isn't...

Asp.Net MVC returning a Json from a string.

Funny as it can sound, I transformed my datatable data into a string which looks something like this: { blocks: [ {"fromAge" : "60","fromAmount" : "0","toAge" : "64","toAmount" : "65000","color" : "red","orderNo" : "2"}, {"fromAge" : "66","fromAmount" : "0","toAge" : "72","toAmount" : "12000","color" : "red","orderNo" : "4"}, {"fromA...