return

PHP Object return value

Hi, Currently I'm programming a database class which makes a little bit use of PHP's PDO class, but I'd like to add some simple features for making programming a certain application a bit easier. Now In the following piece of pseudo code you can see where I'm going. The only problem in this example is that the $result variable is an ob...

Is there a right way to return a new object instance by reference in C++?

So I was writing some code, and I had something like this: class Box { private: float x, y, w, h; public: //... Rectangle & GetRect( void ) const { return Rectangle( x, y, w, h ); } }; Then later in some code: Rectangle rect = theBox.GetRect(); Which worked in my debug build, but in release ther...

Syntax Question: "Exit Sub" or "Return" in VB.Net Sub Routines

Both seem to accomplish the same thing--exit a subroutine. Is there any difference in how they work under the covers? I.e. Private Sub exitNow() Exit Sub End Sub or Private Sub exitNow() Return End Sub ...

Changing return type of a function without template specialization. C++

I was wondering if it is possible to change the return type of a function based on the type of variable it is being assigned to. Here's a quick example of what I mean. I want to create a function that parses a variable of int, bool, or float from a string. For example... Int value = parse("37"); Float value = parse("3.14"); Bool value ...

C# child class returning a unknown type (futher: from parent)

i have interface: public interface Inx<T> { T Set(Data data); } simple class with this metod public class Base { ??? Set(Data data) { ... } } and parent class like that: public class Parent : Base, Inx<Parent> { ... } i want to return Parent type from Set metod in child class It's possible ? I need it do to something li...

How do I return multiple generic Lists in one Web Call ?

Ok, I poked around before posting and can't seem to find anything... so here we go. I decided that returning datasets, working with datasets and datatables in a front end app is a rather bad idea. So with the magic of generics I am returning a generic list via Webservice call ( not WCF just plain ol' asmx ) . That works dandy as long as...

Implicit return values in Ruby

I am somewhat new to Ruby and although I find it to be a very intuitive language I am having some difficulty understanding how implicit return values behave. I am working on a small program to grep Tomcat logs and generate pipe-delimited CSV files from the pertinent data. Here is a simplified example that I'm using to generate the line...

Returning inside for loop inside lambda crashes in Ruby 1.8

In Ruby 1.8 (my version is 1.8.7-72), this code: foo = lambda do for j in 1..2 return end end foo.call crashes with a LocalJumpError: test2.rb:3: unexpected return (LocalJumpError) from test2.rb:2:in `each' from test2.rb:2 from test2.rb:6:in `call' from test2.rb:6 Why does it do this? However, it seems to ru...

php - function return values dynamically

I want to return a set of values from function till the point they exist.... for example.... function abc($i="3"){ for($a=1;$a<=$i;$a++) { $name='t'.$i; $$name = "ae".$a; } //now i am returning values return array($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10); //but i only want to return $t1,$t2,$t3 dep...

How does one return data to the original caller function in Javascript?

I have a problem returning data back to the function I want it returned to. Code below: function ioServer(request_data, callback) { $.ajax({ cache: false, data: "request=" + request_data, dataType: "json", error: function(XMLHttpRequest, textStatus, errorThrown){}, success: function(response_d...

Why does the compiler assume that malloc returns an int?

I'm aware that in C it's best practice to never cast the return value of malloc(). I've read that the compiler assumes that malloc() returns an int if you don't include stdlib.h. Of course it would produce an error if you tried to implicitly assign an int to something that's not an int, but that error could be covered up by an explicit c...

PHP Class won't return to a String

Hi, I'm fairly new to PHP so I have a small problem as I'm learning: I built a Class called DataStrip.php <?php final class DataStrip { public function DataStrip() { // constructor } public function stripVars($vars) { return $vars; } } ?> and then I'm trying to pass the public function stripVars a value: <?php inc...

Any function on the framework with return type overloading?

Had the idea I'd seen at least one. ...

What's the Best Way to Catch the Return Key in a PasswordBox? (WPF/XAML)

What's the best way to catch the return key in a PasswordBox? (WPF/XAML) I have a TextBox field and a PasswordBox field on my login form (for username and password entry). I also have a login button which invokes the method that performs the login validation process. I need to make the Return key react the same way in the PasswordB...

Why default return value of main is 0 and not EXIT_SUCCESS ?

Hello, the iso 1998 c++ standard specifies that not explicitly using a return statement in the main is equivalent to use "return 0". But what if an implementation has a different standard "no error" code, for example "-1" ? Why not use the standard macro "EXIT_SUCCESS" that would be replaced either by "0" or "-1" or any other value de...

adding return true to jquery cycle's next/previous buttons.

The jQuery code used: $('#contentspacer').cycle({fx:'fade',speed:2500,timeout:6000,next:'.next',prev:'.prev'}); $('.pause').click(function() {$('#contentspacer').cycle('pause'); return false;}); $('.play').click(function() {$('#contentspacer').cycle('resume'); return false;}); The html used for the "navigation": <div class="pnbtns"><...

WPF ShowDialog returns null immediatly on second call ...

I think this is a bug in the WPF framework, with out going into depths of my program and why I am doing what I am doing, I wrote a simple test app to prove my theory. Can someone confirm this issue, and suggest possible work arounds for a series of dialogs to be executed before putting the app into its run loop? using System; using Sys...

Returning false in Javascript/Jquery within an if statement...

Hi guys, I've got this function to check my form: function checkFrm() { $.each($('select'), function() { var $this = $(this); if( $this.val() === 'null') { // do nothing } else { if($this.next('input').val().length < 1) { return false; } } }); } When the user submits this, it runs...

Test For Password Protected Folder

How do I use PHP to check whether a folder is password protected or not? I am using a PHP script that check for return codes 401 and 403 but when it runs into a folder that is password protected it recognizes that its a 403 but does not allow the popup box for username and password to display? How do I detect that the folder is password ...

AS3 driving me nuts......

Ok here is what I am currently trying to do. I have a class called vdata.as which takes 2 paramaters both are strings sent from the main stage. Parameter one is the location for an XML file that I need to open and read. The second parameter is the name of the video I am currently looking for. Now I can get the data from the XML file and...