lazy

Is there a spring lazy proxy factory in Spring?

Wicket has this device called a lazy proxy factory. Given: <property name="foo" ref="beanx"/> the idea is to auto-generate a proxy in place of 'beanx', and then only initialize beanx if and when something actually calls a method on it. It seems as if this might be a core Spring capability. Is it there somewhere? ...

Some solid OOP criticism?

Hi! I want to ask you to provide me with some articles (maybe books), which you possibly have found very convincing criticising the OOP methodology. I have read some in the WWW on this topic and I didn't really find a 'definitive demotivator'. It's not much about my personal attitude to the OOP, but I really would like to have somethi...

NHibernate. Initiate save collection at saving parent

Hello, colleagues. I've got a problem at saving my entity. MApping: ?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Clients.Core" namespace="Clients.Core.Domains"> <class name="Sales, Clients.Core" table='sales'> <id name="Id" unsaved-value="0"> ...

How to create an infinite enumerable of Times?

I want to be able to have an object extend Enumerable in Ruby to be an infinite list of Mondays (for example). So it would yield: March 29, April 5, April 12...... etc How can I implement this in Ruby? ...

How to go about reading a web page lazily in Clojure

I and a friend recently implemented link grabbing in my Clojure IRC bot. When it sees a link, it slurp*s the page and grabs the title from the page. The problem is that it has to slurp* the ENTIRE page just to grab the link. How does one go about reading a page lazily until the first </title>? ...

Recommendation for using equals in Entities and avoiding LazyInitializationExceptions?

In the beginning there is a problem that wants to be solved. In my case i got an LazyInitializationException while using indexof in a Collection to retrieve an Object for manipulation. Here i start to think about using equals in EntityBeans (OR-Mapper at all). I know there are some discussions about overriding equals in association with ...

Avoiding secondary selects or joins with Hibernate Criteria or HQL query

I am having trouble optimizing Hibernate queries to avoid performing joins or secondary selects. When a Hibernate query is performed (criteria or hql), such as the following: return getSession().createQuery(("from GiftCard as card where card.recipientNotificationRequested=1").list(); ... and the where clause examines properties that ...

Common Lisp condition system for transfer of control

I'll admit right up front that the following is a pretty terrible description of what I want to do. Apologies in advance. Please ask questions to help me explain. :-) I've written ETLs (Extract, Transform, Load) in other languages that consist of individual operations that look something like: // in class CountOperation IEnumerable<...

How can I make a WPF TreeView data binding lazy and asynchronous?

I am learning how to use data binding in WPF for a TreeView. I am procedurally creating the Binding object, setting Source, Path, and Converter properties to point to my own classes. I can even go as far as setting IsAsync and I can see the GUI update asynchronously when I explore the tree. So far so good! My problem is that WPF eage...

How to write lazy functions which are chainable, in python?

I want to write functions which are lazy as well as chainable. What would be the best way. I know that one way would be to do yield instead of return. I want these functions to be lazy in the way similar to how sqlalchemy functions are lazy when asked to fetch the data from DB. ...

Hibernate: Overriding mapping's EAGER in HQL?

It's possible to override LAZY in HQL using LEFT JOIN FETCH. FROM Obj AS obj LEFT JOIN FETCH obj.otherObj WHERE obj.id = :id Is it also possible to override EAGER? How? ...

MEF Lazy ImportMany with Creationpolicy.NonShared

hi, i'm a beginner in mef and so i have a question :) i have the following: [PartCreationPolicy(CreationPolicy.Shared)] [Export(typeof(SharedExport))] public class SharedExport : INPCBase { [ImportMany(typeof(INonShared),RequiredCreationPolicy = CreationPolicy.NonShared)] private IEnumerable<Lazy<INonShared,Dictionary<string,obj...

What is the most pythonic way to have a generator expression executed?

More and more features of Python move to be "lazy executable", like generator expressions and other kind of iterators. Sometimes, however, I see myself wanting to roll a one liner "for" loop, just to perform some action. What would be the most pythonic thing to get the loop actually executed? For example: a = open("numbers.txt", "w") ...

How do I convert month names to int?

I have a column called Month in a stored proc which returns to me the month in string name terms (eg. January, Febuary, March etc.) I would like to convert that to an integer. Is that possible without just using a number of select case statements? I would like to do this in .NET 3.5 ...

jQuery: looking for lazy loader plugin for css+js with callback

hi, is there a good jquery plugin for lazy loading css+js which also supports callback-when-loaded? i'd like to pass eg. an array of .js and .css files and have a global callback for when anything finished loading. any ideas? thx ...

Pattern for lazy thread-safe singleton instantiation in java

Hello guys, the lazy thread-safe singleton instantion is kinda not easy to understand to every coder, so i wanted to create a class in our enterprise framework that would do the job. What do you think about it? Do you see something bad about it? Is there something similar like in Apache Commons? How can i make it better? Supplier.java...

Can someone point me to a particularly good resource on JPA/Hibernate lazy/eager fetching?

Looking for a really good article that includes strategies/bugs/workarounds. I would prefer a pure JPA solution but I know Hibernate offers a lot of extensions. ...

Memory Warnings from images cause app to crash

I'm implementing the lazy table images algorithm similar to how facebook does. I got this from an example given by apple: http://developer.apple.com/iphone/library/samplecode/LazyTableImages/Introduction/Intro.html It works fine up until I start getting memory warnings. My images are stored in a dictionary, that links up a key to an ima...

Implement lazy drag & drop

I am trying to implement a lazy drag and drop operation. I want to show a listview with files to my user, when the user drags a file and drops it into a folder the content should be downloaded and delivered. I am using the IDataObject interface, but my problem is that the GetData() method is queried way too early. For instance a drag ov...

F# lazy eval from stream reader?

I'm running into a bug in my code that makes me think that I don't really understand some of the details about F# and lazy evaluation. I know that F# evaluates eagerly and therefore am somewhat perplexed by the following function: // Open a file, then read from it. Close the file. return the data. let getStringFromFile = File.Open...