Uniform distribution on z = 1 − √( x ^2 + y ^2) , z ≥ 0
Generate two random numbers with constraints
How do I make the method return type generic? Consider this example (typical in OOP books):    I have an Animal class, where each Animal can have many friends. And subclasses like Dog, Duck, Mouse etc which add specific behavior like bark(), quack() etc.  Here's the Animal class:  public class Animal {     private Map&lt;String,Animal&gt; friends = new HashMap&lt;&gt;();      public void addFriend(String name, Animal animal){         friends.put(name,animal);     }      public Animal callFriend(String name){         return friends.get(name);     } }   And here's some code snippet with lots of typecasting:  Mouse jerry = new Mouse(); jerry.addFriend("spike", new Dog()); jerry.addFriend("quacker", new Duck());  ((Dog) jerry.callFriend("spike")).bark(); ((Duck) jerry.callFriend("quacker")).quack();   Is there any way I can use generics for the return type to get rid of the typecasting, so that I can say      jerry.callFriend("spike").bark(); jerry.callFriend("quacker").quack();   Here's some initial code with return type conveyed to the method as a parameter that's never used.   public&lt;T extends Animal&gt; T callFriend(String name, T unusedTypeObj){     return (T)friends.get(name);         }   Is there a way to figure out the return type at runtime without the extra parameter using instanceof? Or at least by passing a class of the type instead of a dummy instance. I understand generics are for compile time type-checking, but is there a workaround for this? Is save data from previous Dragon Age games used in Inquisition? Does Dragon Age Inquisition make use of save data from previous games in the series?  If so, what benefits does this provide? Prove that $\binom{m+n}{m}=\sum\limits_{i=0}^m \binom{m}{i}\binom{n}{i}$ What is a virtual terminal for? Rounded corner shape with rounded sides Is the current obtained using Ohm's law that which passes through the resistor or that which passes through the circuit? Shouldn't the current passing through a resistor be lesser than that which passes through a circuit? My understanding is that since Current = Charges/Time. If there exists a resistance to the flow of charges, then that must mean the charges slow down, meaning that more time is required to pass through a point. So, the current should then decrease. But, since this opposition to the flow of charges doesn't exist in the ENTIRE circuit, it should really only decrease the current in the resistor, right? Am I confusing the resistance of the resistor with the resistance of the wire? Any help will be appreciated! Thanks a bunch for lending me some of your time :D Overlapping matches in Regex "Specially" vs "especially" When should I use specially and when especially? Commenting out multiple lines of code, specified by line numbers, using vi or vim I have learned from  that it is possible to use vi/vim to comment out a specified range of line numbers.  For example, suppose I have the following bash script:  #!/bin/bash  This is my very very great script   Now suppose that I want to comment out line numbers 6 through 8 (which contain the words very, very, and great) using the # comment character.  In vi/vim, I can simply type :6,8s/^/# to obtain the following:  #!/bin/bash  This is my #very #very #great script   which comments out lines 6 through 8.  My question is, is it possible to type a similar one liner that will remove the # comment character from lines 6 through 8 (but not any other commented lines in the file)?  Having said this, I realize that there is some debate about whether I am actually using vi or vim.  In practice, I open a file script.sh with the command vi script.sh.  Also, when I type the command which vi, I obtain /usr/bin/vi.  Nevertheless, when I simply type vi and press Enter, I obtain this:  ~                              VIM - Vi IMproved ~ ~                               version 7.2.330 ~                           by Bram Moolenaar et al. ~                 Vim is open source and freely distributable ~ ~                           Sponsor Vim development! ~                type  :help sponsor&lt;Enter&gt;    for information ~ ~                type  :q&lt;Enter&gt;               to exit ~                type  :help&lt;Enter&gt;  or  &lt;F1&gt;  for on-line help ~                type  :help version7&lt;Enter&gt;   for version info   which seems to suggest that I'm actually using vim.  I am accessing a remote Ubuntu Linux cluster using SSH from my PC.  I am not using a Ubuntu Linux GUI. What do icons on the tags mean? What does an icon on the tag mean, for example the "rg" before the sql-server tag as pictured below? Is there an open source alternative to "Adobe Digital Editions"? For the moment I run Adobe Digital Editions under Wine to download ebooks burdened with ditigal restriction management. I only use it to open .acsm files supplied by ebook-shops, which contain authentication information required to download the actual DRM'ed ebook files, which I then transfer to my reader-device with calibre. My question is, if there exist open source alternatives to Adobe Digital Editions. They don't need much functionality. I just want to put the .acsm-file in and get the .epub out (no, I don't want to remove the drm, that'd be illegal afaik). Solving a system of ODEs with the Runge-Kutta method I need a formula for conditional formatting to make an Excel 2010 spreadsheet alternate highlighting when a single column changes.  This question, "", is exactly what I want to do, but the suggested solution didn't work for me--it just highlights the first row of each matching value.  I know how to use conditional formatting, but for the life of me I can't figure out or find any pointers on the net so far to make this work.  Ideas?  Here is a link to a picture of how I want my spreadsheet to look when I'm done.  Basically I want every other Disp Number value row to be highlighted.  Seems like it would be a common thing to want to do, and I've seen this asked for in various places, but people struggle with making it work. I have a LAMP server with following configuration.  CPU : Intel(R) Xeon(R) CPU   RAM : 32 GB  HDD : 80 GB  Running on virtual environment.  All the things in the server are running smoothly. But I have noticed that the RAM usage is the server is increasing each day without any reason.   This is the current memory usage on my server.  # free -g              total       used       free     shared    buffers     cached Mem:            31         13         17          0          0         10 -/+ buffers/cache:          1         29 Swap:            2          0          2   And you can see the last 8 weeks memory usage below.   And i have executed the following command to find how much memory each process is consuming.  # ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x&lt;=NF ; x++ ) { printf("%s ",$x) } print "" }'          0.00 Mb COMMAND        2253.62 Mb /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock        1171.66 Mb java -jar /etc/vmagent/bin/VMAgent.jar         138.27 Mb /sbin/audispd         127.75 Mb /usr/sbin/named -u named -c /etc/named.conf -u named -t /var/named/run-root          74.29 Mb auditd          73.03 Mb automount          43.14 Mb /usr/bin/spamd --username=popuser --daemonize --nouser-config --helper-home-dir=/var/qmail --max-children 5 --create-prefs --virtual-config-dir=/var/qmail/mailnames/%d/%l/.spamassassin --pidfile=/var/run/spamd/spamd_full.pid --socketpath=/tmp/spamd_full.sock          43.14 Mb spamd child          43.14 Mb spamd child          37.13 Mb /usr/sbin/httpd          37.02 Mb /usr/sbin/httpd          36.52 Mb /usr/sbin/httpd          36.46 Mb /usr/sbin/httpd          36.23 Mb /usr/sbin/httpd ................   For troubleshooting , i have restarted the MySQL and APACHE servers. But the result was same. Restarting the entire server will fix the issue, but i want to know what is the real issue.  Let me know if you have any idea about this issue.  Thanks,  Arun S Why do I only have 30V going to my light fixture Definition respective derivation of angular momentum formula I am reading An Introduction to Mechanics by Kleppner and Kolenkow (2014). On page 241 is the definition of the :      Here is the formal definition of the angular momentum $\vec{L}$ of a particle that has momentum $\vec{p}$ and is at position $\vec{r}$ with respect to a given coordinate system: $$\vec{L}=\vec{r} \times \vec{p}$$   In the book there is no explanation why this formula should be true. From this equation the formulas for torque and moment of inertia are derived.   My question is: Why is the formula above correct? Why isn't the formula for angular momentum something completely different, like $\vec{L}=\sqrt{(\vec{r} \times \vec{p})2\pi M}$? Is the formula for angular momentum just a mere definition and if not, how to derive it? How did people come across that particular formula? Do I need internet/3G to use GPS? I have a Samsung Galaxy S2 that has some problems with the GPS: If I use internet my navigation works but when I turn the 3G off, GPS does not work.  Do I need internet/3G to use GPS? Find all primes $p$ such that  $ p^3-4p+9 $ is a perfect square.   I tried a few different values for $p$, namely $2,3,5,7,$ and $11$. The prime $p =2,7,11$ all worked but $p =13$ didn't so it makes me wonder. How can I find all primes such that it is a perfect square?  EDIT: it turns out this is problem P25 in post number #63 at In recent versions of PostgreSQL (as of Dec 2013), can we share a query between two or more cores to get a performance boost? Or should we get faster cores? Does "no larger than" imply shapability?