My goal is to write a framework for measuring method execution or transaction time and for processing the measurements, i.e. storing, analysis etc. Transaction may include calls to external systems, with synchronously or asynchronously waiting for the results.  There already have been some questions around that topic, like    ""  ""  ""   And all the answers boil down to three approaches for taking the time   System.currentTimeMillis() System.nanoTime() Instant.now() and Duration(since Java 8)   I know, all of these have some implications  System.currentTimeMillis()  The result of this method depends on the platform. On Linux you get 1ms resolution, of Windows you get 10ms (single core) ~15ms (multi core). So it's ok for measuring large running operations or multiple executions of short running ops.  System.nanoTime()  You get a high resolution time measure, with nano second precision (but not necessarily nano second accuracy) and you get an overflow after 292 years (I could live with that).  Instant.now() and Duration  Since Java 8 there is the new time API. An instant has a second and a nano second field, so it uses on top of the Object reference two long values (same for Duration). You also get nano second precision, depending on the underlying clock (see ""). The instantiaion is done by invoking Instant.now() which maps down to System.currentTimeMillis() for the normal System clock.  Given the facts, it becomes apparent, that best precision is only achievable with System.nanoTime(), but my question targets more towards a best-practice for dealing with the measures in general, which not only includes the measure taking but also the measure handling.   Instant and Duration provide best API support (calculating, comparing, etc) but have os-dependend precision in standard case, and more overhead for memory and creating a measure (Object construction, deeper callstack) System.nanoTime() and System.currentTimeMillis() have different levels of precision but only have basic "api" support (math operations on long), but are faster to get and smaller to keep in memory.   So what would be the best approach? Are there any implications I didn't think of? Are there any alternatives?
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:
Programmatically combining images in PHP Adding a CMS to an existing Magento shop I am working on a project for 3 niche stores built on magento (using magento's multi-store function)  that each get roughly 50k unique visitors a day.  The sites don't currently have a blog or forum or any social networking aspects.    Would like to add a cms to each site that can be centrally run and would like it to take over the front end content from Magento.  Also would like it to maintain an online blog/publication of sorts with videos, articles, and the like with privileges to edit the content given to a dozen or so people with different privileges.  Want to add a forum to each site that is fairly robust and to possibly add some social networking aspects down the road, so extandability and available plugins/mods in each cms is important.  Other than shared login between the forums,blog/publication and store, would like to be able to integrate some content from the forums and blog/publication into the store as well.  After researching this a bit, I am inclined towards Drupal, but I haven't found any modules to integrate it with Magento.  Also, since the blog content will be done by about a dozen nontechnical people, I want something that is very easy to work with.  Lastly, since the site gets a good amount of traffic, speed and security are very important.  What CMS would you recommend integrating in this context?  Deciding between Drupal, Wordpress and ModX.  Also Plone as well.  Thanks. How can we sum up $\sin$ and $\cos$ series when the angles are in arithmetic progression? How can we sum up $\sin$ and $\cos$ series when the angles are in arithmetic progression? For example here is the sum of $\cos$ series:  $$\sum_{k=0}^{n-1}\cos (a+k \cdot d) =\frac{\sin(n \times \frac{d}{2})}{\sin ( \frac{d}{2} )} \times \cos \biggl( \frac{ 2 a + (n-1)\cdot d}{2}\biggr)$$  There is a slight difference in case of $\sin$, which is: $$\sum_{k=0}^{n-1}\sin (a+k \cdot d) =\frac{\sin(n \times \frac{d}{2})}{\sin ( \frac{d}{2} )} \times \sin\biggl( \frac{2  a + (n-1)\cdot d}{2}\biggr)$$   How do we prove the above two identities? How to launch terminal on login How could I get the terminal to be launched once I have logged in, so that typing commands is much simpler? Replaced wrong car in garage in GTA Online I understand the reasoning behind the fairly narrow textwidth in a default LaTeX article. 60-80 characters per line and all that. However, I am preparing a document that features many lengthy equations, and it seems silly to me to restrict the equations to fit into the same margins as the text when there's all that whitespace going unused on either side.  I'd like to have equations which are wider than the textwidth do the obvious thing, that is, continue to be centered on the page just like all the other equations, and simply extend into both the left and right margin equally. My equations are unnumbered, so there's no concern about where to put equation numbers.  How might I go about implementing this? Lead in ice block This is a strange question I would like to have some explanation accompanied with:  We have an ice block, with in it a lead block. This entire block is put into a glass of water, resulting in a rise of water level until the edge of the glass. The block stays floating on the surface. What will happen with the water level when the ice melts?  The answer is that it will drop, but how is this even true?? My thoughts are: - block floats on water, so rho(block) &lt; rho(water) - Archimedes law, the Fg of block = Fg of water pushed away. - Since a smaller volume of water has equal mass (and so Fg) to block, and ice is less dense than water, when it melts, no mass is lost, so it will take in less space??? Please help me with this point of thinking. How to rename wp-includes folder? Is there a way that we could rename wp-includes folder   I have found out there are ways to do for other folders. But how do we do it for wp-includes folder? Distribution of $-\log X$ if $X$ is uniform. For $X$ and $Y$ random variables; $X$ follows the uniform distribution.  (1): if $Y=-\log X$  (2): then it can be shown that $-\log X$ is distributed as $\exp(1)$ {i.e. exponential with mean 1}.  Why is this so? Intuitively statement (2) make sense to me. But i'd like a mathematical proof.  -Probably wrong working:  (1) seems to imply $\exp(-Y) = X$ (which is like saying $X$ is exponentially distributed, which is a contradiction, since its actually uniform!); or is it incorrect for me to do this since $X$ and $Y$ are random variables?  Ultimately how do I prove (2)?  Thanks Make "compact view" as a default directory view instead of "icon view" How can I make "compact view" the default for all directory views in File Manager, instead of "icon view" ? Temporarily change language for terminal messages/warnings/errors Messages in my terminal are displayed using Russian language by default, which is my native one.  For just a moment I want them to be in English (eg. to paste in forums), then switch back to the default language.  How can I do the switch and switch back using bash? Which way does the scale tip? What's the best way to get the last N elements of a Perl array? I remember reading a while back about arithmetics with only a single operator that did all the work of the familiar $+ - \times /$ operators. If there is such a thing, could someone point me to it?  As background: I have a side project where I'm playing with neural nets and genetic search algorithms. Right now it's the good old kind, with matrix multiplication and addition. I thought it would be interesting to implement a sort of neural network that used a combined or "all in one" operator.  I've googled like heck and can't pick up the trail of where I thought I saw that before.  Is there study in that area, or am I mis-remembering, or worse, just making it up? I'd appreciate any pointers. TikZ doesn't fill when node coordinates are used Can someone please explain me why the following code doesn't result in a fill?  And why, sometimes, I get such "very thin lines" artifact (that's visibile in my picture)?  \begin{tikzpicture} \node (A) at (0,0) {A}; \node (B) at (1,0) {B}; \node (C) at (1,1) {C}; \fill[red] (A) -- (B) -- (C) --cycle; \end{tikzpicture}   Here's what I get: How to write conditional equations with one-sided curly brackets I want to write a conditional expression such as the following.    What is the best way to express such conditional expressions in Latex? I'm looking for either a single word or phrase that would describe either someone or the action of dismissing someone's opinions as something "socially unpopular", without giving any reasoning why, either just to spite them, because they have a poor counter-argument, have been backed into a corner, or something similar.  For example, someone who supports something politically incorrect (like, say, stronger gun control or help for male domestic abuse) might have their views dismissed as racist or sexist or liberal without actually acknowledging and debating against them, thus labeling the former as something they might not be.  I was talking to a friend earlier about politics, and she complained about Germany's immigration problem. She said one issue was that many politicians that try to support stronger immigration laws would immediately be shot down as racist or a nazi and forced to resign, instead of being presented with counter-arguments. Regardless of whether you agree with them or not, what would describe that?  EDIT: Forgot to specify -- the word or phrase I'm looking for would be used in an informal context. And to address further questions, to be used when the person's opinion has legitimate worth and isn't just "being racist" etc, i.e. the dismisser is incorrect, and is only making these accusations because they can't argue further. (Added emphasis to the last sentence of the first paragraph) Updating to latest Blender version I currently have version 2.74. How do I update to version 2.76? I do not see any links in the UI to update my version of Blender How to change the output redirection of a running process? I know how to redirect output and how to  in bash. Now, suppose I accidentally forgot to append the output redirection part to the command (e.g. 2&gt;&amp;1 or &gt; /tmp/mystdout) and my background process is already running for a while, can I still change to where stdout and stderr are being written to? I really would like not to kill and restart the application.  To be more specific as asked by  in his comment, I would like to fiddle with it in these scenarios in specific:   wrong output file forgot to redirect stderr to stdout   or a combination of both  E.g. I have Apache running and I can see the file descriptors:  /proc/8019/fd/0 -&gt; /dev/null /proc/8019/fd/1 -&gt; /dev/null /proc/8019/fd/2 -&gt; /var/log/apache2/error.log About the number format in ticks