background preloader

Guice - Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 5 and above, brought to you by Google.

Guice - Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 5 and above, brought to you by Google.
Related:  Java Libraries

guava-libraries - Guava: Google Core Libraries for Java 1.6+ The Guava project contains several of Google's core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth. The latest release is 16.0.1, released February 4, 2014. Start using Guava You can download a JAR at: Guava is also available in Maven Central under the following identifiers: Learn more about how to UseGuavaInYourBuild. Please see the 16.0 release notes for more details about this release. Learn about Guava To stay informed and get "tip of the week"-style posts, follow +Google Guava on Google+. To just stay informed, period, about important news that every Guava user needs to know, subscribe to guava-announce. To report a defect or request a feature, click the Issues tab above and enter a new issue. To get help on a specific question or problem, post a question to Stack Overflow with the tag "guava". Keep an eye on project updates using any of these Project Feeds.

The Java Persistence API - A Simpler Programming Model for Entity Persistence Articles Index The major theme of version 5 of the Java Platform, Enterprise Edition (Java EE, formerly referred to as J2EE) is ease of development. Changes throughout the platform make the development of enterprise Java technology applications much easier, with far less coding. Enterprise developers should notice dramatic simplification in Enterprise JavaBeans (EJB) technology. A major enhancement in EJB technology is the addition of the new Java Persistence API, which simplifies the entity persistence model and adds capabilities that were not in EJB 2.1 technology. In short, EJB 3.0 is much easier to learn and use than was EJB 2.1, the technology's previous version, and should result in faster development of applications. This article supplements the earlier articles by focusing on entity-related code. The article highlights some of the important features that simplify the EJB 3.0 version of the code. Contents First, let's look at the application in use. Defaults make things even easier

Singletons are Pathological Liars by Miško Hevery So you join a new project, which has an extensive mature code base. Your new lead asks you to implement a new feature, and, as a good developer, you start by writing a test. testCreditCardCharge() { CreditCard c = new CreditCard( "1234 5678 9012 3456", 5, 2008); c.charge(100); } This code: Only works when you run as part of the suite.When run in isolation, throws NullPointerException.When you get your credit card bill, you are out $100 for every time the test runs. Now, I want to focus on the last point. But why do I get NullPointerException in isolation while the test works fine when run as part of the suite? testCreditCardCharge() { CreditCardProcessor.init(); CreditCard c = new CreditCard( "1234 5678 9012 3456", 5, 2008); c.charge(100); } You run the test again; still no success, and you get a different exception. testCreditCardCharge() { OfflineQueue.init(); CreditCardProcessor.init(); CreditCard c = new CreditCard( "1234 5678 9012 3456", 5, 2008); c.charge(100); }

Calling JavaFX From Java? While experimenting with JavaFX, remember that Java is never far away. In this case, let's call out to Jim Weaver's JavaFX Calculator demo: Here we go, here's all that's needed, via the Scripting API, which is included in the JavaFX SDK: 01.package calc; 03.import java.io.InputStreamReader; 04.import javax.script.ScriptEngine; 05.import javax.script.ScriptEngineManager; 06.import javax.script.ScriptException; 08.public class CalculatorLauncher { 10. public static void main(String[] args) { 11. try { 12. 13. 14. 15. engine.eval(reader); 16. } catch (ScriptException ex) { And so, here's my whole application, calling Jim Weaver's Calculator demo: Nice.

Apache Cocoon Un article de Wikipédia, l'encyclopédie libre. Apache Cocoon est un framework de développement web. Il s'agit d'un projet libre de la Fondation Apache. La force d'Apache Cocoon est de pouvoir créer n'importe quel type de document, du moment que l'on utilise les composants capables de le faire. Le logiciel est libre, distribué selon les termes de la licence Apache. Le sitemap[modifier | modifier le code] Le sitemap est le cœur d'une application développée avec Apache Cocoon. Les pipelines[modifier | modifier le code] Un pipeline est constitué de plusieurs composants : un générateur, un ou plusieurs transformateurs, et un sérialiseur. Les générateurs[modifier | modifier le code] Les transformateurs[modifier | modifier le code] Les transformateurs sont les composants du pipeline chargés de transformer les évènements SAX qu'ils reçoivent en d'autres événements SAX. Les sérialiseurs[modifier | modifier le code] Le sérialiseur est le dernier composant d'un pipeline Cocoon.

clearspring/stream-lib Hibernate - JBoss Community Where Have All the Singletons Gone? by Miško Hevery In Singletons are Pathological Liars we discussed the problems of having singletons in your code. Let’s build on that and answer the question “If I don’t have singletons how do I ensure there is only one instance of X and how do I get X to all of the places it is needed?” An OO application is a graph of objects. Collaborator Graph: This is the graph of objects that would be emitted if you serialized your application. If the new operators are mixed with application logic (see: How to Think About the new Operator) then the Constructor Graph and the Collaborator Graph tend to be one and the same. The above shows the application collaborator graph. The HTTP request would come to AuthenticatorPage which would collaborate with Authenticator to make sure the user is valid and forward a valid request onto ChargePage which would then try to load the user from UserRepository and create the credit card transaction which would be processed by CrediCardProcessor.

OOP Spelprogrammering Dataspel Många dataspel kan liknas vid simuleringar av en verklig eller påhittad värld. T.ex bilspel, äventyrsspel, eller spel som SimCity och Sims. Simulera betyder efterlikna. Följande är typiskt för spel-liknande simuleringar: Det finns en värld med objekt Det finns ett tidsflöde (realtid, nedsaktad tid, uppsnabbad tid) Objekten i världen är aktiva och kan ha varierande grad av AI Världen visualiseras på bildskärmen Spelaren kan interagera med objekten i världen på olika sätt Spelprogrammering Centrala delar i ett spelprogram: Grafik ("Sprites") Uppdateringsloop (Timer) Inmatning (mus och tangentbord) Nedan diskuteras dessa. Sprite-animeringar Sprite betyder "älva". Sprites i Java Det finns två grundläggande sätt att programmera sprites i Java: Som komponenter i ett fönster (där spriteklasserna är subklasser till t.ex JComponent eller JLabel) Som egna objekt som ritas upp i via paintComponent. Null-layout Exempel där en JLabel visar en bild på koordinat 100,100: Dubbelbuffrad animering Ljud

Spring Nailgun: Insanely Fast Java Last Updated November 25, 2012 Thinnest. Client. Ever? Nailgun is a client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead. What's New? See the Changelog. How does it work? See the project background. How do I get it? From GitHub. Before you download it, be aware that *it's not secure*. How do I use it? See the Quick Start guide. Spring Batch - Spring Batch Many applications within the enterprise domain require bulk processing to perform business operations in mission critical environments. These business operations include automated, complex processing of large volumes of information that is most efficiently processed without user interaction. These operations typically include time based events (e.g. month-end calculations, notices or correspondence), periodic application of complex business rules processed repetitively across very large data sets (e.g. insurance benefit determination or rate adjustments), or the integration of information that is received from internal and external systems that typically requires formatting, validation and processing in a transactional manner into the system of record. Spring Batch is a lightweight, comprehensive batch framework designed to enable the development of robust batch applications vital for the daily operations of enterprise systems. Spring Batch is part of Spring. Spring Batch Architecture

Root Cause of Singletons Since I have gotten lots of love/hate mail on the Singletons are Pathological Liars and Where Have All the Singletons Gone I feel obliged to to do some root cause analysis. Lets get the definition right. There is Singleton the design pattern (Notice the capital “S” as in name of something) and there is a singleton as in one of something (notice the lower case “s”). There is nothing wrong with having a single instance of a class, lots of reasons why you may want to do that. I would say that at this point most developers recognize that global state is harmful to your application design. The moment you traverse a global variable your API lies about its true dependencies (see: Singletons are Pathological Liars) The root problem is not the Singleton design pattern, the root problem here is the global reference to singleton. Someone pointed out that any design pattern can be abused. Now, there is one kind of Singleton which is OK. So the root cause is “GLOBAL STATE!”

Tutorial: Java Collections - CodeCall Programming Forum Collections Collections are an interface in the java.util package, and as its name suggests, it is used to define a collection of objects. There are many different classes which implement the collections interface. Each one has its unique features, some add elements in a sorted manner, others in a binary fashion. But there are two basic structures, a map and a list and most others extended these interfaces. Here is how you do it 1) Declare any object you wish to insert into a Map. Now note that a map stores value in a <KEY><VALUE> pair. DummyClass1 dm2 = new DummyClass1(); 2) Now you declare a HashMap which will store the key value pair. Map m = new HashMap(); //Old method Map<DummyClass> m = new HashMap<DummyClass>(); //New method as per Java 1.5 and above 3) To add the object to a map you need to use the put function. m.put("KEY1", dm1); 4) To retrieve this object use the get method and use KEY1 to identify the object to retrieve it. DummyClass1 dm3; dm3 = (DummyClass1)m.get("KEY1"); Code

Related: