Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
0 votes
0 answers
99 views

Godot (4.3) Windows Export issue, unexpected C# script behaviour

On Godot engine, I created a generator that throw on the map various references of objets, and compare if positions are available, It is entirely based on C# code and uses the classic windows export....
Heolu's user avatar
  • 3
1 vote
1 answer
255 views

Simplest way in C# to defer task execution without synchronization context [closed]

Inside an async method in C#, I need to defer the execution (return the execution to the caller), and also to clear the synchronization context before proceeding with the execution. The statement ...
Ricardo Rocha's user avatar
1 vote
1 answer
70 views

C# LINQ Deferred Execution and Nested Methods

I have written the following code: List<int> ints = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; int start = 0; int end = 5; int limit = 10; IEnumerable<...
Michail Golubjev's user avatar
0 votes
2 answers
73 views

Does Javascript have deferred collection APIs like .NET LINQ?

I know Javascript Array has map, filter and the like, and reduce can be used as a way merge them (though I really dislike the syntax, it does work). However, a simple example below can prove that it ...
Luke Vo's user avatar
  • 21.6k
0 votes
1 answer
57 views

LINQ deferred execution when updating a property

I have the following C# code: #nullable enable using System; using System.Collections.Generic; using System.Linq; public class Program { public static void Main() { var userNames = ...
Pelle Stenild Coltau's user avatar
0 votes
1 answer
157 views

Implementation of DeferredFirstOrDefault to execute SQL queries in batch with multiple result sets

I'm working on my own DeferredFirstOrDefault() implementation. I want it to get an IQueryable and append FirstOrDefault() method to its expression tree. Using the new Expression i want to create a new ...
Shahzaib Hassan's user avatar
3 votes
1 answer
2k views

Performance impact of async vs defer in 3rd party script tag

How does the use of async and defer differ when considering the script execution after download and its impact on page performance? Async Blocks the parsing of the page when executed Executed as soon ...
jamomani's user avatar
  • 993
0 votes
1 answer
170 views

Dynamic script tag not loading, can't see network traffic for it

This code doesn't seem to load dynamically. Am I doing something wrong? Is there a better way. <html> <head> </head> <body> <script id="sovrn-ad" async defer ...
Mike Flynn's user avatar
  • 23.4k
0 votes
1 answer
33 views

Execute a collection of tasks int the order they where add to a list in batchs

I am wondering if anyone can help me, I am trying to get my head around how to execute concurrent tasks in batches and apologies if it is a silly question. However, I can only get them to execute all ...
Jimbo Jones's user avatar
  • 1,002
1 vote
2 answers
852 views

Defer, return and Argument evaluation in golang [duplicate]

package main import "fmt" // fibonacci is a function that returns // a function that returns an int. func fibonacci() func() int { a, b := 0, 1 return func() int { defer ...
likecs's user avatar
  • 363
1 vote
1 answer
2k views

Why should I call os.Exit at most once in the main function?

I started a new job and we've been instructed to use Ubers Go coding standards. I'm not sure about one of their guidelines entitled "Exit Once": If possible, prefer to call os.Exit or log....
NimaKapoor's user avatar
2 votes
1 answer
75 views

Difference between `where` in the query object and `if` in the extension methods [closed]

I am studying LINQ. I don't know the difference between using if in extension method and using where in query object. The Console.WriteLine() results are the same, is there any difference in speed? If ...
user avatar
2 votes
0 answers
687 views

defer - modify named return value vs non-named return value

Code func deferModifyReturnValue() int { x := 0 defer func() { x += 1 // executed before return, }() return x } func deferModifyNamedReturnValue() (x int) { defer func() { ...
Eric's user avatar
  • 25.8k
3 votes
2 answers
557 views

What does "object is enumerated" mean in C#?

I've been reading lately articles and documentation about deferred execution, LINQ, querying in general etc. and the phrase "object is enumerated" came up quite often. Can someone explain ...
marijuslau's user avatar
0 votes
1 answer
371 views

JavaScript: Using the defer attribute with library files

I know that there is a lot of discussion on the defer and async attributes, but I would like to clear up the correct usage in modern browsers. If I want to include a library file on which the second ...
Manngo's user avatar
  • 17k
0 votes
1 answer
680 views

Stop time.NewTimer initialized inside for loop

I have a program similar to below program: package main import ( "fmt" "time" ) func main() { ch := make(chan string) go endProgram(ch) printFunc(ch) } func ...
Abhay Gupta's user avatar
3 votes
1 answer
617 views

Execution order of dynamically added script tags marked with defer attribute?

I have some applications which dynamically create widgets. Some widgets need some libraries to be included (eg Codemirror, Tinymce, jQuery, ..). These scripts are dynamically added in document when ...
Nikos M.'s user avatar
  • 8,393
0 votes
1 answer
584 views

Is my C#.NET LINQ expression optimized for deferred execution (Entity Framework Core)

I am building a REST API using C#.NET for a customer, which will be used to retrieve error logs from a database. The database has three tables: Fault, Message and MessageData. The relation of the ...
onmi's user avatar
  • 57
1 vote
1 answer
642 views

Remove file on function failure

If I run this code: package main import "os" func pass() bool { return false } func main() { f, e := os.Create("file.txt") if e != nil { panic(e) } defer f.Close(...
Zombo's user avatar
  • 1
1 vote
4 answers
1k views

How to defer computation in C++ until needed?

In C++(*), is it possible to have a structure that "defers" some computation until needed (and maybe never does the computation if not necessary)? My use case is as follows: I have roughly ...
Matt's user avatar
  • 992
1 vote
3 answers
153 views

Why the extension method of where for LINQ in this code would print out a single number while it shouldn't print anything at all?

I've been reading about deferred evaluation of LINQ in the "Programming C#" book by Ian Griffiths. Deferred evaluation was explained through an example in which a Fibonacci method is defined ...
Mahsa's user avatar
  • 362
4 votes
1 answer
155 views

How do you create a python list comprehension of lambdas? [duplicate]

I am trying create a list of lambdas for deferred execution using a list comprehension. The below is a simple example. def func_a(message: str) -> None: print('a: ' + message) def func_b(...
OldSchool's user avatar
  • 457
0 votes
1 answer
170 views

Am I enumerating my IEnumerable<T> n times?

I am fairly comfortable with LINQ in c#, but am lost on whether or not my foreach loop is causing excessive enumeration. Assuming the following code snippet is run, var listOfStuff = new List<...
BakeryD's user avatar
1 vote
2 answers
2k views

Deferring function call in argument in python 3

I'm trying to add a cache of sorts to an expensive function using a fixed dictionary. Something like this: def func(arg): if arg in precomputed: return precomputed[arg] else: ...
TheEnvironmentalist's user avatar
2 votes
0 answers
578 views

EclipseLink Nullpointer while executing deffered events(AbstractSession.executeDeferredEvents) with lazy loading

I am getting a NullPointer from EclipseLink during Lazy loading of Children. This is not happening always, but it happens once in a while and once it gets into this exception, it keeps throwing the ...
Anup's user avatar
  • 21
2 votes
1 answer
414 views

How do I write a Plack middleware that runs after the HTTP response is sent to the client?

My Plack web service logs via a TCP connection to fluentD, and I'd like to execute my logging code after I've sent the response back to the client. This would reduce response time (assume this is a ...
Aaron's user avatar
  • 462
0 votes
2 answers
2k views

Why is Linq2DB executing SQL-Statement after disposing DataContext

I have tested the following code with Linq2DB: IQueryable<M> entities = null; using (var context = new DataContext("MySql", ConnectionString)) { entities = context.GetTable<M>(); } ...
BennoDual's user avatar
  • 6,339
2 votes
0 answers
537 views

Can you defer scripts in SVG?

In HTML, if you want to run a script after the page is loaded, your can set the defer attribute. However, when I try to do this in an SVG document: <script type="text/javascript" defer="defer" ...
marcus erronius's user avatar
1 vote
0 answers
203 views

How to make sure that the following recursive function is resolved or completed and then do some operations?

i made a recursive function which will get the file details from a share point document library recursively but unable to know whether the recursive function is resolved or completed //function ...
Srinath M's user avatar
3 votes
2 answers
1k views

Why does it take more time when you run a LINQ OrderBy before Select?

While writing a solution for a coding problem I discovered an interesting behavior of my LINQ statements. I had two scenarios: First: arr.Select(x => x + 5).OrderBy(x => x) Second: arr....
niklasstoffers's user avatar
3 votes
1 answer
2k views

Can the Google crawler read JSON-LD that is inserted after page load by a deferred script?

I have a site where the content is pulled into the page via a JavaScript widget which is deferred, to make it non-blocking and to ensure the dependency scripts in the footer are loaded before the ...
Lewis Donovan's user avatar
-4 votes
1 answer
194 views

Please explain DEFER's behaivour in golang [duplicate]

As I know, defer is usually used to close or free resources. And using defer FUNC () inside the block (function) of the code ensures that FUNC () will call in case of any return from this block(...
Борис's user avatar
1 vote
0 answers
89 views

How does the implementation of range-v3's meta::defer work?

Here is the implementation of meta::defer: template <template <typename...> class C, typename... Ts> struct defer : detail::defer_<C, Ts...> {}; detail::defer_ template <...
Li Chen's user avatar
  • 5,366
0 votes
4 answers
781 views

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 ...
Evorlor's user avatar
  • 7,436
0 votes
1 answer
428 views

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++ }() ...
user40176's user avatar
  • 339
0 votes
1 answer
78 views

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 ...
Robert Oschler's user avatar
0 votes
1 answer
365 views

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 ...
user3700562's user avatar
0 votes
2 answers
2k views

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:...
Travis Griggs's user avatar
0 votes
1 answer
82 views

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 ...
MAK's user avatar
  • 2,313
0 votes
1 answer
161 views

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('...
Flimm's user avatar
  • 154k
10 votes
1 answer
7k views

Are deferred functions called when SIGINT is received in Go?

For the snippet below, the deferred call is not made when ^C is received. Is it possible that the cleanup introduces a race condition? If yes, what could be a better pattern of cleanup on receiving an ...
Andrei's user avatar
  • 103
2 votes
3 answers
337 views

How to generate elements of IEnumerable One by One

Suppose I have an IEnumerable<Thing> enumerable object and that each Thing in this list is expensive to generate. When I go to execute the following code there is considerable overhead when the ...
tgabb's user avatar
  • 379
1 vote
0 answers
48 views

Why does deferred execution repeat itself on the same elements, instead of reading from a cache?

I understand the general idea of what deferred execution is in terms of a collection, but...in the context of .NET, what does that have in common with reconstructing the same elements of a collection ...
Panzercrisis's user avatar
  • 4,770
1 vote
1 answer
59 views

How can I determine when the differed execution will end so that I can load the data in AngularJs?

I'm keeping track of the current culture using localisation cookie. I want to load all the messages for the currently selected culture when the application starts and keep them in localStorage ...
van's user avatar
  • 397
2 votes
1 answer
71 views

Can assignments be deferred and execution of current block continue?

I have been given some educational literature explaining asynchronous happenings in JS... Take the following example where, server1 is a different server to the one running the website and the ...
El Ronnoco's user avatar
  • 11.9k
67 votes
3 answers
79k views

Proper way to release resources with defer in a loop?

I need to make SQL queries to database in the loop: for rows.Next() { fields, err := db.Query(.....) if err != nil { // ... } defer fields.Close() // do something with `fields` ...
ceth's user avatar
  • 45.5k
2 votes
3 answers
176 views

LINQ deferred execution with a function's result as source (e.g. Console.ReadLine)

A function's result is the source for a LINQ query. I want it to be evaluated lazily, every time I use the query, not be locked when I create it. This is an example of what I mean: var query = from c ...
Jakub Dąbek's user avatar
  • 1,044
0 votes
2 answers
48 views

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 ...
dwuuuu's user avatar
  • 29
0 votes
0 answers
86 views

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 ...
Jorge B's user avatar
  • 53
0 votes
2 answers
847 views

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 ...
EAmez's user avatar
  • 917

1
2 3 4 5