Menu
  • HOME
  • TAGS

Timer speeding up in Java

java,timer,delay

Without running the code... timerReady=true; if(checkTimer()){ timer2 = new Timer(); timer2.schedule(new Move(), 0, interval); } Basically means that checkTimer will ALWAYS return true, meaning that each time that update is called, you are creating ANOTHER Timer, which is probably creating a few dozen timers, all updating the game state independently...which...

Objective C for loop delay

objective-c,for-loop,cocos2d-iphone,delay,grand-central-dispatch

The for loop will dispatch one right after the other so they will essentially delay for the same time. Instead set a different increasing delay for each: double delayInSeconds = 0.0; for(NSNumber* transaction in gainsArray) { delayInSeconds += 5.0; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_after(popTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void)...

Performing action every few seconds, no matter what happens in running loop

ruby,loops,delay

You can schedule tasks, the best way is to use a scheduler. You can do this using OpenWFEru and then: scheduler.schedule_every('10s') { do_something } See more in the link below: https://www.igvita.com/2007/03/29/scheduling-tasks-in-ruby-rails/...

Delay textbox-textchenged in vb

vb.net,timer,delay,intervals,firing

TextChanged fires every time you change the content of the textbox. So there is no way to block this behavior. Perhaps you could add a button and move the recalculation on the button click event or better add an event handler for the Validating event. This event is triggered when...

jQuery tooltip random appear

jquery,random,tooltip,delay,show

You have not included jquery-ui.css. Just add it in document and everything will be fine!! You can get it from here UPDATE If you need it in the div the along with html add title attribute too and as below remove the title attribute from other elements $('#show').html($('#' + $(this).attr('aria-describedby')).children().html());...

Delay fadeOut menu jquery

jquery,menu,delay,fadeout

Change the sequence of delay and stop and use longer fadeOut duration. $(this).find("ul:first").delay(2000).stop().fadeOut(500); Demo: http://jsfiddle.net/tusharj/YGB5G/39/ EDIT You can also use hover as follow: $('#menu > li').hover(function (e) { $(this).find("ul:first").finish().fadeIn(120); $(this).find('> a').addClass('active'); }, function (e) { $(this).find("ul:first").finish().delay(1000).fadeOut(1000); $(this).find('> a').removeClass('active'); }); Demo: http://jsfiddle.net/tusharj/YGB5G/43/...

C - Timer logic for error condition

c,timer,pthreads,delay,multitasking

I suggest you add a "pthread_mutex_t" to handle file writing: 1. declare mutex_writing as global variable 2. is_writing[EXTS_LIMIT] as global variable //for each sensor:boolean indicating writing status 3. writingtime[EXTS_LIMIT]//store the last writing time for a given sensor 4. index //added to arg_struct in order to identify the sensor and modify...

Change webpage back and forth using jQuery and ASP.NET MVC?

javascript,jquery,ajax,asp.net-mvc,delay

The JavaScript on page is only good for that page. You can't write JavaScript that applies to the actual browser tab/window or something outside of creating a browser extension. So, you can either add code to each page that redirects you to the other, or pretty much your only other...

How to change button color and after a delay

html,button,delay

Assuming you are using javascript, the setTimeout method is what you want

jQuery animation does not work correctly

jquery,jquery-animate,delay,settimeout

The problem is basically that different things may happen with this type of code, depending on what you put on the .load() callbacks and the delay between events. The DOMContentLoaded ("ready") event happens before the "load" event, but the problem is that typically, you don't know the delay between the...

Add class to each div in a container after interval, and remove previous

jquery,timeout,delay

Here you go.. $(document).ready(function() { var interval = 1000; var timerIds = []; var links = $('.banner-wrap > div > a'); $.each(links, function(index, value) { if (index == links.length - 1) { timerIds.push(window.setTimeout(function() { $('.hovered').removeClass('hovered'); $.each(timerIds, function(idx, val) { clearTimeout(val); }); while (timerIds.length) {timerIds.pop();} }, interval*(index + 2))); } timerIds.push(window.setTimeout(function()...

How to delay a jquery event that isn't an animation? [duplicate]

javascript,jquery,timer,delay

You can use setTimeout(), no need to use the delay function $(document).ready(function() { setTimeout(function() { $(".opacity").css({ "opacity": ".5", }); setTimeout(function() { $(".opacity").css({ "opacity": "1", }) }, 1000) }, 1000); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="opacity">opacity</div> If you want to use the delay function, then you can add an entry to the...

Unity delay in sending the current value when using sockets

c#,sockets,tcp,unity3d,delay

I think it's the fact that you put all the server stuff in the Update. Which means it'll get called every frame. Which is a lot. You should probably put all this in a separate method and call that from the client. ...

Delay execution of code in method Java

java,android,delay,jdk1.6

private Timer timer; timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { //Generate number } }, 2000, 2000); //Documentation (From SDK) /** * Schedule a task for repeated fixed-rate execution after a specific delay * has passed. * * @param task * the task to schedule. *...

Using a handler to delay a repeated task for a limited number of times

java,android,limit,handler,delay

There are a number of ways to do this, including something like what you have done here. The first thing to do is remove the while() loop at the end of your Runnable and instead just have the Runnable post itself as long as the count is less than 49....

time delay in an else statement for multiple method calls?

objective-c,if-statement,timer,delay

Try this GCD function... double delayTimeInSeconds = 1.0; dispatch_time_t popTimeDelay = dispatch_time(DISPATCH_TIME_NOW, delayTimeInSeconds * NSEC_PER_SEC); dispatch_after(popTimeDelay, dispatch_get_main_queue(), ^(void){ //code to be executed on the main queue after delay [self.method3]; }); ...

I need a delay when I change some text

javascript,jquery,delay

You need to know if there is some timeout working and stop it first. Here is your solution: $(function(){ var to; var $tb1 = $('#text-box1'); $tb1.on('mouseenter', function(){ if( to !== undefined ) return; var $this = $(this); to = setTimeout(function(){ $this.text('The text changed!'); to = undefined; }, 500); }).on('mouseleave', function(){...

Java: Moving jLabel twice using Timer

java,swing,animation,timer,delay

You could take a look at something like this example which wraps animation layer around a GridBagLayout or someting like this which is based on the Universal Tween Engine This is a modified version of the first example, which adds the ability to be notified when the animation for a...

Bootstrap submit form displayed from javascript timer

javascript,twitter-bootstrap,timer,delay,form-submit

The way you want to write this is: <script> $(document).ready(function() { setTimeout(function() { $("#form-content").modal('show'); //this will show your modal }, 300); // milliseconds $("button#submit").click(function(){ //this will handle the form submission upon clicking the submit button $.ajax({ type: "POST", url: "process.php", data: $('form.contact').serialize(), success: function(msg){ // $("#thanks").html(msg) $("#form-content").modal('hide'); }, error: function(){...

Why Jenkins does not run a job as scheduled?

jenkins,delay,server

Replace the H by 0 to have 6:00. The H is intended to distribute tasks over the hour, so not all Jenkins tasks start exactly at 06:00 etc. (so it is not a delay, but a different way of scheduling). Two different tasks scheduled both at H 13 * *...

How to create a delay in Swift?

xcode,swift,delay

You will probably want to use NSTimer instead of a sleep, since the former won't lock up your program (if you are doing this from a UI thread). But, if you need it: import Darwin ... { sleep(4) } This uses the sleep function from UNIX....

Wait before function can be executed again

javascript,jquery,scroll,delay

You need to define a variable that indicate when to run the function or not. in this case is the "isScrolling" variable. $(window).bind('mousewheel', function(event) { // My mousewheel function. if (event.originalEvent.wheelDelta >= 0) { scroll(-1); } else { scroll(1); } }); /* Functions */ var isScrolling = false; // This...

PayPal adaptive Payments chained payments won't let the primary receiver take less than the secondary receiver. Want this for refunds

paypal,delay,paypal-adaptive-payments,chained-payments

Sounds like you just have the amounts wrong. When working with chained payments the primary receiver amount should be the total amount of all payments. Then the secondary amounts would just be what they are supposed to get. For example, say $100 was getting split between 3 people. You might...

Trying to make a div slideshow

html,css,css3,animation,delay

Here is a working example that I used before: HTML: <div id="slideshow"> <div> <img src="//farm6.static.flickr.com/5224/5658667829_2bb7d42a9c_m.jpg"> </div> <div> <img src="//farm6.static.flickr.com/5230/5638093881_a791e4f819_m.jpg"> </div> <div> Pretty cool eh? This slide is proof the content can be anything. </div> CSS: #slideshow { margin: 50px auto; position: relative; width: 240px; height: 240px; padding: 10px; box-shadow: 0...

Delaying function in swift

ios,xcode,function,swift,delay

You can use GCD (in the example with a 10 second delay): var triggerTime = (Int64(NSEC_PER_SEC) * 10) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, triggerTime), dispatch_get_main_queue(), { () -> Void in functionToCall() }) ...

Android splash screen delay

java,android,delay,splash

Do yourself a favor and DON'T use a splash screen. On Android guidelines Google is extremely against splash screens because they give some sort of slowish UI perception to the user, and it's not a good thing at all. If you absolutely need to wait for some sort of data...

clojure future vs delay

clojure,delay,future,core

Simple answer future is background execution of body, delay is on-demand execution of body. Example: if you have list of 100 delay-ed code, and trying to loop through it - code will block while evaluating each list item (e.g. doing HTTP request) and first iteration will be slow. Same with...

jQuery append delay

javascript,jquery,append,delay

There are lots of ways to do this. One possible solution is adjust your timeout: var dodajRed = function(redenBroj){ setTimeout(function () { $('.console').append('<p>'+row[redenBroj]+'</p>'); }, (redenBroj + 1) * 1500); } dodajRed(0); dodajRed(1); dodajRed(2); You could also setup a promise chain, but you'd need an external library or browser that supports...

make a delay in my vector, matlab [closed]

matlab,vector,delay

Assuming ASantosRibeiro interpreted your question correctly, you could do this to find when to "go to sleep": delay = 3; idx = find(diff(u)==-1) + delay idx = 8 20 32 43 This is assuming you want a delay of 3. diff(u) returns the difference between consecutive elements in u. Finding...

Jquery .delay (or setTimeout) issue

jquery,delay

setTimeout accepts a function or code snippet (string format) to execute after delay. Also you missed $ before ('#opacity-modal') Use if(delayed > 0) { setTimeout(function(){et.toggleClass('acc-edit-fn'); }, delayed); setTimeout(function(){ $('#opacity-modal').toggleClass('acc-edit-fn').removeAttr('style');}, delayed); } ...

function wait to execute

matlab,events,delay

The "weird behavior and lag" you see is almost always a result of callbacks interrupting each other's execution, and repeated unnecessary executions of the same callbacks piling up. To avoid this, you can typically set the Interruptible property of the control/component to 'off' instead of the default 'on', and set...

How to change element text in jQuery, pause, and reset original text

jquery,timeout,delay

Try // add a refresh button to image previews $(".change").on("click", function () { var oldText = $(this).html(); var that = $(this) $(this).html("new text"); setTimeout(function () { that.html(oldText); }, 2000); }); See JSFIDDLE NOTE: if the elements to click are dynamically created, then try .on() in its delegated form like :...

Need help incrementing a parameter in UIView.animateWithDuration in swift

ios,swift,delay,increment,animatewithduration

for button in options { UIView.animateWithDuration(1.0, delay: increment, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.0, options: nil, animations: { button.center.y -= self.view.bounds.height }, completion: nil) } increment = increment + 0.05 } Besides: Change this let increment = 0.25 To var increment = 0.25 Increase the increment outside animation. Because animateWithDuration is an...

Delay Hover effect on background-size in CSS

css,hover,delay,background-size

So, there's only one small little thing with your CSS, otherwise it'll work exactly as you expect. You can't transition from non-numerical values The values contain and cover for background-size aren't transition-able. Since they're non-numerical, you can't operate a CSS calculation on them. If you change that to a numerical...

Printing Java shapes with a delay

java,swing,user-interface,delay,java-2d

My recommendation separate out drawing in paintComponent() into the 3 constitute parts, these were previously separated by sleep statements Use state inside the TowersOfHanoi object to control what should be drawn, I've used a simple counter Use javax.swing.Timer to update the counter and request a repaint. Notes You cannot sleep...

Python - creating a delay that takes in account the execution time

python,image-processing,time,delay

ummm .... you need basic math here time.sleep(delay-(time.time()-start)) ...

TCP establishment delays for 3 seconds

linux,delay,rsh

Answer the question by myself: This issue was caused by a frame loss. Either SYN or SYN+ACK in 3-way handshake was dropped at a rare rate for some reason, anyway the client peer didn't get the SYN+ACK within in 3 seconds timeout(this timeout is hardcoded in Linux kernel), then the...

jQuery fadeIn breaks after .delay

jquery,css,queue,delay,fadein

I don't think the delay function is the problem here. The thing that is missing in both of your queue callback is a call to the .dequeue() function to execute the next function in-line. Quoting the .queue() documentation, Note that when adding a function with .queue(), we should ensure that...

jQuery annoying initial delay

jquery,delay

I don't think jQuery is intentionally delaying the execution of your code. You have two layers of callbacks here: // here you are waiting for the HTML markup to finish being parsed // and turned into a usable DOM (this is the "DOM-ready" event) $(document).ready(function() { // This code does...

jQuery - call a function from another function after 3 second delay

jquery,function,animation,delay,timing

// Global Var var SpriteVis; // Function to make sprite appear. function tele_in() { $("#sprite").animate({bottom: '0px'}, 400, 'linear', function () { $("#sprite").css({ 'background-image': 'url(/images/Warp-Sprite.png)', 'height': '50px', 'width': '90px', 'left': '300px', 'bottom': '80px' }); setTimeout(function () { $("#sprite").css({ 'background-image': 'url(/images/test-sprite.png)', 'height': '120px', 'width': '96px' }); }, 80); }); SpriteVis = true;...

Run multiple functions at different time intervals

javascript,jquery,function,loops,delay

try: var the_time = 1000; var funArr = [funcitonOne,funcitonTwo,funcitonThree,funcitonFore]; for (var i=0; i<funArr.length;i++){ setInterval(funArr[i], the_time*(i+1)); } UPDATE: duration be passed in to the function: function funcitonOne(time) { console.log('funcitonOne', time); } function funcitonTwo(time) { console.log('funcitonTwo', time); } var funArr = [funcitonOne, funcitonTwo]; for (var i = 0; i < funArr.length; i++)...

NSFetchedResultsController causes delayed segue

ios,core-data,delay,nsfetchedresultscontrolle,uistoryboardsegue

The problem is that you are using CoreData to store your pictures and apple does not. Though there is no limit on file size and on the total size your library can use it will take longer to get your files than opening a folder in the file structure. This...

Fade in different lines of text

javascript,jquery,css3,delay,fadein

You can take advantage of CSS transitions for this. Transitions need a numeric value to function, so you can use the opacity style, rather than visibility: function showText(id, delay) { var elem = document.getElementById(id); setTimeout(function () { elem.style.opacity = 1; }, delay * 1000) } window.onload = function () {...

fade in children sequentially

javascript,jquery,html,delay,fadein

The problem is that you are trying to fade in the sub menus when it appears you want to fade in the li's within the sub menus... I added .children() before the .hide() and before the .each()... I believe this is what you want... JSFiddle $('li.menu-item-type-custom').click(function () { $(this).siblings().find('ul.sub-menu').children().hide(); $(this).children('ul.sub-menu').children().each(function...

How to delay in VB Script?

visual-studio-2010,vbscript,delay,setup-project,wscript

The first statement, WScript.Sleep 1000, does work. Your error must be somewhere else. Proof Create a file test.vbs on your desktop: WScript.Echo Time() WScript.Sleep 2000 WScript.Echo Time() Run as follows: C:\Users\...\Desktop>cscript test.vbs Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. 11:31:34 11:31:36 Note the...

java executor delay not working

java,timer,delay,runnable,executor

You need to make sure your 'main()' method does not exit before the scheduled task have executed. // Example with a one-shot delay ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); executor.schedule(clearstage(), 5, TimeUnit.SECONDS); executor.shutdown(); executor.awaitTermination(6, TimeUnit.SECONDS); System.out.println("Done."); // And your clearstage() must be implemented like this: private static Runnable clearstage() { return new...

Does header file work in codeblocks?

c,delay,codeblocks,dos,timedelay

I was also having same problem & I used this function #include <time.h> void delay(int milliseconds) { long pause; clock_t now,then; pause = milliseconds*(CLOCKS_PER_SEC/1000); now = then = clock(); while( (now-then) < pause ) now = clock(); } edited : As commented, this does make system busy. I have fund...

Android: How to detect and collect multiple clicks (on multiple views) before batch processing

android,delay,detection

Ended up doing it via Handler which is quite simple for this case. For those who are interested, I defined a handler in the activity that handles a designated message which is to process something immediately. Then on every click, I clear the message queue and then send a message...

Delay when changing screen in libGDX

java,libgdx,delay

Depending on when you want it to be done, you need to call: myStage.act(); And an example to get the output your looking for would be: if(player.isDead()) { myStage.act(); } But note, this is not an effective way to transition screens....

Define timeouts between steps of jQuery.each() loop

jquery,delay,synchronous,each,delayed-execution

I'd suggest not using .each() but looping the collection manually.: HTML <div class="foo">A</div> <div class="foo">B</div> <div class="foo">C</div> <div class="foo">D</div> <div class="foo">E</div> Javascript var collection = $('.foo'); if( collection.length > 0 ){ var i = 0; var fn = function(){ var element = $(collection[i]); console.log(i + ' (' + element.text() +...

Jquery dropdown menu flicker after mouseexit and mouseenter instantly again

jquery,delay

your answer helped but didn't provide a solution to my issue. The solution can be found here: UPDATED JS FIDDLE for anyone running into same issues, here's d code below: $(document).ready(function () { //Show then hide ddown menu on hover $('.ddown').hover(function () { $(this).children('ul').stop(true).delay(500).slideDown(500); }, function () { $(this).children('ul').stop(true).delay(1000).slideUp(500); });...

Swift - generate random Integer between 0.1 and 0.6

ios,swift,time,int,delay

Okay here is the working code - thanks to @mireke for help // delay before playing var lower : UInt32 = 1 var upper : UInt32 = 6 var delayTime = arc4random_uniform(upper - lower) + lower var delayTimer = Double(delayTime) / 10 var delay = delayTimer * Double(NSEC_PER_SEC) var time...

How to use delayed expansion with the iterator of the outer for-loop?

batch-file,for-loop,delay,expansion

To correct the error, it is necessary to add a space between the do clause and the opening parenthesis of the code block. The %%s replaceable parameter scope/visibility is anywhere inside the for loop that initializes it. So, it can be directly used inside the inner loop....

How to create delay function in QML?

javascript,qml,delay

As suggested in the comments to your question, the Timer component is a good solution to this. function Timer() { return Qt.createQmlObject("import QtQuick 2.0; Timer {}", root); } timer = new Timer(); timer.interval = 1000; timer.repeat = true; timer.triggered.connect(function () { print("I'm triggered once every second"); }) timer.start(); The above...

delay a for loop with javascript [duplicate]

javascript,for-loop,delay

You'll have to go that way: function jsHello(i) { if (i < 0) return; setTimeout(function () { alert("Hello " + i); jsHello(--i); }, 2000); } jsHello(5); or function jsHello(i) { alert("Hello " + i); if (--i > -1) { setTimeout(function () { jsHello(i); }, 2000); } } jsHello(5); ...

Loop every five seconds in Javascript

javascript,jquery,loops,delay,settimeout

var time = 1; var interval = setInterval(function() { if (time <= 3) { alert(time); time++; } else { clearInterval(interval); } }, 5000); you can simply create an interval and kill it after the 3rd time...

How to download a delayed file via HTTP in Ruby?

ruby,download,delay,open-uri

Here is the modification according to the post and comment: require 'open-uri' def http_download(uri, filename) bytes_total = nil index = 1 begin open( uri, read_timeout: 500, content_length_proc: lambda { |content_length| bytes_total = content_length }, progress_proc: lambda { |bytes_transferred| if bytes_total print("\r#{bytes_transferred} of #{bytes_total} bytes") else print("\r#{bytes_transferred} bytes (total size unknown)")...

Delay for all value in loop

ios,objective-c,iphone,arrays,delay

Try this code, I added a incrementing delay, but I'm not sure if this is a healthy approach. Anyways, It shouldn't be a problem for small loops : - (IBAction)testButton:(id)sender { NSArray *array = [NSArray arrayWithObjects: @"Hefeweizen", @"IPA", @"Pilsner", @"Stout", nil]; int64_t delayInSeconds = 5.0; for (NSIndexPath *anIndexPath in array)...

Cordova splash screen - run code after splash is hidden

cordova,delay,splash-screen

You can do use the cordova API to close the splash when you want. Use a high value on XML configuration: <preference name="SplashScreen" value="screen" /> <preference name="SplashScreenDelay" value="60000" /> And in your JS: document.addEventListener('deviceready', function () { navigator.splashscreen.hide(); }); ...

how to daly send request after user stop typing using angularjs

javascript,angularjs,delay

Your decision to delay (or "debounce," as this technique is sometimes called) is wise--if you get enough users on your application, sending an ajax request with each keystroke is an effective way to bring your server to its knees (not to mention possibly making your client application feel quite sluggish)....

How to add a time delay before a label appears in tkinter?

python,tkinter,delay,tk,timedelay

You would create a function to add the label or change the label, and then request that it be run in the future with after: First, create the function: def showLabel(): label = Label(root, ...) label.place() Next, call it from your main code via after: #Add Enemy (I want a...

RecyclerView : How to create insert animation effect?

android,animation,delay,recyclerview

Below is how I add an animation in my Adapter. This will animate a push effect, with the row coming in from the right. First define the animation in xml (res/anim/push_left_in.xml) <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="300"/> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="300" /> </set> Then set it in your Adapter as...

How to delay output in C++?

c++,output,delay

This is platform-dependent. On Windows, you may use Sleep() function: Sleep(3000); The parameter is the amount of time in milliseconds. You need to include windows.h in order to use this function. On POSIX-compatible, you may use sleep(): sleep(3); // parameter is in seconds If you need better precision, you may...

IPN delay and SAAS application

paypal,delay,paypal-ipn,saas

Don't use IPN for this; it's a poor fit & not designed to be inserted into synchronous user experience flows. It works fine as a way to initiate offline fulfillment, but can delay your customers if they are actively waiting for access. You don't specify which PayPal product you are...

Data-delay function for a website

javascript,jquery,html,css,delay

I found a fiddle online that showed a good example of what you wanted. I updated it and changed a few things, that can be found below. The key to all of this is the following code: $(function() { $("img").lazyload({ effect : "fadeIn", effectspeed: 10000 }); }); All this does...

CSS, Javascript or jQuery blinking element on load

jquery,css,delay,fade,pageload

You can try something like this. DEMO var count = 0 // DOES NOTHING FOR 1 SEC setTimeout(function () { var interval = setInterval(function () { $("#blinker").toggleClass(function(){ count++ return "blink" }); // Reason it is 8 because it is counting the fadeIn and FadeOut if (count == 8) clearInterval(interval); },...

Delay for overlay to disappear on mouseout

css,wordpress,woocommerce,delay,mouseout

It is in your wp-content/themes/agent/woocommerce/woocommerce-custom.js file at line 19. jQuery(document).on( 'mouseenter', '.products .product', function() { jQuery(this).find('.thumb-overlay').stop(true, true).fadeIn(); }); jQuery(document).on( 'mouseleave', '.products .product', function() { jQuery(this).find('.thumb-overlay').stop(true, true).fadeOut(); }); EDITED Child themes only override files in the main theme directory (like header.php) that are called in with functions like get_template_part or get_header,...

Delay Actions in Swift

xcode,swift,delay

dispatch_after() is the standard way of delaying actions. indicator.startAnimating() let delay = 4.5 * Double(NSEC_PER_SEC) let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay)) dispatch_after(time, dispatch_get_main_queue()) { indicator.stopAnimating() } See: dispatch_after - GCD in swift?...

Generic Microcontroller Delay Function

c,delay,pic,mplab

This is referred to as busy waiting, a concept that just burns some CPU cycles thus "waiting" by keeping the CPU "busy" doing empty loops. You don't need to reset the function, it will do the same if called repeatedly. If you call it with N=3, it will repeat the...

What's the harm in having a long maxDelayTime?

javascript,delay,web-audio

Yes, that's a bad idea. The best way to think of this is that the maxDelayTime sets the size of the internal buffer that is continually updated - the delayTime just alters the lookup point in that buffer. If you set a maxDelay to be overly aggressively large, you'll chew...

long delay launching game on real device

ios,initialization,sprite-kit,delay

Using the instruments tool can help you locate where bottlenecks appear in code. I doubt it is 10-13 seconds from app launch as any app that takes 10 seconds or longer to launch is killed by the system. Try to load resources intelligently. Load what is absolutely necessary when launching...

JQuery - delay and show text issue

javascript,jquery,each,delay,settimeout

The problem is occurring because of your use of the keyword this. Inside the for each statement you need to set a variable that is set to $(this) and then reference that variable in the timeout. Example below: var parent = $(this); setTimeout( function(){ var el = parent; el.prev().hide(); el.show();...

Delay lineTo in for loop

javascript,jquery,for-loop,canvas,delay

Your first issue is that you are calling your drawLines function immediately and then passing the result of that function (undefined) to setTimeout. More on that here Once you fix that, you will find you have an issue of having a closure in a loop. There are a number of...

Possible to delay a segue?

ios,objective-c,storyboard,delay,segue

I agree with @Paulw11. Link your segues between view controllers, not from your button. Then your IBAction method would invoke a UIView animation where the completion block invokes the segue. And T_77's advice is terrible. Avoid sleep at all costs. It locks up the device. Bad, bad mojo....

delay, setTimeout - how to do 2 things delayed on click?

click,delay,settimeout

you can do it with same .queue function. $('#clicky').click(function(e){ $("#clicky") .queue(function(){ $(this).addClass("transition").dequeue(); }) .delay(1000) .queue(function(){ $(this).addClass("blur").dequeue(); }) .delay(1000) .queue(function(){ $(this).removeClass('transition').dequeue(); $(this).removeClass('blur').dequeue(); }); }); inspect html element and you can see how css classes are added and removed, I added delay between add/remove css classes for better look and check. DEMO...

Add a 'wait' in jQuery

javascript,jquery,delay

In jQuery it's called delay() not wait() However in plain javascript you have timeouts, and it looks more like that's what you really want $('.thank-you').show() setTimeout(function { location.reload(); }, 1000); ...

jQuery strange delay behaviour

jquery,delay

jQuery docs implicitly states that delay is NOT a timout and should use for animations ONLY what you are trying to achive is that: function doSomething() { // place your code here } setTimeout(doSomething, 200); EDIT: $('.attachment-full').each(function(indexs) { var visible_pathz = $(this).attr('data-info'); setTimeout(function(e) { e.attr('src', visible_pathz).fadeIn(300); }, 200 * indexs,...

Remove content form tag after 5 seconds

javascript,jquery,delay

As per doc: jQuery.delay() is best for delaying between queued jQuery effects and such, and is not a replacement for JavaScript's native setTimeout function, which may be more appropriate for certain use cases. long story short, .delay() works for queued functions. You should use setTimeout() instead. $('#ajax_message').html(data) setTimeout(function(){ $('#ajax_message').html(""); },5000);...

underscore _.delay implementation

javascript,delay

Why does the first implementation of delay not work? Because setTimeout(func(args), wait); calls the function. Right now. Before it's passing the result of the call to setTimeout. But that does expect a callback function to call later! Also how does the 3rd one work without using Array.prototype.slice.call? Because apply...

Call function every 10 seconds while being in a loop

php,sockets,loops,delay

PHP performs quite badly when trying to do realtime stuff. What you could do is get the time before the beginning of the loop, wait a bit after your code has executed (to prevent huge CPU load) and get the time after that : $timeCursor = microtime(true); while (TRUE) {...

Can javascript open a secondary window before the full document is loaded?

javascript,delay,window.open,immediate-window

Yes you can, it's waiting because you're putting it in the window.onload handler, which, well... waits for the entire window (and its resources) to finish loading. However, even if you do wait for the onload handler, the popup will be blocked by popup blockers. The only safe way to open...

OpenCL Kernel wait/delay

c,opencl,delay,wait,data-synchronization

The OpenCL spec is designed for data crunching. Not for wait/sleeps. Even if you may achieve it, you will be breaking a lot of the good design rules of OpenCL. In fact, many GPUs will crash or kill the execution if you try to sleep them. Please reconsider what you...

Java Swing redraw delay

java,multithreading,swing,delay

I have a request delay of about one second and THEN the loading animation is displayed. This animation should be displayed before the request is started. Never use Thread.sleep() in Swing application that sometime hangs the whole application as you stated it already in your post. You should use...

Iterate over an object with delay

javascript,object,recursion,delay,delayed-execution

First create a flat array from the hierarchy: function iter(obj) { var result = []; for (var i = 0; i < obj.length; i++) { result.push(obj[i]); if (typeof obj[i].contains == "object") { result = result.concat(iter(obj[i].contains)); } } return result; } var items = iter(object); Now you can iterate the array...

How do I create a Java delay class?

java,class,delay

Make class public class WaitTools { public static void Wait() { try { Thread.sleep(100); } catch(InterruptedException ex) { Thread.currentThread().interrupt(); } } } And then use java static imports (if you want) import static YOURPACKAGE.WaitTools.Wait; and you should directly use Wait(); or classical way import YOURPACKAGE.WaitTools; and calling it WaitTools.Wait();...

Which chat pattern is better: print the message upon input, or after the server receives it? [closed]

java,input,chat,delay,irc

After user clicked "send" button message should appear in his chat with icon "in progress", as soon as server confirmed that message is received - icon should be removed or changed to "received", in case of timeout - change icon to "error" with possibility to retry sending Doing this way...

Check the scrollTop() of document after few seconds

javascript,jquery,scroll,delay,scrolltop

You can do it using the setTimeout() function after the document.ready was triggered: $(function(){ //wait for document ready setTimeout(function(){ $(document).scrollTop() }, 2000) //execute your function after 2 seconds. }); ...

xcode 6 - change default launch screen display time

xcode,xcode6,delay,splash-screen,launch-screen

You can also use NSThread: [NSThread sleepForTimeInterval:(NSTimeInterval)]; You can put this code in to first line of applicationDidFinishLaunching method. For example, display screen for 4 seconds. File: AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { /*this will pause main thread for x interval seconds. put on the top of application:didFinishLaunchingWithOptions, so...

Delay and animation jQuery [closed]

javascript,jquery,jquery-animate,delay

You can do it using the animate method from jQuery: $("#object1").animate({ opacity: 0.25, height: "toggle" }, 5000, function() { //On Animation completem animate object 2 $("#object2").animate({ opacity: 0.25, height: "toggle" }, 1000); }); ...

Assembly speaker and wait interrupt endless sleep

assembly,delay,sleep,8086,speaker

It turned out that the interval: mov ah,86h; int 15h ret works wrong beacause int 15h 86h function somehow fails, so I wrote my own procedure interval: mov ah, 0 int 1Ah ; actual time mov bx,dx delay: mov ah, 0 int 1Ah sub dx,bx cmp di,dx ja delay ret...

Jquery delay Unhandled Error

jquery,delay

delay appear undefined ? Try substituting $.fn.delay for calling undefined delay function ; utilizing .queue() to call margin recursively $(document).ready(function() { function margin() { $(".logo").animate({ marginLeft: "150px" }, 1500).delay(4000) .animate({ marginLeft: "350px" }, 1500, function() { $(this).delay(4000, "margin") .queue("margin", margin).dequeue("margin"); }); } margin(); }); .logo { background: olive; width: 50px;...

Why udelay and ndelay is not accurate in linux kernel?

timer,linux-kernel,linux-device-driver,delay

As you've already noticed, the nanosecond delay implementation is quite a coarse approximation compared to the millisecond delay, because of the 0x5 constant factor used. 0x10c7 / 0x5 is approximately 859. Using 0x4 would be closer to 1000 (approximately 1073). However, using 0x4 would cause the ndelay to be less...

Schedule restart of Akka actor

scala,akka,delay,restart,supervisor

Delay on restart hasn't been implemented yet. Thread.sleep is out of the question performance wise. I see two choices : Have your main actor create the querying actor on a message. When it blows up because of a database outage, you can just stop the actor and re-schedule a message...

Automatically calling an init function whenever an object is used for the 1st time

c#,load,delay,auto,init

If I understood what you want to achieve, you are looking for the Proxy Design Pattern, more specifically, a virtual Proxy. Refer to http://www.dofactory.com/net/proxy-design-pattern A small example would be something like: public abstract class IObjectProvider { public abstract IObjectProvider Object{get;} public abstract void doStuff(); } public class RealObject : IObjectProvider...

How to use time delay in MobileFirst adapters

timer,delay,mobilefirst,mobilefirst-adapters

You can't do this in the adapter logic, but you can do this in the client logic... Add the required delay implementation in the adapter procedure request's success callback function so that it won't get processed right away, if that's what you really want to do (which would be strange,...

I need to slow down a loop in a python tkinter app

python,tkinter,delay

This is a pretty common class of problems related to GUI programming. The heart of the issue is the window drawing manager. As long as your function is executing, the drawing manager is frozen; updating the label's text will have no apparent effect until your function ends. So if you...