return-value

Grab result set and return value both from stored procedure in Linq to Sql

CREATE Procedure dbo.Ssample AS Select 1 as One , 2 as Two ,'3' as Three RETURN 2 --T-SQL way to execute declare @a int exec @a = dbo.Ssample select @a How can I retrieve the return value and the result set both in linq to sql. I would appreciate if anyone can give me the dbml markup as my designer file always get auto gener...

Linq to SQL question: How to retrieve return value and resultset from Stored Proc

Folks, I have a stored proc as following: create procedure p1 as begin declare @n1 int select @n1=count(*) from Employee select top 100 * from Employee return @n1 end I want to capture @n1 as well as the Employee resultset using Linq To SQL in my C# code. I would appreciate any...

hibernate query.list() method is returning empty list instead of null value

When there are no rows, both query.list() and criteria.list() are returning empty list instead of a null value. What is the reason behind this? ...

When to return values in PHP?

Hello there! Given this ugly method: public function convert_cell_value( $val, $type ) { if($type == 'String') { return $val; } elseif($type == 'Number') { if($val - intval($val) > 0) { return $val; } else { return intval($val); } } ...

if [ $? -ne 0 ] then syntax error then unexpected

Hi all, I have been trying to execute the following unix shell script which is not working. I am running it by ksh. echo $?; if [ $? -ne 0 ] then failed $LINENO-2 $5 $6 fi failed() { echo "$0 failed at line number $1"; echo "moving $2 to failed folder" } This is giving an error saying "Synatx error:then unexpected". Basicall...

Easy one: Can I use a ternary in a PHP class method return statement?

Can I do this? (I can't test it at the moment to see for myself) public function overSimplifiedTernaryTest($condition = false) { return ($condition) ? 'someString' : 'someOtherString'; } ...

Using annotation to ensure that value returned by method is not discarded

String in Java is immutable. The following snippet is, broadly speaking, "wrong". String s = "hello world!"; s.toUpperCase(); // "wrong"!! System.out.println(s); // still "hello world!"!!! Despite this being "wrong", the code compiles and runs, perhaps to the confusion of many beginners, who must either be told what the mistake is, ...

basic JS question: replacing text alert to image alert

I'd really use your help! Js is not really my thing.. I'm making validation form script in my page and browsing through examples scripts iI run into this: ['required', 'This is a required field.', function(v) { return !Validation.get('IsEmpty').test(v); }], I need to put image instead of 'This is a required field.' Is it the ri...

When a third-party C function returns a pointer, should you free it yourself?

There are many functions (especially in the POSIX library) that return pointers to almost-necessarily freshly allocated data. Their manpages don't say if you should free them, or if there's some obscure mechanism at play (like returning a pointer to a static buffer, or something along these lines). For instance, the inet_ntoa function r...

calling Json data returns undefined "

When I call json object from php file it returns undefined. I can see all data writing alert(data) but when I write alert(data.books) it returns undifined. $JSON = ' { "books": { "book1": "firstbook", "book2": "secondbook" } } '; and I call it with jquery jQuery('#login').live('submit',function(event) { $.ajax({ u...

Getting the return value of a method via DTE.Debugger without evaluating the method?

I'm looking for a way to get the return value of a method via the Visual Studio Debugger (using DTE). Is it possible to obtain it if I'm at the closing brace of the method, but not yet exited? Also, it would be best if this could be possible without evaluating the function again via the immediate window. ...

Linking problems template with return

I'm having some problems on returning the parameter of a method as a template, look: // CTestClass.h template<class T> class CTestClass { public: T getNewValue(); }; // CTestClass.cpp template<class T> T CTestClass<T>::getNewValue() { return 10; // just for tests I'm returning hard coded 10 } // main.cpp int _tmain(int argc...

How to verify normal termination of R scripts executed from Perl?

I have written a shebang R script and would like to execute it from a Perl script. I currently use system ($my_r_script_path, $r_script_arg1, $r_script_arg2, ...) and my question is how can I verify the R script terminates normally (no errors or warnings). guess I should make my R script return some true value at the end, only if everyt...

How to display a return value on the browser?

I have the following inside a function something(): if ($cod == 1000) { $message = 'Some Message'; return $message; } Later, I call this function: try { $comandoController->someThing(); } I was expecting to see "Some Message" on the browser. But I don't. Note: If I echo something like echo "hello" inside the conditional, I ...

How to implement a getter-function (using callbacks)

I have to request data for a JS-script from a MySQL database (based upon a user-id). I did not find a simple solution for JavaScript and it was not possible to load the data using ajax, because the database is available under a different domain. I implemented a workaround using PHP and curl. Now the JS has to "wait" for the request...

How efficient is it to return very large data in F#?

Hello F# folks, Suppose we have a Matrix class in F# and you overload the (+) operator. Then, we will have something like this: type Matrix(n : int, m : int) = ... static member (+) (A : Matrix, B : Matrix) = let res = new Matrix(A.Dim1, A.Dim2) // suppose A and B have the same dimension ... // compute here th...

How to assign the result of the previous expression to a variable in R?

Suppose I'm using R's interactive console, and I've just done something like this: long_running_command() That long-running command returns a value, and I've just realized that I wanted to assign that value to a variable instead of discard it. So how can I get that value without running the command again? Is there a command like this?...

Return multiple objects from a method in Objective-C

I have a method that takes an NSMutableArray as a parameter, and I would like it to return that array, another array that is created in the method, and an int created by the method. I realize this could be done by making an array that had all these objects in it, and returning that, then removing them from the array outside the method, ...

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...

In the C language, what does "return ~0" mean?

Hi I'm dealing with some C code that includes return ~0; What does that mean? It's pretty much impossible to google for... ...