Questions tagged [deferred-execution]

219 questions
0
votes
2 answers

Why is Linq2DB executing SQL-Statement after disposing DataContext

I have tested the following code with Linq2DB: IQueryable entities = null; using (var context = new DataContext("MySql", ConnectionString)) { entities = context.GetTable(); } var list = entities.ToList(); return entities; I wonder…
BennoDual
  • 5,865
  • 15
  • 67
  • 153
0
votes
1 answer

does putting Linq query inside a method affect deferred excecution?

Linq query is not executed until the sequence returned by the query is actually iterated. I have a query that is used repeatedly, so I am going to encapuslate it inside a method. I'd like to know if it interferes with the deferred execution. If I…
Yeonho
  • 3,629
  • 4
  • 39
  • 61
0
votes
2 answers

Built in .Net IEnumerable class that defers execution?

I was about to build my own IEnumerable class that performs some action on all items the first time something iterates over it then I started wondering, does the framework already have something that I could use? Here's what I was building so you…
adam0101
  • 29,096
  • 21
  • 96
  • 174
0
votes
4 answers

Why is LINQ non-deterministic?

I randomly sorted an IEnumerable. I keep printing out the same element, and getting a different result. string[] collection = {"Zero", "One", "Two", "Three", "Four"}; var random = new Random(); var enumerableCollection = collection.OrderBy(e =>…
Evorlor
  • 7,263
  • 17
  • 70
  • 141
0
votes
1 answer

Why isn't the return value returned when this deferred statement (without a return) runs?

I am reading through the go specification and don't fully understand the behavior of an example for defer. // f returns 1 func f() (result int) { defer func() { result++ }() return 0 } The function has a named return, which an…
user40176
  • 319
  • 2
  • 10
0
votes
1 answer

Create a Javascript promise in a dormant state?

One of the issues I have faced when crafting Promises for certain app context is that of wanting to delay any execution of the code inside the promise until later. This happens frequently when I have manager objects that maintain a collection of…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227
0
votes
4 answers

Delay/defer document.write from an external script till after document ready

I have an external script which loads advertisements. The script being loaded includes calls to document.write. The problem is this delays the doc ready for the site. I would like to delay showing this until after the doc ready. Currently I just…
jhanifen
  • 4,441
  • 7
  • 43
  • 67
0
votes
1 answer

Return sql query results with deferred execution

I have a method to execute an SQL statement and it returns an instance of my class ResultSet that contains the rows and columns returned. I only want to read the data row-by-row when the caller actually iterates over the results. public class…
user3700562
  • 693
  • 11
  • 23
0
votes
2 answers

Why do I have to wrap my Kotlin method references in closures?

In kotlin, I'm trying to create a dispatch table: class Foo { fun handleEvent(bytes:ByteArray) { // do something fun with the bytes } } class Bar { fun handleEvent(bytes:ByteArray) { // do something fun with the bytes …
Travis Griggs
  • 21,522
  • 19
  • 91
  • 167
0
votes
1 answer

Trying to view properties in debug gives different counts after time delay. Is this due to deferred execution?

I have the following method in a class: public IPlayerInfo GetPlayerInfo(int playerId) { return GetPlayerDetails(playerId).Matches; // Matches have Runs and Wickets list } And I have a class as follows: public class MyClass { public…
MAK
  • 1,915
  • 4
  • 20
  • 44
0
votes
1 answer

Does this Funnelytics code contain a race condition?

I'm looking into tracking scripts that I've come across. Here's one by Funnelytics. At first look it seems like it has a bug: (function(funnel) { var insert = document.getElementsByTagName('script')[0], script =…
Flimm
  • 136,138
  • 45
  • 251
  • 267
0
votes
2 answers

Javascript promise confusion for executing two functions in order

Right now I have funcA, funcB, arrayA and arrayB. In funcA, arrayB will populate itself by requesting some external information and the time for doing this is varied. I want it to execute funcB after arrayB.length == arrayA.length, and arrayB is a…
0
votes
0 answers

Defer Javascript Loading and Execution (JQuery conflicts)

I've been struggling to get jquery and our master scripts file to defer and execute one after another (thanks, Google's Pagespeed) I've used various methods, including require, LAB and the classic document.createElement method. However - the JS…
Jorge B
  • 53
  • 5
0
votes
2 answers

Create Unique Constraint over function based index with existing duplicate values

I have a table with wrong data and I'd like to prevent new wrong data from being inserted while I fix data and find out what process or where is the sentence making this happen. I first made a UQ constraint over the columns that shouldn't be…
0
votes
1 answer

Adding "deferred" members to the spring controller return

I have the following problem. One of the endpoints for my spring-boot controller has to return a POJO with a couple of big BLOBs plus some metadata information about those BLOBs. We need to be able to send first the metadata information (so that UI…
Andrei
  • 175
  • 1
  • 9