Search Results

Search found 9771 results on 391 pages for 'equivalence classes'.

Page 158/391 | < Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >

  • Multithreading improvements in .NET 4

    - by Artiom Chilaru
    I have heard that the .NET 4 team has added new classes in the framework that make working with threads better and easier. Basically the question is what are the new ways to run multithreaded tasks added in .NET 4 and what are they designed to be used for? UPD: Just to make it clear, I'm not looking for a single way of running parallel tasks in .NET 4, I want to find out which are the new ones added, and if possible what situation would each of them be best suited for..

    Read the article

  • Java Singleton Pattern

    - by Spencer
    I'm used the Singleton Design Pattern public class Singleton { private static final Singleton INSTANCE = new Singleton(); // Private constructor prevents instantiation from other classes private Singleton() {} public static Singleton getInstance() { return INSTANCE; } } My question is how do I create an object of class Singleton in another class? I've tried: Singleton singleton = new Singleton(); // error - constructor is private Singleton singleton = Singleton.getInstance(); // error - non-static method cannot be referenced from a static context What is the correct code? Thanks, Spencer

    Read the article

  • Compiler can not find AndroidInstrumentationTestCase2 when building Android app test code with Andro

    - by orospakr
    I have a project with some Android test code in it (with the appropriate elements, <uses-library> and <instrumentation>, added to AndroidManifest.xml). This works fine in Eclipse. However, it fails to build with mm, claiming that it can't find the test-runner classes: /home/orospakr/code/my-android/packages/apps/MyApp/src/ca/orospakr/myapp/test/functional/MyActivityTest.java:5: cannot find symbol symbol : class ActivityInstrumentationTestCase2 location: package android.test import android.test.ActivityInstrumentationTestCase2; ^

    Read the article

  • GWT Dynamic loading using GWT.create() with String literals instead of Class literals

    - by Sathish
    GWT.create() is the reflection equivalent in GWT, But it take only class literals, not fully qualified String for the Class name. How do i dynamically create classes with Strings using GWT.create()? Its not possible according to many GWT forum posts but how is it being done in frameworks like Rocket-GWT (http://code.google.com/p/rocket-gwt/wiki/Ioc) and Gwittir (http://code.google.com/p/gwittir/wiki/Introspection)

    Read the article

  • Problem with delete operation in many to many relation

    - by Alexey Zakharov
    Hi, I've got to classes Product and Store which have many to many relation I want deleting of store not to cause deleting of related product And deleting of product not to cause deleting of related store. Currently deleting of entity cause exception due to Foreign Key constraint. Here is this classes and their mapping in fluent hibernate: public class Product { public Product() { this.StoresStockedIn = new List<Store>(); } public virtual string Name { get; set; } public virtual double Price { get; set; } public virtual long ProductID { get; set; } public virtual IList<Store> StoresStockedIn { get; set; } } public class Store { public Store() { this.Products = new List<Product>(); this.Staff = new List<Employee>(); } public virtual string Name { get; set; } public virtual IList<Product> Products { get; set; } public virtual IList<Employee> Staff { get; set; } public virtual long StoreID { get; set; } } public class ProductMap : ClassMap<Product> { public ProductMap() { this.Id(x => x.ProductID); this.Map(x => x.Name); this.Map(x => x.Price); this.HasManyToMany(x => x.StoresStockedIn) .Cascade.None() .Table("StoreProduct"); } public class StoreMap : ClassMap<Store> { public StoreMap() { this.Id(x => x.StoreID); this.Map(x => x.Name); this.HasManyToMany(x => x.Products) .Cascade.None() .Inverse() .Table("StoreProduct"); this.HasMany(x => x.Staff) .Cascade.All() .Inverse(); } } Thanks, Alexey Zakharov

    Read the article

  • Microsoft.Office.Interop.Word documentation

    - by rold2007
    I need to use the Microsoft.Office.Interop.Word namespace to extract if a Word document contains macros, and which ones. The MSDN documentation for this namespace doesn't give much information compared to the documentation on other .Net classes. Where can I get more informations about this namespaces (examples, complete documentation, etc.). I already searched on Google and SO but didn't much information.

    Read the article

  • Apple Core Foundation license

    - by Shane
    Hi all, A short but sweet question: Can I use Apple's open source Core Foundation (CF classes) in a commercial product for free? That is, can I compile and link against the libraries without open sourcing my own applications's code? Obviously if I alter the original CF code, I would submit the changes. It's a very well constructed API and I'd hate to have to reinvent the wheel. Cheers, Shane

    Read the article

  • ANTLRv3 How to set a custom Lexer and Parser Class names

    - by Filip
    Is there a way to specify custom class name (meaning independent of the grammar name) for the ANTLRv3 generated Parser and Lexer classes? So in the case of grammar MDD; //other stufff Automtaically it would crate MDDParser and MDDLexer, but i would like to have them for example as MDDBaseParser and MDDLexer.

    Read the article

  • JPA @OneToMany and composite PK

    - by Fleuri F
    Good Morning, I am working on project using JPA. I need to use a @OneToMany mapping on a class that has three primary keys. You can find the errors and the classes after this. If anyone has an idea! Thanks in advance! FF javax.persistence.PersistenceException: No Persistence provider for EntityManager named JTA_pacePersistence: Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory: javax.persistence.PersistenceException javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.EntityManagerSetupException Exception Description: predeploy for PersistenceUnit [JTA_pacePersistence] failed. Internal Exception: Exception [TOPLINK-7220] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException Exception Description: The @JoinColumns on the annotated element [private java.util.Set isd.pacepersistence.common.Action.permissions] from the entity class [class isd.pacepersistence.common.Action] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referenceColumnName elements must be specified in each such @JoinColumn. at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:643) at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:196) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83) at isd.pacepersistence.common.DataMapper.(Unknown Source) at isd.pacepersistence.server.MainServlet.getDebugCase(Unknown Source) at isd.pacepersistence.server.MainServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:718) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) There is the source code of my classes : Action : @Entity @Table(name="action") public class Action { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int num; @ManyToOne(cascade= { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }) @JoinColumn(name="domain_num") private Domain domain; private String name; private String description; @OneToMany @JoinTable(name="permission", joinColumns= { @JoinColumn(name="action_num", referencedColumnName="action_num", nullable=false, updatable=false) }, inverseJoinColumns= { @JoinColumn(name="num") }) private Set<Permission> permissions; public Action() { } Permission : @SuppressWarnings("serial") @Entity @Table(name="permission") public class Permission implements Serializable { @EmbeddedId private PermissionPK primaryKey; @ManyToOne @JoinColumn(name="action_num", insertable=false, updatable=false) private Action action; @ManyToOne @JoinColumn(name="entity_num", insertable=false, updatable=false) private isd.pacepersistence.common.Entity entity; @ManyToOne @JoinColumn(name="class_num", insertable=false, updatable=false) private Clazz clazz; private String kondition; public Permission() { } PermissionPK : @SuppressWarnings("serial") @Entity @Table(name="permission") public class Permission implements Serializable { @EmbeddedId private PermissionPK primaryKey; @ManyToOne @JoinColumn(name="action_num", insertable=false, updatable=false) private Action action; @ManyToOne @JoinColumn(name="entity_num", insertable=false, updatable=false) private isd.pacepersistence.common.Entity entity; @ManyToOne @JoinColumn(name="class_num", insertable=false, updatable=false) private Clazz clazz; private String kondition; public Permission() { }

    Read the article

  • Cut and Paste Code Reuse - JavaScript and C#

    - by tyndall
    What is the best tool(s) for tracking down "cut and paste reuse" of code in JavaScript and C#? I've inherited a really big project and the amount of code that is repeated throughout the app is 'epic'. I need some help getting handle on all the stuff that can be refactored to base classes, reusable js libs, etc... If it can plug into Visual Studio 2010, that would be an added bonus.

    Read the article

  • Java language features which have no equivalent in C#

    - by jthg
    Having mostly worked with C#, I tend to think in terms of C# features which aren't available in Java. After working extensively with Java over the last year, I've started to discover Java features that I wish were in C#. Below is a list of the ones that I'm aware of. Can anyone think of other Java language features which a person with a C# background may not realize exists? The articles http://www.25hoursaday.com/CsharpVsJava.html and http://en.wikipedia.org/wiki/Comparison_of_Java_and_C_Sharp give a very extensive list of differences between Java and C#, but I wonder whether I missed anything in the (very) long articles. I can also think of one feature (covariant return type) which I didn't see mentioned in either article. Please limit answers to language or core library features which can't be effectively implemented by your own custom code or third party libraries. Covariant return type - a method can be overridden by a method which returns a more specific type. Useful when implementing an interface or extending a class and you want a method to override a base method, but return a type more specific to your class. Enums are classes - an enum is a full class in java, rather than a wrapper around a primitive like in .Net. Java allows you to define fields and methods on an enum. Anonymous inner classes - define an anonymous class which implements a method. Although most of the use cases for this in Java are covered by delegates in .Net, there are some cases in which you really need to pass multiple callbacks as a group. It would be nice to have the choice of using an anonymous inner class. Checked exceptions - I can see how this is useful in the context of common designs used with Java applications, but my experience with .Net has put me in a habit of using exceptions only for unrecoverable conditions. I.E. exceptions indicate a bug in the application and are only caught for the purpose of logging. I haven't quite come around to the idea of using exceptions for normal program flow. strictfp - Ensures strict floating point arithmetic. I'm not sure what kind of applications would find this useful. fields in interfaces - It's possible to declare fields in interfaces. I've never used this. static imports - Allows one to use the static methods of a class without qualifying it with the class name. I just realized today that this feature exists. It sounds like a nice convenience.

    Read the article

  • Removing table prefixes on ASP.NET MVC DataModel entities

    - by Tim Shults
    My database tables have prefixes on them and when the DataModel generates the EntityObjects they have the prefixes at the beginning of the class name. Is there anyway that I can have those prefixes ignored when the DataModel is updating/creating the classes? I've found the below question, but with no solution. http://stackoverflow.com/questions/1800065/removing-table-prefix-in-linq2sql-setup/2525827#2525827 Thanks in advance, Tim Shults

    Read the article

  • Uploading to Youtube via a proxy using the Java Youtube API

    - by Binaromong
    So I want to write a servlet which uploads a video to a youtube channel using the Java API, but I can't seem to find a way of specifying that I want to go through a proxy server. I've seen an example on this site where someone managed to do this using C#, but the Classes they used don't seem to exist in the Java API. Has anybody managed to successfully do this? YouTubeService service = new YouTubeService(clientID, developerKey);

    Read the article

  • Active Record Validations : uniqueness of

    - by Elliot
    Hey guys, I'm using http://ar.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M000086 to validate records. My form is currently a remote form, using RJS. My question, is how to I return the :message (for errors) to the page through ajax (and I assume the create.rjs file)? Best, Elliot

    Read the article

  • Guides for PostgreSQL query tuning?

    - by Joe
    I've found a number of resources that talk about tuning the database server, but I haven't found much on the tuning of the individual queries. For instance, in Oracle, I might try adding hints to ignore indexes or to use sort-merge vs. correlated joins, but I can't find much on tuning Postgres other than using explicit joins and recommendations when bulk loading tables. Do any such guides exist so I can focus on tuning the most run and/or underperforming queries, hopefully without adversely affecting the currently well-performing queries? I'd even be happy to find something that compared how certain types of queries performed relative to other databases, so I had a better clue of what sort of things to avoid. update: I should've mentioned, I took all of the Oracle DBA classes along with their data modeling and SQL tuning classes back in the 8i days ... so I know about 'EXPLAIN', but that's more to tell you what's going wrong with the query, not necessarily how to make it better. (eg, are 'while var=1 or var=2' and 'while var in (1,2)' considered the same when generating an execution plan? What if I'm doing it with 10 permutations? When are multi-column indexes used? Are there ways to get the planner to optimize for fastest start vs. fastest finish? What sort of 'gotchas' might I run into when moving from mySQL, Oracle or some other RDBMS?) I could write any complex query dozens if not hundreds of ways, and I'm hoping to not have to try them all and find which one works best through trial and error. I've already found that 'SELECT count(*)' won't use an index, but 'SELECT count(primary_key)' will ... maybe a 'PostgreSQL for experienced SQL users' sort of document that explained sorts of queries to avoid, and how best to re-write them, or how to get the planner to handle them better. update 2: I found a Comparison of different SQL Implementations which covers PostgreSQL, DB2, MS-SQL, mySQL, Oracle and Informix, and explains if, how, and gotchas on things you might try to do, and his references section linked to Oracle / SQL Server / DB2 / Mckoi /MySQL Database Equivalents (which is what its title suggests) and to the wikibook SQL Dialects Reference which covers whatever people contribute (includes some DB2, SQLite, mySQL, PostgreSQL, Firebird, Vituoso, Oracle, MS-SQL, Ingres, and Linter).

    Read the article

  • Replacement for CAPICOM

    - by AlexLocust
    Hi, all! Now CAPICOM is deprecated, and MSDN recommends to use .net classes from System.Security.Cryptography. But I have one Lotus Notes application, which using CAPICOM from LotusScript code (very similar to VisualBasic) for displaying certificates to users, and get some cert info (Subject and ValidToDate fields). How can I replace CAPICOM functionality with .net or any other alternative?

    Read the article

  • Running a Java daemon with a GWT front-end served by embedded Jetty

    - by BinaryMuse
    Greetings, coders, Background Info and Code I am trying to create a daemon-type program (e.g., it runs constantly, polling for things to do) that is managed by a GWT application (servlets in a WAR) which is in turn served by an embedded Jetty server (using a WebAppContext). I'm having problems making the GWT application aware of the daemon object. For testing things, I currently have two projects: The daemon and embedded Jetty server in one (EmbJetTest), and the GWT application in another (DefaultApp). This is the current state of the code: First, EmbJetTest creates an embedded Jetty server like so, using a ServletContextListener to inject the daemon object into the web application context: EmbJetTest.server = new Server(8080); // Create and start the daemon Daemon daemon = new Daemon(); Thread thread = new Thread(daemon); thread.start(); // war handler WebAppContext waContext = new WebAppContext(); waContext.setContextPath("/webapp"); waContext.setWar("./apps/DefaultApp.war"); waContext.addEventListener(new DaemonLoader(daemon)); // Add it to the server EmbJetTest.server.setHandler(waContext); EmbJetTest.server.setThreadPool(new QueuedThreadPool(10)); // Start the server; join() blocks until we shut down EmbJetTest.server.start(); EmbJetTest.server.join(); // Stop the daemon thread daemon.stopLoop(); Daemon is a very simple object with a couple properties, at the moment. DaemonLoader is the following ServletContextListener implementation: private Daemon daemon; public DaemonLoader(Daemon daemon) { this.daemon = daemon; } @Override public void contextDestroyed(ServletContextEvent arg0) { } @Override public void contextInitialized(ServletContextEvent arg0) { arg0.getServletContext().setAttribute("daemon", this.daemon); } Then, in one of my servlets in the GWT application, I have the following code: Daemon daemon = (Daemon) this.getServletContext().getAttribute("daemon"); However, when I visit localhost:8080/webapp/* and invoke the servlet, this code throws a ClassCastException, even though the classes are of the same type. This StackOverflow answer indicates that this is because the two classes are loaded with different classloaders. Question My question is twofold. Am I even on the right track here? Am I going about this completely the wrong way? Something tells me I am, but I can't think of another way to make the daemon available to both applications. Is there a better way to communicate with the daemon from the GWT application? Should the GWT app own the daemon and somehow start the daemon itself? The daemon needs to run even if no one visits the one of the GWT app's servlets--how could I do this? If I am on the right track, how can I get around the classloader issue? Thanks in advance.

    Read the article

  • Selective Inheritance Python

    - by user1682595
    I am making a python program which is using classes, I want one class to only selectively inherit from another e.g: class X(object): def __init__(self): self.hello = 'hello' class Y(object): def __init__(self): self.moo = 'moo' class Z(): def __init__(self, mode): if mode == 'Y': # Class will now Inherit from Y elif mode == 'X': # Class will now Inherit for X How can I do this without making another class?

    Read the article

< Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >