I have an array list containing the following data;  [pagoda, hour, hour experience, pagoda, car, eatables, eatables water, walk, small, small garden, little, little hot, jungle, jungle beach, restaurant, ocean, local, room, morning, guy, pagoda small, small garden, hour experience, peaceful environment, view]   I want to check if an element in the arraylist contains value of another element, and if so remove the element which has the shorter length.  Eg:- look at hour, and hour experience in the arraylist above. I would need the method to remove hour element and keep only hour experience element.  This is what I wrote. But it doesn't work that well.  public void removeDuplicateKeywords(ArrayList&lt;String&gt; list){         System.out.println(list);          for(int i=0; i&lt;list.size(); i++){             String keyword = list.get(i);             for(int j=i+1; j&lt;list.size(); j++){                 if(keyword.equals(list.get(j))){                     list.remove(j);                 }                 if(list.get(j).trim().contains(keyword.trim()) &amp;&amp; list.get(j).length() &gt; keyword.length()){                      list.remove(i);                 }              }          }         System.out.println(list);     }   This will print  [pagoda, hour, hour experience, pagoda, car, eatables, eatables water, walk, small, small garden, little, little hot, jungle, jungle beach, restaurant, ocean, local, room, morning, guy, pagoda small, small garden, hour experience, peaceful environment, view]  [hour, hour experience, car, eatables water, walk, little, little hot, jungle beach, restaurant, ocean, local, room, morning, guy, pagoda small, small garden, peaceful environment, view]   Please help. Thanks in advance.
I have an ArrayList&lt;String&gt;, and I want to remove repeated strings from it. How can I do this?
highest power of prime $p$ dividing $\binom{m+n}{n}$ How do I recover my accidentally lost Windows partitions after installing Ubuntu? I have a Toshiba satellite A-200 laptop with a Vista OS on it with 4 NTFS partitions  (C:) Vista  (D:) Entertainment  (E:) Work  (F:) Sources   and I wanted to start using Ubuntu instead. So I tried it first from the live CD and everything was OK and all the partitions were shown and working and so I decided to install Ubuntu to replace Vista on the (C:) drive. After I did that I can no longer find my folders and files on the (D:), (E:), (F:) partitions and the only file system that is shown is one 198 GB although my HDD is 320 GB.  I can't access the lost data on the remaining 120 GB which I hope is still there and not totally lost  I am now working from the live CD but I am unable to install testdisk. Can I recover the Vista partitions by the product recovery CD to get my laptop back to the factory settings? Can I recover the NTFS partitions using a recovery program for Windows or will that make the problem worse?   I need these data badly as I don't have a backup for them. How to remove all subviews? Necessary and sufficient condition for the matrix $A = I - 2 x x^t$ to be orthogonal Let $x$ be a non zeo (column) vector in $\mathbb{R}^n$. What is the necessary and sufficient condition for the matrix $A = I-2xx^t$ to be orthogonal? Where is the denoiser? When overriding equals in Java, why does it not work to use a parameter other than Object? I ran into an interesting behavior recently.  It seems that if I override .equals() to take a parameter other than Object, it doesn't get called.  Can anyone explain to me why this is happening?  It seems to violate my understanding of polymorphism in OOP, but maybe I'm missing something.  Here's much simpler code that shows what I'm seeing:  public class MyClass {   private int x;   public MyClass(int n) { x = n; }   public boolean equals(Object o) { return false; }   public boolean equals(MyClass mc) { return x == mc.x; }   public static void main(String[] args) {     List&lt;MyClass&gt; list = new ArrayList&lt;MyClass&gt;();     list.add(new MyClass(3));     System.out.println("Contains 3? " + list.contains(new MyClass(3)));   } }   When this is run, it prints "Contains 3? false".  It looks like the equals(Object) function is called, even though there is another that would work.  By contrast, if I write equals like this the code works as expected:  public boolean equals(Object o) {   if(!(o instanceof MyClass))     return false;   MyClass mc = (MyClass)o;   return x == mc.x; }   Why isn't it figuring out which version of the function to call based on the type of the parameter? Prove $\int\limits_{0}^{\infty} \mathrm{exp}(-ax^{2}-\frac{b}{x^{2}}) \mathrm{d} x = \frac{1}{2}\sqrt{\frac{\pi}{a}}\mathrm{e}^{-2\sqrt{ab}}$ This is Example 8.4.1 from Chapter 8 (The Normal Integral) of  by Boros and Moll. The authors outlined a solution method, which I will provide in full here. My question: is there another way to obtain this result?  Here is the solution of Boros and Moll with their notation.  Let \begin{equation} \mathrm{L}(a,b) := \int\limits_{0}^{\infty} \mathrm{exp}(-ax^{2}-\frac{b}{x^{2}}) \mathrm{d} x \label{eq:iic8-1} \tag{1} \end{equation} Making the substitution $t=x\sqrt{a}$ yields \begin{equation} \int\limits_{0}^{\infty} \mathrm{exp}(-ax^{2}-\frac{b}{x^{2}}) \mathrm{d} x = \frac{1}{\sqrt{a}} \int\limits_{0}^{\infty}  \mathrm{exp}(-t^{2}-\frac{ab}{t^{2}}) \mathrm{d} t \label{eq:iic8-2} \tag{2} \end{equation} Letting $ab=c$ we call the integral in equation \eqref{eq:iic8-2} $f(c)$, \begin{equation} f(c) = \int\limits_{0}^{\infty} \mathrm{exp}(-t^{2}-\frac{c}{t^{2}}) \mathrm{d} t \label{eq:iic8-3} \tag{3} \end{equation} so that  \begin{equation} \mathrm{L}(a,b) = \frac{f(ab)}{\sqrt{a}} \label{eq:iic8-4} \tag{4} \end{equation} In equation \eqref{eq:iic8-3} we let $y=\sqrt{c}/t$ \begin{equation} f(c) = \sqrt{c} \int\limits_{0}^{\infty} \mathrm{exp}(-y^{2}-\frac{c}{y^{2}}) y^{-2} \mathrm{d} y \label{eq:iic8-5} \tag{5} \end{equation}  Combining equations \eqref{eq:iic8-3} and \eqref{eq:iic8-5}, we have \begin{equation} f(c) = \frac{1}{2} \int\limits_{0}^{\infty} \mathrm{exp}(-t^{2}-\frac{c}{t^{2}}) \left(1+\frac{\sqrt{c}}{t^{2}} \right) \mathrm{d} t \label{eq:iic8-6} \tag{6} \end{equation} Now we let $s = t - \sqrt{c}/t$ \begin{equation} f(c) = \frac{\mathrm{e}^{- 2\sqrt{c}}}{2} \int\limits_{-\infty}^{\infty} \mathrm{exp}(-s^{2}) \mathrm{d} s = \frac{\sqrt{\pi}}{2} \mathrm{e}^{- 2\sqrt{c}} \lim_{z \to \infty} \mathrm{erf}(z) = \frac{\sqrt{\pi}}{2} \mathrm{e}^{- 2\sqrt{c}} \label{eq:iic8-7} \tag{7} \end{equation} Combining equations \eqref{eq:iic8-1}, \eqref{eq:iic8-4}, and \eqref{eq:iic8-7} yields our result. I just installed Ubuntu 12.10 (amd64), and want to install a recent version of MySQL 5.6.  If possible, I would like to install (not upgrade) it the "Debian Way' (i.e., using apt-get or dpkg). If I run  export TEST=foo echo $TEST   It outputs foo.  If I run  TEST=foo echo $TEST   It does not. How can I get this functionality without using export or a script? Capacitor discharging through no load? What exactly would happen in the ideal case where a capacitor were to discharge into a wire with zero resistance?  Like in here:  There is still charge on one plate of the capacitor, which will try to go to the other plate to make $\Delta V = 0$ across the capacitor, so there has to be a current $I$.  But as more charge goes to the other side of the capacitor, the more repulsion these will cause to more coming towards them. So I am assuming current cannot just be constant?  I am starting from $$ I = C \frac{dV}{dt}, $$ but I know neither $V(t)$ nor $I$. Postgres JDBC connection in Eclipse Help I'm trying to get a postgres jdbc connection working in eclipse. It would be nice to use the Data Source Explorer, but for now I'm just trying to get a basic connection. What I have done so far is download the postgres JDBC connector. I then tried two different things. First, Preferences-> Data Management, I tried to add the postgres connector. Second, I added the jar to my project and tried to load the driver using Class.forName("org.postgresql.Driver"); but neither worked. Does anyone have any ideas?  Thanks,    Charlie Is there any way to get real-time compilation for LaTeX? I would really love to have a software or tool which provided real time compilation of my LaTeX document (to be able to see the final pdf or dvi document as I type the latex code), especially for when I am drawing pictures using tikZ. So far, I know of two things, but none of them work for me. They are:   : This is only for tikZ, which would be perfect for me, but unfortunately as far as I know it only works with Ubuntu and Debian, and I use Mac OS X (so I have never actually tried it, though I did dig a lot to see whether I would be able to install on my mac and from what I see it is really what I want - I am even considering installing Ubuntu just to use it!). : This is a minor mode for Emacs. It was extremely hard to get it to work on the mac (see my quest ), and it is not all that fast. The speed is not all that big of a deal for me, but the fact that it does not work with tikZ pictures is (the nodes all collapse in one point so that the words are all one on the top of the other).   So my question is: is there a software ideally like KtikZ or another type of editor which provides real-time compilation and that I can use on my mac? I guess if you know of a Windows/Linux option I would also like to know, and the same for a way to set up a script to get the document compiled every 5 seconds or so (I am sure I have seen this written somewhere, but I don't know whether I can do it with a mac or whether it is editor/pdf viewer dependent), but what I really want is a software/tool which would work with a mac.  To be clear, I am not after something like LyX, that is, I am not after a WYSIWYG-type thing, but rather something where I can type real LaTeX and see my code, but have at the same time another window showing me the pdf (or dvi) file compiled. Is this proof of $\liminf E_k \subset \limsup E_k $ correct? I am wondering if my proof is correct? Thank you for whoever willing to take a look at it for me.     Proof $\liminf E_k \subset \limsup E_k $   If $\{E_k\}_{k=1}^\infty$ is a sequence of sets, we define \begin{align*} \limsup E_k &amp; = \bigcap_{j=1}^\infty\left(\bigcup_{k=j}^\infty E_k\right)\\ &amp;= \bigcap_{j=1}^\infty(E_j \cup E_{j+1} \cup \cdots)\\ &amp;= (E_1 \cup E_2 \cup \cdots) \cap (E_2 \cup E_3 \cup \cdots) \cap \cdots. \end{align*}  Therefore, $\limsup E_k$ consists of those points in $\mathbb{R}^n$ which belong to infinitely many $E_k$. \begin{align*} \liminf E_k &amp; = \bigcup_{j=1}^\infty\left(\bigcap_{k=j}^\infty E_k\right)\\ &amp;= \bigcup_{j=1}^\infty(E_j \cap E_{j+1} \cap \cdots)\\ &amp;= (E_1 \cap E_2 \cap \cdots) \cup (E_2 \cap E_3 \cap \cdots) \cup \cdots. \end{align*} Therefore, $\liminf E_k$ consists of those points in $\mathbb{R}^n$ which belong to all $E_k$ for $k \geq k_0$.  Now consider $x \in \liminf E_k$, then $x \in E_1 \cap E_2 \cap \cdots$, or $x \in E_2 \cap E_3 \cap \cdots$ and so on, that is to say, $x \in E_{k_0} \cup E_{k_0+1} \cup \dots$ for some $k_0$. More specifically, $x \in E_k \forall k \geq k_0$. Therefore, $x \in (E_1 \cup E_2 \cup \cdots) \cap (E_2 \cup E_3 \cup \cdots) \cap \cdots$, so we showed $x \in \limsup E_k$. How to upgrade only core with drush? Given the following data:  972, 975, 985, 993, 993, 995, 998, 1001, 1004, 1007, 1008, 1009, 1011, 1015, 1016, 1020, 1022, 1032  I calculate the lower quartile as follows:  Number of values: 18, Number of 'gaps': 17.  Lower quartile is at 17/4 + 1 = 5.25th value. 5.25th value is 993 + (995 - 993) x 0.25 = 993.5  Upper quartile is at 3 x 17/4 + 1 = 13.75th value. 13.75th value is 1011 + (1015 - 1011) x 0.75 = 1014  Both the Excel QUARTILE function and the R quantile function agree with me. However the book I am using (Understanding Statistics by Graham Upton and Ian Cook) give different answers (993 and 1015 respectively). I'm confused. Which is correct? "Easy" vs. "simple" Are those two words equivalent or is there a difference? When would I say something is easy rather than simple, or vice versa? How do I enable auto-login in LightDM? How do I select elements of an array given condition? How do I defeat the Kayran in the first chapter of the Witcher 2? In the first chapter you are supposed to slay the Kayran, this enormous beast:    I'm having a hard time with it. I drank the Mongoose potion for poison resistance and I have the Kayran trap, but it just hits me too often with its tentacles. Especially when the Kayran swings a tentacle sideways, not from above, I have a very hard time evading it.  Is there any trick besides not getting hit by the tentacles?  With a lot of luck I'm getting as far as the point where it's throwing stones. Any idea what I'm supposed to do then? opengl storing multiple indices into indices buffer After parsing collada files I found out that we have to load two(or more) indices each pointing to say a vertex or normal etc. like this (&lt;p>3 0 2 0 0 0&lt;/p>)  Is there a way to load (and use)these indices to indices buffer(ELEMENT_ARRAY_BUFFER) like this (vnvnvn...) ; where v is vertex pointer, n is normal pointer from the above. with vertices loaded to VBO1 like (vvvv...) and in VBO2 like (nnnn...). So that we dont have to repeat the normals in VBO2.  VBO like (vnvnvn...) is also ok. (and not something like this ), I'm not trying to use multiple indices buffer. I'm trying to put all the given indices into one index buffer and use them alternately.  (If I wasnt clear i will try for more clarification.)