Saturday, November 2, 2013

Stat 2.1x Course: Introduction to Statistics: Descriptive Statistics

Hi Guys,

I am now taking a course on Stat 2.1x: Introduction to Statistics: Descriptive Statistics. 
Just completed the week 1 and truly speaking it looks very interesting to me. 

Loving the way Prof. Ani Adhikari is teaching. Explaining the concepts so clearly 
and interestingly..

I am already feeling excited that within 5 weeks from today I will learn many 
new concepts of Statistics. 

If you guys are interested, please check the link:

Enjoy learning Statistics.

@ All Indian: Happy Diwali.


Saturday, September 21, 2013

Implementation of "Triangular Number Sequence" with Scala

Triangular Number Sequence is 1, 3, 6, 10, 15. This is very basic mathematical concept.
This sequence is getting generated from a pattern of dots which form a Triangle.

To know more about Triangular Number Sequence, please check this page => Triangular Number Sequence

At this page only I saw one very good example of how we can use this sequence in solving problems. One problem is given @: A Walk in The Desert

So I thought of solving the problem with Functional Programming i.e. Scala. 
The solution code is @ Solution to A Walk in The Desert

The strategy I followed:
  • Consideration: My starting position is {0, 0} [FYI: Always first X co-ordinate and then Y co-ordinate]
  • Strategy:
  • In every odd step => Either I am going towards North or toward South i.e. my X co-ordinate is constant
  • In every even step => Either I am going towards East or toward West i.e. my Y co-ordinate is constant
  • In every steps, my co-ordinate(either X or Y based on whether my step is even or odd) will  change the sign.
Feel free to provide your comment if you see any scope of improvement. Thanks.

Friday, September 20, 2013

Coursera Functional Programming Principles in Scala Course by Martin Odersky

Hurray!!! I was waiting for this course Functional Programming Principles in Scala Course by Martin Odersky since long time. It started now and it is really helping me to think differently. It is creating a habit inside me - "Can I do this in better way?". After spending 9 hours (sometime 10 hours) in office, I still manage to check Scala every day, ok sorry almost every day.

Just completed the first week's exercises and received 9.56/10. I think this is not a bad score. But again "Can I make this better?". Let's see if I can do that.

First week's (assignment + tutorial) not only educates me about basics of Scala programming Language & Functional Programming, It helped me to understand few basic mathematical stuffs also. I love the way how easily I can implement mathematical equations into Functional programming using Functions.

While browsing internet, I got this website. Math Is Fun. This website is having very good collections of mathematical concepts and most importantly quizzes to implement those concepts. Now my new target is to implement those mathematical concepts using Scala. All my source code will be available @ Github.

It's time to go for bed now. Good Night.

Tuesday, September 10, 2013

Saturday, August 17, 2013

Java Persistency API 2.0 (JPA): Hibernate JPA Metamodel Generator With Eclipse and Maven

One of the key features introduced in JPA 2.0 is the Criteria API, which brings a unique capability to the Java language: a way to develop queries that a Java compiler can verify for correctness at compile time. The Criteria API also includes mechanisms for building queries dynamically at run time.

In this post, I will share my experience how I configured my Eclipse to create Static Meta Model classes.


Since the Static Meta Model files are generated classes and should automatically changed for each @Entity modification they should placed in the target folder and not comitted to the repository.


Below are the steps that you have to follow:


1. Update pom.xml file:

Please update your pom.xml file with the below code under <dependencies></dependencies>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-jpamodelgen</artifactId>
    <version>1.3.0.Final</version>
</dependency>

<dependency>
    <groupId>org.hibernate.javax.persistence</groupId>
    <artifactId>hibernate-jpa-2.0-api</artifactId>
    <version>1.0.1.Final</version>
</dependency>

2. Configure Eclipse:
Right click on your project -> properties -> Java compiler-> Annotation processing -> mark "enable project specific settings" (rather all the checkboxes on that screen), in the Generated Source Directory put "target/metamodel". 
Screenshot given below:


















Once done, Inside the Annotation processing item there is a Factory Path item. You have to enable this where you have to set the jar you imported via maven to generate the classes. 
You can do it by clicking Add Variable -> M2_REPO -> Extend -> and choose the following path : 


org\hibernate\hibernate-jpamodelgen\1.3.0.Final\hibernate-jpamodelgen-1.3.0.Final
Below is the screenshot:















You have to make sure only that path is checked.

3. Final steps/Adjust Classpath:
Please make sure the target/metamodel folder is on your classpath (right click-> build path -> ad as source folder).






















That's all. From now on every change in Entity Classes will trigger automatic Static Meta Model Generation.

Finally your project structure should look like:





Thursday, August 15, 2013

Integrate Maven with Eclipse

While developing applications with Eclipse, if you have to move from Eclipse to Command Prompt, then after sometime you will feel irritated. That is why it is good to integrate Maven with Eclipse.

Here I will share my experience how I Integrated Maven with Eclipse. Hope it will help you guys:

Tools Needed:

1. Eclipse.
2. Maven

1. Installing Eclipse:
You can go to Eclipse's website and download the latest version of Eclipse to your machine. Once downloaded, extract the downloaded Zip file. That's all. Start enjoying Eclipse now. :-)

2. Integrate Maven with Eclipse:
  • Select Help > Install New Software. This should display the "Install" dialog.
  • Paste the Update Site URL (http://download.eclipse.org/technology/m2e/releases) into the field named "Work with:" and press Enter. Pressing Enter should cause Eclipse to update list of available plugins and components.
  • Choose the component, Click Next. Eclipse will then check to see if there are any issues which would prevent a successful installation.
  • Click Next and agree to the terms.
  • Click Finish to begin the installation process. Eclipse will then download and install the necessary components.
  • Once the installation process is finished, Eclipse will ask you if you want to restart the IDE.
Done. You configured Maven correctly. Enjoy coding ;-)

Wednesday, August 14, 2013

How to Install and Configure Maven on Windows

Maven is a build automation tool used primarily for Java projects. Maven serves a similar purpose to the Apache Ant tool, but it is based on different concepts and works in a different manner.

I don't want to get into details about Maven here. Let's focus :-)

I will share my knowledge about installing and configuring Maven on Windows platform.

It is not required to install Apache Maven on Windows as a service component, we can just download the Maven’s zip file, extract it and configure the Windows environment path variable. That's all we need. Very easy, but very powerful + helpful.

So let's get started.

Tools needed:
  1. JDK
  2. Maven :-)
  3. Windows :-)
1. Verifying Java and JDK (JAVA_HOME):
Make sure JDK is installed, and “JAVA_HOME” variable is added in Windows environment variable which should point to the JDK folder. Below is the screenshot:




































2. Download Maven:
You can download Maven from Apache Maven's official website. Select the latest version and download the zip file. Once the download is finished, extract the downloaded Zip file.



3. Add MAVEN_HOME:
Add a new MAVEN_HOME variable to the Windows environment, and point it to your Maven folder.


































4. Configure Path:
Once MAVEN_HOME is set, add the MAVEN to Path. Append “Maven bin folder” path, so that you can run the Maven’s command everywhere


































5. Verify MAVEN Installation:
Open command prompt in Windows and verify by typing "mvn -version". The result should be:





















Done. You configured Maven correctly. Enjoy coding ;-)