Posts

Showing posts from 2011

Spring Key Points

What is BeanNameUrlHandlerMapping in Spring MVC I have taken these nots from few of the eBooks. ================================= What are the advantages of spring framework? What is the purpose of each module in spring framework? ================================= Spring provides a light-weight solution for building enterprise-ready applications, declarative transaction management remote access to your logic using RMI or web services various options for persisting your data to a database Spring provides a full-featured Spring is modular, allowing you to use just those parts of it that you need, without having to bring in the rest. Spring could potentially be a one-stop-shop for all your enterprise applications AOP into your software. Transparent ways of integrating BeanFactory , which provides a sophisticated implementation of the factory pattern which removes the need for programmatic singletons and allows you to decouple the configuration and sp...

JMeter Tutorial

JMeter Tutorial   Apache JMeter Apache JMeter  is open source software , a  100% pure Java desktop application designed to load test functional behavior and measure performance.   Advantage  1) Apache JMeter may be used to  test performance  both on static and dynamic resources like 1) files 2) Servlets 3) Perl scripts 4) Java Objects 5) Data Bases and Queries 6) FTP Servers . 2) JMeter can be used to  simulate a heavy load on a server, network or object  to test its strength or to analyze overall performance under different load types.    3)  Can load and performance test many different server types: 1) Web - HTTP, HTTPS 2)  SOAP 3)  Database via JDBC 4)  LDAP 5) JMS 6) Mail - POP3(S) and IMAP(S) 4) Complete portability and  100% Java purity  . 5) Full  multithreading  framework allows concurrent sampling by many threads 6) Careful  GUI  design allows fas...

UML Tutorial

Image
UML Tutorial UML key Points / Notes   1)  Inheritance is indicated by a solid line with a closed,  unfilled  arrowhead pointing at the super class 2) Abstract class is indicated by  italic  notation. 3) By default all the assotiations are bidirectional  this means that both classes are aware of each other and their relationship.   A bi-directional association is indicated by a solid line between the two classes. 4)   A uni-directional association is drawn as a solid line with an open arrowhead (not the closed arrowhead , triangle, used to indicate inheritance) pointing to the known class.  5)  a  dotted  line with a closed, unfilled arrow means  realization  (or implementation)   A very important concept in object-oriented design, inheritance, refers to the ability of one class (child class) to inherit the identical functionality of another class (super class), Inheritance is indicated by a solid line wi...

Code Coverage

Image
============================================== What is EMMA Code coverage. What do you understand by code coverage report? ==============================================                     Code coverage is a measure used in software testing. It describes the degree to which the source code of a program has been tested. To measure how well the program is exercised by a test suite, one or more coverage criteria are used. There are following types of criteria in general.   1) Function coverage - Has each function (or subroutine) in the program been called? 2) Statement coverage - Has each node in the program been executed? 3) Decision coverage   - Has every IF and CASE statements been met as well as not met? 4) Condition coverage - Has each boolean sub-expression evaluated both to true and false?            Attached is Emma-codeCoverage Te...

SingleTon Pattern Nots / Key Points

Some of the key points which I feel one should know. 1) Constructor must be private as nobody should able to create object. 2) getInstance method must be static 3) getInstance method must take care of multiple threads 4) if you make getInstance method as synchronized then it will hamper the performance, Use synchronized block 5) Class should not support serialization, as serialization can create multiple object 6) Class should not be clonable, as cloning can create multiple objects 7) Even if you do synchroniz the piece of code in getInstance() then, still you will have to do double check looking.   in the below code that getInstance method ensures that only one instance of the class is created. The constructor is not accessible from the outside of the class , only way of instantiating the class would be only through the getInstance method. Implementation The implementation involves a static member in the "Singleton" class, a private constructor and a st...

Core Java Notes / Key Points

               HashMap provides constant-time performance for the basic operations (get and put). Iteration over collection views requires time proportional to the "capacity" of the HashMap instance (the number of buckets) plus its size (the number of key-value mappings). Thus, it's very important not to set the initial capacity too high (or the load factor too low) if iteration performance is important. An instance of HashMap has two parameters that affect its performance: initial capacity and load factor. As a general rule, the default load factor (.75) offers a good tradeoff between time and space costs.   =============================== What is the capacity of HashMap =============================== The capacity is the number of buckets in the hash table   =============================== What is loadFactor in HashMap =============================== The load factor is a measure of how full the hash table is allo...

XML-DOM

  ====================================== What is the Document Object Model?  ====================================== The foundation of Extensible Markup Language, or XML, is the DOM. XML documents have a hierarchy of informational units called nodes; DOM is a way of describing those nodes and the relationships between them. A DOM Document is a collection of nodes,the DOM is said to be tree-based , or object-based . provides an API that allows a developer to add, edit, move, or remove nodes at any point on the tree in order to create an application. DOM Level 1 included support for XML 1.0 and HTML Namespace support was added to the DOM Level 2 . new modules supporting Cascading Style Sheets, events, and enhanced tree manipulations. DOM Level 3 , currently in Last Call, includes better support for creating a Document object  XSL Transformations and other XML technologies. CDATA: Short for Character Data, this is a node that contains information that should no...

JSP Short Notes for interview

    Home   ------------------------------------------------------------------------------------------------------------------------- When isThreadSafe is set to true, multiple requests will go to JSP page. This is the default setting. If using true, you must ensure that you properly synchronize access to any shared objects defined at the page level. This includes 1) objects created within declarations 2) JavaBeans components with page scope 3) attributes of the page scope object. If isThreadSafe is set to false, requests are dispatched one at a time. However, you still must ensure that access to attributes of the 1) application or session scope objects 2) JavaBeans components with application or session scope must be properly synchronized.     --------------------------------------------------------------------------------------------------- What are implicit object in jsp 1) request 2) response 3) page 4) session 5) application 6) page...

XML-StAX

Image
======================================================= What are advantages of StAX over SAX and DOM ======================================================= 1) StAX-enabled clients are generally easier to code than SAX clients . StAX parser code can be smaller and the code necessary for the client to interact with the parser simpler. 2) StAX is a bidirectional API, meaning that it can both read and write XML documents . SAX is read only, so another API is needed if you want to write XML documents. 3) SAX is a push API, whereas StAX is pull . ======================================================= What is StAX =======================================================                     The StAX project was  initiated by BEA . The goal of the StAX API is to give "parsing control to the programmer by exposing a simple iterator based API. StAX was created to address limitations in the SAX...

XML-SAX

================== =================================== When to Use SAX SAX key points  =====================================================  SAX event model is used when you want to convert existing data to XML. ITs an event-driven, serial-access mechanism for accessing XML documents. This protocol is frequently used by servlets and network-oriented programs that need to send and receive XML documents, because it's the fastest and least memory-intensive mechanism that is currently available for dealing with XML documents. SAX is fast and efficient, and its event model makes it most useful for such state-independent filtering. For example, a SAX parser calls one method in your application when an element tag is encountered and calls a different method when text is found. If the processing you're doing is state-independent (meaning that it does not depend on the elements have come before), then SAX works fine. SAX requires much less memory than DOM, because SAX does n...

Java Interview Questions

Memory Management When does GarbageCollector will run What will happen if garbage collector is not able to free memory

SQL Injection in java

SQL Interview Questions ====================================== What is sql inject attack What is sql injeciton ======================================  This is the way you can pass INVALID or VUNARABLE input parameters to query and retrive information more than expected. This is the way to break the Security of Database lavel. for eg.   Suppose you have sql query like statement     "SELECT * FROM `users` WHERE `name` = '" + userName + "';"        This SQL code is designed to pull up the records of the specified username from its table of users. You can see here that query is taking parameter dynamically. Here you may use prepared statement. At the run time value of userName variable will be added to query. If you pass the userName= ' or '1'='1  the actual statement will look like  SELECT * FROM `users` WHERE `name` = '' OR '1'='1'; If this code were to be used in an authentication procedure then this example could...

Memory Management in java

Memory management is the process of recognizing when allocated objects are no longer needed, deallocating (freeing) the memory used by such objects, and making it available for subsequent allocations.  Garbage collection solves many, but not all, memory allocation problems. You could, for example, create objects indefinitely and continue referencing them until there is no more memory available. Garbage collection is also a complex task taking time and resources of its own. =========================== When does GarbageCollector will run What will happen if garbage collector is not able to free memory =========================== Consider the possibility that the garbage collector may never even run during an application's lifetime. There is no guarantee as to when or if the JVM will invoke the garbage collector -- even if a program explicitly calls System.gc() . Typically, the garbage collector won't be automatically run until a program needs more memory than is currently ava...