[Solved] Cannot implicitly convert type ‘double’ to ‘float’ with Math.Pow()

Your variables are float, but the method Math.Pow returns a double. Hence you need explicit conversion to be performed on the result of the method. presentValue = futureValue / (float)Math.Pow(1 + rate, years); Note: Math.Pow also takes double as parameters, but still it works. That’s because implicit conversion is taking place. Because double can represent … Read more

[Solved] Removing duplicates from arraylist using set

Find the intersection Find the union Subtract the intersection from the union Code: public static void main(String[] args) { Set<Integer> set1 = new HashSet<Integer>(Arrays.asList(1, 2, 3, 4, 5)); Set<Integer> set2 = new HashSet<Integer>(Arrays.asList(1, 3, 6, 7)); Set<Integer> intersection = new HashSet<Integer>(set1); intersection.retainAll(set2); // set1 is now the union of set1 and set2 set1.addAll(set2); // set1 … Read more

[Solved] Making div responsive with margin 0 auto in it

It depend and what you want but fixed width and high margin isn’t the solution, you need another wrapper on your image for center them, and adjust your CSS: <div id=”responsivearea”> <div class=”img-center”> <img class=”wp-image-2520 alignleft” src=”http://www.inspuratesystems.com/nayajeevan/wp-content/uploads/2014/11/good-employer.png” alt=”good employer” width=”201″ height=”199″ /> <img class=”wp-image-2521 alignleft” src=”http://www.inspuratesystems.com/nayajeevan/wp-content/uploads/2014/11/gift-of-health.png” alt=”gift of health” width=”201″ height=”199″ /> <img class=”wp-image-2522 alignleft” … Read more

[Solved] Understand a C program

What the code does is fetch one character from the input stream at a time, and then store the character at the ith position in the s array, then it increments i. It tests for two conditions, if i == lim – 1 then the loop ends, and the ‘\0’ is appended at the lim … Read more

[Solved] how can i work with 16 digit integer type?

The biggest value an int can hold is 2,147,483,647. Change the variables to unsigned long long, which can hold a maximum of over 18,446,744,000,000,000,000. (You’ll need to use %llu to read in/out unsigned long long variables) Also, always validate inputs, this would have hinted at the issue. if(scanf(“%d”, &a) < 1) { //if we read … Read more

[Solved] Unable to access variable in other class for text display [Unity]

You are never initializing the bask in GameManager.cs. public class GameManager : MonoBehaviour { Basket bask; public Text text_apple; // Use this for initialization void Start () { bask = GameObject.Find(“BaskNameInHierarchy”).GetComponent<Basket>() text_apple.text = bask.displayApple; //i want to call the method of displayApple to get the string returned. } } You can also make the bask … Read more

[Solved] How can I place two images within a UINavigationBar? [closed]

One way to do this is to use UINavigationItem.titleView and UINavigationItem.rightBarButtonItem. Like this : viewController.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”yourimage.png”]]; UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@”yourimage2.jpg”]]]; viewController.navigationItem.rightBarButtonItem = item; Here I am using UIImageView as custom view, but it can be UIButton with custom image. Check this: How to add image … Read more

[Solved] How to upload image and status to twitter using twitter4j

You need to use ImageUpload class in twitter4j. The below code describes a typical scenario for image upload with text. AccessToken accessToken = twitterSession.getAccessToken(); ConfigurationBuilder conf = new ConfigurationBuilder(); conf.setOAuthConsumerKey(twitter_consumer_key); conf.setOAuthConsumerSecret(twitter_secret_key); conf.setUseSSL(true); conf.setHttpReadTimeout(2400000); conf.setHttpStreamingReadTimeout(2400000); conf.setOAuthAccessToken(accessToken.getToken()); conf.setOAuthAccessTokenSecret(accessToken.getTokenSecret()); conf.setMediaProviderAPIKey(twitpic_api_key); Configuration configuration = conf.build(); OAuthAuthorization auth = new OAuthAuthorization(configuration); ImageUpload uploader = new ImageUploadFactory(configuration) .getInstance(auth); File photo=new File(“abc/myimage.png”); … Read more

[Solved] form_for [@parent, @child] causes undefined method `parent_child_path’ in Child#new

The thing about form_for is that its URL is based on the model that you passed in. In your case, it’s: <%= form_for [@user, @college] do |f| %> Rails automatically looks for user_college_profiles_path because you assigned User to @user, and current_user.college_profile to @college. Fortunately, Rails provides a way to override the default URL the form … Read more

[Solved] IBOutlet Array declaration [closed]

You probably need more practice with Xcode/Objective-C basics and idioms. Your approach is not valid (for instance, on iOS, we don’t loop (while(1)) to listen for events). Find some books, and you will be able to make your own soundboard soon. If you want to persist, here is some hints : Assuming you place manually … Read more

[Solved] Converting DateTime string in ddd MMM dd HH:mm:ss ‘EST’ yyyy format?

In my controller I do the following now. var startDateTZ = _startDate.Substring(20, 4); if (startDateTZ[3] == ‘ ‘) { startDateTZ = _startDate.Substring(20, 3); } if (startDateTZ.Length > 3) { if (startDateTZ[3] == ‘0’) { startDateTZ = _startDate.Substring(19, 4); } if (startDateTZ[3] == ‘2’) { startDateTZ = _startDate.Substring(19, 3); } } var startDate = new DateTime(); … Read more