In the below code, by hashCode() it seems 2 objects got created. Then although s1 == s3 is giving true, but why s1 == s4 is giving false ?  public class Main  {  public static void main(String[] args) {     String s1 = new String("jordi") ;     String s2 = s1.toUpperCase() ;     String s3 = s1.toLowerCase() ;     String s4 = new String("jordi") ;     System.out.println(s1.hashCode());     System.out.println(s2.hashCode());     System.out.println(s3.hashCode());     System.out.println(s4.hashCode());     System.out.println(s1==s2);     System.out.println(s1==s3);     System.out.println(s1==s4); }   }  This gives output as :     101312786      70775026      101312786      101312786      false      true      false
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?
Why didn't Elizabeth get cursed? Command and Conquer 3 exeption in exception handler I have command and conquer 3 from Origin, but when I try to start it, I get the 'exception in exception handler' error and the game exits.   I've tried the Origin launcher fix as well as -runver to make the game run a different version (although this just says that it can't find any version). I run Windows 10 (I know, experimental) but this game worked at one point, and then stopped working suddenly - there wasn't even an update in between.   I suspect that it's got to do with Origin, but any help would be appreciated. Induction Proof that $x^n-y^n=(x-y)(x^{n-1}+x^{n-2}y+\ldots+xy^{n-2}+y^{n-1})$ This question is from [Number Theory George E. Andrews 1-1 #3].     Prove that $$x^n-y^n=(x-y)(x^{n-1}+x^{n-2}y+\ldots+xy^{n-2}+y^{n-1}).$$   This problem is driving me crazy. $$x^n-y^n = (x-y)(x^{n-1}+x^{n-2}y+\dots +xy^{n-2}+y^{n-1)}$$  $(x^n-y^n)/(x-y) =$ the sum for the first $n$ numbers and then I added $(xy^{(n+1)-2}+y^{(n+1)-1})$ which should equal $(x^{n+1}-y^{n+1})/(x-y)$ but I can't figure it out    This is a similar problem in the book and I tried this method but it wasn't working out      $\quad$Thereom $\bf1$-$\bf2$: $\,\,\,\,$ If $\,x$ is any real number other than $1$, then $$\sum_{j=0}^{n-1}x^j=1+x+x^2+\ldots+x^{n-1}=\dfrac{x^n-1}{x-1}.$$    $\quad$Remark: $\displaystyle\sum_{j=0}^{n-1}A_j$ is shorthand for $A_0+A_1+A_2+\ldots+A_{n-1}.$     $\quad$Proof: Again we proceed by mathematical induction. If $n=1$ then $\displaystyle\sum_{j=0}^{1-1}x^j=x^0=1$ and $(x-1)/(x-1)=1$. Thus the theorem is true for $n=1$.  $\quad$ Assuming that $\displaystyle\sum_{j=0}^{k-1}x^j=(x^k-1)/(x-1)$, we find that $$ \eqalign{ \sum^{(k+1)-1}_ {j=0}x^j &amp; = \sum^{k-1}_ {j=0}x^j+x^k=\dfrac{x^k-1}{x-1}+x^k \\ &amp;= \dfrac{x^k-1+x^{k+1}-x^k}{x-1}\\ &amp;= \dfrac{x^{k+1}-1}{x-1}. }$$   Hence condition $(\rm ii)$ is fulfilled, and we have established the theorem.    $\quad$Corollary $\bf1$-$\bf1$: $\,\,$ If $\,m$ and $n$ are positive integers and if $m&gt;1$, then $n&lt;m^n.$ How many regenerations does the Doctor have after The Time of the Doctor? In The Time of the Doctor, the Doctor says that he has a "new regeneration cycle". Does this mean he has another set of 12 regenerations, or just the one? Incorrect whitespaces or list item size in Android SE app Noticed that sometimes when there are 10+ answers to a question - some answers look like they have \n\n...\n line breaks in the end, so the body of the answer has incorrect height.  It probably has something to do with ViewHolder or adapter not setting correct row height. Although as far as I know, it should do this according to text amount/length. I am considering attacks on Two-Key Triple-DES Encryption assuming $2^{32}$ known plaintext/ciphertext pairs (that's a mere 32 of ciphertext) by the method devised by Paul C. van Oorschot and Michael J. Wiener:  (in ), or another published method not requiring significantly more DES computations. As a synthetic information for decision makers, I am looking for an independent estimate of how much time this is expected to require, assuming all the RAM ever built by mankind to that day (of April 2012) was put to full use. Note: I'm purposely not asking when the attack could become feasible using all the RAM ever built by mankind, because estimates on the amount of RAM mankind will build, and when, are less falsifiable. Update: I am not considering cost; neither of RAM, power, logic including DES engines (as long as the number of DES operations remains within $2^{90}$). I am willing to assume that the amount of RAM used, and its effective speed, are the only factors to account for in determining the expected duration of the attack. This is similar to the hypothesis made by the authors of the linked paper, that their attack is limited by the amount (or cost) of RAM used, with all other factors of secondary importance. Update: sadly, nobody dared answer the question and the bounty period is over. Thus  is a first order answer to criticize. We have a system hosting many websites for our customers, and inside that system there is a method that non-live customers can view their sites before we turn them on.  Say the link is something like this: ourbigcompany.com/customer/domain=thisisanewsiteurl  Those links are not linked to anywhere outside a secure login - they are only sent to the customer via email. They are publicly viewable, as they have to be, but that's not the real problem.  The real problem is that somehow Bing is getting hold of them and trying to crawl the sites.   I know how to stop the crawling, but that would be like treating the symptoms without fixing the problem.  We log the traffic and there is no referrer - so that is not helpful.  If I change the querystring value for a site, Bing has it within hours. I need to figure out where Bing is getting the links from so that I can close what is obviously a security hole, but I am not sure how.   Any ideas on how to figure that out? How can I set the box plot (i.e. axis) ratio of a usual 2D plot to a given value, say 4:3.  I don't want to use unit vector ratio since the quantities of the independent and dependent variables are of completely different orders of magnitude. Do graduate schools care more about my grades in math courses or my general GPA? I'm currently a junior in mathematics at UIUC. I have been doing pretty well in my math courses (mostly A and A+). I will be completing a graduate course in topology, a second course in abstract algebra, and a complex analysis course before I graduate.  I feel that I can work hard to maintain good grades in my math courses, but my non-math courses are not that good (some B and C's).    Do graduate schools care more about my math courses grades more or my general GPA more?  Will poorer marks in non-math courses hurt my chances of getting into good grad schools? Backgrounder:  The  (Pointer to IMPLementation) is a technique for implementation hiding in which a public class wraps a structure or class that cannot be seen outside the library the public class is part of.  This hides internal implementation details and data from the user of the library.  When implementing this idiom why would you place the public methods on the pimpl class and not the public class since the public classes method implementations would be compiled into the library and the user only has the header file?  To illustrate, this code puts the Purr() implementation on the impl class and wraps it as well.  Why not implement Purr directly on the public class?  // header file: class Cat {     private:         class CatImpl;  // Not defined here         CatImpl *cat_;  // Handle      public:         Cat();            // Constructor         ~Cat();           // Destructor         // Other operations...         Purr(); };   // CPP file: #include "cat.h"  class Cat::CatImpl {     Purr(); ...     // The actual implementation can be anything };  Cat::Cat() {     cat_ = new CatImpl; }  Cat::~Cat() {     delete cat_; }  Cat::Purr(){ cat_-&gt;Purr(); } CatImpl::Purr(){    printf("purrrrrr"); } I typically have two needs:  Scenario A. Change a single PDF page.  In this case I have a PDF but not the original source file used to create the PDF. I don't want to try to recreate the document from scratch. I'd like to open the PDF and change a few things. A good example of this scenario: I was responsible for planning a big event at a campground site, I had a PDF of the site. I wanted to start with that document, highlight some parts, add some labels, remove some parts that weren't relevant.   or   Scenario B. Combine PDFs or extract page(s) from a PDF  This scenario usually arises because I want a single PDF deliverable that is made up of parts that are best created in different programs. In this case I have the source files for all the documents but they don't play well enough together to easily create a single PDF deliverable. For part of it, I may want to use Libre Office Writer. For another page I may want to use Gimp. Still another page I may use Libre Office Calc. I could use Writer as the master document and embed images or the Calc object into that, but for ultimate control, you can't beat separate PDF documents that are then combined.  What are the best tools / processes for editing PDFs in Ubuntu? Copy every 512 bytes and skip next 8 bytes from Input file to a Output file I have an input file which is always a multiple of 520 bytes . i,e Input file 1- 1040 bytes Input file 2- 5200 bytes   I need to copy every 512 bytes from input file and skip the next 8 bytes from input files to output file i.e Output file data = Copy first 512 bytes of input file - Skip 8 bytes - Copy second 512 bytes of input file- Skip 8 bytes --.. Therefore, my output file should always be multiple of 512 bytes Input file 1- 1040 bytes        Output file 1 - 1024 bytes Input file 2- 5200 bytes        Output file 2 - 5120 bytes  I need to do this in shell script, any help here please. What is object serialization? How to check if file exists on FTP before FtpWebRequest What happens to a Devil when its alignment is forcibly changed? According to PHB 122, in the section entitled Alignment in the Multiverse, for most creatures, "alignment is a moral choice." Myth says good-aligned gods created the races that are free to choose to be evil (they have free will), while evil-aligned gods created the races that are very inclined towards evil, since they were born to serve the evil god in the first place.  However, there are some types of creatures -- like devils -- which embody an alignment in its essence:     Alignment in the Multiverse, PHB 122      A devil does not choose to be lawful evil, and it doesn't tend toward lawful evil, but rather it is lawful evil in its essence. If it somehow ceased to be lawful evil, it would cease to be a devil.   My first thought was to not take this reading literally. The text could have meant that a neutral evil devil "isn't really a devil," but really, it's still a devil. It's a bit like imagining a guitarist who loses both hands. The loss of some part of a person's essence makes them not the same person anymore.  However, keeping my attention on it, I'm finding this text more and more difficult to interpret. If a devil "is lawful evil in its essence" then what does it mean when "it would cease to be a devil"? What happens to a devil when its alignment is forcibly changed?  There are , and a devil can be subject to some of them. Start ubuntu without a desktop environment but start an X application I want to do a small computer just for internet browsing. I dont want to load a desktop environment to keep RAM, CPU and GPU ussage as low as possible. The computer is going to run on a ARM CPU. I dont care with Distro I use, I thought about good old plain Debian. There are various methods to find installed applications on the system but to my knowledge none returns exactly the same list as control panel item Add Remove Programs. Some of the ways I tried are:   WMI via Win32_Product and Win32Reg_AddRemovePrograms Registry, both x32 and x64 branches   For instance, I have 217 entries in AR and   gwmi  Win32_Product   returns 261 items.  gp HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | ? {![string]::IsNullOrWhiteSpace($_.DisplayName) } | select DisplayName   returns 119 items.   (gwmi Win32Reg_AddRemovePrograms) + (gwmi Win32Reg_AddRemovePrograms64) | sort DisplayName -Unique    returns 107 items.  I tried to nail it down with more complex filter that included InstallLocation, InstallSource, InstallDate etc without success. Prove or disprove that $f(x) = \sin x/x$ is uniformly continuous over the interval $(0,1)$? I am thinking of $\lim_{x \to 0} \ {f(x)} = 1$ but I am confused as $x=0$ is not in the domain and also I want to write an $\epsilon$-$\delta$ proof. So any help is much appreciated!  Thanks! How can I find out what is using the hard disk? Possible Duplicates:             Once or twice a day my computer starts writing significantly hard to the hard drive, the HD led is ON and the performance hit is noticeable. A strange observation is that the Task Viewer does not show I/O activity - even Process Explorer shows no CPU activity and no I/O bytes read or written.  Is there a way to know which application is using the hard drive and how much data is it reading or writing? From a paper via Schneier on Security's  (emphasis mine):  In the case of AES-128, there is no known attack which is faster than the 2128 complexity of exhaustive search. However, AES-192 and AES-256 were recently shown to be breakable by attacks which require 2176 and 2119 time, respectively. While these complexities are much faster than exhaustive search, they are completely non-practical, and do not seem to pose any real threat to the security of AES-based systems. In this paper we describe several attacks which can break with practical complexity variants of AES-256 whose number of rounds are comparable to that of AES-128.  Is the implication here that AES-192 is stronger than AES-256? If so, in simple terms, how is that possible?  The attack exploits the fact that the key schedule for 256-bit version is pretty lousy -- something we pointed out in our 2000 paper -- but doesn't extend to AES with a 128-bit key.  Again, in simple terms, what does that mean? In practice, does this mean I should drop AES-256 in favor of its 128-bit counterpart, like Schneier recommends in the comments?  That being said, the key schedule for AES-256 is very poor. I would recommend that people use AES-128 and not AES-256.