Search Results

Search found 1151 results on 47 pages for 'lazy'.

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

  • Does a lazy-programmer file auto-generator tags exist?

    - by Anthony Forloney
    I was wondering (if possible) if there was a program/tool/utility that when I create a new file and provide it with an extension that it creates the tags automatically? For example, a new file I create called index.php would have the appropriate tags auto-generated inside: <?php ?> I hope you get the idea. Does one, or could one, exist, preferably Windows based? Any information regarding this would be helpful.

    Read the article

  • Does a lazy-programmer "document template" with tags exist for Windows?

    - by Anthony Forloney
    I was wondering (if possible) if there was a program/tool/utility that when I create a new file and provide it with an extension that it creates the tags automatically? For example, a new file I create called index.php would have the appropriate tags auto-generated inside: <?php ?> I hope you get the idea. Does one, or could one, exist, preferably Windows based? Any information regarding this would be helpful.

    Read the article

  • Altering lazy-loaded object's private variables

    - by Kevin Pang
    I'm running into an issue with private setters when using NHibernate and lazy-loading. Let's say I have a class that looks like this: public class User { public int Foo {get; private set;} public IList<User> Friends {get; set;} public void SetFirstFriendsFoo() { // This line works in a unit test but does nothing during a live run with // a lazy-loaded Friends list Users(0).Foo = 1; } } The SetFirstFriendsFoo call works perfectly inside a unit test (as it should since objects of the same type can access each others private properties). However, when running live with a lazy-loaded Friends list, the SetFirstFriendsFoo call silently fails. I'm guessing the reason for this is because at run-time, the Users(0).Foo object is no longer of type User, but of a proxy class that inherits from User since the Friends list was lazy-loaded. My question is this: shouldn't this generate a run-time exception? You get compile-time exceptions if you try to access another class's private properties, but when you run into a situation like this is looks like the app just ignores you and continues along its way.

    Read the article

  • Is Subversion's 'Lazy Copy' still lazy when overwriting a previously deleted file?

    - by JW
    Is Subversion's 'Lazy Copy' still lazy when overwriting a previously deleted file? I store my externals in a separate folder for each version: i.e say for dojo I'd have: webroot\ scripts\ dojo-v-1.0.0\ dojo-v-1.1.0\ etc. By doing this, for me at least, I feel it makes it easier to switch over to a new version. By only adding each new version i am not really giving svn the history it needs to do lazy copies. So one tactic I have used is to svn copy over the old version over to where the new one will be then svn delete that whole folder then unpack my newer version into that place then svn add them The idea is to avoid having a massive amount of duplicated data in my repo. I hope svn is looking at the new files and saying, "hey, i already had this once, copied, then deleted...so i am only going to be lazy store the changes". That was my theory - but does that happen in practice? p.s. Yes I know an alternative is to set the 'externals properties on the folder' - but that's another question.

    Read the article

  • Rebuilding lazily-built attribute when an underlying attribute changes in Moose

    - by friedo
    I've got a Moose class with a lazy_build attribute. The value of that attribute is a function of another (non-lazy) attribute. Suppose somebody instantiates the class with a value of 42 for the required attribute. Then they request the lazy attribute, which is calculated as a function of 42. Then, they have the nerve to change the first attribute! The lazy one has already been built, so the builder will not get called again, and the lazy attribute is now out-of-date. I have a solution now where I maintain a "dirty" flag on the required attribute, and an accessor on the lazy one checks the dirty flag and rebuilds it if needed. However, this seems like a lot of work. Is there a way to handle this within Moose, e.g. using traits?

    Read the article

  • Lazy loading in Hibernate

    - by Steve
    My Java Web application uses Hibernate to perform ORM. In some of my objects, I use lazy loading to avoid getting data until I absolutely need it. The problem is that I load the initial object in a session, and then that session is destroyed. When I later attempt to resolve the lazy-loaded collections in my object I get the following error: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: common.model.impl.User.groups, no session or session was closed I tried associating a new session with the collection and then resolving, but this gives the same results. Does anyone know how I can resolve the lazy collections once the original session is gone? Thanks... --Steve

    Read the article

  • Castle ActiveRecord: session error search and access to lazy loading property in different threads

    - by sc911
    Hi *, I've got a problem with an multi-threaded desktop application using Castle ActiveRecord in C#: To keep the GUI alive while searching for the objects based on userinput I'm using the BackgroundWorker for the search-function. Some of the properties of the objects, especially some HasMany-Relations, are marked as Lazy. Now, when the search is finished and the user selects an resulting object, some of the properties of this object should be displayed. But as the search was done by the BackgroundWorker in a different thread, accessing the properties fails as the session for the lazy-access is no longer available. What will be the best way to do the search in an extra thread to keep the GUI alive and to access all properties correctly including those marked as lazy? Thanks for any advise! Regards sc911

    Read the article

  • Lazy sequence or recur for mathematical power function?

    - by StackedCrooked
    As an exercise I implemented the mathematical power function. Once using recur: (defn power [a n] (let [multiply (fn [x factor i] (if (zero? i) x (recur (* x factor) factor (dec i))))] (multiply a a (dec n)))) And once with lazy-seq: (defn power [a n] (letfn [(multiply [a factor] (lazy-seq (cons a (multiply (* a factor) factor))))] (nth (multiply a a) (dec n)))) Which implementation do you think is superior? I truly have no idea.. (I'd use recur because it's easier to understand.) I read that lazy-seq is fast because is uses internal caching. But I don't see any opportunities for caching in my sample. Am I overlooking something?

    Read the article

  • Spring, Hibernate, Blob lazy loading

    - by Alexey Khudyakov
    Dear Sirs, I need help with lazy blob loading in Hibernate. I have in my web application these servers and frameworks: MySQL, Tomcat, Spring and Hibernate. The part of database config. <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="user" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="driverClass" value="${jdbc.driverClassName}"/> <property name="jdbcUrl" value="${jdbc.url}"/> <property name="initialPoolSize"> <value>${jdbc.initialPoolSize}</value> </property> <property name="minPoolSize"> <value>${jdbc.minPoolSize}</value> </property> <property name="maxPoolSize"> <value>${jdbc.maxPoolSize}</value> </property> <property name="acquireRetryAttempts"> <value>${jdbc.acquireRetryAttempts}</value> </property> <property name="acquireIncrement"> <value>${jdbc.acquireIncrement}</value> </property> <property name="idleConnectionTestPeriod"> <value>${jdbc.idleConnectionTestPeriod}</value> </property> <property name="maxIdleTime"> <value>${jdbc.maxIdleTime}</value> </property> <property name="maxConnectionAge"> <value>${jdbc.maxConnectionAge}</value> </property> <property name="preferredTestQuery"> <value>${jdbc.preferredTestQuery}</value> </property> <property name="testConnectionOnCheckin"> <value>${jdbc.testConnectionOnCheckin}</value> </property> </bean> <bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" /> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="/WEB-INF/hibernate.cfg.xml" /> <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" /> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> </props> </property> <property name="lobHandler" ref="lobHandler" /> </bean> <tx:annotation-driven transaction-manager="txManager" /> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> The part of entity class @Lob @Basic(fetch=FetchType.LAZY) @Column(name = "BlobField", columnDefinition = "LONGBLOB") @Type(type = "org.springframework.orm.hibernate3.support.BlobByteArrayType") private byte[] blobField; The problem description. I'm trying to display on a web page database records related to files, which was saved in MySQL database. All works fine if a volume of data is small. But the volume of data is big I'm recieving an error "java.lang.OutOfMemoryError: Java heap space" I've tried to write in blobFields null values on each row of table. In this case, application works fine, memory doesn't go out of. I have a conclusion that the blob field which is marked as lazy (@Basic(fetch=FetchType.LAZY)) isn't lazy, actually! How can I solve the issie? Many thanks for advance.

    Read the article

  • Lazy Loading with Ninject

    - by devlife
    I'm evaluating ninject2 but can't seem to figure out how to do lazy loading other than through the kernel. From what I can see that kind of defeats the purpose of using the [Inject] attributes. Is it possible to use the InjectAttribute but get lazy loading? I'd hate to force complete construction of an object graph every time I instantiated an object.

    Read the article

  • Lazy Loading wpf Combobox items

    - by Chris McGrath
    I have an IEnumerable< which lazy loads it's data. I want to just set a Combobox's ItemsSource to the IEnumerable, but when I do it goes and loads all the data anyway (which removes the point of lazy loading). I've tried it with Linq-To-Sql as well since it seems to be a similar theory and it also loads all the data. Is there an easy way to do this?

    Read the article

  • Lazy loading the addthis script? (or lazy loading external js content dependent on already fired eve

    - by Keith Bentrup
    I want to have the addthis widget available for my users, but I want to lazy load it so that my page loads as quickly as possible. However, after trying it via a script tag and then via my lazy loading method, it appears to only work via the script tag. In the obfuscated code, I see something that looks like it's dependent on the DOMContentLoaded event (at least for firefox). Since the DOMContentLoaded event has already fired, the widget doesn't render properly. What to do? I could just use a script tag (slower)... or could I fire (in a cross browser way) the DOMContentLoaded (or equivalent) event? I have a feeling this may not be possible b/c I believe that (like jQuery) there are multiple tests of the content ready event, and so multiple simulated events would have to occur. Nonetheless, this is an interesting problem b/c I have seen a couple widgets now assume that you are including their stuff via static script tags. It would be nice if they wrote code that was more useful to developers concerned about speed, but until then, is there a work around?? And/or are any of my assumptions wrong? Edit: Because the 1st answer to the question seemed to miss the point of my problem, I wanted to clarify the situation. This is about a specific problem. I'm not looking for yet another lazy load script or check if some dependencies are loaded script. Specifically this problem deals with external widgets that you do not have control over and may or may not be obfuscated delaying the load of the external widgets until they are needed or at least, til substantially after everything else has been loaded including other deferred elements b/c of the how the widget was written, precludes existing, typical lazy loading paradigms While it's esoteric, I have seen it happen with a couple widgets - where the widget developers assume that you're just willing to throw in another script tag at the bottom of the page. I'm looking to save those 500-1000 ms** though as numerous studies by yahoo, google, and amazon show it to be important to your user's experience. **My testing with hammerhead and personal experience indicates that this will be my savings in this case.

    Read the article

  • NHibernate FetchMode.Lazy

    - by RyanFetz
    I have an object which has a property on it that has then has collections which i would like to not load in a couple situations. 98% of the time i want those collections fetched but in the one instance i do not. Here is the code I have... Why does it not set the fetch mode on the properties collections? [DataContract(Name = "ThemingJob", Namespace = "")] [Serializable] public class ThemingJob : ServiceJob { [DataMember] public virtual Query Query { get; set; } [DataMember] public string Results { get; set; } } [DataContract(Name = "Query", Namespace = "")] [Serializable] public class Query : LookupEntity<Query>, DAC.US.Search.Models.IQueryEntity { [DataMember] public string QueryResult { get; set; } private IList<Asset> _Assets = new List<Asset>(); [IgnoreDataMember] [System.Xml.Serialization.XmlIgnore] public IList<Asset> Assets { get { return _Assets; } set { _Assets = value; } } private IList<Theme> _Themes = new List<Theme>(); [IgnoreDataMember] [System.Xml.Serialization.XmlIgnore] public IList<Theme> Themes { get { return _Themes; } set { _Themes = value; } } private IList<Affinity> _Affinity = new List<Affinity>(); [IgnoreDataMember] [System.Xml.Serialization.XmlIgnore] public IList<Affinity> Affinity { get { return _Affinity; } set { _Affinity = value; } } private IList<Word> _Words = new List<Word>(); [IgnoreDataMember] [System.Xml.Serialization.XmlIgnore] public IList<Word> Words { get { return _Words; } set { _Words = value; } } } using (global::NHibernate.ISession session = NHibernateApplication.GetCurrentSession()) { global::NHibernate.ICriteria criteria = session.CreateCriteria(typeof(ThemingJob)); global::NHibernate.ICriteria countCriteria = session.CreateCriteria(typeof(ThemingJob)); criteria.AddOrder(global::NHibernate.Criterion.Order.Desc("Id")); var qc = criteria.CreateCriteria("Query"); qc.SetFetchMode("Assets", global::NHibernate.FetchMode.Lazy); qc.SetFetchMode("Themes", global::NHibernate.FetchMode.Lazy); qc.SetFetchMode("Affinity", global::NHibernate.FetchMode.Lazy); qc.SetFetchMode("Words", global::NHibernate.FetchMode.Lazy); pageIndex = Convert.ToInt32(pageIndex) - 1; // convert to 0 based paging index criteria.SetMaxResults(pageSize); criteria.SetFirstResult(pageIndex * pageSize); countCriteria.SetProjection(global::NHibernate.Criterion.Projections.RowCount()); int totalRecords = (int)countCriteria.List()[0]; return criteria.List<ThemingJob>().ToPagedList<ThemingJob>(pageIndex, pageSize, totalRecords); }

    Read the article

  • Why Stream/lazy val implementation using is faster than ListBuffer one

    - by anrizal
    I coded the following implementation of lazy sieve algorithms using Stream and lazy val below : def primes(): Stream[Int] = { lazy val ps = 2 #:: sieve(3) def sieve(p: Int): Stream[Int] = { p #:: sieve( Stream.from(p + 2, 2). find(i=> ps.takeWhile(j => j * j <= i). forall(i % _ > 0)).get) } ps } and the following implementation using (mutable) ListBuffer: import scala.collection.mutable.ListBuffer def primes(): Stream[Int] = { def sieve(p: Int, ps: ListBuffer[Int]): Stream[Int] = { p #:: { val nextprime = Stream.from(p + 2, 2). find(i=> ps.takeWhile(j => j * j <= i). forall(i % _ > 0)).get sieve(nextprime, ps += nextprime) } } sieve(3, ListBuffer(3))} When I did primes().takeWhile(_ < 1000000).size , the first implementation is 3 times faster than the second one. What's the explanation for this ? I edited the second version: it should have been sieve(3, ListBuffer(3)) instead of sieve(3, ListBuffer()) .

    Read the article

  • Strange lazy load problem

    - by JooLio
    public class QuickQuoteTemplate { ... public virtual IList<QuickQuoteTemplateItem> InnerItems { get; set; } ... } public class QuickQuoteTemplateItem { ... public virtual IList<QuickQuoteTemplateItem> InnerItems { get; set; } ... } <class name="QuickQuoteTemplate" table="SA_QUICK_QUOTE_TEMPLATE"> ... <bag name="InnerItems" lazy="false" inverse="true" cascade="delete" > <key column="PARENT_QQ_TEMPLATE_ID" ></key> <one-to-many class="QuickQuoteTemplateItem" /> </bag> ... </class> <class name="QuickQuoteTemplateItem" table="SA_QUICK_QUOTE_TEMPLATE_ITEMS"> ... <bag name="InnerItems" lazy="false" inverse="false" cascade="delete"> <key column="PARENT_ITEM_ID" /> <one-to-many class="QuickQuoteTemplateItem" /> </bag> ... </class> InnerItems collections is set as no lazy, but after disposing the ISession instance, quickQuote.InnerItems is crying "failed to lazily initialize a collection, no session or session was closed". I've even tried to call InnerItems before the session is closed by myself. It successfully retrieves, but after disposing of the session it becomes not initialized.

    Read the article

  • Avoiding NPE in trait initialization without using lazy vals

    - by 0__
    This is probably covered by the blog entry by Jesse Eichar—still I can't figure out how to correct the following without residing to lazy vals so that the NPE is fixed: Given trait FooLike { def foo: String } case class Foo( foo: String ) extends FooLike trait Sys { type D <: FooLike def bar: D } trait Confluent extends Sys { type D = Foo } trait Mixin extends Sys { val global = bar.foo } First attempt: class System1 extends Mixin with Confluent { val bar = Foo( "npe" ) } new System1 // boom!! Second attempt, changing mixin order class System2 extends Confluent with Mixin { val bar = Foo( "npe" ) } new System2 // boom!! Now I use both bar and global very heavily, and therefore I don't want to pay a lazy-val tax just because Scala (2.9.2) doesn't get the initialisation right. What to do?

    Read the article

  • NHibernate WCF Bidirectional and Lazy loading

    - by ChrisKolenko
    Hi everyone, I'm just looking for some direction when it comes to NHibernate and WCF. At the moment i have a many to one association between a person and address. The first problem. I have to eager load the list of addresses so it doesn't generate a lazy loaded proxy. Is there a way to disable lazy loading completely? I never want to see it generated. The second problem. The bidirectional association between my poco's is killing my standard serialization. What's the best way forward. Should I remove the Thanks for all your help

    Read the article

  • Why does this static field always get initialized over-eagerly?

    - by TheSilverBullet
    I am looking at this excellent article from Jon Skeet. While executing the demo code, Jon Skeet says that we can expect three different kinds of behaviours. To quote that article: The runtime could decide to run the type initializer on loading the assembly to start with... Or perhaps it will run it when the static method is first run... Or even wait until the field is first accessed... When I try this out (on framework 4), I always get the first result. That is, the static method is initialized before the assembly is loaded. I have tried running this multiple times and get the same result. (I tried both the debug and release versions) Why is this so? Am I missing something?

    Read the article

  • C#4: Why does this static field always get initialized over-eagerly?

    - by TheSilverBullet
    I am looking at this excellent article from Jon Skeet at this location: http://csharpindepth.com/Articles/General/Beforefieldinit.aspx While executing the demo code, Jon Skeet says that we can expect three different kinds of behaviours. To quote that article: The runtime could decide to run the type initializer on loading the assembly to start with... Or perhaps it will run it when the static method is first run... Or even wait until the field is first accessed... When I try this out (on framework 4), I always get the first result. That is, the static method is initialized before the assembly is loaded. I have tried running this multiple times and get the same result. (I tried both the debug and release versions) Why is this so? Am I missing something?

    Read the article

  • EJB3 Entity and Lazy Problem

    - by Stefano
    My Entity beAN have 2 list: @Entity @Table(name = "TABLE_INTERNAL") public class Internal implements java.io.Serializable { ...SOME GETTERS AND SETTERS... private List<Match> matchs; private List<Regional> regionals; } mapped one FetchType.LAZY and one FetchType.EAGER : @OneToMany(fetch = FetchType.LAZY,mappedBy = "internal") public List<Match> getMatchs() { return matchs; } public void setMatchs(List<Match> matchs) { this.matchs = matchs; } @ManyToMany(targetEntity = Regional.class, mappedBy = "internals", fetch =FetchType.EAGER) public List<Regional> getRegionals() { return regionals; } public void setRegionals(List<Regional> regionals) { this.regionals = regionals; } I need both lists full ! But I cant put two FetchType.EAGER beacuse it's an error. I try some test: List<Internal> out; out= em.createQuery("from Internal").getResultList(); out= em.createQuery("from Internal i JOIN FETCH i.regionals ").getResultList(); I'm not able to fill both lists...Help!!! Stefano

    Read the article

  • Lazy non-modifiable list in Google Collections

    - by mindas
    I was looking for a decent implementation of a generic lazy non-modifiable list implementation to wrap my search result entries. The unmodifiable part of the task is easy as it can be achieved by Collections.unmodifiableList() so I only need to sort out the the lazy part. Surprisingly, google-collections doesn't have anything to offer; while LazyList from Apache Commons Collections does not support generics. I have found an attempt to build something on top of google-collections but it seems to be incomplete (e.g. does not support size()), outdated (does not compile with 1.0 final) and requiring some external classes, but could be used as a good starting point to build my own class. Is anybody aware of any good implementation of a LazyList? If not, which option do you think is better: write my own implementation, based on google-collections ForwardingList, similar to what Peter Maas did; write my own wrapper around Commons Collections LazyList (the wrapper would only add generics so I don't have to cast everywhere but only in the wrapper itself); just write something on top of java.util.AbstractList; Any other suggestions are welcome.

    Read the article

  • Help me understand entity framework 4 caching for lazy loading

    - by Chris
    I am getting some unexpected behaviour with entity framework 4.0 and I am hoping someone can help me understand this. I am using the northwind database for the purposes of this question. I am also using the default code generator (not poco or self tracking). I am expecting that anytime I query the context for the framework to only make a round trip if I have not already fetched those objects. I do get this behaviour if I turn off lazy loading. Currently in my application I am breifly turning on lazy loading and then turning it back off so I can get the desired behaviour. That pretty much sucks, so please help. Here is a good code example that can demonstrate my problem. Public Sub ManyRoundTrips() context.ContextOptions.LazyLoadingEnabled = True Dim employees As List(Of Employee) = context.Employees.Execute(System.Data.Objects.MergeOption.AppendOnly).ToList() 'makes unnessesary round trip to the database, I just loaded the employees' MessageBox.Show(context.Employees.Where(Function(x) x.EmployeeID < 10).ToList().Count) context.Orders.Execute(System.Data.Objects.MergeOption.AppendOnly) For Each emp As Employee In employees 'makes unnessesary trip to database every time despite orders being pre loaded.' Dim i As Integer = emp.Orders.Count Next End Sub Public Sub OneRoundTrip() context.ContextOptions.LazyLoadingEnabled = True Dim employees As List(Of Employee) = context.Employees.Include("Orders").Execute(System.Data.Objects.MergeOption.AppendOnly).ToList() MessageBox.Show(employees.Where(Function(x) x.EmployeeID < 10).ToList().Count) For Each emp As Employee In employees Dim i As Integer = emp.Orders.Count Next End Sub Why is the first block of code making unnessesary round trips?

    Read the article

  • Lazy non-modifiable list

    - by mindas
    I was looking for a decent implementation of a generic lazy non-modifiable list implementation to wrap my search result entries. The unmodifiable part of the task is easy as it can be achieved by Collections.unmodifiableList() so I only need to sort out the the lazy part. Surprisingly, google-collections doesn't have anything to offer; while LazyList from Apache Commons Collections does not support generics. I have found an attempt to build something on top of google-collections but it seems to be incomplete (e.g. does not support size()), outdated (does not compile with 1.0 final) and requiring some external classes, but could be used as a good starting point to build my own class. Is anybody aware of any good implementation of a LazyList? If not, which option do you think is better: write my own implementation, based on google-collections ForwardingList, similar to what Peter Maas did; write my own wrapper around Commons Collections LazyList (the wrapper would only add generics so I don't have to cast everywhere but only in the wrapper itself); just write something on top of java.util.AbstractList; Any other suggestions are welcome.

    Read the article

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