Tuesday, January 31, 2012

Know Your Programming Language Author

Programming Languages - Author
Linux - Linus Torvalds
Perl - Larry Wall

Monday, January 30, 2012

Meditation

Cannon’s guide to meditation
    
If you’re sitting, move to the edge of your chair and make your back straight. Or, stand up straight.
    
Close your eyes and breathe in through your nose, into your stomach and hold it there for a couple of counts. Then breathe back out. 
    
Slowly breathe in for a count of eight and then hold it for a count of two, then breathe back out for a count of eight. Place your attention on your breath, either on the tip of your nose, at the feel of your stomach as it moves or at the travel of air coming through your throat into your lungs and then back out. 
    
Repeat the process.

Monday, January 16, 2012

Apache Maven

Apache Maven, is an innovative software project management tool, provides new concept of a project object model (POM) file to manage project’s build, dependency and documentation. The most powerful feature is able to download the project dependency libraries automatically.

Check maven version to see if maven is already installed in your Ubuntu box : mvn -version
Install maven in Ubuntu : sudo apt-get install maven2

Refer for more maven details about local repository, central repository and remote repository : http://www.mkyong.com/tutorials/maven-tutorials/

Maven central repository : http://repo1.maven.org/maven2/

Note : If the “version” tag is ignore, it will upgrade the library automatically when there is a newer version.

Include “Maven coordinates” into “pom.xml” file, under “dependency” tag.

maven Command to skipTest, clean and install from cmd prompt :
mvn -DskipTests clean install

Sync Maven Project with Eclipse (Run this command where pom.xml in your java project exists)
mvn eclipse:eclipse

You can download jars from maven repository : http://mvnrepository.com/artifact/org.hibernate/hibernate-tools/3.2.0.ga

Install maven manually in linux box

Download maven
  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 /usr/local/apache-maven. The subdirectory apache-maven-3.0.4 will be created from the archive.
  2. In a command terminal, add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.4.
  3. Add the M2 environment variable, e.g. export M2=$M2_HOME/bin.
  4. Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven.
  5. Add M2 environment variable to your path, e.g. export PATH=$M2:$PATH.
  6. Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.5.0_02 and that $JAVA_HOME/bin is in your PATH environment variable.
  7. Run mvn --version to verify that it is correctly installed.
Create a maven project with below command : 

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

cd my-app

The src/main/java directory contains the project source code, the src/test/java directory contains the test source, and the pom.xml file is the project's Project Object Model, or POM.

mvn package 

package - take the compiled code and package it in its distributable format, such as a JAR.
Execute Below command if you want to open the project in eclipse.

mvn eclipse:eclipse
mvn eclipse:clean 

If above command not executed you will UnSupported error while you do Import maven project in eclipse.

Install maven plug-in in eclipse 

Help -> Install Eclipse Market Place -> maven


Wednesday, January 11, 2012

Hindi

ping karo - ping me
tk  - ok

Spring Framework

Why Spring ? 

Spring framework is an open source Java platform that provides comprehensive infrastructure support for developing robust Java applications very easily and very rapidly.

Spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 2MB.

Spring framework targets to make J2EE development easier to use and promote good programming practice by enabling a POJO-based programming model.

Spring enables developers to develop enterprise-class applications using POJOs. The benefit of using only POJOs is that you do not need an EJB container product such as an application server but you have the option of using only a robust servlet container such as Tomcat or some commercial product.


Dependency Injection (DI):

The technology that Spring is most identified with is the Dependency Injection (DI) flavor of Inversion of Control. The Inversion of Control (IoC) is a general concept, and it can be expressed in many different ways and Dependency Injection is merely one concrete example of Inversion of Control.

What is dependency injection exactly? Let's look at these two words separately. Here the dependency part translates into an association between two classes. For example, class A is dependent on class B. Now, let's look at the second part, injection. All this means is that class B will get injected into class A by the IoC.


Dependency injection can happen in the way of passing parameters to the constructor or by post-construction using setter methods. As Dependency Injection is the heart of Spring Framework

Spring is an extremely powerful Inversion of control(IoC) framework to helps decouple your project components’ dependencies.

Refer : http://www.vaannila.com/spring/spring-tutorial/spring-tutorial.html for spring IDE setup, and know about setter injection, constructor injection, MVC framework, Spring Hibernate Integration etc..

Spring Interceptor -
Interceptor means when the operation travels to other end, we intercept before as pre_handle and change the behavior and when the operation is done we do post_handle for the same is called interceptor.

Example : pre_insert, post_insert, pre_save, post_save. When the save method called before we call pre_insert and after save we call post_insert

Reference : http://www.tutorialspoint.com/spring/spring_overview.htm
// Below script tag for SyntaxHighLighter