Search Results

Search found 1806 results on 73 pages for 'lazy evaluation'.

Page 3/73 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Lazy-loading flash objects

    - by friedo
    I'm using the jQuery lazy-loading plugin to defer loading of below-the-fold images on a large web page. This works great. Now, I would like to apply the same technique to a large Flash object which is also below-the-fold. I don't think the lazy-load plugin handles things that aren't images (at least it doesn't look that way so far.) I may have to do it myself. In that case, how do I detect when the area containing the Flash object becomes visible?

    Read the article

  • lazy loading images in UIScrollView

    - by idober
    I have an application the requires scrolling of many images. because I can not load all the images, and save it in the memory, I am lazy loading them. The problem is if I scroll too quickly, there are "black images" showing (images that did not manage to load). this is the lazy loading code: int currentImageToLoad = [self calculateWhichImageShowing] + imageBufferZone; [(UIView*)[[theScrollView subviews] objectAtIndex:0]removeFromSuperview]; PictureObject *pic = (PictureObject *)[imageList objectAtIndex:currentImageToLoad]; MyImageView *iv = [[MyImageView alloc] initWithFrame:CGRectMake(currentImageToLoad * 320.0f, 20.0f, 320.0f, 460)]; NSData *imageData = [NSData dataWithContentsOfFile:[pic imageName]]; [iv setupView:[UIImage imageWithData: imageData] :[pic imageDescription]]; [theScrollView insertSubview:iv atIndex:5]; [iv release]; this is the code inside scrollViewWillBeginDecelerating: [NSThread detachNewThreadSelector:@selector(lazyLoadImages) toTarget:self withObject:nil];

    Read the article

  • Hibernate Lazy initialization exception problem with Gilead in GWT 2.0 integration

    - by sylsau
    Hello, I use GWT 2.0 as UI layer on my project. On server side, I use Hibernate. For example, this is 2 domains entities that I have : public class User { private Collection<Role> roles; @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "users", targetEntity = Role.class) public Collection<Role> getRoles() { return roles; } ... } public class Role { private Collection<User> users; @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = User.class) public Collection<User> getUsers() { return users; } ... } On my DAO layer, I use UserDAO that extends HibernateDAOSupport from Spring. UserDAO has getAll method to return all of Users. And on my DAO service, I use UserService that uses userDAO to getAll of Users. So, when I get all of Users from UsersService, Users entities returned are detached from Hibernate session. For that reason, I don't want to use getRoles() method on Users instance that I get from my service. What I want is just to transfer my list of Users thanks to a RPC Service to be able to use others informations of Users in client side with GWT. Thus, my main problem is to be able to convert PersistentBag in Users.roles in simple List to be able to transfer via RPC the Users. To do that, I have seen that Gilead Framework could be a solution. In order to use Gilead, I have changed my domains entities. Now, they extend net.sf.gilead.pojo.gwt.LightEntity and they respect JavaBean specification. On server, I expose my services via RPC thanks to GwtRpcSpring framework (http://code.google.com/p/gwtrpc-spring/). This framework has an advice that makes easier Gilead integration. My applicationContext contains the following configuration for Gilead : <bean id="gileadAdapterAdvisor" class="org.gwtrpcspring.gilead.GileadAdapterAdvice" /> <aop:config> <aop:aspect id="gileadAdapterAspect" ref="gileadAdapterAdvisor"> <aop:pointcut id="gileadPointcut" expression="execution(public * com.google.gwt.user.client.rpc.RemoteService.*(..))" /> <aop:around method="doBasicProfiling" pointcut-ref="gileadPointcut" /> </aop:aspect> </aop:config> <bean id="proxySerializer" class="net.sf.gilead.core.serialization.GwtProxySerialization" /> <bean id="proxyStore" class="net.sf.gilead.core.store.stateless.StatelessProxyStore"> <property name="proxySerializer" ref="proxySerializer" /> </bean> <bean id="persistenceUtil" class="net.sf.gilead.core.hibernate.HibernateUtil"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean class="net.sf.gilead.core.PersistentBeanManager"> <property name="proxyStore" ref="proxyStore" /> <property name="persistenceUtil" ref="persistenceUtil" /> </bean> The code of the the method doBasicProfiling is the following : @Around("within(com.google.gwt.user.client.rpc.RemoteService..*)") public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable { if (log.isDebugEnabled()) { String className = pjp.getSignature().getDeclaringTypeName(); String methodName = className .substring(className.lastIndexOf(".") + 1) + "." + pjp.getSignature().getName(); log.debug("Wrapping call to " + methodName + " for PersistentBeanManager"); } GileadHelper.parseInputParameters(pjp.getArgs(), beanManager, RemoteServiceUtil.getThreadLocalSession()); Object retVal = pjp.proceed(); retVal = GileadHelper.parseReturnValue(retVal, beanManager); return retVal; } With that configuration, when I run my application and I use my RPC Service that gets all of Users, I obtain a lazy initialization exception from Hibernate from Users.roles. I am disappointed because I thought that Gilead would let me to serialize my domain entities even if these entities contained PersistentBag. It's not one of the goals of Gilead ? So, someone would know how to configure Gilead (with GwtRpcSpring or other solution) to be able to transfer domain entities without Lazy exception ? Thanks by advance for your help. Sylvain

    Read the article

  • How to turn this linq query to lazy loading

    - by Luke101
    I would like to make a certain select item to lazy load latter in my linq query. Here is my query var posts = from p in context.post where p.post_isdeleted == false && p.post_parentid == null select new { p.post_date, p.post_id, p.post_titleslug, p.post_votecount, FavoriteCount = context.PostVotes.Where(x => x.PostVote_postid == p.post_id).Count() //this should load latter }; I have deleted the FavoriteCount item in the select query and would like it to ba added later based on certain conditions. Here is the way I have it lazy loaded if (GetFavoriteInfo) { posts = posts.Select(x => new { FavoriteCount = context.PostVotes.Where(y => y.PostVote_postid == x.post_id).Count() }); } I am getting a syntax error with this the above query. How do I fix this

    Read the article

  • visualising piano performance evaluation

    - by Dolphin
    I need to develop a performance evaluator for piano playing. Based on a midi generated from sheet music, I need to evaluate the midi of the actual playing (midi keyboard). I'm planning to evaluate the playing based on note pitch, duration and loudness. The evaluation is I suppose a comparison of the notes of the sheet music and playing in midi. But I have no idea how I can visualise (i.e. show where the person have gone wrong) this evaluation process. i.e. maybe show both the notation and highlight which note has gone wrong. But how can I show any of this in some graphical form? Or more precisely on a stave (a music score) itself. I have note details (pitch, duration) and score details (key and time signature) stored in a table, and I'm using Java. But I have no clue as in how I can put all this into graphical form. Any insight is most gratefully appreciated. Advance thanks

    Read the article

  • Showplan Operator of the Week - Lazy Spool

    Continuing to illuminate the depths of SQL Server's Query Optimizer, Fabiano shines a light on the sixth major Showplan Operator on his list: the Lazy Spool. What does the Lazy Spool do that's so special, how does the Query Optimizer use it, and why is it so Lazy? Fabiano explains all...

    Read the article

  • NHibernate, Databinding to DataGridView, Lazy Loading, and Session managment - need advice

    - by Tom Bushell
    My main application form (WinForms) has a DataGridView, that uses DataBinding and Fluent NHibernate to display data from a SQLite database. This form is open for the entire time the application is running. For performance reasons, I set the convention DefaultLazy.Always() for all DB access. So far, the only way I've found to make this work is to keep a Session (let's call it MainSession) open all the time for the main form, so NHibernate can lazy load new data as the user navigates with the grid. Another part of the application can run in the background, and Save to the DB. Currently, (after considerable struggle), my approach is to call MainSession.Disconnect(), create a disposable Session for each Save, and MainSession.Reconnect() after finishing the Save. Otherwise SQLite will throw "The database file is locked" exceptions. This seems to be working well so far, but past experience has made me nervous about keeping a session open for a long time (I ran into performance problems when I tried to use a single session for both Saves and Loads - the cache filled up, and bogged down everything - see http://stackoverflow.com/questions/2526675/commit-is-very-slow-in-my-nhibernate-sqlite-project). So, my question - is this a good approach, or am I looking at problems down the road? If it's a bad approach, what are the alternatives? I've considered opening and closing my main session whenever the user navigates with the grid, but it's not obvious to me how I would do that - hook every event from the grid that could possibly cause a lazy load? I have the nagging feeling that trying to manage my own sessions this way is fundamentally the wrong approach, but it's not obvious what the right one is.

    Read the article

  • Lazy-loading with Spring HibernateDaoSupport ?

    - by umanga
    Greetings I am developing a non-webapplication using Spring+Hibernate. My question is how the HibernateDaoSupport handles lazy-loading , because after a call do DAO , the Session is closed. Take a look at following psuedo-code: DAO is like: CommonDao extends HibernateDaoSupport{ Family getFamilyById(String id); SubFamily getSubFamily(String familyid,String subfamilyid); } Domain model is like: Family{ private List<SubFamily> subfamiles; public List<SubFamily> getSubFamiles(); } SubFamily{ private Family family; public Family getFamily(); } In the application I get DAO from app-context and want to following operations.Is this possible to do with lazy-loading because AFAIK after every method (getFamilyById() , getSubFamily() ) the session is closed. CommonDAO dao=//get bean from application context; Family famA=dao.getFamilyById(familyid); // //Do some stuff List<SubFamily> childrenA=fam.getSubFamiles(); SubFamily asubfamily=dao.getSubFamily(id,subfamilyid); // //Do some other stuff Family famB=asubfamily.getFamily();

    Read the article

  • Lazy Loading Association and Casting

    - by Zuber
    I am using NHibernate 2.0.1 and .NET I am facing issues with Lazy loading an association I have a BusinessObject class that has associations to other BusinessObject in it, and it can go deeper. The following function is in the BusinessObject to read the values of a collection in the BusinessObject. public virtual object GetFieldValue(string fieldName) { var fieldItems = fieldName.Split(AppConstants.DotChar); var objectToRead = this; for (var i = 0; i < fieldItems.Length - 1; i++) { objectToRead = (BusinessObject) objectToRead.GetFieldValue(fieldItems[i]); } //if (objectToRead._data == null) return objectToRead.SystemId + " Error: _data was null"; return objectToRead.FieldValue(fieldName.LastItem()); } The FieldValue function is described below private object FieldValue(string fieldName) { return _data.Contains(fieldName) ? _data[fieldName] : null; } The BusinessObject has a dictionary_data which stores the field values. Assume the fieldName is BusinessDriver.Description and the BusinessObject which has this field is StrategyBusinessDriver This code breaks down the field name into two - BusinessDriver & Description. The first iteration reads the BusinessDriver object from StrategyBusinessDriver. It is cast into a BusinessObject type so that I can call the GetFieldValue again on it to read the next field i.e Description in the BusinessDriver. The problem is that when I read the BusinessDriver in the first iteration and cast it, I get the Ids and all other details of the BusinessObject but the field dictionary _data and other collections are not fetched. This should be fetched lazily when I read the _data of the BusinessObject. However, this does not happen and I get an error that _data is null. Is there something wrongly coded because of which the collection is not fetched lazily? Please ask for more clarifications if needed. Thanks in advance. UPDATE: It works when I don't do Lazy load.

    Read the article

  • Methods for Lazy Initialization with properties

    - by Stuart Pegg
    I'm currently altering a widely used class to move as much of the expensive initialization from the class constructor into Lazy Initialized properties. Below is an example (in c#): Before: public class ClassA { public readonly ClassB B; public void ClassA() { B = new ClassB(); } } After: public class ClassA { private ClassB _b; public ClassB B { get { if (_b == null) { _b = new ClassB(); } return _b; } } } There are a fair few more of these properties in the class I'm altering, and some are not used in certain contexts (hence the Laziness), but if they are used they're likely to be called repeatedly. Unfortunately, the properties are often also used inside the class. This means there is a potential for the private variable (_b) to be used directly by a method without it being initialized. Is there a way to make only the public property (B) available inside the class, or even an alternative method with the same initialized-when-needed? This is reposted from Programmers (not subjective enough apparently): http://programmers.stackexchange.com/questions/34270/best-methods-for-lazy-initialization-with-properties

    Read the article

  • NHibernate unintential lazy property loading

    - by chiccodoro
    I introduced a mapping for a business object which has (among others) a property called "Name": public class Foo : BusinessObjectBase { ... public virtual string Name { get; set; } } For some reason, when I fetch "Foo" objects, NHibernate seems to apply lazy property loading (for simple properties, not associations): The following code piece generates n+1 SQL statements, whereof the first only fetches the ids, and the remaining n fetch the Name for each record: ISession session = ...IQuery query = session.CreateQuery(queryString); ITransaction tx = session.BeginTransaction(); List<Foo> result = new List<Foo>(); foreach (Foo foo in query.Enumerable()) { result.Add(foo); } tx.Commit(); session.Close(); produces: NHibernate: select foo0_.FOO_ID as col_0_0_ from V1_FOO foo0_ NHibernate: SELECT foo0_.FOO_ID as FOO1_2_0_, foo0_.NAME as NAME2_0_ FROM V1_FOO foo0_ WHERE foo0_.FOO_ID=:p0;:p0 = 81 NHibernate: SELECT foo0_.FOO_ID as FOO1_2_0_, foo0_.NAME as NAME2_0_ FROM V1_FOO foo0_ WHERE foo0_.FOO_ID=:p0;:p0 = 36470 NHibernate: SELECT foo0_.FOO_ID as FOO1_2_0_, foo0_.NAME as NAME2_0_ FROM V1_FOO foo0_ WHERE foo0_.FOO_ID=:p0;:p0 = 36473 Similarly, the following code leads to a LazyLoadingException after session is closed: ISession session = ... ITransaction tx = session.BeginTransaction(); Foo result = session.Load<Foo>(id); tx.Commit(); session.Close(); Console.WriteLine(result.Name); Following this post, "lazy properties ... is rarely an important feature to enable ... (and) in Hibernate 3, is disabled by default." So what am I doing wrong? I managed to work around the LazyLoadingException by doing a NHibernateUtil.Initialize(foo) but the even worse part are the n+1 sql statements which bring my application to its knees. This is how the mapping looks like: <class name="Foo" table="V1_FOO"> ... <property name="Name" column="NAME"/> </class> BTW: The abstract "BusinessObjectBase" base class encapsulates the ID property which serves as the internal identifier.

    Read the article

  • Lazy Evaluation in Bash

    - by User1
    Is there more elegant way of doing lazy evaluation than the following: pattern='$x and $y' x=1 y=2 eval "echo $pattern" results: 1 and 2 It works but eval "echo ..." just feels sloppy and may be insecure in some way. Is there a better way to do this in Bash?

    Read the article

  • When is lazy evaluation not useful?

    - by Cherian
    Delay execution is almost always a boon. But then there are cases when it’s a problem and you resort to “fetch” (in Nhibernate) to eager fetch it. Do you know practical situations when lazy evaluation can bite you back…?

    Read the article

  • Project Performance Evaluation and Finding Weak Areas

    - by pramodc84
    I'm working in J2EE web project, which has lots of Java, SQL scripts, JS, AJAX stuff. Its been 5 years for project still running fine. I have assigned with work of performance evaluation on the project as there might be some memory usage issues, DB fetching logic delays and other similar weak performance areas. From where should I begin? Any best practices to make project better?

    Read the article

  • Where are the clever uses of strict evaluation?

    - by devonrt
    It seems like there are plenty of examples of clever things being done in a lazily-evaluated language that can't be done in an environment with strict evaluation. For example infinite lists in Haskell or replacing every element in a tree with the tree's minimum value in one pass. Are there any examples of clever things being done in a strictly-evaluated language that can't easily be done in a lazily-evaluated language?

    Read the article

  • Lazy/deferred loading of a CollectionViewSource?

    - by Shimmy
    When you create a CollectionViewSource in the Resources section, is the set Source loaded when the resources are initalized (i.e. when the Resources holder is inited) or when data is bound? Is there a xamly way to make a CollectionViewSource lazy-load? deferred-load? explicit-load?

    Read the article

  • implement lazy loading in gwt for bigger widgets

    - by wingdings
    how do i implement lazy loading in gwt just like the one they have in http://www.smartclient.com/smartgwt/showcase/ and so i would like the whole page to be loaded first and and after that i want all widgets to load iv tried Gwt.runasync but it aint doing much also i tried using Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { loadWidgets(); } }); void loadWidgets() { hugeWidgets=load_some_huge_widgets(); RootLayoutPanel rp = RootLayoutPanel.get(); rp.add(hugeWidgets); }

    Read the article

  • NHibernate unintentional lazy property loading

    - by chiccodoro
    I introduced a mapping for a business object which has (among others) a property called "Name": public class Foo : BusinessObjectBase { ... public virtual string Name { get; set; } } For some reason, when I fetch "Foo" objects, NHibernate seems to apply lazy property loading (for simple properties, not associations): The following code piece generates n+1 SQL statements, whereof the first only fetches the ids, and the remaining n fetch the Name for each record: ISession session = ...IQuery query = session.CreateQuery(queryString); ITransaction tx = session.BeginTransaction(); List<Foo> result = new List<Foo>(); foreach (Foo foo in query.Enumerable()) { result.Add(foo); } tx.Commit(); session.Close(); produces: NHibernate: select foo0_.FOO_ID as col_0_0_ from V1_FOO foo0_<br/> NHibernate: SELECT foo0_.FOO_ID as FOO1_2_0_, foo0_.NAME as NAME2_0_ FROM V1_FOO foo0_ WHERE foo0_.FOO_ID=:p0;:p0 = 81<br/> NHibernate: SELECT foo0_.FOO_ID as FOO1_2_0_, foo0_.NAME as NAME2_0_ FROM V1_FOO foo0_ WHERE foo0_.FOO_ID=:p0;:p0 = 36470<br/> NHibernate: SELECT foo0_.FOO_ID as FOO1_2_0_, foo0_.NAME as NAME2_0_ FROM V1_FOO foo0_ WHERE foo0_.FOO_ID=:p0;:p0 = 36473 Similarly, the following code leads to a LazyLoadingException after session is closed: ISession session = ... ITransaction tx = session.BeginTransaction(); Foo result = session.Load<Foo>(id); tx.Commit(); session.Close(); Console.WriteLine(result.Name); Following this post, "lazy properties ... is rarely an important feature to enable ... (and) in Hibernate 3, is disabled by default." So what am I doing wrong? I managed to work around the LazyLoadingException by doing a NHibernateUtil.Initialize(foo) but the even worse part are the n+1 sql statements which bring my application to its knees. This is how the mapping looks like: <class name="Foo" table="V1_FOO"> ... <property name="Name" column="NAME"/> </class> BTW: The abstract "BusinessObjectBase" base class encapsulates the ID property which serves as the internal identifier.

    Read the article

  • How significant are JPA lazy loading performance benefits?

    - by Robert
    I understand that this is highly specific to the concrete application, but I'm just wondering what's the general opinion, or at least some personal experiences on the issue. I have an aversion towards the 'open session in view' pattern, so to avoid it, I'm thinking about simply fetching everything small eagerly, and using queries in the service layer to fetch larger stuff. Has anyone used this and regretted it? And is there maybe some elegant solution to lazy loading in the view layer that I'm not aware of?

    Read the article

  • Hibernate Lazy Loading Proxy Incompatable w/ Other Frameworks

    - by bowsie
    I've come across several instances where frameworks that take POJOs to do some work crap-out with proxied hibernate beans. For example if I xml annotate a bean for framework X and pass it to framework X it doesn't recognise the bean because it is passed the proxied object - which has no annotations for framework X. Is there a common solution to this? I'd prefer not to define the bean as eager loaded, or turn of lazy-loading anywhere in the application. Thoughts? Thanks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >