Saturday, January 26, 2013

JDK8 : Development Milestones and road map!!!

The JDK 8 development schedule is divided into a sequence of milestone cycles, most six to eight weeks in length, with builds occurring roughly once each week.

There will be no formal beta or early-access releases. Major features and other potentially-destabilizing changes will be targeted for integration early in a specific milestone.

Here is the milestone schedule, with the features targeted to each cycle:

JDK 8 Milestones & Road Map.


Saturday, January 19, 2013

Maven: Getting started with Apache Maven 3.0.4 (Part 2)

In the last article part 1, I have explained the steps for downloading, setting up and installation verification on both Mac and windows successfully, and if everything was going okay then you are ready for this part.

Here I will explain how to create, compile and test a basic maven project, with explanation of POM (Project Object Module), then understanding of maven build life cycle which it provides.

Creating a maven project

Now with everything set upped and all the steps has been done successfully? Great! Let's get down to the business, by creating a first maven project. Specifically with maven goal archetype:generate.
  1. First create new folder for your project, for example "C:\Hello Maven".
  2. Open new command-line on Windows or terminal on Mac and run the following command:


  3. If this is the first time you run this command you will see on command-line a bunch of downloads taking place, which used to be referenced locally by your projects after that.

  4. After downloads are finished you will see a rather long list of local or remote archetypes. Each archetype has a number, name and short description explaining the purpose of the archetype and what is it. By now we will use the default one (in my case) with the number 244 (244: remote -> maven-archetype-quickstart(An archetype which contains a sample Maven project.)).

    When being asked for the archetype number, type 244 followed by enter.

    Note: The number depends on if you are running from local or remote repositories.

    Note: If you are using internet via proxy server, then you should specifies the proxy server information according to access the internet, you provide these information via the maven settings.xml file, which is located inside maven home directory ".m2". The settings should be as the following:

  5. Then you will be asked to choose the archetype version, the default one is the most stable version lets choose that (typically choose the default in this case number 6). Types 6 then hit enter.
  6. After that, you will be asked to enter the following properties (Maven project co-ordinates) respectively:
    1. GroupId co-ordinates are used to specify the hierarchical location of a project within a Maven repository. In this case, the repository is the local Maven repository present in your filesystem. GroupId co-ordinates are typically the root package and thus can be shared by multiple projects within an organization.

    2. The artifactId is an identifier for your project and version here refers to the project version.

    3. Packages refer to the reverse DNS root package name that contains all your source and test classes.

    artifactID identifiers will be used when artifacts are deployed in repositories and used as dependencies for other projects.

    For version just hit enter and "1.0-SNAPSHOT" will be used, rather than that type what version name you want.

    After finishing all the parameters, you will get confirmation question about your entered data, choose yes and upon completion you should see the following on the command-line:

What happened just here?

We have asked a maven plugin to create a maven project for us by firing the following command "mvn archetype:generate".

A new project for apache maven can either be created by a "hand-crafted" with a minimal POM.xml file with folder creation or generated through a maven project archetype.

Surprisingly, what exactly have maven created for us????

Simple answer, the following:

It creates a maven project, with commonUI (artifactId) root project contains src and pom.xml file. The source contains the main folder which contains the project source classes, and another one test which contains all your test classes, both has the same hierarchy created as when get asked for package property eg.com.tm.mvn.proj. Finally in main folder there is a basic application class contains hello world console app (App.java), and its unit test class under test folder (AppTest.java).

Compiling and testing the project

Up to this point we have created a maven project at hand; then the most interesting part is compiling and testing the previously created project.

If you are new to Apache Maven, which probably why you are here ;), then this will be your first introduction to maven build lifecycle, as maven has number of built-in lifecycle goals.

To compile:

  1. Navigate to you project folder which contains the pom.xml file, in this case commonUI, and fire the following command:
  2. After this command, Maven will begin downloading the project dependences into your local repository, and proceeds compiling your project. At the end print the following on the console:

  3. The previous command triggers the java compiler associated to the project pom.xml file, it is default to JDK 1.5+ and indeed the pom.xml can be modified to add any other JDK source to be used for compilation.
  4. The successful runs of the compile maven goal will generate a target folder, which contains all compiled source classes. the directory structure should be as the following:

To Test:

After successful compilation of your project, now it is the time for testing. Maven recognizes that software should be tested before goes to the next step, it do this as default behavior of build lifecycle with built-in goal called test. This makes TDD (Test Driven Development) implementation more easer for development teams to integrate in their development process.

When the default convention is being used in maven project, by having src\test folder that contains all tests for the code. Then just run the following command to initiate the test process:

This command triggers the test process to run all test classes under src/test folder, after successful completion you should echoed back with a brief testing report on the terminal with the following output:

And the folder structure will be as the following:
The surefire-reports contain the testing report for each test class and suite, and folder test-classes contain the compiled test unit classes. Surefire is a plugin used for testing report generation and used by default by maven.

Finally we have now reached out to the end of the article, hope you enjoy it and being useful to you, for any question just leave your comment.

Thursday, January 17, 2013

Netbeans: JDK (jdkhome) not found use default one??

I frequently using Netbeans to test new functionalities, and at the same time always updating my JDK version to the most new version.

In my case I was using Netbeans 7.2.1 installed on JDK 7_u10 and for security issue there is a new JDK 7.0_u11 available to download, and I have downloaded it and install it and finally removing the old version u10.

When starting Netbeans you will get the following annoying message
If you hit YES the Netbeans use the new installed one and starts, but if you hit NO it will not start.

The problem is when you start it again it will show the same message even if you have registered the new JDK in platforms, and at the same time it doesn't update its configuration.

I have searched for the config file that it uses for lunching the next time. After one day of searching, I have found it inside the following location:

Example:

Open the file with you favorite text editor such Notepad++, and search for "netbeans_jdkhome"

And I changed it to

Run the Netbeans and the message disappeared ;)

Monday, January 14, 2013

JDeveloper: On the fly view file content; a feature inside jdeveloper.

While I am working on jdeveloper in my case (JDeveloper 11.1.2.3.0), I have found a handy feature at hand, file content viewer on the fly.

In the project navigator panel, navigate to any file like java, xml, pictures, scripts or any node files, and instead of opening the file inside the code window. You can view the content of the file by doing the following; go to the file by just hover on it by the mouse (don’t select it) then hit Shift key and you will see the content of the file as the following:





Monday, January 7, 2013

Maven: Getting started with Apache Maven 3.0.4 (Part 1)

What is maven?
Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

Maven's Objectives
Maven's primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with:
  • Making the build process easy.
  • Providing quality project information.
  • Providing guidelines for best practices development.
  • Allowing transparent migration to new features.

Providing quality project information
It also provides plenty of useful project information that is in part taken from your POM and in part generated from your project's sources. For example, Maven can provide:
  • Change log document created directly from source control.
  • Cross referenced sources.
  • Mailing lists.
  • Dependency list.
  • Unit test reports including coverage.

Providing guidelines for best practices in development and testing
Maven aims to gather current principles for best practices development, and make it easy to guide a project in that direction.

For example, specification, execution, and reporting of unit tests are part of the normal build cycle using Maven. Current unit testing best practices were used as guidelines:
  • Keeping your test source code in a separate, but parallel source tree.
  • Using test case naming conventions to locate and execute tests.
  • Have test cases setup their environment and don't rely on customizing the build for test preparation.
Maven also aims to assist in project workflow such as release management and issue tracking.

Maven also suggests some guidelines on how to layout your project's directory structure so that once you learn the layout you can easily navigate any other project that uses Maven and the same defaults.
For more information and a complete set of features about maven please see the references below.
Whatever the reasons that made you choose Maven (be it build automation, dependency management, standardization, testability, lifecycle management, continuous integration, or any other industry best practice), This and coming articles will get you up and running in the shortest time possible.
Typically we now have solid information about Maven. Let's dirt our hands with the installation process on both windows and Mac OS X as those are my main development operating systems. The Installation on different operating systems is not far from the provided steps below, enough talking and let's goes ahead with coding.

Prerequisite software pieces:
  1. JDK 1.5 or above to allow maven installation process goes successfully, not JRE because it is not sufficient.
  2. Apache Maven v3.0.4, and it could be downloaded from here (download).
Installing Maven on Windows and Mac OS X operating systems for the first time.

Here we will set up Maven on various platforms and host environments.

Setting up Apache Maven on Windows:
  1. Maven is a command line tool, and needs to be integrated with windows environment variables. It is very easy to setup and it is Java dependent.

  2. Download and unzip the distribution archive, i.e. apache-maven-3.0.4-bin.zip (as of this writing) to the directory you wish to install Maven 3.0.4. These instructions assume you chose C:\apache-maven-3.0.4 which will be created from the archive.

  3. Add the M3_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, and then adding the M3_HOME variable in the system variables with the value C:\apache-maven-3.0.4. Be sure to omit any quotation marks around the path even if it contains spaces.

  4. Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.

  5. In the same dialog, update/create the Path environment variable in the user variables and prepend the value %M3_HOME%\bin to add Maven available in the command line.

  6. In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.6.0_38 and that %JAVA_HOME%\bin is in your Path environment variable.

  7. See the below Figure 1 which summaries the steps from 3 to 6.




    Figure 1: Maven windows integration steps
  8. Go to verification step below to ensure that your maven installation goes successfully.

Setting up Apache Maven on Mac OS X:

Installing Maven on the Mac OS X isn’t very different from the installation and setup on Linux. This really shouldn’t be a surprise because OS X is built on top of BSD Linux in the first place.
  1. Extract the distribution archive, i.e. apache-maven-3.0.4-bin.tar.gz to the directory you wish to install Maven 3.0.4. These instructions assume you chose /Applications/Maven_3.0.4 which will be created from the archive.

  2. The next step is to add commands to export the PATH and M3_HOME environment variables in the .bash_login file.

  3. In a command terminal, add the M3_HOME environment variable, e.g.

  4. Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g.

    This environment variable can be used to supply extra options to Maven.

  5. Add M3_HOME/bin environment variable to your path, e.g.

  6. Make sure that JAVA_HOME is set to the location of your JDK, e.g.
    export JAVA_HOME=/usr/java/jdk1.7.0_10 and that $JAVA_HOME/bin is in your PATH environment variable.

  7. Go to verification step below to ensure that your maven installation goes successfully.
Verify the Maven installation:
  1. From Windows, open a new command prompt (Winkey + R then type cmd).

  2. From Mac, open command terminal.

  3. Run

    To verify that it is correctly installed.

  4. You should see something like the following Figure 2, otherwise check the installation steps:


    Figure 2: Maven installation is successful
Apache Maven is now ready and available for use in the command line. It is also available for integration with IDEs and other development tools.

By reaching here you are done the installation and verification steps successfully, congratulations. Next I will explain how to create, compile and test a project.

References:
  1. http://maven.apache.org/
  2. http://maven.apache.org/maven-features.html
  3. http://maven.apache.org/download.cgi

Sunday, January 6, 2013

Others: Human Brain Analysis - Man vs. Woman......A MUST READ!


1. MULTI-TASKING
Women - Multiple process
Womens brains designed to concentrate multiple task at a time.
Women can Watch a TV and Talk over phone and cook.

Men - Single Process
Mens brains designed to concentrate only one work at a time. Men can not watch TV and talk over the phone at the same time. they stop the TV while Talking. They can either watch TV or talk over the phone or cook.

2. LANGUAGE
Women can easily learn many languages. But can not find solutions to problems. Men can not easily learn languages, they can easily solve problems. That's why in average a 3 years old girl has three times higher vocabulary than a 3 yeard old boy.

3. ANALYTICAL SKILLS
Mens brains has a lot of space for handling the analytical process. They can analyze and find the solution for a process and design a map of a building easily. But If a complex map is viewed by women, they can not understand it. Women can not understand the details of a map easily, For them it is just a dump of lines on a paper.

4. CAR DRIVING.
While driving a car, mans analytical spaces are used in his brain. He can drive a car fastly. If he sees an object at long distance, immediately his brain classifies the object (bus or van or car) direction and speed of the object and he drives accordingly. Where woman take a long time to recognize the object direction/ speed. Mans single process mind stops the audio in the car (if any), then concentrates only on driving.

5. LYING
When men lie to women face to face, they get caught easily. Womans super natural brain observes facial expression 70%, body language 20% and words coming from the mouth 10%. Mens brain does not have this. Women easily lie to men face to face.
So guys, do not lie face to face.

6. PROBLEMS SOLVING
If a man have a lot of problems, his brain clearly classifies the problems and puts them in individual rooms in the brain and then finds the solution one by one. You can see many guys looking at the sky for a long time.
If a woman has a lot of problems, her brain can not classify the problems. she wants some one to hear that. After telling everything to a person she goes happily to bed. She does not worry about the problems being solved or not.

7. WHAT THEY WANT
Men want status, success, solutions, big process, etc... But Women want relationship, friends, family, etc...

8. UNHAPPINESS
If women are unhappy with their relations, they can not concentrate on their work. If men are unhappy with their work, they can not concentrate on the relations.

9. SPEECH
Women use indirect language in speech. But Men use direct language.


10. HANDLING EMOTION
Women talk a lot without thinking. Men act a lot without thinking.

By: Engineer Vs Doctor