Monday, July 25, 2011

What are new features in Java 7 or JDK7?

I was looking at all new features of Java 7. List of features include to simplify common, day-to-day programming tasks: Strings in switch statements, try-with-resources statements, improved type inference for generic instance creation ("diamond" or "<>"), simplified varargs method invocation, better integral literals, improved exception handling (multi-catch), and my favorite feature fork-join framework. I found many blog posts mentioning them. I developed following simple examples to demonstrate all new JDK7 features. Click on following links to see the example code and its detailed explanation:

JDK7 feature's list of examples:
  1. An example of new feature in JDK 7 which can do type inference for generic instance creation.
  2. Try-with-resources statement
  3. String object is allowed in switch-case statement
  4. Catch multiple exceptions in a single catch block & more precise exception re-throw example
  5. Express literal values in binary with prefix '0b' (or '0B') for integral types (byte, short, int and long)
  6. Fork-Join Framework for supporting Parallel Programming
  7. Performance comparison of Executor framework vs ForkJoin framework’s RecursiveTask feature in java or JDK7 
  8. More informative varargs warnings

Following are few links/posts I found informative and useful:
  1. 7 new cool features in Java 7:
  2. Hidden Java 7 Features – System and Process CPU Load Monitoring:
  3. JDK 7 Features: 
  4. Java Fork/Join for Parallel Programming:
  5. New Java 7 Language Features:
There are lots of new goodies, I will add more details regarding Java 7 features once I am ready with running examples.

Recently, I read about Java 7 having some severe bugs. Quoting "Some loops are mis-compiled due to errors in the HotSpot compiler optimizations, which causes programs to fail. This bug affects several Apache projects directly — Apache Lucene Core and Apache Solr have already raised a warning, noting that the bug might be present in Java 6 as well." For more details visit following blogs:
  1. Java7 Hotspot Loop Bug Details:
  2. Java 7 Ships With Severe Bug: 
  3. Don’t Use Java 7, For Anything:

    Thursday, July 21, 2011

    Getting started with Android application development

    Many Java developers have shown their interest in Android application development but they don't know where to start. Few are planning to join Android training in some training institute. I advice not to do that. Internet is your best teacher. That is the way, I started learning Android.

    Following are few links which I started reading to understand Android platform. These links will give you good idea about Android basics and help you setup Android development environment using Eclipse IDE:

    Tuesday, July 12, 2011

    Why do I get missing "use strict" statement error when I run my java script code through Crockford's JSLint?

    Strict Mode is a new feature in ECMAScript 5 that allows you to place a program, or a function, in a "strict" operating context. This strict context prevents certain actions from being taken and throws more exceptions. Strict mode helps out in a couple ways:
    • It catches some common coding bloopers, throwing exceptions.
    • It prevents, or throws errors, when relatively "unsafe" actions are taken (such as gaining access to the global object).
    • It disables features that are confusing or poorly thought out.
    Also note you can apply "strict mode" to the whole file... Or you can use it only for a specific function. Conclusion is it helps you make fewer errors, by detecting more things that could lead to breakages.

    1. You can also look at article about that : John Resig - ECMAScript 5 Strict Mode, JSON, and More 
    2. You can try JSLint (The JavaScript Code Quality Tool) online by visiting: 
    3. JSHint looks pretty interesting too:

      Example code to connect node.js REST service with Eureka discovery service

      Eureka is Spring based discovery service developed by Netflix. To know how Eureka is used at Netflix visit: