background preloader


Related:  JAVA

jpcap network packet capture library Logging in NetBeans using slf4j It's probably not necessary to start this article with a mini-lecture on why logging, like unit-testing, is a Good Thing, so all I will say is logging is important not only during development but also invaluable in diagnosing runtime problems, once a solution is delivered and running. From here on I'm going to assume you're convinced. So, you know you should be logging, but how? And which of the many logging frameworks should you use? This article sets out to answer the first question, showing you how to get started logging in Java, using the NetBeans IDE, and offers an opinion on the answer to the second question. There are several well-established ways to do logging in Java but the best approach I have come across so far is to use slf4j (the Simple Logging Facade for Java) for all logging statements in source code. Splitting the logging job into two in this way means you need two references in your Java project, in order to use slf4j: Download slf4j and logback. Logging Statements

Network Packet Capture Facility for Java | Free software downloads Logback Manual The complete logback manual documents the latest version of logback framework. In over 150 pages and dozens of concrete examples, it covers both basic and advanced logback features, including: the overall logback architecture discussion of best logback practices and anti-patterns logback configuration scripts in XML format appenders encoders layouts filters mapped diagnostic contexts Joran, logback's configuration system The logback manual describes the logback API in considerable detail, including its features and design rationale. Authored by Ceki Gülcü and Sébastien Pennec, the main contributors to the logback project, the logback manual is intended for developers already familiar with the Java language but new to logback, as much as for experienced logback users. With the aid of introductory material and many examples, new users should quickly come up to speed.

kaitoy/pcap4j Commons Logging The Logging Component When writing a library it is very useful to log information. However there are many logging implementations out there, and a library cannot impose the use of a particular one on the overall application that the library is a part of. The Logging package is an ultra-thin bridge between different logging implementations. A library that uses the commons-logging API can be used with any logging implementation at runtime. Applications (rather than libraries) may also choose to use commons-logging. Note that commons-logging does not attempt to initialise or terminate the underlying logging implementation that is used at runtime; that is the responsibility of the application. Documentation The Release Notes document the new features and bug fixes that have been included in the latest release. The JavaDoc API documents for the latest release are available online. The Wiki site has the latest updates, an FAQ and much other useful information. Releases 1.1.3 Release - May 2013

Retrieve Oracle version information This Oracle tutorial explains how to find the Oracle version information with syntax and examples. Description You can check the Oracle version by running a query from the command prompt. The version information is stored in a table called v$version. In this table you can find the version information for Oracle, PL/SQL, etc. Syntax The syntax to retrieve the Oracle version information is: SELECT * FROM v$version; SELECT * FROM v$version WHERE banner LIKE 'Oracle%'; Parameters or Arguments There are no parameters or arguments. Example Let's look at some of examples of how to retrieve version information from Oracle. All Version Information To retrieve all version information from Oracle, you could execute the following SQL statement: This query would output something like this: Oracle Version Only If you only wanted the Oracle version information, you execute the following SQL statement: It should return something like this:

Programación con Java: 10 de las Mejores Prácticas en Java 1.- Evitar la creación innecesaria de objetos, Lazy Initialitation La creación de objetos en Java es una de las operaciones mas costosas en términos de uso de memoria e impacto en el performance. Esto es evitable creando o inicializando objetos solo en el momento en que serán requeridos en el código. public class Paises { private List paises; public List getPaises() { //se inicializa solo cuando es requerido if(null == paises) { paises = new ArrayList(); } return paises; } } 2.- Nunca hacer variables de instancia públicas Hacer una clase publica se puede ocasionar problemas en un programa. public class MiCalendario { public String[] diasDeLaSemana = {"Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"}; //mas código } La mejor práctica es como mucho de ustedes saben, es siempre definir estas variables como privadas y crear los métodos accesores, “setters“ y “getters” Pero escribir los métodos accesores no resuelve el problema del todo. Escribir código es divertido.

Buenas prácticas para la construcción de software Java Weak Reference Releasing unused objects for garbage collection can be done efficiently using java weak reference. Yes. weak reference is related to garbage collection. In java we need to not anything explicitly for garbage collection (GC), this memory management overhead is taken care by java run-time itself. Then what is the use of java weak reference? Let us see an example scenario, which will help us understand the problem in detail. Before that, we should be aware there are four types of references in java and they are strong reference, weak reference, soft reference and phantom reference. Weak Reference When there are one or more reference to an object it will not be garbage collected in Java. Let us take a sample scenario to understand it better. Key is TextView object and value is the Id. So, programmatic we need to ensure that, when a textView is removed then its corresponding entry in the map should be removed. WeakHashMap There is a predefined Map which uses weak reference. Soft Reference

Play framework - Home Design Patterns in Java Tutorial Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development. These solutions were obtained by trial and error by numerous software developers over quite a substantial period of time. This tutorial will take you through step by step approach and examples using Java while learning Design Pattern concepts. This reference has been prepared for the experienced developers to provide best solutions to certain problems faced during software development and for un-experienced developers to learn software design in an easy and faster way. Before you start proceeding with this tutorial, I'm making an assumption that you are already aware about basic java programming concepts.

Logging facade that allows various implementations to be used like log4j, java logging, commons logging. The chap that made this library has his own logging framework that is supported( by superunknown Apr 10