java hashcode and equals Create the hashCode and equals method for the following class.  private static class MyOb {      private String name;     private Integer quality;     private final int MAXIMUM = 23;  }   I could not solve this question
What issues should be considered when overriding equals and hashCode in Java? What issues / pitfalls must be considered when overriding equals and hashCode?
In PHP, function parameters can be passed by reference by prepending an ampersand to the parameter in the function declaration, like so:  function foo(&amp;$bar) {     // ... }   Now, I am aware that this is not designed to improve performance, but to allow functions to change variables that are normally out of their scope.  Instead, PHP seems to use Copy On Write to avoid copying objects (and maybe also arrays) until they are changed. So, for functions that do not change their parameters, the effect should be the same as if you had passed them by reference.  However, I was wondering if the Copy On Write logic maybe is shortcircuited on pass-by-reference and whether that has any performance impact.  ETA: To be sure, I assume that it's not faster, and I am well aware that this is not what references are for. So I think my own guesses are quite good, I'm just looking for an answer from someone who really knows what's definitely happening under the hood. In five years of PHP development, I've always found it hard to get quality information on PHP internals short from reading the source. Continuously invertible operators How to hide title bar in Firefox 57 Quantum? I used to use an extension to hide/show the title bar in Firefox, but since Firefox 57 was released most of the extensions were disabled.  In Chrome I just uncheck the option "Use system title bar and borders" and it's done.  Are there any ways to do that? Two particles with initial positions and velocities $r_1,v_1$ and $r_2,v_2$ are interacting by the inverse square law (with G=1), so that  $$ {d^2r_1\over dt^2} = - { m_2(r_1-r_2)\over |r_1-r_2|^3} $$ $$ {d^2r_2\over dt^2} = - { m_1(r_2-r_1)\over |r_1-r_2|^3} $$  (the inverse square law along the line of separation). What is the complete solution of these differential equations? What is the position of the two objects as a function of time?  After reading a lot on Wikipedia, I've come to the definition of center of mass and relative coordinates:   $$R(t) ~=~ \frac{m_1 r_1 + m_2 r_2}{m_1+m_2}$$  $$\ddot{r}(t) r(t)^2 ~=~ (m_1+m_2)G$$  Where $R$ is the center of mass, and $r$ is the displacement between the particles... Is this correct? How do I proceed to solve the differential equation? What is the structure in "as best you can"? I instinctively translate it "as best as you can", however this makes no sense.  What is the real structure behind this phrase?  I'll include an  to illustrate the historical presence of this phrase:    Whatever the structure is, I'm guessing that it has something to do with 19th century grammar. How to delete OS from boot menu After installing fedora and Centos and other OS now I have them all showing in my Boot menu [F2] on start up not the menu form the OS even after deleting them and reinstaling other OS - Ubuntu -so It just shows one when the OS starts but when I go to UEFI setting I still find all the old ones they instruct you to use DEL to take them out but that does not work In Shakespeare's Macbeth, the Third Witch says to Banquo: "Thou shalt get kings, though thou be none" (1.3.65); if I want to quote that line and write it in the third person singular, how should I conjugate the verbs "shall" and "be" correctly? What is the lowest level of mathematics required in order to understand how encryption algorithms work? What mathematical fields of knowledge would be required in order to get a good understanding of encryption algorithms?   Is it basic algebra, or is there a "higher education" mathematical field dedicated to encryption? I know there is the cryptography field, but what is the subset of knowledge required for cryptographers? How to upgrade only core with drush? Function to determine if two numbers are nearly equal when rounded to n significant decimal digits I have been asked to test a library provided by a 3rd party. The library is known to be accurate to n significant figures. Any less-significant errors can safely be ignored. I want to write a function to help me compare the results:  def nearlyequal( a, b, sigfig=5 ):   The purpose of this function is to determine if two floating-point numbers (a and b) are approximately equal. The function will return True if a==b (exact match) or if a and b have the same value when rounded to sigfig significant-figures when written in decimal.   Can anybody suggest a good implementation? I've written a mini unit-test. Unless you can see a bug in my tests then a good implementation should pass the following:  assert nearlyequal(1, 1, 5)  assert nearlyequal(1.0, 1.0, 5)  assert nearlyequal(1.0, 1.0, 5)  assert nearlyequal(-1e-9, 1e-9, 5)  assert nearlyequal(1e9, 1e9 + 1 , 5)  assert not nearlyequal( 1e4, 1e4 + 1, 5)  assert nearlyequal( 0.0, 1e-15, 5 )  assert not nearlyequal( 0.0, 1e-4, 6 )    Additional notes:   Values a and b might be of type int, float or numpy.float64. Values a and b will always be of the same type. It's vital that conversion does not introduce additional error into the function. Lets keep this numerical, so functions that convert to strings or use non-mathematical tricks are not ideal. This program will be audited by somebody who is a mathematician who will want to be able to prove that the function does what it is supposed to do. Speed... I've got to compare a lot of numbers so the faster the better. I've got numpy, scipy and the standard-library. Anything else will be hard for me to get, especially for such a small part of the project. Limits involving factorials $\lim_{N\to\infty} \frac{N!}{(N-k)!N^{k}}$ I am trying to calculate the following limit  $$\lim_{N\to\infty} \frac{N!}{(N-k)!N^{k}}$$ where $k$ can be any number between $0$ and $N$.  I thought of the following:  If I take the logarithm of the expression then I get:  $$\lim_{N\to\infty} \left(\log(N!)-\log((N-k)!)-k\log N\right)$$    Using the Stirling formula this can be approximated as:  $$\lim_{N\to\infty} \left(N\log(N)-(N-k)\log(N-k)-k\log N\right)$$  Now there are two cases: If $k$ is $N$, then the second term vanishes and the remaining terms cancel. If $k$ is smaller than $N$, then I can drop the $k$ inside the second logarithm and all the terms cancel. So the limit $$\lim_{N\to\infty} \log\left(\frac{N!}{(N-k)!N^{k}}\right)=0$$ Which means that: $$\lim_{N\to\infty} \frac{N!}{(N-k)!N^{k}}=1$$ I don't know if this is mathematically rigorous. Would like some help. Thanks Making voltmeter accepting bipolar input voltage, using a microcontroller I want to build a very simple voltmeter using ATMEGA328 ADC. I can successfully measure up to 20v (using a voltage divider), but the problem is, I don't understand how to measure the voltage properly, if negative and positive terminals are switched.   Only way I could think of is adding another ADC input which is responsible for measuring the 'inverted voltage'. The join both ADC inputs, but add diodes in between, so one channel works with (+-) and the other channel works with (-+) and then 'merge' the input from both channels using code. Then I should be able to measure things like sin wave for example (where polarities switch).   Is the concept correct or is there a better way to do this? Thanks! Recently I decided to use only Ubuntu and there is no Windows in my laptop. When I turn on my laptop the GRUB menu is showing but I don't need to choose OS anymore.   How can I remove or hide this? And after removing this how could I access to recovery mode? I'm new at Linux and I just download Ubuntu 12.04 LTS.  I found a spot that showed me how join my Windows Active Directory.  It has me add couple lines into the 'hosts' but I'm not able to edit the file because I do not have the permission.  I'm not the owner.  I use chmod with it rwx and still it will not let edit the file.  How do you change the permission?  Thanks How many times to roll a die before getting two consecutive sixes? Basically, on average, how many times do you have to roll a fair six-sided die before getting two consecutive sixes? double perpendicular symbol (for independence) I found from  that I could use the independence symbol:     \newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}} \def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}    I was wondering how this works. Can anybody explain? I don't know the commands mathpalette, rlap, and mkern2mu. Good review audit has "possible spam" warning? I was looking through someone's edit history and I was looking at :    Why does it give this notice, while at the same time saying that it's a high-quality post? $f:\mathbb R \to \mathbb R$ be a continuous such that $f(f(f(x)))=x,\forall x \in \mathbb R$ , is $f(x)=x , \forall x \in \mathbb R$? Let $f:\mathbb R \to \mathbb R$ be a continuous function such that $f(f(f(x)))=x,\forall x \in \mathbb R$ , then is it true that $f(x)=x , \forall x \in \mathbb R$ ? I can see that $f$ is bijective , hence strictly monotone . But I cannot progress further . Please help. Thanks in advance I am writing my thesis,  and i am in restructuring phase - sorting theorems where they should belong thematically. And it would be helpful to have all the proofs hidden so i am not laden with the additional information.  Is it possible to add something like hideproof to documentclass options to omit them when compiling the latex file. primitive n-th roots of unity Show that the primitive n-th roots of unity have the form $e^{2ki\pi/n}$ for $k,n$ coprime for $0\leq k\leq n$.  Since all primitive n-th roots of unity are n-th roots of unity by definition they all have that form, the question is, how to show $k$ and $n$ are coprime.