Search Results

Search found 10207 results on 409 pages for 'backbone js collections'.

Page 8/409 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Should I use parameters in template scripting to control the output, or a separate specialized template?

    - by asawyer
    Would it be considered best practice to use a single template that changes it's output based on script values, or have multiple templates, and use the view to pick the correct one instead? For example, in this underscope template: <script type="text/template" id="SkillsetTemplate"> <div class='RegularMode <%= (skillset.get('InEditMode')===false)?'show':'hide' %>'> </div> <div class='EditMode <%= (skillset.get('InEditMode')===true)?'show':'hide' %>'> </div> </script> I use a backbone model to bind against, and use the InEditMode attribute to pick which content to render. Should I instead have a normal mode, and an edit mode template, and use the attribute on the model to pick the template ? For background purposes, I am using backbone.js with underscore templates and an MVC3 backend.

    Read the article

  • dirtyFields with itemview

    - by user1449437
    I have a master/detail application that I'm building with backbone marionette. as the user clicks the master rows, the detail will show the row details. users need to be able to edit the row. I'd like the notify them if they try to 'leave' the row before saving. I was thinking that I'd use the dirtyFields plugin for this functionality. Has anyone else used these together? when I swap out my itemview, how do I initialize the plugin? when I close the view, is there anything I should think about to clean up the view? any thoughts would be appreciated. thx

    Read the article

  • node.js ./configure warnings

    - by microspino
    I'm trying to install node.js and I get this list of warnings when I run ./configer. I don't know which libraries/packages I miss on my Debian installation (Linux 2.6.32.6 ppc GNU/Linux on a Bubba2 sever) Checking for gnutls >= 2.5.0 : fail --- libeio --- Checking for pread(2) and pwrite(2) : fail Checking for sync_file_range(2) : fail --- libev --- Checking for header sys/inotify.h : not found Checking for header port.h : not found Checking for header sys/event.h : not found Checking for function kqueue : not found Checking for header sys/eventfd.h : not found Can you tell me what I need to install?

    Read the article

  • History.js not working in Internet Explorer

    - by Wilcoholic
    I am trying to get history.js to work in Internet Explorer because I need history.pushState() to work. I have read over the instructions on GitHub (https://github.com/balupton/History.js/) and have tried implementing it, but havent had any success. Here's what I have <!DOCTYPE html> <html> <head> <!-- jQuery --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <!-- History.js --> <script defer src="http://balupton.github.com/history.js/scripts/bundled/html4+html5/jquery.history.js"></script> <script type="text/javascript"> function addHistory(){ // Prepare var History = window.History; // Note: We are using a capital H instead of a lower h // Change our States History.pushState(null, null, "?mylink.html"); } </script> </head> <body> <a href="mylink.html">My Link</a> <a href="otherlink.html">Other Link</a> <button onclick="addHistory()" type="button">Add History</button> </body> Not sure what I'm doing wrong, but it's definitely not working in IE. Any help is appreciated

    Read the article

  • ReadOnlyCollection or IEnumerable for exposing member collections?

    - by Erik Öjebo
    Is there any reason to expose an internal collection as a ReadOnlyCollection rather than an IEnumerable if the calling code only iterates over the collection? class Bar { private ICollection<Foo> foos; // Which one is to be preferred? public IEnumerable<Foo> Foos { ... } public ReadOnlyCollection<Foo> Foos { ... } } // Calling code: foreach (var f in bar.Foos) DoSomething(f); As I see it IEnumerable is a subset of the interface of ReadOnlyCollection and it does not allow the user to modify the collection. So if the IEnumberable interface is enough then that is the one to use. Is that a proper way of reasoning about it or am I missing something? Thanks /Erik

    Read the article

  • How to load entities into private collections using the entity framework

    - by Anton P
    I have a POCO domain model which is wired up to the entity framework using the new ObjectContext class. public class Product { private ICollection<Photo> _photos; public Product() { _photos = new Collection<Photo>(); } public int Id { get; set; } public string Name { get; set; } public virtual IEnumerable<Photo> Photos { get { return _photos; } } public void AddPhoto(Photo photo) { //Some biz logic //... _photos.Add(photo); } } In the above example i have set the Photos collection type to IEnumerable as this will make it read only. The only way to add/remove photos is through the public methods. The problem with this is that the Entity Framework cannot load the Photo entities into the IEnumerable collection as it's not of type ICollection. By changing the type to ICollection will allow callers to call the Add mentod on the collection itself which is not good. What are my options? Edit: I could refactor the code so it does not expose a public property for Photos: public class Product { public Product() { Photos = new Collection<Photo>(); } public int Id { get; set; } public string Name { get; set; } private Collection<Photo> Photos {get; set; } public IEnumerable<Photo> GetPhotos() { return Photos; } public void AddPhoto(Photo photo) { //Some biz logic //... Photos.Add(photo); } } And use the GetPhotos() to return the collection. The other problem with the approach is that I will loose the change tracking abilities as I cannot mark the collection as Virtual - It is not possible to mark a property as private virtual. In NHibernate I believe it's possible to map the proxy class to the private collection via configuration. I hope that this will become a feature of EF4. Currently i don't like the inability to have any control over the collection!

    Read the article

  • Generics & Collections!

    - by RayAllen
    I had a doubt. Why,generics (in java or any other lang), works with the objects and not with primitive types ? For e.g Gen< Integer inum=new Gen< Integer(100); works fine , but Gen< int inums=new Gen< int(100); is not allowed. Thanks !

    Read the article

  • Nhibernate , collections and compositeid

    - by Ciaran
    Hi, banging my head here and thought that some one out there might be able to help. Have Tables below. Bucket( bucketId smallint (PK) name varchar(50) ) BucketUser( UserId varchar(10) (PK) bucketId smallint (PK) ) The composite key is not the problem thats ok I know how to get around this but I want my bucket class to contanin a IList of BucketUser. I read the online reference and thought that I had cracked it but havent. The two mappings are below -- bucket -- <id name="BucketId" column="BucketId" type="Int16" unsaved-value="0"> <generator class="native"/> </id> <property column="BucketName" type="String" name="BucketName"/> <bag name="Users" table="BucketUser" inverse="true" generic="true" lazy="true"> <key> <column name="BucketId" sql-type="smallint"/> <column name="UserId" sql-type="varchar"/> </key> <one-to-many class="Bucket,Impact.Dice.Core" not-found="ignore"/> </bag> -- bucketUser --

    Read the article

  • Java Collections and Garbage Collector

    - by Anth0
    A little question regarding performance in a Java web app. Let's assume I have a List<Rubrique> listRubriques with ten Rubrique objects. A Rubrique contains one list of products (List<product> listProducts) and one list of clients (List<Client> listClients). What exactly happens in memory if I do this: listRubriques.clear(); listRubriques = null; My point of view would be that, since listRubriques is empty, all my objects previously referenced by this list (including listProducts and listClients) will be garbage collected pretty soon. But since Collection in Java are a little bit tricky and since I have quite performance issues with my app i'm asking the question :) edit : let's assume now that my Client object contains a List<Client>. Therefore, I have kind of a circular reference between my objects. What would happen then if my listRubrique is set to null? This time, my point of view would be that my Client objects will become "unreachable" and might create a memory leak?

    Read the article

  • Autowiring collections with IoC

    - by Marcus
    Hi, Anyone know if there exists any IoC container that can handle this: Given: ISomeInterfce<T> where T : Entity Impl1 : ISomeInterfce<Entity1> Impl2 : ISomeInterfce<Entity1> Impl3 : ISomeInterfce<Entity2> Impl4 : ISomeInterfce<Entity2> I want to be able to auto wire my system and be able to resolve like this IoC.ResolveAll(typeof(ISomeInterfce<Entity1>)) and get a collection back of all implementations of ISomeInterfce<Entity1>

    Read the article

  • Generics and collections ... struggling with an implementation

    - by mattruma
    I am trying to figure out a way to leverage generics so I can make the property Value be an actual type that initialized (not sure if this is the correct way of saying it) when my collection class is created. I would like to have the syntax be something like: var list = new ListItemCollection<Guid>(parameters would go here); I have the following class: [Serializable] public class ListItem { public object Value { get; set; } public string Text { get; set; } public object DataContext { get; set; } public Nullable<bool> Checked { get; set; } public ListItem() { this.Checked = false; } } I have the following collection: [Serializable] public class ListItemCollection : List<ListItem> { public ListItem this[object value] { get { foreach (var child in this) { if (child.Value.Equals(value)) return child; } return null; } } public bool Contains(object value) { foreach (var child in this) { if (child.Value.Equals(value)) return true; } return false; } public void Add(object value, string text) { this.Add(value, text, null); } public void Add(object value, string text, object dataContext) { var child = new ListItem(); child.Value = value; child.Text = text; child.DataContext = dataContext; this.Add(child); } public ListItemCollection() { } public ListItemCollection(IEnumerable items, string displayMember, string valueMember, bool showEmptyItem, string emptyItemText, object emptyItemValue) { if (showEmptyItem) { this.Add(emptyItemValue, emptyItemText); } foreach (object item in items) { object text = null; object value = null; text = item.GetType().GetProperty(displayMember).GetValue(item, null); value = item.GetType().GetProperty(valueMember).GetValue(item, null); // Add the item this.Add(value, text.ToString(), item); } } }

    Read the article

  • Better type safety in Java collections

    - by Paul Tomblin
    In my java coding, I often end up with several Map<String,Map<String,foo>> or Map<String,List<String>> and then I have trouble remembering which String is which key. I comment the declaration with //Map<capabiltyId,Map<groupId,foo>> or //Map<groupId,List<capabilityId>, but it's not the greatest solution. If String wasn't final, I would make new classes CapabilityId extends String and GroupId extends String, but I can't. Is there a better way to keep track of which thing is the key and maybe have the compiler enforce it?

    Read the article

  • Subsonic, child records, and collections

    - by Dane
    Hi, I've been working with subsonic for a few weeks now, and it is working really well. However, I've just run into an issue with child objects with additional partial properties. Some of it is probably me just not understanding the .Net object lifecycle. I have an object - search. This has a few properties like permissions and stuff, and it links to a child table called search_options. In my Asp.Net app, it loops through these search options and creates controls. Then on postback, it grabs the values and assigns it back to a "value" property on the search_option. This value property is a simple string that's defined in a partial class. I then want to create a method on the search object, called PerformSearch. This then loops through the child search_options, and performs a custom query based on the "value" property. However, even though I assign the "value" property to the child search_option, when I access it later via the search.search_options collection, it is null. I'm guessing that maybe because it's accessing it in two different places, it performs another lazy load from the DB and the value is lost? Is there a way to tell the class that it's already loaded or something? or a way to access it so it's not reloaded from the DB? Code is below (shitty pseudocode, not full version) : ASP.Net page, loading back the values from postback : dim obj_search as search = new subsonic.query.select().......' retrieves the search object for each opt as search_option in obj_search.search_options opt.Value = Ctype(FindControl("search_option_" + opt.search_option_id),Textbox).Text debug.print(opt.Value) ' value is correct next for each opt as search_option in obj_search.search_options debug.print(opt.Value) 'this is nothing next Now, the partial class : public partial class search_option private m_value as string public property Value() as string get return m_value end get set( byval value as string) m_value = value end set end property end class

    Read the article

  • Searching through Collections in Java

    - by Click Upvote
    I have a java properties file containing a key/value pair of country names and codes. I will load the contents of this file into a Collection like List or HashMap. Then, I want users to be able to search for a country, e.g if they type 'Aus' in a textbox and click submit, then I want to search through the collection I have, containing a key/value pair of country codes/names (e.g AUS=Australia), and return those countries which are found matching. Is there any more efficient way of doing this, other than looping through the elements of the collection and using charAt()?

    Read the article

  • Why does C# not implement GetHashCode for Collections?

    - by Peterdk
    I am porting something from Java to C#. In Java the hashcode of a ArrayList depends on the items in it. In C# I always get the same hashcode from a List... Why is this? For some of my objects the hashcode needs to be different because the objects in their list property make the objects non-equal. I would expect that a hashcode is always unique for the object's state and only equals another hashcode when the object is equal. Am I wrong?

    Read the article

  • How to load entities into readonly collections using the entity framework

    - by Anton P
    I have a POCO domain model which is wired up to the entity framework using the new ObjectContext class. public class Product { private ICollection<Photo> _photos; public Product() { _photos = new Collection<Photo>(); } public int Id { get; set; } public string Name { get; set; } public virtual IEnumerable<Photo> Photos { get { return _photos; } } public void AddPhoto(Photo photo) { //Some biz logic //... _photos.Add(photo); } } In the above example i have set the Photos collection type to IEnumerable as this will make it read only. The only way to add/remove photos is through the public methods. The problem with this is that the Entity Framework cannot load the Photo entities into the IEnumerable collection as it's not of type ICollection. By changing the type to ICollection will allow callers to call the Add mentod on the collection itself which is not good. What are my options?

    Read the article

  • customising serialisation of java collections using xstream

    - by Will Goring
    I have an object that needs to be serialised as XML, which contains the following field: List<String> tags = new List<String>(); XStream serialises it just fine (after some aliases) like this: <tags> <string>tagOne</string> <string>tagTwo</string> <string>tagThree</string> <string>tagFour</string> </tags> That's OK as far as it goes, but I'd like to be able to rename the <string> elements to, say, <tag>. I can't see an obvious way to do that from the alias documentation on the XStream site. Am I missing something obvious?

    Read the article

  • Java: Finding objects in collections.

    - by Jake
    This problem occurs over and over. I have some complicated object, such as a Cat, which has many properties, such as age, favorite cat food, and so forth. A bunch of Cats are stored in a Java Collection, and I need to find all the Cats that are aged 3, or those whose favorite cat food is Whiskas. Surely, I can write a custom method that finds those Cats with a specific property, but this gets cumbersome with many properties; is there some generic way of doing this?

    Read the article

  • Collections removeAll method

    - by srinannapa
    I would like to know if something like below is possible , list<**MyObject**>.**removeAll**(list<**String**>) I hope the context is understandable. The list<MyObject : is a ArrayList<MyObject The list<String : is a ArrayList<String I know this can be achieved by overriding equals method in MyObject class. I would like to know if any other choice is prsent. Thanks,Srinivas N

    Read the article

  • google collections ordering on map values

    - by chris-gr
    I would like to order a map based on the values. Function<Map.Entry<A, Double>, Double> getSimFunction = new Function<Map.Entry<A, Double>, Double>() { public Double apply(Map.Entry<A, Double> entry) { return entry.getValue(); } }; final Ordering<Map.Entry<A, Double>> entryOrdering = Ordering.natural().onResultOf(getSimFunction); ImmutableSortedMap.orderedBy(entryOrdering).putAll(....).build(); How can I create a new sortedMap based on the ordering results or a sortedset based on the map.keyset()?

    Read the article

  • AutoMapping Custom Collections with FluentNHibernate

    - by ScottBelchak
    I am retrofitting a very large application to use NHibernate as it's data access strategy. Everything is going well with AutoMapping. Luckily when the domain layer was built, we used a code generator. The main issue that I am running into now is that every collection is hidden behind a custom class that derives from List<. For example public class League { public OwnerList owners {get;set;} } public class OwnerList : AppList<Owner> { } public class AppList<T> : List<T> { } What kind of Convention do I have to write to get this done?

    Read the article

  • C++ stl collections or linked lists

    - by Lucas
    I'm developing a OpenGL based simulation in C++. I'm optmizing my code now and i see throughout the code the frequently use of std:list and std:vector. What is the more performatic: to continue using C++ stl data structs or a pointer based linked list? The main operation that involve std::list and std::vector is open a iterator and loop through all items in the data structs and apply some processing

    Read the article

  • scala 2.8 implict java collections conversions

    - by nablik
    I have problem with JavaConversions with 2.8 beta: import scala.collection.JavaConversions._ class Utils(dbFile : File, sep: String) extends IUtils { (...) def getFeatures() : java.util.List[String] = csv.attributes.toList } And then exception: [INFO] Utils.scala:20: error: type mismatch; [INFO] found : List[String] [INFO] required: java.util.List[String] [INFO] def getFeatures() : java.util.List[String] = csv.attributes.toList [INFO]

    Read the article

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