return-value

Returning values inside a JS function

Can someone explain to me why I cannot use document.getElementById('id').value inside of a function? I was trying to make a simple multiplication script (im learning JS, its actually kinda fun) and realized quickly how annoying typing that whole line of code just to return a value is, so I wrote a small function: <script type="text/jav...

returning index array objective c

Does anyone know a quick way to return the index of my array in a simple function something like this if([appDelegate.exerciseReference containsObject:aExerciseRef.IDE]) { //return indexofwhere the object is the same .... } so let's say these two are the same at the index:5 from my array it would return a 5 integer. ...

How to handle incorrect values in a constructor?

Please note that this is asking a question about constructors, not about classes which handle time. Suppose I have a class like this: class Time { protected: unsigned int m_hour; unsigned int m_minute; unsigned int m_second; public: Time(unsigned int hour, unsigned int minute, unsigned int second); }; While I would wa...

unlisted reserved word?

I ran into a very strange behaviour in some of our PHP code today. We have a class for dealing with files. It's something like this: class AFile { //usual constructor, set and get functions, etc. //... public function save() { //do some validation //... if($this->upload()) { //save the file to disk $this->upda...

MS Access 2003 - Creating a Dashboard - Return Values to a form?

So this is something that I have never tried, but I think I want to create a Metrics Dashboard in my MS Access database. So I think the first question that I need to ask is how can I return a value to a form? If I ave aggregate queries that are top 10 total sales, how can I specify not only the query that I want the top result to come f...

Should WCF services return plain old objects, or the actual class that you're working with?

I am consuming a WCF service from another company, and it is returning an object of type object. Is there a reason not to return the actual class, and return an object that must be cast into the correct form? For example, if the web service returns an object of type OrderStatus, why would you instead return a plain old object? Correct...

What would cause a WCF service to return an object of type "object"

Per my other post about WCF service return values, I'm consuming a web service from another company, and when I add the service reference inside Visual Studio, the return value of the method is an object of type object. The author of the web service showed me the code, and it actually returns a typed object. Am I missing something, or ...

catching return code of a command with "invoke-command" - Powershell 2

Hi, I am using "invoke-command" to execute a script on a remote machine. invoke-command -computername <server_name> -scriptblock {command to execute the script} My script returns "-1" when there are any errors. So, I wanted to ensure that script has executed successfully by checking the return code. I tried as follows. $code = invok...

Handling the return value of object_getIvar(id object, Ivar ivar)

1) object_getIvar(id object, Ivar ivar) returns an 'id' if the Ivar is an object eg. if the variabe is an NSString, presumably the id = NSString which contains the value. Is that correct? Or what do I need to do to access the value of the Ivar. 2) if the Ivar is a float/int etc. what will get returned and how do I convert it into someth...

How do I get the int value from object_getIvar(self, myIntVar) as it returns a pointer

if the variable in object_getIvar is a basic data type (eg. float, int, bool) how do I get the value as the function returns a pointer (id) according to the documentation. I've tried casting to an int, int* but when I try to get that to NSLog, I get error about an incompatible pointer type. ...

object_getInstanceVariable works for float, int, bool, but not for double?

I've got object_getInstanceVariable to work as here however it seems to only work for floats, bools and ints not doubles. I do suspect I'm doing something wrong but I've been going in circles with this. float myFloatValue; float someFloat = 2.123f; object_getInstanceVariable(self, "someFloat", (void*)&myFloatValue); works, and myFloat...

Handling multiple return values in ANTLR

Hello, I have a simple rule in ANTLR: title returns [ElementVector<Element> v] @init{ $v = new ElementVector<Element>() ; } : '[]' | '[' title_args {$v.add($title_args.ele);} (',' title_args {$v = $title_args.ele ;})* ']' ; with title_args being: title_args returns [Element ele] : author {$ele = new Element(...

General programming - calling a non void method but not using value

This is general programming, but if it makes a difference, I'm using objective-c. Suppose there's a method that returns a value, and also performs some actions, but you don't care about the value it returns, only the stuff that it does. Would you just call the method as if it was void? Or place the result in a variable and then delete it...

What is a good way to handle returned data from MySQL and C# ?

Just a quick questions, since most blogs and tutorials I found are about the very basic elements of MySQL and C#. I am using the MySQL ADO Connector. I have everything setup and I can retrieve data from the table. But I want to create a method that simplifies things for me. So I can set a query string (either in the method or the objec...

C#: when an event has mutiple subscribers, how do I get the return value for each subscriber?

The code looks like below: Clock: public class Clock { public event Func<DateTime, bool> SecondChange; public void Run() { for (var i = 0; i < 20; i++) { Thread.Sleep(1000); if (SecondChange != null) { //how do I get return value for each subscriber? ...

PHP function return value nested array removed

I have a function that builds a collection of user objects from the database: public static function GetUsersByGroup($instanceID, $groupID) { $col = null; if($groupID != null) { $col = UserGroup::GetCollection("User" ,_DB_GET_ALL_INSTANCE_USERGROUP_MEMBERS,array ($instanceID, $groupID)); } els...

Can virtual functions be used in return values?

I was a little surprised that the following code did not work as expected: #include "stdio.h" class RetA { public: virtual void PrintMe () { printf ("Return class A\n"); } }; class A { public: virtual RetA GetValue () { return RetA (); } }; class RetB : public RetA { public: virtual void PrintMe () { printf ("Return class...

Howto allow any data type to be returned by a function in actionscript 3?

I have a static Settings class where my application can retrieve settings from. The problem is that some of these settings are strings, while others are ints or numbers. Example: package { public final class Settings { public static function retrieve(msg:String) { switch (msg) { case "register_link":...

Access array returned from a function - javascript/jquery noob moment

When the form is submitted, I'm calling a function getPosts and passing through a variable str. What I'd like to do is get the data returned from that function. // when the form is submitted $('form#getSome').submit(function(){ var str = $("form#getSome").serialize(); var something = getPosts(str); * This is where I'd like to g...

Returning object initialized through "convenience constructor"

When an instance method returns a value that was initialized with a convenience constructor, do I need to retain that object and then autorelease in the return so that when the convenience constructor's autorelease occurs, it doesn't remove the object. Will this release description before the calling code and take ownership with a retai...