delay

How to set 1 second time delay at assembly language 8086

北城余情 提交于 2019-11-27 15:10:36
My problem is that I have written a code that is supposed to output a result into a set of LEDs connected to the parallel port. When I ran the code it pretty much did nothing. My instructor told me that the code ran too fast that my eyes did not see what happened. I have found that there are a couple of ways to do a time delay, I have tried to loop the NOP but I think I cannot really determine what is going on. Is there any better way? I have here a part of the code where I have to add a time delay into: org 100h mov ax, 0 mov dx, 378 out dx, ax mov ax, 1 ; 1st mov cx, 1ah start1st: mov ax, 1

Delays between promises in promise chain

Deadly 提交于 2019-11-27 15:04:18
问题 Let's say I am using the following code to run a couple of promises in series: let paramerterArr = ['a','b','c','d','e','f'] parameterArr.reduce(function(promise, item) { return promise.then(function(result) { return mySpecialFunction(item); }) }, Promise.resolve()) The code simply calls mySpecialFunction (which returns a promise), waits for the promise to be resolved and then calls mySpecialFunction again etc. So the function is called once for every element in the array, in the correct

jQuery delay() - how to stop it?

ぃ、小莉子 提交于 2019-11-27 14:38:58
I already tried stop(true,true), stop(true) and clearQueue(); but this doesn't work. I have problem with fast changing slides, i already have some function what have to reset everything, but it doesn't work. function reset(){ $('div').clearQueue(); $('#img').html('').css({'left':0,'right':0,'opacity':1,'z-index':1}); $('#img2').html('').css({'left':0,'right':0,'opacity':1,'z-index':1}); $('#place').html('');$('#place').html('<div id="img"></div><div id="img2"></div>'); } But i thing this doesn't stop (or delete) delay() function on animations. So I don't know if i don't have to use setTimeout

delay() or timeout with stop()?

荒凉一梦 提交于 2019-11-27 13:53:09
问题 $('.file a').live('mouseenter', function() { $('#download').stop(true, true).fadeIn('fast'); }).live('mouseleave', function() { $('#download').stop(true, true).fadeOut('fast'); }); I want the mouseenter function to have a stop() and a delay of 1 second. So, if I hover over #download the fadeIn should start after a 1 second delay. If I mouse out meanwhile the fadeIn shouldn't start. Get me? I don't really know how to do that, any ideas? 回答1: You need to use setTimeout() in this case because of

While variable is not defined - wait

拜拜、爱过 提交于 2019-11-27 13:24:38
问题 I have a click event that is triggered from another place automatically for the first time. My problem is that it runs too soon, since the required variables are still being defined by Flash and web services. So right now I have: (function ($) { $(window).load(function(){ setTimeout(function(){ $('a.play').trigger("click"); }, 5000); }); })(jQuery); The problem is that 5 seconds for a person with a slow internet connection could be too fast and vice versa, for a person with a fast internet

How to delay jquery animation?

时光总嘲笑我的痴心妄想 提交于 2019-11-27 13:14:51
I can't seem to delay the showing of a div. I want to delay the animation by about 20 seconds is this possible??? $("#microcharcounter").delay(10000).show(); Try this: $("#microcharcounter").delay(10000).show(0); or this: $("#microcharcounter").delay(10000).queue(function(n) { $(this).show(); n(); }); The reason for this is that .delay() will only delay items in an animation queue. So you can make .show() a short animation by adding a duration of '0', or add it to the queue with .queue() . You can do it like this: setTimeout(function() { $("#microcharcounter").show(); }, 20000); The problem

Is there an alternative for sleep() in C?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 11:36:55
In traditional embedded programming, we will give a delay function like so: for(i=0;i<255;i++) for(j=0;j<255;j++); In the microprocessor's view, is this how the sleep() function works? Is there an alternative for the sleep() function in C? Alternatives depend in what you are trying to do and what OS you are on. If you just want to waste time, then these might help: On most unix-type systems you'll find a 'usleep' function, which is more or less like sleep with greater resolution. Be careful with that one because it usually can not sleep for just one microsecond. On some unix-type systems, the

How to add a delay for a 2 or 3 seconds [closed]

廉价感情. 提交于 2019-11-27 11:30:54
How can I add a delay to a program in C#? digEmAll You could use Thread.Sleep() function, e.g. int milliseconds = 2000; Thread.Sleep(milliseconds); that stops the execution of the current thread for 2 seconds. Anyway, that could not fit your needs... what exactly are you trying to accomplish ? Use a timer with an interval set to 2–3 seconds. You have three different options to choose from, depending on which type of application you're writing: System.Timers.Timer System.Windows.Forms.Timer System.Threading.Timer Don't use Thread.Sleep , as that will completely lock up the thread and prevent it

Delaying function in swift [duplicate]

北慕城南 提交于 2019-11-27 10:35:14
This question already has an answer here: dispatch_after - GCD in Swift? 23 answers I don't have a code to sample or anything, because I have no idea how to do it, but can someone please tell me how to delay a function with swift for a set amount of time? Farlei Heinen You can use GCD (in the example with a 10 second delay): Swift 2 let triggerTime = (Int64(NSEC_PER_SEC) * 10) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, triggerTime), dispatch_get_main_queue(), { () -> Void in self.functionToCall() }) Swift 3 and Swift 4 DispatchQueue.main.asyncAfter(deadline: .now() + 10.0, execute: { self

jQuery: Wait/Delay 1 second without executing code

孤街醉人 提交于 2019-11-27 09:15:30
问题 I can't get the .delay method working in jQuery: $.delay(3000); // not working $(queue).delay(3000); // not working I'm using a while loop to wait until an uncontrolled changing value is greater than or equal to another and I can't find any way to hault execution for X seconds. 回答1: $.delay is used to delay animations in a queue, not halt execution. Instead of using a while loop, you need to recursively call a method that performs the check every second using setTimeout : var check = function