How can I ask a user for 4 numbers and print them out sorted (ascending / descending)?
How do I compare strings in Java?
How can I launch a GameObject at a target if I am given everything except for its launch angle? I am trying to launch an object at a target, given its position, its target position, the launch speed, and the gravity.  I am following this formula from :  $$ \theta = arctan \bigg( \frac{v^2 \pm \sqrt{v^4-g(gx^2 + 2yv^2)}}{gx} \bigg) $$  I have simplified the code to the best of my ability, but I still cannot consistently hit the target.  I am only considering the taller trajectory, of the two available from the +- choice in the formula.  Does anyone know what I am doing wrong?  using UnityEngine;  public class Launcher : MonoBehaviour {     public float speed = 10.0f;      void Start()     {         Launch(GameObject.Find("Target").transform);     }      public void Launch(Transform target)     {         float angle = GetAngle(transform.position, target.position, speed, -Physics2D.gravity.y);         var forceToAdd = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) * speed;         GetComponent&lt;Rigidbody2D&gt;().AddForce(forceToAdd, ForceMode2D.Impulse);     }      private float GetAngle(Vector2 origin, Vector2 destination, float speed, float gravity)     {         float angle = 0.0f;          //Labeling variables to match formula         float x = Mathf.Abs(destination.x - origin.x);         float y = Mathf.Abs(destination.y - origin.y);         float v = speed;         float g = gravity;          //Formula seen above         float valueToBeSquareRooted = Mathf.Pow(v, 4) - g * (g * Mathf.Pow(x, 2) + 2 * y * Mathf.Pow(v, 2));         if (valueToBeSquareRooted &gt;= 0)         {             angle = Mathf.Atan((Mathf.Pow(v, 2) + Mathf.Sqrt(valueToBeSquareRooted)) / g * x);         }         else         {             //Destination is out of range         }          return angle;     } } Can I achieve a torchlight effect (lighter area around a light source) in a 2D game? I am thinking of writing myself a simple 2D game. It will not shine with perfect graphics or gameplay at first, but I'd consider it my first step in PC game development. So, imagine such simple sprite-based 2D game (like Heroes IV or Startcraft BroodWar).  I want the gameplay to support day/night with the according lighting changes and at the same time it will be madness to have to create sprites for every lighting nuance. So, I decided adding a semi-transparent layer on top of other objects will be enough.   The issue with this solution is if I have a light source object in the game (like the hero wearing a torch, or a burning building), there must be a lighter area around it, right? Since I am putting my semi-transparent layer over everything, how would you suggest to achive the torchligt visual effect I want? Maybe redraw that layer adding 'gaps' or differently colored areas based on the lighting effect? how many ways can the letters in ARRANGEMENT can be arranged When I boot Ubuntu 10.04.3 from a live CD, it asks me to enter a username and password. I have not booted before, and I haven't created an account. I am a British citizen and US permanent resident. I rarely need visas. However, I am considering a Mediterranean cruise in the spring or summer of 2019.  Unlike British politicians, I like to plan ahead and be prepared. If I am going to need a Schengen visa, I want to assemble the documentation early next year, so I can apply to the appropriate country as soon as I have an itinerary and it is at most 90 days before travel. Given how things are going, I am preparing for a hard, no-agreement, Brexit.  For trade, that would mean WTO rules. For personal travel, is there a similar fall-back that would allow me visa-free visits to the Schengen countries? Condition for a tensor to be decomposable The Half-Elven and their choices Earendil and Elwing were given the choice of kindreds after their journey to Valinor, This choice was extended to their sons (specifically sons, not daughters or grandchildren)  Elrond chose the race of the Eldar and his brother Elros chose to be counted amongst the Edain. Thus far Manwë's proclamation has been fulfilled.  There are some inconsistencies here:   Arwen was given the choice, but Elladan and Elrohir remained as Eldar in Imladris Tar-Vardamir was not given the choice The offspring of Imrazor and Mithrelas in Dol Amroth dont seem to have been given a choice   I can think of only one explanation, that the Mannish blood is dominant over the blood of the Eldar, thus, As Vardamir was the offspring of two mortals he did not fall under Manwë's proclamation despite being the son of a half elven.  However this does not seem to explain the other inconsistencies, Is it possible that Elladan and Elrohir and also the princes of Dol Amroth weren't considered important enough by Manwë or Eru to give them the choice.  Also as a side note Tolkien states there were only three unions between man and elf, but this seems to ignore Turin/Finduilas and Imrazor/Mithrelas  My question is, Why was Arwen given the choice and not the sons of Elros? There is a book I read in the 1980s or 1990s from a Ca.  library. It was a hard copy not a paperback. It is not "To Outlive Eternity/Tau Zero" by Poul Anderson (I have that one). It may have been written by a woman or someone whose last name starts with an "L".  A large crew of men and women are in a new super fast space ship. They are being chased by someone and they outrun the collapse of the universe, but they have lost their home planet. They watch as the universe is reborn. They go into orbit around a planet that looks like it can support life like theirs. They are moving super fast. They look like a ring of radiation going around the planet. They put down 10 super metal markers with scientific info onto the surface of the planet. They watch the planet develop and form life like the dinosaurs and then evolve into human like life forms.  There are 2 warring countries on the planet. They block or turn off the sun to freeze the planet and force the countries to form one world government. The planet gets freezing cold and the people start to freeze. The countries agree to form one world government. The people on the ship are welcomed to the planet. I often use  to keep my sentences gender neutral. Many of my friends (none of them are native speakers), however, consider this to be grammatically incorrect, and suggest me not to use it in formal English exams.  My questions are:   Is singular they widely accepted in English speaking countries such as America and Britain? Is it formal enough to be used in formal situations, such as a public speech? Is it casual enough to be used in informal situations, such as gossiping among friends? Mammals, reptiles, arachnids, insects, etc are all as far as I am aware symmetrical in appearance.  Take a human for instance, make a line from the top of our head right down the middle. However, internally it is not the same. Our organs excluding the kidneys, lungs, reproductive organs, etc are not symmetrically placed in our body.   Why do we not have an even number of each organ so it can be placed symmetrically? If we have a single organ why is it not placed in the middle like the brain or bladder is for instance? Is there some evolutionary advantage that led to this setup? Is it possible to make an ASP.NET MVC route based on a subdomain? . If you filter out a range of wavelengths, how can you calculate the energy from the remaining wavelengths?   To make it concrete, say we filter everything below 450nm or alternatively above 700nm. Practically speaking, how do people handle ANOVA when the data doesn't quite meet assumptions? This isn't a strictly stats question--I can read all the textbooks about ANOVA assumptions--I'm trying to figure out how actual working analysts handle data that doesn't quite meet the assumptions. I've gone through a lot of questions on this site looking for answers and I keep finding posts about when not to use ANOVA (in an abstract, idealized mathematical context) or how to do some of the things I describe below in R. I'm really trying to figure out what decisions people actually make and why.   I'm running analysis on grouped data from trees (actual trees, not statistical trees) in four groups. I've got data for about 35 attributes for each tree and I'm going through each attribute to determine if the groups differ significantly on that attribute. However, in a couple of cases, the ANOVA assumptions are slightly violated because the variances aren't equal (according to a Levene's test, using alpha=.05).   As I see it, my options are to: 1. Power transform the data and see if it changes the Levene p-val. 2. Use a non-parametric test like a Wilcoxon (if so, which one?). 3. Do some kind of correction to the ANOVA result, like a Bonferroni (I'm not actually sure if something like this exists?). I've tried the first two options and gotten slightly different results--in some cases one approach is significant and the other is not. I'm afraid of falling into the p-value fishing trap, and I'm looking for advice that will help me justify which approach to use.  I've also read some things that suggest that heteroscedasticity isn't really that big of a problem for ANOVA unless the means and variances are correlated (i.e. they both increase together), so perhaps I can just ignore the Levene's result unless I see a pattern like that? If so, is there a test for this?  Finally, I should add that I'm doing this analysis for publication in a peer-reviewed journal, so whatever approach I settle on has to pass muster with reviewers. So, if anyone can provide links to similar, published examples that would be fantastic. Arraylist to List using .Net? GZip of drive image created by using `dd` command I created yesterday a drive image using GZip.  I opened the 51.3 GiB file named ssd.img.gz to see one icon thats a package of 3.9 GiB, yes, thats THree point Nine Gigabytes in size and has the name of the image as ssd.img  That does not seem right to me, has the image creation worked or not?  Yes the drives have data and an operating system on it.  Should I have used cat instead? only I did and it kept on saying that it had nothing to do.  Would using the | zip instead be a better option?    ** EDIT **  The command used was:  mark@zotac:~$ sudo -l Enter password:&lt;entered password to get in to root&gt; root@zotac:~# dd if=/dev/sda | gzip -c &gt; "/media/mark/Seagate External Drive/ssd.img.gz   the terminal spent the best part of 10 Hours at building the image, something in itself that I also found suspect, why so log when copying the files to a folder that I wanted, some 40GiB took 45 minutes...  The source drive /dev/sda had no mounted partitions.     ** EDIT **  Just to clarify, I am trying to make an image of the drive to back up later if things go wrong with a repair, the drive itself needs to be a file on a drive as the target drive partition is using almost all of the drive, the partitions can't be resized on it without formatting it and I am not about to lose 1.4TB of data.   So the dd if=/dev/sda of=/&lt;target&gt; isn't what I need, what I do need is an image of the drive that I can restore the image from to the drive should the repair go wrong.  So what command do I use, dd or cat? Why does | zip keep telling me it has nothing to do when used with cat but no error or warning with dd I have a  with a fingerprint reader:    How to make Ubuntu recognise it and use it for login?  I already tried:  sudo add-apt-repository ppa:fingerprint/fingerprint-gui sudo apt-get update   ... but this GUI did not recognizes my device. Does anyone knows any other option? How to change root password for mysql and phpmyadmin I've set up mysql and phpmyadmin and chose not to set a password when installing hoping that once set up i could login with root and no password but i get the following error from phpmyadmin:  Login without a password is forbidden by configuration (see AllowNoPassword)   I have previously moved the phpmyadmin folder to /var/www/   I have tried changing the following line  $cfg['Servers'][$i]['AllowNoPassword'] = false;   to  $cfg['Servers'][$i]['AllowNoPassword'] = true;   but still had no success, so i am wondering is there a way i can change the root passwords for both so i can access phpmyadmin and create databases. How can I install Ubuntu without removing Windows? I need my pre-installed version of Windows 7 (or any other version of Windows), how could I install Ubuntu without erasing it? "Always on Top" Windows with Java In Java, is there a way to have a window that is "Always on top" regardless if the user switches focus to another application?  I've searched the web, and all of the solutions lean to some sort of JNI interface with native bindings.  Truly this can't be the only way to do it?.. or is it? Proof that $a\mid b \land b\mid c \Rightarrow a\mid c $ I am trying to prove:     $a\mid b \land b\mid c \Rightarrow a\mid c $   $a\mid b$ means that a divides b if there is an integer k, that $b=k\cdot a$  Please give me a hint on how to start, because I have no idea.