return-type

menu - if has children ->turn off links; if doesn't has children -> link on?

Hi, how do I do something like that in a menu? If has children → turn off links; if doesn't has children → link on? Can anyone help me????! :) I was trying like that: over = function(){ var $$ = $(this), menu = getMenu($$); if ("li:has(ul)") { clearTimeout(menu.sfTimer); $$.showSuperfishUl().siblings().hideSup...

Method return type String is not a String

First of all, my target here is to read from a URL, parse it, and take information from it and give it to another method sendMessage which then sends it to an IRC client. I haven't been doing java long so I'm adapting things I code I find on the internet. The below methods work when they are declared in their own class file, and run by p...

Pimpl idiom: What size_type to use if implementation is unknown?

I have a class that holds an array of elements, and I want to give it a GetSize member function. But what return type should I give that function? I'm using the pimpl idiom, and so in the header file it is not known what the implementation will use to store the elements. So I cannot just say std::vector<T>::size_type, for example: cla...

Return Type Boolean in Java

I have a question on boolean return types. Check the following code: Code Sample 1 boolean flag = sampleMethod(); public boolean samplemethod(){ return false; } Code Sample 2 sampleMethod(); public boolean samplemethod(){ return false; } In the above two examples, the code compiles properly without any compile time or r...

C-structs, NSObjects, float, int, double, ...

Hello, First of all: this is a though question, sorry for that, but I hope someone can help me! I'm making a UIML renderer on the iPhone. UIML is a language to describe interfaces. I want to render the XML and show the Interface on the iPhone. To inform you bettter, i first explain what I'm doing: <?xml version="1.0"?> <uiml> <in...

jQuery .post() and dynamically specifying the return type

Hi Guys I have the following $.post() function that expects JSON as its return value. $.post($(this).attr("action"), $(this).serialize(), function(data) { if (data.returnData) { //do stuff with data.returnData } }, "json"); This piece of code does the trick so long as the return type is JSON. The question I ha...

How to return a string literal from a function

Hi, I am always confused about return a string literal or a string from a function. I was told that there might be memory leak because you don't know when the memory will be deleted? For example, in the code below, how to implement foo() so as to make the output of the code is "Hello World"? void foo ( ) // you can a...

Returning superclass of return type from remote EJB method

Let's say I have remote interface A: @Remote public interface A { public Response doSomething(); } And implementation: @Stateless public class B implements A { public BeeResponse doSomething() {...} } Where: BeeResponse extends Response. Response is located in the EJB-API jar and BeeResponse is in the implementation jar. Re...

Using Sub-Types And Return Types in Scala to Process a Generic Object Into a Specific One

I think this is about covariance but I'm weak on the topic... I have a generic Event class used for things like database persistance, let's say like this: class Event( subject: Long, verb: String, directobject: Option[Long], indirectobject: Option[Long], timestamp: Long) { def getSubject = subject def getVerb = verb def...

Actionscript 3 return types - is a * return type ok to use?

Hi, I have a function in which I'd like to return an Object or false. Is a return type of * ok to use? are there any downfalls to this? (besides it being a bit lazy in some cases). ...

C++ Beginner - Trouble using classes inside of classes

Hello, I am working on a college project, where I have to implement a simple Scrabble game. I have a player class (containing a Score and the player's hand, in the form of a std::string, and a score class (containing a name and numeric (int) score). One of Player's member-functions is Score getScore(), which returns a Score object for...

How do I return a value from a javascript function

Say I have a function function myFunction(myValue) { // do something } How would I return a value from this, say a string type after the method is executed? ...

ActionScript Custom Class With Return Type?

i just know this is a dumb question, so excuse me in advance. i want to essentially classify a simple function in it's own .as file. the function compares integers. but i don't know how to call the class and receive a boolean return. here's my class package { public class CompareInts { public function CompareInts(small:int, ...

VB.NET Why won't my Function return an array?

Hi, I'm trying to write a function that returns an Array that I can pass into a String.Format: Public Function ToArray() As Array Dim vals As New ArrayList() vals.Add(Me("district")) vals.Add(Me("county")) vals.Add(Me("route")) vals.Add(Me("section")) vals.Add(Me("beg_logmile")) vals.Add(Me("end_logmile")) ...

Is it advisable to have an interface as the return type?

I have a set of classes with the same functions but with different logic. However, each class function can return a number of objects. It is safe to set the return type as the interface? Each class (all using the same interface) is doing this with different business logic. protected IMessage validateReturnType; <-- This is in an abstra...

What is the type of a lambda function?

In C++0x, I'm wondering what the type is of a lambda function. Specifically: #include<iostream> type1 foo(int x){ return [x](int y)->int{return x * y;}; } int main(){ std::cout<<foo(3)(4);//would output 12 type2 bar = foo(5); std::cout<<bar(6);//would output 30 return 0; } What do I need to replace type1/type2 with to get the...

member function pointer which returns same type of member function pointer

Hello, I'd like to declare a member function pointer in C++, that returns the same member function pointer type This doesn't work: class MyClass { public: typedef FunctionPtr (MyClass::*FunctionPtr)(); } Does someone know a solution? ...

Does C++ enforce return statements?

Okay, little oddity I discovered with my C++ compiler. I had a not-overly complex bit of code to refactor, and I accidentally managed to leave in a path that didn't have a return statement. My bad. On the other hand, this compiled, and segfaulted when I ran it and that path was hit, obviously. Here's my question: Is this a compiler bug...

WCF Service returning a different CustomType then SharedLibrary Type?

I have a WCF Service which returns some custom objects to a desktop client application. Both projects share the same ObjectLibrary.dll, however when the WCF server return these objects it is returning ClientApplication.ServerReference.ObjectType instead of ObjectLibrary.ObjectType Is there a way to get the WCF server to return the...

Variable return type in objective-c function (with Cocoa)

Hi everyone I have a configuration class in my objective-c app which reads a PLIST file with configuration data. I would then like to be able to read the value for any key with a single function, something like this: - () getValueforKey:(NSString *)key { some magic here.... return value; } The issue: Some of the values in t...