25 junho 2014

Web Article - 10 common mistakes Java developers make when writing SQL

1. Forgetting about NULL
2. Processing data in Java memory
3. Using UNION instead of UNION ALL
4. Using JDBC Paging to page large results
5. Joining data in Java memory
6. Using DISTINCT or UNION to remove duplicates from an accidental cartesian product
7. Not using the MERGE statement
8. Using aggregate functions instead of window functions
9. Using in-memory sorting for sort indirections
10. Inserting lots of records one by one

Full Article

20 maio 2014

Java - String Split with “.” (dot)

package com.lopes.tests;

public class StringSplitWithDot {

    public static void main(String[] args) {

        // Get only 12345
        String number = "12345.00000";

        // Split with error
        String splitError = number.split(".")[0];
        System.out.println("splitNumber " + splitError);

        // Correct way to split by dot(.)
        // "." is a special character. You have to use "\\." to escape this character
        String splitCorrect = number.split("\\.")[0];
        System.out.println("splitNumber " + splitCorrect);

    }

}


Output of Correct way
splitNumber 12345

JSF 2.2 New Features in Context

Now that JSF 2.2 is complete, this session demonstrates the most important features in the context of a self-contained sample application.

The features covered include
 • HTML5-friendly markup
• Faces Flow
• Resource library contracts

You will learn how JSF is still relevant in today's enterprise software stack. Specifically, you will learn why you would want to upgrade to JSF 2.2 rather than opting for a different architecture entirely.

23 abril 2014

Web Article - 10 JDK 7 Features to Revisit, Before You Welcome Java 8




1) Type inference2) String in Switch
3) Automatic Resource Management
4) Fork Join Framework
5) Underscore in Numeric literals
6) Catching Multiple Exception Type in Single Catch Block
7) Binary Literals with prefix "0b"
8) Java NIO 2.0
9) G1 Garbage Collector
10) More Precise Rethrowing of Exception

14 abril 2014

Web Article - Java ZIP File Example

In this tutorial see how to ZIP a file in Java.
ZIP is an archive file format that enables data compression and it is mostly used on files and folders. A ZIP file may contain one or more compressed files or folders. Many compression algorithms have been used by several ZIP implementations, which are ubiquitous in many platforms. It is also possible to store a file in a ZIP archive file without compressing it.


Source