Currently having difficulty with Selection Sort and Bubble Sort codes. The selection sort is used to sort out student ID in ascending order and the bubble sort is used to sort out last names in ascending order. The program compiles but crashes upon choosing choice 10 or 11.   My array is declared as follows:   student[] list = new student[100]; //my array   This is the code that I have for selection sort and bubble sort. I am using an array with methods:     if (choice == 10) { // Dissplay the sorted array by student id              SortArrayBySelection(list);              System.out.println("Sorted studentid are:");             for (int i =0; i&lt; studentNumber; i++)             {                 System.out.println(list[i]);             }            }          if (choice == 11){ // Display the sorted array by family name              BubbleSort(list);              System.out.println("The sorted names are:");             for(int i = 0; i &lt; studentNumber; i++)             {                 System.out.println(list[i].Getfamilyname());             }         }       } while (choice != 1);    }  public static void SortArrayBySelection(student[] arrayToSort){ // Function to sort out the array on sutdentid  for(int i = 0; i &lt; arrayToSort.length-1; ++i)  {      int minIndex = i;      int studentid3 = arrayToSort[i].Getstudentid();      int studentid2 = arrayToSort[minIndex].Getstudentid();      for(int j = i + 1; j &lt;arrayToSort.length; ++j)      {          int studentid1 = arrayToSort[j].Getstudentid();          if(studentid1 &lt; studentid2)          {              minIndex = j;          }      }      int temp = studentid3;      studentid3 = studentid2;      studentid2 = temp;    } }  public static void BubbleSort(student[] arraySort){     String t;     for(int i = 0; i&lt;arraySort.length; i++){         for(int j=0; j&lt;arraySort.length-1;j++){             String str1 = arraySort[j].Getfamilyname();             String str2 = arraySort[j+1].Getfamilyname();             if(str1.compareTo(str2)&lt;0){                 t = str1;                 str1 = str2;                 str2 = t;             }         }     }  }   Any suggestions would be appreciated! thank you Errors:  Exception in thread "main" java.lang.NullPointerException     at client.Client.SortArrayBySelection(Client.java:270)     at client.Client.main(Client.java:232)  Exception in thread "main" java.lang.NullPointerException     at client.Client.BubbleSort(Client.java:288)     at client.Client.main(Client.java:246)
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
How can I find the version of Ubuntu that is installed? Some conditions require that a person lie in bed all the time until recovered. Is there a name for such conditions or people experiencing them at the moment?   For example,      I am currently &lt;bed sick&gt; and can't help you with your homework.   I tried looking for bed sick but hit a dead end. Why are most of the main characters White/English in Game Of Thrones? I am looking to identify a story that I read around 2001 (it is probably much older).  Someone showed me the story on pages printed from the internet, and it was attributed to Isaac Asimov (although I cannot state that is the true author).    The story is told in glimpses at different points of time in the future.  In each glimpse, humans are asking a more and more "intelligent" computer how to prevent the universe from collapsing into a singularity in the future, and the computer states it needs more computational power and resources to solve this problem.  At some point, man becomes one with the computer, and the computer exists in hyperspace (or subspace?).    In the final glimpse, it is the end of time and the universe is collapsing into a singularity.  At the instant the universe reaches the singularity, the computer figures out how to prevent it and says "Let there be light" and the universe begins to expand again.  Is anyone familiar with this story? Can there be a notification for bounties started on questions you've asked or answered? By default, all browser instances use the same cookie for the same site. Is there a browser that doesn't follow this?  Or is there a Firefox plugin that can "wear" different cookies for a specific site? Novel about a dragon lord who has to wear gloves at all times I read this novel when I was young. It is probably a children's or young adult novel. I think I read it in 1997 or earlier. I remember very much enjoying it, but the title and most of the details are unfortunately quite hazy for me. Here is what I have:   The main character was a girl in her early teens (I think) She was sent to live with a man who was some sort of master of dragons She may have been related to this man (his niece, perhaps), but I also may have made that up The man wore gloves at all times. When he removed them and touched someone he could see something about them. Their future, I think?   Sound familiar to anyone?   Update: Thinking back on it some more, I think I remember that the dragon lord guy and the heroine ended up in some kind of romantic relationship (making it less likely that he was her uncle). Also, he did at one point take off his gloves and touch her, seeing her future (I think).  'nother Update: It's possible that I'm confusing dragons with volcanos. Or, there may have been both. And I think they lived on an island, or a coastline? How do I get my players to form a PC party without just forcing them to? I believe that it is generally a good thing that all the PCs travel together, as a "party". This way the GM has to manage one environment – not, say, five. The problem is how the GM can ensure such a relationship between the characters.  One simple and really great solution is to require the players to design their characters so that they know each other. This has the added advantage of cross-backstories – as the players try to adjust their stories to fit together, they get and create hooks for more narrative!  However, I am now experimenting with giving the players complete freedom at character creation and later meeting in-game. No luck so far.  It is not easy, as trusting someone with your life (what happens during combat) is not a trivial thing. Furthermore, people generally like others with the same behaviour/interests/skin colour. Fantasy is all about diversity – you do not character-generate a strong man with a sword, no, you generate a half-ogre with an axe never before seen!  How can the GM get players, with diverse characters who are strangers to each other, decide to have their PCs act as a coherent group. I absolutely want to avoid asking my players to just solve this through metagaming ("Hey Joe, think of a way to get together with those, I can't story-tell two separate groups at the same time!").  I'm not having the stereotypical problem where a bunch of PCs meet for the first time and are automatically so paranoid of strangers that they start trying to kill each other. My players have just created a bunch of characters who have their own legitimate interests, and are faithfully following those in completely different directions that don't result in a classic "party". I put the PCs in great peril together and everyone escaped by their own devices, but now I have to figure out get the guy who ran for the hills back together with the couple that entered the city. And, I want to do it by resorting only to reasonable in-game events, not out-of-game metagame suggestions. I run Windows XP and the wallpaper I used to have got lost. I have backups of the system itself, so if I knew where to look, I could find a copy of the old wallpaper.  I have some idea of the original filename (searching now), and I recall it saves it as a bitmap, but an exact location would be helpful.  It was a photo/JPEG that used to be on the filesystem, and I don't have backups, so the Firefox, and Internet Explorer wallpaper locations are unlikely. I checked %SYSTEMROOT%\system32 as well - so I'm assuming it's somewhere else. Why does pressing a transform hotkey not display the axes on the selected object? I open Blender 2.80 (official release, not a beta or RC) and get the new scene with the usual 3 objects present (camera, light and cube). I select the cube, press 't' for the tools menu and click on the Move tool. The usual 3 axis glyph appears at the cube's origin as expected. But if I use the hotkey 'g' to activate the move transform instead of selecting the tool from the menu with the mouse this glyph does not appear. The exact same problem exists if I use the a hotkey for rotate or scale as well. Why? Is there some clickable checkbox setting hidden somewhere that could have disabled this? Page range truncation with imakeidx This is a followup question to egreg's answer to  The answer runs into a problem if an index topic occurs in more than one page range. The following MWE, based on egreg's answer:  \begin{filecontents*}{subjind.ist} delim_0 ", \\checkrange{" delim_t "}" \end{filecontents*}  \documentclass{book} \usepackage{xparse} \usepackage{imakeidx}  \makeindex[title=Subject Index,options=-s subjind]  \ExplSyntaxOn \NewDocumentCommand{\checkrange}{&gt;{\SplitArgument{1}{--}}m}  {   \formatrange#1  } \NewDocumentCommand{\formatrange}{mm}  {   \IfNoValueTF { #2 }    { % no --, it's not a range     #1    }    { % it's a range     \egreg_range:nn { #1 } { #2 }    }  }  \bool_new:N \l__egreg_range_compare_bool  \cs_new_protected:Nn \egreg_range:nn  {   % print the start number   #1--   \int_compare:nNnTF { \str_count:n { #1 } } = { \str_count:n { #2 } }    {% same number of digits, remove equal ones at the start     \__egreg_range_compare:nn { #1 } { #2 }    }    {% different number of digits, print both     #2    }  } \cs_new_protected:Nn \__egreg_range_compare:nn  {   \bool_set_true:N \l__egreg_range_compare_bool   % do a loop on the digits in the first number   \int_step_inline:nn { \str_count:n { #1 } }    {     \bool_if:NTF \l__egreg_range_compare_bool      {       % if the digits coincide, print nothing       \str_if_eq:eeF { \str_item:nn { #1 } { ##1 } } { \str_item:nn { #2 } { ##1 } }        {         \str_item:nn { #2 } { ##1 }         % at the first differing digit, don't compare any longer         \bool_set_false:N \l__egreg_range_compare_bool        }      }      { \str_item:nn { #2 } { ##1 } }    }  } \ExplSyntaxOff  \begin{document} \setcounter{page}{95}\index{Topic0|(}Text\newpage \setcounter{page}{101}\index{Topic0|)}Text\newpage \setcounter{page}{124}\index{Topic1|(}\index{Topic2|(}Text\newpage \setcounter{page}{126}\index{Topic1|)}Text\newpage \setcounter{page}{134}\index{Topic2|)}Text\newpage \setcounter{page}{141}\index{Topic0}Text\newpage \index{Topic0}Text\newpage \index{Topic0}Text \printindex \end{document}   yields the following error message:  ! LaTeX3 Error: Too many '--' tokens when trying to split argument.  For immediate help type H &lt;return&gt;.  ...                                                l.3   \item Topic0, \checkrange{95--101, 141--143}   Entering non-stop yields the following output:    which omits "-3" from the second index entry of Topic0. The question is how to get around this.  Edit following up on egreg's ingenious solution.  I don't know if I should ask a new follow up question, so I'm posing it first here in this edit.  egreg's solution doesn't seem to handle index sub-topics.  If one adds the following 4 lines  \setcounter{page}{135}\index{Topic0!sub0|(}Text\newpage \setcounter{page}{136}\index{Topic0!sub0!subsub0|(}Text\newpage \setcounter{page}{139}\index{Topic0!sub0!subsub0|)}Text\newpage \setcounter{page}{140}\index{Topic0!sub0|)}Text\newpage   after  \setcounter{page}{134}\index{Topic2|)}Text\newpage   in the solution, one gets the following errors:  Output written in mwe.ind. Transcript written in mwe.ilg.  (mwe.ind ! Extra }, or forgotten \endgroup. l.4     \subitem sub0, 135--140}  ? r OK, entering \nonstopmode... ! Extra }, or forgotten \endgroup. l.5       \subsubitem subsub0, 136--139}  ) [145] (mwe.aux) )   and this output:    Alas I don't understand egreg's code well enough to make the required changes. I see questions/information online about how to get rid of corpses but I'm not sure what the consequences to having them lying around are.  I know that I can use a morgue to store them and that they will eventually be taken away in a hearse. However, I've always just left them lying around. This doesn't seem to have any obvious consequences.  Do they upset prisoners or staff (e.g. increasing the danger level beyond what death normally does)? Make them sick? Slow down pathing? Is this something that's not implemented yet or is leaving dead bodies all over the place meant to be completely fine?  The wiki's pages for  and  don't shed any light on this. All I'm finding is the how of getting rid of corpses/glitches related to it but not why it matters in the first place. All I've seen that's related is that apparently prisoners can loot guard corpses for keys, but there's no obvious consequences for prisoner corpses which are what I tend to end up with.  So why not just leave them in the corridors? Converting a year from 4 digit to 2 digit and back again in C# My credit card processor requires I send a two-digit year from the credit card expiration date. Here is how I am currently processing:   I put a DropDownList of the 4-digit year on the page. I validate the expiration date in a DateTime field to be sure that the expiration date being passed to the CC processor isn't expired. I send a two-digit year to the CC processor (as required). I do this via a substring of the value from the year DDL.   Is there a method out there to convert a four-digit year to a two-digit year. I am not seeing anything on the DateTime object. Or should I just keep processing it as I am? Will C++ exceptions safely propagate through C code? $$\sum_{n = 1}^\infty \frac{(-1)^n}{p_n}$$ where $p_n$ is the $n$th prime.  I have computed this to 10000 rather than infinity. My results suggest that convergence does happen but it's very slow. But I can't even be sure about the first few digits: $-0.26959$?  I have looked at the "questions that may already have your answer" and some of the "similar questions," but they involve somewhat different formulas. Is the double-slit experiment typically carried out in a vacuum? It is my understanding of the double-slit experiment that when a measuring device is activated, to measure which of the two slits a particle is travelling through, this measuring is responsible for a different outcome than when the device is left off. When the device is left off particles leave an interference pattern, suggesting a single particle (or its wave) interferes with itself; when the device is activated no interference pattern is left, and particles are observed to travel through a single slit.  Now, does all this imply that this experiment is typically carried out in a vacuum? If not, how is it that interaction with other particles in the environment of the experiment's set-up are not already influencing the outcome, regardless of whether the measuring device is on or left off?  This question may very well be a very naive one, due to my very limited understanding of particle interaction, vacuums and/or physics in general. If so, I would appreciate a brief, layman's, overview of where my understanding of the different subjects at play here is likely to be lacking. /etc/shadow date of last password change—UTC or local time? man 5 shadow gives the following description of the third field in each line:  The date of the last password change, expressed as the number of days since Jan 1, 1970. The value 0 has a special meaning, which is that the user should change her pasword the next time she will log in the system. An empty field means that password aging features are disabled.  Does this refer to times in UTC or the local timezone? In particular, if I want to calculate comparable numbers using something like $(( $(date +%s) / 86400 )), do I need to pass date the -u option? I've just upgraded from Ubuntu 18.04 to its newest LTS version - 20.04. While it comes with some interesting changes, the Desktop icon system was messed up in my opinion. When you hover the mouse cursor over the icons, you see a huge space marked around them that cannot be violated (as you can see in the image below) so that they need to be placed very far apart from each other.  18.04 allowed you to place icons much closer to each other and didn't have that marked space around them. This new way leaves much less space on the Desktop to organize large amounts of icons - including folders, files and shortcuts. Is there a way I can significantly reduce the size of icons and their "spaces" or go back to the old system of organizing files? On "Settings", there is a tool to change the size of Dock icons, but not of Desktop icons.  Also, every time I move or delete something, the Desktop "flashes" and the icons seem to rearrange themselves automatically, nothing of which happened in 18.04. I also can't move anything directly to the Desktop; I need to move to the Desktop folder on Nautilus. This makes me start to think about downgrading Ubuntu back to 18.04. Automatic image format detection in PHP I am looking for a way to take a user uploaded image that is currently put in a temporary location ex: /tmp/jkhjkh78 and create a php image from it, autodetecting the format.  Is there a more clever way to do this than a bunch of try/catching with imagefromjpeg, imagefrompng, etc? Why are there folders in /Users of already deleted users?