I'm trying to make a timer within javascript. I want the timer to stop on click but it won't. I have two parameters: "start" and "stop". I want my program to restart the timer if the start button is clicked while the timer is already going and to stop when the stop button is clicked.  function timer(start, stop) { let count; if (start) {     let count = 0;     setInterval(() =&gt; {         count++;         console.log(count);     }, 1000); } if (stop) {     count = count; }   }
I am using setInterval(fname, 10000); to call a function every 10 seconds in JavaScript. Is it possible to stop calling it on some event?   I want the user to be able to stop the repeated refresh of data.
Custom DataTable using Vanilla Datables in LWC I'm trying to build a custom datable because I want the functionality to sort, search and paginate and also add action buttons in each row. Initially, my VF page was using  but we have now decided to rebuild that page in LWC.  I found a similar  but it hasn't really worked for me.  I then found  (Javascript) and  (ES2018) I have tried to implement Vanilla Datatables but I keep running into issues such as:      TypeError: Cannot read property 'length' of undefined   The above error is thrown because the library is unable to find the body of the table.   My point is that I feel this library won't work because it's using document, window and so on.   I was wondering if there is a way I could convert this library to something that is more suited to LWC basically have it "export" the modules. Since I'm not a JS expert I'm unable to put the pieces together.   Just for some context, I'll post my code here:  &lt;template&gt;     &lt;table class="sobject-table slds-table slds-table_cell-buffer slds-table_bordered"&gt;         &lt;thead&gt;             &lt;tr class="slds-line-height_reset"&gt;                 &lt;template for:each={fieldSetData} for:item="field"&gt;                     &lt;th key={field.apiName} title={field.fieldLabel} class="" data-scope="col"&gt;                         &lt;div class="slds-truncate" title={field.fieldLabel}&gt;{field.fieldLabel}&lt;/div&gt;                     &lt;/th&gt;                 &lt;/template&gt;             &lt;/tr&gt;         &lt;/thead&gt;         &lt;tbody&gt;             &lt;template for:each={records} for:item="row"&gt;                 &lt;tr key={row} class="slds-hint-parent"&gt;                     &lt;template for:each={row} for:item="data"&gt;                         &lt;td key={data.id} data-label="Name" data-scope="row"&gt;{data.value}&lt;/td&gt;                     &lt;/template&gt;                 &lt;/tr&gt;             &lt;/template&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/template&gt;   import {LightningElement, api, wire} from 'lwc'; import {processRecords} from 'c/recordGenerator'; import getFieldSetData from '@salesforce/apex/FieldSetData.getFieldSetData'; import getSobjectRecords from '@salesforce/apex/DeomoCTRL.getRecords'; import VanillaDatatable from '@salesforce/resourceUrl/VanillaDatatable'; import {loadScript, loadStyle} from 'lightning/platformResourceLoader';  export default class ManageSelectedIndicators extends LightningElement {     @api recordId;     records;     fieldSetData;     @wire(         getFieldSetData,         {objectName: 'SOBJECTName', fieldSet: 'FIELSETName'}     ) wiredFieldSetData({error, data}) {         console.log('wired called in Child')         if (data) {             this.fieldSetData = data;             this.getData();         }     }       constructor() {         super();         console.log('Constructor called in Child');     }      connectedCallback() {         console.log('Connected callback');     }      renderedCallback() {         console.log('Rendered callback');         Promise.all([              loadScript(this, VanillaDatatable + '/VanillaDataTables/src/vanilla-dataTables.js')          ]).then(() =&gt; {              const table = new DataTable(                  document.getElementsByClassName('.sobject-table'),                  //Also tried this.template.querySelector('.sobject-table'),                  {searchable: true, sortable : true}              );          })          .catch(error =&gt; {             console.log(error);          });     }      getData() {         getSobjectRecords ({             sobjectId: this.recordId         })         .then(response =&gt; {             this.records= processRecords(response, this.fieldSetData);         })         .catch((error) =&gt; {             console.log(error);         });     }  }   Edit: I have also tried lwc:dom="manual" that didn't seem to work either.  Is there any other way I could achieve these functionalities? Or do I have to write custom code to achieve this? I'm a new blender user, but have used other modelling programs before.   I've downloaded a  and unzipped it.   When I import the obj into blender, it is my understanding (from here: ) that the mtl should just import itself with it. However, when I import the obj, I just get a grey model with no texture. Is it actually importing the mtl but I'm not seeing it? Also for the record, I have changed no settings in blender.  Picture for reference: Suppress black box at end of line Under TeX, when I write a line too long, it prints a fat black box at the end of the line.  That is probably a feature, but I dislike it.  How to turn that OFF? Is there a command-line option or something else?   I usually use LaTeX, but I have a complicated file which happens to be plain TeX. Keep sharp edges when using subdivision surface How can I use the subdivision surface modifier to create more high poly meshes without ruining sharp edges? For example this mesh  The sphere should be subdivided but the rim of the cylinder should stay the same because it is a sharp edge. This is the result of the subdevision  How can I get sharp edges to not be affected by the sub surf mod? Suppose the mean noon-time temperature for September days in San Diego is 24∘ and the standard deviation is 4.9. (Temperature in this problem is measured in degrees celsius)  On September 26, 1963, the all-time record of noon-time temperature in San Diego of 44∘ was hit. Assume the temperature distribution is symmetric around the mean, what is the Chebyshev bound for the probability of breaking (or tieing) this record?  I am having a hard time understanding this. Could someone explain to me how to do this? shell scripts are still working without #!(sha-bang line) I am new to shell scripts and many books have written that use #!(sha-bang) line in starting of the script to invoke the interpreter .And this will invoke a new shell for script and do the interpretation line by line.But one of my basic script is still running without the magic line.  so my questions are:   from where did my basic script get the interpreter. how did the script manages to locate the interpreter.   now let me tell you about my basic script it just contains the following line:  echo "basic script without the magic lines" Does the series $\sum\limits_{n=1}^\infty \frac{1}{n\sqrt[n]{n}}$ converge? Does the following series converge? $$\sum_{n=1}^\infty \frac{1}{n\sqrt[n]{n}}$$   As $$\frac{1}{n\sqrt[n]{n}}=\frac{1}{n^{1+\frac{1}{n}}},$$ I was thinking that you may consider this as a p-series with $p&gt;1$. But I'm not sure if this is correct, as with p-series, p is a fixed number, right ? On the other hand, $1+\frac{1}{n}&gt;1$ for all $n$. Any hints ? How to cite sources written in a different language than English? Product of Consecutive Integers is Not a Power Why is 128==128 false but 127==127 is true when comparing Integer wrappers in Java? How many ways can we let people into a movie theater if they only have half-dollars and dollars? My interest in combinatorics was recently sparked when I read about the many things that the Catalan numbers count, as found by Richard Stanley. I picked up a copy of Brualdi's Combinatorics, and while browsing the section on counting sequences I found a nice little puzzle that has definitely puzzled me.     Let $m$ and $n$ be nonnegative integers with $n\geq m$. There are $m+n$ people in line to get into a theater for which admission if $50$ cents. Of the $m+n$ people, $n$ have a $50$-cent piece and $m$ have a $\$ 1$ dollar bill. The box offices opens with an empty cash register. Show that the number of ways the people can line up so that change is available when needed is   $$ \frac{n-m+1}{n+1}\binom{m+n}{m}. $$     I first noted that the first person to enter must be one of the $n$ with a half-dollar. Now the register has a half-dollar change. The second person can be either a person with a half-dollar or a dollar. In the first case, the register will now have two half-dollars, in the second case, the register will now have one dollar bill. So it seems to me that when one of the $n$ people with a half-dollar enters, the number of half-dollars in the register increases by $1$, and when one of the $m$ people with a bill enters, the number of half-dollars decreases by $1$ but the number of bills increases by $1$.   I tried to model this by looking at paths in $\mathbb{Z}^2$. The $x$-axis is like the number of half-dollars, and the $y$-axis is the number of bills. You start at $(0,0)$, and you can take steps forward $(1,0)$ or backwards diagonally $(-1,1)$ corresponding to who enters, but you must always stay in the first quadrant of the plane without crossing over the axes. The goal is to make $m+n$ moves, and I figured maybe the number of such paths is counted by $\frac{n-m+1}{n+1}\binom{m+n}{m}$, but I'm not sure how to show this. I don't know if this observation simplifies the problem at all, as I don't know how to finish up. I'd be happy to see how this problem is done, thank you. New SSD problem I've just installed a new SSD replacing an HDD in my old (late 2008) iMac. When I switched it on all I got on screen was a question mark.   On the advice of my son I tried cmdR during switch on with no result.   I then tried alt which at least got me a cursor on the screen, but nothing else. Any suggestions? I've got everything backed up on an external Hard Drive, by the way. How to find the square root of a permutation Observe that  $$\begin{pmatrix} 1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 \\  2 &amp; 4 &amp; 1 &amp; 5 &amp; 3 \end{pmatrix} \begin{pmatrix} 1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 \\  2 &amp; 4 &amp; 1 &amp; 5 &amp; 3 \end{pmatrix} =  \begin{pmatrix} 1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 \\  4 &amp; 5 &amp; 2 &amp; 3 &amp; 1 \end{pmatrix},$$  so $\begin{pmatrix} 1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 \\  4 &amp; 5 &amp; 2 &amp; 3 &amp; 1 \end{pmatrix}$ is the square of a permutation. More generally, how do I check if a permutation is square and how can I find its root? How can I search within a manpage? Why do all the planets of the solar system orbit in roughly the same 2D plane? Most images you see of the solar system are 2D and all planets orbit in the same plane. In a 3D view, are really all planets orbiting in similar planes? Is there a reason for this? I'd expect that the orbits distributed all around the sun, in 3D. Has an object made by man (a probe) ever left the Solar System? Can I safely uninstall games purchased from Steam? Can I uninstall purchased games from my computer and then later download them through Steam without having to re-purchase if I'd like to?   I'm running short on space on my laptop, looking to free up some space and wanted to be sure that I can safely re-download anything at a later time similar to how you can with the Xbox Live marketplace. Skype window problem in Ubuntu 14.04 Show that $x^4-10x^2+1$ is irreducible over $\mathbb{Q}$ Adding related resources or hyperlinks in edits So, I've been rejecting the addition of resources/hyperlinks to posts simply because I had no idea that this was an acceptable practice.  Today, I was browsing through the edits page and saw:     Some common reasons to edit are:         to fix grammatical or spelling mistakes   to clarify the meaning of a post without changing it   to correct minor mistakes or add addendums / updates as the post ages   to add related resources or hyperlinks      Why is this an acceptable practice?  I can see adding links to official documentation, but the quality of outside resources is (potentially) subjective.  I see the merit in adding resources, but it seems to me that these additional resources should be placed in comments, not inserted into the post via an edit.  Anyone have thoughts on this? If I know the GCD of 20 numbers, and know the 20 numbers, is there a formula such that I input the 20 numbers and input their GCD, and it outputs their LCM? I know that $$\frac{\left| a\cdot b\right|}{\gcd(a,b)} = \text{lcm}(a,b).$$ So is it$$\frac{\left| a\cdot b\cdot c\cdot d\cdot e\cdot f\right|}{\gcd(a,b,c,d,e,f)}?$$If not, what is it?