I'm pretty new to Java and this website, and I'm sorry if this question has already been asked  but if it isn't to hard, an answer would be extremely helpful.
How do I generate a random int value in a specific range? I have tried the following, but those do not work: Attempt 1: randomNum = minimum + (int)(Math.random() * maximum);  Bug: randomNum can be bigger than maximum. Attempt 2: Random rn = new Random(); int n = maximum - minimum + 1; int i = rn.nextInt() % n; randomNum =  minimum + i;  Bug: randomNum can be smaller than minimum.
It looks like if I load dynamic content using $.get(), the result is cached in browser.  Adding some random string in QueryString seems to solve this issue (I use new Date().toString()), but this feels like a hack.   Is there any other way to achieve this? Or, if unique string is the only way to achieve this, any suggestions other than new Date()? MS word: a macro to turn ON/OFF some proofing settings What macro could turn ON/OFF some proofing settings? (Unfortunately macro recording doesn't record the setting change)  I'm looking for a way to turn ON/OFF 2 proofing settings (at the same time):    check spelling as you type mark grammar errors as you type Gravatar links on "Filtered Questions" page are not HTTPS Distance Between Two Points in Matlab MacPorts fails to find 'make' I've installed Xcode and MacPorts on a brand new mid-2013 MacBook Air, but MacPorts doesn't work, saying that it cannot find anything.  mba:~ cnst$ sudo port install wget Warning: The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build. Warning: See http://guide.macports.org/chunked/installing.xcode.html for more information. ---&gt;  Computing dependencies for wgetError: Unable to execute port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it? mba:~ cnst$   And, indeed, there is no make or clang in the path, but it is definitely installed, though:  mba:~ cnst$ find /Applications -name "clang" -or -name "make" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang /Applications/Xcode.app/Contents/Developer/usr/bin/make mba:~ cnst$   Why is there no make or clang in the path?  Why MacPorts doesn't work?  I notice that  mentions that you have to install something from ADC, Apple Command Line Developer Tools, but ADC doesn't work since last Thursday or Friday due to their security breach, so, the developer tools are nowhere to be found.  What's the proper solution here? Negative probabilities are naturally found in the Wigner function (both the original and its discrete variants), the Klein paradox (where it is an artifact of using a one-particle theory) and the Klein-Gordon equation.  Is a general treatment of such quasi-probability distributions, besides naively using 'legit' probabilistic formulas? For example, is there a theory saying which measurements are allowed, so to screen negative probabilities? Additionally, is there an intuition behind negative probabilities? From time to time certain chat rooms (JavaScript and probably PHP, too) attract the attention of a fellow help vampire who thinks he can start sucking from the people in there.  Often their message end up being flagged as offensive (and those flags are likely to be validated, too, because people are annoyed by such behaviour) but it's kind of an inappropriate use of those flags.  I'm proposing a new chat flag type, which is especially meant for help vampires. Flagging it would present the flag to 10k users and owners of the room where the flag originated (no matter how much rep they have). When the flag is validated it would cause messages from this user to be shown with a low opacity for maybe three hours. It could also notify the user that help vampirism is a bad thing and that he needs to improve his behaviour.  Repeated flags of this type - obviously with some time in between in case multiple message which are really part of the same conversation are flagged - should then result in a temporary ban from the room where the messages got flagged. If that doesn't help the next step would probably be a temporary ban from all chat rooms.    For clarification, I'm not talking about the quick "this line doesn't work, why?" stuff but the kind of help vampires who get cocky even though they just got e.g. a link to a SO question which has a perfectly fine and fitting answer. Because hey, you didn't give them teh codez! loading a view in popup hi i'm trying to display a view in a popup but unable to get a solution. i tried   colorbox node module popup views integration module   Is there any better way to display a view as a popup ? Open Windows Terminal as admin with WIN+R I noticed that my American friends tend to use the past perfect form when they use the verb mention in its past form, almost despite of the context of the sentence. I hear them say  "you had mentioned" a lot more often even in situations where the use of simple past would have been perfectly fine. Have you noticed it too and is it one of those unwritten rules, or is there a more formal explanation to it?  It seems like there was more verbs like that, but I am having a hard time remembering it now. If I do, I will edit the post and likely change the title to accommodate other verbs. Let $F$ be a field and let $a \neq 0$ be a zero of the polynomial $a_0 + a_1x + . . . +a_nx^n$ in $F[x]$.  I want to show that $\frac{1}{a}$ is a zero of the polynomial $a_n + a_{n-1}x + . . . + a_0x^n$  How can I do this? How can I make a script (or make some changes) to allow me to turn the screen off in Ubuntu (12.04) whenever I want, the way thevscreen can be turned off in Cellphones?  And how can I make a combination of keys (a shortcut) to execute that script?  I want to conserve power.  I've seen this question    but there is no hotkey for it.  Moreover, in the answer, it is said that there are many ways to accomplish this so I'd like to know more. In Volo's Guide it is suggested that a curse could transform someone into a race of 'monstrous origin' (p. 118). Does this apply to the Bestow Curse spell specifically? Note: this is a  (my apologies).  In film / lore, such magic does , ,   - or even  transformative curses.  Points &amp; Concerns:   this is within guidelines for a 'reasonable' curse, i.e. less harm than the listed set Bestow Curse writeup encourages DM-homebrewing &amp;/or interpretation. Great role-play possibility / RAI (hence most myths, fairy tales, cartoons, legends, etc) this could be subject to abuse, temptation to bestow a 'curse' as a blessing / boon one could also change: age, size, weight &amp;/or gender (all great curse ideas... but RAW-legal?)   Summation:  What are the limits of the 3rd lvl / Necromatic Bestow Curse spell for transformation? Which edit actions can move a post into Community Wiki mode? Surprisingly, I couldn't find a straight answer to this.  It's not entirely clear in the .  There are (at least?) four different types of edit actions:   Body edits Title edits Retags Rollbacks   And a few actions that show up in the history but aren't really "edits":   Close/Reopen Delete/Undelete   The FAQ seems to indicate that only body edits are important as far as "wikification" is concerned, but I'm not sure if that's really correct or if I'm just interpreting the post too literally.  The FAQ also says that rollbacks don't reverse the calculations - fine, but are they considered to be additional edits or are they ignored?  Can anyone tell me which of these actually count toward the wikification of a post, and whether the rules are any different for owner edits vs. multiple editors? Missing dollar problem This sounds silly but I saw this and I couldn't figure it out so I thought you could help. The below is what I saw.  You see a top you want to buy for $\$97$, but you don't have any money so you borrow $\$50$ from your mom and $\$50$ from your dad.  You buy the top and have $\$3$ change, you give your mom $\$1$,your dad $\$1$, and keep $\$1$ for yourself.  You now owe your mom $\$49$ and your dad $\$49$.  $\$49 + \$49 = \$98$ and you kept $\$1$.   Where is the missing $\$1$? Prove that for any $x_0 \in X$ and any $r&gt;0$, the open ball $B_r(x_o)$ is open.   My attempt: Let $y\in B_r(x_0)$. By definition, $d(y,x_0)&lt;r$. I want to show there exists an $r_1\in\mathbb{R^+}$ s.t. $B_{r_{1}}(y)\subseteq B_r(x_0)$. Let $a\in B_{r_{1}}(y)$. Then, $d(a,y)&lt;r_1$. For $a\in B_{r}(x_0)$, $d(a,x_0)&lt;r$. I want to show $d(a,y)&lt;r_1$ implies $d(a,x_0)&lt;r$. By triangle inequality, $d(a,y)\leq d(a,x_0) + d(y,x_0) \rightarrow$  $d(a,y)&lt;r_1\leq d(a,x_0)+d(y,x_0)&lt;2r...$  I'm a little stuck after this point. Why does ( exit 1 ) not exit the script? How many actuations are "too many actuations"? Specify a bijection from [0,1] to (0,1]. There are two different commands to incorporate another file into the source of some document, \input and \include. When should I use one or the other? What are the differences between them? Are there more things like them to be aware of?