hash code HashMap I am trying to learn Java. The Eric Roberts text, "The Art and Science of Java" has a programming assignment where we simulate a flight booking console. I wanted to 'class it up' by using a City class where just a City String would do. It only has one field, name, which is a String, but I am trying to learn how to use classes.  Anyway, so then I had to override the equals method in the City class to avoid getting duplicates. So then I had to override the hashCode method.  Now my HashMap&lt;City,ArrayList&lt;Flight&gt;&gt; isn't working. It can't find certain values and it still permits duplicate keys.  My City equals and hashCode overrides are as follows. Can anybody see why my HashMap is going wrong?  /* (non-Javadoc)  * @see java.lang.Object#equals(java.lang.Object)  */ @Override public boolean equals(Object that) {     // TODO Auto-generated method stub     if ( this == that ) return true;     if ( !( that instanceof City) ) return false;     City aThat = (City) that;     return (name == aThat.name ); }  @Override public int hashCode() {     // TODO Auto-generated method stub     return name.hashCode(); }
How do I compare strings in Java? 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?
Please require more reviewers on First Posts On the one hand, I see very few posts in the review queue when I visit.  On the other hand, I see a lot of pretty awful first posts sitting on the front page.  This leads me to suspect that robo-reviewers are blowing through the queue.  Given how empty the queue is, could you please increase the number of people who have to check in before a post leaves the queue?  Of course, some honey-pot solution to detect and disable the auto-clickers would be even better. Is there a way to summon Dogmeat to you? I've recently started playing Fallout 4, and I've acquired Dogmeat. Long story short, I told him to stay in a small building so I could down a few raiders quietly but I forgot about him and I can't find him. Is there a way to call Dogmeat back or do I have to retrace my steps until I'm reunited with him? I need another LP-E5 type battery for my Canon 450D. Should I buy an original Canon battery or one of the many generic brands available? There are loads of cheapos on , for example.  I should add that the new battery will be added to my existing Canon battery in a battery grip.  Does anyone have any experience (good or bad) of using generic batteries? Sharing a Bluetooth Keyboard and Mouse sequentially between two Macs How do I make money efficiently? In Oblivion, I had two favorite money-makers:   Dump all my stuff except some basic armor and potions, and raid an oblivion tower. The armor and weapons was worth lots, and selling it in Anvil made a lot of cash fast. Harvest an entire farm's worth of crops, create 'restore fatigue' potions and sell them.   Skyrim seems to spoil this:   Merchants have a max-amount per day/QOD/... instead of per item You can't carry as much (or maybe I have yet to discover the strength/feather spells) Alchemy is a lot harder (most common items go into food recipes now, which don't sell for those prices) On top of that, once a dungeon is cleared, it doesn't respawn - so no 'farming' familiar dungeons?   What are some easy/repeatable money making methods in Skyrim? Which are most efficient effortwise/real-life-time wise? Providing command key-value arguments with commas in value When using commands that allow using key-value pairs, how can one provide an argument value that has commas in it? As an example, say I'm using the \newacronym command from the glossaries package as below:  \newacronym[firstplural = Alphas, Bravos, and Charlies (ABCs), plural = ABCs]{ABC}{ABC}{Alpha, Bravo, Charlie}   Unfortunately, the comma is used to separate key-value pairs so the Bravos, and Charlies (ABCs) portion doesn't get parsed correctly. Is there a way to overcome this? Why do we need sigma-algebras to define probability spaces? Rogue DHCP Server Can't be found Over the last 3-4 weeks I have been trying to find a rogue DHCP server on my network but have been stumped! It is offering IP Addresses that do not work with my network, so any device that needs a Dynamic Address is getting one from the Rogue DHCP and then that device stops working. I need help to find and destroy this thing! I think it might be a Trojan of some sort.  My Main Router is the only valid DHCP Server and is 192.168.0.1 which offers a range of 192.160.0.150-199, and I have this configured in my AD as Authorized. This ROGUE DHCP claims to be coming from 192.168.0.20 and offering an IP Address in the range of 10.255.255.* which is messing up EVERYTHING on my network unless I assign a static IP Address to it. 192.168.0.20 does not exist on my network.  My network is a single AD Server on Windows 2008R2, 3 other physical servers (1-2008R2 and 2 2012R2) about 4 Hypervisor VM's, 3 laptops and a Windows 7 box.  I can't ping the rogue 192.160.0.20 IP, and I can't see it in the ARP -A output, so I can't get its MAC address. I'm hoping that someone reading this post has come across this before. Why is it dangerous to initialize weights with zeros? Is there any simple example that demonstrates it? How to learn physics effectively and efficiently How to logout an user from the connected app? NOTE: I am not interested in calling /secur/logout.jsp since it ends all the active salesforce sessions.  I am developing a web application that is registered on salesforce as a connected app, so I am using salesforce credentials to authorize the user.  Application is developed in REST API and the communication with salesforce is happening in restful manner.   Auth url:   Authorization:  Method 1: If there is no salesforce session active, The user is taken to salesforce login page, where he enters his salesforce details to be authorized and after which he is taken to home page of my web application.  Method 2: If there is already a salesforce session active in another tab, the user is directly authorized and is taken to home page of my web application.  Now I am trying to implement logout button for my application, such that the following scenarios are covered,  Scene 1: The user is authorized using method1, and the user press the logout. Upon trying to logback the user is prompted for credentials.  Scene 2:  The user is authorized using method2, and the user should use logout to logout of the web application (not from active sessions). Upon login, the user should be again able to login using method2.  Can someone help me on how to implement the logout button such that it covers scenario 1 &amp; 2.  Thanks in advance. Windows 2008 R2 Standard server - how to disable RC4 I have just used www.ssllabs.com and ran a few tests - my server is capped to a B grade because my server accepts RC4     This server accepts the RC4 cipher, which is weak. Grade capped to B.   I've researched and found that to disable RC4 I need to add 3 keys, and set their enabled dword to 0  and   I have done this for RC4 40/128, RC 56/128 and RC4 64/128  I then restarted my server. When the server was up again, I verified the Registry Changes were done, and they are - all 3 exist and all 3 have their enabled value set to 0.  I return to ssllabs, clear the cache, re-run the test and it returns the same result (capped to B due to RC4 being enabled).   At this stage, I'm not sure what this means - if SSLLabs showing incorrect results (I'm going to assume not), have I disabled RC 4.  How can I tell if I have successfully disabled RC4  Edit  I also saw the KB about this  so trying now... I've done the same registry changes but, when I try to download the 64 bit version for W2008 R2 Standard, it fails to install with error message     The update is not applicable to your computer I was rewatching the Breaking Bad episode S04E08 (Hermanos) and I didn't quite understand why exactly Don Eladio killed Gus's partner, but he let Gus live. He says:     The only reason you're alive and he's not, is because I know who you are.   But I still have yet to fully understand. Formation of supermassive black holes Scientists have found very bright source of light which they call  and the are found to be . So these black holes are so massive that they cannot be formed by a supernova. So how are these formed? When I studied Bayesian statistics, a question about the notation of Bayes' Theorem came to my mind. Below is the density function version of Bayes' Theorem, where $y$ is data vector and $\theta$ is the parameter vector:  $$ p(\theta|y)=\frac{p(y|\theta)p(\theta)}{p(y)} $$ The numerator on the right handside can be written as: $$ p(y,\theta) $$ which is the joint probability distribution of $y$ and $\theta$, then Bayes' theorem could be written as: $$ p(\theta|y)=\frac{p(y,\theta)}{p(y)} $$ Furthermore, $$  p(\theta|y)\propto p(y,\theta) $$ Am I right on this? I think it does not look right. Because the posterior is the proportional to the joint density function. But where is the mistake? Is there a standard idiom for comparing version numbers?  I can't just use a straight String compareTo because I don't know yet what the maximum number of point releases there will be.  I need to compare the versions and have the following hold true:  1.0 &lt; 1.1 1.0.1 &lt; 1.1 1.9 &lt; 1.10 Finding the search terms behind 'not provided' Using awk to sum the values of a column, based on the values of another column I am trying to sum certain numbers in a column using awk. I would like to sum just column 3 of the "smiths" to get a total of 212. I can sum the whole column using awk but not just the "smiths". I have:  awk 'BEGIN {FS = "|"} ; {sum+=$3} END {print sum}' filename.txt   Also I am using putty. Thank you for any help.  smiths|Login|2 olivert|Login|10 denniss|Payroll|100 smiths|Time|200 smiths|Logout|10 biblatex: How to omit "p." at \cite? View referrals from one part of my site to another in Google Analytics I have an online shop with a blog structured this way:   Shop: example.com Blog: example.com/blog   Both index have the same Google Analytic Code (UA). In the blog I write articles about some products with a link to the product page.  Now the problem is, I want to see stat on visits whose referral links have this pattern example.com/blog/*.