deferred-execution Questions

2

Solved

When creating new objects in a LINQ statement, for example: var list = new List<string>() { "a", "b", "c" }; var created = from i in list select new A(); With class A looking like this: c...
Lussier asked 20/9, 2013 at 12:45

3

Solved

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` } What w...
Poor asked 10/8, 2017 at 15:23

10

Solved

I have the following html code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="https://cdn.jsdelivr.n...
Judaize asked 30/12, 2016 at 10:50

11

Solved

I have a few <script> elements, and the code in some of them depend on code in other <script> elements. I saw the defer attribute can come in handy here as it allows code blocks to be p...
Imbibe asked 9/3, 2011 at 18:29

3

Solved

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 fu...
Lowson asked 8/4, 2015 at 14:51

6

Solved

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 executio...
Zolazoldi asked 8/10, 2010 at 21:38

1

Solved

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...
Shift asked 18/5, 2018 at 8:7

2

Solved

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 &l...

2

From what I'm reading, the defer attribute on <script> is now widely supported but I never see it used or mentioned. If you don't need to defer inline scripts and don't add scripts dynamical...
Indecorum asked 27/12, 2013 at 12:6

2

Solved

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...

3

Solved

I ran into a weird issue and I'm wondering what I should do about it. I have this class that return a IEnumerable<MyClass> and it is a deferred execution. Right now, there are two possible co...
Sayre asked 10/11, 2016 at 21:41

1

Solved

gometalinter and errcheck return me a warning about deferring a function which returns a variable. Example in a web request: defer r.Body.Close() In this case, Close returns an error variable a...
Ardys asked 3/11, 2016 at 9:22

6

Solved

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 ...
Tortilla asked 2/1, 2016 at 15:1

5

Solved

I am having an issue with HTML injection into an already loaded DOM where the inline javascript is being loaded after the script file is downloaded. From what I know this should not be async and th...
Wellmannered asked 24/1, 2016 at 14:12

1

Solved

after adding bool distinct to method Splitter and checking if distinct is true the code broke. The quesry now instead of being dictionary is IEnumerable<string>, but whould be Dictionary<s...
Jac asked 20/5, 2015 at 13:45

1

Solved

If you have a function which has both .then and .always callbacks, which one will get executed first?
Janik asked 23/4, 2015 at 0:28

3

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 nothi...
Kikelia asked 26/9, 2013 at 20:40

3

Since using $.Deferred I've run into this scenario a couple times: I have a list of values each of which yields a Deferred Object in some way and I want to execute a callback once all of the Deferr...

1

Solved

When I execute a query in Dapper and only want to retrieve a block of records, can I use .Skip().Take(), or do I need use select top n * in the SQL? eg Given a table with 10,000 records and I only...
Mcknight asked 19/10, 2013 at 0:16

5

Solved

So, this may seem like an edge case, but I'm simply wondering if this is possible. What I have is a combination of a static set and deferred set wrapped in an IEnumerable - for example: public IEn...
Screening asked 15/2, 2013 at 19:56

6

Solved

I've been learning about IQueryable and lazy loading/deferred execution of queries. Is it possible to expose this functionality over WCF? I'd like to expose a LINQ-to-SQL service that returns an I...

2

Should efQuery.ToList().Count and efQuery.Count() produce the same value? How is it possible that efQuery.ToList().Count and efQuery.Count() don't produce the same value? //GetQuery() returns a d...
Tedda asked 3/7, 2013 at 15:23

2

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<string&gt...
Schmeltzer asked 17/5, 2010 at 8:30

2

Solved

Consider the following code: using System; using System.Collections.Generic; using System.Linq; using System.Xml; using System.Xml.Linq; namespace ConsoleApplication1 { class Program { static ...
Panel asked 28/3, 2013 at 13:5

2

Solved

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...
Malinda asked 22/3, 2013 at 9:27

© 2022 - 2024 — McMap. All rights reserved.