I am working on a program that uses quick sort to sort an array to display the running time. This program selects the median of three random numbers as the pivot. However, I am not sure if I am doing something wrong because every time I run this program I get the following errors:   "java.lang.StackOverflowError",  at java.util.Random.nextInt(Unknown Source) at SortingItems.quickSort(SortingItems.java:31) at SortingItems.quickSort(SortingItems.java:69)   " I get this  specific message multiple times"   This is the code:  import java.util.Random;  public class SortingItems {     static int x = 1000;     static int array []  = new int[x];      public static void main(String[] args) {         long time;         input(x, array);        time = System.nanoTime();        sort(array);        System.out.println("Running time in ascending order " + (System.nanoTime() - time));     }     public static void sort(int[] array) {        quickSort(array, 0, array.length - 1);    }     public static void quickSort(int[] array, int low, int high) {        if (array == null || array.length == 0)            return;         if (low &gt;= high)            return;         // Generating random numbers from 0 to the last element of the array        Random f = new Random();        int first = f.nextInt(array.length - 1);         Random s = new Random();        int second = s.nextInt(array.length - 1);         Random t = new Random();        int third = t.nextInt(array.length - 1);           // Selecting the pivot        int pivot = Math.max(Math.min(array[first], array[second]),                    Math.min(Math.max(array[first],array[second]), array[third]));         int i = low;        int j = high;         while (i &lt;= j) {             while (array[i] &lt; pivot) {                   i++;             }              while (array[j] &gt; pivot) {                   j--;             }              if (i &lt;= j) {                  int temp = array[i];                  array[i] = array[j];                  array[j] = temp;                  i++;                  j--;              }       }        if (low &lt; j)           quickSort(array, low, j);        if (high &gt; i)           quickSort(array, i, high);    }    // Input in ascending order   public static int[] input(int x, int[] array) {        for (int k = 0; k &lt; x; k++) {             array[k] = k;        }        return array;    } }
What is a StackOverflowError, what causes it, and how should I deal with them?
I looked around but did not find that anyone has asked this before, but what are the fonts that are standard/recommended while writing academic reports/papers? Boy asks 'How about pie?' I am looking for the title of a 1950s science fiction movie, involving an astronomer trying to decode some extraterrestrial signal, where the juvenile (male) character asks 'how about pi?' which all the adults interpret as a foolish 'how about pie?' question. Explanation of method for showing that $\frac{0}{0}$ is undefined table of contents no word separation Is it possible to have in the toc no word separation but have a word separation in the chaptername:  For example:   Contents  1. max Mustermann   Chapter  Max Muster- mann Help resizing posted images I often add pictures to my questions. Most of the time they come out the right size. Well, that used to be OK always, up until I started posting screenshots taken by my mobile. For example, this one:  This way, I'm sure you'll agree it is huge, decidedly too big, it takes up the whole body of the question, I mean. At present, the only way I have to resize it is the following code: &lt;sub&gt;(Click image to enlarge)&lt;/sub&gt;  [&lt;img src=&quot;http://i.stack.imgur.com/hKmRp.jpg&quot; width=&quot;210&quot; height=&quot;350&quot; alt=&quot;&quot;&gt;][1]  which I do not remember, and always have to recover from . Is there a simpler, less HTML-hacky (and, I'd expect, more Markdown-based) way of resizing it? PS The output of the above code is: (Click image to enlarge) Command Options on Command Line - Details and Functions? This is probably easier to show than tell...   On the recent question , I see the following:    As you can see, the first five links render properly, but after that, they stop converting.  Unfortunately, this isn't obvious to the person writing the post, which I discovered when I went to edit the post to fix the "broken" links. In the edit window, it renders all of the links just fine:    I understand that this behavior is expected based on balpha's answer :        Links to questions on the same site are unlimited.   Links to other sites are limited to             a) 5 linked-to sites and     b) N questions per target site, where N is 200 on meta sites and 10 on non-metas (this is about the site that the post containing the link is posted on, not the site that is being linked to)         So if this rule is still going to stay in effect, please fix the edit view to also not automatically convert more than five linked-to sites to help people writing posts know that they need to manually title the links to the other questions.  That said, I'd prefer that (at least on MSE) this limitation be removed or raised. Even in the answer, balpha says:     The restrictions are currently as follows, but note that they do look a bit contrived, resulting from the fact that they have grown over time (from single site to cross-site, from "there are no subsites" to "facebook.SO", etc.), so it's not unlikely that we'll revisit them.   So, if it's not hurting performance, can we please increase the limit or remove it? C++ map access discards qualifiers (const) The following code says that passing the map as const into the operator[] method discards qualifiers: #include &lt;iostream&gt; #include &lt;map&gt; #include &lt;string&gt;  using namespace std;  class MapWrapper { public:     const int &amp;get_value(const int &amp;key) const {         return _map[key];     }  private:     map&lt;int, int&gt; _map; };  int main() {     MapWrapper mw;     cout &lt;&lt; mw.get_value(42) &lt;&lt; endl;     return 0; }  Is this because of the possible allocation that occurs on the map access? Can no functions with map accesses be declared const? MapWrapper.cpp:10: error: passing const std::map&lt;int, int, std::less&lt;int&gt;, std::allocator&lt;std::pair&lt;const int, int&gt; &gt; &gt; as this argument of  _Tp&amp; std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::operator[](const _Key&amp;)  [with _Key = int, _Tp = int, _Compare = std::less&lt;int&gt;,  _Alloc = std::allocator&lt;std::pair&lt;const int, int&gt; &gt;] discards qualifiers How can I figure out what's slowly eating my HD space? Every few days I get notices on my MacBook that it's running or run out of hard drive space. Curiously, restarting the computer will enable me to recover gigabytes of space (this past time, it was able to recover about 2.2GB). However, I can't identify anything in my personal activity that consumed that space.  It's possible that it's a rogue iTunes podcast or a huge software update that my Mac is automatically downloading - would either of these reclaim the space upon a restart?  One possibility that I can think of is that FileVault has some sort of disk leak, allocating but not freeing files. Does this make sense? Is there a tool that I can run to determine where this space is going? Assuming it is FileVault, should I try to disable it? What's the best way to turn of FileVault on a nearly full computer? Trigger a button click with JavaScript on the Enter key in a text box I have one text input and one button (see below). How can I use JavaScript to trigger the button's click event when the Enter key is pressed inside the text box?  There is already a different submit button on my current page, so I can't simply make the button a submit button. And, I only want the Enter key to click this specific button if it is pressed from within this one text box, nothing else.  &lt;input type="text" id="txtSearch" /&gt; &lt;input type="button" id="btnSearch" value="Search" onclick="doSomething();" /&gt; Good books for a high schooler self-studying Abstract Algebra? Does anyone have any suggestions for abstract algebra books particularly suited to self-study?     Here is some background and motivation, if it's helpful.  I'm currently a junior in high school, but I have some familiarity with groups, rings, polynomials and fields, as I went through Fraleigh's book. I liked its writing style, but many of the problems were not helpful. I would like to get better at algebra with some other book, particularly one that's aimed at someone who already has a little familiarity with the objects, but is by no means completely comfortable.  One of my longer-term goals is to learn a bit of algebraic number theory, as I've only been studying elementary number theory. That's why I feel it  good to learn more algebra first. (I'd also be interested in suggestions of other good subjects to learn prior to tackling algebraic number theory.)  I was considering using one of Lang's books, since they seem pretty universal, but I've heard rumors that they are very terse and not good for self-learning. Finding an old flight number How can I find an old flight number from over three years ago? I am trying to make a claim for a delay of over five hours. They sent us to the wrong destination and lost our luggage. Add Windows 10 to GRUB OS list How do I build a SOQL query for records in a list of IDs? Can some one correct my soql? I need to export records in data loader like:  WHERE Id IN ('123123123','123123fsdf')   But this following query does not work for me:  SELECT Id, Syndication_Documents__c FROM ContentVersion  WHERE Syndication_Documents__c in : 'a4fa0000000KzbV','a4fa0000000KzbW' Update iOS 5.1.1 on iPad 1 to at least iOS 6 how to have a custom zsh auto_cd command Instead of the normal cd I've created my own function  function cd {     builtin cd "$@" &amp;&amp; ls -F }   This works great for when I use commands like cd someDir/subDir but not when I change directories via zsh's auto_cd someDir/subDir.  Is there a way to customize what command gets called for auto_cd? What is the design pattern for processing command line arguments The reply buttons in chat shouldn't reposition themselves on pinged messages Could not download all repository indexes Uses of the 3D Cursor