I want to sort a List of Strings in descending order.   I tried different comparators but none is giving the answer i am looking for.   public class arrasss {      public static void main(String[] args) {         // TODO Auto-generated method stub          List&lt;String&gt; a1 = Arrays.asList("7560923143", "7560923053", "7560922899", "7560922344", "7560504628",                 "7280202486", "7280202087", "7280202068", "353549090116186", "353549090116079", "353549090114991",                 "353549090113191", "353549090112896", "353549090000007");          a1.sort(Comparator.reverseOrder());         // Collections.reverse(a1);          System.out.println(a1);      }  }   Received Answer: [7560923143, 7560923053, 7560922899, 7560922344, 7560504628, 7280202486, 7280202087, 7280202068, 353549090116186, 353549090116079, 353549090114991, 353549090113191, 353549090112896, 353549090000007]  Expected Answer : 353549090116186 353549090116079 353549090114991 353549090113191 353549090112896 353549090000007  7560923143...
I need to write a Java Comparator class that compares Strings, however with one twist.  If the two strings it is comparing are the same at the beginning and end of the string are the same, and the middle part that differs is an integer, then compare based on the numeric values of those integers.  For example, I want the following strings to end up in order they're shown:   aaa bbb 3 ccc bbb 12 ccc ccc 11 ddd eee 3 ddd jpeg2000 eee eee 12 ddd jpeg2000 eee   As you can see, there might be other integers in the string, so I can't just use regular expressions to break out any integer.  I'm thinking of just walking the strings from the beginning until I find a bit that doesn't match, then walking in from the end until I find a bit that doesn't match, and then comparing the bit in the middle to the regular expression "[0-9]+", and if it compares, then doing a numeric comparison, otherwise doing a lexical comparison.  Is there a better way?  Update I don't think I can guarantee that the other numbers in the string, the ones that may match, don't have spaces around them, or that the ones that differ do have spaces.
Distribution of orbital velocities in a disk galaxy for N-body simulation? I'd like to write an N-body simulation in which I collide two disk galaxies. To give you an idea of the accuracy I'm trying to achieve, I'm aiming to make this my screensaver at 30fps on my work desktop. Think Euler's method, large epsilons in denominators to prevent blow up, all that lazy stuff.   One place I don't want to be lazy, however, is in the initial construction of the galaxies I'm trying to collide. I want to design a galaxy that will at least sort of hold together by its own gravity until it smash it into another one.   How might I go about selecting the orbital velocities for each of the bodies composing the galaxy? Dark Mode for Stack Exchange sites Each Stack Exchange site should provide users the option of using a dark mode design/theme.  Why is this feature missing?  The major IDEs are already a letdown regarding dark color schemes. How to connect Nokia Lumia 730 to Ubuntu 15.04? My Nokia Lumia 730 (WP8.1) is not getting detected on Ubuntu 15.04.  Can anybody tell me how to fix this? Story where people inject "books" in the back of their necks? I read this story in middle school or high school and I cannot for the life of me remember the name of it. I think it started off in a small clan of people, there was a young boy who had just come of age and he had some kind of gift that related to the books? Also I think the injecting was illegal, because I vaguely remember the boy encountering an old man who had a bunch of books that he had to keep hidden. There was also a city and he met a girl there that was Special some how. I may just be merging memories but I think at some point the boy and girl went to an underground city?  Does anyone know what I'm talking about? It seems like maybe cancelled downvote might be less...weird? Is my US visa still valid after change in name? Is it acceptable to edit (correct) grammar or spelling? Some individuals may be sensitive to edits of their posts on the basis of spelling or grammar. Some editors may be concerned about what to put in as a reason/explanation for the edit. New editors, in general, are likely uncertain of what the accepted "etiquette" is, on these sites, for such corrections. Finding solutions to congruence equations Local timezones on servers considered harmful? I'm curious as to what other administrators' experiences with timezones, in the context of remotely administered servers, are. In my career I've come across several conventions;   Always, always, always use UTC.   Always, always, always use the timezone of wherever base HQ is. Use the local time of the people who happen to be administering.  Use the local time of the server location.    In some places, I've come across multiple and conflicting conventions. My own preference has been to use UTC, always - with no daylight savings. But for one reason or another, it seems that most people prefer to use some concept of local time, with daylight savings. Although it seems like a straightforward technical matter, discussions around changing conventions always seem to trend towards religious schisms.  What are you using? What do you consider to be the advantages and disadvantages of each approach? How can I make a "Movie Clip" node start at a certain frame of the scene? I have just downloaded "ubuntu-14.04.1-desktop-amd64.iso" and "ubuntu-14.04.1-server-amd64.iso" through "".   Please can someone confirm the maximum RAM that is supported.  According to many sites, Maximum RAM supported by the OS  ubuntu-14.04.1-desktop : " 2^64 bytes " -- Kindly confirm  ubuntu-14.04.1-server : " 2^64 bytes " -- Kindly confirm When can I use a forward declaration? How do Horcruxes work? A few questions regarding the Horcruxes.   Had Voldemort actually succeeded in using a Horcrux, would he come back the same age (biologically and/or aesthetically) he was when he made the Horcrux, or the age he would biologically be if he had never died (half died)? If Harry was a Horcrux, then in the graveyard, when Wormtail added Harry's blood to the potion to bring Voldemort back, didn't that technically use up the Horcrux inside of Harry? So in Deathly Hallows when Voldemort kills Harry, shouldn't Harry have actually died rather than just have the Horcrux inside him destroyed, seeing as it was technically used in the Goblet of Fire? When is the limit of a sum equal to the sum of limits? I was trying to solve a problem and got stuck at the following step:  Suppose ${n \to \infty}$ .  $$\lim \limits_{n \to \infty} \frac{n^3}{n^3} = 1$$  Let us rewrite $n^3=n \cdot n^2$ as $n^2 + n^2 + n^2 + n^2 \dots +n^2$,$\space$ n times.  Now we have  $$\lim \limits_{n \to \infty} \frac{n^3}{n^3} = \frac {n^2 + n^2 + n^2 + n^2 + n^2 \dots +n^2}{n^3} $$  As far as I understand, we can always rewrite the limit of a sum as the sum of limits ...  $$\dots = \lim \limits_{n \to \infty} \left(\frac{n^2}{n^3} + \frac{n^2}{n^3} + \dots + \frac{n^2}{n^3}\right)$$  ...but we can only let ${n \to \infty}$ and calculate the limit if all of the individual limits are of defined form (is this correct?). That would be the case here, so we have:  $= \dots \lim \limits_{n \to \infty} \left(\frac{1}{n} + \frac{1}{n} + \dots + \frac{1}{n}\right) =$[ letting ${n \to \infty}]$ $= 0 + 0 + \dots + 0 = 0$  and the results we get are not the same.  Where did I go wrong? Prove that the only automorphism of $\mathbb{Q}(\sqrt[3]{2})$ is the identity automorphism. I am having difficulty with this proof. I have previously proved that for an automorphism on the extension field $K$ of $F$ that when restricted to $F$ is the identity automorphism must take roots of $f(x)\in F[x]$ in $E$ to roots of $f(x)$ in $E$. I was thinking of using the minimal polynomial $x^{3}-2\in\mathbb{Q}[x]$ and the result of previous problem I solved, but I suspect there are automorphisms that don't fix the subfield, so the result can't be used or I need to prove that any automorphism of an extension field must fix the subfield that is being extended or always sends roots in $E$ to roots in $E$.  I am not asking for a solution to this, but maybe a hint or pointer in the right direction. This problem is introduced in the text prior to Galois theory, so please keep that in consideration. translation invariant of integral on $\mathbb{R}$ Problem 1: Let $f\in L^1(\mathbb{R})$, show $\int_\mathbb{R}f(t)dt=\int_{\mathbb{R}}f(x+t)dt,\forall x\in (-\infty, \infty)$.  Problem 2: Let $f\in L^1(\mathbb{R})$,show $\displaystyle \lim_{t\rightarrow 0}\int_{\mathbb{R}}|f(x+t)-f(x)|dx=0$.  My try for Problem 1:  Consider $\displaystyle \int_{\mathbb{R}}f(t)dt=\lim_{n\rightarrow \infty}\int_{-n}^nf(t)dt=\lim_{n\rightarrow \infty}\int_{\mathbb{R}}f_n(t)dt$, where $f_n(t)=f(t)\chi_{[-n,n]}$.  And since $dt=d(x+t)$, we have $\displaystyle \int_{-n}^nf(x+t)dt=\int_{-n+x}^{n+x}f(t)dt$.  So for each $x\in (-\infty,\infty)$,  $$ \begin{split} \int_{\mathbb{R}}f(t)-f(t+x)dt &amp;=\lim_{n\rightarrow \infty}\int_{\mathbb{R}}f(t)(\chi_{[-n,n]}-\chi_{[-n+x,n+x]})dt\\ &amp;=\lim_{n\rightarrow \infty}\int_{\mathbb{R}}f(t)(\chi_{[-n,-n+x]}-\chi_{[n,n+x]})dt\\ &amp;=\lim_{n\rightarrow \infty}\lim_{k\rightarrow \infty}\int_\mathbb{R}\varphi_k(t)(\chi_{[-n,-n+x]}-\chi_{[n,n+x]})dt\\ &amp;=\lim_{k\rightarrow \infty}\lim_{n\rightarrow \infty}\int_\mathbb{R}\varphi_k(t)(\chi_{[-n,-n+x]}-\chi_{[n,n+x]})dt \end{split} $$ where $\varphi_k(t)$ is simple function pointwise converges to $f(t)$, simple function vanish out of set of finite measure, so $\varphi_k(t)(\chi_{[-n,-n+x]}-\chi_{[n,n+x]})$ vanishes when $n$ big enough(is this right?)    Another try:  Since $f\in L^1$, $f$ is bounder a.e. so can be approximated by simple functions, and $\chi_{A+t}(x)=\chi_A(x-t)$,thus $$\int f(t)=\lim_n\int\varphi_n=\lim_n \sum_{i=1}^nc_i\mu(E_i)=\lim_n \sum_{i=1}^nc_i\mu(E_i-x)=\int f(t+x)$$  For problem 2, I guess they share the same method.   Any help or correction about these two problems? Thanks. 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 Full List of inventory items After beating the game, I still have several empty inventory spots.  I most likely missed several items in my addicted frenzy to finish the game.  What are all the items that can be found in the game? And where can they found? How to make a figure span on two columns in a scientific paper? If I just try to set the figure's size to 0.9\textwidth my figure will just end up on the right column, sized to be two-columns wide.  Has anyone done this before? I've just had to write a string reverse function in C# 2.0 (i.e. LINQ not available) and came up with this:  public string Reverse(string text) {     char[] cArray = text.ToCharArray();     string reverse = String.Empty;     for (int i = cArray.Length - 1; i &gt; -1; i--)     {         reverse += cArray[i];     }     return reverse; }   Personally I'm not crazy about the function and am convinced that there's a better way to do it. Is there?