Search Results

Search found 35086 results on 1404 pages for 'return on investment'.

Page 3/1404 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • C++ function will not return

    - by Mike
    I have a function that I am calling that runs all the way up to where it should return but doesn't return. If I cout something for debugging at the very end of the function, it gets displayed but the function does not return. fetchData is the function I am referring to. It gets called by outputFile. cout displays "done here" but not "data fetched" I know this code is messy but can anyone help me figure this out? Thanks //Given an inode return all data of i_block data char* fetchData(iNode tempInode){ char* data; data = new char[tempInode.i_size]; this->currentInodeSize = tempInode.i_size; //Loop through blocks to retrieve data vector<unsigned int> i_blocks; i_blocks.reserve(tempInode.i_blocks); this->currentDataPosition = 0; cout << "currentDataPosition set to 0" << std::endl; cout << "i_blocks:" << tempInode.i_blocks << std::endl; int i = 0; for(i = 0; i < 12; i++){ if(tempInode.i_block[i] == 0) break; i_blocks.push_back(tempInode.i_block[i]); } appendIndirectData(tempInode.i_block[12], &i_blocks); appendDoubleIndirectData(tempInode.i_block[13], &i_blocks); appendTripleIndirectData(tempInode.i_block[14], &i_blocks); //Loop through all the block addresses to get the actual data for(i=0; i < i_blocks.size(); i++){ appendData(i_blocks[i], data); } cout << "done here" << std::endl; return data; } void appendData(int block, char* data){ char* tempBuffer; tempBuffer = new char[this->blockSize]; ifstream file (this->filename, std::ios::binary); int entryLocation = block*this->blockSize; file.seekg (entryLocation, ios::beg); file.read(tempBuffer, this->blockSize); //Append this block to data for(int i=0; i < this->blockSize; i++){ data[this->currentDataPosition] = tempBuffer[i]; this->currentDataPosition++; } data[this->currentDataPosition] = '\0'; } void outputFile(iNode file, string filename){ char* data; cout << "File Transfer Started" << std::endl; data = this->fetchData(file); cout << "data fetched" << std::endl; char *outputFile = (char*)filename.c_str(); ofstream myfile; myfile.open (outputFile,ios::out|ios::binary); int i = 0; for(i=0; i < file.i_size; i++){ myfile << data[i]; } myfile.close(); cout << "File Transfer Completed" << std::endl; return; }

    Read the article

  • Getting stored procedure's return value with iBatis.NET

    - by MikeWyatt
    How can I retrieve the return value of a stored procedure using iBatis.NET? The below code successfully calls the stored procedure, but the QueryForObject<int> call returns 0. SqlMap <procedure id="MyProc" parameterMap="MyProcParameters" resultClass="int"> MyProc </procedure> <parameterMap id="MyProcParameters"> <parameter property="num"/> </parameterMap> C# code public int RunMyProc( string num ) { return QueryForObject < int > ( "MyProc", new Hashtable { { "num", num } } ); } Stored Procedure create procedure MyProc @num nvarchar(512) as begin return convert(int, @num) end FYI, I'm using iBatis 1.6.1.0, .NET 3.5, and SQL Server 2008.

    Read the article

  • Define and return a struct in c

    - by nevan
    I'm trying to convert some code from Javascript to c. The function creates an array (which always has a fixed number of items) and then returns the array. I've learned that in c it's not straightforward to return an array, so I'd like to return this as a struct instead. My c is not all that great, so I'd like to check that returning a struct is the right thing to do in this situation, and that I'm doing it the right way. Thanks. typedef struct { double x; double y; double z; } Xyz; Xyz xyzPlusOne(Xyz addOne) { Xyz xyz; xyz.x = addOne.x + 1; xyz.y = addOne.y + 1; xyz.z = addOne.z + 1; return xyz; }

    Read the article

  • return from jquery ajax call

    - by michael
    hi im tryin to use the return from a jquery ajax call in my own function, but it keeps returning undefined. function checkUser2(asdf) { $.ajax({ type: "POST", async: false, url: "check_user.php", data: { name: asdf }, success: function(data){ return data; //alert(data); } }); } $("#check").click(function(){ alert(checkUser2("muma")); }); the ajax call definately works, because when i uncomment my alert i get the correct return, and i can see it in firebug. Am i doing something stupid.

    Read the article

  • Return an Object in Java

    - by digby12
    I've been struggling to work out how to return an object. I have the following array of objects. ArrayList<Object> favourites; I want to find an object in the array based on it's "description" property. public Item finditem(String description) { for (Object x : favourites) { if(description.equals(x.getDescription())) { return Object x; else { return null; Can someone please show me how I would write this code. Thanks.

    Read the article

  • ActionScript Custom Class With Return Type?

    - by TheDarkIn1978
    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, big:int) { compare(small, big); } private function compare(small:int, big:int):Boolean { if (small < big) return true; else return false; } } } so now i'd like to write something like this: if (CompareInts(1, 5) == true). or output 'true' by writing trace(CompareInts(1, 5));

    Read the article

  • checking the return code using python (MAC)

    - by cyberbemon
    I have written a script that checks if an SVN Repo is up and running, the result is based on the return value. import subprocess url = " validurl" def check_svn_status(): subprocess.call(['svn info'+url],shell=True) def get_status(): subprocess.call('echo $?',shell=True) def main(): check_svn_status() get_status() if __name__ == '__main__': main() The problem I'm facing is that if I change the url to something that does't exist I still get the return value as 0, but if I were to run this outside the script, i.e go to the terminal type svn info wrong url and then do a echo $? I get a return value of 1. But I can't re-create this in the python. Any guidelines ?

    Read the article

  • can constructors actually return Strings?

    - by elwynn
    Hi all, I have a class called ArionFileExtractor in a .java file of the same name. public class ArionFileExtractor { public String ArionFileExtractor (String fName, String startText, String endText) { String afExtract = ""; // Extract string from fName into afExtract in code I won't show here return afExtract; } However, when I try to invoke ArionFileExtractor in another .java file, as follows: String afe = ArionFileExtractor("gibberish.txt", "foo", "/foo"); NetBeans informs me that there are incompatible types and that java.lang.String is required. But I coded ArionFileExtractor to return the standard string type, which is java.lang.string. I am wondering, can my ArionFileExtractor constructor legally return a String? I very much appreciate any tips or pointers on what I'm doing wrong here.

    Read the article

  • Ajax jquery async return value

    - by Sonny
    Hi, how can i make this code to don't pause the browser but still return value. You can rewrite this with new method of course. function get_char_val(merk) { var returnValue = null; $.ajax({ type: "POST", async: false, url: "char_info2.php", data: { name: merk }, dataType: "html", success: function(data) { returnValue = data; } }); return returnValue; } var px= get_char_val('x'); var py= get_char_val('y');

    Read the article

  • C# function normal return value VS out or ref argument

    - by misha-r
    Hi People, I've got a method in c# that needs to return a very large array (or any other large data structure for that matter). Is there a performance gain in using a ref or out parameter instead of the standard return value? I.e. is there any performance or other gain in using void function(sometype input, ref largearray) over largearray function(sometype input) ? Thanks in advance!

    Read the article

  • Using a constructor for return.

    - by Fecal Brunch
    Hi, Just a quick question. I've written some code that returns a custom class Command, and the code I've written seems to work fine. I was wondering if there are any reasons that I shouldn't be doing it this way. It's something like this: Command Behavior::getCommand () { char input = 'x'; return Command (input, -1, -1); } Anyway, I read that constructors aren't meant to have a return value, but this works in g++. Thanks for any advice, Rhys

    Read the article

  • Can a constructor return a NULL value?

    - by Sanctus2099
    I know constructors don't "return" anything but for instance if I call CMyClass *object = new CMyClass() is there any way to make object to be NULL if the constructor fails? In my case I have some images that have to be loaded and if the file reading fails I'd like it to return null. Is there any way to do that? Thanks in advance.

    Read the article

  • Return statements for all functions

    - by emddudley
    How common is it for coding style guidelines to include a requirement that all functions include a return statement (including functions which return void)? To avoid being subjective or argumentative, I'd like answers which can name specific companies or open-source projects which have this requirement. If you haven't ever come across this coding style guideline, or you have a resource (book, online article) which discusses it, that would be useful as well. Thanks!

    Read the article

  • HOW TO RETURN VALUE FROM FUNCTION? (c#)

    - by Ole Jak
    So... I want to return value when C# function is called. I need a code example (simple summ of a,b values will be ok) Please help I need something like this ( I know ActionScript so I will write in it): public function sum(valueA:int, valueB:int):int { var summ:int = valueA + valueB; return summ; } How to translate it into C#?

    Read the article

  • Return Double from Boost thread

    - by Benedikt Wutzi
    Hi I have an Boost thread which should return a double. The function looks like this: void analyser::findup(const double startwl, const double max, double &myret){ this->data.begin(); for(int i = (int)data.size() ; i >= 0;i--){ if(this->data[i].lambda > startwl){ if(this->data[i].db >= (max-30)) { myret = this->data[i+1].lambda; std::cout <<"in thread " << myret << std::endl; return; } } } } this function is called by another function: void analyser::start_find_up(const double startwl, const double max){ double tmp = -42.0; boost::thread up(&analyser::findup,*this, startwl,max,tmp); std::cout << "before join " << tmp << std::endl; up.join(); std::cout << "after join " << tmp << std::endl; } Anyway I've tried and googled almost anything but i can't get it to return a value. The output looks like this right now. before join -42 in thread 843.487 after join -42 Thanks for any help.

    Read the article

  • Which syntax is better for return value?

    - by Omar Kooheji
    I've been doing a massive code review and one pattern I notice all over the place is this: public bool MethodName() { bool returnValue = false; if (expression) { // do something returnValue = MethodCall(); } else { // do something else returnValue = Expression; } return returnValue; } This is not how I would have done this I would have just returned the value when I knew what it was. which of these two patterns is more correct? I stress that the logic always seems to be structured such that the return value is assigned in one plave only and no code is executed after it's assigned.

    Read the article

  • return false for parent javascript function

    - by jeerose
    $("#purchaser_contact").live('submit', function(){ $.ajax({ type: "POST", url: 'ajax/contactSearch.php', data: ({ fname: $("#fname").val(), lname: $("#lname").val(), city: $("#city").val(), state: $("#state").val() }), success: function(d) { var obj = JSON.parse( d ); if(obj.result != 0){ $("#contactSearch").remove(); $("#button-wrapper").before('<div id="contactSearch">' + obj.result + '</div>'); $("#contactSearch").slideToggle('slow'); //return false from submit!! }); }); I know there are other posts on this but I couldn't figure out how to apply them properly to my situation without making it messy. How do I return false on the submit event to prevent the form from submitting if I'm within the $.ajax and success functions? Thanks.

    Read the article

  • Problem with debug watch in Visual Studio with yield return enumerator methods

    - by Stuart
    I have a method which returns an IEnumerable<> which it builds up using the yield return syntax: public IEnumerable<ValidationError> Validate(User user) { if (String.IsNullOrEmpty(user.Name)) { yield return new ValidationError("Name", ValidationErrorType.Required); } [...] yield break; } If I put a breakpoint in the method, I can step over each line, but if I try to use the Watch or Immediate windows to view the value of a variable I get this error: Cannot access a non-static member of outer type '[class name].Validate' via nested type '[class name]' Does anyone know why this is and how I can get around it?

    Read the article

  • Store return value of function in reference C++

    - by Ruud v A
    Is it valid to store the return value of an object in a reference? class A { ... }; A myFunction() { A myObject; return A; } //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 needed anymore and should be exactly the same as mySecondObject so it would in theory be faster just to pass ownership of the object from one object to another. (This is also possible using boost shared pointer but that has the overhead of the shared pointer.) Thanks in advance.

    Read the article

  • In Java, does return trump finally?

    - by jonny five
    If I have a try/catch block with returns inside it, will the finally block be called? For example: try { something(); return success; } catch (Exception e) { return failure; } finally { System.out.println "i don't know if this will get printed out." } I know I can just type this in an see what happens (which is what I'm about to do, actually) but when I googled for answers nothing came up, so I figured I'd throw this up as a question. Thanks!

    Read the article

  • ocjective-c Obtain return value from public method

    - by Felix
    I'm pretty new to objective-C (and C in general) and iPhone development and am coming from the java island, so there are some fundamentals that are quite tough to learn for me. I'm diving right into iOS5 and want to use storyboards. For now I am trying to setup a list in a UITableViewController that will be filled with values returned by a web service in the future. For now, I just want to generate some mock objects and show their names in the list to be able to proceed. Coming from java, my first approach would be to create a new Class that provides a global accessible method to generate some objects for my list: #import <Foundation/Foundation.h> @interface MockObjectGenerator : NSObject +(NSMutableArray *) createAndGetMockProjects; @end Implementation is... #import "MockObjectGenerator.h" // Custom object with some fields #import "Project.h" @implementation MockObjectGenerator + (NSMutableArray *) createAndGetMockObjects { NSMutableArray *mockProjects = [NSMutableArray alloc]; Project *project1 = [Project alloc]; Project *project2 = [Project alloc]; Project *project3 = [Project alloc]; project1.name = @"Project 1"; project2.name = @"Project 2"; project3.name = @"Project 3"; [mockProjects addObject:project1]; [mockProjects addObject:project2]; [mockProjects addObject:project3]; } And here is my ProjectTable.h that is supposed to control my ListView #import <UIKit/UIKit.h> @interface ProjectsTable : UITableViewController @property (strong, nonatomic) NSMutableArray *projectsList; @end And finally ProjectTable.m #import "ProjectsTable.h" #import "Project.h" #import "MockObjectGenerator.h" @interface ProjectsTable { @synthesize projectsList = _projectsList; -(id)initWithStyle:(UITableViewStyle:style { self = [super initWithStyle:style]; if (self) { _projectsList = [[MockObjectGenerator createAndGetMockObjects] copy]; } return self; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // only one section for all return 1; - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSLog(@"%d entries in list", _projectsList.count); return _projectsList.count; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // the identifier of the lists prototype cell is set to this string value static NSString *CellIdentifier = @"projectCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; Project *project = [_projectsList objectAtIndex:indexPath.row]; cell.textLabel.text = project.name } So while I think everything is correctly set, I expect the tableView to show my three mock objects in its rows. But it stays empty and the NSLog method prints "0 entries in list" into the console. So what am I doing wrong? Any help is appreciated. Best regards Felix

    Read the article

  • Should my WCF webservice return a 500 or 200 http code (soap fault / functional return message)

    - by Tim Mahy
    Hi all, after reading the SOAP specs, it states that a SOAP Fault should return a http 500 errorcode, so when a SoapException is thrown, WCF returns a 500 error code. Now, I'm looking for some best practices to when return a functional soap error message and when to return a SOAP Fault. What would you guys return when a functional error occurred while processing the message because of the input message contains some functional errors, a 500 SOAP Fault or a 200 Soap response containing some error message ?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >