I am currently wondering if there is a good way of implementing an equals method for a non-static inner class in Java. I basically a class Foo with an inner-class Bar like this:  public class Foo {    private final String foo; // constructor omitted    public /* non-static */ class Bar {      private final String bar; // constructor omitted      @Override     public boolean equals(Object other) {       return other != null &amp;&amp; other.getClass() == getClass()         &amp;&amp; ((Bar) other).bar.equals(this.bar)         &amp;&amp; Foo.this.equals(Foo.((Bar) other)); // Will, of course, not compile.     }   }    @Override   public boolean equals(Object other) {     return other != null &amp;&amp; other.getClass() == getClass()       &amp;&amp; ((Foo) other).foo.equals(foo);   } }   My classes are a lot more complex in reality and I want to reuse the Foo#equals method from within Bar#equals in order to save me a lot of code. I am now considering to make the "inner-class-relationship" explicit in order to being able to refer to the "outer" class. However, then I have to add accessor methods manually and I want to avoid this. I cannot get rid of the feeling that there should be a Java approach of doing this.
I'm using the Apache Commons EqualsBuilder to build the equals method for a non-static Java inner class. For example:  import org.apache.commons.lang.builder.EqualsBuilder;  public class Foo {     public class Bar {         private Bar() {}          public Foo getMyFoo() {             return Foo.this         }          private int myInt = 0;          public boolean equals(Object o) {             if (o == null || o.getClass() != getClass) return false;              Bar other = (Bar) o;             return new EqualsBuilder()                 .append(getMyFoo(), other.getMyFoo())                 .append(myInt, other.myInt)                 .isEquals();         }     }      public Bar createBar(...) {         //sensible implementation     }      public Bar createOtherBar(...) {         //another implementation     }      public boolean equals(Object o) {         //sensible equals implementation     } }   Is there syntax by which I can refer to other's Foo reference apart from declaring the getMyFoo() method? Something like other.Foo.this (which doesn't work)?
How can I reset my menus? How can I check if /bin/x86_64/bin/ls is a directory in a bash shell script  Here is what I tried:  #!/bin/bash  if [ $# -eq 2 ]; then     if [[ "$1" = /* ]]     then     cd ./bin/x86_64/bin/ls         if [ -d "$1" ]; then             echo "ok"             i="$1"             echo $i         else             echo "error2"             exit         fi     else         echo "error"         exit     fi fi Editing capabilities document in GeoServer I've got several layers in GeoServer, one of which I'm trying to use as a WMS in desktop programs (Manifold 8). I've set it up correctly, but whenever I bring it into Manifold, it projects the layer into EPSG:4326, which unfortunately can't work with my map - I need it in EPSG:3857. The layer in question is wrapped inside a more overarching layer definition, which contains all the layers - and coordinate systems that allow them all to be used flexibly. However, I want to put this layer on its own in the capabilities document, and only allow it to use EPSG:3857. How, in GeoServer, would I edit, or override, a capabilities document? Prove $|\arctan x - \arctan y|\leq |x-y|$ Since the final Black Hole (BH) had 3 solar masses less of mass than the original binary BH, it seems the 2 BHs lost mass, and with it event surface area, entropy, and information. If that came from inside the BHs it seems that it would be a contradiction of what a BH is --'nothing escapes its event horizon'. Some may say that came from the rotational energy of the pair, but the new BH now seems to have less than the two original ones summed. So, did some of that escape the horizons? Uniform convergence of derivatives, Tao 14.2.7. This is frustrating for me. The UV-textures to vertex cols add-on doesn't seem to work despite the specific instructions. Any other tutorials I can find are either very old or very poor.  I'd like to know how to do this in Blender 2.79. I need vertex colors in my ambient occlusion for use in Shader Forge. In bibliography, how to print the page in my text where I cited certain paper? How to get, for instance,  [19] S. Roth and M. J. Black. Fields of experts: A framework for learning image priors. In IEEE Conf. on Computer Vision and Pattern Recognition, 2005. 1, 2, 7, 8  where the last numbers (1, 2, 7, 8) are the pages where I cited the paper in MY TEXT?  This would be like a reversed reference, or a index for bibliography. dpkg-divert: error: rename involves overwriting `/usr/lib/xorg/protocol.txt' with different file `/usr/lib/xorg/protocol-precise.txt', not allowed I just installed Ubuntu (12.04.4) and I upgraded to 13.10  I have no idea how to fix this :/  $ sudo apt-get install -f  Reading package lists... Done Building dependency tree        Reading state information... Done The following packages will be REMOVED:   xserver-common-lts-saucy 0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded. 1 not fully installed or removed. After this operation, 1,718 kB disk space will be freed. Do you want to continue [Y/n]? y (Reading database ... 175174 files and directories currently installed.) Removing xserver-common-lts-saucy ... Removing 'diversion of /usr/lib/xorg/protocol.txt to /usr/lib/xorg/protocol-precise.txt by xserver-common-lts-saucy' dpkg-divert: error: rename involves overwriting `/usr/lib/xorg/protocol.txt' with   different file `/usr/lib/xorg/protocol-precise.txt', not allowed dpkg: error processing xserver-common-lts-saucy (--remove):  subprocess installed post-removal script returned error exit status 2 Errors were encountered while processing:  xserver-common-lts-saucy E: Sub-process /usr/bin/dpkg returned an error code (1) Let's consider it case by case:  Case 1: Charged particle is at rest. It has an electric field around it. No problem. That is its property.  Case 2: Charged particle started moving (it's accelerating). We were told that it starts radiating EM radiation. Why? What happened to it? What made it do this?  Follow up question: Suppose a charged particle is placed in uniform electric field. It accelerates because of electric force it experiences. Then work done by the electric field should not be equal to change in its kinetic energy, right? It should be equal to change in K.E + energy it has radiated in the form of EM Waves. But then, why don't we take energy radiated into consideration when solving problems? (I'm tutoring grade 12 students. I never encountered a problem in which energy radiated is considered.) Addition is to Integration as Multiplication is to ______ Addition is to Integration as Multiplication is to ______ ? Everyone knows that definite integration  is "a way to sum continuum-many terms" in a rough sense. Can we "multiply continuum-many factors"  in a similar sense? Prove $GL_n(\Bbb{R})/SL_n(\Bbb{R}) \cong \Bbb{R}^\times$ $$GL_n(\Bbb{R})/SL_n(\Bbb{R}) \cong \Bbb{R}^\times$$  This is trivial to prove with the first isomorphism theorem - by using the determinant as a endomorphism, then as $SL_n(\Bbb{R})$ is $1$ under the determinant, it is the kernel, and by FIT, the above is proved.  I was wondering how to prove this without the isomorphism theorem ? I understand intuitively that this is true, but I'm embarrassed to say I'm having a hard time constructing a rigorous proof that $|a+b| \leq |a|+|b|$. Any help would be appreciated :) How to override 'DefWndProc' in WPF What set of books makes a complete starter set for 4e? I've asked several questions about 4th Edition D&amp;D because I may be able to start a game. However, I'd need to purchase (some) materials. I am aware of the 4 book set (core) and the expected Essentials Red Box.  So now I need to know: presumably buying either the 4 book set or essentials will be enough to get my game on. Would there be something 'lacking' though? Would I be missing character types, for instance, as I've seen that the splatbook strategy is still in effect?  I'm an experienced player and GM and plenty creative, so many holes I'd be able to fill in myself. I just don't want to get sucked into too much financial impact. How to check if file exists on FTP before FtpWebRequest "By" vs "Per". Which one should I use on expressions like "P&L/Geography" or "VaR/Asset"? In the finance field, it is quite common to express some measures in relation to some grouping criteria. Some groupings can be temporal (year, month, etc.) and others like greography, asset class (e.g. a financial product), strategy (used in trading), and others.   Which one is the most appropriate preposition to apply in this kind of expression ?    "VaR per asset" or "VaR by asset" "P&amp;L per strategy" or "P&amp;L by strategy".   Is there any well defined rule behind the most appropriate use ? Redirect based on country Let's say I have a site that has multiple versions for different countries, e.g.:  www.example.com/us www.example.com/uk www.example.com/ca   and I want to use IP geolocation to redirect users who go to www.example.com to the appropriate country version of the site.  What is the best way to do that without confusing crawlers such as Googlebot or running into other SEO type trouble? How to disable Ctrl+Shift+U? Ctrl+Shift+U is a combined shortcut in Eclipse. But when I press it, it shows up a u, just like input with an underline. I guess this shortcut has been declared by Ubuntu, so I can't use it. I used to solve this problem by typing Caps Lock first. Is there any better method? I have opened Disks program today and noticed that there is FAILING in the Assessment column for the SMART status.     What does this error mean? Is it serious problem?  I have Lenovo G50-45 laptop, disk is SEAGATE ST1000LM014-SSHD-8GB(LVD3) 1TB SSHD with 8GB NAND Flash (original disk in this latop).  Update 2017-09-24:  The disk has died yesterday. 1 year and 3 months have passed since 1st hint of problem. About 4 months ago I had few issues with it not booting, but I was able to make another clean install. Since yesterday the disk is non-responsive. As this was long expected I had backup of all important data.(!) The disk was about 2 years old, so that was quite premature death.