Posts

Showing posts from 2012

Steps for installation of fonts on Windows 2008 Server and Tomcat Application Sever.

Image

Fetchinng Facebook Friend List Running Example Using Javascript Sdk

Only replace your Api Id from YourApiIdHere and fetch friend information acording to requirement


<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
        <title> 'FbFriends'</title>
        <script src="http://connect.facebook.net/en_US/all.js"></script>
        <script src="http://code.jquery.com/jquery-latest.js"></script>
        <!--<link rel="stylesheet" type="text/css" href="styles.css">-->
  </head>
    <body>
     <div id="fb-root"></div&g…

Post on Friend's Wall without Facebook Pop up using Javascript Sdk.

function PostOnFriendsWall()
{
        var access_token=document.getElementById("access_token").value;
        var sendername=document.getElementById("sendername").value;
        status1 = document.getElementById('message').value;
        var facebookid = document.getElementsByName("facebookid");

        FB.api(
        {
            method: 'stream.publish',
            message: status1,
            target_id: facebookid,
            access_token:access_token,
            attachment: {
            name: ''Your Message Here by'+sendername+' via Javascript Sdk.',
            caption: 'Your Caption Here',
            description: ('Your Discription Here'),
            href: 'Your URL Here where you want to redirect after click',
            media: [
                    {
                        type: 'image',
                        href: 'Your URL Here where you want to redirect after…

Wall Post on Your Facebook Wall using Javascript Sdk

unction postOnSenderWallForMoneyGift()
{
    var FriendsName = document.getElementsByName("FriendsName");
    var access_token=document.getElementById("access_token").value;          
    for (i = 0; i< FriendsName.length; i++)
    { 
        recipient = FriendsName[i].value;
        FB.api(
        {
            method: 'stream.publish',
            access_token:access_token,
            attachment: {
            name: ''Your Message Here by'+sendername+' via Javascript Sdk.',
            caption: 'Your Caption Here',
            description: ('Your Discription Here'),
            href: 'Your URL Here where you want to redirect after click',
            media: [
                    {
                        type: 'image',
                        href: 'Your URL Here where you want to redirect after click',
                        src: 'Your Website Image Url if you want to display your…

Calling Ajax Function in Struts Running Example

function AjaxFunction()
{
    var xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    }
    var url="userwelcome.do?method=getContactById&contact_id="+cntId;
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        {
            var content=xmlHttp.responseText;
            document.getElementById("Res_Div_ID").innerHTML=    xmlHttp.responseText;
            document.getElementById("Div_ID").style.display        =    "none";
            document.getElementById("Disp_Div_ID").style.display=    "none";
        }
    };
    xmlHttp.open("POST",url,true);
    xmlHttp.send(null);
}

function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
    {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
    }catch (e)
    {
        // Internet Explorer
        try
        …

Differentiate between a Statement and a PreparedStatement.

• A standard Statement is used for creating a Java representation for a literal SQL statement and for executing it on the database.

• A PreparedStatement is a precompiled Statement.

• A Statement has to verify its metadata in the database every time.

• But ,the prepared statement has to verify its metadata in the database only once.

• If we execute the SQL statement, it will go to the STATEMENT.

• But, if we want to execute a single SQL statement for the multiple number of times, it’ll go to the PreparedStatement.

Describe how the JDBC application works.

A JDBC application may be divided into two layers:

• Driver layer

• Application layer

• The Driver layer consists of DriverManager class & the JDBC drivers.

• The Application layer begins after putting a request to the DriverManager for the connection.

• An appropriate driver is chosen and used for establishing the connection.

• This connection is linked to the application layer.

• The application needs the connection for creating the Statement kind of objects by which the results are obtained.

Explain the life cycle of JDBC.

The life cycle for a servlet comprises of the following phases:

• DriverManager : for managing a list of database drivers.

• Driver : for communicating with the database.

• Connection : for interfacing with all the methods for connecting a database.

• Statement : for encapsulating an SQL statement for passing to the database which had been parsed, compiled, planned and executed.

• ResultSet: for representing a set of rows retrieved for the query execution.

Briefly tell about the JDBC Architecture

The JDBC Architecture consists of two layers:

1.The JDBC API
2.The JDBC Driver API

• The JDBC API provides the application-JDBC Manager connection.

• The JDBC Driver API supports the JDBC Manager-to-Driver Connection.

• The JDBC API interacts with a driver manager, database-specific driver for providing transparent connectivity for the heterogeneous databases.

• The JDBC driver manager authenticates that the correct driver has been used to access each data source.

• The driver manager supports multiple concurrent drivers connected to the multiple heterogeneous databases.

How do Java applications access the database using JDBC?

Java applications access the database using JDBC by :

• Communicating with the database for Loading the RDBMS specific JDBC driver

• Opening the connection with database

• Sending the SQL statements and get the results back.

• Creating JDBC Statement object which contains SQL query.

• Executing statement to return the resultset(s) containing the tuples of database table which is a result of SQL query.

• Processing the result set.

• Closing the connection.

Explain the difference between abstract class and interfaces with an example for each.

Explain the difference between abstract class and interfaces with an example for each.The differences between abstract class and interface are as follows:
Abstract Class Interface Can have abstract methods and concrete methods Can have only method signatures and static final members All methods are not by default public All methods by default abstract and public An abstract class can extend another abstract class An interface can extend another interface but not a class The extended class can override the methods of its super class and its hierarchy An implementing class can implement multiple interfaces All abstract methods must have abstract access modifier All methods in an interface must not have abstract access modifier The following examples illustrate the differences:
abstract class Shape
{
       abstract void area();
       abstract void perimeter();
       void someMethod() // concrete method
       {
              ..
       }
}
interface Shape
{
       void area();

Android Interview Questions and Answers

Image
Android Interview Questions and Answers Describe Android Application Architecture.
Android Application Architecture has the following components:
• Services – like Network Operation
• Intent – To perform inter-communication between activities or services
• Resource Externalization – such as strings and graphics
• Notification signaling users – light, sound, icon, notification, dialog etc.
• Content Providers – They share data between applications
Describe a real time scenario where android can be used?
Imagine a situation that you are in a country where no one understands the language you speak and you can not read or write. However, you have mobile phone with you.
With a mobile phone with android, the Google translator translates the data of one language into another language by using XMPP to transmit data. You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens.
What’s the difference between f…