Find the Latitude and Longitude using Gmap

Hi,

Google gives the great Javascript Api for finding the Location latitude and longitude by just giving the address only

This is following code

<script src=”http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAANez3-95VQQxZUR1e1BaC7RQlRyH5qh-HDT3ImsMIYwyhpUeTghSwTS8yZGHT9D9mFG6mgXkotPdcKw&#8221; type=”text/javascript”></script>

var address =’chennai’;

var geocoder = new GClientGeocoder();

if ( geocoder ) {
geocoder.getLatLng(
address,
function(point) {
if ( !point ) {
//alert(address + ” not found”);
$(“#error”).html(address + ” not found”);
$(“#mapurl”).focus();
} else {
$(“#wp_geo_latitude”).val(point.lat());
$(“#wp_geo_longitude”).val(point.lng());
}
}
);
}
});

if you need more details please visit here

Advertisements

Bing Map Bird’s view

Hi,

i worked in a project for that my client ask to display the bing map instead of google map. i surprised why the client need’s the bing map what  is the feature  but after i saw the bing map i really feel that “Bing Map is  better than the google map”  becausebing map showing birds eye view with a photosynth overlay ,a draggable map (yes you can move this map with your mouse) ,context actions by right clicking the map (zoom in/out and ‘move map to here’) . it is very simple to integrate in your page . blow are the example i used

<body onLoad=”GetMap();”>
<div id=’myMap’ style=”position:relative; width:400px; height:400px;”></div>
<script type=”text/javascript” src=”http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2″></script&gt;
<script type=”text/javascript”>

var map = null;

function GetMap() {
map = new VEMap(‘myMap’);
map.LoadMap(new VELatLong(34.042765, -118.256063), 10, VEMapStyle.Birdseye, false);
}
</script>
</body>

This is the output of the code

Display a Success Message like Twitter

Hi,

 

i find the Css and Jquery way to display the Error or Success Message Like Twitter. For this you need Jquery.js and the Small css

 

Here Is my Code

 

CSS

 

.notification
{
text-align: center;
display: none;
width: 100%;
position: fixed;
padding-top: 8px;
padding-bottom: 8px;
margin: 0;
font-weight: bold;
font-size: 1.2em;
overflow: visible;
}
.success {background:#FFF;color:#264409;border-color:#c6d880;}
.error, .alert, .notice, .success, .info {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
.error, .alert {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}

Javascript

 

var notifyCallBack;

function showNotification(message, type, callback) {

notifyCallBack = callback;

var notification = $(“#notification”);
notification.removeClass(“success notice error”);
notification.addClass(type);

//Make sure it’s visible even when top of the page not visible
notification.css(“top”, $(window).scrollTop());
notification.css(“width”, $(document).width()/2 +40);

// $(“#notification-text”).html(message);

//show the notification
notification.slideDown(“slow”, function() {

});
}

function hideNotification() {
$(“#notification”).slideUp(“slow”, function() {
if (null != notifyCallBack && (typeof notifyCallBack == “function”)) {
notifyCallBack();
}
//reset the callback variable
notifyCallBack = null
});
}

 

In Html

 

Past the Below code

 

<div id=”notification” class=’notification’>

<span id=’notification-text’></span>

</div>

 

call the function Body on load or at the end of the page showNotification(”, “success”, function(){});

 

 

 

Convert XML to JSON in PHP

IBM’s developerWorks has posted an interesting article on converting XML to JSON using PHP. At first glance, the question would be “Why”? After all, both XML and JSON serve similar purposes and they both do their job. Almost. It turns out that people find it much easier to process JSON data in the browser than XML. Since many web services return XML, there needs to be a conversion process. Here’s where IBM’s article comes in. Here’s a quote where they talk a little about what they are trying to do.

More and more applications need to convert XML data into JSON. Several Web-based services are already popping up to do such conversions. The IBM T.J. Watson Research Center has developed a particular approach that uses PHP to do the conversion. This approach accepts XML string data as input and converts that into JSON-formatted data output. This PHP-based solution provides several benefits:

  • It can be run in a standalone mode, executed from the command line.
  • It can be included in an existing server-side code artifact.
  • It can be easily hosted as a Web service on the Web.

If you are working with web services, especially if you are proxying other’s services for your own use, you’ll want to read this article. It’s not a long read. If you are already familiar with XML and JSON then it’s even shorter because you can skip the “basics” sections. Most of the rest of the article is source code and explanations.

We used XML for the web service api, and converting xml(returned from REST web service API) to php array was consuming time, does using JSON for web service, increases the performance?

For this we need the xml2json.php

xml2json.php – A PHP class with two static functions

you can download the file form here

http://www.ibm.com/developerworks/xml/library/x-xml2jsonphp/#download

Sorting A Table in Html Using Javascript

Hi,

In any Programming language of code like PHP, ASP there is need to sort a table content in any one of the order ascending or descending. i found the java script to sort a content of table it is very easy to integrate in only the template. it doesn’t need to page load. it very easy to implement. Please find the Zip file sortable.zip in the side box my shared file and keep enjoying 🙂

Facebook-style lightbox

What is it?

Facebox is a jQuery-based, Facebook-style lightbox which can display images, divs, or entire remote pages.

It’s simple to use and easy on the eyes. Download the tarball, view the examples, then start enjoying the curves.

find the code facebook.rar in my share box and use it

The Code

<a href="stairs.jpg" rel="facebox">text</a>

give a Title in javascript alert box

To give a alert box title in javascript. Please find the files alert.rar in my share box Try the demo below

Free Scripts And Tools

<HTML>
<HEAD>
<TITLE>Free Scripts And Tools</TITLE>
</HEAD>
<BODY>
<STYLE type=”text/css”>
.okButton {
background-color: #D4D4D4;
font-color: #000000;
font-size: 9pt;
font-family: arial;
width: 70px;
height:    20px;
}
.alertTitle {
background-color: #3C56FF;
font-family: arial;
font-size: 9pt;
color: #FFFFFF;
font-weight: bold;
}
.alertMessage {
font-family: arial;
font-size: 9pt;
color: #000000;
font-weight: normal;
}
.alertBoxStyle {
cursor: default;
filter: alpha(opacity=90);
background-color: #E4E4E4;
position: absolute;
top: 200px;
left: 200px;
width: 100px;
height: 50px;
visibility:hidden; z-index: 999;
border-style: groove;
border-width: 5px;
border-color: #FFFFFF;
text-align: center;
}
</STYLE>
<div id=”alertLayer”></div>
<SCRIPT LANGUAGE=”JavaScript”>
function BrowserCheck() {
var b = navigator.appName;
if (b == “Netscape”) this.b = “NS”;
else if (b == “Microsoft Internet Explorer”) this.b = “IE”;
else this.b = b;
this.v = parseInt(navigator.appVersion);
this.NS = (this.b == “NS” && this.v>=4);
this.NS4 = (this.b == “NS” && this.v == 4);
this.NS5 = (this.b == “NS” && this.v == 5);
this.IE = (this.b == “IE” && this.v>=4);
this.IE4 = (navigator.userAgent.indexOf(‘MSIE 4’)>0);
this.IE5 = (navigator.userAgent.indexOf(‘MSIE 5′)>0);
if (this.IE5 || this.NS5) this.VER5 = true;
if (this.IE4 || this.NS4) this.VER4 = true;
this.OLD = (! this.VER5 && ! this.VER4) ? true : false;
this.min = (this.NS||this.IE);
}
is = new BrowserCheck();
alertBox = (is.VER5) ? document.getElementById(“alertLayer”).style
: (is.NS) ? document.layers[“alertLayer”]
: document.all[“alertLayer”].style;

function hideAlert(){
alertBox.visibility = “hidden”;}

function makeAlert(aTitle,aMessage){
document.all.alertLayer.innerHTML = “<table border=0 width=100% height=100%>” +
“<tr height=5><td colspan=4>” + ” ” + aTitle + “</td></tr>” +
“<tr height=5><td width=5></td></tr>” +
“<tr><td width=5></td><td width=20 align=left><img src=’alert.gif’></td><td align=center>” + aMessage + “<BR></td><td width=5></td></tr>” +
“<tr height=5><td width=5></td></tr>” +
“<tr><td width=5></td><td colspan=2 align=center><input type=button value=’OK’ onClick=’hideAlert()’><BR></td><td width=5></td></tr>” +
“<tr height=5><td width=5></td></tr></table>”;
thisText = aMessage.length;
if (aTitle.length > aMessage.length){ thisText = aTitle.length; }

aWidth = (thisText * 5) + 80;
aHeight = 100;
if (aWidth < 150){ aWidth = 200; }
if (aWidth > 350){ aWidth = 350; }
if (thisText > 60){ aHeight = 110; }
if (thisText > 120){ aHeight = 130; }
if (thisText > 180){ aHeight = 150; }
if (thisText > 240){ aHeight = 170; }
if (thisText > 300){ aHeight = 190; }
if (thisText > 360){ aHeight = 210; }
if (thisText > 420){ aHeight = 230; }
if (thisText > 490){ aHeight = 250; }
if (thisText > 550){ aHeight = 270; }
if (thisText > 610){ aHeight = 290; }

alertBox.width = aWidth;
alertBox.height = aHeight;
alertBox.left = (document.body.clientWidth – aWidth)/2;
alertBox.top = (document.body.clientHeight – aHeight)/2;

alertBox.visibility = “visible”;
}

// WHEN YOU WANT TO GENERATE AN ALERT DO THIS:
// CALL THE makeAlert FUNCTION AND PASS THE ALERT TITLE AND THE MESSAGE
// TO THE FUNCTION.
// eg. makeAlert(‘My Alert Title’ , ‘My Alert Message’);
</SCRIPT>
<CENTER>
Click on the bellow buttons and compare the two alerts. You will see that the Alert is just like the JavaScript alert but looks 10 times better. <BR>
<BR>
<BR>
<INPUT TYPE=button value=”Click Here For A Normal JavaScript Alert” onClick=”alert(‘A Boring JavaScript Alert’);”>
<BR>
<BR>
<a href=”javascript:void(0);” onClick=”makeAlert(‘karuppasamy’,’Your Alert Message Goes Here, This Script Is Very Very Easy To Use’);”>Click Here</a>
<P>
</BODY>
</HTML>