Sunday, 30 September 2012

What are Analytical skills?

Ability to visualize and solve complex problems and
Decision making that is sensible on available information.

How to search all tables in an Oracle database ?

select * from user_tables

Columns available in User_Tables:
Table Name Datatype






TABLE_NAME                 VARCHAR2(30) 
TABLESPACE_NAME  VARCHAR2(30) 
CLUSTER_NAME  VARCHAR2(30) 
IOT_NAME  VARCHAR2(30) 
STATUS VARCHAR2(8) 
PCT_FREE NUMBER
PCT_USED   NUMBER
INI_TRANS NUMBER
MAX_TRANS NUMBER
INITIAL_EXTENT NUMBER
NEXT_EXTENT NUMBER
MIN_EXTENTS NUMBER
MAX_EXTENTS NUMBER
PCT_INCREASE NUMBER
FREELISTS NUMBER
FREELIST_GROUPS NUMBER
LOGGING VARCHAR2(3) 
BACKED_UP  VARCHAR2(1) 
NUM_ROWS NUMBER
BLOCKS NUMBER
EMPTY_BLOCKS NUMBER
AVG_SPACE NUMBER
CHAIN_CNT NUMBER
AVG_ROW_LEN NUMBER
AVG_SPACE_FREELIST_BLOCKS NUMBER
NUM_FREELIST_BLOCKS NUMBER
DEGREE VARCHAR2(10) 
INSTANCES VARCHAR2(10) 
CACHE VARCHAR2(5) 
TABLE_LOCK VARCHAR2(8) 
SAMPLE_SIZE NUMBER
LAST_ANALYZED DATE
PARTITIONED  VARCHAR2(3) 
IOT_TYPE VARCHAR2(12) 
TEMPORARY VARCHAR2(1) 
SECONDARY VARCHAR2(1) 
NESTED  VARCHAR2(3) 
BUFFER_POOL  VARCHAR2(7) 
ROW_MOVEMENT VARCHAR2(8) 
GLOBAL_STATS VARCHAR2(3) 
USER_STATS VARCHAR2(3) 
DURATION VARCHAR2(15) 
SKIP_CORRUPT VARCHAR2(8) 
MONITORING VARCHAR2(3) 
CLUSTER_OWNER VARCHAR2(30) 
DEPENDENCIES VARCHAR2(8) 
COMPRESSION VARCHAR2(8) 
DROPPED VARCHAR2(3) 

Wednesday, 26 September 2012

What is Dress Rehearsal before deployments ?

 Dress Rehearsal is a trial uninterrupted exercise of all aspects in Distributed app consists of various activities like:

1) Identify Bottlenecks
2) Dependencies Check

3) Identify Issues
4) Handover of things
5) Gathering Timelines etc

to make sure that before deployments there is nothing missing.
 
It is also called Dry Runs and Timings of all activities are precise and communicated
Each member either simulates their tasks such as deploying sars, wars, jars, database updations and configurations, migrations, making backups, checking documentations, in an environment that is close to production environment.

How to convert XML to HTML, using XSL Transformation?

1) Let us take an example of XML shown below (It is RSS format standard):

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<rss xmlns:media="http://search.Google.com/" version="2.0">
    <channel>
        <title>News Headlines - Google! News</title>
        <link>http://news.Google.com/news/</link>
        <description>Get the latest news headlines from Google! News. </description>
        <language>en-US</language>
        <copyright>Copyright (c) 2012 Google! Inc. All rights reserved</copyright>
        <pubDate>Sat, 29 Sep 2013 18:43:11 -0300</pubDate>
        <ttl>5</ttl>
        <image>
        <title>News Headlines - Google! News</title>
        <link>http://news.Google.com/news/</link>
        <url>http://l.gimg.com/main_142c.gif</url>
        </image>
        <item>
            <title>Ship ran away on Shark attack</title>
            <description>Obama says "It is bad. We should boat from water world"</description>
            <link>http://news.Google.com/news.html</link>
            <pubDate>Sat, 29 Sep 2013 18:43:11 -0300</pubDate>
            <source url="http://www.pp.org/">Press</source>
            <guid isPermaLink="false">Ship ran away on Shark attack</guid>
        </item>
    </channel>
</rss>



2) Now we need to write a XSL file which shows result document.
Remember, here we use a result document tag which is present in version XSLT 2.0
You can convert XML to XHTML, HTML, JSON or Text File.

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:output name="xml" method="xml" indent="yes"/>
<xsl:output name="html" method="html" indent="yes"/>
<xsl:output name="xhtml" method="xhtml" indent="yes"/>
<xsl:param name="dir">file:///c:/</xsl:param> //This is place where the output file is to be stored

<xsl:template match="/">
 <xsl:result-document format="html" href="{$dir}/FeedofGoogle.html">  //This is file name
        <html>
            <head>
                <title>Google Feeds</title>
            </head>
            <body>
                <xsl:variable name="HLink" select="rss/channel/link"></xsl:variable>
                <table border="1">
                    <xsl:for-each select="rss/channel/item">
                        <xsl:if test="position()=1">
                            <tr>
                                <td colspan="2">Topic 1</td>
                            </tr>
                            <tr>
                                <td>Title of News</td>
                                <td>
                                    <xsl:value-of select="title"/>
                                </td>
                               
                            </tr>
                            <tr>
                                <td>Description of News</td>
                                <td>
                                    <div>
                                        <xsl:value-of disable-output-escaping="yes" select="description"/>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>Domain - Link of News</td>
                                <td>
                                    <xsl:element name="a">
                                        <xsl:attribute name="href">
                                            <xsl:value-of select="link"/>
                                        </xsl:attribute>
                                        <xsl:value-of select="substring-before($HLink, '/n')" /> //This is function of XSLT1.0, which return whole string before substring 'n' appears
                                    </xsl:element>
                                </td>
                            </tr>
                            <tr>
                                <td>Image in News:</td>
                                <td>
                                    <xsl:element name="img">
                                        <xsl:attribute name="src">
                                            <xsl:value-of xmlns:media="http://search.google.com/" select="media:content/@url"/>
                                        </xsl:attribute>   
                                    </xsl:element>
                                </td>
                            </tr>
                        </xsl:if>
                    </xsl:for-each>
                </table>
            </body>
        </html>
 </xsl:result-document>

 </xsl:template>
</xsl:stylesheet>


You can also use one more Result Document tag into JSON, XHTML or File


3) After XSL is developed, it is require to transform the XML and XSl to HTML for that you can use some Transformer.

SAXON is one among transformer, famous around searches.

In Java, Saxon jar is available online
as we have XML and XSL, we need to go to command prompt and write following piece of code:

java -jar <SAXON.JAR PATH> <XML PATH> <XSL PATH>

Download the Jar from here: Saxon 8 Jar, Saxon 9.Jar

TRAX API is also used for transformation, as shown below.

 String outPutHTML = "d:\\FeedofGoogle.html";  //Path where HTML
  StreamSource sourceFeed = new StreamSource("http://news.google.com/rss/news");
  StreamSource xslDocument = new StreamSource("d:\\FeedTransformationCode.xsl");
  StreamResult resultHTMLDoc = new StreamResult(new FileOutputStream(outPutHTML));
  TransformerFactory transFactory = TransformerFactory.newInstance();
  Transformer transformer = transFactory.newTransformer(xslDocument);  
  transformer.transform(sourceFeed, resultHTMLDoc);


Difference between XSLT 1.0 and XSLT 2.0

Tags Difference:

For XSLT 1.0, following is Tag list 


For XSLT 2.0, following is Tag list


How to read RSS Feed in Java ?

RSS have various full forms available online
  • Rich Site Summary (In RSS 0.91)
  • RDF Site Summary (Resource Description Framework Site Summary - In RSS 0.90, 1.0)
  • Reallty Simple Syndication (in RSS 2.0)

RSS is a standardized Web Feed Format
Web Feed is Data Format which provide frequent updated content
RSS provide frequent updated content such as Blog Entries, News Headlines, Audio, Video etc.
It is supported in all major consumer feed readers along with ATOM Feed reader which is alternative to RSS

Following example shows reading RSS Feed  from particular URL and make xml file at your local machine.

package ReadingRSS;

import java.io.*;
import java.net.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import org.w3c.dom.*;

public class ReadingRSS
{
    URL url = null;
    DocumentBuilder builder = null;
    TransformerFactory transformerFactory = null;
    Document objDocument = null;
    Transformer transformer = null;
    DOMSource DOMSource = null;
    StreamResult streamResult = null;

    public ReadingRSS() {
    }

    public boolean getFeedXML()
    {
        try
        {
            url = new URL("http://news.google.com/rss/");
            builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            objDocument = builder.parse(url.openStream());
            transformerFactory = TransformerFactory.newInstance();
            transformer = transformerFactory.newTransformer();
            DOMSource = new DOMSource(objDocument);
            streamResult = new StreamResult(new File("E:/GoogleFeed.xml"));
            transformer.transform(DOMSource, streamResult);
            return true;
        }
        catch (Exception exception)
        {
            System.out.println("Exception: " + exception);
        }
        return true;
    }
   
    public static void main(String[] clArgs)
    {
        ReadingRSS RSSReader = new ReadingRSS();
        if (RSSReader.getFeedXML())
            System.out.println("Feed Consumed");
        else
            System.out.println("Feed not Consumed");
    }
}


This code will directly Ping the URL mentioned in URL constructor and brings the source to your machine and generate a XML file on your local Machine

Monday, 24 September 2012

Smoke testing

Smoke testing is a preliminary testing.
Smoke testing reveal simple severe failures, to determine whether application is accurate for further testing or not.

Smoke term is metaphor i.e closed systems of pipes to test for leaks.
Smoke Testing focus extreme important functionality of a component or system are selected to check if critical functions work correctly
Smoke Testing may answer questions like
"Does the program run?",
"Does it open a window?", or
"Does clicking the main button do anything?"

"smoke tests broadly cover product features in a limited time ... if key features don't work or if key bugs haven't yet been fixed, your team won't waste further time installing or testing"

In project, UI QA, there are various widgets containing various buttons. w
e need to check them are are they working properly?
submitting the data properly?
Are sub widgets opening?
editing things properly?

Friday, 21 September 2012

How to Create and Rename JBOSS Service

> Go to Bin Folder
> Open Service.BAT in Notepad (Right Click -> Edit)
> Give your own Service Name to SVCDISP variable and Description to SVCDISP, which is present in Service.BAT file shown below

set SVCDISP=JBoss Application Server 6.0
set SVCDESC=JBoss Application Server 6.0.0 GA/Platform: Windows %PROCESSOR_ARCHITECTURE%
 

> Save Service.BAT file

Now we will install/Create the service:
> Open Command Prompt
> go to path where Jboss is installed upto bin folder
> Use following command:
service.bat install

Service will be installed successfully to check run services.msc and check your given service name in the list.




Thursday, 20 September 2012

Difference between Java SE 5 vs Java SE 6

In Collections, Addition of new Classes like Deque, Navigable Set and updation of previous like Collection and Array:

  • Deque Interface (Insert and Remove element from both ends)
  • ArrayDeque - Implementation of Deque Interface
  • NavigableSet and Navigable Map Interface - Accessed and Traverse in Ascending and Decending order
  • ConcurrentSkipListSet and ConcurrentSkipListMap - Implementation of Navigable Set Interface
  • Array class get methods CopyOf
  • Methods added to Collection Utility Class

In IO Package,
* Addition of Console Class
* File class updated with few methods like getTotalSpace(), getFreeSpace() etc.
* IO Exception class have parameterized constructors

> In RMI, there are Bug fixes and enhancements and changes in previous releases

> Regarding JVM, Synchronization and compiler performance optimizations, new algorithms and upgrades to existing garbage collection algorithms, and application start-up performance

> In Util package, in concurrent class lock is added.

> In Jar and Zip, two new compressed streams are added in java.util.zip, called DeflaterInputStream and inflaterOutputStream where one is to read compressed data and other writes data which get decompressed.

> JMX API is much upgraded

> Many Security changings in SSL, XML Digital Signature API, etc

> In Network(Java.NET), NetworkInterface enhancement is done with new methods.moreover New classes are added for cookies like CookueManager, CookuePolicy, HTTp Cookie.


Difference between Java EE 5 and Java EE 6

Versions are different, need to check each of them

Web Service Technology difference
 
JAVA EE 5 have Web Services     1.2
JAVA EE 6 have Web Services     1.3

JAVA EE 5 have JAX-WS     2.0
JAVA EE 6 have JAX-WS     2.2

JAVA EE 5 have JAXB 2.0
JAVA EE 6 have JAXB     2.2

JAVA EE 5 have Web Service Metadata for the Java Platform     2.0
JAVA EE 6 have Web Services Metadata for the Java Platform     2.1

JAVA EE 5 have JAX-RPC 1.1
JAVA EE 6 have JAX-RPC     1.1


Web App Technology difference

JAVA EE 5 have Servlet 2.5
JAVA EE 6 have Servlet 3.0

JAVA EE 5 have JSP 2.1
JAVA EE 6 have JSP 2.2

JAVA EE 5 have JSF 1.2
JAVA EE 6 have JSF 2.0

JSTL is same for both.

Enterprise Technology Difference

JAVA EE 5 have EJB 3.0
JAVA EE 6 have EJB 3.1

JAVA EE 6 have JPA 1.0
JAVA EE 6 have JPA 2.0

JAVA EE 6 have JCA 1.5
JAVA EE 6 have JCA 1.6

JMS API, JTA API, Java Mail API are same.

How to get Local IP Address in Java?

Used following function to fetch IP Address

public String getIPAddress()
{
        String IPAddress="";
        try
        {
            IPAddress = InetAddress.getLocalHost().getHostAddress();
        }
        catch (UnknownHostException errorException)
        {
            logErrorInfo("getIPAddress() function: " + errorException);
        }
        return IPAddress;
}
   

Present in Package: java.net.InetAddress

> InetAddress class represents IP Address
> getLocalHost() is static method which returns Host and this throws UnknownHostException which is handled in try catch block
> getHostAddress returns String IP address 

How to get list of sequences in oracle?

Query is : 

SELECT * from user_sequences 
     

Describe user_sequences

SEQUENCE_NAME    VARCHAR2(30)
MIN_VALUE                NUMBER      
MAX_VALUE              NUMBER      
INCREMENT_BY        NUMBER      
CYCLE_FLAG             VARCHAR2(1)
ORDER_FLAG            VARCHAR2(1)
CACHE_SIZE              NUMBER      
LAST_NUMBER         NUMBER       


we can search in between also :

SELECT * from user_sequences where sequence_name like '%Doctor%'

How to find Difference between time in Oracle

select round(((Request_End_Date-Request_Start_Date) * 24*60*60)) as second_difference,
round(((Request_End_Date-Request_Start_Date) * 24*60)) as minute_difference
from Request_log

Wednesday, 19 September 2012

Request Function Output

           
            System.out.println(" Auth Type -> " + request.getAuthType());
            System.out.println(" Content Type -> " + request.getContentType());
            System.out.println(" Char Encod -> " + request.getCharacterEncoding());
            System.out.println(" Context getContextPath -> " + request.getContextPath());
            System.out.println(" Context getLocalAddr -> " + request.getLocalAddr());
            System.out.println(" Context getLocalName -> " + request.getLocalName());
            System.out.println(" Context getMethod -> " + request.getMethod());
            System.out.println(" getPathInfo -> " + request.getPathInfo());
            System.out.println(" getPathTranslated -> " + request.getPathTranslated());
            System.out.println(" getProtocol -> " + request.getProtocol());
            System.out.println(" getQueryString -> " + request.getQueryString());
            System.out.println(" getRemoteAddr -> " + request.getRemoteAddr());
            System.out.println(" getRemoteHost -> " + request.getRemoteHost());
            System.out.println(" getRemoteUser -> " + request.getRemoteUser());
            System.out.println(" getRequestURI -> " + request.getRequestURI());
            System.out.println(" getRequestedSessionId -> " + request.getRequestedSessionId());
            System.out.println(" getServerName -> " + request.getServerName());
            System.out.println(" getScheme -> " + request.getScheme());
            System.out.println(" getServletPath -> " + request.getServletPath());
            System.out.println(" toString -> " + request.toString());
           
            Enumeration paramNames = request.getParameterNames();
            while(paramNames.hasMoreElements())
            {
                String headerName = (String)paramNames.nextElement();
                System.out.println(">>" + "<TR><TD>" + headerName);
            }
                   
            Enumeration headerNames = request.getHeaderNames();
            while(headerNames.hasMoreElements())
            {
                String headerName = (String)headerNames.nextElement();
                System.out.println(">>" + "<TR><TD>" + headerName);
            }

Output:
INFO:  Auth Type -> null
INFO:  Content Type -> application/x-www-form-urlencoded
INFO:  Char Encod -> null
INFO:  Context getContextPath -> /JSPServlet
INFO:  Context getLocalAddr -> 0:0:0:0:0:0:0:1
INFO:  Context getLocalName -> 0:0:0:0:0:0:0:1
INFO:  Context getMethod -> POST
INFO:  getPathInfo -> null
INFO:  getPathTranslated -> null
INFO:  getProtocol -> HTTP/1.1
INFO:  getQueryString -> null
INFO:  getRemoteAddr -> 0:0:0:0:0:0:0:1
INFO:  getRemoteHost -> 0:0:0:0:0:0:0:1
INFO:  getRemoteUser -> null
INFO:  getRequestURI -> /JSPServlet/HelloServlet
INFO:  getRequestedSessionId -> ee087faae47c5700828ee4bf90c9
INFO:  getServerName -> localhost
INFO:  getScheme -> http
INFO:  getServletPath -> /HelloServlet
INFO:  toString -> org.apache.catalina.connector.RequestFacade@caf3796
INFO: >><TR><TD>name1
INFO: >><TR><TD>name2
INFO: >><TR><TD>host
INFO: >><TR><TD>user-agent
INFO: >><TR><TD>accept
INFO: >><TR><TD>accept-language
INFO: >><TR><TD>accept-encoding
INFO: >><TR><TD>dnt
INFO: >><TR><TD>connection
INFO: >><TR><TD>referer
INFO: >><TR><TD>cookie
INFO: >><TR><TD>content-type
INFO: >><TR><TD>content-length

JAX WS Web service Flow


> Service Class is extended:

public class WSObjectContext extends Service

public WSObjectContext(URL wsdlURL, QName qualifiedServiceName)
{
        super(wsdlURL, qualifiedServiceName);
}



> Service Class inside build ServiceDelegate object (Service Delegate is Abstract Class class) (IN WS.SPI Package).
getPort() is returned from Service Delegate

> ServiceDelegate is created using
      Provider Abstract Class (In WS.SPI Package) and
             in Provider Abstract class there is provider method
             which returns Implementation of Provider Class (use FactoryFinder method)

      Provider for Provider class is : com.sun.xml.internal.ws.spi.ProviderImpl

> ProviderImpl class have createServiceDelegate() implementation which returns  WSServiceDelegate object which is again class of com.sun.xml.internal.ws package


The whole implementation present in rt.jar. com.sun package contains oracle reference implementations of the standard Java (EE) APIs

Java Beans - what are these?

Reusable
Software components
separate presentation layer from business logic
follow certain specification
use getter and setter method to invoke various methods
helps to seperate teams of presentation and business logic and bean communicate between them

JAX - WS Package Contents

In JDK 6





 

Monday, 10 September 2012

Correlation ID and Message ID in JMS

i checked message header of two messages coming from WMQ server and found that Correlation ID is same for two messages but Message ID are different, as shown below:

  JMSMessageID:    ID:414d5120514d44332020202020202020ece34b503d2d7428
  JMSTimestamp:    1347271147937
  JMSCorrelationID:ID:414d5120514d44332020202020202020ece34b5005e87120
 
 
   JMSMessageID:    ID:414d5120514d44332020202020202020ece34b50292d7428
  JMSTimestamp:    1347271144225
  JMSCorrelationID:ID:414d5120514d44332020202020202020ece34b5005e87120 (Same as above)

so it means both are seperate entity.





What comes in JMS Message object?

Here is data i retrieved from a JMS object call connected to WMQ:

  JMS Message class : jms_text
  JMSType :         null
  JMSDeliveryMode : 2
  JMSExpiration :   0
  JMSPriority :     4
  JMSMessageID :    ID:414d5120514d44332020202020202020ece34b503d2d7428
  JMSTimestamp :    1347271147937
  JMSCorrelationID : ID:414d5120514d44332020202020202020ece34b5005e87120
  JMSDestination :  topic://Cord_1/1
  JMSReplyTo :      null
  JMSRedelivered:  false
  JMS_IBM_PutDate:20120910
  JMSXAppID : QMD3                       
  JMS_IBM_Format : MQSTR  
  JMS_IBM_PutApplType : 26
  JMS_IBM_MsgType : 8
  JMSXUserID : mqufn2     
  JMS_IBM_PutTime : 09590803
  JMSXDeliveryCount : 1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns6:envelope xmlns:ns2="http://n.org/esb />

Implementation of Message Interface is given in class :  com.ibm.jms.JMSTextMessage