How to measure performance test on java method?
How do I time a method's execution in Java?
Evaluating $\int \sqrt{1 + t^2} dt$? How do we solve (i.e. get the closed form of) $\int \sqrt{1 + t^2} dt$ ?   shows the closed form of it but not the steps in solving it.  I think I need some algebraic trick..   I thought of some hyperbolic functions and their derivatives and equalities:  If I make $ t = \sinh x$, then I can reduce the integral to  $$ \int \cosh ^2 x dx $$ though I'm not sure if this is valid. But from here, I cannot go on evaluating the integral... Linux Command Not Functioning As Alias Why is it sensical for a proposition with a false antecedent to validate to true? Show that $u(x)=\ln\left(\ln\left(1+\frac{1}{|x|}\right)\right)$ is in $W^{1,n}(U)$, where $U=B(0,1)\subset\mathbb{R}^n$. The entire problem statement is:  Let $n&gt;1$ and let $U=B(0,1)\subset\mathbb{R}^n$. Show that $u:U\to\mathbb{R}$ given by  $$u(x)=\ln\left(\ln\left(1+\frac{1}{|x|}\right)\right)$$ is in $W^{1,n}(U).$  My attempt at the proof is as follows:  To show that $u\in W^{1,n}(U)$ it suffices to show that $|Du|\in L^{n}(U)$. Consider $$u_{x_i}=\frac{1}{\ln\left(1+\frac{1}{|x|}\right)}\frac{1}{1+\frac{1}{|x|}}|x|^{-2}\frac{x_i}{|x|},$$ which simplifies to, $$u_{x_i}=\frac{1}{\ln\left(1+\frac{1}{|x|}\right)}\frac{1}{1+\frac{1}{|x|}}\frac{x_i}{|x|^3}.$$ Thus, $$|Du|=\frac{1}{\ln\left(1+\frac{1}{|x|}\right)}\frac{1}{1+\frac{1}{|x|}}\frac{1}{|x|^2}$$ which can be manipulated to, $$|Du|=\frac{1}{\ln\left(1+\frac{1}{|x|}\right)}\frac{1}{1+|x|}\frac{1}{|x|}.$$  Moreover, since $U=B(0,1)$ we can bound the second term from above which gives, $$|Du|\leq\frac{1}{\ln\left(1+\frac{1}{|x|}\right)}\frac{1}{|x|}$$  Thus, we can instead show that $$\int_U\left(\frac{1}{\ln\left(1+\frac{1}{|x|}\right)}\frac{1}{|x|}\right)^n&lt;\infty.$$  Converting this into polar coordinates we have with $r=|x|$, $$\int_0^R\int_{\partial B(0,r)}\left(\frac{1}{\ln\left(1+\frac{1}{r}\right)}\frac{1}{r}\right)^n\,dSdr=\int_0^R\left(\frac{1}{\ln\left(1+\frac{1}{r}\right)}\frac{1}{r}\right)^n\int_{\partial B(0,r)}dSdr$$ Note that $\int_{\partial B(0,r)}\,dS=n\alpha(n)r^{n-1}$, which is the surface area of $B(0,r)$. Thus, we have then $$n\alpha(n)\int_0^R\left(\frac{1}{\ln\left(1+\frac{1}{r}\right)}\frac{1}{r}\right)^nr^{n-1}\,dr=n\alpha(n)\int_0^R\left(\frac{1}{\ln\left(1+\frac{1}{r}\right)}\right)^n\frac{1}{r}\,dr$$  And so this is where I get stuck in the problem, since I don't how I can evaluate that last integral to show it's finite.  Thank you for any help or feedback! WinForms: How to programmatically fire an event handler? I want to programmatically invoke an event handler for a control. For example:  DateTimePicker dtpLastConsummated;   I want to trigger the TextChanged event handler for the dtpLastConsummated, how can i do it?  In other languages I would call something akin to:  dtpLastConsummated.TextChanged(this, new EventArgs());   but in .NET you can have multiple event handlers:  dtpLastConsummated.Click +=new EventHandler(dtpLastConsummated_TextChanged); dtpLastConsummated.Click +=new EventHandler(dtpLastConsummated_AnotherHandler); dtpLastConsummated.Click +=new EventHandler(dtpLastConsummated_MoreHandlers); ... dtpLastConsummated.Click +=new EventHandler(dtpLastConsummated_Nminus1);   so you need a way to trigger all the attached event handlers.    Answer  The following code will fire the event:  Toolkit.FireEvent(dtpLastConsummated, "TextChanged", new EventArgs());   And here's the code of the static toolkit function:  /// &lt;summary&gt; /// Programatically fire an event handler of an object /// &lt;/summary&gt; /// &lt;param name="targetObject"&gt;&lt;/param&gt; /// &lt;param name="eventName"&gt;&lt;/param&gt; /// &lt;param name="e"&gt;&lt;/param&gt; public static void FireEvent(Object targetObject, string eventName, EventArgs e) {    /*     * By convention event handlers are internally called by a protected     * method called OnEventName     * e.g.     *     public event TextChanged     * is triggered by     *     protected void OnTextChanged     *      * If the object didn't create an OnXxxx protected method,     * then you're screwed. But your alternative was over override     * the method and call it - so you'd be screwed the other way too.     */     //Event thrower method name //e.g. OnTextChanged    String methodName = "On" + eventName;     MethodInfo mi = targetObject.GetType().GetMethod(          methodName,           BindingFlags.Instance | BindingFlags.NonPublic);     if (mi == null)       throw new ArgumentException("Cannot find event thrower named "+methodName);     mi.Invoke(targetObject, new object[] { e }); }     Note: I'm not creating a subclass of every control in the .NET framework, and every 3rd party control, and convincing an enterprise worth of developers to retrofit every form to use my custom controls. I used the following code to list my java code, but the it looks like there's too much space between words. What can I do?  % source code listing \usepackage{listings} \usepackage{color} \usepackage{xcolor}  \usepackage{caption}  % citation style \usepackage{apacite} \DeclareCaptionFont{white}{\color{white}} \DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}  \begin{document} \begin{lstlisting}[label=some-code,caption=bind to service call] bindService(new Intent(this, Recognizer.class), recConnection, Context.BIND_AUTO_CREATE); \end{lstlisting} \end{document}   The snapshot of what I got. The code not completely shown, and space too wide, in function bindService. How do I appropriately examine the dimensionality of binary data? I have 72 binary variables and, at a theoretical level, I am trying to identify groups of variables that seem to vary together. In practice, I am struggling with how to analyze this data properly. I am using R and the psych package. Here is what I have tried and what the outcomes were:  Estimated a tetrachoric correlation matrix (ran without problem) Estimated MSA (relatively strong values, ran without problem) Ran parallel analysis to identify how many factors to extract (ran without problem) EFA using fa() to estimate factors (non-positive definite matrix and strangely high RMSEA) Tried different factor counts, smoothing/unsmoothing, estimation methods, rotations methods, and removing variables (problems persisted) Tried to focus instead on eBIC (always returned as NULL in output) EFA using (inappropriately) Pearson correlations (RMSEA behaved)  From looking at other questions and answers on here, I am now aware that tetrachoric matrices can be problematic like this. However, I don't know what to do with that information. Accept the problems as a limitation and move forward? Conduct a different type of analysis? I considered IRT as is recommended, but am unaware of an exploratory way to conduct IRT analyses. I understand that most of my options are imperfect. My goal is to find an analysis that is at least arguably appropriate for binary variables and that will inform the ways in which I group these variables in my theorizing. Given this, my questions are:  Can I trust EFA on a tetrachoric matrix despite problematic output? Can I somehow recover the lost eBIC value and use that? Is exploratory IRT possible/desirable? Are there other analyses, in R, that can be used to examine the dimensionality of binary data?  I appreciate all feedback! I love learning about data analysis and hearing about how I can improve. Proving a function is Lipschitz continuous Show that the following function is Lipschitz continuous and find a Lipschitz constant  $$y\mapsto f(x,y)\\ f(x,y)=\frac{y}{x}\ln(\frac{y}{x})\text{  , } |x-1|\leq\frac{1}{2}\text{  , } |y-e|\leq\frac{e}{2} $$  I have no clue on where to begin to prove this.   My first question is how I should interpret this function, is $x$ a sort of constant? How Do I Compute the Eigenvalues of a Small Matrix? Calculate difference between two dates (number of days)? Show that one-sided limits always exist for a monotone function (on an interval) Show that one-sided limits always exist for a monotone function on an interval $[a,b]$.  Me attempt:  1) If a function is monotone on an interval $[a,b]$, then $f(a)\le f(x) \le f(b)$ for $x\in[a,b]$. Therefore if there exists left-hand (right-hand) limit of this function at a given point, then it must be finite. Now we must show that a both left-hand and right=hand limits exist. We use the fact that if we take a sequence $(x_n)\rightarrow c^{+} \in [a,b]$ then $f(x_n)$ is bounded and monotone and therefore it is convergent. How do I resize an encrypted LVM to install another copy of Ubuntu? I have an old PowerBook which has been happily running Ubuntu Server for a few months. Now I want to repartition the hard drive and install Ubuntu Client, while keeping my existing installation intact.  When I first installed Ubuntu, I chose to erase the entire hard drive and use it as an encrypted LVM. Now, the installer seems to recognize the partitions on the drive, but it never prompts me for the password to the LVM.  How do I make room for another installation alongside my current one? How to properly restart unity? Lately I've been seeing this cookie popup that blocks a lot of the screen.  When I try to do the &quot;manage cookies&quot; thing, all it shows me are several categories, with a green oval containing a black circle to the right of each.  Clicking on that oval makes it disappear.  Clicking on the same spot again makes it reappear.  But I see no indication as to which state is off or on. So how can I make this popup go away, never to bother me again?  Or failing that, could you at least provide some indication as to what those buttons do?  Like maybe simple text saying &quot;Off&quot; or &quot;On&quot;? I have an associative array in the form key =&gt; value where key is a numerical value, however it is not a sequential numerical value. The key is actually an ID number and the value is a count. This is fine for most instances, however I want a function that gets the human-readable name of the array and uses that for the key, without changing the value.  I didn't see a function that does this, but I'm assuming I need to provide the old key and new key (both of which I have) and transform the array. Is there an efficient way of doing this? fsck error on boot: /dev/sda6: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY I dual boot Ubuntu and Windows 7. I was browsing on FireFox in Ubuntu and all of a sudden I get some error message, so I rebooted.  Now when I try to boot into Ubuntu I get this message:  fsck from util-linux 2.26.2 /dev/sda6 contains a file system with errors, check forced. /dev/sda6: Inodes that were part of a corrupted orphan linked list found.  /dev/sda6: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.         (i.e., without -a or -p options) fsck exited with status code 4 The root filesystem on /dev/sda6 requires a manual fsck  Busybox v1.22.1 (Ubuntu 1:1.22.0-15ubuntu1) built in shell (ash) Enter 'help' for a list of built-in commands.  (initramfs) _   How can I fix this? Let $f:\mathbb{R}\to\mathbb{R}$ continuous such that $\lim_{x\to\infty}f(x+1)-f(x)=l$.  How can I prove that $\dfrac{f(x)}x$ converges for $x\to+\infty$ ?  I am just trying to prove the convergence, not that it converges to $l$ (that part be deduced immediately by Stolz-Cesaro and the sequential characterization of limits) Unable to stylize raster data as pseudocolor render type on MAC OSX In a raster layer's Style Properties, I can choose pseudocolor render type, and choose a color ramp and classify the raster.      However, when I click the 'Apply' button, or click 'OK', the visualization of the raster never changes.  I was able to output a 'colorized' version of the same raster using GRASS plugin.  I also reinstalled QGIS 2.8, and was able to adjust and see a raster stylings using the steps I outlined above.  So, can anyone confirm this as an issue, or confirm that there's a mistake somewhere in my process?  I should note that I'm on a Mac, 10.10.4, and I'm using the QGIS provided by , 2.10.1-1 .  Update 1: Here's a screenshot of the rest of my settings.      I have Grayscale set to off in the Style setting.  Also, I don't believe grayscale/color-blind Preview is available on the Mac version of QGIS.  They're does't appear to be the option where it , in the Menu Bar under View / Preview / Photocopy (grayscale) etc.  Either way-- I added a shapefile to show color.  Update 2: I've experimented with setting color interpolation to discrete, linear, and exact, but still am not able stylize using Singleband pseudocolor.  I've also confirmed that the 'Render' box on the the main map view is checked.  Also, I am able to adjust Color Rendering settings, like Hue, Blending Mode, etc., and see the results when clicking 'Apply' or 'OK'.  Update 3: As other Mac users are confirming this, I think it may be a bug. I've created a bug report at the official . Is it a good idea to take a break from studying a mathematics PhD and revisit academia at a later stage? Possible Duplicate:          Here is a test case:   void foo(int i, int j) {    printf("%d %d", i, j); } ... test = 0; foo(test++, test);   I would expect to get a "0 1" output, but I get "0 0"  What gives??