Search Results

Search found 699 results on 28 pages for 'lifetime learner'.

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

  • return value (not a reference) from the function, bound to a const reference in the calling function

    - by brainydexter
    "If you return a value (not a reference) from the function, then bind it to a const reference in the calling function, its lifetime would be extended to the scope of the calling function." So: const BoundingBox Player::GetBoundingBox(void) { return BoundingBox( &GetBoundingSphere() ); } Returns a value of type const BoundingBox from function GetBoundingBox() Called function: (From within function Update() the following is called:) variant I: (Bind it to a const reference) const BoundingBox& l_Bbox = l_pPlayer->GetBoundingBox(); variant II: (Bind it to a const copy) const BoundingBox l_Bbox = l_pPlayer->GetBoundingBox(); Both work fine and I don't see the l_Bbox object going out of scope. (Though, I understand in variant one, the copy constructor is not called and thus is slightly better than variant II). Also, for comparison, I made the following changes. BoundingBox Player::GetBoundingBox(void) { return BoundingBox( &GetBoundingSphere() ); } with Variants: I BoundingBox& l_Bbox = l_pPlayer->GetBoundingBox(); and II: BoundingBox l_Bbox = l_pPlayer->GetBoundingBox(); The objet l_Bbox still does not out scope. So, I don't see how "bind it to a const reference in the calling function, its lifetime would be extended to the scope of the calling function", really extends the lifetime of the object to the scope of the calling function ? Am I missing something trivial here..please explain .. Thanks a lot

    Read the article

  • Eclipse RCP setting classpath from workspace

    - by English Learner
    I am working one Eclipse RCP project where I have got one situation that I wanted to set classpath at runtime. So initially, I can set the classpath from project\lib\sample.jar file in order to avoid the compilation error. But once the Eclipse RCP application started, and click one update button, a new sample.jar file would be generated at workspace. Now I wanted to update the classpath for newly generated sample.jar from workspace. Which is the best option for setting such a runtime classpath ?

    Read the article

  • Aspnet Redirect using location tag

    - by Learner
    <location path="/home/address?city="jcity" allowOverride="true"> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <httpRedirect enabled="true" httpResponseStatus="Permanent" exactDestination="true" destination="/home/jerseycity" /> </system.webServer> </location> I get an error since location tag can not use "?" tag. What is the best way to do this redirect?

    Read the article

  • List Manipulation in C# using Linq

    - by Learner
    using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace ConsoleApplication1 { public class Class1 { static void Main(string[] args) { List<Car> mylist = new List<Car>(); Car car1; Car car2; Car car3; car1 = new Car() { make = "Honda", id = 1 }; car2 = new Car() { make = "toyota", id = 2 }; car3 = new Car() { make = "Honda", id = 3, color = "red" }; mylist.Add(car1); mylist.Add(car2); **////mylist.Where(p => p.id == 1).SingleOrDefault() = car3;** } } public class Car { public int id { get; set; } public string make { get; set; } public string color { get; set; } } } How can I update the list by replacing the honda car of Id 1 with honda car with Id 3 in the best way.

    Read the article

  • O(log n) algorithm to find the element having rank i in union of pre-sorted lists

    - by Eternal Learner
    Given two sorted lists, each containing n real numbers, is there a O(log?n) time algorithm to compute the element of rank i (where i coresponds to index in increasing order) in the union of the two lists, assuming the elements of the two lists are distinct? I can think of using a Merge procedure to merge the 2 lists and then find the A[i] element in constant time. But the Merge would take O(n) time. How do we solve it in O(log n) time?

    Read the article

  • Error while excuting a simple boost thread program

    - by Eternal Learner
    Hi All, Could you tell mw what is the problem with the below boost::thread program #include<iostream> #include<boost/thread/thread.hpp> boost::mutex mutex; class A { public: A() : a(0) {} void operator()() { boost::mutex::scoped_lock lock(mutex); } private: int a; }; int main() { boost::thread thr1(A()); boost::thread thr2(A()); thr1.join(); thr2.join(); } I get the error message: error: request for member 'join' in 'thr1', which is of non-class type 'boost::thread()(A ()())' BoostThread2.cpp:30: error: request for member 'join' in 'thr2', which is of non-class type 'boost::thread ()(A ()())'

    Read the article

  • Write a function that returns the longest palindrome in a given string. e.g "ccddcc" in the string "

    - by Learner
    I thought of a solution but it runs in O(n^2) time Algo 1: Steps: Its a brute force method Have 2 for loops for i = 1 to i less than array.length -1 for j=i+1 to j less than array.length This way you can get substring of every possible combination from the array Have a palindrome function which checks if a string is palindrome so for every substring (i,j) call this function, if it is a palindrome store it in a string variable If you find next palindrome substring and if it is greater than the current one, replace it with current one. Finally your string variable will have the answer Issues: 1. This algo runs in O(n^2) time. Algo 2: Reverse the string and store it in diferent array Now find the largest matching substring between both the array But this too runs in O(n^2) time Can you guys think of an algo which runs in a better time. If possible O(n) time

    Read the article

  • Adding Custom dialogs in Visual Studio Setup projects

    - by constant learner
    Hello All I need to develop a Visual Studio Setup Project for my application. As far as i see, i can use only a handful of preconfigured dialogs which i can use. Is there any way possible to use any custom dialogs in Visual Studio SetUp Project ? For ex: Whenever i start my setup, a dialog should be shown to the user prompting him to select a language for installation. The user then shall select a language based on his preference and the installation shall then commence thereafter. I hope i have made myself clear CL

    Read the article

  • Problem with futures in c++0x .

    - by Eternal Learner
    Hi, I have written a small program , to understand how futures work in c++0x. while running the code I get an error like " error: 'printEn' was not declared in this scope". I am unable to understand what the problem is..Kindly point out what I am doing wrong here and if possible write the correct code for the same.. #include <future> #include <iostream> using namespace std; int printFn() { for(int i = 0; i < 100; i++) { cout << "thread " << i << endl; } return 1; } int main() { future<int> the_answer2=async(printEn); future<int> the_answer1=async(printEn); return 0; }

    Read the article

  • how to set values to combobox dynamically in javascript

    - by Learner
    this is how i set value to a combobox using dwr call, var reportID = '<%=reportid%>'; var reportName = '<%=reportname%>'; loadReportNames(reportUserID); function loadReportNames(reportUserID){ CustomiseReportAction.getReportNames(reportUserID, addReportNamesDropDown); } function addReportNamesDropDown(resultMap){ dwr.util.removeAllOptions("reportnames"); dwr.util.addOptions("reportnames",resultMap); } after loading the combo box i set values to loaded combo like this, document.getElementById("reportnames").value=reportID; but the reportID is not set, what could be the problem please help me to resolve this. UPDATE : function addCombo() { var reportID = '<%=reportid%'; var reportName = '<%=reportname%'; var textb = document.getElementById("reportnames"); var option = document.createElement("option"); option.text = reportName; option.value = reportID; option.selected="selected"; try { textb.add(option, null); //Standard }catch(error) { textb.add(option); // IE only } textb.value = ""; } used above method it gives me no exception but no results. Regards

    Read the article

  • Avoid existing files being overwritten when newer version is installed.

    - by constant learner
    Hello I have a VS2008 windows application project (WinProject) which is deployed by the installation project (InstallationProject) which inturn has the property RemovePreviousVersions set to True. In my app for each configuration made by an user, the winapp writes the configurations into an xml file (stored in C:\Application Name\Files\ folder) which also includes the path where the config was saved. Now when I build new versions of the installer,This folder and the files are overwritten since i the flag AlwaysCreate is set to True. My question is how can i avoid these older files from being overwritten and at the same time shall get the updated file from the installer. Ex: Contents of the file <PriceFiles> <Name>arr</Name> <Path>C:\NewTool\arr.xml</Path> <UserDefined>true</UserDefined> </PriceFiles> <ReferenceProjects> <Name>studio</Name> <Path>C:\NewTool\ReferenceProjects\6cd3a9e9-ad65-475e-953b-128915a496cd.xml</Path> <UserDefined>true</UserDefined> <CreatedBy>Admin</CreatedBy> </ReferenceProjects> Thanks in advance

    Read the article

  • Doubt in Stored Procedure MySql - how to return multiple values for a variable ?

    - by Eternal Learner
    Hi, I have a stored procedure below. I intend this procedure to return the names of all the movies acted by an actor. Create Procedure ActorMovies( In ScreenName varchar(50), OUT Title varchar(50) ) BEGIN Select MovieTitle INTO Title From Movies Natural Join Acts where Acts.ScreenName = 'ScreenName '; End; I make a call like Call ActorMovies(' Jhonny Depp',@movie); Select @move; The result I get is a Null set , which is not correct.I am expecting a set of movies acted by Jhonny Depp to be returned. I am not sure as to why this is happening?

    Read the article

  • URL rewrite module for IIS7

    - by Learner
    I am trying to test if the redirect that I wrote works or not. If I do IISReset the redirect does not work. But if I recycle the app then this works. Is this how it works? <rule name="RedirectToanothercity" patternSyntax="ECMAScript" stopProcessing="true"> <match url="^home/cities.aspx?$" /> <conditions> <add input="{QUERY_STRING}" pattern="city=jerseycity" /> </conditions> <action type="Redirect" url="jerseycity" appendQueryString="false" />

    Read the article

  • PHP, manipulating images and thumbnails?

    - by learner.php
    I am using php and mysql. I allow my registered users to upload photos, the photos are store in filesystem format, then I will keep the original/max size of : width: 1600px and heigh: 1200px. In the user profile page, I would like to display the image, it maybe one of the 5 types of thumnails: 500x500, 300x300, 200x200, 100x100 or 50x50. What is the best way to create the thumbnails, here are my current solutions: I am thinking of create 1 thumbnail, then from that thumbnail, i will resize in [img src="" width="XX"] tag, alternatively, store the different thumbnails size in database, then get and display it Create 5 thumbnails for each photos? (I am afraid this is a bad way) Whats the best practices?

    Read the article

  • How to rotate image completely. with out showing the black portion.

    - by learner
    I have an image I have to rotate that image 25 degree. if I rotate it shows some black background. How can I avoid that. How can I rotate image completely with out showing the black portion by using PHP GD. I cant use js for rotation. because I have to merge the image with another one after rotation. any body have the scripts for this please help me.

    Read the article

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