background preloader

Java

Facebook Twitter

Net.javaforge.blog - How to create Java POJOs dynamically at runtime with Javassist. Imagine your application have to create Java POJO instances dynamically at runtime from some external configuration.

net.javaforge.blog - How to create Java POJOs dynamically at runtime with Javassist

This task can be easily done using one of the bytecode manipualtion library. This post demonstrates how this can be done using Javassist library. Assume we have following configuration for the properties our dynamically created POJO should contain: Map<String, Class<? >> props = new HashMap<String, Class<? Javanotes 7.0, Section 11.4. Section 11.4 As far as a program is concerned, a network is just another possible source of input data, and another place where data can be output.

Javanotes 7.0, Section 11.4

That does oversimplify things, because networks are not as easy to work with as files are. Java - Can you explain the HttpURLConnection connection process?

Android

Http streaming. Mockito. Maven. StaticPropertyReadWithSpring. Mockito - simpler & better mocking - Google Project Hosting. TransactionHandling. Java Interview Topics. 'servlets' tag wiki. Getting Started · Building Java Projects with Maven. The simple Hello World sample is completely self-contained and does not depend on any additional libraries.

Getting Started · Building Java Projects with Maven

Most applications, however, depend on external libraries to handle common and complex functionality. For example, suppose that in addition to saying "Hello World! ", you want the application to print the current date and time. While you could use the date and time facilities in the native Java libraries, you can make things more interesting by using the Joda Time libraries. First, change HelloWorld.java to look like this: src/main/java/hello/HelloWorld.java Here HelloWorld uses Joda Time’s LocalTime class to get and print the current time. If you were to run mvn compile to build the project now, the build would fail because you’ve not declared Joda Time as a compile dependency in the build. Org.springframework. Time - Java date and time API - Home. Release 2.7 is the current latest release.

Time - Java date and time API - Home

This release is considered stable and worthy of the 2.x tag. See the upgrade notes for full details. Joda-Time requires Java SE 5 or later and has no dependencies. There is a compile-time dependency on Joda-Convert, but this is not required at runtime thanks to the magic of annotations.

Multithreading

7 Ways to Add JARs to Project Build Paths in Eclipse (Java) Note: It is much better to reference JARs that exist in your project or in other projects - this allows you to check in all of your dependencies to your version control system.

7 Ways to Add JARs to Project Build Paths in Eclipse (Java)

(You are using version control, right?) Use one of the following methods. Method 1 This is the preferred method, as it allows different developers of a common project to locate their external jars in different places. 1Right click the project name and navigate to Build Path. 2Select Configure Build Path... and the project properties window will appear showing your build path configurations. 3Click Add Variable... 4Click Configure Variables... 5Click New... 6Type a name for the new variable.

Java and “& 0xFF” example. Before you understand what is & 0xFF, make sure you know following stuffs : Bitwise AND operator, link.Converts hex to/from binary, and decimal to/from binary.

Java and “& 0xFF” example

In short, & 0xFF is used to make sure you always get the last 8 bits. Let’s see an example to convert an IP address to/from decimal number. 1. Convert IP Address To Decimal It’s a common practice to convert IpAddress to decimal and store it into database for better calculation and comparison. Testing IP address = 192.168.1.2 Decimal Number = 3232235778 To convert 192.168.1.2 to decimal (base 10) the formula is: 192 x (256)^3 + 168 x (256)^2 + 1 x (256)^1 + 2 (256)^0 = ? 7 Ways to Add JARs to Project Build Paths in Eclipse (Java) Display tag library - Simplest case, no columns. Basic table The simplest possible usage of the table tag is to point the table tag at a java.util.List implementation and do nothing else.

Display tag library - Simplest case, no columns

The table tag will iterate through the list and display a column for each property contained in the objects. Typically, the only time that you would want to use the tag in this simple way would be during development as a sanity check. For production, you should always define at least a single column. Basic, columns This example starts to show you how to use the table tag. Note that you have one column tag for every column that you want to appear in the table.

You can define the content of a column by adding a property attribute to the column tag or adding a content to the tag. <display:column property="email" /><display:column title="email">email@it.com</display:column> There are two ways to define the content of a column. Adding content in the column body you can easily concatenate or "decorate" fields available in objects in the list.

Exceptions

Java EE 6 Technologies. Part III: Developing JSP Custom Tags. Oracle Technology Network > Java Software Downloads View All Downloads Top Downloads New Downloads What's New.

Part III: Developing JSP Custom Tags