Questions tagged [delay]

Delay refers to amount of time between two events.

A delay is simply the difference in time between two events.

This may refer to the start and stop of a single event (e.g. data processing delay) or the execution of two separate, independent events.

A delay may be manually implemented by the programmer using sleep or pause functions common in many programming languages.

In the case of computer networks, delay between sending and receiving of data packets is referred to synonymously as latency.

4215 questions
11
votes
2 answers

AudioTrack lag: obtainBuffer timed out

I'm playing WAVs on my Android phone by loading the file and feeding the bytes into AudioTrack.write() via the FileInputStream > BufferedInputStream > DataInputStream method. The audio plays fine and when it is, I can easily adjust sample rate,…
BTR
  • 4,880
  • 4
  • 24
  • 21
11
votes
5 answers

Can I delay jQuery addClass?

Is there a way to delay the addClass() of jQuery? For example this code $('#sampleID').delay(2000).fadeOut(500).delay(2000).addClass('aNewClass'); When I load the page, it has the class 'aNewClass' already on id 'sampleID'. How to solve this…
Ryan
  • 1,783
  • 8
  • 27
  • 42
11
votes
6 answers

Add a delay to a for loop in swift

I have a coding 'issue'. I have a label, which text I want to change dynamically every 2 seconds. I've done the following: // WELCOME STRING ARRAY let welcomeContainer:[String] =…
Alex
  • 271
  • 2
  • 4
  • 18
11
votes
2 answers

Is there a variant of `Task.Delay` that expires after real time passes e.g. even when the system is suspended and resumed?

I have a situation where it makes more sense to me to have a delay between periodic actions wait for an amount of time in the real world to pass rather than waiting for the system clock to tick some number of times. This way I could, say, renew a…
binki
  • 7,754
  • 5
  • 64
  • 110
11
votes
0 answers

Netem and virtual interfaces

I need to emulate a network, introducing for instance random delay, and I need help to use NetEm. The scenario consists in two Ubuntu 14.04 machines: A and B. A and B have ip addresses 192.168.0.1 and 192.168.0.2 on eth1. To avoid to mess with the…
Paolo
  • 183
  • 1
  • 6
11
votes
1 answer

In Shiny apps for R, how do I delay the firing of a reactive?

I have a selectizeInput in my Shiny app. It is in multiple-select mode, so the user can specify more than one selection. However, the reactives that depend on the selectizeInput get fired every time a selection is added. Suppose that the user…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
11
votes
2 answers

Rails: using "content_for" after the corresponding "yield" inside layout

I think this has been asked before but even though I searched Google I haven't come up with a solution. So this is what I'm trying to do in Rails 2.3.5: layouts/application.html.erb: ... some other stuff <%= yield :head %> …
thenoseman
  • 1,180
  • 1
  • 11
  • 12
11
votes
1 answer

Right way to test page load time in selenium?

I'm trying to programatically test the load time of a list of websites. The purpose is to roughly simulate the page load time a user will perceive. My first approach is to call the following inside a loop: startTime =…
cookM
  • 953
  • 3
  • 8
  • 11
10
votes
8 answers

How can i put a delay with C#?

I want to make an application to execute several instructions to pass the following instruction has to wait a few milliseconds. Such that: while(true){ send("OK"); wait(100); //or such delay(100); } Is it possible in C#?
FredVaz
  • 423
  • 3
  • 8
  • 14
10
votes
4 answers

How to create a delay in Swing

I made a blackjack game, and I want the AI player to pause between taking cards. I tried simply using Thread.sleep(x), but that makes it freeze until the AI player is done taking all of his cards. I know that Swing is not thread safe, so I looked at…
Fractaly
  • 834
  • 2
  • 10
  • 25
10
votes
1 answer

Why are Spring Rest services slow on the first request?

so this question has been asked a few times already but seems like no one answered it in a way that could help me. I'm currently making a backend for a simple application handling product data. It's not even with JSP, just a plain Rest backend.…
Panossa
  • 371
  • 5
  • 17
10
votes
1 answer

jQuery: slideUp() delay() then slideDown; not working

I'm trying to implement a very simple footer notification element to slide up for a moment, then slide back down. I'm using: $('button').click( function () { $('#message-box').slideUp('slow').delay(1500).slideDown('slow'); }); However, when you…
Ryan
  • 21,437
  • 7
  • 25
  • 28
10
votes
2 answers

Android app launch first time launch is taking more time even some time 30 sec and more

Below is log when app is first time installing: 05-12 13:16:23.632 28250-28250/com.app.projectName W/System: ClassLoader referenced unknown path: /data/app/com.app.projectName-1/lib/arm 05-12 13:16:59.041 28250-28250/com.app.projectName W/System:…
Anant Shah
  • 3,744
  • 1
  • 35
  • 48
10
votes
1 answer

Binding Delay property WPF - I didn't notice any difference

I was trying to understand more about bindings delay and its effects. I've implemented a simple code, but, honestly, I didn't notice any visual difference in the end, with or without delays. Here is the code:
Leonardo Alves Machado
  • 2,747
  • 10
  • 38
  • 53
10
votes
2 answers

delay() and fadeOut() don't delay attr() in the queue

what is wrong in this code? I'm trying to get this effect: fadeOut(500) and attr('class','myClass') delayed by 600 millisecs.. then delay(600) again, and fadeIn(500). The delays happen correctly but the attr() is not being delayed, it fires when…
Luca
  • 9,259
  • 5
  • 46
  • 59