Saturday, December 26, 2015

Project Manager Round FAQ's

In a Typical interview process,Project Management round plays a vital role, based on which the fate of the candidate would be decided.This round would be taken by a project manager and will evaluate the candidate in various aspects.

1)Technical
2)Nature of work
3)leadership qualities
4)Behavioral and commitment aspects
5)Source Control Management
6)Process Oriented

Project Manager will access the candidate to analyze whether he would fit for the current role based on his past experience, nature of work and various motivational and behavioral aspects.

He might ask questions related to the nature of work,roles and responsibility to check your willingness towards work and your ownership towards them,He will try to assess your skills and their experience as well.

He might ask various other thing about the organization in which you are working,its web site URL type of business number of employee, your designation and other things etc.

He might ask you questions related to the project (few in term of technical) size of the team ,client, your role and few of the challenges you faced while handling the project.In turn he will ask you process related question like delivery model,quality standard adaped ,SDLC lifecycle , Waterfall or Agile process.

At this stage he tries to check you in overall aspects to map you a role in his organization.


Technical Aspects FAQ


1) What is your Project Architecture?
2)What was your roles and responsibility in project ?
3)What are the technologies you have worked on ?
4)What are the tools that are used in your project ?
5)Which IDE you have used in development?
6)What are the Databases you worked on?
7)What are the Server/platform you worked on ?
8) Which Operating System/environment you are woking on ?
9) Have you ever been involved  into design?
10)What are the reporting tool you are using in your project ?
11)What are the CIS/build management tool you are using in your project ?
12)What are the volume of the data against which your application runs?
13)How do you manage secuirty like managing user credentials/data encryption etc?
14) how do you write Unit Test Case?


Nature of work FAQ

1) Have you ever participated in release call?
2) Have you ever been involved into testing?
3)What is your team size?
4)What are the corporate training you have attended?
5)Do you have experience on Production Support and What is the Hierarchy in production Support ?

Leadership Qualities FAQ's


1)Tell and explain to us about a specific situation during the project where you have to cope with a less experience candidate in your team and what are the measures you look to meet your deadlines?
2)How do you handle non productive team member?

Behavior and Commitment Aspects


1)Tell us some of your extraordinary skills(if any) which place you in the leading position over the other technical associate?
2)What were the criticism/difficulties you got during your projects, how did you handle it and what are the measures that you took to avoid repitation of the same ?

Source Control Management


1) What is SCM/SVN tool?
2)What are the measures that you take to ensure are minimal code conflicts with other peers in the team?
3)If You are working for a parallel release how do you manage your code?


I have written this contents based on my experience on different interviews.
Any other interview questions are welcome please share on comments.

Working with Stored Procedures.

How to Deal with Stored Procedures with JDBC.


To work with Stored Procedure we need to create connection and callable statement in the init() of the servlet. Here is an example on how to execute a stored procedure with JDBC .
package app;
import java.sql.*;
public class Dips1
{

private String msDbUrl = "jdbc:oracle:thin:@localhost:1521:XE";
private String msJdbcClass = "oracle.jdbc.driver.OdbcDriver";
private Connection con;
private CallableStatement cs;

public Dips1()
{
try {
Class.forName(;
mcDbAccess = DriverManager.getConnection( msJdbcClass, "milestone", "milestone" );
msProcedure = mcDbAccess.prepareCall(
"{? = call sp_sav_Bom_Header( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) }"
);
msProcedure.registerOutParameter( 1, java.sql.Types.VARCHAR );
msProcedure.setInt( 2, -1 );
msProcedure.setInt( 3, 39 );
msProcedure.setString( 4, "format" );
long ltTest = new java.util.Date().getTime();
System.out.println( "Today: " + ltTest );
msProcedure.setTimestamp( 5, new Timestamp( ltTest ) );
msProcedure.setString( 6, "type" );
msProcedure.setString( 7, "submitter" );
msProcedure.setString( 8, "email" );
msProcedure.setString( 9, "phone" );
msProcedure.setString( 10, "comments" );
msProcedure.setString( 11, "label" );
msProcedure.setInt( 12, 52 );
msProcedure.setBoolean( 13, true );
msProcedure.setBoolean( 14, false );
msProcedure.setInt( 15, 53 );
msProcedure.setString( 16, "runtime" );
msProcedure.setString( 17, "configuration" );
msProcedure.setBoolean( 18, true );
msProcedure.setBoolean( 19, false );
msProcedure.setString( 20, "special instructions" );
msProcedure.setInt( 21, 54 );

ResultSet lrsReturn = null;
System.out.println( "Execute: " + (lrsReturn = msProcedure.executeQuery() ) );
while( lrsReturn.next() ) {
System.out.println( "Got from result set: " + lrsReturn.getInt( 1 ) );
}
System.out.println( "Got from stored procedure: " + msProcedure.getString( 1 ) );
} catch( Throwable e ) {
e.printStackTrace();
}
}

public static void main(String[] args) {
new JdbcTest();
}
}
I also tried it by using a native JDBC driver (i-net) and it also works fine. The only problem we encounter with JDBC-ODBC bridge is that a stored procedure pads spaces to the full length of a VARCHAR but the native JDBC behaves right. Therefore I suggest to use JDBC native drivers.
The above example uses the MS SQL Server.

Monday, January 13, 2014

Struts Sample Code

A Full Struts Application
//index.jsp
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<html:html locale="true">
<head>
<title>A Welcome Page</title>
<html:base/>
</head>
<body bgcolor="white">

<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
  <font color="red">
    ERROR:  Application resources not loaded -- check servlet container
    logs for error messages.
  </font>
</logic:notPresent>
    <h1>Reading User Input</h1>

    <html:form action="Data"
          Please type your name: <html:text property="text" />
          <html:submit />
    </html:form

</body>
</html:html>

//ch03_01.jsp
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/ch03" prefix="ch03" %>

<HTML>
    <HEAD>
        <TITLE>The Struts Cafe</TITLE>
    </HEAD>
    
    <BODY>
        <H1>The Struts Cafe</H1>
        <html:errors/>
        <ch03:items/>
        <ch03:toppings/>
        <html:form action="ch03_04.do">
            <TABLE>
                <TR>
                    <TD ALIGN="LEFT" VALIGN="TOP">
                        <bean:message key="toppings"/>
                        <BR>
                        <logic:iterate id="toppings1" name="toppings">
                            <html:multibox property="toppings">
                                <%= toppings1 %>
                            </html:multibox>
                            <%= toppings1 %>
                            <BR>
                        </logic:iterate>
                    </TD>
                    <TD ALIGN="LEFT" VALIGN="TOP">
                        <bean:message key="items"/>
                        <BR>
                        <html:select property="items">
                            <html:options name="items"/>
                        </html:select>
                    </TD>
                </TR>
                <TR>
                    <TD ALIGN="LEFT">
                                    <BR>
                        <bean:message key="email"/>
                        <html:text property="email"/>
                    </TD>
                <TR>
            </TABLE>
                  <BR>
            <html:submit value="Place Your Order!"/>
        </html:form>
    </BODY>
</html>

package ch03;

import ch03.DataForm;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;

public class DataAction extends Action {

  public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {

    String text = null;

    String target = new String("success");

    if form != null ) {

      DataForm dataForm = (DataForm)form;

      text = dataForm.getText();

    }

    return (mapping.findForward(target));
  }
}

package ch03;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;

public class DataForm extends ActionForm {

  private String text = null;

  public String getText() {

    return (text);
  }

  public void setText(String text) {

    this.text = text;
  }

  public void reset(ActionMapping mapping,
    HttpServletRequest request) {

    this.text = null;
  }

//  public ActionErrors validate(ActionMapping mapping,
//    HttpServletRequest request) {

//    ActionErrors errors = new ActionErrors();

//    if ( (symbol == null ) || (symbol.length() == 0) ) {

//      errors.add("symbol",
//        new ActionError("errors.data.symbol.required"));
//    }
//    return errors;
//  }
}

package ch03;

import java.util.*;
import javax.servlet.jsp.tagext.TagSupport;

public class ch03_02 extends TagSupport 
{
    public int doStartTag() 
      {
        
        String[] itemsArray = {"""Pizza""Calzone""Sandwich"};
        
        pageContext.setAttribute("items", itemsArray);
        
        return SKIP_BODY;
    }
}
package ch03;

import java.util.*;
import javax.servlet.jsp.tagext.TagSupport;

public class ch03_03 extends TagSupport 
{
    public int doStartTag() 
      {
        String[] toppingsArray = {"Pepperoni""Hamburger""Sausage""Ham""Cheese"};
        
        pageContext.setAttribute("toppings", toppingsArray);
        
        return SKIP_BODY;
    }
}

package ch03;

import java.io.*;
import java.util.*;
import ch03.ch03_06;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import org.apache.struts.action.*;

public class ch03_04 extends Action 
{
  public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {

        ActionErrors actionerrors = new ActionErrors();
                
        ch03_06 orderForm = (ch03_06)form;
        
        String email = orderForm.getEmail();        
        if(email.trim().equals("")) {
            actionerrors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.noemail"));
        }
        
        String items = orderForm.getItems();        
        if(items.trim().equals("")) {
            actionerrors.add("ActionErrors.GLOBAL_ERROR"new ActionError("error.noitems"));
        }
        
        String[] toppings = orderForm.getToppings();        
        if(toppings == null) {
            actionerrors.add("ActionErrors.GLOBAL_ERROR"new ActionError("error.notoppings"));
        }
            
        if(actionerrors.size() != 0) {            
            saveErrors(request, actionerrors);
            return new ActionForward(mapping.getInput());            
        }
        return mapping.findForward("OK");
    }
}

A Full Struts Application

           
       

Struts Flow

Struts Flow Diagram


Struts Flow Diagram :




Struts working:

Process flow:
web.xml : Whenever the container gets start up the first work it does is to check the web.xml file and determine what struts action Servlets exist. The container is responsible for mapping all the file request to the correct action Servlet.
A Request : This is the second step performed by the container after checking the web.xml file. In this the user submits a form within a browser and the request is intercepted by the controller.
The Controller : This is the heart of the container. Most Struts application will have only one controller that is ActionServlet which is responsible for directing several Actions. The controller determines what action is required and sends the information to be processed by an action Bean. The key advantage of having a controller is its ability to control the flow of logic through the highly controlled, centralized points.
struts.config.xml : Struts has a configuration file to store mappings of actions. By using this file there is no need to hard code the module which will be called within a component. The one more responsibility of the controller is to check the struts.config.xml file to determine which module to be called upon an action request. Struts only reads the struts.config.xml file upon start up.
Model : The model is basically a business logic part which takes the response from the user and stores the result for the duration of the process. This is a great place to perform the preprocessing of the data received from request. It is possible to reuse the same model for many page requests. Struts provides the ActionForm and the Action classes which can be extended to create the model objects.
View : The view in struts framework is mainly a jsp page which is responsible for producing the output to the user.
Struts tag libraries : These are struts components helps us to integrate the struts framework within the project's logic. These struts tag libraries are used within the JSP page. This means that the controller and the model part can't make use of the tag library but instead use the struts class library for strut process control.
Property file : It is used to store the messages that an object or page can use. Properties files can be used to store the titles and other string data. We can create many property files to handle different languages. 
Business objects :  It is the place where the rules of the actual project exists. These are the modules which just regulate the day- to- day site activities.
The Response : This is the output of the View JSP object.