Java creating a array of type generic
What's the reason I can't create generic array types in Java?
When a star becomes a black hole, does its gravitational field become stronger? Where are static variables stored in C and C++? I accidentally clicked reject on the suggested edit on this question(). I can't find the button to change it to Approve? What is tail call optimization? Can a continuous real function take each value exactly 3 times? I will like to know some of the android emulators that work really well with Ubuntu 11.10 and above. I want to try 'whatsapp' on Ubuntu through an android emulator. Thanks in advance Equation of motion of a free particle We know that the equation of motion of particle can be derived from the respective action. But in the book I am reading, the author is saying:     ... timelike worldline of a massive particle is parametrised by proper time, $x^a=x^a(\tau)$. The velocity (tangent) vector is $u^a \equiv \dot{x}^a(\tau)$. This is normalised as $u^au_a =-c^2$.   How can one derive e.o.m? I installed Ubuntu 14.04 onto my Acer Aspire E15. The PC has a 500 Gigabyte HDD.   During the installation it divided the HDD into separate partitions. However every time I turn on the PC it goes directly into Windows 8.1. It doesn't allow you the opportunity to select which OS you want to use.   Question 1: How do I set the PC so it will allow me to select the OS?  Question 2: And if #1 isn't possible. How to I remove Ubuntu from the PC and recover the partition for Windows How to write 1, 2, ... as a subscript to a letter? Proving Pascal's identity So I came across Pascal's identity: Prove that for any fixed $r\geq 1$, and all $n\geq r$, $$ \binom{n+1}{r}=\binom{n}{r}+\binom{n}{r-1}. $$  I know you can use basic algebra or even an inductive proof to prove this identity, but that seems really cumbersome. I was wondering if anyone had a "cleaner" or more elegant way of proving it. For example, I think the following would be a decent combinatorial proof.   Proof: Let $S$ be a set with $n+1$ elements, and consider some fixed $x\in S$. There are $\binom{n+1}{r}\;\; r$-subsets of $S$--count them according to whether or not they contain $x$: there are $\binom{n}{r}$ not containing $x$, (each formed by choosing $r$ of the remaining $n$ elements in $S\setminus\{x\}$), and there are $\binom{n}{r-1}\;\; r$-sets containing $x$, (each formed by selecting an additional $r-1$ elements in $S\setminus\{x\}$).   Is that right? Are there any other efficient ways of doing it? Is there a --parents option for mv like for cp? cp has a useful feature --parents that allows a file's directory structure to be copied to another directory:  $ cp -v --parents source/directory/from target/ ‘source/directory/from’ -&gt; ‘target/source/directory/from’   How do I similarly move a file? How can I force a program to open in a specific desktop? I've created an environment where I use 3 different desktop configurations, but every time I reboot, I have to manually open each program in that target desktop to make it look like it did before.   So, I'd like to write a .bat file that can get all my programs running in their appropriate desktops. I'm wondering if something like this is possible:  "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -desktop:2 "C:\Program Files\My\Other\Software.exe" -desktop:3 ...etc.   Obviously, this example is not real, but I hope there's something similar. I don't care if it's hacky :) Switch statement fallthrough in C#? Switch statement fallthrough is one of my personal major reasons for loving switch vs. if/else if constructs. An example is in order here:  static string NumberToWords(int number) {     string[] numbers = new string[]          { "", "one", "two", "three", "four", "five",            "six", "seven", "eight", "nine" };     string[] tens = new string[]          { "", "", "twenty", "thirty", "forty", "fifty",            "sixty", "seventy", "eighty", "ninety" };     string[] teens = new string[]         { "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",           "sixteen", "seventeen", "eighteen", "nineteen" };      string ans = "";     switch (number.ToString().Length)     {         case 3:             ans += string.Format("{0} hundred and ", numbers[number / 100]);         case 2:             int t = (number / 10) % 10;             if (t == 1)             {                 ans += teens[number % 10];                 break;             }             else if (t &gt; 1)                 ans += string.Format("{0}-", tens[t]);         case 1:             int o = number % 10;             ans += numbers[o];              break;         default:             throw new ArgumentException("number");     }     return ans; }   The smart people are cringing because the string[]s should be declared outside the function: well, they are, this is just an example.  The compiler fails with the following error:   Control cannot fall through from one case label ('case 3:') to another Control cannot fall through from one case label ('case 2:') to another   Why? And is there any way to get this sort of behaviour without having three ifs? limit find output AND avoid signal 13 I have a directory with ~1M files and need to search for particular patterns. I know how to do it for all the files:  find /path/ -exec grep -H -m 1 'pattern' \{\} \;   The full output is not desired (too slow). Several first hits are OK, so I tried to limit number of the lines:  find /path/ -exec grep -H -m 1 'pattern' \{\} \; | head -n 5   This results in 5 lines followed by  find: `grep' terminated by signal 13   and find continues to work. This is well explained . I tried quit action:  find /path/ -exec grep -H -m 1 'pattern' \{\} \; -quit   This outputs only the first match.  Is it possible to limit find output with specific number of results (like providing an argument to quit similar to head -n)? Avoid footnotes from appearing before mark What is the EV scale? I have seen an "EV" (exposure value) scale that's sometimes used to express a camera's exposure settings, or scene brightness. How exactly does this scale work? Which package can be used to write BNF grammars? I receive the error 'grub-install /dev/sda failed' while attempting to install Ubuntu as the computer's only OS. I am attempting to install Ubuntu on a box which was previously running Windows 7.  I have also experienced the dreaded "Unable to install GRUB" error.  I am not attempting to dual boot. I have previously run a Windows boot disk and removed all existing partitions.  If I run the Ubuntu 12.04 install CD and click install after the config screens, I get the error   Executing 'grub-install /dev/sda' failed. This is a fatal error. (It is the same error as this question: )  All the questions I've read while looking for a solution are related to dual boot.  I'm not interested in dual boot, I'm after a clean out the box Ubuntu install. How can I achieve this?  (For my sanity, please use very simple instructions when responding. I don't claim to have any talent either for linux or as a sysadmin)    Additional details copied from comments dated: 2012-05-29 ~15:19Z  After booting from the CD, clicking Try Ubuntu, and then sudo fdisk /dev/sda I get fdisk: unable to seek on /dev/sda: Invalid argument  sudo fdisk /dev/sdb gives   Device contains neither a valid DOS partiion table, nor Sun, SGI or OSF disklabel.  Building a new DOS disklabel with disk identifier 0x15228d1d.  Changes will remain in memory only until you decide to write them.  After that of course, the previous content won't be recoverable.  Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite).  Command (m for help):   I should add the Live CD desktop is graphically bad. I've got missing parts of programs and the terminal occasionally reflects to the bottom of the screen. But I can't imagine this is related. Primes congruent to 1 mod 6 I came across a claim that I found interesting, but can't seem to prove for some reason. I have the feeling it should be easy  a prime $p$ can be written in the form $p = a^2 -ab +b^2$ for some $a,b\in\mathbb{Z}$ if and only if $p\equiv 1\bmod{6}$ Can't install php5 on Ubuntu 16.04 so I've recently installed my first Ubuntu, to be precise, a daily build of 16.04, on my new laptop since the hardware was to new for 15.10. Now I'm in the process of setting it up and I want to install php5 and some extensions.  When I execute sudo apt-get install libapache2-mod-php5 I get the error message that there is no installation package available for php5 and libapache2.  The error message is in german, so I doubt that this would help, but anyways here it is. :-) E: For package »libapache2-mod-php5« existiert kein Installationskandidat.  Do I need to add a apt-get repository? Or what am I doing wrong?