Questions tagged [deferred-execution]

206 questions
210
votes
10 answers

How exactly does
user31782
  • 5,979
  • 8
  • 54
  • 117

35
votes
2 answers

Add defer attribute to javascript_include_tag Rails

Is there some way to add the defer attribute easily using the javascript_include_tag helper in Rails? I.e., is there some easy way to turn <%= javascript_include_tag "blah.js" %> into
30
votes
6 answers

Linq - What is the quickest way to find out deferred execution or not?

What is the quickest way to find out which .net framework linq methods (e.g .IEnumerable linq methods) are implemented using deferred execution vs. which are not implemented using deferred execution. While coding many times, I wonder if this one…
Tejas
  • 991
  • 2
  • 10
  • 15
25
votes
3 answers

In go, is there a way to execute code on termination of the program?

I know you can define functions called init in any package, and these function will be executed before main. I use this to open my log file and my DB connection. Is there a way to define code that will be executed when the program ends, either…
Fabien
  • 9,808
  • 7
  • 37
  • 61
24
votes
3 answers

yield returns within lock statement

if i have a yield return in a lock statement does the lock get taken out on each yield (5 times in the example below) or only once for all the items in the list? Thanks private List _data = new List(){"1","2","3","4","5"}; …
DayOne
  • 937
  • 1
  • 8
  • 16
22
votes
1 answer

When using yield within a "using" statement, when does Dispose occur?

I have a question regarding deferred execution and the disposing of data. Consider the following example: private IEnumerable ParseFile(string fileName) { using(StreamReader sr = new StreamReader(fileName)) { string line; …
Middas
  • 1,616
  • 1
  • 23
  • 36
20
votes
1 answer

Understanding jQuery Deferred.pipe()

I am trying to implement the jQuery Deferred.pipe() method for the following scenario: Add a user in DB via $.ajax() Get response whether user was added correctly or not. If successfully added, get all the user list from server via $.ajax() Display…
Ashish
  • 2,424
  • 6
  • 36
  • 52
20
votes
3 answers

Why does `defer recover()` not catch panics?

Why does a call to defer func() { recover() }() successfully recover a panicking goroutine, but a call to defer recover() not? As an minimalistic example, this code doesn't panic package main func main() { defer func() { recover() }() …
jinpan
  • 330
  • 3
  • 10
19
votes
1 answer

What is a browser event loop?

I have been doing some web application programming using GWT and have been confused by the term "browser event loop". I have encountered situations where I need to execute deferred commands and "do something" after the browser event loop…
gofeddy
  • 559
  • 8
  • 20
17
votes
2 answers

When to use LINQ's .ToList() or .ToArray()

After running this code: var input = new List( ... ); var result = input.Select( t => new U(t) ); U first1 = null; foreach ( U u1 in result ) if ( first1 == null ) first1 = u1; U first2 = null; foreach ( U u2 in result ) if (…
HappyNomad
  • 4,092
  • 3
  • 31
  • 52
16
votes
3 answers

How to execute Ant build in command line

I have an Ant build file, and I try to execute it in the command line with the following command: $ C:\Program Files (x86)\.....>ant -f C:\Silk4J\Automation\iControlSilk4J\build.xml But nothing happens, and the result is: BUILD SUCCESSFUL Total…
Guylene Emond
  • 231
  • 2
  • 4
  • 7
15
votes
2 answers

Executing a trigger AFTER the completion of a transaction

In PostgreSQL, are DEFERRED triggers executed before (within) the completion of the transaction or just after it? The documentation says: DEFERRABLE NOT DEFERRABLE This controls whether the constraint can be deferred. A constraint that is not…
Mehran
  • 12,150
  • 14
  • 78
  • 191
14
votes
6 answers

Deferred assignment in pure javascript

In this question I encountered the following simplified problem: We start with an array of Objects with a value attribute. We want to calculate for each value what percentage of the sum of values it is, and add it to the structure as a property. To…
Sumurai8
  • 18,213
  • 9
  • 58
  • 88
13
votes
6 answers

Deferred execution in C#

How could I implement my own deferred execution mechanism in C#? So for instance I have: string x = DoFoo(); Is it possible to perform some magic so that DoFoo does not execute until I "use" x?
Larsenal
  • 45,294
  • 40
  • 140
  • 210
1
2 3
13 14