Configure HTML/JavaScript

Wednesday, May 26, 2010

JSON (javascript object notification)

Hi all,

This is one of the technology you can use to make your javascript and ajax objects more powerfull.

declaring object:

var newJsonObj = {}
vat newJsonArr = [];

newJsonObj = { "tty" : android,
"name", aniruddha das,
"posts" : [
{"":thid,}
]
}

in reference to: 4shared.com - free file sharing and storage (view on Google Sidewiki)

Sunday, May 23, 2010

generating a popup calender in javascript

// written by Tan Ling Wee on 2 Dec 2001
// last updated 10 Apr 2002
// email : fuushikaden@yahoo.com

var fixedX = -1 // x position (-1 if to appear below control)
var fixedY = -1 // y position (-1 if to appear below control)
var startAt = 1 // 0 - sunday ; 1 - monday
var showWeekNumber = 1 // 0 - don't show; 1 - show
var showToday = 1 // 0 - don't show; 1 - show
var imgDir = "images/" // directory for images ... e.g. var imgDir="/img/"

var gotoString = "Go To Current Month"
var todayString = "Today is"
var weekString = "Wk"
var scrollLeftMessage = "Click to scroll to previous month."
var scrollRightMessage = "Click to scroll to next month."
var selectMonthMessage = "Click to select a month."
var selectYearMessage = "Click to select a year."
var selectDateMessage = "Select [date] as date." // do not replace [date], it will be replaced by date.

var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear

var bPageLoaded=false
var ie=document.all
var dom=document.getElementById

var ns4=document.layers
var today = new Date()
var dateNow = today.getDate()
var monthNow = today.getMonth()
var yearNow = today.getYear()
var imgsrc = new Array("drop1.gif","drop2.gif","left1.gif","left2.gif","right1.gif","right2.gif")
var img = new Array()

var bShow = false;

/* hides and objects (for IE only) */
function hideElement( elmID, overDiv )
{
if( ie )
{
for( i = 0; i < document.all.tags( elmID ).length; i++ )
{
obj = document.all.tags( elmID )[i];
if( !obj || !obj.offsetParent )
{
continue;
}

// Find the element's offsetTop and offsetLeft relative to the BODY tag.
objLeft = obj.offsetLeft;
objTop = obj.offsetTop;
objParent = obj.offsetParent;

while( objParent.tagName.toUpperCase() != "BODY" )
{
objLeft += objParent.offsetLeft;
objTop += objParent.offsetTop;
objParent = objParent.offsetParent;
}

objHeight = obj.offsetHeight;
objWidth = obj.offsetWidth;

if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );
else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );
else if( overDiv.offsetTop >= ( objTop + objHeight ));
else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
else
{
obj.style.visibility = "hidden";
}
}
}
}

/*
* unhides and objects (for IE only)
*/
function showElement( elmID )
{
if( ie )
{
for( i = 0; i < document.all.tags( elmID ).length; i++ )
{
obj = document.all.tags( elmID )[i];

if( !obj || !obj.offsetParent )
{
continue;
}

obj.style.visibility = "";
}
}
}

function HolidayRec (d, m, y, desc)
{
this.d = d
this.m = m
this.y = y
this.desc = desc
}

var HolidaysCounter = 0
var Holidays = new Array()

function addHoliday (d, m, y, desc)
{
Holidays[HolidaysCounter++] = new HolidayRec ( d, m, y, desc )
}

if (dom)
{
for (i=0;i<

in reference to: Google (view on Google Sidewiki)

opening a new divisin window in javascript and handling ajax operation

//generate the message window

function showWindow(varTotalTax,evt)
{

//var evt = (evt) ? evt : ((window.event) ? window.event : "")
if(evt)
{
var elem = (evt.target) ? evt.target : evt.srcElement
var id = elem.id;
var x = evt.clientX - 10;
var y = evt.clientY + document.body.scrollTop+4;
var divObj = document.getElementById("popupdiv");
divObj.style.display = "block";
divObj.style.position = "absolute";
divObj.style.left = x;
divObj.style.top = y;
if(varTotalTax !=0)
{
divObj.innerHTML = "

"+varTotalTax+"

"
}
else
{
divObj.innerHTML = "Notes not available
X "
}
}
}

// close the generated window
function divclose(name)
{
var divObj;
divObj= document.getElementById(name);
divObj.style.display = "none";
}

in reference to: Google (view on Google Sidewiki)

sending ajax request

function selectState(e)
{
if(e==212)
{
//document.getElementById("countryLvl").innerHTML = "";
document.getElementById("stateLebel").innerHTML = "County : ";
document.getElementById("state").innerHTML = "";
//document.getElementById("countryLvl").innerHTML = "";

}
else
{
document.getElementById("stateLebel").innerHTML = "State : ";
if(xmlHttp)
{
try {
xmlHttp.open("GET","SelectState.php?country="+e, true);
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(null);
} catch(e) {
alert("Can't connect to server:\n" + e.toString());
}
}
}
}

/*function selectCity(e)
{
var myDivLebel = document.getElementById("cityLebel"); //.innerHTML;
myDivLebel.innerHTML = "City : ";

if(xmlHttp)
{
try {
var country = document.getElementById("countryId").value;
xmlHttp.open("GET","SelectState.php?country="+country+"&state="+e, true);
xmlHttp.onreadystatechange = handleServerResponseCity;
xmlHttp.send(null);
} catch(e) {
alert("Can't connect to server:\n" + e.toString());
}
}
}*/

function handleServerResponse()
{
myDiv = document.getElementById("state");
// display the status o the request
/* if (xmlHttp.readyState == 1)
{
myDiv.innerHTML = "Request status: 1 (loading)
";
}
else if (xmlHttp.readyState == 2)
{
myDiv.innerHTML = "Request status: 2 (loading)
";
}
else if (xmlHttp.readyState == 3)
{
myDiv.innerHTML = "Request status: 3 (loading)
";
}
else*/ if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
try {
response = xmlHttp.responseText;
//myDiv.innerHTML += "Request status: 4 (complete). Server said:
";
myDiv.innerHTML = response;
} catch(e) {
alert("Error reading the response: " + e.toString());
}
}
}
}

function handleServerResponseCity()
{
myDiv = document.getElementById("city");
/* if (xmlHttp.readyState == 1)
{
myDiv.innerHTML = "Request status: 1 (loading)
";
}
else if (xmlHttp.readyState == 2)
{
myDiv.innerHTML = "Request status: 2 (loading)
";
}
else if (xmlHttp.readyState == 3)
{
myDiv.innerHTML = "Request status: 3 (loading)
";
}
else*/ if (xmlHttp.readyState == 4)
{
// continue only if HTTP status is "OK"
if (xmlHttp.status == 200)
{
try {
response = xmlHttp.responseText;
//myDiv.innerHTML += "Request status: 4 (complete). Server said:
";
myDiv.innerHTML = response;
} catch(e) {
alert("Error reading the response: " + e.toString());
}
}
}
}

in reference to: Google (view on Google Sidewiki)

JavaScript ajax call using xmlHttpRequest and xmlHttpResponse

var xmlHttp = createXmlHttpRequestObject();

function createXmlHttpRequestObject() {
  var xmlHttp;
// if running Internet Explorer  if(window.ActiveXObject) {
    try {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlHttp = false;
      }
    }
  } else { // if running Mozilla or other browsers    
    if(!xmlHttp && typeof ActiveXObject == "undefined") {
      try {
        xmlHttp = new XMLHttpRequest();
      } catch (e) {
        xmlHttp = false;
      }
    }
  }
// return the created object or display an error message  if (!xmlHttp) {
    alert("Error creating the XMLHttpRequest object.");
  } else {
    return xmlHttp;
  }
}


Tuesday, May 18, 2010

jave project arcteture

Hi,

Project Architecure means what are the tiers in our project with flow diagram.

supposoe our project contains five tiers like client tier ,presentation tier, Business tier,Integration tier,Data tier. then we draw the all tiers flow.

project approch is different from project architecure. sorry here i can't insert my own project architecure diagram. if any one want project architecure , project approch then mail me.

Client tier:

• IE Browser (default) from which the end user will access the application
• The request from the browser will be submitted to the Application Server using HTTP protocol.
• The Response from the presentation layer (struts framework) will be interpreted into html pages to view on the browsers.
• Presentation Tier:

Struts Framework with Tiles
• On Request from the browser, the appropriate Action Class handles the user request. The Action class then connects to the business tier via Service Business Delegate.
• Tiles have been used to create a set of pages with a consistent user interface (e.g.: the same navigation bar, header, footer, etc.).
• Taglibs are used for displaying tabular data (e.g. search results) in a consistent fashion, with pagination.
Business Delegate layer
• Enable the Struts Action classes to be unaware of underlying Session Beans
• Encapsulates the invocation of Service Locator to locate them.

Advantages of Struts
‘Centralized File-Based Configuration’, i.e. rather than hard-coding information into Java programs, many Struts values are represented in XML or property files.
This loose coupling means that many changes can be made without modifying or recompiling Java code.
Validation of the user entry fields in the jsps to be handled by entries in the validation.xml and defining validation rules in validator-rules.xml.
Internationalization of the static components of the screen as field and button labels, titles, error messages etc.
This approach also lets Java and Web developers to focus on their specific tasks (like implementing business logic, presenting certain values to clients.) without needing to know about the overall system layout.

Business Tier

• The Business Delegate identifies the business service class (the Session EJBs) and delegates client request to the EJBs. Internally, the session beans are shallow, and delegate all business logic requests to business logic POJOs, which in turn implement the actual functionality.
• The Business Logic POJOs encapsulate the server side business logic. They do not use Hibernate directly, but instead call upon Data Access Objects (DAO) to work with the model. Parameters and return values are modeled as Data Transfer Objects (DTO), and hence no Hibernate model classes will ever leave the DAO layer. The business logic is made available in the business service class, which increases maintainability and easy debugging, if necessary.

Hibernate/DB Tier
The DAOs encapsulates the database access. For all practical purposes, we are using Hibernate (v 2.1) as the OR mapping layer. This saves development time to write SQLs for executing insert and update statements, find by primary key etc. For each value object that directly or compositely represent a table in the database, we have Hibernate mapping files.
For some complex data retrieval, however we will be using raw SQLs (independent of database) from the DAOs and populate the Value Object POJOs. In those specific cases, the DAOs will be having direct access to the Databases using the available connection. The connection properties of the ‘DB Manager’, holding the data sources, direct the request to the appropriate database.

Issues that may rise of Hibernate
• Hibernate no longer supports dynamic proxies
• The Hibernate has issues using Microsoft's driver especially when using SqlServer2000. It appears that the failures are due to some strange handling of dates.
• Hibernate has issues with Informix Databases due to the way JDBC implementation is done in Informix.

keeps smiling and mailing

bora_srinivasarao@yahoo.co.in
Hyderabad

"HELP EVER HU

in reference to: Google (view on Google Sidewiki)

hi

Android Development


Android development is very easy now with Android Studio 2.0. Google guys changed almost everything they can to make the android development super fast and easy. The best part is lots of configuration are automated and you dont have to write or make configuration related changes to start porject.


Developing application in Android studio 2.0

Now a days developing android application is really easy, i remember those days when I started with eclipse and there were hell lot of bugs everywhere. 

Templates:


To start a new porject in android studion 2.0, you can go to the new project wizard and then you will get more options like which types of project you want to create, what layout you want to use, how your pplication will react to the UI, etc. Also they included new now a days device options as well. like if your app will run on android watch, tv etc.

if you are new to android development, you can get all kind of latest news and help at  developer.android.com.