lazy-loading

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

寵の児 提交于 2019-12-05 11:39:51
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 that's irrelevant here. The way this works is by first placing an anchor on the page containing the

Entity Framework 6 context not retrieving navigation properties

南楼画角 提交于 2019-12-05 10:09:31
I have found many other posts but they are nt facing exactly the same problem. And they are using a slightly different code. SO I think it is worth reviewing this. I´m using EF6 code first, and I created a Client Entity that has some navigation properties. I´ll post just the relevant code, consider there are a few more properties and foreign keys as well, but not relevant to the problem. Model is generating ok. public class Client { public Client() { JobsExperiences = new Collection<JobsExperience>(); CapacitationCourses = new Collection<CapacitationCourse>(); ScholarLevelDetails = new

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

泄露秘密 提交于 2019-12-05 09:39:45
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 would be a usual, simplified lazy-loading property. You may even want to use the generic Lazy Class to get

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

孤人 提交于 2019-12-05 09:13:42
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 pair[0]), I just want to load the groups one by one. I already have an iterative solution. I'm just

Angular2 lazy loading module error 'cannot find module'

≡放荡痞女 提交于 2019-12-05 08:26:38
问题 I was trying to find any solution for this error but nothing works for me. I have simple Angular2 App created with Angular-CLI. When I serve this app in browser I'm getting this error: EXCEPTION: Uncaught (in promise): Error: Cannot find module '/app/test.module'. I was trying using different path in loadChildren: '/app/test.module' './app/test.module' './test.module' '/src/app/test.module' Folders src/ app/ app-routing.module.ts app.component.ts app.module.ts test.component.ts test.module.ts

Overriding property getters with lazy loading in Objective-C

纵饮孤独 提交于 2019-12-05 07:09:24
I usually lazy instantiate my @property objects in their getter methods like this: @interface MyGenericClass : UIViewController @property(nonatomic, readonly) UIImageView *infoImageView // ... @implementation GenericClass - (UIImageView *)infoImageView { if (!_infoImageView) { _infoImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"PlaceholderInfoImage"]]; } return _infoImageView; } But when subclassing, I would often like to override some of the @properties to be more subclass specific. So I'd like to change the instantiation and do something like: @interface

What is the ideal place to cache images?

我怕爱的太早我们不能终老 提交于 2019-12-05 07:08:04
问题 I am fetching a lot of thumbnails in my application from a remote server and lazy-loading these in a list view. The image fetches run in a background AsynTask and when completed the fetched images are stored in a HashMap using SoftReferences. This works just fine but when the images in the cache gets GC’d, the fetches have to be rerun. I could have stored them on the SD card so there would be no re-fetching. But I did not take this approach because of the clutter it would create on the SD

When using lazy dataTable another component does not get updated / 2nd component data is one request behind

自古美人都是妖i 提交于 2019-12-05 06:31:59
I have a PrimeFaces p:dataTable and enabled lazy loading by implementing a LazyDataModel . The dataTable holds search results, so when doing a search request the search service only retrieves the required (paginating) data. That works fine. When doing a ajax request with p:commandButton : <p:commandButton id="searchCmdBtn" value="Search" action="#{searchBean.search}" update=":resultForm:resultList :filterForm:filterMenu :resultForm:messages" ajax="true" /> the dataTable gets updated properly, but not the filterMenu in the filterForm (differnt forms, bcz using p:layout ). The filterMenu is one

Is there a way to combine the lazyload js library with Picturefill?

给你一囗甜甜゛ 提交于 2019-12-05 05:29:22
问题 I'm wondering how you would incorporate lazyload.js with Picturefill, when lazyload's image syntax requires the img tag along with data-original, and Picturefill's syntax doesn't have a spot for those. For example, this is my markup for an image using Picturefill: <span data-picture data-alt="Operating room 2 stands vacant in Dr. Tariq Mahmood's closed Renaissance Hospital in Terrell, Texas."> <span data-src="img/main1_small.jpg"></span> <span data-src="img/main1_small_x2.jpg" data-media="

virtual properties and lazy loading

北慕城南 提交于 2019-12-05 04:39:17
By definition virtual properties or methods are methods visible to sub classes to be overridden. But, NHibernate for example uses virtual properties to ensure lazy loading. My question is not about NHibernate, but how you could use virtual properties to achieve lazy loading? Are there any hidden behaviors about virtual properties that I don't know? The fact that they are declared virtual allows NHibernate to override the property and create a proxy implementation for it - the proxy in turn they can use to implement lazy loading on the first access of the property. There is no hidden behavior