Can actionPerformed return a value?
In my application I use a FileChooser to chose a file. The name of the selected file should be returned to another class. how to do this in eclipse? ...
In my application I use a FileChooser to chose a file. The name of the selected file should be returned to another class. how to do this in eclipse? ...
I use this method to get file extension, public string ReturnExtension(string fileExtension) { switch (fileExtension) { case ".doc": case ".docx": return "application/ms-word"; } } When i compile it i got the error BaseClass.ReturnExtension(string)': not all code ...
Hello, Hopefully my title was descriptive enough to attract the right help. I want to write a function that will return 1 thing, and modify a provided pointer in another. My current function declaration is . . . char * replaceURLS(char * body) What I want to do is copy all of body's data into a new string, and set body to point to ...
I'm using a macro and I think it works fine - #define CStrNullLastNL(str) {char* nl=strrchr(str,'\n'); if(nl){*nl=0;}} So it works to zero out the last newline in a string, really its used to chop off the linebreak when it gets left on by fgets. So, I'm wondering if I can "return" a value from the macro, so it can be called like f...
I have a Perl script which calls another script. The Perl script should be propagating the script's return code but seems to be returning zero to its caller (a Java application) desipte the explicit call to exit $scriptReturnCode. Code and output as follows (I realise that <=> could/should be != but that's what I have): print "INFO: Ca...
Solved: I figured out a clean way to do it with setjmp()/longjmp(), requiring only a minimal wrapper like: int jump(jmp_buf j, int i) { longjmp(j, i); return 0; } This allows jump() to be used in conditional expressions. So now the code: if (A == 0) return; output << "Nonzero.\n"; Is correctly translated to: return ((A == 0) && ju...
using namespace boost; class A {}; class B : public A {}; class X { virtual shared_ptr<A> foo(); }; class Y : public X { virtual shared_ptr<B> foo(); }; The return types aren't covariant (nor are they, therefore, legal), but they would be if I was using raw pointers instead. What's the commonly accepted idiom to work around thi...
Hi, I was wondering if someone could explain how the following code works: public interface Result { public int getCount(); public List<Thing> getThings(); } class SomeClass { ... public Result getThingResult() { final List<Thing> things = .. populated from something. final int count = 5; return new Result { ...
How does returning a value from a function internally works ? See this example.. ...
edited: This is what i need: sendpost = function(a,b,c){ return jQuery.post('inc/operations.php', {a:b}, c, "json"); }, rotate = function(callback){ //.... alert(callback); } sendpost('operation', 'test', rotate) old post: i use this function to return the response of post: $.sendpost = function(){ return jQuery.pos...
The following Ruby code def a(b,c) b+c end is the same as follows with Python def a(b,c): return b+c It looks like that ruby has the special stack that stores the final evaluation result and returns the value when a function is called. If so, what's the name of the stack, and how can I get that stack? If not, how does the Ruby ...
Is there any way to have a subroutine send data back while still processing? For instance (this example used simply to illustrate) - a subroutine reads a file. While it is reading through the file, if some condition is met, then "return" that line and keep processing. I know there are those that will answer - why would you want to do tha...
Hi, Consider the following piece of code: As you can see we are on line 28. Is there any way to see the return value of the function at this point, without letting the code return to the caller function? Foo.Bar() is a function call which generates a unique path (for example). So it's NOT constant. Entering ?Foo.Bar() in the immidi...
Hi, what is the difference between following function declarations, which create and return the array in C/C++? Both methods create the array and fill it with proper values and returns true if everything passed. bool getArray(int* array); bool getArray(int* array[]); Thanks Best Regards, STeN ...
I'm working with a binary file that I disas'd in gdb. Right now I'm just examining the return value of a function. 0x08048604 <playGame+78>: ret Is the address shown the address where ret is stored in the function? Or is it just the address of the instruction to return the ret value? ...
When I have to write methods which return two values, I usually go about it as in the following code which returns a List<string>. Or if I have to return e.g. a id and string, then I return a List<object> and then pick them out with index number and recast the values. This recasting and referencing by index seems inelegant so I want to ...
Hi there, I basically want to know how to take a user entered number, then take another user entered number and times it by a predefined number and then display the result when submit is clicked. E.g. 200 + 300 x 0.4 = xxxx Im sure this must be fairly simple so if anyone is able to help me out it would be greatly appreciated! If thi...
I have 46 rows of information, 2 columns each row ("Code Number", "Description"). These codes are returned to the client dependent upon the success or failure of their initial submission request. I do not want to use a database file (csv, sqlite, etc) for the storage/access. The closest type that I can think of for how I want these code...
I have a function that issues an AJAX call (via jQuery). In the complete section I have a function that says: complete: function(XMLHttpRequest, textStatus) { if(textStatus == "success") { return(true); } else { return(false); } } However, if I call this like so: if(callajax()) { // Do som...
Is it valid to store the return value of an object in a reference? class A { ... }; A myFunction() { A myObject; return myObject; } //myObject goes out of scope here void mySecondFunction() { A& mySecondObject = myFunction(); } Is it possible to do this in order to avoid copying myObject to mySecondObject? myObject is not...