I have an editable div in which users write text for comment. Now I want to remove space before and after the text. For example when a user type   "&amp;nbsp;&amp;nbsp;Hello&amp;nbsp;world&amp;nbsp;&amp;nbsp;&amp;nbsp;"   I have to insert   "Hello&amp;nbsp;world"    into the database.  I have tried   text.trim()   but it doesn't work. How can I do this ?  Also how to remove duplicates empty line ?  I would like to replace   &lt;div&gt;Hello&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;World&lt;/div&gt;   By   &lt;div&gt;Hello&lt;div&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;World&lt;/div&gt;   Thank you
How do I trim a string in JavaScript? That is, how do I remove all whitespace from the beginning and the end of the string in JavaScript?
Significance of assumption in competition inequality questions Refer to the problem below (IMO 2009 Shortlist)     Let $a, b, c$ be positive real numbers such that $$\frac{1}{a} + \frac{1}{b} + \frac{1}{c} = a + b+ c$$   Prove that    $$\frac{1}{(2a+b+c)^2} + \frac{1}{(2a+b+c)^2} + \frac{1}{(2a+b+c)^2} \leqslant \frac{3}{16} $$    In the solution given by the  (Pg 16), it states that      Without loss of generality, we choose $$a +b+c = 1$$.    Thus, the problem becomes    $$ \frac{1}{(1 + a)^2} + \frac{1}{(1 + b)^2} +\frac{1}{(1 + b)^2} \leqslant \frac{3}{16}(\frac{1}{a} + \frac{1}{b} + \frac{1}{c})$$    Applying Jensen’s inequality to the function $$f(x) = \frac{x}{ (1+ x)^2}$$   ,which is concave for $0 ≤ x ≤ 2$   and increasing for $0 ≤ x ≤ 1$, we obtain   $$α \frac{a}{(1 + a)^2} + β \frac{b}{(1 + b)^2} + γ \frac{c}{(1 + c)^2} \leqslant (α + β + γ) \frac{A}{(1 + A)^2}$$   , where $A =\frac{αa + βb + γc}{α + β + γ}.$   Choosing $α = \frac{1}{a} , β =\frac{1}{b},$ and  $γ = \frac{1}{c}$   , we can apply the harmonic-arithmetic-mean inequality   $$A =\frac{3}{\frac{1}{a} + \frac{1}{b} + \frac{1}{c}} ≤ \frac{a + b + c }{3} = \frac{1}{3} &lt; 1$$   Finally we prove:   $$ \frac{1}{(1 + a)^2} + \frac{1}{(1 + b)^2} +\frac{1}{(1 + b)^2} \leqslant ( \frac{1}{a} + \frac{1}{b} + \frac{1}{c}) \frac{A}{(1 + A)^2} \leqslant ( \frac{1}{a} + \frac{1}{b} + \frac{1}{c})\frac{A}{(1 + \frac{1}{3})^2} = \frac{3}{16}(\frac{1}{a} + \frac{1}{b} + \frac{1}{c}) $$   However,  (Pg 4) differs by having $a +b+c=3$ and setting $f(x) = \frac{1}{16x} - \frac{1}{(x+3)^2}$ and allowing Jensen to resolve the rest.   The questions are as follows;   How do you choose before hand which $a + b+ c =$ to choose?  Why particularly does the assumption differ between the 2 solutions? How does one know before hand the choosing of $α = \frac{1}{a} , β =\frac{1}{b},$ and  $γ = \frac{1}{c}$?  Where and how did $A =\frac{αa + βb + γc}{α + β + γ}$ come from?   Any help would be much appreciated. How do you cite a Github repository? GroupBy a list of associations with their keys What are the practical applications of the Taylor Series? I started learning about the  in my calculus class, and although I understand the material well enough, I'm not really sure what actual applications there are for the series.  Question: What are the practical applications of the Taylor Series? Whether it's in a mathematical context, or in real world examples. I'm looking for a library/method to parse an html file with more html specific features than generic xml parsing libraries. What is the function of this circuit? Just wondering if someone can give me an explanation for this capacitor layout - what is it's function? The chip to the right is an ADC.  Circled in blue.    I'm guessing it is well known but i don't know how to search for it. I'm looking to generate a set of 5 random variables and enforce a dependence structure between them and onto a dependent variable $Y$.  I understand how to generate correlated random variables for multivariate normal, but not when mixing different types.  Below is a little more than I need, but I'm hoping someone can give me a general way of solving this problem...   $X_1$ and $X_2$ need to be highly correlated Bernoulli variables.  $X_3$ needs to take one of 5 categorical values, call them "A"..."E".  $X_4$ needs to be normal, and negatively correlated with $X_1$, $X_2$.  $X_5$ needs to approximate test scores from $0$ to $100$ with a high skew, so gamma probably.  $X_5$ needs to be positively correlated with $X_1$, $X_2$, $X_4$.   Each of these variables must impact a "success/occurrence" Bernoulli distributed variable $Y$.  How would I begin?  I would like to enforce correlation both between the values of $X$, and also between each $X$ and $Y$.  (The categorical correlations seem particularly confusing to me.) What are all possible ways to stop a zombie from despawning? Is there any way for which we are able to stop a zombie from de-spawning no matter how far we go? If so, what are all possible ways?  Bonus question: what are all the other techniques for which we can prevent a zombie from de-spawning within a specific block radius? I've always had a LOST.DIR folder on my external SD card, which until now has been empty.  Today my phone complained that my SD card was damaged and wouldn't mount it, so I pulled it out and looked at it on my computer.  There's now a 70237 file inside LOST.DIR which is 128 MB.  It starts with something like "&euml;&lt;MSWIN4.1", seemingly to indicate that it's a dump of a  (which makes no sense).  What did Android dump here and and why?  (I think I may have disconnected my phone from my PC yesterday without ejecting the drives first, so that might be the "why", though it was from Windows XP and not Windows 98.)  Is there a simple way to recover the information in this file? What is the SE version of Seven Dirty Words? Caution: R-rated language  Some words, when present in a comment, make it eligible for instant, automatic one-flag deletion. Out of the , only      shit and fuck    appear to work this way. But then there are other, Stack Exchange-specific dirty phrases:    accept rate or accept-rate acceptance rate  what have you tried   whore    Are there other such words or phrases? Is there a complete list of them?     Some suspect words and phrases that do not suffice for automatic deletion:       accept an/the answer, thank you, voting to close, piss, bitch, idiot, cunt (often found on Stack Overflow as a misspelling of "count"). How to define a bijection between $(0,1)$ and $(0,1]$? When getting a new credit card, what is the policy in regards to signing the strip on the back? Should I sign it? Should I write "See ID"? Should I leave it blank? Should I sign it AND write "See ID"?   I see all sorts of different advice but it seems like it's all based on urban legends, hearsay, or self interest (merchants and banks seem to advise you to do what's best for them, not what's best for the customer).  My question: For an average everyday consumer who uses a card fairly frequently, what is the best practice? What practice is most secure? How to make a domain receiving email behind cloudflare? How to get the native version of Spotify running? Schwarz's Lemma, fixed points question How can I parse dates and convert time zones in Perl? What are the use cases for different scoping constructs? $f(x)$ is a strictly increasing, and continuous, function on $[0,+\infty)$. Consider the integral,  $$\int_0^a f^{-1}(x) dx.$$  Reasoning  The interval $[0,a]$ is "reflected" across the line $y=x$ onto the interval $0 \leq y \leq a.$  $f(x)$ and $f^{-1}(x)$ are symmetric across the line $y=x$. So, the integral is equivalent to the area bounded by $y = 0$, $y=a$, and $f(x)$.  So, "integrating $f$ along an interval on the $y$-axis" is the same as integrating $f^{-1}$ along the same interval on the $x$-axis?  Question  Is my reasoning correct? I am running Xubuntu 11.10 and everything works nicely. I have selected a nice Xfce theme and everything looks beautiful, except Libreoffice.  While other programmes (Gimp, Inkscape, Thunar etc.) integrate with the selected Appearance &amp; Window Manager theme, Libreoffice looks like a Windows 98 programme.  Does anyone know how to fix this? I have already tried this solution, without success:   Thanks for your help! OS X El Capitan and older not available on App Store? So it turns out I can not install Sierra because I have a Mid2009 Macbook Pro. I wanted to update to El Capitan, but it turns out its no longer available on the app store?  Any ideas, how to get El Capitan?