How do I ensure two different instances of a class have the same hash code? So when one of them is in a HashSet, the Contains function returns true.  Here is my code:  public class Position  {      public int row, col;      public override bool Equals(object obj)      {          return ((Position)obj).row == row &amp;&amp; ((Position)obj).col == col;      }  }   And here is how I use it:  HashSet&lt;Position&gt; hash = new HashSet&lt;Position&gt;(); Position position = new Position(3, 1); Position position2 = new Position(3, 1); hash.Add(position); Console.WriteLine(hash.Contains(position2));
Given the following class  public class Foo {     public int FooId { get; set; }     public string FooName { get; set; }      public override bool Equals(object obj)     {         Foo fooItem = obj as Foo;          if (fooItem == null)          {            return false;         }          return fooItem.FooId == this.FooId;     }      public override int GetHashCode()     {         // Which is preferred?          return base.GetHashCode();          //return this.FooId.GetHashCode();     } }   I have overridden the Equals method because Foo represent a row for the Foos table.  Which is the preferred method for overriding the GetHashCode?  Why is it important to override GetHashCode?
How to prove $\,x^a-1 \mid x^b-1 \iff a\mid b$ Some text lines are italicized with no spaces between words Drupal SA-CORE-2014-005 - How to tell if my server / sites were compromised? I just updated all my sites using the patch method of resolving the Drupal SA-CORE-2014-005 exploit. I just read reports that just yesterday there is someone from a Russian IP infiltrating drupal sites.     My main concerns are now:   How do I tell if my sites have been comprised? What should I search for in my apache access logs to detect if my site was a victim or not? So far what are these hackers doing to comprised sites? If I've decided to update my SE avatar (in any of the various ways well described in the answer to this ), am I able to return to either the original stock image or previous avatar images I have used? Compare means of group with a mean of a subgroup Self adjoint operators and trace class property This is a variation of the  questioned some time ago.  For a complex Hilbert space $H$ let $T: H \rightarrow H$ be a bounded operator. We call that $T$ is a trace-class operator if the following sum  $$\sum_{i}{\langle |T|e_{i}, e_{i} \rangle} &lt; \infty$$  converges, where $|T| = (T T^{*})^{\frac{1}{2}}$ is the absolute value of the operator.  Assume that  $$\sum_{i}{\langle Te_{i}, e_{i} \rangle}$$  converges for any basis in the space $H$. How to prove that if the aformentioned property holds then the operator is a trace class operator?  The progress on the problem is the following: Given an arbitrary bounded operator $T: H \rightarrow H$, one can use the following decomposition $$T = \big( \frac{T + T^{*}}{2} \big) ^{*} + i \big( \frac{T^{*} - T}{2i} \big) ^{*}$$  The latter line gives the decomposition $$T = A + i B$$ where $A, B$ are normal operators.  For the normal operators we can apply the spectral theorem that proposes that $T$ is unitary equivalent to  $$(UT U^{-1})(f(x)) = g(x) f(x)$$  where  $$U: H \rightarrow L^{2}(X, \mu)$$ $$g \in L^{\infty}(X, \mu)$$  Though this decomposition classify the operator in a broad sence, i see no direct way to conclude the statement. Are the any hints that may extend the previous argument? If not, are there any ways to conclude the statement? Finite ring has only zero divisors and units If a nonzero element $a$ of a ring $\mathbb{D}$ does not have a multiplicative inverse, then $a$ must be a zero divisor.   If $\mathbb{D}$ has finitely many elements, then the statement is true. However, I don't see why, as for the infinite case, 7 isn't a zero divisor only because every element $a &gt; 0$ when multiplied by a $b &gt; 0$ gives you $ab &gt; 0$ which has nothing to do with infinity or finite amounts of elements. why does loop-cut-and-slide ignore some faces but not others? I can't think of a decent reason to allow editing audit messages (like  or ). I have abused it for fun before but it really has no purpose other than joking or obfuscating your actions. For that I think that such messages should be untouchable. Please make them so. If I run:  sudo apt-get --yes install postfix    or  sudo bash -c 'yes | apt-get --yes install postfix'   an interactive prompt appears to configure postfix. I need to automate the installation of postfix (I can modify the configuration files after the install).  Is there some magic that lets me install postfix (and other package) without human intervention? Why would a JavaScript variable start with a dollar sign? Does decrease in temperature affect mass $E=mc^2$? My understanding of Quantum physics and String Theory is very basic and I don't yet have a grasp on the maths, but in my research I have come up with a question.  Does a decrease in temperature also signify/create a decrease in mass?  I am quite willing to believe the concepts I think I am beginning to understand are totally misconceptions on my part.  But, as I see it mass is a product/mark of disruption to the Higgs field as a particle moves.  If these particles are ultimately composed of vibrating Strings, their mass is given by the rate at which they vibrate and how it interacts with the Higgs field.  I don't have any idea if, as the temperature (as we know it) approaches 0k, the string/quark/sparticle would change its state in any way or if the changing of the state of the String would change what type of particle it represents.  It seems I'm more full of questions than answers, but that's why I love these topics!  I know what I'm learning is new if the best and brightest are still working on the 'basics' to just make their systems work :). How to revert an update? The latest xorg update was a big regression for me on a dual display setup. Is there a simple way to revert to the previous version?  I'm on Lucid Lynx. I am new and struggling with java and I need assistance with code. Value keeps resetting to default Let $f$ be an analytic isomorphism on the unit disc $D$, find the area of $f(D)$ Let $f$ have power series $f(z) = \sum_{n=1}^\infty a_n z^n$ in $D$, then prove that   $\mathrm{area}\, f(D) = \sum_{n=1}^\infty n \,|a_n|^2$.  Note: We define $\mathrm{area}\, S = \iint_S \mathrm{d}x\,\mathrm{d}y$.  I presume the way to do this is to take the integral $$\iint_{f(D)} \mathrm{d}x\,\mathrm{d}y = \iint_D \mathbf{J}_f (x+iy) \,\mathrm{d}x\,\mathrm{d}y = \int_0^1 \int_0^{2\pi} r \mathbf{J}_f (r e^{i \theta}) \mathrm{d}\theta\,\mathrm{d}r,$$ and letting $\gamma_r : [0,2\pi]\to\Bbb{C}, \,\gamma_r (\theta) = r e^{i\theta},\, \gamma_r '(\theta) = i\gamma_r (\theta),$ then we get $$\mathrm{area}\,f(D) = \int_0^1 \int_{\gamma_r}\frac{\lvert f'(z)\rvert^2 \bar{z}}{ir}\mathrm{d}z\,\mathrm{d}r.$$ Unfortunately, this approach seems to be a dead end. I think I'm meant to use Cauchy's Formula somewhere, but I can't see where that might be useful in this kind of question. Is 512 bits a more secure hashing than 256 bits? I am looking for a way to add some string to the beginning of every line (same string for every line). Not something customizable but rather something that will be easy to remember and available on every POSIX-compliant platform (and every shell as well). I want to say "someone (or something) intends to help, but instead it makes things worse". Is there any succinct expression or phrase for this?  Thanks. How to create a filter in Gmail to identify messages forwarded from Zimbra? Change how questions marked as duplicates by the asker are represented Situation: when a user self-marks their post as a duplicate, it shows as closed by "community" rather than the original poster.  Problems: this is not clear at all to most users of SE what has happened. It looks like the question was "mod closed" as a duplicate against the asker's wishes.    Suggestion: instead of the community user "closing" the post, have the final close user be the asker (or make it "Community &amp; Asker"). This will help clear up confusion and streamline the process for understanding what happens.