March 26, 2017

#ParthSamthaan affirms that the molestation case is completely baseless..

Parth Samthaan, who became a household name after the success of 'Kaisi Yeh Yaariyan' is not new to controversy. The actor, who was last accused of molesting model Gauri Arora is back in the news for molesting a model named Sushmita Chokraborty. Last Month, Sushmita filed an FIR against him for Molestation (354-A) in Bangur Nagar Mumbai. Today, the actor has been summoned by the police

March 24, 2017

Meet Bros. collaborate with Neeraj Pandey once again!

One of India’s most popular music composer duo, Meet Bros. are back with a new song called ‘Dil Hua Besharam’ from Neeraj Pandey’s upcoming film Naam Shabana. The duo has worked with Neeraj in the past when they composed the title track of Baby.

Begum Jaan's first song Prem Me Tohre OUT Now!

From the legendary Amitabh Bachchan lending his voice to the mind-blowing trailer to roping in the legendary Asha Bhosle to lend her voice to the first track Prem Me Tohre, Begum Jaan as a film has brought onboard powerhouse performers!

March 23, 2017

Phillauri’s 3D Hologram Projection is a huge hit!

For the first time ever, Bollywood is using 3D Hologram projection to promote a film! The makers of Phillauri, Fox Star Studios, is using 3D projection, making cine-goers interact with the bride in spirit, Shashi!

Shikha Kapur, Chief Marketing Officer, Fox Star Studios stated, “With Phillauri, our endeavor has been to create immersive ideas that transcend conventional norms of fan-star engagement. The unique storyline of the film where the lead actor plays a friendly ghost gives us the opportunity for experiential marketing that communicates both the theme of the film as well as gives us the chance for virality.”

BARC Ratings (Impressions)- Week 11, 2017

March 17, 2017

I Declare..

I 'K Himaanshu Shuklaa', declare that I must master my life in every area. I will no longer settle for a life that is less than what I know I deserve. I have had enough experience to know one side of life, and now it’s My Time to Shine.

March 13, 2017

Popular television actors recall their childhood Holi memories

It is said that, the innocence of celebrating the festival as kids can never really be forgotten. As Holi is just around the corner, we got in touch with a few popular actors to know what they are planning to do on Holi and share fond childhood memories associated with the festival.

March 12, 2017

#Spring: Event Handling in Spring

Sometimes in our spring application, we may want to add capability of listening specific events so that we can process these events as per application logic.

We can always write the event processing code as another method within existing application code, but then it will be tightly coupled with our existing code and we will not have much handle to change it later (we might need to disable it for certain duration or permanently remove it).

March 11, 2017

#Spring : Annotations

Spring provides support for annotation based container configuration.

@Required: It is applied on setters of the attributes of bean, which are mandatory, i.e specifies that a particular property must be injected or else the configuration will fail. Suppose you have an Employee bean, which has 'employee id', then you need to import @Required  from org.springframework.beans.factory.annotation.Required and add it before your setter method, e.g

public void setEmpId(String empId) {
    this.empId = empId;

And in the spring.xml you need to add,
< bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor" / >

After doing this, the "empId" property must be injected or else Spring will throw a BeanInitializationException and context creation will fail.

#Spring: Lifecycle Callbacks

registerShutdownHook(): To close the application context, we need to use AbstractApplicationContext which registers the registerShutdownHook() for the Java programme. This will ensure a graceful shutdown and call the relevant destroy methods.It is used for desktop applications, not for the web applications.

#Spring: Using MessageSource to get text from property files

For an application to support internationalization, it requires the capability of resolving text messages for different locales.

Spring’s application context is able to resolve text messages for a target locale by their keys. Typically, the messages for one locale should be stored in one separate properties file, which is called a resource bundle.

March 10, 2017

#Spring: Dependency Injection

Dependency Injection (DI)
When writing a complex Java application, application classes should be as independent as possible of other Java classes to increase the possibility to reuse these classes and to test them independently of other classes while doing unit testing. Dependency Injection helps in gluing these classes together and same time keeping them independent.

For example, 'DEPENDENCY' means class A is dependent on class B. 'INJECTION' signifies means that class B will get injected into class A by the IoC (Inversion of Control).

Dependency injection can happen in the way of passing parameters to the constructor or by post-construction using setter methods.

#Spring : BeanFactoryPostProcessor and BeanPostProcessor..

BeanPostProcessor tells Spring to do some processing after initialization some beans.

BeanPostProcessor is interface which defines callback methods, with these methods we can tell Spring to do some processing after initialization of beans. This allows you to add some custom logic before and after spring bean creation.

You need to configure, your own BeanPostProcessor in spring.xml (you can configure same BeanPostProcessor multiple times)
< bean class = "com.test.MyBeanPostProcessor" / >

When you implement BeanPostProcessor, you need to override postProcessBeforeInitialization() and postProcessAfterInitialization() methods:

public Object postProcessBeforeInitialization(Object bean, String beanName)
    throws BeansException {
return bean; // you can return any other object as well

public Object postProcessAfterInitialization(Object bean, String beanName)
    throws BeansException {
return bean; // you can return any other object as well

We can configure multiple BeanPostProcessor interfaces and we can control the order in which these BeanPostProcessor interfaces execute by setting the order property provided the BeanPostProcessor implements the Ordered interface.

When you implement Ordered, you need to override getOrder() method:
public int getOrder() {
    return 1;

The BeanPostProcessors operate on bean (or object) instances, which means that the Spring IoC container instantiates a bean instance and then BeanPostProcessor interfaces do their work.

An ApplicationContext automatically detects any beans that are defined with the implementation of the BeanPostProcessor interface and registers these beans as postprocessors, to be then called appropriately by the container upon bean creation.

public static void main(String[] args) {
AbstractApplicationContext  context=new ClassPathXmlApplicationContext("beanPostProcessorSpring.xml");
    Traingle traingle3=(Traingle)context.getBean("traingle");

We need to register a shutdown hook registerShutdownHook() method that is declared on the AbstractApplicationContext class. This will ensures a graceful shutdown and calls the relevant destroy methods.

BeanFactoryPostProcessor: When BeanPostProcessor is registered as a post-processor with the BeanFactory, for each bean instance that is created by the BeanFactory, the post-processor will get a callback from the BeanFactory before any initialization methods (afterPropertiesSet and any declared init method) are called, and also afterwords.

But with BeanFactoryPostProcessor, you can apply changes of some sort to an entire BeanFactory, after it has been constructed.

You need to Override postProcessBeanFactory() method when you implement BeanFactoryPostProcessor interface.

public void postProcessBeanFactory(ConfigurableListableBeanFactory arg0)
    throws BeansException {
    System.out.println("postProcessBeanFactory is called..");       

BeanFactoryPostProcessor need to be configured in spring.xml in a similar way we have configured BeanPostProcessor,
< bean class = "com.test.MyBeanFactoryPostProcessor" / >

-K Himaanshu Shuklaa..

March 08, 2017

Why Swabhimaan actress Shalini Arora is elated these days?

Shalini Arora, who is currently seen in RajShri Productions's Ek Shringaar-Swabhimaan on Colors' is quite elated these days. The reason is not just the show, but her on-screen name.

International Women's Day: Is celebrating just one day enough?

On the occasion of International Women's Day, we spoke to a few popular actors to know there views on whether we should celebrate the day or not?

Java Program to Traverse a Graph using BFS and DFS..

What is the difference between BFS and DFS?

  • BFS Stands for “Breadth First Search”, where as DFS stands for “Depth First Search”.
  • BFS starts traversal from the root node and then explore the search in the level by level manner i.e. as close as possible from the root node. DFS starts the traversal from the root node and explore the search as far as possible from the root node i.e. depth wise.
  • Breadth First Search can be done with the help of queue i.e. FIFO implementation. Depth First Search can be done with the help of Stack i.e. LIFO implementations.
  • BFS algorithm works in single stage. The visited vertices are removed from the queue and then displayed at once. DFS algorithm works in two stages – in the first stage the visited vertices are pushed onto the stack and later on when there is no vertex further to visit those are popped-off.
  • BFS is slower than DFS
  • BFS requires more memory compare to DFS.

  • BFS is useful in finding shortest path.BFS can be used to find the shortest distance between some starting node and the remaining nodes of the graph. Where as    DFS in not so useful in finding shortest path. It is used to perform a traversal of a general graph and the idea of DFS is to make a path as long as possible, and then go back (backtrack) to add branches also as long as possible.
    Breadth First Search

    Depth First Search
package com.graph;
public class GraphNode {    
/*Graph is a collection of linked nodes and values.
 *Each GraphNode has reference to each of its neighbouring nodes.
 *We also store reference of the node’s value and whether or not we’ve visited the node before.*/
    public GraphNode[] neighbours;
    public String val;
    public boolean visited;
    public GraphNode(String value) {
        this.val = value;
        this.visited = false;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;

public class MainDriver {
    public static void main(String[] args) {
        GraphNode a = new GraphNode("a");
        GraphNode b = new GraphNode("b");
        GraphNode c = new GraphNode("c");
        GraphNode d = new GraphNode("d");
        GraphNode e = new GraphNode("e");
        GraphNode f = new GraphNode("f");
        a.neighbours=new GraphNode[] { b, c };
        b.neighbours=new GraphNode[] { a, d };
        d.neighbours=new GraphNode[] { b};       
        c.neighbours=new GraphNode[] { a, e, f };
        e.neighbours=new GraphNode[] { c};
        f.neighbours=new GraphNode[] { c };
    1). Create a new Java Queue of type GraphNode
    2). Mark our root GraphNode as discovered and print it out
    3). Add the root GraphNode into the Queue
    4). Loop through the Queue infinitely until it is empty
        4.1). Poll the head of the Queue for the GraphNode
        4.2). Loop through all GraphNode neighbours of the polled head
        4.3). If the neighbour has not been discovered, mark it as discovered and add it into the Queue
    public static void BFS(GraphNode node) {       
        Queue queue = new LinkedList();
        node.visited = true;
        while(!queue.isEmpty()) {
            GraphNode v = queue.poll();
            for(GraphNode w : v.neighbours) {
                if(!w.visited) {
                    w.visited = true;
     1). Create a Java Stack and push the root node to it
     2). Loop until the GraphNode stack is empty
        2.1). Pop the top GraphNode off the stack
        2.2). If the node has not been visited, mark it so and loop through all GraphNode neighbours in reverse
            2.2.1). Push each neighbour into the stack
     * */
    public static void DFS(GraphNode node) {       
        Stack stack = new Stack();
        while(!stack.isEmpty()) {
            GraphNode v = stack.pop();
            if(!v.visited) {
                v.visited = true;
                for(int i = v.neighbours.length - 1; i >= 0; i--) {

March 01, 2017

Data Structures and Algorithm Interview Questions for Java Developers

How to find middle element of linked list in one pass?
In order to find middle element of linked list we need to find length first, but since we can only traverse linked list one time, we will use two pointers one which we will increment on each iteration while other which will be incremented every second iteration. so when first pointer (currect_pointer) will point to the end of linked list, second (middle_pointer) will be pointing to the middle element of linked list.

If the list the length is odd or even, if its odd then middle_pointer=middle_pointer+1;
e.g: suppose, if length =6, then after traversing, current=6 and middle_pointer=3.
if length =5, then after traversing, current=5 and middle_pointer=2. As the length is odd, we need to increment the middle_pointer, hence the 3rd element is the middle one.

I got to learn a lot of things from Ravindra Gautam: Vishal Bhardwaj

Vishal Bhardwaj, who was last seen in SAB TV's 'Khidhki', recently entered in Star Plus' Meri Durga. Here the dashing actor talks about his role in the show and shares his experience in working with Paperback films..

What are the shows you have done?
My first show was Itti Si Khushi on Sony TV, after that I did Krishnadasi, Silsila Pyar Ka and Sasural Simar Ka. Apart from this, I also did some episodic shows like Savdhaan India, Bhakton Ki Bhakti Mein Shakti, Devlok With Devdutt Pattanaik and Maha episode of Sab TV's Khidhki.
RSSChomp Blog Directory