return

Iterating over returned data.

I've a method in a separate class from my main form that I've created that returns a List, and adds items to the List from the lines of a a file using something like this: public List<string> testMethod(string data); StreamReader read = new StreamReader(data); List<string> lines= new List<string>(); while(read.Peek >= 0) { lines.Add(r...

Accessing an array element when returning from a function

Some searching through Google (and my own experience) shows that in PHP you can't grab an array element when it's been returned from a function call on the same line. For example, you can't do: echo getArray()[0]; However, I've come across a neat little trick: echo ${!${false}=getArray()}[0]; It actually works. Problem is, I do...

PHP - Parse template variable with regex

Hello, I have to parse this template file ($html) : {$myFirstVariable} {$myMainVar:MYF1,"x\:x\,x",2:MYF2:MYF3,false} {$myLastVariable:trim} Following, my php parser : $regexp = '#{\$(?<name>.+?)(\:(?<modifiers>.+?))?}#'; preg_replace_callback($regexp, 'separateVariable', $html); function separateVariable($matches) { $varname = ...

How do you return to a sourced bash script?

Hi, I use a script that extends using the bash source feature; #!/bin/bash source someneatscriptthatendsprematurely.sh I would like to be able to return from that script, without breaking the main script. Using exit breaks the main script, return is only valid in functions and experimenting with $(exit 1) does not seem to work eith...

Returning an inclusion tag

Hi, I am suffering whereever i try to do something in django that is not common(in django, not in python in general) For example, i don't know how to return an inclusion tag. This. obviously, won't work: @register.inclusion_tag('template.tpl') def myinclusiontag(parameter): return {'var': parameter.attr1} @register.inclusion_tag(...

What type does fwrite() returns?

On the php manual we can read: fwrite() returns the number of bytes written Ok... but what kind of thing is "number of bytes written"? Binary string? Binary number? Stream? Int? I'm a little bit lost here. Regards ...

Confused about return statement in user defined function

hi there, i have few question regarding the return statement. a) is it compulsory to define a return statement in a user defined function.? b) is it still valid if i just define a return statement without any parameter? will it return the null value? c) is the following function valid? function admin_credential($password = 0, $email...

Javascript return false in if statements

Hey all, Is it good practice to use "return false;" to basically say do nothing in an if statement? For example: if (navigator.userAgent.match(/iPad/i) != null) { return false; } else { //Usual script here } just wondering if there are any downfalls to this. I can use the if statement without the else but i'm just wanting to ...

Does Python have a method that returns all the attributes in a module?

I already search for it on Google but I didn't have lucky. ...

return output with php oop mysqli

Hello all i try to select stuff from the database and when i will return it so i can echo stuff out like $instance->titel $instance->content and like that, hope you understand, now i only got the id "1" echo out. here is my code <?php /** * Simon testClass */ class testClass { public $mysqli; public function __construct(...

PHP function does not return a value

I have a recursive function that returns a value. public function getparent ($user) { $referrer=''; $pos=0;$this->setFieldNames(); $result=mysql_query("select * FROM ". $this->dbtablename ." WHERE ".$this->id_field . " = '$user'", $this->dbConnectionID); while($row=mysql_fetch_array($result, MYSQL_ASSOC)...

Removing new line function when enter button is pressed Java

Hi I have a text area that I would like to become blank when the enter button is pressed. I know this would normally be done with a setText method. However when I do this, the text is removed but the new line function created by the return key being pressed. My question is, is the anyway of stopping this default action from happening? ...

Is it possible to break/return method execution from another method?

I have something like this: void MethodToBreak() { // do something if(something) { MethodThatBreaks(); return; } // do something } void MethodThatBreaks() { // do something } So, I was wondering: is it possible to break execution from: MethodThatBreaks()? Then, I would have: if(something) Met...

Why can I not return responseText from an Ajax function?

Here is part of my Ajax function. For some reason that I cannot figure out, I am able to alert() responseText but not able to return responseText. Can anybody help? I need that value to be used in another function. http.onreadystatechange = function(){ if( http.readyState == 4 && http.status == 200 ){ return http.responseTe...

How to get COUNT from stored procedure return?

I have a stored procedure in SQL which I can't change. It needs few input parameters and returns a table with 100+ rows and several columns. exec dbo.Select_Data 0, 0, 18, 50 I need something to get count of returned rows: select count(*) from (exec dbo.Select_Data 0, 0, 18, 50) and a way to get values from e.g. Name column:...

Powershell error returning hashtable

Anyone have any ideas why the following code would produce an error, see additional comments after the function for more details function callee ([Hashtable]$arg0) { [Hashtable]$hashtable = @{} $hashtable = $arg0 $hashtable.add('passed', $True) # $hashtable ######## toggle this line $typ...

How to change implementation of returned object base class's function when object is returned C++

I have an existing application in C++ with a custom ArrayBase class that manages storage and access to a contiguously allocated region of memory. I have a separate ItrBase class that is used to access data in that ArrayBase. ArrayBase has a createItr() function that currently returns an ItrBase object. I need to extend ArrayBase to us...

How to return array in C++?

Why does the following code not work? It compiles fine but output is something like an address if I write f using * and the output is 0 if I write f without *. #include <iostream> #include<cstring> using namespace std; using std::size_t; int *f(size_t s){ int *ret=new int[s]; for (size_t a=0;a<s;a++) ret[a]=a; ...

Return a value from an ajax call to parent function

I have a function where I need to return a url that I am getting via an ajax call. var heatmap = new google.maps.ImageMapType({ getTileUrl: function(coord, zoom) { var tileURL; $.get('getimage.php', { zoom: zoom, x: coord.x, y: coord.y }, function(data) { if(data.status) { tileURL=data.image; } },...

What is meaning of boolean value returned from an event-handling method in Android

In android, most event listener methods return a boolean value. What is that true/false value mean ? what will it result in to the subsequence events ? class MyTouchListener implements OnTouchListener { @Override public boolean onTouch(View v, MotionEvent event) { logView.showEvent(event); return true; } } ...