I have a script that is designed to make an element sticky when it reaches a specific point on the page.  That is working correctly, however on some pages that section doesn't exist (by design).  As a result I am getting an Uncaught TypeError.  I have tried a few methods of verifying the var but it's still not working correctly on pages without the JumpTo div.  Here is my code:  jQuery(document).ready(function() {     var jumpToTop = jQuery(".jump-to").offset().top - 160;     if (jumpToTop !== undefined) {         jQuery(window).scroll(function() {             if (jQuery(window).scrollTop() &gt; jumpToTop) {                 jQuery(".jump-to").addClass("sticky-jump-to");             } else {                 jQuery(".jump-to").removeClass("sticky-jump-to");             }         });     } });   Please help me with the verification or other method so that the function only runs when .jump-to is present and I don't get the Uncaught TypeError.
How can I check the existence of an element in jQuery?  The current code that I have is this:  if ($(selector).length &gt; 0) {     // Do something }   Is there a more elegant way to approach this? Perhaps a plugin or a function?
I am trying to convince my friend that the integral of $0$ is $C$, where $C$ is an arbitrary constant. He can't seem to grasp this concept. Can you guys help me out here? He keeps saying it is $0$. How to group distinct values from a list using odata rest api Prove the map has a fixed point Assume $K$ is a compact metric space with metric $\rho$ and $A$ is a map from $K$ to $K$ such that $\rho (Ax,Ay) &lt; \rho(x,y)$ for $x\neq y$. Prove A have a unique fixed point in $K$.  The uniqueness is easy. My problem is to show that there a exist fixed point. $K$ is compact, so every sequence has convergent subsequence. Construct a sequence ${x_n}$ by $x_{n+1}=Ax_{n}$,$\{x_n\}$ has a convergent subsequence $\{ x_{n_k}\}$, but how to show there is a fixed point using $\rho (Ax,Ay) &lt; \rho(x,y)$? How can I find hard links on Windows? I've created some hard links on my Windows 7 file system using mklink. It was some time ago and I can't remember for sure where, or which files. When I use Explorer, all files look the same. When I use the command line and type "dir", they all look the same.  How do I find hard links? Or how do I determine whether a specific file IS a hard link? Is there an algorithm to decide if a symlink loops? Unix systems usually just error out if they are confronted with a path that contains a symlink loop or just too many symlinks, because they have a limit to the number of symlinks they will traverse in one path lookup. But is there a way to actually decide if a given path resolves to something or contains a loop, even if it contains more links than a unix is willing to follow? Or is this a formally undecidable problem? And if it can be decided, can it be decided in a reasonable amount of time/memory (e.g. without having to visit all files on a filesystem)?  Some examples:  a/b/c/d where a/b is a symlink to ../e and e is a symlink to f and f is a symlink to a/b  a/b/c/d where a/b/c is a symlink to ../c  a/b/c/d where a/b/c is a symlink to ../c/d  a/b/c/d where a/b/c is a symlink to /a/b/e where a/b/e is a symlink to /a/b/f where a/b/f is a symlink to /a/b/g   Edit:  To clarify, I am not asking about finding loops in the file system, I am asking about a decision algorithm that decides of a given path whether it resolves to a definite file/directory or whether it does not resolve at all. For example in the following system, there is a loop, but the given path still resolves fine:  / -- a -- b where b is a symlink to /a   This directory tree clearly has a cycle, but the path a/b/b/b/b/b still resolves fine to /a. How do you reverse a string in place in C or C++? How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string? How do I correct an HSA distribution when I was refunded by a health provider? Or operand with int in if statement Form inside a table Concurrent requests limit exceeded - how to find the problematic code I am a developer for a Salesforce org that serves as a community portal for thousands of users. We have been consulting with a large team of developers for years and everything we have is custom coded. Our pages are built using AngularJS to remotely call Apex code. We are on an Unlimited Edition org and we are nearing 90% of our total allowed code. We have a lot of callouts to external services and many times these callouts can run long.  We are now running into issues where users are seeing the "Unable to Process Request - Concurrent requests limit exceeded" error. The issue is there is so much code written by so many different developers it is hard to identify what/where the problematic code is. Sometimes users see this error when they are trying to perform a callout. Sometimes it's when they are inserting a record and triggers are firing. The long-running code issue can be anywhere in our org. Another issue is error handling has been done very poorly, so if any process does run long, we most likely are not looking for it or logging it.  Other than enhancing the logging on our callouts, I do not know where to even begin to find other problematic code. Every developer before me has written code with no regards to limits, so inefficient code can be anywhere. Is there any way or best practice to being able to analyze such a complex org and find where the problems may be? All I can think of is enhanced logging EVERYWHERE, but that may not be the best approach and would be very time consuming, especially considering how many developers we have constantly writing and pushing new code.  I have tried to replicate the issue in a sandbox however I cannot seem to get it working. I wrote Javascript to remotely call an Apex method that waits for 6 seconds. I called this remotely 11 times at once, causing 11 synchronous transactions running concurrently each longer than 5 seconds. However instead of getting the concurrent limit error, each Apex transaction just errors out with a timeout.  Any help would be greatly appreciated. I am not familiar with the majority of the code/functionality of our org, so I do not know how to really solve this issue considering I don't even know what could be problematic aside from long running callouts. Thanks! I would like to use Class.newInstance() but the class I am instantiating does not have a nullary constructor. Therefore I need to be able to pass in constructor arguments. Is there a way to do this? Using \footnote in a figure's \caption Maybe this is an easy one, but I struggled with this now too long :)  I want to have a footnote in a caption of a figure, see the example.   \begin{figure}[!ht]   \caption{a figure caption\footnote{where i got it from}}   \label{somelabel}   \begin{center}        \pgfuseimage{...}   \end{center} \end{figure}   The compilation error reads as follows  ! Argument of \@caption has an extra }. &lt;inserted text&gt;              \par  l.192 ...i got it from}}   The actual tex code for my figure with the answer of Leo  \pgfdeclareimage[width=6cm]{aba.medcenter}{aba.medcenter}  \begin{figure}[!ht]   \begin{minipage}{\textwidth}     \caption[Medcenter Monthly Medication System]{Medcenter\textsuperscript\textregistered Monthly Medication System\footnote{Quelle Bild: http://www.amazon.com/dp/B000RZPL0M}}     \label{aba.medcenter}     \begin{center}       \pgfuseimage{aba.medcenter}     \end{center}   \end{minipage} \end{figure}   leads to the error  ! LaTeX Error: Command \itshape invalid in math mode.   in the same line. If I comment out the foot note, everything compiles fine. \textsuperscript\texttrademark isn't the problem, too. One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing everything possible to protect people's personal information (health, financial, surfing habits, etc.), but sometimes people get a little too jumpy.  Case in point: One of our state customers recently found out that the browser provides the handy feature to save your password. We all know that it has been there for a while and is completely optional and is up to the end user to decide whether or not it is a smart decision to use or not. However, there is a bit of an uproar at the moment and we are being demanded to find a way to disable that functionality for our site.  Question: Is there a way for a site to tell the browser not to offer to remember passwords? I've been around web development a long time but don't know that I have come across that before.  Any help is appreciated. Is it time to be rid of automatic down votes on certain closed questions? Can a set be neither open nor closed? An example would do. I cant think of any.   Thanks in advance! When signing in with Google (OAuth), it shows a list of accounts it already knows about. How can I remove some accounts from this list?    I know I can nuke all of them by deleting all cookies, but I'd prefer to remove one account that I don't want there, rather than all of them.  There used to be an ability to edit this list in the older version of this screen, but in 2018 redesign Google has removed [×] buttons next to the accounts. How to make a blank page in Google Chrome at start-up? Does Google Chrome has anything similar to about:blank page in IE and Firefox? I did not find any suitable page mentioning this? PS: I tried about:blank but it looked like Chrome is trying to load something before showing blank page... This is a follow up question to . My reference database contains some DOI codes, but mainly normal URLs and some ISBN/ISSN codes. What I would like to achieve is extending the code from Herbert and hyperlink the title of the entry with the following priority: 1. DOI, 2. URL, 3. ISBN/ISSN. What I mean is, if both DOI and URL is available, use DOI. If URL and ISBN is available use URL. If only ISBN is available use that.  There are two further isses:    The URL field might contain several URLs, which are just seperated by a white space. In that case just the first URL should be used.  Herbert's code just extends to articles. I would like to extend this to all entry types.   The code from Herbert to Hyperlink the Title with DOIs is:   \newbibmacro{string+doi}[1]{%   \iffieldundef{doi}{#1}{\href{http://dx.doi.org/\thefield{doi}}{#1}}} \DeclareFieldFormat{title}{\usebibmacro{string+doi}{\mkbibemph{#1}}} \DeclareFieldFormat[article]{title}{\usebibmacro{string+doi}{\mkbibquote{#1}}}   This far surpasses my skill, so it would be great if someone could give me some guidance how to achieve that. Direct observations of a black hole? I'm not very knowledgeable about physics generally, but know that nothing can escape a black hole's gravitational pull, not even light (making them nearly invisible?).   My question is: What has been obtained from direct observation of a black hole to prove their existence? Please note that I'm not questioning the existence of black holes, but am just curious as to how we have come to realize it. With a Canon 550D camera and a Tamron 18-270 mm zoom lens, I tried to fix shutter time, aperture (f/8.0 to cover all zoom range), and ISO, so the exposure meter read 0.0 with 18 mm focal length and while focusing on a uniform white wall.  Then I changed to 270 mm focal length, but the exposure reading did not change significantly (only to -0.7).  However, I had expected exposure to change, since only (18 mm / 270 mm) ** 2 = 1/225 of the wall is now covered in compare the coverage when focal length is 18 mm, thus only 1/225 of the light gets to the sensor after the change of focal length.  Why does exposure not change when narrowing the field of view with change of focal length?