I'm using ASMX web services in VB.Net in VS 2005. I am calling a function method on the web service that returns a true or false value. This works fine if I call the the web method synchronously, but if I want to call the method asynchronously, the function returns to a sub and there is no return value; therefore, I can't tell whether ...
I've heard some voices saying that checking for a returned null value from methods is bad design. I would like to hear some reasons for this.
pseudocode:
variable x = object.method()
if (x is null) do something
...
I am always annoyed by this fact:
$ cat foo.py
def foo(flag):
if flag:
return (1,2)
else:
return None
first, second = foo(True)
first, second = foo(False)
$ python foo.py
Traceback (most recent call last):
File "foo.py", line 8, in <module>
first, second = foo(False)
TypeError: 'NoneType' object is not it...
I know its fine to call a method as if it was void even though it has a return value (like printf), but what about this?
[NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(method) userInfo:nil repeats:NO];
Can I just have that floating there without using the object it returns? That's like calling [NSObject all...
Is it possible to change this code, with a return value and an exception:
public Foo Bar(Bar b)
{
if(b.Success)
{
return b;
}
else
{
throw n.Exception;
}
}
to this, which throws separate exceptions for success and failure
public Foo Bar(Bar b)
{
throw b.Success ? new BarException(b) : new FooException...
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...
Let's say I have a function:
typedef std::vector<int> VecType;
VecType randomVector();
int processing()
{
VecType v = randomVector();
return std::accumulate(v.begin(), v.end(), 0);
}
Does C++0x specifically say the spurious copy will be averted from the return value of randomVector? Or would a compiler need to implement the R...
So I have a class foo that has a method which returns an array bar. I have another function that calls foo.getBar and then filters the array. I want to be able to always get the original contents of bar when I use a different filter, but bing seems to be just creating a reference to bar, not a separate array. I have tried using return th...
Is there any way to do the following:
validateLogin();
return false;
But actually like this..
validateLogin();
And here is the function:
function validateLogin(){
if(hi=true){
return true;
}
else{
return false
}
I want to attach this function for the event of a form being submitted, so if HI is false - i want to return false; me...
This is for Excel and VBA. Assume that BondClass has been properly defined in a Class Module. I get a #VALUE! when I type "=GetBondPrincipal()" into an Excel cell. Have I done something syntactically wrong or is this just not possible in Excel/VBA? I ask because what I really want to do is this:
http://stackoverflow.com/questions/1354046...
I have an uninstaller that calls AuthorizationExecuteWithPrivileges to run some tools that perform cleanup. On OS X 10.6 everything is fine. On 10.5 I'm getting -1 as the return value. The documentation doesn't cover what this means.
Can anyone shed some light?
...
Can somebody please point out what I'm doing wrong here?
FORTRAN 77 dll code
*$pragma aux DON "DON" export parm(value*8,value*8)
SUBROUTINE DON(DAA,DBB,DCC)
REAL*8, DAA,DBB,DCC
DBB=DAA+1
DCC=DBB+1
RETURN
END
C# code
using System;
using System.Collections.Generic;
using System.Linq;
using S...
I have a more complicated version of the following:
unsigned int foo ();
unsigned int bar ();
unsigned int myFunc () {
return foo()+bar();
}
In my case, myFunc is called from lots of places. In one of the contexts there is something going wrong. I know from debugging further down what the return value of this function is when thi...
I'm using NHibernate to retrieve a list from the database based on some criteria.
List<MyType> myList = GetByCriteria(...)
Does anyone know whether myList will be null or an empty list of MyType if no results are found that match the criteria?
I've been looking through the NHibernate documentation and searching in google but I can't ...
Hi All,
Quickish issue. I'm currently working with RoR with a great deal of Javascript for a project. I have a particular entity that has a "color" property. Of course I want to do this as "snazzily" (yup that's a word) as possible, however, I'm not sure how to go about it. I've seen a million and one different "Color Pickers" but n...
How can I setup a timer to call a method if it expires before receiving a return value?
myTimer.Interval = 100000;
bool status = methodReturningValue();
myTimer.Start();
if (status == true && myTimer.expired == false)
// Do Something
els...
Is it possible to call a method on a returned object using the pipeline infix operator?
Example, I have a .Net class (Class1) with a method (Method1). I can currently code it like this:
let myclass = new Class1()
let val = myclass.Method1()
I know I could also code it as such
let val = new Class1().Method1()
However I would like t...
Which is better:
bool MyClass::someQuery() const;
const bool MyClass::someQuery() const;
I've been using 'const bool' since I'm sure I remember hearing it's "what the ints do" (for e.g. comparison operators) but I can't find evidence of that anywhere, mostly due to it being difficult to Google and Intellisense not helping out any ;) ...
Im trying to write to an API and I need to call an eventhandler when I get data from a table. Something like this:
public override bool Run(Company.API api)
{
SomeInfo _someInfo = new SomeInfo();
if (_someInfo.Results == 1)
return true;
else
return false;
using (MyTable ...
I'm trying to just write a simple PHP if statement that checks if a custom field has anything entered into or if it has been left blank.
when it is blank it is meant to not print anything to the page,
if something is set in the custom field then it should create a li element with an a tag inside of it.
here is my code so far:
<ul clas...