Search Results

Search found 6189 results on 248 pages for 'garbage collection'.

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

  • Are C or C++ The Only Viable Languages for a GC

    - by user95312
    Background I have just finished writing a compiler for a functional language compiling to the JVM as a learning project. However, since I'm just doing this to learn, I thought it might be interesting to write a native backend and a RTS for it. As I've been planning out what this new backend will look like, the one point I'm stumbling on is the garbage collector. I've implemented the compiler in Haskell. But I have no desire to write the GC in Haskell since, while it may be possible, it'd suck. Question I've looked at several FOSS garbage collectors prior to posting and most of them were implemented in good old ANSI C. Is this still the most accepted choice for writing a GC nowadays? I've seen that this site tends to frown upon questions with multiple answers so I hope this will make it more specific: If some startup was writing a professional grade gc today, are the only viable choice for them C or C++? It's my first question here so please comment and let me know if this question is ill-suited for for programmers.

    Read the article

  • Should I use a collection here?

    - by Eva
    So I have code set up like this: public interface IInterface { public void setField(Object field); } public abstract class AbstractClass extends JPanel implements IInterface { private Object field_; public void setField(Object field) { field_ = field; } } public class ClassA extends AbstractClass { public ClassA() { // unique ClassA constructor stuff } public Dimension getPreferredSize() { return new Dimension(1, 1); } } public class ClassB extends AbstractClass { public ClassB() { // unique ClassB constructor stuff } public Dimension getPreferredSize() { return new Dimension(42, 42); } } public class ConsumerA { public ConsumerA(Collection<AbstractClass> collection) { for (AbstractClass abstractClass : collection) { abstractClass.setField(this); abstractClass.repaint(); } } } All hunky-dory so far, until public class ConsumerB { // Option 1 public ConsumerB(ClassA a, ClassB b) { methodThatOnlyTakesA(a); methodThatOnlyTakesB(b); } // Option 2 public ConsumerB(Collection<AbstractClass> collection) { for (IInterface i : collection) { if (i instanceof ClassA) { methodThatOnlyTakesA((ClassA) i); else if (i instanceof ClassB) { methodThatOnlyTakesB((ClassB) i); } } } } public class UsingOption1 { public static void main(String[] args) { ClassA a = new ClassA(); ClassB b = new ClassB(); Collection<AbstractClass> collection = Arrays.asList(a, b); ConsumerA consumerA = new ConsumerA(collection); ConsumerB consumerB = new ConsumerB(a, b); } } public class UsingOption2 { public static void main(String[] args) { Collection<AbstractClass> collection = Arrays.asList(new ClassA(), new ClassB()); ConsumerA = new ConsumerA(collection); ConsumerB = new ConsumerB(collection); } } With a lot more classes extending AbstractClass, both options get unwieldly. Option1 would make the constructor of ConsumerB really long. Also UsingOption1 would get long too. Option2 would have way more if statements than I feel comfortable with. Is there a viable Option3? If it helps, ClassA and ClassB have all the same methods, they're just implemented differently. Thanks for slogging through my code!

    Read the article

  • Collection.contains(Enum.Value) in HQL?

    - by Seth
    I'm a little confused about how to do something in HQL. So let's say I have a class Foo that I'm persisting in hibernate. It contains a set of enum values, like so: public class Foo { @CollectionOfElements private Set<Bar> barSet = new HashSet<Bar>(); //getters and setters here ... } and public enum Bar { A, B } Is there an HQL statement I can use to fetch only Foo instances who'se barSet containst Bar.B? List foos = session.createQuery("from Foo as foo " + "where foo.barSet.contains.Bar.B").list(); Or am I stuck fetching all Foo instances and filtering them out at the DAO level? List foos = session.createQuery("from Foo as foo").list(); List results = new ArrayList(); for(Foo f : foos) { if(f.barSet.contains(Bar.B)) results.add(f); } Thanks!

    Read the article

  • C# collection/string .Contains vs collection/string.IndexOf

    - by Daniel
    Is there a reason to use .Contains on a string/list instead of .IndexOf? Most code that I would write using .Contains would shortly after need the index of the item and therefore would have to do both statements. But why not both in one? if ((index = blah.IndexOf(something) = 0) // i know that Contains is true and i also have the index

    Read the article

  • Nhibernate get collection by ICriteria

    - by Andrew Kalashnikov
    Hello, colleagues. I've got a problem at getting 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"> <column name="id" not-null="true"/> <generator class="native"/> </id> <property name="Guid"> <column name="guid"/> </property> <set name="Accounts" table="sales_users" lazy="false"> <key column="sales_id" /> <element column="user_id" type="Int32" /> </set> </class> Domain: public class Sales : BaseDomain { ICollection<int> accounts = new List<int>(); public virtual ICollection<int> Accounts { get { return accounts; } set { accounts = value; } } public Sales() { } } I want get query such as SELECT * FROM sales s INNER JOIN sales_users su on su.sales_id=s.id WHERE su.user_id=:N How can i do this through ICriterion object? Thanks a lot.

    Read the article

  • Datatype to use for collection of QT buttons

    - by different
    Hi Everyone, I am brand new to QT and need to develop the Mancala game. Since I'm brand new to the QT environment, my plan it to keep things very simple. I will be using the "Push Button" widget as pieces on the game. Since two players play this game, my idea is to have to arrays of buttons. One array for player 1 and the other for player 2. My question is since I am using "Push Button" widgets, how can I group them to iterate through? I notice that QT has both the array and vector data types but I'm confused on how these data types can be used to "group" the buttons. Does anyone know of any sample code or tutorials to look at to learn more? Thanks for your time and any input provided.

    Read the article

  • Serializing Class Derived from Generic Collection yet Deserializing the Generic Collection

    - by Stacey
    I have a Repository Class with the following method... public T Single<T>(Predicate<T> expression) { using (var list = (Models.Collectable<T>)System.Xml.Serializer.Deserialize(typeof(Models.Collectable<T>), FileName)) { return list.Find(expression); } } Where Collectable is defined.. [Serializable] public class Collectable<T> : List<T>, IDisposable { public Collectable() { } public void Dispose() { } } And an Item that uses it is defined.. [Serializable] [System.Xml.Serialization.XmlRoot("Titles")] public partial class Titles : Collectable<Title> { } The problem is when I call the method, it expects "Collectable" to be the XmlRoot, but the XmlRoot is "Titles" (all of object Title). I have several classes that are collected in .xml files like this, but it seems pointless to rewrite the basic methods for loading each up when the generic accessors do it - but how can I enforce the proper root name for each file without hard coding methods for each one? The [System.Xml.Serialization.XmlRoot] seems to be ignored. When called like this... var titles = Repository.List<Models.Title>(); I get the exception <Titlesxmlns=''> was not expected. The XML is formatted such as. .. <?xml version="1.0" encoding="utf-16"?> <Titles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Title> <Id>442daf7d-193c-4da8-be0b-417cec9dc1c5</Id> </Title> </Titles> Here is the deserialization code. public static T Deserialize<T>(String xmlString) { System.Xml.Serialization.XmlSerializer XmlFormatSerializer = new System.Xml.Serialization.XmlSerializer(typeof(T)); StreamReader XmlStringReader = new StreamReader(xmlString); //XmlTextReader XmlFormatReader = new XmlTextReader(XmlStringReader); try { return (T)XmlFormatSerializer.Deserialize(XmlStringReader); } catch (Exception e) { throw e; } finally { XmlStringReader.Close(); } }

    Read the article

  • Why is free() not allowed in garbage-collected languages?

    - by sundar
    I was reading the C# entry on Wikipedia, and came across: Managed memory cannot be explicitly freed; instead, it is automatically garbage collected. Why is it that in languages with automatic memory management, manual management isn't even allowed? I can see that in most cases it wouldn't be necessary, but wouldn't it come in handy where you are tight on memory and don't want to rely on the GC being smart?

    Read the article

  • What's a good library to do computational geometry (like CGAL) in a garbage-collected language?

    - by Squash Monster
    I need a library to handle computational geometry in a project, especially boolean operations, but just about every feature is useful. The best library I can find for this is CGAL, but this is the sort of project I would hesitate to make without garbage collection. What language/library pairs can you recommend? So far my best bet is importing CGAL into D. There is also a project for making Python bindings for CGAL, but it's very incomplete.

    Read the article

  • Java multi Generic collection parameters complie error

    - by Geln Yang
    Hi, So strange!Please have a look the code first: public class A { } public class B extends A { } public class C extends A { } public class TestMain { public <T extends A> void test(T a, T b) { } public <T extends A> void test(List<T> a, List<T> b) { } public static void main(String[] args) { new TestMain().test(new B(), new C()); new TestMain().test(new ArrayList<B>(), new ArrayList<C>()); } } The statement "new TestMain().test(new ArrayList(), new ArrayList())" get a "Bound mismatch" compile error, while "new TestMain().test(new B(), new C())" is compiled ok. Bound mismatch: The generic method test(T, T) of type TestMain is not applicable for the arguments (ArrayList, ArrayList). The inferred type ArrayList is not a valid substitute for the bounded parameter It seems the type of the second generic List parameter is limited by the Type of the first.Is it a feature or a bug of the compile program? ps, jdk:1.6,IDE:Eclipse 3.5.1

    Read the article

  • Best way to bind node collection to itemscontrol in Silverilght

    - by mrtrombone
    I have a Silverlight project where the main objects are just a bunch of nodes that are joined to each other. A parent node can have many children. I want to be able to bind the nodes to an itemscontrol or similar and so was wondering how to best structure the parent child relationship. Is it OK to create a flat top level list of all nodes (List allNodes) and add each node to that, binding the list to the itemscontrol, then on top of that add each node to it's parent's 'childnodes' list to establish the structure - or am I doing some kind of ugly doubling up? Just hoping there is some kind of best practice or pattern I can latch on to Thanks

    Read the article

  • oracle collection not enough values

    - by john
    I did following: create or replace type my_row as object ( lname varchar2(30), fname varchar2(30), MI char(1), hohSSN char (9), hohname VARCHAR2(63), hohDob char(10), dob DATE ); create or replace type eiv.my_rec as table of eiv.my_row; but then doing query like: my_records my_rec select '', '', '', '', '', '', sysdate bulk collect into my_records from dual; gives error ORA-00947: not enough values what can i be doing wrong here?

    Read the article

  • Oracle multiset, collection and records

    - by Atul
    Can anybody Explain me why records are required. Can't we perform the same operation in pl/sql using loop and all. Also when multiset, records query can be used i.e. in which type of situation and which one will be the preference.

    Read the article

  • LINQ, creating unique collection of a collection

    - by Wish
    I have class Vertex and a class Edge (Edge holds 2 properties - Vertex Source and Vertex Target); Edges and Vertexes are collected into lists Some example: A-->B // edge from vertex A to B B-->C // edge from vertex B to C C-->A // edge from vertex C to A A-->C // edge from vertex A to C -- this is two way edge So I would like to make IDictionary<Edge, bool> which would hold edges (A--B and B--A would be like 1), and bool - if it is two way or no. I need it because when I draw them now, it draws 2 arrows under one another. I would better make 1 arrow. So I'm pretty stuck right here... May anybody help me a bit ?

    Read the article

  • Setting a property from one collection to another collection

    - by ooo
    I have two colluections List<Application> myApps; List<Application> yourApps; These lists have overlapping overlapping data but they are coming from different sources and each source has some missing field data. Application object has a property called Description Both collections have a unique field called Key i want to see if there is a LINQ solution to: Loop through all applications in myApps and look at the key and see if that existing in yourApps. If it does, i want to take the description property from that application in yourApps and set the description property on the application on myApps to that same value i wanted to see if there was any slick way using lambda expressions (instead of having to have loops and a number of if statements.)

    Read the article

  • Security Trimmed Cross Site Collection Navigation

    - by Sahil Malik
    Ad:: SharePoint 2007 Training in .NET 3.5 technologies (more information). This article will serve as documentation of a fully functional codeplex project that I just created. This project will give you a WebPart that will give you security trimmed navigation across site collections. The first question is, why create such a project? In every single SharePoint project you will do, one question you will always be faced with is, what should the boundaries of sites be, and what should the boundaries of site collections be? There is no good or bad answer to this, because it really really depends on your needs. There are some factors in play here. Site Collections will allow you to scale, as a Site collection is the smallest entity you can put inside a content database Site collections will allow you to offer different levels of SLAs, because you put a site collection on a separate content database, and put that database on a separate server. Site collections are a security boundary – and they can be moved around at will without affecting other site collections. Site collections are also a branding boundary. They are also a feature deployment boundary, so you can have two site collections on the same web application with completely different nature of services. But site collections break navigation, i.e. a site collection at “/”, and a site collection at “/sites/mySiteCollection”, are completely independent of each other. If you have access to both, the navigation of / won’t show you a link to /sites/mySiteCollection. Some people refer to this as a huge issue in SharePoint. Luckily, some workarounds exist. A long time ago, I had blogged about “Implementing Consistent Navigation across Site Collections”. That approach was a no-code solution, it worked – it gave you a consistent navigation across site collections. But, it didn’t work in a security trimmed fashion! i.e., if I don’t have access to Site Collection ‘X’, it would still show me a link to ‘X’. Well this project gets around that issue. Simply deploy this project, and it’ll give you a WebPart. You can use that WebPart as either a webpart or as a server control dropped via SharePoint designer, and it will give you Security Trimmed Cross Site Collection Navigation. The code has been written for SP2010, but it will work in SP2007 with the help of http://spwcfsupport.codeplex.com . What do I need to do to make it work? I’m glad you asked! Simple! Deploy the .wsp (which you can download here). This will give you a site collection feature called “Winsmarts Cross Site Collection Navigation” as shown below. Go ahead and activate it, and this will give you a WebPart called “Winsmarts Navigation Web Part” as shown below: Just drop this WebPart on your page, and it will show you all site collections that the currently logged in user has access to. Really it’s that easy! This is shown as below - In the above example, I have two site collections that I created at /sites/SiteCollection1 and /sites/SiteCollection2. The navigation shows the titles. You see some extraneous crap as well, you might want to clean that – I’ll talk about that in a minute. What? You’re running into problems? If the problem you’re running into is that you are prompted to login three times, and then it shows a blank webpart that says “Loading your applications ..” and then craps out!, then most probably you’re using a different authentication scheme. Behind the scenes I use a custom WCF service to perform this job. OOTB, I’ve set it to work with NTLM, but if you need to make it work alternate authentications such as forms based auth, or client side certs, you will need to edit the %14%\ISAPI\Winsmarts.CrossSCNav\web.config file, specifically, this section - 1: <bindings> 2: <webHttpBinding> 3: <binding name="customWebHttpBinding"> 4: <security mode="TransportCredentialOnly"> 5: <transport clientCredentialType="Ntlm"/> 6: </security> 7: </binding> 8: </webHttpBinding> 9: </bindings> For Kerberos, change the “clientCredentialType” to “Windows” For Forms auth, remove that transport line For client certs – well that’s a bit more involved, but it’s just web.config changes – hit a good book on WCF or hire me for a billion trillion $. But fair warning, I might be too busy to help immediately. If you’re running into a different problem, please leave a comment below, but the code is pretty rock solid, so .. hmm .. check what you’re doing! BTW, I don’t  make any guarantee/warranty on this – if this code makes you sterile, unpopular, bad hairstyle, anything else, that is your problem! But, there are some known issues - I wrote this as a concept – you can easily extend it to be more flexible. Example, hierarchical nav, or, horizontal nav, jazzy effects with jquery or silverlight– all those are possible very very easily. This webpart is not smart enough to co-exist with another instance of itself on the same page. I can easily extend it to do so, which I will do in my spare(!?) time! Okay good! But that’s not all! As you can see, just dropping the WebPart may show you many extraneous site collections, or maybe you want to restrict which site collections are shown, or exclude a certain site collection to be shown from the navigation. To support that, I created a property on the WebPart called “UrlMatchPattern”, which is a regex expression you specify to trim the results :). So, just edit the WebPart, and specify a string property of “http://sp2010/sites/” as shown below. Note that you can put in whatever regex expression you want! So go crazy, I don’t care! And this gives you a cleaner look.   w00t! Enjoy! Comment on the article ....

    Read the article

  • Desktop Fun: Halloween 2013 Wallpaper Collection [Bonus Edition]

    - by Akemi Iwaya
    Halloween is quickly approaching, so why not get your favorite system ready for the holiday? Make your desktop the spookiest one of all with our Halloween 2013 Wallpaper collection. Halloween 2013 Note: Click on the picture to see the full-size image—these wallpapers vary in size so you may need to crop, stretch, or place them on a colored background in order to best match them to your screen’s resolution.                     More Halloween Goodness for Your Desktop Desktop Fun: Halloween 2012 Wallpaper Collection [Bonus Edition] Desktop Fun: Halloween 2011 Wallpaper Collection [Bonus Edition] Desktop Fun: Halloween Wallpaper Collection [Bonus Edition] Desktop Fun: Halloween 2011 Icon Packs Desktop Fun: Halloween Icon Packs Desktop Fun: Halloween 2011 Fonts Desktop Fun: Halloween Fonts Awesome Desktop Wallpapers: Halloween Edition For more great wallpapers make sure to look through our terrific collections in the Desktop Fun section.     

    Read the article

  • Collection System

    Both first and third party collection agencies have been using collection system software to streamline collections for years, so it comes as no surprise that collection system software has evolved t... [Author: Sue McCrossin - Computers and Internet - March 30, 2010]

    Read the article

  • Turn on anonymous access in SharePoint2010 Site collection

    - by ybbest
    In this post, I would like to show you how to turn on anonymous access in SharePoint2010 Site collection using SharePoint Web UI. If you would like to achieve the same thing using PowerShell you can check this blog post here. 1. You need to go to Central AdminàManage Web Applications 2. Click Authentication provider 3. Click Default and Enable anonymous access 4. Go to your site collection and click on Site actions then click Site Permissions 5. Click on Anonymous Access 6. Select the Entire Web site and click OK. 7 Navigate to your site collection and boom you are all set for the anonymous access for your SharePoint site collection.

    Read the article

  • How to TDD test that objects are being added to a collection if the collection is private?

    - by Joshua Harris
    Assume that I planned to write a class that worked something like this: public class GameCharacter { private Collection<CharacterEffect> _collection; public void Add(CharacterEffect e) { ... } public void Remove(CharacterEffect e) { ... } public void Contains(CharacterEffect e) { ... } } When added an effect does something to the character and is then added to the _collection. When it is removed the effect reverts the change to the character and is removed from the _collection. It's easy to test if the effect was applied to the character, but how do I test that the effect was added to _collection? What test could I write to start constructing this class. I could write a test where Contains would return true for a certain effect being in _collection, but I can't arrange a case where that function would return true because I haven't implemented the Add method that is needed to place things in _collection. Ok, so since Contains is dependent on having Add working, then why don't I try to create Add first. Well for my first test I need to try and figure out if the effect was added to the _collection. How would I do that? The only way to see if an effect is in _collection is with the Contains function. The only way that I could think to test this would be to use a FakeCollection that Mocks the Add, Remove, and Contains of a real collection, but I don't want _collection being affected by outside sources. I don't want to add a setEffects(Collection effects) function, because I do not want the class to have that functionality. The one thing that I am thinking could work is this: public class GameCharacter<C extends Collection> { private Collection<CharacterEffect> _collection; public GameCharacter() { _collection = new C<CharacterEffect>(); } } But, that is just silly making me declare what some private data structures type is on every declaration of the character. Is there a way for me to test this without breaking TDD principles while still allowing me to keep my collection private?

    Read the article

  • Desktop Fun: Rainy Days Wallpaper Collection Series 2

    - by Asian Angel
    Earlier this year we brought you a beautiful rainy day collection that embraced the rain as it was falling down. Today our collection focuses on the lush raindrops that remain once it has stopped raining. Make your desktop feel as fresh as the day it was new with our Rainy Days Series 2 Wallpaper collection. How to See What Web Sites Your Computer is Secretly Connecting To HTG Explains: When Do You Need to Update Your Drivers? How to Make the Kindle Fire Silk Browser *Actually* Fast!

    Read the article

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