I want to call a function depending upon the data-value value of the &lt;a&gt; that is clicked. Is this possible? I tried [call](); and call();. Both return errors.    function a() {   alert("Hi"); }  function b() {   alert("Bye"); }  $(function() {   $("a").click(function() {     var call = $(this).attr('data-value');    [call]();   }); }); &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt; &lt;a data-value="a"&gt;A&lt;/a&gt; &lt;a data-value="b"&gt;B&lt;/a&gt;
I have the name of a function in JavaScript as a string. How do I convert that into a function pointer so I can call it later?  Depending on the circumstances, I may need to pass various arguments into the method too.  Some of the functions may take the form of namespace.namespace.function(args[...]).
Why does Javascript getYear() return 108? Fill the area determined by two pgfplots graphs I need to fill the region determined by two (Gaussian) curves and the right red line (the region is brushed in green in the figure below). I also wonder what is the best way to draw vertical line which goes through the intersection of both graphs (the left red line on the figure).  Any pointers would be greatly appreciated.    My initial attemt is pasted below.  \documentclass{standalone} \usepackage{pgfplots}  \begin{document}  \pgfmathdeclarefunction{dnorm}{2}{%   \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}% }  \begin{tikzpicture} \begin{axis}[domain=0:12, samples=100, height=5cm, width=10cm] % Fill aread under the curves \addplot [fill=red!20, draw=none, domain=0:6] {dnorm(6.5,1.5)} \closedcycle; \addplot [fill=blue!20, draw=none, domain=6:10] {dnorm(4,1)} \closedcycle; % Draw curves \addplot [thick] {dnorm(4,1)}; \addplot [thick] {dnorm(6.5,1.5)}; \end{axis} \end{tikzpicture}  \end{document}   My solution  A picture is worth a thousand words. Code is pasted below.   \documentclass{article} \usepackage{tkz-fct} \usetikzlibrary{intersections}  \begin{document}  \tikzset{    name plot/.style={every path/.style={name path global=#1}} }  % Extract coordinates for point X \makeatletter \newcommand{\gettikzxy}[3]{%   \tikz@scan@one@point\pgfutil@firstofone#1\relax   \edef#2{\the\pgf@x}%   \edef#3{\the\pgf@y}% } \makeatother  % Dimlines \def\Dimline[#1][#2][#3][#4]{ \begin{scope}[thin, &gt;=stealth'] % redefine as flechas \draw let \p1=#1, \p2=#2, \n0={veclen(\x2-\x1,\y2-\y1)} in [|&lt;-&gt;|, decoration={markings,mark=at position .5 with {\node[#3] at (0,0) {#4};}, }, postaction=decorate] #1 -- #2 ; \end{scope} }  \begin{tikzpicture}[scale=1,font=\small] \tkzInit[xmin=0,xmax=12,ymin=0,ymax=.3,ystep=.05] % Draw coordinates \draw[&gt;=stealth', &lt;-&gt;] (0,6) node[above] {$y$} -- (0,0) --  (12.5,0) node[right] {$x$}; % Draw functions and areas \tkzFct[name plot=A,thick,color=red,domain=0:12]{1/(1.5*sqrt(2*pi))*exp(-((x-4.5)**2)/(2*1.5**1))} \tkzDrawArea[opacity=.3,color=blue,domain = 7:12] \tkzFct[name plot=B,thick,color=blue,domain=0:12]{1/(2*sqrt(2*pi))*exp(-((x-7)**2)/(2*2**1))} \tkzDrawArea[opacity=.3,color=red,domain=0:7] \tkzDrawAreafg[between=b and a,opacity=.3,color=green,domain = 0:7] % Intersection between curves \path [name intersections={of=A and B,by=C}]; % Extract coordinates of C \gettikzxy{(C)}{\cx}{\cy} % Vertical lines \draw [thick,dashed, black] (\cx,0) -- (\cx,5.5) node [above] {$x_{0}$}; \draw [thick,dashed, black] (7,0) -- (7,5.5) node [above] {$\hat{x}$}; % Define regions \Dimline[($(0,0)+(0,-.6)$)][($(7,0)+(0,-.6)$)][above,black][$\mathcal{R}_{1}$]; \Dimline[($(7,0)+(0,-.6)$)][($(12,0)+(0,-.6)$)][above, black][$\mathcal{R}_{2}$]; \end{tikzpicture}  \end{document} How do websites block selecting text and how do I unblock that? There's a website () that somehow blocks selecting text. Also it blocks Ctrl+A to select everything, there is also no “Copy” in the popup menu.  What I have tried:  Some sites use JavaScript to block selection. So I disabled all JavaScript sources in no-script addon in Firefox. I tried the same site in Google Chrome with the Script Safe addon. Made sure that everything is blocked, still can’t select text. Mousepointer remains an arrow and not a text cursor also on the whole site.  Used about:config to disable JavaScript completely in Firefox. Still no effect.  I read that some sites use DIVs with the style display:block so I used Inspect to examine the styles of the site. There is not one mention of "block" on the whole website, not in embedded CSS nor in object style=-attributes.  The text is not an image or flash or some HTML5 canvas ect. Everything is within DIV and P tags but no style was found that might block the text selection.  How can the website still block any selection of text? Not to mention why browsers support such behaviours at all. I just want to use a selected word or sentence and want to search google for it using right mouse click. It’s pretty annoying when a website does such things and forces me to type technical terms and names into google by hand. It disturbs my workflow. I have a number of tiff files named:    sw.001.tif sw.002.tif ...   and I want to remove the .tif at the end of each of the files.  How can I use the rename command to do this? Show intersection of two algebras are not a $\sigma$-algebra I have the following question:    $\textbf{Question}:$ Let $\mathcal{F}_1$ and $\mathcal{F}_2$ be two algebras. Is $\mathcal{F}_1 \cap \mathcal{F}_2$ a $\sigma$-algebra?  I believe the answer is no. I know the definition of an algebra and the definition of $\sigma$-algebra.    I'm assuming I need to show that the intersection of the finite unions of each algebra is finite, but then I get stuck trying to work out how to show it is not a $\sigma$-algebra.  All help is appreciated.  Many thanks, John How do you find out the caller function in JavaScript? function main() {    Hello(); }  function Hello() {   // How do you find out the caller function is 'main'? }   Is there a way to find out the call stack? How do you challenge the closing of one of your questions? Seo: Change the title of a page Lets say my website looks like this:  News -Hello world -Foo -Bar  So the parent page will list the last 3 news messages. For each news message there is a sub-page. For the parent page I was thinking of setting the page title to: News - Hello world, Foo, Bar.  Now if somebody adds a new message the title tag will also change. I googled this and read a few blog posts where people said that changing the title actually hurts the ranking of that page.  So is this true? Should I just set a static title tag for all my pages? Is the vector cross product only defined for 3D? I am trying to solve the following two problems:  1) Prove that the functions $\cos(z)$, $\sin(z)$ are surjective over the complex numbers.  2) Find all $z \in \mathbb C$: $cos(z) \in \mathbb R$ and find all $z \in \mathbb C$: $\sin(z) \in \mathbb R$.  For 1),I've tried to prove it for the function $\cos(z)$ (I suppose the other one is analogue)  so I've used the fact that $\cos(z)=\dfrac{e^{iz}+e^{-iz}}{2}$.  Let $w \in \mathbb C$, I want to show there exists $z \in \mathbb C : f(z)=w$, i.e., $\dfrac{e^{iz}+e^{-iz}}{2}=w$, multiplying by $2$ and then by $e^{iz}$ yields $e^{2iz}+1=2we^{iz}$ iff $e^{2iz}-2we^{iz}+1=0$.   I don't know if this approach is the correct one but here I've replaced $e^{iz}$ by $x$, so the solutions of the equation would be the roots of the polynomial $p(x)=x^2-2wx+1$, by the quadratic formula, I get that $x \in \{\dfrac{2w+w_0}{2},\dfrac{2w-w_0}{2}\}$, where $w_0^2=4w^2-4$.  Then, $e^{iz} \in \{\dfrac{2w+w_0}{2},\dfrac{2w-w_0}{2}\}$. At this point I got lost, I would like to explicitly show that $z$ exists and I can't see existence directly from the fact that $e^{iz}=\dfrac{2w+w_0}{2}$ or $e^{iz}=\dfrac{2w-w_0}{2}$.  First I thought of taking logarithm of both sides of the equation ir order to solve for $z$, but this is not a legitimate operation unless $e^{iz} \in \mathbb R$.   I couldn't go any farther.  For point 2) I have no idea what to do, should I use the identity $\cos(z)=\dfrac{e^{iz}+e^{-iz}}{2}$?  I would appreciate some help with the two points (specially with point 2), at least in 1) I could do something).   Btw, Happy new year! Is a 2-hour transit time enough to catch a connecting flight in Muscat airport? Both flights are with Oman Air I am flying from Dubai to India with Oman Air with a layover of 2 hours at Muscat airport. Is 2 hours enough for me to catch my connecting flight from Muscat to New Delhi? My flight from Dubai to Muscat as well as the connecting flight from Muscat to New Delhi are with Oman Air. Do I need to re-check in my luggage? Am I taking a risk or should I take an earlier flight from Dubai to get more layover time to be on the safer side? Physically what does warping (of space-time) mean? So there's general relativity and Einstein's field equations that tell us "mass(or equivalently energy) warps space-time, and the warping tells mass how to move", but I'm still having trouble understanding how space (a thing I conceive to be 'empty' or nothingness) can be 'warped'.  After researching books, on-line articles, and this stack exchange itself I can't seem to find any descriptions or discussions that don't immediately resort to jumping into GR and its mathematics to provide a more physical intuitive understanding of what it means to for space to be warped.  Is it space, this empty thing, that's getting warped. Or rather is it some field (Higgs field?) that exists around matter that's getting warped?  Although this question appears similar to  , it's asking if it's empty space that's being warped by matter or rather a field in space that's being warped (the Higgs Field?). The other question and all 10 answers addressing it do not address fields vs. empty space - What's really getting warped? mod [= remainder] operation (and relation), name and meaning I am trying to write the Euclidean algorithm in the following way:  $A = \lfloor A \div B \rfloor \times B + (\text{remainder of}) \: A \div B $   Now is there any symbol I can use  to say "remainder of A $\div$ B"? I know that in the C programming language there is the operator % for modulus; is that a valid symbol in maths? Can I write A % B? Or is there some other way? I have a simular issue to the question asked in :  I have tried the solution provided by Jake. This makes that my picture fails to resize (scale) as i intend.  Whether i give Set scale=0.4 or Set scale=0.8 The size of the  picture remains the same  This is the code i use:  \begin{figure}[ht!] \centering \begin{tikzpicture}[Set scale=0.4, every node/.append style={transform shape},] % STYLES \tikzstyle{every node}=[rectangle,rounded corners, minimum width=100pt,     align=center,node distance=3cm,fill=black!10,inner sep=5pt,text width=3cm,minimum height=1.75cm,&gt;=stealth,text badly centered] % Draw forces \node [force, above of=rivalry] (top) {Firm strategy, structure and rivalry}; \node [force, left=1cm of rivalry] (left) {Factor conditions}; \node [force, right=1cm of rivalry] (right) {Demand Conditions}; \node [force, below of=rivalry] (bottom) {Related and Supporting industries}; %%%%%%%%%%%%%%%% % Draw the links between forces \path[&lt;-&gt;,thick]  (left) edge (right) (left) edge (top) (left) edge (bottom) (top) edge (right) (bottom) edge (right); \path[&lt;-&gt;,thick]  (bottom) edge (top); \end{tikzpicture} \caption{Porter's Diamond source:~\cite{Porter:1980}}% \label{fig:diamond}  \end{figure} Biblatex: submitting to the arXiv I am trying to submit a LaTeX file to the  which uses biblatex.  However, it fails whatever I do.    I first get the message   biblatex.sty is not found   I have tried including (all from TeXLive 2010) biblatex.sty but then I get   logreq.sty is missing then logreq.def is missing   then   ! Package biblatex Error: Outdated 'etoolbox' package.   I then tried adding etoolbox.sty and etoolbox.def and get  ! Package biblatex Error: Style 'alphabetic' not found   So I added alphabetic.bbx then standard.bbx then alphabetic.cbx and finally I get   ! Package biblatex Error: Autocite command 'inline' undefined   I also tried incorporating the bib into the main LaTeX file as in  but it doesn't help.  Has anyone successfully used biblatex with the  and if so, how? I've generated some JSON and I'm trying to pull it into an object in JavaScript. I keep getting errors. Here's what I have:  var data = '{"count" : 1, "stack" : "sometext\n\n"}'; var dataObj = eval('('+data+')');   This gives me an error:   unterminated string literal   With JSON.parse(data), I see similar error messages: "Unexpected token ↵" in Chrome, and "unterminated string literal" in Firefox and IE.  When I take out the \n after sometext the error goes away in both cases. I can't seem to figure out why the \n makes eval and JSON.parse fail. Why is it dangerous use a coiled extension cord How to grep a specific line _and_ the first line of a file? Free way to clone HDD to SSD? Oneboxing a Stack Exchange post using HTTPS does not work When you post a link from Stack Exchange into the chatbox using HTTPS, the link does not onebox. However, if you change the link to HTTP, it works. See the screenshot below:    HTTPS URLs should onebox, too.