May 22, 2017

Tusshar Kapoor, Sonakshi Sinha, Evelyn Sharma dress alike at Half Girlfriend screening!!

A recent special screening of the Arjun Kapoor-Shraddha Kapoor movie Half Girlfriend saw an unusual synchronization of minds that flummoxed many.

Amitabh Bachchan, Shabana Azmi, Sonu Nigam talk women empowerment

In the movie Bahubali 2, the character of Amarendra Bahubali played by Prabhas feels that merely chopping off the fingers of a man trying to grope women is not enough punishment. He beheads him as capital punishment. Now that can happen in the make-believe world of movies where things are often glorified and gory-fied. But in a dignified cultured society with better sensibilities, matters have to be drastically different.

May 19, 2017

Emma Watson’s dream comes true!

Emma Watson is much excited these days as her dream has come true! The actor has finally got a chance to work with her dream actor ‘Tom Hanks’ in their upcoming film “The Circle”.

The Harry Potter star confesses that it was an honour for her to share screen space with Hanks in their upcoming directoral by James Ponsoldt. Based on David Eggers’ book with same name, this techno-thriller hits Indian Cinemas under the banner of MVP Entertainment on May 19.

May 17, 2017

'God-woman' Radhe Maa turns actress!

Mamtamayi Radhe Maa aka Sukhvinder Kaur, who had grabbed national attention with an array of controversies is back with a bang. Well, this time in a brand new avatar.

May 15, 2017

RJ Malishka makes Bollywood debut with Vidya Balan's Tumhari Sulu..

The growing exciting cast of T-Series and Ellipsis Entertainment's Vidya Balan-starrer, Tumhari Sulu, has been in the news. From theatre ace Manav Kaul who will play Sulu's husband to the sexy Neha Dhupia who will essay the role of a radio boss, the quirky slice-of-life comedy, being directed by noted ad filmmaker Suresh Triveni, has become the talk of the town.

Is Shah Rukh Khan-luck rubbing off on Evelyn Sharma?

And you thought only Shah Rukh Khan and Salman Khan had fans waiting for them outside their Bandra residences. Wait till you are surprised!

A week ago, the Yeh Jawaani Hai Deewani (YJHD) actress Evelyn Sharma was taken aback to find two fans from Punjab waiting for autographs and selfies outside her Bandra abode. When she was preparing to leave for a shoot, they walked up to her and told her they had been coming there from two days and standing below her building for a couple of hours to get a peek of the actress.

May 14, 2017

Popular TV stars describe their mom in one sentence..

On the occasion of Mother’s Day, we spoke to a few popular TV celebs and asked them to describe their mom in one sentence. Here is what they said:
Urvashi Dholakia, who will be soon seen in yet another power packed role in Ekta Kapoor's Chandrakanta affirmed that she has a great respect for all the mother's not just today but everyday. "As a child, we wake up every morning and get to work and start our day. But Mothers wake up and pray. They pray for our joyous life, they pray so that we can remain strong. If they sense any trouble coming at us, they cut it like a knife. We as children need to understand that she will 'always' be holding our hand," says Urvashi.

IN PICS: Jamai Raja actor Sandit Tiwari ties the knot..

Sandit Tiwari, who did the shows like Beend Banoongaa Ghodi Chadhunga, Me Aajji Aur Sahib,  Jamai Raja and Mahisagar recently tied knot with his long time girlfriend Priyankona Das. She is a software professional and works with a leading IT firm.

May 10, 2017

Sridevi’s MOM to release in four languages!

 Boney Kapoor’s MOM presented by Zee Studios featuring superstar Sridevi, Nawazuddin Siddiqui and Akshaye Khanna will now be releasing nationwide in three languages including Tamil, Telugu and Malayalam besides Hindi.

Sridevi & A R Rahman promotes MOM on the sets of ‘Sa Re Ga Ma Pa Lil Champs 2017’!

Mother’s Day is just around the corner and to celebrate this special day, two special guests – superstar Sridevi and music maestro A R Rahman recently visited the sets of the singing reality show – Sa Re Ga Ma Pa Lil Champs to promote their forthcoming film, MOM.

Nadeem back with Suneel Darshan’s Ek Haseena Thi Ek Deewana Tha..

After launching the motion poster of Ek Haseena Thi Ek Deewana Tha, filmmaker Suneel Darshan has unveiled the musical teaser of his forthcoming musical thriller starring Upen Patel, Shiv Darshan and introducing sensational new find Natasha Fernandez.

May 09, 2017

Urvashi Dholakia learns horse-riding for Chandrakanta..

Urvashi Dholakia, who played the iconic role of Komolika Basu in 'Kasautii Zindagii Kay' will be playing an antagonist in Ekta Kapoor’s upcoming show Chandrakanta. She is playing a fearless, ambitious queen Iravati in the show, and is required to ride a horse. To get into the skin of the character, she went the extra mile and underwent extensive training in horse riding.

May 08, 2017

'Suit Suit' sensation Guru Randhawa sings for Vidya Balan's Tumhari Sulu..

The Punjabi "Suit Suit" sensation Guru Randhawa visited the set of T-Series & Ellipsis Entertainment's comedy "Tumhari Sulu" today. Guru's song Suit Suit was a chartbuster and he is now making aggressive inroads into Bollywood.

May 07, 2017

Hibernate Tutorial..

Hibernate is an ORM tool and is used in the data layer of an application. It implements JPA (Java Persistence API), which is a set of standards that have been prescribed for any persistence implementation.

Suppose you want to store user information in the database. Most of the time, you will be using a relational database. You will be creating a user table, which has the columns corresponding to variables present in your Java class. i.e a class corresponds to a table, and an object of a class corresponds to a row in the table.  We need to write SQL queries, to select, insert, update details in the user table.

We have objects in Java, but not in the database, so we need to take the values of member variables from Java object and map it in the SQL queries. If you add a new column in the table, then you need to make changes in Java classes.

What if an object has a reference to another object, then you need to create tables with foreign keys.

Also, you need to manually do the data-type conversion.

Hibernate solves the above pain points.

Suppose, you want to save the object in the database, without Hibernate, we need to do following things:
  • We need to create the database table.
  • We need to do JDBC configuration.
  • We need to write a model object, which is the object which we need to save.
  • A service method, which will create this model object.
  • A DAO class, which will generate the SQL queries to save the object.
If you are using Hibernate, then you need to:
  • You need to write a hibernate configuration file (hibernate.cfg.xml), which will give information to Hibernate to which database it needs to connect.
  • Create a model object.
  • Write a service method, which will create an instance of a model object and pass it to Hibernate API.
Hibernate Annotations
  • @Entity annotation is used to mark the class as an Entity bean. So the class should have at least have a package scope no-argument constructor. When a Hibernate finds a class with @Entity annotations (entry of that class should be present in hibernate.cfg.xml), it will recreate it as a table in your database. If you specify name attribute with @Entity annotation e.g @Entity (name="User_Details"), then Hibernate will insert/ update/ fetch the record from User_Details, instead of from the table, whose name is same as Entity class name.
  • @Id annotation is used to specify the identifier property of the entity bean and should be kept above the member variable which you want to be used as primary key. The placement of the @Id annotation determines the default access strategy that Hibernate will use for the mapping. If the @Id annotation is placed over the field, then filed access will be used. Instead, if it placed over the getter method of that field, then property access will be used. Here we use property access.
  • @GeneratedValue annotation will tell hibernate to automatically generate values using an internal sequence. Therefore we don’t have to set it manually. We can use it along with @Id and make our primary key automatically generated rather than setting each time. We can also specify a strategy on how the values will be generated like @GeneratedValue(strategy=GenerationType.AUTO). AUTO is the default if we don’t give a strategy. Other values are IDENTITY, SEQUENCE and TABLE, which are actually dependent on the database that we use. AUTO is the preferred option as hibernate will chose the best strategy for us automatically.
  • @Column annotation is used to specify the details of the column to which a field or property will be mapped. If the @Column annotation is not specified by default the property name will be used as the column name. 
  • @Table annotation is used to specify the table to persist the data. The name attribute refers to the table name. If @Table annotation is not specified then Hibernate will by default use the class name as the table name. 
  • @Basic annotation without any parameters is same as without having it. It just tells hibernate to treat it is a field that needs to be saved and is the same behavior without it. However, the use comes when it is used along with its parameters. By default, it is same as @Basic (optional=true) and the field can be not supplied any value (not calling getter) or supplied with a null value. @Basic (optional=false) makes it a non-null field.  If not supplied any value (not calling getter) or supplied with a null value with @Basic (optional=false), you will get an exception: org.hibernate.PropertyValueException: not-null property references a null or transient value.
  • @Transient annotation tells Hibernate not to save this field. Even without this annotation, a static variable or a transient variable is not saved. So the behavior is same for a static variable, transient variable or any other variable with @Transient annotation. If annotations are placed over getters, those placed over fields are ignored and only getters are considered. Even other fields are ignored and all other getters are considered. Hence if you have annotations over any of your getter, then a static variable, transient variable or any other variable will be saved as usual if it has a getter.
  • @Temporal annotation over a date field tells hibernate the format in which the date needs to be saved. For instance, by default, the date will be saved as a timestamp, but to save date alone we can use @Temporal(TemporalType.DATE).
  • @Lob annotation tells Hibernate that this is a large object, not a simple object. So Hibernate creates a CLOB or BLOB based on the type of the object. For instance, if @Lob comes over a string, then Hibernate assumes to use a character large object (CLOB). In the case of array, it will treat it as BLOB.
  • @Embeddable and @Embedded annotations are used when you want to embed one entity in another entity. The attributes of an entity can be common attributes of more than one entity. An embeddable entity can be embedded in more than one entity. 

First Hibernate Application To Save And Fetch Objects using Hibernate APIs
We will be using SQL server 2012 for writing our Hibernate application.

Hibernate uses XML mapping file for the transformation of data from POJO to database tables and vice versa. We will first we need to write a configuration file.  Here is the example of hibernate.cfg.xml for SQL server
< ?xml version='1.0' encoding='UTF-8'? >
< !DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "" >
< hibernate-configuration >
    < session-factory >
     < !-- Database connection settings -- >
        < property name="hibernate.connection.driver_class" >< /property >
        < property name="hibernate.connection.url" >jdbc:sqlserver://;databaseName=scrutinydb< /property >
        < property name="hibernate.connection.username" >khs< /property >
        < property name="hibernate.connection.password" >khs< /property >
        < !-- JDBC connection pool (use the built-in) -- >
        < property name="connection.pool_size" >1< /property >

        < !-- SQL dialect -- >
        < property name="dialect" >org.hibernate.dialect.SQLServer2012Dialect< /property >

        < !-- Disable the second-level cache  -- >
        < property name="cache.provider_class" >org.hibernate.cache.internal.NoCacheProvider< /property >

        < !-- Echo all executed SQL to stdout -- >
        < property name="show_sql" >true< /property >

        < !-- Drop and re-create the database schema on startup -- >
        < property name="" >create< /property >

        < !-- Names the annotated entity class -- >
        < mapping class="com.test.khs.UserDetails"/ >
    < /session-factory >
< /hibernate-configuration >

We need to write the Model Class with annotations and mention it in 'mapping' tag of hibernate.cfg.xml
package com.test.khs;
import javax.persistence.Entity;
import javax.persistence.Id;

public class UserDetails {
    private int userId;
    private String userName;

    public int getUserId() {
        return userId;
    public void setUserId(int userId) {
        this.userId = userId;
    public String getUserName() {
        return userName;
    public void setUserName(String userName) {
        this.userName = userName;

Hibernate will create UserDetails, with two columns userId, userName and when you call save() method, the object will be saved in UserDetails table.
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import com.test.khs.UserDetails;
public class TestHibernate {
    public static void main(String[] args) {
        UserDetails user1=new UserDetails();
        user1.setUserName("Himaanshu Shuklaa");
        //create a session factory
        SessionFactory sessionFactory=new Configuration().configure().buildSessionFactory();
        //get the session from session factory       
        Session savesession=sessionFactory.openSession();
        //to save the object in hibernate;
        Session fetchsession=sessionFactory.openSession();
        //fetch based on the primary key
        user1=fetchsession.get(UserDetails.class, 1);
        System.out.println("*****fetched UserDetails:"+user1.getUserName()+", Id="+user1.getUserId());

If you execute TestHibernate again, then it will delete the previous record the UserDetails table and insert the new one again. This happens because of '' property in hibernate.cfg.xml, which was,
< property name="" > create < /property >

To retain the previous data, you need to change 'create' to 'update'.

If you set to update and then execute TestHibernate class again, then it will insert a new record in the table.

Suppose you have executed TestHibernate with as 'create' or with 'update' and then added a new variable in UserDetails class. An error 'Invalid column name' when you try to execute TestHibernate with as 'update'.

Hibernate creates and insert the record in the UserDetails table, where the name of the table is same as Entity class name. What if the class name is different? Or you want to insert the record in a table with the different name? To resolve this issue by specifying the name in @Entity annotation. Also, by default the property name will be used as the column name, you can change it with the name property of @Column annotation.

Example of Hibernate Annotations @Embeddable and @Embedded

This example will add Address details in the Employee table.
import javax.persistence.Column;
import javax.persistence.Embeddable;

public class Address {
    @Column(name = "street")
    private String street;
    @Column(name = "city")
    private String city;
    public String getStreet() {
        return street;
    public void setStreet(String street) {
        this.street = street;
    public String getCity() {
        return city;
    public void setCity(String city) { = city;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Table(name = "employee_details")
public class Employee {
    @Column(name = "id")
    private int empId;
    @Column(name = "emp_name")
    private String empName;
    @Column(name = "emp_address")
            @AttributeOverride(name = "street", column = @Column(name = "emp_add_street")),
             @AttributeOverride(name = "city", column = @Column(name = "emp_add_city"))})
    private Address empAddress;
    public int getEmpId() {
        return empId;
    public void setEmpId(int empId) {
        this.empId = empId;
    public String getEmpName() {
        return empName;
    public void setEmpName(String empName) {
        this.empName = empName;
    public Address getEmpAddress() {
        return empAddress;
    public void setEmpAddress(Address empAddress) {
        this.empAddress = empAddress;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class EmbedEmployeeTest {
    public static void main(String[] args) {
        Employee employee=new Employee();
        Address empAddress=new Address();
        employee.setEmpName("K Himaanshu Shuklaa");
        //create a session factory
        SessionFactory sessionFactory=new Configuration().configure().buildSessionFactory();
        //get the session from session factory       
        Session savesession=sessionFactory.openSession();
        //to save the object in hibernate;

When you execute EmbedEmployeeTest, it will create employee_details table with id, emp_add_city, emp_add_street, emp_name as the columns with values 1, Kempten, Alfred-weitnauer-straße, K Himaanshu Shuklaa respectively.

May 05, 2017

May 03, 2017

This is how yesteryear actress Mumtaz looks like..

Yesteryear actress Mumtaz, started her career as a child actress in Sone Ki Chidiya in 1958. After that the pretty actress had worked with most of the leading heroes and delivered numerous hits like Do Raste, Roti, Dushman, Apna Desh, Aap Ki Kasam, Sachcha Jhottha, Bharmchari, Hare Rama Hare Krishna etc.

May 02, 2017

Apache ANT Interview Questions And Answers

ANT stands for Another Neat Tool and is a Java based build tool from Apache Software Foundation. Apache Ant's build files are written in XML and they take advantage of being open standard, portable and easy to understand.

As a developer, we compile the code, package the binaries, deploy those binaries to the test server, test the changes and sometimes copy the code from one location to another. We can automate these tasks in a simplier way by using Apache Ant.

First Look Of Baaghi 2

May 01, 2017

A Grateful Crow..

During summers, I keep some bowls of fresh water in the balcony for birds. Every day I rinse, and refilled them with fresh water. To be very frank, I have a super selfish motive behind this. I believe, our present time is seed time; in the other world we shall reap as we sow now. I am a water baby, I do this so that I will always get sheer abundance of water.

April 27, 2017

Vinod Khanna dies at 70, was suffering from bladder cancer

Veteran actor Vinod Khanna, who was suffering from cancer, passed away on Thursday morning at Mumbai's HN Reliance Hospital.

BARC Ratings (Impressions)- Week 16, 2017

Maven Interview Questions And Answers

What is Maven?
Apache Maven is an advanced build tool to support the developer at the whole process of a software project. Maven allows the developer to automate the process of the creation of the initial folder structure for the Java application, performing the compilation, testing, packaging and deployment of the final product.

Since Maven is implemented in Java which makes it platform-independent.

Common activities we perform while developing an application:
  1. Multiple Jars: if you are using couple of frameworks like (Spring or Hibernate etc) in your application, then you need to include all the required jars.
  2. Dependencies: When you are adding multiple jars, you might face a issue where one jar is dependent on another jar, which in turn depend on some other jar. You need to make sure, you have added matching versions of jars.
  3. Setting Project Structure:  We need to set proper project structure.
  4. Building, deploying and publishing.

Maven helps us in these 4 activities, it has very elegant solution for each activity.

What are the key features of Maven?
  • Convention over configuration: Maven tries to avoid as much configuration as possible, by choosing real world default values and supplying project templates (archtypes).
  • Dependency management: It is possible to define dependencies to other projects. During the build, the Maven build system resolves the dependencies and it also builds the dependent projects if needed.
  • Repository: Project dependencies can be loaded from the local file system, from the Internet or public repositories. The company behind the Maven project also provides a central repository called Maven Central.
  • Extensible via plug-ins: The Maven build system is extensible via plug-ins, which allows to keep the Maven core small. The Maven core does for example not know how to compile Java source code, this is handled by the compiler plug-in.
What is Maven Repository?
A maven repository is a directory of packaged JAR file with pom.xml file. Maven searches for dependencies in the repositories. There are 3 types of maven repository: Local, Central, and Remote.

Maven searches for the dependencies in the following order: Local repository then Central repository then Remote repository. If dependency is not found in these repositories, maven stops processing and throws an error.

  • Maven local repository is located in your local system. It is created by the maven when you run any maven command. By default, maven local repository is %USER_HOME%/.m2 directory.
  • Maven central repository is located on the web. It has been created by the apache maven community itself. The path of central repository is: The central repository contains a lot of common libraries that can be viewed by this url
  • Maven remote repository is located on the web. Most of libraries can be missing from the central repository such as JBoss library etc, so we need to define remote repository in pom.xml file. e.g:
< dependencies >  
    < dependency >  
      < groupId > junit< /groupId >  
      < artifactId > junit< /artifactId >  
      < version > 4.8.2< /version >  
      < scope > test< /scope >  
    < /dependency >  
< /dependencies >  

Can you change the location of Maven Local Repository?
Yes, we can change the location of maven local repository by changing the settings.xml file, which is located in MAVEN_HOME/conf/settings.xml.
< settings xmlns=""  
   xsi:schemaLocation="" >  
  < !-- localRepository 
   | The path to the local repository maven will use to store artifacts. 
   | Default: ${user.home}/.m2/repository 
  < localRepository > /path/to/local/repo< /localRepository >  
  -- >  
< /settings >  

If you want to change the Local Repository location to mavenlocalrepo folder in D drive then change the value in localRepository tag:
< localRepository > d:/mavenlocalrepo< /localRepository >   
What is Maven Central?
Maven Central is an open repository provided by the company Sonatype. This repository hosts libraries which can be used in your build. By default, a Maven build uses Maven Central to search for required libraries.

How can you download and install Maven?
If you are planning to use Maven only from within the Eclipse IDE, this installation is not required.

Else, download the maven from

After downloading, extract the downloaded distribution to a selected folder on your computer. Add a new environment variable M2_HOME pointing to this directory and add M2_HOME/bin to the PATH variable.

To validate whether Maven is installed correctly , open a console and run the following command:
mvn -version

If you get the output then Maven is installed.

How can you build a Maven project via the command line?
To build the project you need to run 'mvn' command from the command line. This command need to be executed in the directory which contains the relevant pom file. You need to provide the mvn command with the life cycle phase or goal to execute.

The Maven tooling reads the pom file and resolves the dependencies of the project. Maven validates if required components are available in a local repository (which is found in the .m2/repository folder of the users home directory). If the dependency is not available in the build reactor or the local repo, Maven downloads the depended artifacts from the central repository or the specified ones into the local repository.

Maven executes all life cycle phases until the specified one. e.g, the 'mvn clean install' command triggers the jar packaging. This includes compiling the sources, executing the tests and packaging the compiled files in a JAR file. As last step the install phase installs the resulting artifact into the local repository, so it can be used as dependencies by other Maven builds.

Maven creates the build result in the target folder.

'mvn install' will compile, build and install the build result. 

To ensure that the build target is removed before a new build, add the clean target. run 'mvn clean install' command.

By default, Maven checks online if the dependencies have been changed. If you want to use your local repository, you can use the -o to tell Maven to work offline. To do this run, 'mvn -o clean install' command.

In how many ways, you can deal with build failure?
If you are running a complex multi-module project build, you can define how the Maven build system should react to errors in one module.
  • -fae, --fail-at-end - fails the build after all modules are build; allow all non-impacted builds to continue
  • -ff, --fail-fast - Stop at first module build failure
  • -fn, --fail-never - NEVER fail the build, regardless of module build result

The -fn and -fae options are useful to verify builds that are running within a continuous integration tool like Jenkins and to see all errors in the build

What is Maven Wrapper?
When building with Maven the same input should always result in the same output. To ensure this on different machines, every machine has to have the same version of Maven. Having the same version on different machines is bit difficult sometimes, when different projects require different versions of Maven. To overcome this issue Maven Wrapper is specified for Maven projects.

The Maven Wrapper allows to run a Wrapper, which wraps a specified version of Maven for a projects build. When having a Maven Wrapper for a project there is no need to install a certain version of Maven on a machine. Only for the inital creation of the Maven Wrapper files a local Maven installation is necessary.

How can we create a Maven Wrapper?

To create a Maven Wrapper for a project with the latest available Maven version.

C:\...project directory > mvn -N io.takari:maven:wrapper

Create a Maven Wrapper for a project with a specified Maven version by using the maven property.

C:\...project directory > mvn -N io.takari:maven:wrapper -Dmaven=3.3.0

What are the aspects does Maven Manages?
 Maven handles following activities of a developer
• Build
• Documentation
• Reporting
• Dependencies
• SCMs
• Releases
• Distribution
• Mailing list

Mention the three build lifecycle of Maven?
: Cleans up artifacts that are created by prior builds
Default (build): Used to create the application
Site: For the project generates site documentation

Explain what is POM?

In Maven, POM (Project Object Model) is the fundamental unit of work. It is an XML file which holds the information about the project and configuration details used to build a project by Maven. Maven reads the pom.xml file, then executes the goal.

Before maven 2, it was named as project.xml file. But, since maven 2, it is renamed as pom.xml.

What are the elements of maven pom.xml file?

  • project:It is the root element of pom.xml file.
  • modelVersion:It is the sub element of project. It specifies the modelVersion. It should be set to 4.0.0.
  • groupId:It is the sub element of project. It specifies the id for the project group.
  • artifactId:It is the sub element of project. It specifies the id for the artifact (project). An artifact is something that is either produced or used by a project. Examples of artifacts produced by Maven for a project include: JARs, source and binary distributions, and WARs.
  • version:It is the sub element of project. It specifies the version of the artifact under given group.
  • packaging:defines packaging type such as jar, war etc.
  • name:defines name of the maven project.
  • url:defines url of the project.
  • dependencies:defines dependencies for this project.
  • dependency:defines a dependency. It is used inside dependencies.
  • scope:defines scope for this maven project. It can be compile, provided, runtime, test and system.
Explain what is Maven artifact? 
Usually an artifact is a JAR file which gets arrayed to a Maven repository. One or more artifacts a maven build produces such as compiled JAR and a sources JAR. Each artifact includes a group ID, an artifact ID and a version string.

Why Maven Plugins are used?

Maven plugins are used to
• Create a jar file
• Create war file
• Compile code files
• Unit testing of code
• Documenting projects
• Reporting

List out the dependency scope in Maven?

 The various dependency scope used in Maven are:
• Compile: It is the default scope, and it indicates what dependency is available in the classpath of the project
• Provided: It indicates that the dependency is provided by JDK or web server or container at runtime
• Runtime: This tells that the dependency is not needed for compilation but is required during execution
• Test: It says dependency is available only for the test compilation and execution phases
• System: It indicates you have to provide the system path
• Import: This indicates that the identified or specified POM should be replaced with the dependencies in that POM’s section.

Mention how profiles are specified in Maven?
Profiles are specified in Maven by using a subset of the elements existing in the POM itself.

Explain how you can exclude dependency?
By using the exclusion element, dependency can be excluded

Mention the difference between Apache Ant and Maven? 
  • Ant doesn't has formal conventions, so we need to provide information of the project structure in build.xml file. Maven has a convention to place source code, compiled code etc. So we don't need to provide information about the project structure in pom.xml file.
  • Ant is procedural, you need to provide information about what to do and when to do through code. You need to provide order.    Maven is declarative, everything you define in the pom.xml file.
  • There is no life cycle in Ant.  There is life cycle in Maven.
  • Ant is a tool box, whereas Maven is a framework.
  • Ant is mainly a build tool, whereas Maven is mainly a project management tool.
  • The ant scripts are not reusable. The maven plugins are reusable.

List out what are the build phases in Maven?
Build phases in Maven are
• Validate
• Compile
• Test
• Package
• Install
• Deploy

Explain what would the “jar: jar” goal do?

jar: jar will not recompile sources; it will imply just create a JAR from the target/classes directory considering that everything else has been done.

For POM what are the minimum required elements?
The minimum required elements for POM are project root, modelVersion, groupID, artifactID and version

How to build the maven project or how to package maven project?
The mvn package command completes the build life cycle of the maven project.

A Maven build lifecycle is made up of phases. Each of these build lifecycles is defined by a different list of build phases, wherein a build phase represents a stage in the lifecycle. The default lifecycle comprises of the following phases:
  • validate - validate the project is correct and all necessary information is available
  • compile - compile the source code of the project
  • test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package - take the compiled code and package it in its distributable format, such as a JAR.
  • verify - run any checks on results of integration tests to ensure quality criteria are met
  • install - install the package into the local repository, for use as a dependency in other projects locally
  • deploy - done in the build environment, copies the final package to the remote repository for sharing with other developers and projects. 
-K Himaanshu Shuklaa..

April 26, 2017

I am a confused orthodox person : Krishnamachari Srikkanth

Former India captain Krishnamachari Srikkanth, a veteran in the sport, revealed that while cricketers such as Sandeep Patil and himself may not go down in history as legends, they will be remembered for the entertainers that they were, on and off field. Srikkanth, who is the mentor for Sunrisers Hyderabad this IPL season, joined Sandeep on his show ‘Taste Match’ which airs on Living Foodz and &TV.

The duo had a candid conversation about the golden days of Indian cricket and Srikkanth confessed that he has always been superstitious. The exuberant batsman has a superstition with the number 9 and he would even chant shlokas on the field. However, being an electrical engineer, Srikkanth leveraged his analytical abilities to calculate risk perfectly and take shots that always paid off! Laughing about this fusion Srikkanth said, “I am a confused orthodox person.”

April 25, 2017

Esha Gupta looked gorgeous at the Cama Awards!

Be it attending a formal event, or a dinner, Esha Gupta’s outfits have always been on point! Esha attended the Cama Awards in Ahmedabad recently and amazed everyone with what she wore!

Whoopie! Evelyn Sharma gets 3 million hits and a piano!!

Evelyn Sharma is on cloud nine. Her music video Party Nonstop with Kangna singer-music producer Dr Zeus along with Punjabi singer Jasmine Sandlas (of Kick's Yaar Na Mila fame) and rapper Ikka (of High Heels fame), has crossed three million hits on YouTube within just about three days.

Manisha Koirala gets nostalgic about R.D.Burman

The charismatic Manisha Koirala, who was Anil Kapoor's love and obsession in the memorable song 'Ek Ladki Ko Dekha Toh Aisa Laga' from the illustrious R.D.Burman's last movie 1942: A Love Story, seemed nostalgic about the composer this week. Manisha was delighted when at a recent event, senior award-winning journalist Chaitanya Padukone presented her a copy of his authored book R.D.BurMania.

“What a musical masterpiece genius Panchamda came up with. Even today, his amazing melodies soothe the heart,"
said Manisha, who is playing the legendary Nargis Dutt in the biopic on Sanjay Dutt, being directed by Rajkumar Hirani.

April 24, 2017

All about JUnit..

What is JUnit and Unit Test Case?
JUnit is a testing framework for unit testing. It uses Java as a programming platform, and it is an Open Source Software managed by the community.

Unit Test Case is a part of the code that ensures that the another part of code (method) behaves as expected. For each requirement, there must be at least two test cases one negative test and one positive test.

First JUnit test case:

1). Create a java class file name TestJunit, which has a method testName(). This method will compare whether 'name' is valid or not

import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TestJunit {
   public void testName() {
      String name = "Name is K Himaanshu Shuklaa";
      assertEquals("Name is K Himaanshu Shuklaa",name);

2). Create a java class file name TestRunner.
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;

public class TestRunner {
   public static void main(String[] args) {
      Result result = JUnitCore.runClasses(TestJunit.class);       
      for (Failure failure : result.getFailures()) {
         System.out.println("failure result="+failure.toString());
      System.out.println("is test successful? "+result.wasSuccessful());

When you run TestRunner, it will call testName() method of TestJunit. If the 'name' is equal to the value passed in assertEquals, then output will be:
"is test successful? true"

But suppose, the value of 'name' variable is 'Name is Tiger Shroff', then output will be :
failure result=testName(com.junit.TestJunit): expected: < Name is [K Himaanshu Shuklaa] > but was: < Name is [Tiger Shroff] >
is test successful? false

Features of JUnit Test Framework : JUnit test framework provides the following important features :-

1). Fixture : A test fixture is a fixed state in code which is tested used as input for a test. Another way to describe this is a test precondition. For example, a test fixture might be a a fixed string, which is used as input for a method. The test would validate if the method behaves correctly with this input

It includes :
  • setUp() method, which runs before every test invocation.
  • tearDown() method, which runs after every test method.

e.g: Let us make some changes in TestJunit, we need to extend TestCase class and add two methods setUp() and tearDown().
import junit.framework.TestCase;
import org.junit.Test;
public class TestJunit extends TestCase{
    protected String name;
    protected void setUp() {
        System.out.println("Inside setUp()");
        name = "Name is Tiger Shroff";
    protected void tearDown() {
        System.out.println("Inside tearDown()");
    public void testName() {
        System.out.println("Inside testName()");
        assertEquals("Name is K Himaanshu Shuklaa", name);

Now when you run TestRunner, it will give an output (test is failed because the 'name' is nt equal to the value passed in assertEquals):
Inside setUp()
Inside testName()
Inside tearDown()
failure result=testName(com.junit.TestJunit): expected: < Name is [K Himaanshu Shuklaa]> but was: < Name is [Tiger Shroff] >
is test successful? false

2). Test Suites : If you have several test classes, you can combine them into a test suite. Running a test suite executes all test classes in that suite in the specified order. A test suite can also contain other test suites.

In JUnit, both @RunWith and @Suite annotation are used to run the suite test. Given below is an example that uses TestJunit1 & TestJunit2 test classes.

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
                TestJunit2.class })

public class TestRunner {


3). Test Runners : It is used for executing the test cases.
4). JUnit Classes : They are important classes, used in writing and testing JUnits. Some of the important classes are −
  • Assert − Contains a set of assert methods.
  • TestCase − Contains a test case that defines the fixture to run multiple tests.
  • TestResult − Contains methods to collect the results of executing a test case.
junit.framework : Its the most important package in JUnit because it contains all the core classes.
  • Assert : A set of assert methods.
  • TestCase : A test case defines the fixture to run multiple tests.
  • TestResult : A TestResult collects the results of executing a test case.
  • TestSuite : A TestSuite is a composite of tests.

Assert Class : It is present in org.junit package of junit.framework. Assert class provides a set of assertion methods useful for writing tests. Only failed assertions are recorded.

A few methods to assert test results (parameters in [] brackets are optional and of type String):
fail(message) : Let the method fail. Might be used to check that a certain part of the code is not reached or to have a failing test before the test code is implemented. The message parameter is optional.
  • assertTrue([message,] boolean condition) : Checks that the boolean condition is true.
  • assertFalse([message,] boolean condition) : Checks that the boolean condition is false.
  • assertEquals([message,] expected, actual) : Tests that two values are the same. Note: for arrays the reference is checked not the content of the arrays.
  • assertEquals([message,] expected, actual, tolerance) : Test that float or double values match. The tolerance is the number of decimals which must be the same.
  • assertNull([message,] object) : Checks that the object is null.
  • assertNotNull([message,] object) : Checks that the object is not null.
  • assertSame([message,] expected, actual) : Checks that both variables refer to the same object.
  • assertNotSame([message,] expected, actual) : Checks that both variables refer to different objects

TestCase Class : It is present in org.junit package of junit.framework, this class extends Assert and implements Test interface. Some of the important methods of TestCase class are :
  • int countTestCases() Counts the number of test cases executed by run(TestResult result).
  • TestResult createResult() Creates a default TestResult object.
  • String getName() Gets the name of a TestCase.
  • TestResult run() A convenience method to run this test, collecting the results with a default TestResult object.
  • void run(TestResult result) Runs the test case and collects the results in TestResult.
  • void setName(String name) Sets the name of a TestCase.
  • void setUp() Sets up the fixture, for example, open a network connection.
  • void tearDown() Tears down the fixture, for example, close a network connection.
  • String toString() Returns a string representation of the test case.

TestResult Class : It is present in org.junit package of junit.framework. A TestResult collects the results of executing a test case. It is an instance of the Collecting Parameter pattern. The test framework distinguishes between failures and errors. A failure is anticipated and checked for with assertions. Errors are unanticipated problems like an ArrayIndexOutOfBoundsException. Some of the important methods of TestResult class are :
  • void addError(Test test, Throwable t) Adds an error to the list of errors.
  • void addFailure(Test test, AssertionFailedError t) Adds a failure to the list of failures.
  • void endTest(Test test) Informs the result that a test was completed.
  • int errorCount() Gets the number of detected errors.
  • Enumeration errors() Returns an Enumeration for the errors.
  • int failureCount() Gets the number of detected failures.
  • void run(TestCase test) Runs a TestCase.
  • int runCount() Gets the number of run tests.
  • void startTest(Test test) Informs the result that a test will be started.
  • void stop() Marks that the test run should stop.
What is the difference between errors and failures?
failures occurs when your test cases fail,  i.e. your assertions are incorrect. Errors are unexpected errors that occur while trying to actually run the test - exceptions, etc.

TestSuite : It is a Composite of tests. It runs a collection of test cases. Some of the important methods of TestSuite class are:
  • void addTest(Test test) Adds a test to the suite.
  • void addTestSuite(Class testClass) Adds the tests from the given class to the suite.
  • int countTestCases() Counts the number of test cases that will be run by this test.
  • String getName() Returns the name of the suite.
  • void run(TestResult result) Runs the tests and collects their result in a TestResult.
  • void setName(String name) Sets the name of the suite.
  • Test testAt(int index) Returns the test at the given index.
  • int testCount() Returns the number of tests in this suite.
  • static Test warning(String message) Returns a test which will fail and log a warning message.
Assertion in JUnit
All the assertions are declared inside Assert class. This class provides a set of assertion methods, useful for writing tests. Only failed assertions are recorded. Some of the important methods of Assert class are:
  • void assertEquals(boolean expected, boolean actual) : Checks that two primitives/objects are equal.
  • void assertTrue(boolean expected, boolean actual) : Checks that a condition is true.
  • void assertFalse(boolean condition) : Checks that a condition is false.
  • void assertNotNull(Object object) : Checks that an object isn't null.
  • void assertNull(Object object) : Checks that an object is null.
  • void assertSame(boolean condition) : The assertSame() method tests if two object references point to the same object.
  • void assertNotSame(boolean condition) : The assertNotSame() method tests if two object references do not point to the same object.
  • void assertArrayEquals(expectedArray, resultArray): It  will test whether two arrays are equal to each other.
Annotation in JUnit:
  • @Test : The Test annotation tells JUnit that the public void method to which it is attached can be run as a test case.
  • @Before : Several tests need similar objects created before they can run. Annotating a public void method with @Before causes that method to be run before each Test method.
  • @After : If you allocate external resources in a Before method, you need to release them after the test runs. Annotating a public void method with @After causes that method to be run after the Test method.
  • @BeforeClass : Annotating a public static void method with @BeforeClass causes it to be run once before any of the test methods in the class.
  • @AfterClass : This will perform the method after all tests have finished. This can be used to perform clean-up activities.
  • @Ignore : The Ignore annotation is used to ignore the test and that test will not be executed.
Call sequence:
  • First of all, the beforeClass() method executes only once.
  • The afterClass() method executes only once.
  • The before() method executes for each test case, but before executing the test case.
  • The after() method executes for each test case, but after the execution of test case.
  • In between before() and after(), each test case executes.
Ignore Test: Sometimes it so happens that our code is not completely ready while running a test case. As a result, the test case fails. The @Ignore annotation helps in this scenario.
A test method annotated with @Ignore will not be executed.
If a test class is annotated with @Ignore, then none of its test methods will be executed.

Time Test: If a test case takes more time than the specified number of milliseconds, then JUnit will automatically mark it as failed. The timeout parameter is used along with @Test annotation.

e.g: if testName() takes more than 1000 milliseconds, then JUnit will mark it as failed.

@Test(timeout = 1000)  
public void testName() {
   String name = "Name is K Himaanshu Shuklaa";
   assertEquals("Name is K Himaanshu Shuklaa",name);

Exceptions Test: JUnit provides an option of tracing the exception handling of code. You can test whether the code throws a desired exception or not. The expected parameter is used along with @Test annotation

@Test(expected = ArithmeticException.class)
public void testName() {
   String name = "Name is K Himaanshu Shuklaa";
   assertEquals("Name is K Himaanshu Shuklaa",name);

Parameterized Test: It is introduced in JUnit 4. Parameterized tests allow a developer to run the same test over and over again using different values.

There are five steps that we need to follow to create a parameterized test:
  1. Annotate test class with @RunWith(Parameterized.class).
  2. Create a public static method annotated with @Parameters that returns a Collection of Objects (as Array) as test data set.
  3. Create a public constructor that takes in what is equivalent to one "row" of test data.
  4. Create an instance variable for each "column" of test data.
  5. Create your test case(s) using the instance variables as the source of the test data.

public class PrimeNumberChecker {
    public Boolean validate(final Integer primeNumber) {
        for (int i = 2; i < (primeNumber / 2); i++) {
            if (primeNumber % i == 0) {
                return false;
        return true;

import java.util.Arrays;
import java.util.Collection;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import static org.junit.Assert.assertEquals;
public class PrimeNumberCheckerTest {

    private Integer inputNumber;
    private Boolean expectedResult;
    private PrimeNumberChecker primeNumberChecker;
    public void initilize()
        primeNumberChecker=new PrimeNumberChecker();
//public PrimeNumberCheckerTest(){}
    public PrimeNumberCheckerTest(Integer inputNumber, Boolean expectedResult) {
        this.inputNumber = inputNumber;
        this.expectedResult = expectedResult;
    public static Collection primeNumbers() {
        return Arrays.asList(new Object[][] {
                { 2, true }, { 6, false },
                { 8, true }, { 22, false },
                { 23, true } });
    public void testPrimeNumberChecker() {
        System.out.println("Parameterized Number is : " + inputNumber);
        assertEquals(expectedResult, primeNumberChecker.validate(inputNumber));

import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;

public class TestRunner {
   public static void main(String[] args) {
      Result result = JUnitCore.runClasses(PrimeNumberCheckerTest.class);

      for (Failure failure : result.getFailures()) {
         System.out.println("***Inside TestRunner: failure result="+failure.toString());
      System.out.println("***Inside TestRunner: is test successful?"+result.wasSuccessful());

Output of TestRunner:
Parameterized Number is : 2
Parameterized Number is : 6
Parameterized Number is : 8
Parameterized Number is : 22
Parameterized Number is : 23
***Inside TestRunner: failure result=expected: but was:
***Inside TestRunner: is test successful?false

If you do not mention @RunWith(Parameterized.class) in PrimeNumberCheckerTest, then below exception will be thrown:
***Inside TestRunner: failure result=initializationError(com.parameter.PrimeNumberCheckerTest): Test class should have exactly one public zero-argument constructor

If you mention @RunWith(Parameterized.class), but forgot to add @Parameterized.Parameters in primeNumber() method of PrimeNumberCheckerTest, then below exception will occur
***Inside TestRunner: failure result=initializationError(com.parameter.PrimeNumberCheckerTest): No public static parameters method on class com.parameter.PrimeNumberCheckerTest

-K Himaanshu Shuklaa..

Ek Shringaar-Swabhiman actress Sangeita Chauhaan’s husband missing since Thursday

Ek Shringaar-Swabhiman actress Sangeita Chauhaan with her husband Chirag Shah
Television actress Sangeita Chauhaan's husband Chirag Shah, has been reportedly missing from the last few days.

April 21, 2017

Did you know Urvashi Dholakia was given an ultimatum to lose weight by producers?

Urvashi Dholakia, who played the iconic role of Komolika Basu in 'Kasautii Zindagii Kay' was recently subjected to body shaming. The pretty actress, met her friend and out of no context, he told her that she looked beautiful, but she needed to lose some weight. Miffed by this incident Urvashi vented out her emotions on social networking sites. She wrote, "I hate the thought of size zero. I love myself just the way I am! Be it healthy or healthier."

April 18, 2017

A street named after Diana Penty's ancestors!

Did you know that a street named ‘Penty Naka’ in Jabalpur, Madhya Pradesh is named after actress Diana Penty’s ancestors?

Diana, who is currently shooting for her upcoming film Lucknow Central, has a street named after her great grandfather, Maneck S. Penty. And since Diana comes from a family of food lovers, it's only fitting that Penty Naka is an area known for its street food!

Lisa Ray all set to be seen in Dobaara: See Your Evil

The incredibly gorgeous Lisa Ray who owns our hearts with her talent, gumption and her spirit is all set to take on the silver screen again - this time with Prawaal Raman's Dobaara: See Your Evil. Releasing on May 19, Lisa will be part of a four character based human drama with an edge of horror co-starring Huma Qureshi, Saqib Saleem and Adil Hussain.

April 17, 2017

April 12, 2017

Baahubali 2: The Conclusion exclusive IMAX Poster unveiled

The much awaited movie Baahubali 2: The Conclusion is all set to release this April. Ahead of its release, the movie’s exclusive poster in the IMAX format was launched today at INOX, R-City Mall Ghatkopar.

My association with Sony YAY! aims to bring happiness to all the young ones across the country : Tiger Shroff

Sony Pictures Networks India (SPN) today announced the launch of its much-awaited Kid’s Entertainment Channel – Sony YAY! that will go LIVE on 18th April 2017. Promising to be the ‘Destination for Unlimited Happiness’ for Kids, the channel has roped in the young cinestar, Tiger Shroff, who has become a phenomenon with kids across the country, as its brand ambassador.

#CristyLane - One Day At A Time, Sweet Jesus lyrics

I'm only human, I'm just a woman.
Help me believe in what I could be
And all that I am.
Show me the stairway, I have to climb.
Lord for my sake, teach me to take
One day at a time.

April 07, 2017

Sony YAY! signs Tiger Shroff as Brand Ambassador

Sony YAY!, soon to be launched Kids’ Entertainment Channel from Sony Pictures Network, has roped in the country's newest heartthrob Tiger Shroff as the brand ambassador and face of the channel. This would be the debut television association of the young star whose popularity amongst children is today unbounded.

April 06, 2017

BARC Ratings (Impressions)- Week 13, 2017

'Jigariyaa' actor Harsh Vardhan Deo to play the gangster in a short film!

Actor Harsh Vardhan Deo, who played the role of boy-next-door in his Bollywood debut with 'Jigariyaa' has literally gone through a 360-degree transformation. He will be seen as a ruthless gangster in the upcoming short film 'Neelofar'.

Vinod Khanna suffering from cancer?

Ailing Vinod Khanna with his second wife Kavita and son Saakshi
Dashing veteran Bollywood actor Vinod Khanna, who mesmerized the audience with his acting in films like Dostana, Parvarish, etc., was hospitalised to HN Reliance Foundation and Research Centre in Girgaon, Mumbai on Friday after he complained of discomfort. He is reportedly suffering from bladder cancer. However, son Rahul Khanna says that he was recuperating fast and will soon be out of the hospital.
RSSChomp Blog Directory