lazy-loading

Angular - Lazy loading a module inside module with a child route

别说谁变了你拦得住时间么 提交于 2019-12-07 11:00:59
问题 I have an angular application where my main routing module lazy loads modules correctly. I do however now have an additional requirement of displaying another component / module inside one of the lazy loaded modules. When I now navigate to users/id (this part works correctly) I want a tab view in the HTML where I can load additional modules based on what tab is clicked on. For example, I might have 3 buttons: User Albums , User Favourites and User Stats . When I click on one of those, I want

Will inserting the same `<script>` into the DOM twice cause a second request in any browsers?

我是研究僧i 提交于 2019-12-07 10:27:27
问题 I've been working on a bit of JavaScript code that, under certain conditions, lazy-loads a couple of different libraries (Clicky Web Analytics and the Sizzle selector engine). This script is downloaded millions of times per day, so performance optimization is a major concern. To date, I've employed a couple of flags like script_loading and script_loaded to try to ensure that I don't load either library more than once (by "load," I mean requesting the scripts after page load by inserting a

Private backing field for entity framework lazy loading

久未见 提交于 2019-12-07 09:36:33
问题 I'm using Entity Framework 5 with lazy loading enabled. I have got the following code: private ICollection<Subscription> _subscriptions = new Collection<Subscription>(); public virtual ICollection<Subscription> Subscriptions { get { return _subscriptions; } set { _subscriptions = value; } } But does this make sense? I want to ensure that the public property Subscriptions is never null. Due to the virtual entity framework overrides the getter and setter to provide the lazy loading

Entity Framework 4.1 code-first, required lazy load reference is null on save

泪湿孤枕 提交于 2019-12-07 09:05:31
问题 I'm building a forum project for ASP.NET MVC 3, running on .NET 4 with the latest version of Entity Framework. I have the usual forum design, with a Board with Categories, and Categories with Forums, Forums with Topics and Topics with Posts etc. Simplified: public class Category { [Required] public virtual Board Board { get; set; } } public class Forum { [Required] public virtual Category Category { get; set; } } public class Topic { [Required] public virtual Forum Forum { get; set; } }

How to abstract lazy initialization in C++?

早过忘川 提交于 2019-12-07 09:00:49
问题 While refactoring some code for performance the other day, I needed an answer to creating member variables that are lazy initialized, but that also provides a convenient, though optional, non-lambda interface for non c++11 compilers. Here's the typical pattern for lazy instantiation that I want to abstract: if( !bInitialized ) { value = doInitialization(); bInitialized = true; } return value; For my use, I'd like some flexibility: allow explicit initialization, like the example above provide

Delay loading expensive fields in Entity Framework v.1

你。 提交于 2019-12-07 08:16:41
问题 After hunting around the net, and thinking I'd come up with the solution, I seem to have hit another brick wall. I have a table in my database: Photos; containing columns for PhotoID, Caption, Ordering, and four sets of binary data: Original, Large, Medium and Small (yes, it was based on the old ASP.NET starter kit with various fixes, etc). I'm in the process of moving from L2S to Entity Framework for some of the advantages I appear to get with that - so I no longer need to go through a

How to produce a lazy sequence by portion in clojure?

雨燕双飞 提交于 2019-12-07 07:20:46
问题 I have a database server and I fetch data from it. Sometimes data have millions rows and more so I use laziness for downloading. I use Server Side Cursors from clojure.jdbc library https://funcool.github.io/clojure.jdbc/latest/#cursor-queries to fetch data lazily. Now I have a problem. I need produce initial 500 elements from a lazy-sequence, then the program must wait for 10 minutes to get a signal which report to the program produce next 500 elements and so on until i receive all data from

Use of static local variables in lazy loading property in VB.NET

走远了吗. 提交于 2019-12-07 06:45:28
问题 I just recently learned about the uses of static local variables in VB.NET and wondered about it's potential use in lazy loading properties. Consider the following example code. Public Class Foo Implements IFoo End Class Public Interface IFoo End Interface Public Class Bar Private _fooImplementation As IFoo Public ReadOnly Property FooImplementation As IFoo Get If _fooImplementation Is Nothing Then _fooImplementation = New Foo Return _fooImplementation End Get End Property End Class This

Is it possible to do a lazy groupby, returning a stream, in java 8?

自闭症网瘾萝莉.ら 提交于 2019-12-07 05:42:04
问题 I have some large-ish text files that I want to process by grouping its lines. I tried to use the new streaming features, like return FileUtils.readLines(...) .parallelStream() .map(...) .collect(groupingBy(pair -> pair[0])); The problem is that, AFAIK, this generates a Map. Is there any way to have high level code like the one above that generates, for example, a Stream of Entries? UPDATE : What I'm looking for is something like python's itertools.groupby. My files are already sorted (by

First attempt at lazy loading (deferring the load of embedded YouTube videos) - how can I do this more gracefully?

a 夏天 提交于 2019-12-07 04:44:33
问题 Yesterday I decided to improve the way my website loads YouTube videos by only embedding them when a user requests them. Sometimes a page could have as many as 30 videos on, and this would take a long time to load. This is the first time I've attempted a "lazy loading" method of anything, and I figured it would be well worth asking: What can I do to improve on this? How can I make it a bit more graceful? Does this completely miss the point of deferred loading? JSFiddle. Ignore the styling as