lazy-loading

How to lazily evaluate ORM call after fixtures are loaded into db in Django?

I've got a module pagetypes.py that extracts a couple of constants (I shouldn't really use word constant here) from the db for later reuse: def _get_page_type_(type): return PageType.objects.get(type=type) PAGE_TYPE_MAIN = _get_page_type_('Main') PAGE_TYPE_OTHER = _get_page_type_('Other') then somewhere in views I do: import pag...

Linq to Entities in .Net, 4.0, Lazy Loading still eager loading

I'm using Linq to Entities for some simple database access. In the automatically generated entities, there's a Class IndexMeta, which refers to a collection of objects of class IndexData. Although i set the ObjectContext like this: this.xxxDataEntities.ContextOptions.LazyLoadingEnabled = true; It seems the DataEntities is still doin...

Is there a way to use the NHibernate session to figure out if changes need to be written to db?

Hi, I'm using NHibernate here with C#. I have a cache of nhibernate objects that have lazily loaded objects inside of those that might have changes written to them. I need a way to determine if there are changes that need to be saved. It's quite a lot of effort to set flags when one little thing changes and also quite annoying to compar...

How do I only load an image when the user scrolls to it

Many sites appear to only download images or generate parts of the document (eg for reviews) when the user scrolls far enough down the page to actually see them. This obviously will give you faster loading pages and save on bandwidth for anyone that does not bother scrolling down. How is this done, ideally with jquery? Or to ask it ano...

Hibernate JPA - ManyToOne relationship not populated

I'm currently moving a (working) app from using EclipseLink to Hibernate JPA, mostly it's gone quite smoothly, but I'm finding one thing that I can't explain, and also can't think of any good search terms! Basically, I have four entities, with one-to-many relationships forming a chain: EntityA has a list of EntityB's, each of which has...

How can I simulate the ending of a transaction using JUnit with Spring and Hibernate to isolate a LazyInitializationException?

I'm trying to write a test that isolates the failure to load a property because no Session exists. The following path fails ERROR [http-8081-14] LazyInitializationException.setSessionAttribute(223) | could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hib...

Lazy loaded list view in GTK#

I'm looking to display a large dataset via a list view in GTK# and performance is an issue here. I'm currently using a TreeView backed with a ListStore, but adding all my data to the ListStore takes forever. Is there a list view widget of some sort in GTK that supports lazy loading of data? In Winforms, you can use the VirtualMode pro...

tableView:cellForRowAtIndexPath: lazy loading problem

Hiya, While implementing TableView I've stuck with the problem that I somehow has broken "lazy" loading behaviour of UITableView. Now upon entering the screen it loads all the cells (both visible and invisible). Could someone point out where I should look at? In IB I have such an organization: -> UIView --> UIScrollView ---> UITable...

How to stop UITableView of reloading data and calling tableView:cellForRowAtIndexPath: ?

Hi people, I've got another problem my my UITableView: I dynamically load "Questions" from a XML File and show them inside cells of my UITableView, where the user can also answer them. The Problem is: if you scroll down, and then scroll up again, the answers that you typed before, just disappear. I've also noticed that UITableView calls...

Android: lazy loading in Gallery

Hi, I've reviewed some posts about lazy loading but I believe my problem is a bit different. I have a gallery (my class extends Gallery) which displays 20 rather large in size images (400-500K each). I cannot load them all to gallery since I get an OutOfMemory exception. So, I created an array of 20 Drawables and initially populated ...

Error in lazy loading with NHibernate

I use lazy loading in my application. When I work on my source code and view it in my browser there isn't any problem but when I publish my web application, this error shown : The following types may not be used as proxies: Faraconesh.BusinessFramework.Common.OrganizationalMonth: field bkpStartDate should not be public nor internal Fara...

Lazy loading in Objective-C -- too lazy?

I have a UIViewController that needs to set a few labels when it receives a new (object) value for one of its properties: -(void)setCurrentEvent:(Event *)e { [currentEvent release]; currentEvent = [e retain]; self.dateLabel.text = currentEvent.subtitle; self.summaryTextView.text = currentEvent.summary; self.avgRating...

Improve performance in scrollview.

Hello. I am new to programming. I have a paging enabled scroll view with many pages (up to ten) and on every page I have a custom button. Every custom button has a custom image. Everything I have made in Interface Builder. When I load the view controller containing this scroll view, it takes a lot of time to load it because it loads all ...

Implementation of Lazy<T> for .NET 3.5

.NET 4.0 has a nice utility class called System.Lazy that does lazy object initialization. I would like to use this class for a 3.5 project. One time I saw an implementation somewhere in a stackoverflow answer but I can't find it anymore. Does someone have an alternative implementation of Lazy? It doesn't need all the thread safety featu...

stand-alone lazy loading images (no framework based)

I look after a site which by nature has to load quite a lot of images and content on the page. We have decreased the number of elements and graphical layout images as much as we can, so we are now looking at ways to increase the page load in the browser. Does anyone know any code for lazy loading images that doesn't require a framework ...

NHibernate: why do non-persistent properties have to be marked as virtual for lazy loading.

I kind of get that in order to allow lazy loading, NHibernate needs to generate a proxy class which extends the POCO class. And so I guess NHibernate needs to override the implementation of the persisted properties, and you have to mark them as virtual. What I don't get is why I have to go round marking almost everything else as virtual...

lazy event publish subscribe in python

I need an event messaging system in my google app engine application. and i was referring to following python library. http://pubsub.sourceforge.net/apidocs/concepts.html my question is , is it must that the listener function i want to execute must be imported ( or exist otherwise) somewhere in to the execution path in order to run it...

How to tell if an item is on the screen (WITHOUT using scrollbars)...

Hey, Is there a way that I can only render the elements on the screen and leave those others to be rendered when they come into view? Basically like 3d culling, but on a website ^.^ [edit] I take it that this isn't possible then? [/edit] [edit2] I tried LazyLoad (jQuery plugin) but that initialised on windows scroll [/edit2] [edit3] S...

Rails 3 'where' with no conditions or 'all' lazy loading

How can I get ActiveRecord::Relation object of the model without any conditions? Of cause I can write User.where # without any args , but thats looks confusing ...

StructureMap, NHibernate and ASP.NET MVC fails to lazy load

I'm urrently working on a MVC project based on StructureMap and NHibernate. It's my first time using StructureMap, so I might be using it wrong, which causes these troubles for me. In my Application_Start I initialize StructureMap like this: ObjectFactory.Initialize(x => { x.For<ISessionFactory>() .Singl...