This is my code, here when i input the  Product name i.e. Laptop/Mobile and then input the price. after that the program does not input eask and simply goes to the eask if-else case and prints the Invalid option as:  import java.util.*;     class Main {           public static void main(String[] args) {             int discount=0,ediscount=1;             Scanner sc = new Scanner(System.in);             String Product = sc.nextLine();             int Price = sc.nextInt();             String eask = sc.nextLine();                      if(Price&gt;100){               if(eask == &quot;Yes&quot; || eask == &quot;No&quot;){                 if(Product == &quot;Mobile&quot;){                 discount = 10;                 if(eask == &quot;Yes&quot;)                   ediscount=12;               }               else if(Product == &quot;Laptop&quot;){                 discount = 20;                 if(eask == &quot;Yes&quot;)                   ediscount=10;               }               else if(Product == &quot;gadgets&quot;){                 discount = 0;                 if(eask == &quot;Yes&quot;)                   ediscount=0;               }               else System.out.println(&quot;Invalid product&quot;);               }               else                 System.out.println(&quot;Invalid option&quot;);             }             else System.out.println(&quot;Invalid price&quot;);                      float TBA = discount * Price;             System.out.println(TBA);           }        }
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
Need clarification on the Draw 4 rule. - Player 1 lays down a Draw 4 Card and says the color is Red. - Player 2 does not have a Red card but has a Draw 4 Card. Can Player 2 lay down his Draw 4 Card and have Player 3 draw 8 cards? Is there an optimal setting for the number of CPU cores exposed to a VM? VirtualBox, and possibly other VM software, allows the user to specify the number of CPUs exposed to the VM. In my particular case, I have a dual core CPU, with Windows 7 64-bit running natively, and Ubuntu 9.04 64-bit as the VM.  The help file suggests not setting this above the number of physical cores available. This makes sense. So, is it best allocating 1 or 2 CPU cores? Does this depend entirely on the native CPU load? Preparing for metric dominance: alternatives to idioms using imperial units Related to , are there any metric alternatives to these idioms:        He inches closer to her.   a. meters? - too far   b. centimeters? - too weird   c. scoots? - don't use units     By then, she was miles away from him.   a. far away? - again, don't use units   b. kilometers away? - maybe   c. light-years away? - probably better, preserving the hyperbole     This is an amazing foot-long sandwich.   a. half-a-meter-long? - not accurate   b. dong-long? - even less accurate. It rhymes, though   c. about-a-third-of-a-meter-long? - pretty accurate, but not very marketable     I went the whole nine yards.   a. the whole 8.23 meters? - ...No   b. all the way? - again, don't use units   An ounce of common sense is worth a pound of theory.   a. A gram/a tonne? - preserve the weight comparison, but even more hyperbolic   b. A little/a lot? - again, don't use units        Any suggestions? I mean, I've never seen any idioms using obsolete units like ,  or , but I'm sure there were some when they were in common usage. There's a spaceship, nearing the end of its journey. Everybody on board is in cryosleep. For some reason the wake-up system malfunctions, and the ship will fly on indefinitely. The people at the space port realise this, and try to wake someone up. Their last resort is finding someone on board who is telepathic, and wake this person up. They find one, but it turns out to be an unborn baby. Divisibility by 7 rule, and Congruence Arithmetic Laws For any smooth manifold, is it true that for any two points on the manifold, there exists a chart that covers the two points? JSonNet boolean serialization How do you turn off developer mode on an s5? I turned developer options 'off', but is there anything else that needs to be done? Not my phone so don't want to mess anything up :-) Replacing a font in many illustrator files I have several hundred Illustrator files that are formatted similarly, and for legal reasons I need to replace a font in all of them. Even with the 'Find font' tool, that's a hell of a lot of fonts to replace by hand.  Is there some way of automating it? For example, using Bridge? Illustrator (CS5) doesn't offer many options in Bridge, compared to the automation options offered by Photoshop. I also don't see any option for running actions on multiple Illustrator files.  Also, creating a repeatable action for replacing the font doesn't seem to work: instead of repeating my action, it brings up the dialog box an waits for me to tell it to replace them.  As a programmer I'm prepared to edit the files directly if it can be done without breaking them.    Update: The 'Batch...' menu item from Illustrator's actions panel menu allows the same action to be performed on a folder of files. It doesn't fix the Find Fonts action waiting for input though. Toggling the dialog off makes the action do nothing at all. When you have a link from lets say twitter that is t.co/foo that links back to your website how does that effect SEO and how do the major search engines handle Shortened URLs? Don't include SE site in SE search filter? I couldn't find this question here, but I would like to be able to search all sites in the SE network except some sites. In my case, I want to remove the thousands of results from SO on a popular project for devs so I can see the handful of results on other sites from admins and users.  The current form only allows all sites or listed sites.  The answer linked does not tell me how to use the information in the answer. It is a poor answer for an average user.  As @Laurel describes in the comment below, the answer at  no longer works. Existence of subgroup of order six in $A_4$ Show that  the  alternating  group  $A_4$  of all even permutations of $S_4$ does not contain a  subgroup of order $6$.   For me am thinking to write all elements of $A_4$ and trying to find every cyclic subgroup generated by each element of $A_4$, then I have to check whether there exist such a subgroup or not! This is a long procedure for me, I ask if there is a short way to do this. Additional needed documents for UK trip if someone will shoulder all expenses Someone (a relative) from the UK (already a naturalized British Citizen) will be financing my trip, as well as taking care of my accommodation. What are the documents I need to submit aside from bank statements? Does the sponsor need to fill-out the Sponsorship Undertaking Form? ()  something to consider from my question: -my relative is a naturalized citizen in the UK. Is proof of naturalization needed? Change ViewPager animation duration when sliding programmatically I'd like to make links to all files in a directory tree. Which means, create the same directory structure and make the links in them to the respective subdirectory in the original dir.  That could be done with   cp -R -s ../foo .   But - that needs an absolute path. So rather  cp -R -s `readlink -e ../foo` `readlink -e .`   I would like the resulting links to be relative.  How would I do that? Select Input Texture file name as parameter/node Please provide a mobile-optimized captcha page How to remove version and thank you message from the admin footer I've used following codes and no luck  1  //Hide admin footer from admin function change_footer_admin () {     return ' '; } add_filter('admin_footer_text', 'change_footer_admin', 9999);  function change_footer_version() {     return ' '; } add_filter( 'update_footer', 'change_footer_version', 9999);   2  function wpbeginner_remove_version() { return ''; } add_filter('the_generator', 'wpbeginner_remove_version');   3  function my_footer_shh() {     remove_filter( 'update_footer', 'core_update_footer' );  } add_action( 'admin_menu', 'my_footer_shh' );   Still I see those texts and version on my footer.   So what is the accurate way to remove these? I've added these code snippets into my child theme function.php How to run grep and show x number of lines before and after the match grep returns just the line where it matched the regex and often what I want to really see is a few (say 2) lines above and below the matched one. Is there a simple way to achieve it?  EDIT: OS: Ubuntu based Bodhi Linux.  As mentioned in comments, -C does not work in vanilla but its GNU grep in my case. I have been wondering about the differences between model paramters and model hyperparameters, as well as what their categorization means for a learning problem.  Is the distinction between model parameters and hyperparameters only about reducing the complexity of the problem or are there implications for the 'model quality' to be considered?  Let's consider an example from (1, Eq. 2.43), a linear expansion of basis functions   $$f_\theta(x) = \sum_{m=1}^{M} \theta_m h_m(x), $$  where $h_m\:\forall m=1,...,M$ is some function of $x$, $\theta=[\theta_1,...,\theta_M]^\intercal$ is a vector of the parameters of the model and $M$ is the number of basis functions.   In my understanding, we would consider $\theta$ to contain the parameters of the model, while $M$ is a .  To quote the Wikipedia article of hyperparameter that I linked above:     In machine learning, a hyperparameter is a parameter whose value is   set before the learning process begins. By contrast, the values of   other parameters are derived via training.   It makes sense treating the values in $\theta$ as parameters that should be learned from the data, similar to the coefficients in a linear model - it is surely far more reliable  and  specifying them manually would be quite annoying, although it's not impossible. But what about $M$? It surely is easier to pick some integer value for it. But would it really be terrible to determine $M$ based on the data, too? Probably not, as that is what we would do if we search a grid of possible values for the best performing one.   Let's consider the above basis expansion model and choose Gaussian kernel functions to serve as basis functions. As the Kernel itself has parameters too  this makes the problem a bit more complicated.  $$f_\theta(x) = \sum_{m=1}^{M}\theta_m K_{\lambda_m}(\mu_m,x), $$ with $\mu_1,...,\mu_m$ being the location of the kernels and $\lambda_1,...,\lambda_m$ their scales/bandwidths.  Friedman et al. write in (1, p. 36)        "In general we would like the data to dictate them as well. Including   these as parameters changes the regression problem from a   straightforward linear problem to a combinatorially hard nonlinear   problem. In practice, shortcuts such as greedy algorithms or two stage processes are used."   I see that if we were to treat $M$, $\theta_1 ... \theta_M$, $\mu_1 ... \mu_M$ and $\lambda_1 ... \lambda_M$, as model parameters, this problem would be really complex, especially with the choice of $M$ determining the number of the other parameters. But what if we simplify the model definition - let us for example use the same scale/bandwidth for each kernel, that gives us only one parameter $\lambda$. Furthermore, let's say we specify $\mu_1 ... \mu_M$ based on some heuristic, which would mean we treat it as a hyperparameter.  This gives us   $$f_{\theta,\lambda}(x) = \sum_{m=1}^{M}\theta_m K_\lambda(\mu_m,x), $$  Besides increased complexity of the involved optimization problem, does treating $\lambda$ as a parameter rather than a hyperparameter have other negative or undesired effects?      (1) Friedman, Jerome, Trevor Hastie, and Robert Tibshirani. The   elements of statistical learning. Vol. 1. No. 10. New York: Springer   series in statistics, 2001.