How to copy to clipbord content of textarea using jquery or javascript? Hi  I am using codemirror for textarea. I want to copy conent of textarea to clipbord, i want to javascript or jquery scipt support for all major browser.  &lt;textarea name="code" id="text_1" cols="30" rows="10"&gt;&lt;/textarea&gt; &lt;script&gt; $("#text_1").click(function(){      // required code for copy text in  clipbord  });
How do I copy to the clipboard in JavaScript? What is the best way to copy text to the clipboard (multi-browser)? I have tried: function copyToClipboard(text) {     if (window.clipboardData) { // Internet Explorer         window.clipboardData.setData(&quot;Text&quot;, text);     } else {         unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege(&quot;UniversalXPConnect&quot;);         const clipboardHelper = Components.classes[&quot;@mozilla.org/widget/clipboardhelper;1&quot;].getService(Components.interfaces.nsIClipboardHelper);         clipboardHelper.copyString(text);     } }  But in Internet Explorer it gives a syntax error. In Firefox, it says unsafeWindow is not defined. A nice trick without using :
I have no idea how to do this. Any help would be appreciated. The chapter I'm on is about differentiation and the mean value theorem.  Prove $a^\alpha b^{1-\alpha} \le \alpha a + (1 - \alpha)b, \; a,b &gt; 0,\; 0 &lt; \alpha &lt; 1$ I am a relatively recent graphic design graduate. I have been working at a small printing house for about two years, but will soon be interviewing for a different position in another city.  My question is about what to include in my design portfolio. When I was in school, my professors all insisted that work included in a portfolio should be 100% original: my original photography, my original logos, my original layout, my original written content etc. However, at my current office, we rely heavily on client-supplied logos, type content, and photography—and stock photography (shutterstock, etc).  What do other designers include in their portfolios? Has anyone else had this issue and can I reasonable include these more recent projects in my portfolio if I label them appropriately (something like "layout design")? Resize Move Partitions on Dual Boot System How to add n hours to a specified time? Short way for upper triangularization Is $\int \frac{1}{2x} \, dx $ equal to $\frac{\ln|2x|}{2}+ C$ or $\frac{\ln|x|}{2}+ C$ Reasoning for $\frac{\ln|x|}{2}+ C$ :  $$\int  \frac{1}{(2x)}  \, dx = \frac{\ln|2x|}{2}+ C$$   Check: By taking derivative we get $\frac{1}{x}$  Reasoning for $\frac{\ln|x|}{2}+ C$ :  $$\int  \frac{1}{2x}  \, dx = \frac{1}{2}\int  \frac{1}{x}  \, dx =\frac{\ln|x|}{2}+ C$$  Check: By taking derivative we get $\frac{1}{x}$  Question: Is  $\int  \frac{1}{2x}  \, dx $ equal to $\frac{\ln|2x|}{2}+ C$ or $\frac{\ln|x|}{2}+ C$? I know this is a total noob question but then again, when it comes to PostgreSQL I am a total noob...    I have installed the OpenGeo suite on my computer, running Windows 7, 64-bit.  I have downloaded the tutorial data and have been working through it.  I would like to access the database that I have made with ArcGIS so I can start learning about how that works.  However, when I try to connect to the database using the "Add Database Connection..." I can't seem to figure out what to put in for 'Instance' - everything I've tried (localhost, localhost,54321, my IP address with and without the port, my computer name) doesn't seem to work.  I installed and created the nyc test database according to all the instructions in the OpenGeo tutorial pages but am at a total loss here.  I know this must be an easy thing to deal with, I just can't get my head around it.  Can someone with more experience throw me a bone on this one?    Frustratingly enough, QGIS connects to the database with almost no effort and everything works fine - but my organization is heavily ESRI focused and switching to QGIS is a long shot...  EDIT Thanks everyone for pitching in on this.  I really appreciate the advice, it's what makes this site great.  I have installed    OpenGeo Suite 3.0.1 with no extensions ArcGIS Desktop 10.1, no license for server   I just went to the Opengeo website and downloaded the Windows installer and installed the default configuration. I have tried every permutation for the instance name that I can think of - using colons and commas, my machine name, localhost, postgresql, server, my IP address, random curse words, anything I can think of.  I have been using port 54321 instead of 5432 because that is what the OpenGeo workshop told me to set up my 'nyc' practice database to use.    It seems that localhost should work, here is a shot of the server properties from pgAdmin: Given six numbers $x,y,z,a,b,c$ which satisfy the following relations. Express $x+y+z$ in terms of $a,b,c$ Given six numbers $x,y,z,a,b,c$ which satisfy the following relations $y^2+yz+z^2=a^2$ $z^2+zx+x^2=b^2$ $x^2+xy+y^2=c^2$ Express $x+y+z$ in terms of $a,b,c$    My attempt: $\dfrac{(y^3-z^3)}{(y-z)}=a^2,\dfrac{(z^3-x^3)}{(z-x)}=b^2,\dfrac{(x^3-y^3)}{(x-y)}=c^2$ But this step didn't seem to help. So I tried adding and expressing $k(a+b+c)^2$ but some other unmanagable elements came along. I could not think of any other way to approach the problem. Please help. One-sided Fisher's exact test and its complement How to tail multiple files using tail -0f in Linux/AIX I tried tailing two files using the option:  tail -0f file1.log -0f file2.log   In Linux I see an error "tail : can process only one file at a time".  In AIX I see the error as "Invalid options".  This works fine when I use:  tail -f file1 -f file 2   in Linux but not in AIX.  I want to be able to tail multiple files using -0f or -f in AIX/Linux  multitail is not recognized in either of these OS. How To quickly do derivatives with respect to matrices Whats a quick way to work the below (and problems similar) out?   For me to take this derivative it involves a lot of time and boring calculation, there has to be a better way.    This is taken from the solutions to Chris Bishop's Pattern Recognition and Machine learning: Recover scaling factor in TikZ Does it exist some tikz register (let say \zoomfactor) that provides the curent scale factor. For example can I do something like :   \begin{tikzpicture}[scale=2]     \begin{scope}[scale=1.5]         \draw (0,0) circle (\zoomfactor);     \end{scope} \end{tikzpicture}   and to obtain circle of size 3=2*1.5 ? Manual/automatic line breaks and text alignment in TikZ nodes I know how to solve "simple" recurrence relations. For instance, say you have:  $$c_0 = 20$$ $$c_1 = 30$$ $$c_n = 3 c_{n-1} - 2 c_{n-2}$$  We can write the characteristic equation as:  $$3x^{n-1} - 2x^{n-2} = x^n$$  Solving this with $n=2$, we get $x = 1$ or $x = 2$. This lets us write the relation $c_n = \alpha_1 1^n + \alpha_2 2^n$, and we can solve for $\alpha_1$ and $\alpha_2$ with the initial states $c_0$ and $c_1$.  However, this depends on the fact that $3x^{n-1} - 2x^{n-2} = x^n$ has two roots.  Now, I'm stuck on another problem where the characteristic equation has fewer roots than terms.  Say I have this recurrence relation instead:  $$a_0 = 0$$ $$a_1 = 2$$ $$a_2 = −1$$ $$a_n = 9a_{n-1} - 15a_{n-2} - 25a_{n-3}$$  The characteristic equation would be:  $$9x^{n-1} - 15x^{n-2} - 25x^{n-3} = x^n$$  However, solving with $n=3$, we only get two roots: $x=-1$ or $x=5$. There are not enough roots to write a relation in the form of $a_n = \alpha_1 r_1^n + \alpha_2r_2^n + \alpha_3r_3^n$. How do I proceed? When to use reinterpret_cast? I am little confused with the applicability of reinterpret_cast vs static_cast. From what I have read the general rules are to use static cast when the types can be interpreted at compile time hence the word static. This is the cast the C++ compiler uses internally for implicit casts also.  reinterpret_casts are applicable in two scenarios:   convert integer types to pointer types and vice versa  convert one pointer type to another. The general idea I get is this is unportable and should be avoided.     Where I am a little confused is one usage which I need, I am calling C++ from C and the C code needs to hold on to the C++ object so basically it holds a void*. What cast should be used to convert between the void * and the Class type?  I have seen usage of both static_cast and reinterpret_cast? Though from what I have been reading it appears static is better as the cast can happen at compile time? Though it says to use reinterpret_cast to convert from one pointer type to another? What does if __name__ == "__main__": do? Automatically run commands over SSH on many servers There is a list of IP addresses in a .txt file, ex.:  1.1.1.1 2.2.2.2 3.3.3.3   Behind every IP address there is a server, and on every server there is an sshd running on port 22. Not every server is in the known_hosts list (on my PC, Ubuntu 10.04 LTS/bash).  How can I run commands on these servers, and collect the output?  Ideally, I'd like to run the commands in parallel on all the servers.  I'll be using public key authentication on all the servers.  Here are some potential pitfalls:   The ssh prompts me to put the given servers ssh key to my known_hosts file. The given commands might return a nonzero exit code, indicating that the output is potentially invalid. I need to recognize that. A connection might fail to be established to a given server, for example because of a network error. There should be a timeout, in case the command runs for longer than expected or the server goes down while running the command.   The servers are AIX/ksh (but I think that doesn't really matter. Problems with pie charts There seems to be in increasing discussion about pie charts.   The main arguments against it seem to be:   Area is perceived with less power than length. Pie charts have very low data-point-to-pixel ratio   However, I think they can be somehow useful when portraying proportions. I agree to use a table in most cases but when you are writing a business report and you've just included hundreds of tables why not having a pie chart?  I'm curious about what the community thinks about this topic. Further references are welcome.  I include a couple of links:         In order to conclude this question I decided to build an example of pie-chart vs waffle-chart. I'm trying to answer the following question from the book :  Let $X_1,X_2,\dots$ be a sequence of sub-gaussian random variables, which are not necessarily independent. Show that   $E\bigg[ \max_i \frac{|X_i|}{\sqrt{1 + \log i}} \bigg] \le CK$,  where $K = \max_i \|X_i\|_{\psi_2}$. Deduce that for ever $N \ge 2$ we have   $E\bigg[ \max_{i \le N} |X_i| \bigg] \le CK \sqrt{\log N}$.  I've tried to figure out what is the distribution of the maximum of Gaussians, but I'm reaching only inequalities that that don't help me answer the question.   I've also seen a similar question .  Does anyone have a clue or something to start with in order to answer this question?  Thanks! Is it possible to schedule my laptop to mute and unmute at a specific time? I always used to wake up to my favorite radio station on my alarm clock. However, I have moved and can no longer get that radio station over the air. To solve this problem, I would like to stream the station on my laptop, but have it muted overnight, then set it to unmute at a specific time in the morning, so that it will act as an alarm clock. Is there a way to schedule my laptop (Windows 7 64-bit) to unmute at a specific time?