background preloader

Java

Facebook Twitter

Hsqldb

Managing multiple internal projects using Maven (Switching from ant/ivy) Local Storage. You are here: Home Dive Into HTML5 Diving In Persistent local storage is one of the areas where native client applications have held an advantage over web applications. For native applications, the operating system typically provides an abstraction layer for storing and retrieving application-specific data like preferences or runtime state. These values may be stored in the registry, INI files, XML files, or some other place according to platform convention. If your native client application needs local storage beyond key/value pairs, you can embed your own database, invent your own file format, or any number of other solutions.

Historically, web applications have had none of these luxuries. What we really want is a lot of storage space on the client that persists beyond a page refresh and isn’t transmitted to the server Before HTML5, all attempts to achieve this were ultimately unsatisfactory in different ways. A Brief History of Local Storage Hacks Before HTML5 Introducing HTML5 Storage. Practical Introduction into Code Injection with AspectJ, Javassist, and Java Proxy. The ability to inject pieces of code into compiled classes and methods, either statically or at runtime, may be of immense help. This applies especially to troubleshooting problems in third-party libraries without source codes or in an environment where it isn’t possible to use a debugger or a profiler. Code injection is also useful for dealing with concerns that cut across the whole application, such as performance monitoring.

Using code injection in this way became popular under the name Aspect-Oriented Programming (AOP). Code injection isn’t something used only rarely as you might think, quite the contrary; every programmer will come into a situation where this ability could prevent a lot of pain and frustration. This post is aimed at giving you the knowledge that you may (or I should rather say “will”) need and at persuading you that learning basics of code injection is really worth the little of your time that it takes. Why You Are Going to Need It Mini Glossary Advice Aspect Pointcut. Memory leaks are easy to find. Building Filesystems the Way You Build Web Apps (Ksplice Blog) FUSE is awesome. While most major Linux filesystems (ext3, XFS, ReiserFS, btrfs) are built-in to the Linux kernel, FUSE is a library that lets you instead write filesystems as userspace applications.

When something attempts to access the filesystem, those accesses get passed on to the FUSE application, which can then return the filesystem data. It lets you quickly prototype and test filesystems that can run on multiple platforms without writing kernel code. You can easily experiment with strange and unusual interactions between the filesystem and your applications. You can even build filesystems without writing a line of C code. FUSE has a reputation of being used only for toy filesystems (when are you actually going to use flickrfs?) Take a page from web apps This is the kind of problem that web development frameworks have also had to solve, since it's been a long time since a URL always mapped directly onto a file on the web server.

RouteFS: URL routing for filesystems Getting started #! Screenshots. Squares Aren’t Rectangles? A Common Misunderstanding of Object Oriented Design From MSDN Magazine | DoubleCloud.org. While reading the recent Dec 2010 issue of MSDN magazine, I found an article (Multiparadigmatic .Net, Part 4: Object Orientation) with misunderstandings on object oriented design.

I was surprised that the author reached conclusions like, “squares aren’t rectangles,” and “no happy ending here.” The conclusions are based on misunderstandings of object oriented design. Let me show you what the root problem is and how to get a happy ending. After reading this, you won’t be bothered by “squares aren’t rectangles.” What’s the problem? As most people already know, inheritance or generalization (I prefer the latter) is an important feature of OOD. What about Square and Rectangle? As you can find out, the Square has equal height and width and you would need only one attribute Edge for this like the following: Now thinking of “a square is a rectangle,” people might consider how to convert a square and a rectangle. Why are Squares Still Rectangles? Unfortunately it’s NOT. Happy Ending Here.

Jpc

Using XML and Jar Utility API to Build a Rule-Based Java EE Auto-Deployer. By Colin (Chun) Lu 11/16/2007 Introduction Today's Java EE application deployment is a common task, but not an easy job. If you have ever been involved in deploying a Java EE application to a large enterprise environment, no doubt you have faced a number of challenges before you click the deploy button. For instance, you have to figure out how to configure JMS, data sources, database schemas, data migrations, third-party products like Documentum for web publishing, dependencies between components and their deployment order, and so on.

Although most of today's application servers support application deployment through their administrative interfaces, the deployment task is still far from being a one-button action. In the first few sections of this article, I will discuss some of the challenges of Java EE deployment. Challenge 1: Package Limitations A Java EE application is packaged as an enterprise application archive file (EAR). Figure 1. Challenge 2: Deployment Order and Dependencies 1. Home - Janino.

Jvm

Java device driver. Image procesing. JUV NativeAccess SDK demo (webcam capture) V1Benchmarks - kryo - Benchmarks for version 1.x - Fast, efficient Java serialization and cloning. The results below were obtained using the thrift-protobuf-compare project. There you will find the source for the benchmarks used to generate the charts displayed here. The project also has a benchmarking page that compares 20+ Java serialization libraries, including Kryo. Besides the benchmark project linked above, a project called memcached-session-manager has done some additional benchmarking. Protobuf Google's protobuf project beats out most other Java serialization libraries, so is a good baseline to compare against: The bars labeled "kryo" represent out of the box serialization.

The bars labeled "kryo optimized" represent the classes registered with optimizations such as letting Kryo know which fields will never be null and what type of elements will be in a list. The bars labeled "kryo compressed" represent the same as "kryo optimized" but with deflate compression. Protobuf differences There are other differences between the projects that should be considered. Java serialization.

Architecture

Security. Live-android - A LiveCD for Android. Improving J2EE Application Performance. Introduction You delivered the application to the users and they are now using it every day. Early feedback has indicated that the performance of the application does not meet the requirements. The service level agreement called for a maximum response time of five seconds per request. "Inconceivable! " This article describes how to achieve a high level of performance in a J2EE application, independent of which Application Server you use.

Choose your performance goals It is always best to choose the project goals before development starts. If you are building an n-tier application that has the goal of supporting clients over slow connections (dial-up modems), then you may employ techniques such as compressing as much information into individual TCP/IP packets as possible. In most applications, performance is dependent on several factors. Follow a structured approach to improving performance It is exciting to make changes to the application that significantly improve performance. Summary. Introduction to Java Module System in Java 7.0. GuavaExplained - guava-libraries - Landing page for Guava explanations. - 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.

Each of these tools really do get used every day by Googlers, in production services. But trawling through Javadoc isn't always the most effective way to learn how to make best use of a library. Here, we try to provide readable and pleasant explanations of some of the most popular and most powerful features of Guava. This wiki is a work in progress, and parts of it may still be under construction. Basic utilities: Make using the Java language more pleasant. NOTE: To discuss the contents of this wiki, please just use the guava-discuss mailing list.

ProxyFactory (Javassist API) Factory of dynamic proxy classes. This factory generates a class that extends the given super class and implements the given interfaces. The calls of the methods inherited from the super class are forwarded and then invoke() is called on the method handler associated with instances of the generated class.

The calls of the methods from the interfaces are also forwarded to the method handler. For example, if the following code is executed, Here, Method is java.lang.reflect.Method. Then, the following method call will be forwarded to MethodHandler mi and prints a message before executing the originally called method bar() in Foo. foo.bar(); The last three lines of the code shown above can be replaced with a call to the helper method create, which generates a proxy class, instantiates it, and sets the method handler of the instance: : Foo foo = (Foo)f.create(new Class[0], new Object[0], mi); To change the method handler during runtime, execute the following code:

Think again before adopting the commons-logging API. By Ceki Gülcü, November 14th, 2002, last updated October 29th, 2009, © All rights reserved Introduction Given that log4j is such a low-level library, most organizations are hesitant to tie their code to log4j, especially considering the new logging API included in JDK 1.4. Before going forward, it is appropriate to mention that these two APIs are very similar. The classical usage pattern for log4j is: import org.apache.log4j.Logger; public class MyClass { final static Logger logger = Logger.getLogger("some.name"); public void foo1() { logger.debug("Hello world.

"); } public void foo2() { logger.info("Another message. "); logger.error("Stop that! " As you are well aware by now, one of the important benefits of log4j is that it can be configured at run time using configuration scripts. Although the log4j API is at least two years older than JDK 1.4, notice the extent to which the two APIs are similar. Although not particularly difficult, it turns out that wrappers are not trivial to write. Project Lombok. State of the Collections. April 2012 This is an informal overview of the major proposed library enhancements to take advantage of new language features, primarily lambda expressions and extension methods, specified by JSR 335 and implemented in the OpenJDK Lambda Project.

This document describes the design approach taken in the rough prototype that has been implemented in the Lambda Project repository. It is intended as a working straw-man proposal; the final version may look different, but there is a working design and implementation that may now serve as a jumping-off point for discussions. Background Had lambda expressions (closures) been part of the Java language from the beginning, our Collections APIs would certainly look different than they do today.

Parallelism is an important driver for this work. For a description of the language features being specified by JSR 335, see the State of the Lambda. Internal vs external iteration for (Block b : blocks) { b.setColor(RED); } The role of laziness Streams No storage. Modularization in java 8. To Java SE 8, and Beyond!

Unit testing

The Java Specialists' Newsletters.