Creating an array of Random Strings [Java] I was wondering if anyone could give me any insight as to how I would go about creating an array of random Strings?   I want to use this array to test the time it takes different sorting methods to execute.
How to generate a random alpha-numeric string I've been looking for a simple Java algorithm to generate a pseudo-random alpha-numeric string.  In my situation it would be used as a unique session/key identifier that would "likely" be unique over 500K+ generation (my needs don't really require anything much more sophisticated).    Ideally, I would be able to specify a length depending on my uniqueness needs. For example, a generated string of length 12 might look something like "AEYGF7K0DM1X".
How do I add Python to the Windows PATH? I want to be able to run Python commands from the Windows CMD. However, if I don't specify Python's full path for each command, I get an error saying "Python is not recognized as an internal or external command, operable program or batch file."  How do I add Python to the Windows PATH permanently? Java in Eclipse: Where do I put files on the filesystem that I want to load using getResource? (e.g. images for an ImageIcon) I know the file needs to be where the getClass().getResource(filename) can find it, but I don't know where that is.  I'm interested both in where to put the files on the filesystem itself, and how to go about using Eclipse's functionality to set up the resources. What is the difference between max, min and sup, inf? Time Expressions with "in" I have seen some examples about using "in" with time expressions. They give some examples as shown below:     I will leave for vacation in a month. (Exactly one month from now I   will go on vacation.)      We’ll be there in an hour.  (Exactly one hour will go by and then we   will arrive.)   But these comments confused me. Then I looked the usage of "in" up in a dictionary and it says about usage of "in" with time expressions :"before or at the end of a particular period". I think the comments and the definition in the dictionary contradict each other?    I have examples of mine:     1- Dinner will be ready in ten minutes. (Maybe dinner will be   ready at the 5th minute? or 8th. Does it strictly mean dinner will be   ready at the end of the ten minutes?)      2- My letter arrived in two days. ( Does that mean it took   exactly two days to arrive? or Could it be just one day because he/she   doesnt remember the exact time?)      3- Imagine you are on the first day of a month and your friend says:   I will be going outside the country in this month. (Does that mean he/she could go tomorrow or ten days later or at the end of the   month?)      4- He can run a mile in 5 minutes. ( Does that mean he has to   spent entire 5 minutes to run a mile? Could it be 4 or 4.5 minutes?) Is there any parameter (in terms of physical quantities such as mass, length, charge...) which can be used to decide when to treat a system quantum mechanically and not classically? I'm assuming that the answer to the question in the title is a resounding yes. Since Baryonic matter and dark matter interact via gravitational forces.  If this is the case how is information not lost if, as is presumed, dark matter does not interact via the electromagnetic force? A Light is shone out the side window of a spaceship ( moving close to light speed ), will the light still travel at the speed of light in the B axis? Install software from packages, or build it from source? This is a  about when to use packaged software and when to build and install it yourself.   When should I install software from packages provided by my OS distribution, instead of building and installing it myself from source?  When is it better to build from source? Subsetting matrices How to migrate a WordPress installation from one site to another, including all images? Find the default application for a certain extension Given xdg-open and an extension, is there a way to get the application which xdg-open is set to for that particular extension?  For example given xdg-open and .jpg the result is eog. I have a question about inheritance in Java.  I have two classes A and B , and class B, inherits from A:  public class A {      public A() {          System.out.println("Hi!");      } }   public class B extends A {      public B() {          System.out.println("Bye!");      }       public static void main(String[] args) {          B b = new B();      } }   When I run program B, the output is:  Hi! Bye!      Question : why the constructor of class A is invoked, when I create and object of class B ?    I know that B inherits everything from A - all instance or class variables, and all methods, and in this sense an object of B has all characteristics of A plus some other characteristics defined in B. However, I didn't know and didn't imagine that when I create an object of type B, the constructor of A is also invoked. So, writing this:  B b = new B();   creates Two objects - one of type B, and one of type A.  This is getting interesting,   can somebody explain why exactly this happens? I've been reading through a lot of the rookie Java questions on finalize() and find it kind of bewildering that no one has really made it plain that finalize() is an unreliable way to clean up resources.  I saw someone comment that they use it to clean up Connections, which is really scary since the only way to come as close to a guarantee that a Connection is closed is to implement try (catch) finally.    I was not schooled in CS, but I have been programming in Java professionally for close to a decade now and I have never seen anyone implement finalize() in a production system ever.  This still doesn't mean that it doesn't have its uses, or that people I've worked with have been doing it right.  So my question is, what use cases are there for implementing finalize() that cannot be handled more reliably via another process or syntax within the language?    Please provide specific scenarios or your experience, simply repeating a Java text book, or finalize's intended use is not enough, as is not the intent of this question. How can I take a photo using a slow shutter speed without it being overexposed? When I try to take a picture using a slow shutter speed in daylight it is overexposed. How can I change the settings so it isn't overexposed? Is there a modal command for MakeLowercase? Analog to  question I've been wondering WHAT is to \lowercase as \bfseries is to \textbf? (... and for uppercase, or \MakeLowercase and MakeUppercase, etc., which also seem to be text-block commands as explained .)  Is there a "switch"/"declaration"/"modal command" (what is the correct term here?, is there a difference between them?) that would allow one to turn something into lowercase/uppercase in the same way that one would use \scshape for example, i.e., not as text-block command with the curly braces?  Or how to create such a command?  I couldn't find any clue on the forum. Forward/Inverse Search Does Not work on certain tex files What is an efficient way to implement a singleton pattern in Java? Graphical glitches using Ubuntu 18.04 on Dell XPS 13 2019 laptop My laptop keeps on having weird screen glitches, sometimes for a second, and that goes away just by moving the cursor, sometimes, making me restart the whole thing.  I could still use the play/pause key and it still played/paused the video that was running even though the screen was completely teared.  Also, printscreens actually print a normal screen and do not show the problem.  Some pictures of the screen when it happens :     Do you guys know what I could do to solve the issue ? How do I set an environment variable on the command line and have it appear in commands? If I run  export TEST=foo echo $TEST   It outputs foo.  If I run  TEST=foo echo $TEST   It does not. How can I get this functionality without using export or a script? My (very simple) question to a friend was how do I prove the following using basic trig principles:  $\tan75^\circ = 2 + \sqrt{3}$  He gave this proof (via a text message!)  $1. \tan75^\circ$   $2. = \tan(60^\circ + (30/2)^\circ)$  $3. = (\tan60^\circ + \tan(30/2)^\circ) / (1 - \tan60^\circ \tan(30/2)^\circ) $  $4. \tan (30/2)^\circ = \dfrac{(1 - \cos30^\circ)}{ \sin30^\circ}$    Can this be explained more succinctly as I'm new to trigonometry and a little lost after (2.) ?    EDIT  Using the answers given I'm almost there:   $\tan75^\circ$    $\tan(45^\circ + 30^\circ)$   $\sin(45^\circ + 30^\circ) / \cos(45^\circ + 30^\circ)$   $(\sin30^\circ.\cos45^\circ + \sin45^\circ.\cos30^\circ) / (\cos30^\circ.\cos45^\circ - \sin45^\circ.\sin30^\circ)$    $\dfrac{(1/2\sqrt{2}) + (3/2\sqrt{2})}{(3/2\sqrt{2}) - (1/2\sqrt{2})}$   $\dfrac{(1 + \sqrt{3})}{(\sqrt{3}) - 1}$   multiply throughout by $(\sqrt{3}) + 1)$   Another alternative approach:   $\tan75^\circ$    $\tan(45^\circ + 30^\circ)$   $\dfrac{\tan45^\circ + \tan30^\circ}{1-\tan45^\circ.\tan30^\circ}$   $\dfrac{1 + 1/\sqrt{3}}{1-1/\sqrt{3}}$   at point 6 in above alternative