I've been wanting to add a feature to my script, which can enable me to stop the setInterval function through a simple command, but the real problem is that I do not know how to do it. client.on('message', async (message) =&gt; {  if (message.author.username === 'username')   if (message.content === '*shiba inu pupper') {    const attachment = new Discord.MessageAttachment('shiba doggo');     setInterval(() =&gt; {     message.channel.send(attachment);    }, 20000);   } });
2127
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.
81911
This question shows how to stop automatic time update (and switch to manual):    I want to do this exact thing but I can only ssh onto my machine so I need to make this change through the terminal. Is there any way to do this?
62324
I want a script to run minutely, but stop executing it during the nighttime.  I tried  OnCalendar=*-*-* 05..00:*:00   but that lead to   Failed to parse calendar specification, ignoring: *-*-* 05..00:*:00 Timer unit lacks value setting. Refusing   Whats wrong here?
20710
I am working on a game that uses commands in such a way that players disconnecting then reconnecting could break the commands. I was wondering if there is a way to detect when players join the game in 1.13.2 and run a command to give them an item. When I researched this, I found solutions for older versions using /testfor or stat.leaveGame, but those seem to be outdated in 1.13. If someone could show me the commands to use as well as the layout for command blocks/redstone that would be great. It can be for the second time they join only, or for all times that they do. Thanks
67045
I am trying to code a shell-script that uses a ssh-connection for doing "heartbeats". I want to terminate the client- and server-side of that connection after a certain timeout (after the connection drops).  What I found so far:   TCPKeepAlive yes/no for ssh and sshd ClientAliveCountMax for sshd ClientAliveInterval for sshd ServerAliveCountMax for ssh ServerAliveInterval for ssh   To change "ClientAliveCountMax" I would have to modify the sshd_config on each target machine (this option is disabled by default).  So my question is - can I use "TCPKeepAlive" for my purposes, too (without changing anything else on the source/target machines)?  Target operating system is SLES11 SP2 - but I do not think that is relevant here.
44322
The only things I've found so far are a cart method (which ceased working in 1.6), a dispenser method (utilizing the decay on dropped items, but this requires occasional feeding), and a binary counter (which won't work for a single input but rather a fluctuating one).  I want to have a circuit that when I apply an input signal, the output signal doesn't change for 2 to 5 minutes.  When the input turns off, I again want a 2 to 5 minute delay.  I could accomplish this with (roughly) 240 to 600 redstone repeaters, but this is far in excess of being useful.  The only method I can think of, but would require a XOR gate (on the button-input and final output) to start and stop a clock attached to a binary counter.  While I can make room for a device of this size, I was hoping for something simpler.
90856
Ok, I'm doing a bunch of RIA/AJAX stuff and need to create a "pretty", custom confirm box which is a DIV (not the built-in javascript confirm). I'm having trouble determining how to accomplish a pause in execution to give the user a chance to accept or decline the condition before either resuming or halting execution. (depending upon their answer)   So here's the general flow of logic I'm dealing with:   User selects an item from dropdown and clicks button. In client-side javascript eventhandler for button, I need to check a (this is the key) SERIES of conditions for the item they chose in dropdown.  These conditions could possibly result in not showing any confirmation at all or possibly only some of the conditions may evaluate to true which means I'll need to ask the user to accept or decline the condition before proceeding. Only one confirmation should be show at a time.   To demonstrate the logic:  function buttonEventHandler() {  if (condition1) {   if(!showConfirmForCondition1) // want execution to pause while waiting for user response.      return; // discontinue execution }  if (condition2) {   if (!showConfirmForCondition2) // want execution to pause while waiting for user response.       return; // discontinue execution }  if (condition3) {   if (!showConfirmForCondition3) // want execution to pause while waiting for user response.       return; // discontinue execution }  ...   }    If anybody has dealt with this challenge before and found a solution, help would be greatly appreciated. As a note, I'm also using the MS Ajax and jQuery libraries although I haven't found any functionality that may already be included in those for this problem.
116831
I have created a short command block stack, one block teleports the player and the other plays block.piston.extend. My problem is that it teleports the player before the player can hear the sound. I would like to know if there is a way to delay the command from inside that command block. I have looked at other solutions but they all involve some complex scoreboard timer thing. If you could give me a solution that doesn't use that system or maybe you could explain it better.  This is the command I need to delay:  /tp @p -586.634 64 -430.697   If anyone could help I would really appreciate it, so thanks in advance!
96230
How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I want the user to know it right away, even if he is using another application at the time.  Edit: These users do want to be distracted when a new message arrives.
13669
I've placed a command block making it day all the time. I want to turn it off, but I've lost it. What's the quickest way to find it?
34951
It's a really basic question but i can't think at the second. How do i set up a loop that asks each time the function inside runs whether to do it again. So it runs it then says something like;  "loop again? y/n"
41693
What's the proper way to execute a function every 3 months? Watchdog variables don't seem to be available after a certain time. I could create another table to insert the execute function date to compare, but it doesn't seem to be the best approach.  The functionality of such functions are:   Send an eMail Tag an inactive user
44387
I am looking for good ideas for implementing a generic way to have a single line (or anonymous delegate) of code execute with a timeout.  TemperamentalClass tc = new TemperamentalClass(); tc.DoSomething();  // normally runs in 30 sec.  Want to error at 1 min   I'm looking for a solution that can elegantly be implemented in many places where my code interacts with temperamental code (that I can't change).  In addition, I would like to have the offending "timed out" code stopped from executing further if possible.
48151
When writing a batch file to automate something on a Windows box, I've needed to pause its execution for several seconds (usually in a test/wait loop, waiting for a process to start). At the time, the best solution I could find uses ping (I kid you not) to achieve the desired effect. I've found a better write-up of it , which describes a callable "wait.bat", implemented as follows:  @ping 127.0.0.1 -n 2 -w 1000 &gt; nul @ping 127.0.0.1 -n %1% -w 1000&gt; nul   You can then include calls to wait.bat in your own batch file, passing in the number of seconds to sleep.   (at last!). In the meantime, for those of us still using Windows&nbsp;XP, Windows 2000 or (sadly) , is there a better way?  I modified the sleep.py script in the , so that it defaults to one second if no arguments are passed on the command line:  import time, sys  time.sleep(float(sys.argv[1]) if len(sys.argv) &gt; 1 else 1)
731
I'm wondering (since it just happened to me), is it possible to "cancel" ("undo", "delete", "retract", whatever) a flag I just raised if I misclicked it, so the mods won't waste time?  I looked everywhere, but I can't find such a feature.
273
I'd like to run a command at startup which pings a certain address every 10 minutes and writes the result to a file. I've figured out now how to do the pinging and file writing and the 10 min intervals:  while true; do my-command-here; sleep 600; done   My question is, can I put this in /etc/init.d/rc.local or should I be putting it in /etc/rc.local or somewhere else entirely? I'm specifically concerned because it's an infinite loop so I'm not sure if I could put it in one of these startup scripts.  Some help would be appreciated. I'm using Ubuntu 12.04.5
97101
I want a certain local user to not log off. ever.  It's much like this , however I don't necessarily care if the buttons are there, I want to pop up a messagebox that says "Please do not log off the console" with an "OK" button that then cancels the log off attempt. Can this be done in a logoff script?  there are group policies to disable the logoff button on the startmenu and on the CTRL-ALT-DEL dialog.  However what I'd like is more like , which appears to not be in server 2008 R2?  Or am I missing it?  I even tried to , but it doesn't work,   Is it possible to create a logoff script that displays a dialog warning the user to not logoff and then cancels the logoff?  I understand this is a daft need - unfortunately it is not in my power to change or push back.  I've exhausted those options.  Feel free to get a ton of upvotes on a comment explaining that this is really a dumb plan that is obviously mitigating a symptom of many many systemic issues rather than solving anything.  I fully understand that this course of action is actually creating problems.  I want this done so I can be done with this contract and never ever work with them again.