Saturday, December 11, 2010

Inner classes | Local Inner Classes | Anonymous Inner Classes | When to Use an Anonymous Class |When to Use an Inner Class



Inner Classes

  • Inner class is associated with an instance of its enclosing class and has direct access to that object's methods and fields.
  • It’s allowed only final variable.
  • Also, because an inner class is associated with an instance, it cannot define any static members itself.
  • Objects that are instances of an inner class exist within an instance of the outer class. Consider the following classes:
class OuterClass {
...
class InnerClass {
...
}
}
  • To instantiate an inner class, you must first instantiate the outer class. Then, create the inner object within the outer object with this syntax:
OuterClass.InnerClass innerObject = outerObject.new InnerClass()


Local Inner Classes

  • We can declare an inner class within the body of a method. Such a class is known as a local inner class.
  • A local class is a nested class that is not a member of any class and that has a name.
  • Every local class declaration statement is contained by a block.
  • Local class defined in a method has access to final method variables and also to the outer class's member variables.

Anonymous Inner Classes

  • We can declare an inner class within the body of a method without naming its called anonymous inner classes.
  • An anonymous class is an inner class with the usual
  • class body, but
  • No class name
  • No access specifier (i.e., no public/private/protected)
  • No constructor
  • No explicit use of extends or implements
  • It either extends one class or implements one interface
  • An anonymous class is never abstract. An anonymous class is always an inner class; it is never static. An anonymous class is always implicitly final.
  • Are commonly used in Swing code to implement listeners or adapters.

Syntax for Anonymous Classes

new class-name ( [ argument-list ] ) { class-body }
or:
new interface-name () { class-body }

When to Use an Anonymous Class
  • The class has a very short body.
  • Only one instance of the class is needed.
  • The class is used right after it is defined.
  • The name of the class does not make your code any easier to understand.

Static variable and method


Static Keyword

  • The static variables are created only once for all objects.
  • The value of static variables is the last modified value.
  • The static method only access the static variable.
  • The static keyword u can’t apply for constructor.
  • The static block is first executed. The static variable and method u can access from non-static method and constructor.
  • Without creating object we can access the Static members and methods.
  • It won’t support the this and super keyword inside the static method.
  • We can apply static keyword only inner class

Example of Static
public class Sta {
static int a=100; int b=200;
static void show(){
System.out.println(“non_static var=“+b); è // we can’t access non static variable
System.out.println("static show method"); inside of static method….
}
Static{ è // static block
System.out.println("static block");
}
static int disp(int b){
return b;
}
public static void main(String[] args){
System.out.println("static variable=="+Sta.a);
Sta.show();
System.out.println(Sta.disp(300));
}
}



Difference between Overloading and overriding

Overloading

  • Same method name with different argument.
  • Method return type is different and Access specifier is might be different or might be same.
  • Overloaded methods must have different argument lists (different of args, or different types).
  • It is resolved at the compile time.





Overriding
  • A subclass can redefine an existing method from a superclass
  • It is resolved at the runtime.
  • When overriding a method the subclass method prototype must match exactly the prototype of the superclass (same name, same return type, same arguments).
  • You may change access specifier (public, private, protected), but derived classes cannot decrease the visibility.
  • Instance method can override only instance method.
  • Static method can override only static method.
Diff b/w OverLoading & Overriding


Object Oriented Programming|opps| Encapsulation | Polymorphism | Inheritance

Object Oriented Programming

OOP encapsulates data (e.g. numbers and objects) and methods (functions)

Information hiding is a key aspect of OOP

Implementation details are hidden from the user
(“we can drive a car without knowing how it is built”)

Java is “object oriented” language.

Encapsulation
Data and methods (ie functions) are stored together in a “class”. Code becomes modifiable, understandable, and portable.

In OOP the data and methods associated with objects are normally hidden from the users.

The details of the code are not available outside the class, the author decides what others can see, modify, and use.

Variables (data) can be Public, Protected, Private, Default.

Inheritance
Objects can inherit the properties of other objects.
Inheritance permits software reusability.
New classes can be created from old classes.
The attributes (data) and behavior (methods) of the old class are available to the new class.
New data and methods can be added to the new class also.
Inheritance allows you to write key pieces of code once and use it over and over.
Java support Multilevel Inheritance.
Java does not support Multiple Inheritance.

Polymorphism
You can write functions that behave differently depending on what kind of data is passed to them. E.g. you could make a sqrt function that would work with integers, floats, or even complex numbers.
Polymorphism allows you to avoid very complicated switch or if/else constructs that are required in other languages to treat special cases.
The same method name can be used in many different ways by different objects, this is especially interesting for inherited objects.

Abstraction

An abstraction denotes the essentials properties and behavior of an Object that differentiate it from other objects.

Wednesday, November 24, 2010

AJAX Suggestion Text Box | AJAX Auto Complete Using JSP JAVA, JQuery

AJAX Suggestion Text Box | AJAX Auto Complete Using JSP JAVA, JQuery

AJAX Suggestion Text Box 
AJAX Auto Complete Text Box Using JSP JAVA
The latest Websites uses AJAX for user friendly. 
Text box Auto Complete is latest trend to display the typing word as dropdown.
 Example google shows the drop down.
How to create Suggestion Box?
Its simple because if you gonna use jQuery then it takes little time. However you need the Business logic to work on Database. 
You have to configure your coding structure for connecting to Database. Whenever user types a letter in the Text box then using onkeyup event in javascript have to ping up the Database. Using like statement in Database have to retrieve the value and display it in View part i mean in JSP.

Example for AJAX Suggestion Box:

Monday, September 27, 2010

Garbage Collections Interview Questions| Garbage in java

 Garbage Collections Interview Questions

Q1) Which part of the memory is involved in Garbage Collection? Stack or Heap?

Ans) Heap

Q2)What is responsiblity of Garbage Collector?

Ans) Garbage collector frees the memory occupied by the unreachable objects during the java program by deleting these unreachable objects.
It ensures that the available memory will be used efficiently, but does not guarantee that there will be sufficient memory for the program to run.

Q3) Is garbage collector a dameon thread?

Ans) Yes GC is a dameon thread. A dameon thread runs behind the application. It is started by JVM. The thread stops when all non-dameon threads stop.

Q4)Garbage Collector is controlled by whom?

Ans) The JVM controls the Garbage Collector; it decides when to run the Garbage Collector. JVM runs the Garbage Collector when it realizes that the memory is running low, but this behavior of jvm can not be guaranteed.
One can request the Garbage Collection to happen from within the java program but there is no guarantee that this request will be taken care of by jvm.

Q5) When does an object become eligible for garbage collection?

Ans) An object becomes eligible for Garbage Collection when no live thread can access it.

Q6) What are the different ways to make an object eligible for Garbage Collection when it is no longer needed?

Ans)

      1. Set all available object references to null once the purpose of creating the object is served :

      public class GarbageCollnTest1 {

         public static void main (String [] args){

          String str = "Set the object ref to null";
          //String object referenced by variable str is not eligible for GC yet

          str = null;
          /*String object referenced by variable str becomes eligible for GC */

         }

      }

      2. Make the reference variable to refer to another object : Decouple the reference variable from the object and set it refer to another object, so the object which it was referring to before reassigning is eligible for Garbage Collection.

      publc class GarbageCollnTest2 {

         public static void main(String [] args){

          String str1 = "Garbage collected after use";
          String str2 = "Another String";
          System.out.println(str1);
          //String object referred by str1 is not eligible for GC yet

          str1 = str2;
          /* Now the str1 variable referes to the String object "Another String" and the object "Garbage collected after use" is not referred by any variable and hence is eligible for GC */


         }

      }

      3) Creating Islands of Isolation : If you have two instance reference variables which are referring to the instances of the same class, and these two reference variables refer to each other and the objects referred by these reference variables do not have any other valid reference then these two objects are said to form an Island of Isolation and are eligible for Garbage Collection.


      public class GCTest3 {
      GCTest3 g;

         public static void main(String [] str){

          GCTest3 gc1 = new GCTest3();
          GCTest3 gc2 = new GCTest3();
          gc1.g = gc2; //gc1 refers to gc2
          gc2.g = gc1; //gc2 refers to gc1
          gc1 = null;
          gc2 = null;
          //gc1 and gc2 refer to each other and have no other valid //references
          //gc1 and gc2 form Island of Isolation
          //gc1 and gc2 are eligible for Garbage collection here

         }

      }


Q7) Can the Garbage Collection be forced by any means?

Ans) No. The Garbage Collection can not be forced, though there are few ways by which it can be requested there is no guarantee that these requests will be taken care of by JVM.


Q8) How can the Garbage Collection be requested?

Ans) There are two ways in which we can request the jvm to execute the Garbage Collection.

    * 1) The methods to perform the garbage collections are present in the Runtime class provided by java. The Runtime class is a Singleton for each java main program.
      The method getRuntime() returns a singleton instance of the Runtime class. The method gc() can be invoked using this instance of Runtime to request the garbage collection.
    * 2) Call the System class System.gc() method which will request the jvm to perform GC.

Q9) What is the purpose of overriding finalize() method?

Ans) The finalize() method should be overridden for an object to include the clean up code or to dispose of the system resources that should to be done before the object is garbage collected.


Q10) If an object becomes eligible for Garbage Collection and its finalize() method has been called and inside this method the object becomes accessible by a live thread of execution and is not garbage collected. Later at some point the same object becomes eligible for Garbage collection, will the finalize() method be called again?

Ans) No


Q11) How many times does the garbage collector calls the finalize() method for an object?

Ans) Only once.

Q12) What happens if an uncaught exception is thrown from during the execution of the finalize() method of an object?
Ans) The exception will be ignored and the garbage collection (finalization) of that object terminates.

Q13) What are different ways to call garbage collector?
Ans) Garbage collection can be invoked using System.gc() or Runtime.getRuntime().gc().

Q14) How to enable/disable call of finalize() method of exit of the application

Ans) Runtime.getRuntime().runFinalizersOnExit(boolean value) . Passing the boolean value will either disable or enable the finalize() call.

Tuesday, September 21, 2010

Duplicate data from table | not Duplicate data from table

1. select state_prefix from samplezip  group by state_prefix


2. Duplicate data from table

select count(city),city from samplezip group by city having(count(city)>1)

3. Not Duplicate Data

select count(city),city from samplezip group by city having(count(city)=1)




Here's a handy query for finding duplicates in a table. Suppose you want to find all email addresses in a table that exist more than once:

SELECT email,
 COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )

You could also use this technique to find rows that occur exactly once:

SELECT email
FROM users
GROUP BY email
HAVING ( COUNT(email) = 1 )

Tuesday, August 24, 2010

Generics in java

Generics
 
When you take an element out of a Collection, you must cast it to the type of element that is stored in the collection. Besides being inconvenient, this is unsafe. The compiler does not check that your cast is the same as the collection's type, so the cast can fail at run time.

Generics provides a way for you to communicate the type of a collection to the compiler, so that it can be checked. Once the compiler knows the element type of the collection, the compiler can check that you have used the collection consistently and can insert the correct casts on values being taken out of the collection.


Here is a simple example taken from the existing Collections tutorial:


    // Removes 4-letter words from c. Elements must be strings
    static void expurgate(Collection c) {
        for (Iterator i = c.iterator(); i.hasNext(); )
          if (((String) i.next()).length() == 4)
            i.remove();
    }


Here is the same example modified to use generics:


    // Removes the 4-letter words from c
    static void expurgate(Collection c) {
        for (Iterator
i = c.iterator(); i.hasNext(); )
          if (i.next().length() == 4)
            i.remove();
    }


When you see the code , read it as “of Type”; the declaration above reads as “Collection of String c.” The code using generics is clearer and safer. We have eliminated an unsafe cast and a number of extra parentheses. More importantly, we have moved part of the specification of the method from a comment to its signature, so the compiler can verify at compile time that the type constraints are not violated at run time. Because the program compiles without warnings, we can state with certainty that it will not throw a ClassCastException at run time. The net effect of using generics, especially in large programs, is improved readability and robustness.

To paraphrase Generics Specification Lead Gilad Bracha, when we declare c to be of type Collection, this tells us something about the variable c that holds true wherever and whenever it is used, and the compiler guarantees it (assuming the program compiles without warnings). A cast, on the other hand, tells us something the programmer thinks is true at a single point in the code, and the VM checks whether the programmer is right only at run time.

While the primary use of generics is collections, there are many other uses. “Holder classes,” such as WeakReference and ThreadLocal, have all been generified, that is, they have been retrofitted to make use of generics. More surprisingly, class Class has been generified. Class literals now function as type tokens, providing both run-time and compile-time type information. This enables a style of static factories exemplified by the getAnnotation method in the new AnnotatedElement interface:

    T getAnnotation(Class annotationType);

This is a generic method. It infers the value of its type parameter T from its argument, and returns an appropriate instance of T, as illustrated by the following snippet:

    Author a = Othello.class.getAnnotation(Author.class);

Prior to generics, you would have had to cast the result to Author. Also you would have had no way to make the compiler check that the actual parameter represented a subclass of Annotation.

Generics are implemented by type erasure: generic type information is present only at compile time, after which it is erased by the compiler. The main advantage of this approach is that it provides total interoperability between generic code and legacy code that uses non-parameterized types (which are technically known as raw types). The main disadvantages are that parameter type information is not available at run time, and that automatically generated casts may fail when interoperating with ill-behaved legacy code. There is, however, a way to achieve guaranteed run-time type safety for generic collections even when interoperating with ill-behaved legacy code.

The java.util.Collections class has been outfitted with wrapper classes that provide guaranteed run-time type safety. They are similar in structure to the synchronized and unmodifiable wrappers. These “checked collection wrappers” are very useful for debugging. Suppose you have a set of strings, s, into which some legacy code is mysteriously inserting an integer. Without the wrapper, you will not find out about the problem until you read the problem element from the set, and an automatically generated cast to String fails. At this point, it is too late to determine the source of the problem. If, however, you replace the declaration:

    Set s = new HashSet();

with this declaration:

    Set s = Collections.checkedSet(new HashSet(), String.class);

the collection will throw a ClassCastException at the point where the legacy code attempts to insert the integer. The resulting stack trace will allow you to diagnose and repair the problem.

You should use generics everywhere you can. The extra effort in generifying code is well worth the gains in clarity and type safety. It is straightforward to use a generic library, but it requires some expertise to write a generic library, or to generify an existing library. There is one caveat: You may not use generics (or any other Tiger features) if you intend to deploy the compiled code on a pre-5.0 virtual machine.

If you are familiar with C++'s template mechanism, you might think that generics are similar, but the similarity is superficial. Generics do not generate a new class for each specialization, nor do they permit “template metaprogramming.”

Monday, August 16, 2010

How many types of action clases are there in stuts |

How many types of action clases are there in stuts |

Apart from Action Class these are the following Action clases which you'ld find in Struts Framework ::::::::::::::

1)Dispatch Action :----- It dispatches to a public method that is named by the request parameter whose name is specified by the parameter property of the corresponding ActionMapping. This Action is useful for developers who prefer to combine many similar actions into a single Action class in order to simplify their application design.

2)Forward Action :----------It forwards to the context-relative URI specified by the parameter property of our associated ActionMapping.

3)IncludeAction :-----------It includes the context-relative URI specified by the parameter property of our associated ActionMapping.

and there are more actions but these are the main actions which you developers mainly use in your daiyl codings...........


Action -- As all know basic action class in which we will implement our bussiness logic

Include Action-- Similar to Include in our jsp

Forward Action-- Instead of directly forwarding from one JSP to Another We user Forward Action (If we do that directly it violates Struts MVC Architechture).

Dispatch Action-- Handling multiple operations in multiple methods. one method per operation instead of merging the entire logic in single execute method of action class.

Look up Dispatch Action-- Purpose is Similar to Dispatch action.Implementation is different Recommended not to use this.

Switch Action-- to switch between different modules in struts application



The important Dispatchers that struts provides includes : DispatchAction ActionDispatcher LookupDispatchAction and MappingDispatchAction.

DispatchAction: In this type of aggregation the action class must extend DispatchAction class as shown.

public final class CRUDDispatchAction extends DispatchAction {

public ActionForward create(ActionMapping mapping
ActionForm form
HttpServletRequest request
HttpServletResponse response) throws Exception {
return (mapping.findForward( success ));
}
...

and the action mapping will be as





in your jsp you can call this action as

Create
...

Observe that the above class extends DispatchAction and so you cannot use this method if your class already extends your (some) super class (eg. the class where the session is validated/invalidated). Here the user has to send a query string variable (methodToCall) to set the action name to call.

ActionDispatcher: This flavor of aggregation is same as DispatchAction except that we need not extend ActionDispatcher so we can use this method even if our class extends a super class. The following code snippet shows this scenario.


public final class CRUDActionDispatcher extends Action {

protected ActionDispatcher dispatcher new ActionDispatcher(this ActionDispatcher.DEFAULT_FLAVOR);

public ActionForward execute(ActionMapping mapping
ActionForm form
HttpServletRequest request
HttpServletResponse response) throws Exception {
return dispatcher.execute(mapping form request response);

The DEFAULT_FLAVOR field suggests that the default parameter is method if none is specified as parameter in struts-config.xml (eg . methodToCall).
ActionDispatcher flavor also needs methodToCall parameter to be set (using hidden variable or a query string) as in case of DispatchAction.

LookupDispatchAction: This type of aggregation is useful in situations where in you have multiple submit buttons in a single form. The class must extend LookupDispatchAction. However the great thing about this type is that its java script free. That means you need not set any hidden variables or pass query string however you must use submit buttons as shown.



...
The example Action class will be as follows

public class CRUDLookUpDispatchAction extends LookupDispatchAction {

protected Map getKeyMethodMap() {
Map map new HashMap();
map.put( button.create create );

return map;
}
public ActionForward create(ActionMapping mapping
ActionForm form
HttpServletRequest request
HttpServletResponse response) throws Exception {
return (mapping.findForward( success ));
}
Observe the getKeyMethodMap() method. The submit button names are specified in a Map and their keys comes from MessageResources file. Struts picks up the name from this file and redirects it to the value specified in the Map. The calling code in jsp however has multiple submit buttons only differing in their names.

MappingDispatchAction: This aggregation extends MappingDispatchAction class. This is the most useful type among the four types available. But as seen in other cases you can use this type only when your action does not extend any other action. The good thing about this type is that the action mappings can differ and so need not be the same as in all other cases. To illustrate this consider the below mappings.








Notice that in the first action mapping there is no form bean while in the second the bean name is specified. This means that the user has the flexibility to change the mapping according to his needs and hence not been contained to use a constant mapping for all the CRUD actions. Note that in all the other types of aggregations we must use the same mapping for all the CRUD actions.

Friday, August 13, 2010

Struts Interview Question

 1.What is MVC?

Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data.
    * Model : The model contains the core of the application's functionality. The model encapsulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller.
    * View: The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur.
    * Controller:The controller reacts to the user input. It creates and sets the model.
 2.What is a framework?

A framework is made up of the set of classes which allow us to use a library in a best possible way for a specific requirement.

3.What is Struts framework?
Struts framework is an open-source framework for developing the web applications in Java EE, based on MVC-2 architecture. It uses and extends the Java Servlet API. Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.

4.What are the components of Struts?

Struts components can be categorize into Model, View and Controller:

    * Model: Components like business logic /business processes and data are the part of model.
    * View: HTML, JSP are the view components.
    * Controller: Action Servlet of Struts is part of Controller components which works as front controller to handle all the requests.

5.What are the core classes of the Struts Framework?

Struts is a set of cooperating classes, servlets, and JSP tags that make up a reusable MVC 2 design.

    * JavaBeans components for managing application state and behavior.
    * Event-driven development (via listeners as in traditional GUI development).
    * Pages that represent MVC-style views; pages reference view roots via the JSF component tree.

6.What is ActionServlet?

ActionServlet is a simple servlet which is the backbone of all Struts applications. It is the main Controller component that handles client requests and determines which Action will process each received request. It serves as an Action factory – creating specific Action classes based on user’s request.

7.What is role of ActionServlet?

ActionServlet performs the role of Controller:

    * Process user requests
    * Determine what the user is trying to achieve according to the request
    * Pull data from the model (if necessary) to be given to the appropriate view,
    * Select the proper view to respond to the user
    * Delegates most of this grunt work to Action classes
    * Is responsible for initialization and clean-up of resources

8.What is the ActionForm?

ActionForm is javabean which represents the form inputs containing the request parameters from the View referencing the Action bean.

9.What are the important methods of ActionForm?

The important methods of ActionForm are : validate() & reset().

10.Describe validate() and reset() methods ?

validate() : Used to validate properties after they have been populated; Called before FormBean is handed to Action. Returns a collection of ActionError as ActionErrors. Following is the method signature for the validate() method.
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request)

reset(): reset() method is called by Struts Framework with each request that uses the defined ActionForm. The purpose of this method is to reset all of the ActionForm's data members prior to the new request values being set.
public void reset() {}


 11.What is ActionMapping?

Action mapping contains all the deployment information for a particular Action bean. This class is to determine where the results of the Action will be sent once its processing is complete.

12.How is the Action Mapping specified ?

We can specify the action mapping in the configuration file called struts-config.xml. Struts framework creates ActionMapping object from configuration element of struts-config.xml file

    type="submit.SubmitAction"
         name="submitForm"
         input="/submit.jsp"
         scope="request"
         validate="true">
  

13.What is role of Action Class?

An Action Class performs a role of an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request.

14.In which method of Action class the business logic is executed ?

In the execute() method of Action class the business logic is executed.

public ActionForward execute(
        ActionMapping mapping,
             ActionForm form,
             HttpServletRequest request,
             HttpServletResponse response)
          throws Exception ;

execute() method of Action class:

    * Perform the processing required to deal with this request
    * Update the server-side objects (Scope variables) that will be used to create the next page of the user interface
    * Return an appropriate ActionForward object


 15.What design patterns are used in Struts?
People who read this, also read:-  



* AJAX Interview Questions
    * Spring Questions
    * webMethods Certification
    * iBatis an alternative to Hibernate
    * Tibco Interview Questions


* AJAX Interview Questions
    * Spring Questions
    * webMethods Certification
    * iBatis an alternative to Hibernate
    * Tibco Interview Questions Struts is based on model 2 MVC (Model-View-Controller) architecture. Struts controller uses the command design pattern and the action classes use the adapter design pattern. The process() method of the RequestProcessor uses the template method design pattern. Struts also implement the following J2EE design patterns.
    * Service to Worker
    * Dispatcher View
    * Composite View (Struts Tiles)
    * Front Controller
    * View Helper
    * Synchronizer Token


 16.Can we have more than one struts-config.xml file for a single Struts application?

Yes, we can have more than one struts-config.xml for a single Struts application. They can be configured as follows:
action      
 
    org.apache.struts.action.ActionServlet
    config
 
     /WEB-INF/struts-config.xml,             
     /WEB-INF/struts-admin.xml,
     /WEB-INF/struts-config-forms.xml         
 
 18.What is the difference between session scope and request scope when saving formbean ?

when the scope is request,the values of formbean would be available for the current request.
when the scope is session,the values of formbean would be available throughout the session.

19.What are the important tags of struts-config.xml ?

The five important sections are:

 20.What are the different kinds of actions in Struts?
The different kinds of actions in Struts are:
    * ForwardAction
    * IncludeAction
    * DispatchAction
    * LookupDispatchAction
    * SwitchAction

21.What is DispatchAction?

The DispatchAction class is used to group related actions into one class. Using this class, you can have a method for each logical action compared than a single execute method. The DispatchAction dispatches to one of the logical actions represented by the methods. It picks a method to invoke based on an incoming request parameter. The value of the incoming parameter is the name of the method that the DispatchAction will invoke.

22.How to use DispatchAction?

To use the DispatchAction, follow these steps :

    * Create a class that extends DispatchAction (instead of Action)
    * In a new class, add a method for every function you need to perform on the service – The method has the same signature as the execute() method of an Action class.
    * Do not override execute() method – Because DispatchAction class itself provides execute() method.
    * Add an entry to struts-config.xml

 23.What is the use of ForwardAction?

The ForwardAction class is useful when you’re trying to integrate Struts into an existing application that uses Servlets to perform business logic functions. You can use this class to take advantage of the Struts controller and its functionality, without having to rewrite the existing Servlets. Use ForwardAction to forward a request to another resource in your application, such as a Servlet that already does business logic processing or even another JSP page. By using this predefined action, you don’t have to write your own Action class. You just have to set up the struts-config file properly to use ForwardAction.

24.What is IncludeAction?

The IncludeAction class is useful when you want to integrate Struts into an application that uses Servlets. Use the IncludeAction class to include another resource in the response to the request being processed.

25.What is the difference between ForwardAction and IncludeAction?

The difference is that you need to use the IncludeAction only if the action is going to be included by another action or jsp. Use ForwardAction to forward a request to another resource in your application, such as a Servlet that already does business logic processing or even another JSP page.

26.What is LookupDispatchAction?

The LookupDispatchAction is a subclass of DispatchAction. It does a reverse lookup on the resource bundle to get the key and then gets the method whose name is associated with the key into the Resource Bundle.

27.What is the use of LookupDispatchAction?

LookupDispatchAction is useful if the method name in the Action is not driven by its name in the front end, but by the Locale independent key into the resource bundle. Since the key is always the same, the LookupDispatchAction shields your application from the side effects of I18N.

 28.What is difference between LookupDispatchAction and DispatchAction?

The difference between LookupDispatchAction and DispatchAction is that the actual method that gets called in LookupDispatchAction is based on a lookup of a key value instead of specifying the method name directly.

29.What is SwitchAction?

The SwitchAction class provides a means to switch from a resource in one module to another resource in a different module. SwitchAction is useful only if you have multiple modules in your Struts application. The SwitchAction class can be used as is, without extending.

30.What if element has declaration with same name as global forward?

In this case the global forward is not used. Instead the element’s takes precendence.


  31.What is DynaActionForm?

A specialized subclass of ActionForm that allows the creation of form beans with dynamic sets of properties (configured in configuration file), without requiring the developer to create a Java class for each type of form bean.

32.What are the steps need to use DynaActionForm?

Using a DynaActionForm instead of a custom subclass of ActionForm is relatively straightforward. You need to make changes in two places:

    * In struts-config.xml: change your to be an org.apache.struts.action.DynaActionForm instead of some subclass of ActionForm

            * In your Action subclass that uses your form bean:
          o import org.apache.struts.action.DynaActionForm
          o downcast the ActionForm parameter in execute() to a DynaActionForm
          o access the form fields with get(field) rather than getField()

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;


import org.apache.struts.action.DynaActionForm;

public class DynaActionFormExample extends Action {
 public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
            throws Exception {            
  DynaActionForm loginForm = (DynaActionForm) form;
                ActionMessages errors = new ActionMessages();       
        if (((String) loginForm.get("userName")).equals("")) {
            errors.add("userName", new ActionMessage(
                            "error.userName.required"));
        }
        if (((String) loginForm.get("password")).equals("")) {
            errors.add("password", new ActionMessage(
                            "error.password.required"));
        }
        ...........


33.How to display validation errors on jsp page?

tag displays all the errors. iterates over ActionErrors request attribute.

34.What are the various Struts tag libraries?

The various Struts tag libraries are:

    * HTML Tags
    * Bean Tags
    * Logic Tags
    * Template Tags
    * Nested Tags
    * Tiles Tags

35.What is the use of ?

repeats the nested body content of this tag over a specified collection.

36.What are differences between and

: is used to retrive keyed values from resource bundle. It also supports the ability to include parameters that can be substituted for defined placeholders in the retrieved string.

: is used to retrieve and print the value of the bean property. has no body.

37.How the exceptions are handled in struts?
Exceptions in Struts are handled in two ways:

    * Programmatic exception handling :
      Explicit try/catch blocks in any code that can throw exception. It works well when custom value (i.e., of variable) needed when error occurs.

    * Declarative exception handling :You can either define handling tags in your struts-config.xml or define the exception handling tags within tag. It works well when custom page needed when error occurs. This approach applies only to exceptions thrown by Actions.
 
            type="java.lang.NullPointerException"
            path="/WEB-INF/errors/null.jsp"/>


or

           type="package.SomeException"
           path="/WEB-INF/somepage.jsp"/>

38.What is difference between ActionForm and DynaActionForm?

    * An ActionForm represents an HTML form that the user interacts with over one or more pages. You will provide properties to hold the state of the form with getters and setters to access them. Whereas, using DynaActionForm there is no need of providing properties to hold the state. Instead these properties and their type are declared in the struts-config.xml
    * The DynaActionForm bloats up the Struts config file with the xml based definition. This gets annoying as the Struts Config file grow larger.
    * The DynaActionForm is not strongly typed as the ActionForm. This means there is no compile time checking for the form fields. Detecting them at runtime is painful and makes you go through redeployment.
    * ActionForm can be cleanly organized in packages as against the flat organization in the Struts Config file.
    * ActionForm were designed to act as a Firewall between HTTP and the Action classes, i.e. isolate and encapsulate the HTTP request parameters from direct use in Actions. With DynaActionForm, the property access is no different than using request.getParameter( .. ).
    * DynaActionForm construction at runtime requires a lot of Java Reflection (Introspection) machinery that can be avoided.
 39.How can we make message resources definitions file available to the Struts framework environment?
We can make message resources definitions file (properties file) available to Struts framework environment by adding this file to struts-config.xml.

Oracle sues Google over use of Java in Android By Eric Bangeman | Last updated about 8 hours ago

Oracle sues Google over use of Java in Android
By Eric Bangeman | Last updated about 8 hours ago


In a tersely worded press release, Oracle announced that it was suing Google for patent and copyright infringement over its use of the Java programming language for Android development. Neither the press release nor the complaint filed in the US District Court for Northern California go into any significant detail.

"In developing Android, Google knowingly, directly, and repeatedly infringed Oracle's Java-related intellectual property" an Oracle spokesperson said in a statement. "This lawsuit seeks appropriate remedies for their infringement."

Google makes heavy use of Java in the Android software development kit (SDK). Third-party developers code Android apps in Java, which is then translated into bytecode that runs in Dalvik, Google's own custom VM. Google subsequently released the Android Native Development Kit, which allows developers to build Android components with C and C++. It is not intended to replace the Java development model, though, which remains the strongly preferred means of Android development.

Aside from its use of Java syntax, Google's Android SDK implementation is largely independent from Oracle's. It uses its own compiler and runtime tailored specifically for Android.

Originally developed by Sun Microsystems as a "write-once, run anywhere" language, Java became the property of Oracle when it purchased Sun in April 2009. Java was a significant part of the deal for Oracle, as it has been a major player in the world of Java middleware.

Prior to its acquisition by Oracle, Sun proved hostile to the Harmony Project, the Apache Software Foundation's attempt to build an Apache-licensed Java SE implementation. In addition to Dalvik, Google also uses Harmony's class libraries in Android, which has apparently aroused the ire of Oracle.

In the complaint, a copy of which was posted on VentureBeat, Oracle claims that Android, the Android SDK, and Dalvik all infringe on seven patents owned by the database giant. Oracle also accuses Google of "knowingly, willingly, and unlawfully" copying, preparing, publishing, and distributed its IP.

The fact that Oracle has chosen to sue Google over its implementation is sure to cause concern in the wider Java community.

Neither Oracle nor Google responded to our requests for comment in time for publication.





larry-ellisonOracle announced today that it has filed suit against Google for alleged patent and copyright infringement.

The business software giant headed by Larry Ellison (pictured) said that the suit concerns intellectual property related to the Java programming language, which Oracle purchased through its acquisition of Sun Microsystems. In a press release, Oracle spokeswoman Karen Tillman said, “In developing Android, Google knowingly, directly and repeatedly infringed Oracle’s Java-related intellectual property.”

I’ve embedded a copy of Oracle’s complaint below, which includes more details about the company’s allegations. From the complaint: “Google’s Android competes with Oracle America’s Java as an operating system software platform for cellular telephones and other mobile devices. … Google has been aware of Sun’s patent portfolio, including the patents at issue, since the middle of this decade, since Google hired certain former Sun Java engineers.”

A Google spokesman told me that the company hasn’t been served with the complaint yet, so it can’t comment. There’s a good chance that Oracle raised the issue with Google before filing suit, so it may be worth quoting the boilerplate language in Google’s latest earnings report about how Google is involved in legal claims “from time to time,” but that the company believes “the resolution of our current pending matters will not have a material adverse effect on our business.”

Thursday, August 12, 2010

Reading XLS Content Using Java Code.

Reading XLS Content Using Java Code.

We can read XLS content cell by cell by using java code.For this we need jxl jar file.

The following is the simple example to read .xls file and display its content.

Following is the link to download jxl jar file
http://fisheye1.cenqua.com/viewrep/jptools/jpTools/lib




import java.io.File;
import java.io.*;
import jxl.*;
import java.util.*;
import jxl.Workbook;
import jxl.read.biff.*;


class ReadXls
{
public static void main(String[] args)
{
try
{
String filename = "C:/ExcelFileName.xls";
WorkbookSettings ws = new WorkbookSettings();
ws.setLocale(new Locale("en", "EN"));

Workbook workbook = Workbook.getWorkbook( new File(filename),ws);

Sheet s = workbook.getSheet(0);
System.out.println("Sheet Content::"+s.getName());
readDataSheet(s);
workbook.close();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (BiffException e)
{
e.printStackTrace();
}
private static void readDataSheet(Sheet s)
{
// Find the labeled cell from sheet
System.out.println(lc.getString());

//gets the value of cell at specified column and row
DateCell dc = (DateCell) s.getCell(20,1);
System.out.println(dc);

}
}

Wednesday, August 11, 2010

Jackie Evancho, 10, amazes on 'America's Got Talent'



You've got to listen to Jackie Evancho, 10, who stole the show last night on America's Got Talent. And, yes, she's being called "the next Susan Boyle."

Thursday, August 5, 2010

GCT Coimbatore MBA & MCA Counselling 2010 | TN MBA/MCA Counselling 2010 | GCT Counselling Schedule | www.gct.ac.in


GCT Coimbatore MBA & MCA Counselling 2010 | TN MBA/MCA Counselling 2010 | GCT Counselling Schedule | www.gct.ac.in


The Government College of Technology, Coimbatore formerly known as the Arthur Hope College of Technology, was started in July 1945 in accordance with the general policy of the then Government of Madras to give high priority to technical education under the post-war reconstruction schemes in order to meet the demand for trained engineers for various

Monday, August 2, 2010

Anna University Tirunelveli examination results

Visit Anna University, Tirunelveli website www.annauniv.edu.in for information on Academic programmes & Courses offered by the University, Admission procedures, list of Affiliated colleges and Curriculum Syllabi for U.G./P.G Degree programmes.



Anna University Tirunelveli students can access their semester examination results and latest exam related notifications on the website.

Saturday, July 31, 2010

Enthiran The Robo – Movie, Songs Free Download songs

Download HERE Songs




Enthiran The Robo – Movie, Songs  Free Download songs

Star Cast: Rajinikanth, Aishwarya Rai Bachchan, Danny Denzongpa, Santhanam, Karunas

Director : Shankar

Music : A R Rahman

Cameraman : Rathnavelu

Production : Ayngaran International Films Pvt Ltd

Endhiran is releasing on July 14, 2010
Movie stills, Mp3 songs, Latest Endhiran Photos, Shooting, News

Endhiran The Robo – Movie, Songs
Movie stills, Mp3 songs, Latest Endhiran Photos, Shooting, News

Endhiran is a sci-fi film directed by S. Shankar. Rajinikanth and Aishwarya Rai in the lead roles. Sun pictures own distribution rights in india and HBO films (world wide).


Enthiren Song download  Here

 1. Puthiya Manidha .Download
Singers: S. P. Balasubramaniam, A. R. Rahman, Khatija Rahman
Lyrics: Vairamuthu


2. Kadal Anukkal…..Download
Singers: Vijay Prakash, Shreya Ghoshal
Lyrics: Vairamuthu


3. Irumbile Oru Idhaiyam...Download
Singers: A. R. Rahman, Kash’n'Krissy
Lyrics: Kaarki
English lyrics: Kash’n'Krissy

4. Chitti Dance Showcase……Download
Singers: Pradeep Vijay, Pravin Mani, Yogi B
Additional Arrangements and Programming: Pravin Mani

5. Arima Arima….Download
Singers: Hariharan, Sadhana Sargam
Additional Vocals: Benny Dayal, Naresh Iyer
Lyrics: Vairamuthu


6. Kilimanjaro..Download
Singers: Javed Ali, Chinmayi
Lyrics: P. Vijay
Additional Vocal Arrangements: Clinton Cerejo


7. Boom Boom Robo Download
Singers: Yogi B, Keerthi Sagathia, Swetha Mohan, Tanvi Shah
Lyrics: Kaarki

Friday, July 30, 2010

TANCET 2010 MBA / MCA / ME/ MTech Counselling Status, Procedures and Details

The Tamil Nadu Common Entrance Test –2010 for admission to MBA, M.Tech, MCA etc  Post Graduate course admission  was conducted by Anna Univesity.  Thow students  who are looking for the Anna University  TANCET –2010  result  can visit the official website of Anna University  The results of TANCET  will be available on the Anna University website very soon.



The TANCET results, Rank List, and Counseling schedule for TANCET results updates. Anna University was established on 4th September 1978 as aunitary type of University. It offers higher education in Engineering, Technology and allied Sciences relevant to the current and projected needs of the society.

Besides promoting research and disseminating knowledge gained there from, The TANCET results, Rank list, and counseling schedule for TANCET based PG Course admission notification is to be made available online on the official website of Anna University Chennai. The results updates can be read from the official website of Anna University. T

his university situated in the southern part of the city  of Madras (Chennai),  the university’s main  campus extends over 100 hectares abutting the Adyar River on the north and  Raj Bhavan on the south. The Madras  Institute of Technology at Chromed constitutes the second campus of the university which  extends over 20 hectares. So the students you can see the result of merit counsellng  on the official website.
http://www.annauniv.edu/tancet2010/

Thursday, July 29, 2010

Finally in java | exception finally block

Finally in java | exception finally block

Finally is a keyword. Finally block will executed when exception occure or not (it always executed).

Finally block executed after try-catch. It's executed before the method return.

It's used for the file and unresource closed.

ex:1

try{
}catch(){
}
finally{
}

ex:2

try{
}
finally{
}

Note
-------
If a catch clause invokes System.exit() the finally clause WILL NOT execute.

Tancet MCA counselling, MBA counselling , ME counselling 2010

Tancet MCA counselling, MBA counselling , ME counselling 2010


The Tamil Nadu Common Entrance Test –2010 for admission to MBA, M.Tech, MCA etc  Post Graduate course admission  was conducted by Anna Univesity.  Thow students  who are looking for the Anna University  TANCET –2010  result  can visit the official website of Anna University  The results of TANCET  will be available on the Anna University website very soon.



The TANCET results, Rank List, and Counseling schedule for TANCET results updates. Anna University was established on 4th September 1978 as aunitary type of University. It offers higher education in Engineering, Technology and allied Sciences relevant to the current and projected needs of the society.

Besides promoting research and disseminating knowledge gained there from, The TANCET results, Rank list, and counseling schedule for TANCET based PG Course admission notification is to be made available online on the official website of Anna University Chennai. The results updates can be read from the official website of Anna University. T

his university situated in the southern part of the city  of Madras (Chennai),  the university’s main  campus extends over 100 hectares abutting the Adyar River on the north and  Raj Bhavan on the south. The Madras  Institute of Technology at Chromed constitutes the second campus of the university which  extends over 20 hectares. So the students you can see the result of merit counsellng  on the official website.

http://www.annauniv.edu/tancet2010/

Tuesday, July 27, 2010

TNEA 2010 Vacancy Position | TNEA Counselling | Anna University TNEA Seat Availability | TNEA 2010 Counselling Status and Admission

NEA 2010 Vacancy Position | TNEA Counselling | Anna University TNEA Seat Availability | TNEA 2010 Counselling Status and

Admission
   
    Tamil Nadu Engineering Admissions – 2010
THE ANNA University TNEA 2010 rank list has been published. Tamil Nadu Engineering Admissions rank list 2010 will be

available on the official website at annauniv edu tancet exam results.
TNEA 2010 Rank List is for tancet 2010 entrance exam results, admission to the first year B.E/ B Tech degree courses which

are offered in the Anna University Departments and Anna University Colleges including Tamil.
direct link at www.annauniv.edu/tnea2010/rankaca.html
more updates at http://www.annauniv.edu/tnea2010/

source : http://www.annauniv.edu/
Counselling for NRI/CIWGC Category (B.E/B.Tech/B.Arch) Programmes) on 21st June 2010
COUNSELLING FOR VOCATIONAL CANDIDATES AND
DIFFERENTLY ABLED PERSONS CATEGORY
The counselling for Tamil Nadu Engineering Admissions 2010 for Vocational Candidates and Differently Abled Persons category

is scheduled,
The counselling will be held at the Examination Centre,
Anna University Chennai, Chennai - 600 025.
The counselling for special reservation under sports quota is scheduled on 28.06.2010.
  Counselling Schedule for Vocational and
  Diff. Abled Persons

    * Anna University Chennai
    * Anna University Coimbatore
    * Anna University Tiruchirappalli
    * Anna University Tirunelveli


TAMIL NADU ENGINEERING ADMISSIONS 2010
SCHEDULE OF EVENTS FOR B. E. / B. TECH.
Sl.
No. Events Dates
1.
Assigning Random Number
15.06.2010
2.
Publication of Rank List
18.06.2010
3.
Verification of Certificates for Eminent
Sports Persons Category for short listed
candidates only (For details check
www.annauniv.edu/tnea2010/sports.html )
21.06.2010
22.06.2010
4.
Counselling for Sports Quota
28.06.2010
5.                       Counselling for Vocational Candidates
29.06.2010
to
03.07.2010
6.
Counselling for Differently Abled Persons
04.07.2010
7.
Commencement of Counselling for
Academic Candidates
05.07.2010
Candidates have to pay an initial deposit of Rs.5,000/- (Rs.1,000/- for SC/SCA/ST candidates belonging
to Tamil Nadu) at the time of counselling.
Candidates are advised to be present two hour before the commencement of the counselling session.
Candidates are also advised to see the vacancy positions on the Display Screens at the counselling centre or in the website:

http://www.annauniv.edu/tnea2010

Getting linkedin connection profile- API using JAVA

Social Networking sites like Linkedin, Facebook, Orkut, Gmail, Yahoo, Hotmail, MSN, Twitter, Bebo, Hi5 likewise many sites providing their API keys to accessing into their site.

As a programmer in one of the module we are intent to use Linkedin API for accessing the connections Profile.
Soon we will provide JAVA code for accessing all Social Networking sites. 

Let we see how to access Connections of Linkedin profile using JAVA. Being a programmer i always like to share my codes as well. I will explain you this Step By Step.

Step 1:

Go to Linkedin website and log in using your Id or create a seperate Id for your Application or Website.

Step 2:
Log in using your Id
Step3:
After Logging into linked in at the Bottom of the Page you can able to see a link to DEVELOPERS as i marked red in image.


Step 4:
After Clicking that you can able to see page to API as i mentioned in image click Get Started.

Step5:
In new Page click Request an API


Shortcut method Just click this link instead doing all above methods.
https://www.linkedin.com/secure/developer

Just click Add new Application and provide all the information.
After successful registration they will provide you two codes.
They are:
API KEY: 5LdYz7ur2LLDJ4SXXX205pkn84CsBuZAHxaQPzfXXXX
SECRET KEY:

This is the main important one keep it secret and store it safely

Coding for Java is Explained  this link:

String in java | what is a string in java

String is a lang package in java. It's final class so immutable.

String object created two ways

1. using "new" keyword  ----> It's store the normal memory.

2. reference variable   ----> It's store the string pool.

point : 1
----------

String s1=new String("java");


s1 reference variable refer the object1 ['java']

if we change the s1 object1

for example

s1=s1.concat("program");


create the new object

Friday, July 23, 2010

String in java

String class
Java String Class is immutable, i.e. Strings in java, once created and initialized, cannot be changed on the same reference. A java.lang.String class is final which implies no class and extend it. The java.lang.String class differs from other classes, one difference being that the String objects can be used with the += and + operators for concatenation.


What is String Pool?


A JVM has the Pool. All the String Object which are created by assignment stored in the pool. This pool is present in the heap. So whenever any assignment is done for String first it check in the String Pool whether that String is already exist or not... This is done by calling intern() method present in the String class. If it find the same String then it return the same reference else it create new 1. But with new Operator everytime it creates the new Object.

eg.

String str "Sample" // first check wheather its present in the pool
String str1 "Sample"



So now str and str1 have the same reference so .equals and method will return true.

String str2 new String("sample");// this will create the new object in heap.

So above only 2 objects are created1 by str and other by str2

Thursday, July 22, 2010

Garbage Collection in java

Garbage Collection in java


What is Garbage collection?

or

What purpose using garbage collection?
or

Explain garbage collection?

Or

How you can force the garbage collection?

Or

What is the purpose of garbage collection in Java, and when is it used?

Or

What is Garbage Collection and how to call it explicitly?

Or

Explain Garbage collection mechanism in Java?


Garbage Collection is automatically destroy the object and release the memory. when no reference to an object to be no longer is required. That object occupy the memory released and used for another object share the same memory.


Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects (value is null) from the memory. Every class inherits finalize() method from java.lang.Object, the finalize() method is called by garbage collector when it determines no more references to the object exists. In Java, it is good idea to explicitly assign null into a variable when no more in use. In Java on calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected



What kind of thread is the Garbage collector thread?

It is a daemon thread.

Can an object’s finalize() method be invoked while it is reachable?

An object’s finalize() method cannot be invoked by the garbage collector while the object is still reachable. However, an object’s finalize() method may be invoked by other objects.

Does garbage collection guarantee that a program will not run out of memory?

Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.

What is the purpose of finalization?

The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup, before the object gets garbage collected. For example, closing an opened database Connection.

If an object is garbage collected, can it become reachable again?

Once an object is garbage collected, It can no longer become reachable again.

TANCET 2010 MBA / MCA / ME/ MTech Counselling Status, Procedures

TANCET 2010 MBA / MCA / ME/ MTech Counselling Status, Procedures


TANCET TamilNadu Common Entrance Test
Vacancy Position and Counselling Status

Every Year TamilNadu Government Conduct TANCET Examination for MBA, MCA ME and MTech students.
According to TANCET Scores every student get seats in good college.
Each time Anna university Conduct this Exam and Counseling in Coimbatore GCT (Govt College of Technology).

Using TANCET Score every student can join in any engineering colleges affiliated to Anna University.
Anna university separately conduct counseling for joining in Anna University Campus.

Counselling for Admission to M.C.A. (Regular) / M.C.A. (Evening - SS) Degree
Programme 2010-11 in University Departments of Anna University Chennai

For Joining in Anna University Campus itself you can view this steps http://www.annauniv.edu/mba2010/coun.pdf

So after Tancet results announced you have to manually apply for counseling.
TANCET Rank List will be published by community wise OC, BC, MBC , SC or ST

This time ME / MTech Tancet scores has been around 15 - 50 marks out of 100. Based on this, counselling will be conducted.

And for MCA / MBA, as usual scores are low.
In 2009 for OC students who secured around 35 - 50 Marks got seats in Good College.
So try to predict your college using your TANCET score.

Take one person with you while going for counseling because they ask another person to sign the application for authority purpose while choosing college.

Sunday, July 18, 2010

West Bengal train accident july 19

KOLKATA: Railway minister Mamata Banerjee Monday said there was "some doubt" over the West Bengal train accident in which at least 49 people were killed.

The speeding Sealdah-bound Uttar Banga Express rammed into the stationary Bhagalpur-Ranchi Vananchal Express from the rear at Sainthia station in West Bengal's Birbhum district early Monday morning.

Banerjee told reporters while leaving for the accident site: "We have some doubt in our mind. We are searching for information. Let us now find details."

Describing it as "a sad incident", she said: "Human lives are very important."

The minister said: "We are really sorry for this. Sorry to see two incidents take place in West Bengal in two months."

"Whatever happens is not (a) casual thing. We will take necessary action. We will take strong steps whoever is behind this."

On May 28, 148 people were killed when the Mumbai-bound Gyaneshwari Express derailed following Maoist guerrillas sabotaging the tracks near Jhargram in West Midnapore district. A speeding freight train then rammed into the derailed coaches.
West Bengal train accident july 19


Sainthia, West Bengal: Forty-nine people are feared dead in a train collision in West Bengal, near the Jharkhand border. Over 170 people have been taken to hospital, some are said to be in critical condition.

At around 2 am on Monday, the Uttar Banga Express coming in from New Cooch Bihar to Sealdah rammed a stationary Bhagalpur-Ranchi Vananchal Express at Sainthia station in Virbhum district, 191 kms from Howrah.



Casualties are feared in two general second class bogies of the Vananchal Express. These coaches and the luggage van and guard van of the train were hit. A local television channel said so severe was the impact that the roof of a bogey had been detached in the collision and was thrown up on an overbridge.

Relief operations are on and around 32 bodies have reportedly been removed from the wreckage. The Army has also been called in for rescue operations. Seven Army officers and 145 jawans have been sent to the site. Equipment like gas cutters are being used to bring people out of the mangled heaps that the bogies are. More gas cutters are being brought from Panagarh and Kachhrapara to extricate bodies trapped in the mangled coaches. The focus is on saving lives and the locals in the area have been helping in rescue work. There are some people coming out unscathed from the wreckage

Eastern Railway CPRO, Samir Goswami said a few trains - the Kanchunjunga Express, the Sealdah bound Darjeeling mail and the Kanchankanya Express had been diverted.

Railway Minister Mamata Banerjee was in Delhi and rushed to the spot as did senior officials.

Questions are being raised on how the two trains were on the same line. Also, the scheduled arrival and departure of the Uttar Banga Express at Sainthia was 1.38 am and 1.39 am and it was not clear why the train, which was to halt at the station, arrived at a high speed. An inquiry headed by the Commissioner, Railway Safety has been ordered into the incident, the PRO of the Railways Ministry said.

Control rooms have been opened in Sealdah, Malda, Bhagalpur and Howrah.

Helpline numbers:

Ranchi: (0651) 2600263/64, 2460488, 2461404
Sealdah: (033) 23503535, 23503537,
Malda: (06436) 222061
Bhagalpur: (06412) 4222433
Jamalpur (063444) 3101
(With PTI inputs)


Did human error cause Bengal train accident?

Kolkata: West Bengal woke up to the news of another train accident on Monday morning, this time in Sainthia near the Jharkhand border. The Uttar Banga Express rammed a stationary Vanachal Express at Sainthi station hitting the rear coaches of the train.

Fifty people are feared dead, the driver of the Uttar Banga Express was killed as was the guard of the Vanachal Express.

Several questions are being raised. Was it a signal error or communication error that caused the accident?

The allowed speed at the time that the Uttar Banga Express entered the station was 20 kmph and the driver may have missed that yellow signal and not reduced speed.


The train was scheduled to arrive at Sainthia at 1.38 am and leave at 1.39 am after a minute's halt, and so should not have been entering the station at a high speed.

Also, it is not clear why the two trains on the same line? The Vanachal Express was running late by several hours and was leaving the station when the collision occurred. So why was the Uttar Banga not switched to another line?

Questions that shall now be answered after the inquiry that shall no doubt be ordered into the tragedy.


Compensation of Rs 5 lakh for train accident victims: Mamata

Kolkata: Over 50 people are feared dead in a train collision in West Bengal, near the Jharkhand border.

At around 2 am on Monday, the Uttar Banga Express coming in from New Cooch Behar to Sealdah rammed a stationary Bhagalpur-Ranchi Vananchal Express at Sainthia station in Virbhum district, 191 kms from Howrah.

Railway Minister Mamata Banerjee rushed to the spot as did senior officials.
"It is sad that two such incidents happened in last two months. I am leaving fort the accident site. We will take all necessary steps for relief. Forty nine people have died in the accident. A compensation of Rs 5 lakh will be given," she said at the Kolkata airport.


Read more at: http://www.ndtv.com/article/india/compensation-of-rs-5-lakh-for-train-accident-victims-mamata-38305?cp