I have a static method that consists of a nested loop going over an integer array of size 10,000. I call that method once, and measure the time using System.currentTimeMillis() (also measured with System.nanoTime()). I then call that method again and measure the time again. I am getting different time taken for both calls. The second call usually takes less time.   A slight difference is fine, but sometimes the difference is significant (more than 5 times the time taken to run the second call). E.g. first method call would take 190ms and the second call would only take 35ms. I have also tried pausing the thread in between the method calls, but the difference in time taken remains.  How can I have a stable measurement of time taken for a method call such that the time taken does not vary significantly for repeated calls?
How do you write (and run) a correct micro-benchmark in Java?  I'm looking for some code samples and comments illustrating various things to think about.  Example: Should the benchmark measure time/iteration or iterations/time, and why?  Related:
USB-C Dongles killing Wifi on 2016/2017 MacBooks – Who’s to blame? I recently switched from my beloved MacBook Pro Retina (Late 2013) i5 2.6/16/512 to MacBook Pro (2017) Non-TB i5 2.3/16/512.  I purchased what from the build-quality looked like a good USB-C-to-DisplayPort cable with 4k/60Hz support, just to run into the very problem the Logicboard repair guru Louis Rossmann had described in : As soon as you plug in the USB-C dongle, the (2.4 GHz) Wifi stops working despite full antenna signal. Unplug the USB-C connector and you are immediately back in the game.  The big question I'm asking myself now: Who is to blame? Is this a design flaw in the current generation MacBooks with improper shielding or is it a design flaw in the various dongles?  I mean the fact that even Apple’s very own USB-C Digital AV Multiport Adapter is causing these WiFi issues (as you can learn from the many horrific ; but AFAIK have been fixed through a ), show that there’s something going horribly wrong. Max length for HTML How to restrict the maximum number of characters that can be entered into an HTML &lt;textarea&gt;? I'm looking for a cross-browser solution. If $A^2\succ B^2$, then necessarily $A\succ B$ I remember reading somewhere about the following properties of non-negative definite matrix. But I don't know how to prove it now.  Let $A$ and $B$ be two non-negative definite matrices. If $A^2\succ B^2$, then it necessarily follows that $A\succ B$, but $A\succ B$ doesn't necessarily leads to $A^2\succ B^2$.  How can you prove it? Thanks! What is the meaning of "would", and how to use it? What is the meaning of would, and which tense is it used in the following sentences?  For example,   That would be Ram calling. I'll answer it. (the meaning of would and which tense is used) The guy on the phone had southern accent. That would be Tom. (the meaning of would and which tense is used) “We saw a police helicopter overhead yesterday morning.” “Really? They would have been looking for those bank robbers.” (the meaning of would and which tense is used) You would have to say/do that. (Why is would used here? What happens to the meaning if would is removed?) John said he didn't steal any money. Well, he would, wouldn't he ? (Why is would used here?)   Why is would used in sentences 1, 2, and 3 to mean "presumption" instead of using other modals, such as: must and should? Does the meaning change if used others?   Can we use will, must, should and could in the place of would, without changing the meaning of sentences?   What kind of meanings would it make if they (will, must, should, and could) are used in the place of would?     I'd be grateful if you could answer me. Convert .sdf database to .mdf database Teenage girl in life-sustaining valley on poisoned Earth visited by another survivor I'm trying to identify a book I read in school, though I can't recall at what grade level; let's say it had to have been published before I graduated high school in 2000. Despite being required reading, it didn't feel much like a classic.  The story took place on Earth, after some catastrophe had caused the air to become poisonous. However, one teenage girl was able to survive because her house was in a valley which was somehow protected from the poisonous winds and was able to sustain its own ecosystem. One day, a man wearing a protective full-body suit and gas mask appears in the valley, and both are rather surprised to find someone else alive. She feeds and shelters the man and shows him how she had come to survive in the valley. Rather abruptly…      the man attempts to rape her, but she overpowers him somehow. She steals his protective suit and starts to leave the valley. He tells her that he had seen birds in a certain direction away from the valley, indicating there might be life there as well, and she leaves.   I believe there was an author's note either at the beginning or end of the book stating that the author had actually died while writing the manuscript, and that their friends or family had finished the book by going off the author's original notes, which I suppose may explain the abruptness of the ending.  In case it wasn't clear from the above, I didn't really like the book. But I'm curious about it regardless. Why shouldn't I care what model/make/year my bicycle is? Can I mix different RAM modules in PC? I have 4 RAM slots on the motherboard P5K. At the moment I have two 1GB RAM modules and two 2GB RAM modules. Everything is working fine.   Can I buy one 4GB module and put it instead of the 1GB module?  Another question, can I mix MHz values, like that I have two 667MHz modules and two 1066MHz modules? Is this dangerous for the comp? Clustering procedure where each cluster has an equal number of points? Process management and high technology weapon. Novel name and author? I am looking for help to point me out at a very old novel (likely from the '60s) about two empires at interstellar war. When it comes to starships, one is technologically very advanced, and the other has very low and inefficient technology.  The highly advanced empire has apparently strong chances to win the war, in particular considering a new technology they were developing. I remember the technology to work like this: consider the space as a flat surface, and on this surface, a disk around the spaceship. When the technology was turned on, this disk was stretched out, as made of rubber, so that it produced a cone, with the tip being the spaceship. The spaceship was therefore teleported 10 parsec away (if I remember correctly), but retained all the connections to the original position. If the spaceship moved, the cone moved as well. This allowed to move in position among enemy ships completely unnoticed, by stretching while afar, then moving in the proper position 10 parsecs away, then destretching.  Despite this technology, the empire lost the war because of delays. It's a perfect example of how having a disruptive technology does not guarantee to win against the competitors.  I am trying to find out the author and name of this novel, hopefully with the date of publication and in which journal/magazine. Manual/automatic line breaks and text alignment in TikZ nodes How to make terminal autocomplete when there are several files/directory? If I have several directories, like:  afoo abar   sometimes my terminal will refuse autocomplete when I press tab (e.g. "cd a" then tab), and print the list of directories instead. Sometimes it even throws a noisy, annoying sound. Any idea how to make it autocomplete in cases like this? E.g it can show abar first, and then afoo if I press tab again. I saw this is the case in windows, or some applciation in Ubuntu Why doesn't Steam start? When I try to start Steam nothing happens. Reinstall doesn't help.  $ steam Running Steam on ubuntu 13.04 64-bit STEAM_RUNTIME is enabled automatically Installing breakpad exception handler for appid(steam)/version(1378500910_client) Installing breakpad exception handler for appid(steam)/version(1378500910_client) Installing breakpad exception handler for appid(steam)/version(1378500910_client) unlinked 0 orphaned pipes removing stale semaphore last operated on by process 7278 with name 0eBlobRegistryMutex_DC7EBB4AEA41D3C6C74E5EFFD6757CEC removing stale semaphore last operated on by process 7278 with name 0eBlobRegistrySignal_DC7EBB4AEA41D3C6C74E5EFFD6757CEC removing stale semaphore last operated on by process 7278 with name 0emSteamEngineInstance removing stale semaphore last operated on by process 7278 with name 0eSteamEngineLock Gtk-Message: Failed to load module "overlay-scrollbar" Installing breakpad exception handler for appid(steam)/version(1378500910_client) [0913/182910:WARNING:proxy_service.cc(958)] PAC support disabled because there is no system implementation   How to fix it? How to accomplish SQL Server 2012+2014 high availability Maybe I'm searching for the wrong thing, but I can't see how I can do this.  I have two servers:   Server A (has SQL Server 2012 installed) Server B (has SQL Server 2014 installed)   Server A provides an API via IIS. The code both inserts and gets data from the database depending on the API call.  Server B does exactly the same for its local database.  I would like to have it so that the two databases are consistent copies of each other. I do believe this is what HA accomplishes.   So a load balancer, for example, might direct API calls to A sometimes, and B sometimes, but the data needs to be consistent either way.  I found some documentation on HA for SQL Server 2012, but not on how to do this for a mixed environment of 2012 and 2014.  Any help or pointers to documentation would be great! Thanks. Will some parents be offended when being asked, "Is it male or female?" If I ask the parent about a baby's gender, will it be impolite or not appropriate to say, "Is it male or female?"  Is there any subtle difference, in terms of politeness, among   "Is it a boy or girl?" "Is it he or she?" "is it male or female?" Do you "gain" your 1st level? Why is the Star Trek 2009 reboot called a reboot? biblatex: per-entry language switching According to biblatex manual (p.24), the hyphenation field in a bib-entry switches language on per-entry basis:     hyphenation field    The language of the bibliography entry. The identifier must be a language name   known to the babel package. This information may be used to switch hyphenation   patterns and localize strings in the bibliography.   This functionality seemed to not work. I just used an example of bib base that comes with biblatex documentation to print the entire bibliography.   \documentclass[a4paper]{article} \usepackage[T1]{fontenc} \usepackage[german,american]{babel} \usepackage{csquotes} \usepackage[style=numeric,backend=biber]{biblatex} \addbibresource{biblatex-examples.bib} \begin{document} \nocite{*} \printbibliography \end{document}   The bibliography contains few entries in German. However in the printed list of references they are formatted with english strings.     [8] Averroes. Drei Abhandlungen über die Conjunction des separaten Intellects   mit dem Menschen. Von Averroes (Vater und Sohn), aus dem   Arabischen übersetzt von Samuel Ibn Tibbon. Ed. and trans. by J. Hercz.   Berlin: S. Hermann, 1869.   Per-entry language switching is provided by the  bundle of bst style for BibTeX. Looking through biblatex internal code, I've got an impression that biblatex needs major re-implementation in order to provide similar functionality. Or am I wrong? Fibonacci Sequence and series limits List of generally believed conjectures which cannot all be true There are some conjectures which most leading experts believe in albeit no one can prove it yet. For example: $\mathcal{P} \neq \mathcal{NP}$, the Riemann hypothesis or the Collatz conjecture.  My question is whether there is a set of such conjectures which cannot all be true, eg. is a statement such as "Either $\mathcal{P} = \mathcal{NP}$ or the Riemann hypothesis is wrong" true?