How to Install Windows Media Player on Windows Server 2008


Installing Windows Media Player (via Adding a Windows Server 2008 Feature)

1) Launch Server Manager. You can find that in Start > Administrative Tools > Server Manager.

2) Find and click the Add Features link. Hint: It’s under Features.

3) Find the Desktop Experience check box.

4) Select next or Install and follow the directions in the wizard.

5) It may require a reboot.

Note: You can’t add this feature while running a major Windows Update. My Desktop Experience install errored out when I did this the first time. I tried it again and it worked fine.

Tags: Desktop Experience, How to Add a Feature, Windows Media Player 11, Windows Server 2008

Advertisements

Get all currency updated rate


<?php
//This is aPHP(5)script example on how eurofxref-daily.xml can be parsed
//Read eurofxref-daily.xml file in memory
//For the next command you will need the config option allow_url_fopen=On (default)
$XML=simplexml_load_file(“http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml&#8221;);
//the file is updated daily between 2.15 p.m. and 3.00 p.m. CET

foreach($XML->Cube->Cube->Cube as $rate){
//Output the value of 1EUR for a currency code
echo ‘1&euro;=’.$rate[“rate”].’ ‘.$rate[“currency”].'<br/>’;
//————————————————–
//Here you can add your code for inserting
//$rate[“rate”] and $rate[“currency”] into your database
//————————————————–
}
?>

showing direction on map from two textbox and also getting alternative ways from json


file1.php

========================================================================

<!DOCTYPE html>
<html>
<head>
<meta name=”viewport” content=”initial-scale=1.0, user-scalable=no”/>
<meta http-equiv=”content-type” content=”text/html; charset=UTF-8″/>
<title>Google Maps JavaScript API v3 Example: Directions Waypoints</title>
<link href=”http://code.google.com/apis/maps/documentation/javascript/examples/standard.css&#8221; rel=”stylesheet” type=”text/css” />
<link rel=”stylesheet” type=”text/css” href=”http://carshare.vervesys.com//css/redmond/jquery-ui-1.8.1.custom.css&#8221; media=”screen” />
<link rel=”stylesheet” type=”text/css” href=”http://carshare.vervesys.com//css/coVoiturage.css&#8221; media=”screen” />
<!–AUTHOR : HARISH PATIL
DATE : 07-MARCH-2011
DESCR : GETTING DISTANCE–>

<script src=”http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAxfM792nyXR7woBqjAj9EPhRHvOZxbfYMBkr56pDT3TCnqDxE_RQyQt5acukouEbxsJtR6uKxEqImhQ&#8221; type=”text/javascript”></script>
<script type=”text/javascript” src=”http://maps.google.com/maps/api/js?sensor=false”></script&gt;
<!–AJAX–>
<script type=”text/javascript”>
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
var geocoder;
var side_bar_html = “”;
var gmarkers = [];
var htmls = [];
var i = 0;

function initialize() {

geocoder = new GClientGeocoder();
directionsDisplay = new google.maps.DirectionsRenderer();
var chicago = new google.maps.LatLng(41.850033, -87.6500523);
var myOptions = {
zoom: 3,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: chicago
}
map = new google.maps.Map(document.getElementById(“map_canvas”), myOptions);
directionsDisplay.setMap(map);

}
function stripVowelAccent(str)
{
var s=str;

var rExps=[ /[\xC0-\xC2]/g, /[\xE0-\xE2]/g,
/[\xC8-\xCA]/g, /[\xE8-\xEB]/g,
/[\xCC-\xCE]/g, /[\xEC-\xEE]/g,
/[\xD2-\xD4]/g, /[\xF2-\xF4]/g,
/[\xD9-\xDB]/g, /[\xF9-\xFB]/g ];

var repChar=[‘A’,’a’,’E’,’e’,’I’,’i’,’O’,’o’,’U’,’u’];

for(var i=0; i<rExps.length; i++)
s=s.replace(rExps[i],repChar[i]);

return s;
}
function calcRoute(start,end,waypoints,flag) {
//alert(waypoints);

var waypts = [];

if(waypoints !=null && waypoints !=”)
waypts.push({
location:waypoints,
stopover:true});

var request = {
origin: start,
destination: end,
waypoints: waypts,
optimizeWaypoints: true,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};

directionsService.route(request, function(response, status) {
if(status==google.maps.DirectionsStatus.ZERO_RESULTS)
{
alert(“Sorry, There is no result found.Please provide more specification or valid address.”);
}
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
if(flag==’0′)
{

<!–    ===================================================================================================–>
document.getElementById(‘loading’).style.display=’block’;

var url ='<?php echo config_item(‘base_url’);?>/gethint.php?address1=’+stripVowelAccent(start)+’&address2=’+stripVowelAccent(end)+’&a=’+Math.random();

var ajaxReq = getXmlHttpRequestObject();

if(ajaxReq.readyState == 4 || ajaxReq.readyState == 0)
{

ajaxReq.open(“post”, url, true);
ajaxReq.onreadystatechange = function()
{

if(ajaxReq.readyState == 4 && ajaxReq.status == 200)
{

var doc=ajaxReq.responseText;
//alert(doc);
//alert(doc);

<!–=================================XXXXXXXXXXXXXXXXXXXXXXXXXXX=====================================–>
// === Parse the JSON document ===
var jsonData = eval(‘(‘ + doc + ‘)’);
side_bar_html=””;
// === Plot the markers ===

for (var i=0; i<jsonData.routes.length;i++)
{
// var point = new GLatLng(jsonData.routes[0].legs[0].steps[i].start_location.lat, jsonData.routes[0].legs[0].steps[i].start_location.lng);
//         alert(jsonData.routes.length);
var lable=””;
var start=””;
var end=””;
var via_waypoint=””;
var via_waypoint_address=””;
var distance=””;
var times=””;

start=jsonData.routes[i].legs[0].start_address;
end=jsonData.routes[i].legs[0].end_address;
distance=jsonData.routes[i].legs[0].distance.text;
times=jsonData.routes[i].legs[0].duration.text;

if(jsonData.routes[i].legs[0].via_waypoint.length>0)
{

via_waypoint=jsonData.routes[i].legs[0].via_waypoint[0].location.lat+” “+jsonData.routes[i].legs[0].via_waypoint[0].location.lng;
point = new GLatLng(jsonData.routes[i].legs[0].via_waypoint[0].location.lat,jsonData.routes[i].legs[0].via_waypoint[0].location.lng);

side_bar_html += ‘ <input type=”radio” name=”waypoints” onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;
//   side_bar_html += start+”     “+end+”     “+distance+”     “+via_waypoint+”<br>”;
}
else
{

via_waypoint=”;
//point = new GLatLng(jsonData.routes[i].legs[0].via_waypoint[0].location.lat,jsonData.routes[i].legs[0].via_waypoint[0].location.lng);

side_bar_html += ‘ <input type=”radio” name=”waypoints”  onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;
//   side_bar_html += start+”     “+end+”     “+distance+”     “+via_waypoint+”<br>”;
}

}
side_bar_html=side_bar_html+'<br/><input type=”button” name=”submit” onclick=”return post_value();” value=”Submit” />’;
document.getElementById(“side_bar”).innerHTML = side_bar_html;
document.getElementById(‘loading’).style.display=’none’;
<!–================================XXXXXXXXXXXXXXXXXXXXXXXXXXXX=====================================–>

}
}
ajaxReq.send(null);
}
<!–            ===================================================================================================–>

}
}
});

}

<!–  ================================================–>

function getFirst()
{

var start = document.getElementById(“start”).value;
geocoder.getLocations(start, getSecond);
}
function getSecond(response)
{

var end = document.getElementById(“end”).value;
if (!response || response.Status.code != 200) {
alert(“Sorry, we were unable to geocode that address”);
}
else
{
place = response.Placemark[0];
if(place.AddressDetails.Country.CountryNameCode==”US” || place.AddressDetails.Country.CountryNameCode==”CA”)
{
geocoder.getLocations(end,hello);
}
else
{
alert(‘Departure is out of CANADA and USA location’);
}
}
}
function hello(response)
{

if (!response || response.Status.code != 200) {
alert(“Sorry, we were unable to geocode that address”);
}
else
{
place = response.Placemark[0];
if(place.AddressDetails.Country.CountryNameCode==”CA” || place.AddressDetails.Country.CountryNameCode==”US”)
{
var start = document.getElementById(“start”).value;
var end = document.getElementById(“end”).value;

calcRoute(start,end,”,’0′);

}
else
{
alert(‘Arrival is out of CANADA and USA location’);
}

}
}

<!–==============================================================================================================–>

// ================================================================
// === Define the function thats going to process the JSON file ===
function process_it (doc)
{

//alert(doc);

// === Parse the JSON document ===
var jsonData = eval(‘(‘ + doc + ‘)’);
side_bar_html=””;
// === Plot the markers ===

for (var i=0; i<jsonData.routes.length;i++)
{
// var point = new GLatLng(jsonData.routes[0].legs[0].steps[i].start_location.lat, jsonData.routes[0].legs[0].steps[i].start_location.lng);
//         alert(jsonData.routes.length);
var lable=””;
var start=””;
var end=””;
var via_waypoint=””;
var via_waypoint_address=””;
var distance=””;
var times=””;

start=jsonData.routes[i].legs[0].start_address;
end=jsonData.routes[i].legs[0].end_address;
distance=jsonData.routes[i].legs[0].distance.text;
times=jsonData.routes[i].legs[0].duration.text;

if(jsonData.routes[i].legs[0].via_waypoint.length>0)
{

via_waypoint=jsonData.routes[i].legs[0].via_waypoint[0].location.lat+” “+jsonData.routes[i].legs[0].via_waypoint[0].location.lng;
point = new GLatLng(jsonData.routes[i].legs[0].via_waypoint[0].location.lat,jsonData.routes[i].legs[0].via_waypoint[0].location.lng);

side_bar_html += ‘ <input type=”radio” name=”waypoints” onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;
//   side_bar_html += start+”     “+end+”     “+distance+”     “+via_waypoint+”<br>”;
}
else
{

via_waypoint=”;
//point = new GLatLng(jsonData.routes[i].legs[0].via_waypoint[0].location.lat,jsonData.routes[i].legs[0].via_waypoint[0].location.lng);

side_bar_html += ‘ <input type=”radio” name=”waypoints” id=”temp_waypoints” onclick=”selectWay(\”+start+’\’,\”+end+’\’,\”+via_waypoint+’\’,\”+distance+’\’);” value=”‘+distance+'” />Way ‘+(i+1)+’ : ‘+’ Distance (‘+distance+’) Times (‘+times+’)<br/>’;
//   side_bar_html += start+”     “+end+”     “+distance+”     “+via_waypoint+”<br>”;
}

}
side_bar_html=side_bar_html+'<br/><input type=”button” onclick=”return post_value();” name=”submit” value=”Submit” />’;
document.getElementById(“side_bar”).innerHTML = side_bar_html;
document.getElementById(‘loading’).style.display=’none’;

}

function selectWay(start,end,waypoints,distance)
{
document.getElementById(“address1”).value = start;
document.getElementById(“address2″).value = end;
document.getElementById(‘waypoints’).value=waypoints;
document.getElementById(‘miledistance’).value=distance;
calcRoute(start,end,waypoints,’1′);
}

</script>
<script langauge=”javascript”>
function post_value(){
var len=document.frmvalue.waypoints.length;
var flag=false;
for(var i=0;i<len;i++){
if(document.frmvalue.waypoints[i].checked==true){
flag=true;
}
}

if(flag==false)
{
alert(‘Please select atleast one route’);
return false;
}
else
{
opener.document.formOfferTrip.miledistance.value = document.frmvalue.miledistance.value;
opener.document.formOfferTrip.departureWaypoint.value = document.frmvalue.address1.value;
opener.document.formOfferTrip.arrivalWaypoint.value = document.frmvalue.address2.value;
opener.document.formOfferTrip.waypoints.value = document.frmvalue.waypoints_1.value;
var html='<label name=”lbl2″ id=”lbl2″ style=”margin-top:-6px”>Distance : </label>’+document.frmvalue.miledistance.value;
opener.document.getElementById(‘distance_section’).style.display=’block’;
opener.document.getElementById(‘distance_section’).innerHTML = html;
self.close();
}
}
</script>
<!–AJAX–>

<script type=”text/javascript”>

function getXmlHttpRequestObject()
{
if (window.XMLHttpRequest)
{
return new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
return new ActiveXObject(“Microsoft.XMLHTTP”);
}
else
{
alert(“Please upgrade your browser. The current version does not support the booking request.”);
}
}

</script>

<!–END–>
</head>
<body style=”background-color:#63caf3;” onLoad=”initialize();”>

<div style=”background-color:#8fd9f7″>

<div id=”directions_panel” style=”margin:20px;background-color:#FFEE77;display:none;” style=”background-color:#63caf3;”></div>
<div style=”float:right”>

</div>
<table width=”100%” border=”0″>
<tr>
<td style=”width:35%;”>
<form action=”” name=”frm”>
<table align=”center” border=”none” style=”border:0″>
<tr>
<td><label for=”departureCity”>Departure</label></td>
<td><input type=”text” name=”address1″ id=”start” value=”” /></td>
</tr>
<tr>
<td><label for=”departureCity”>Arrival</label></td>
<td><input type=”text” name=”address2″ id=”end” value=””  /></td>
</tr>
<tr>
<td colspan=”2″ align=”center”><input type=”hidden” name=”oper” value=”search” />
<button type=”button” onClick=”getFirst();” value=”button” style=”color:#FFFFFF;height:20px;” >&nbsp;Search</button>
</td>
</tr>
</table>
</form>
</td>
<td>
<form name=”frmvalue” action=”<?php echo config_item(‘base_url’);?>/index.php/trip/displayOffer” method=”post”>
<div id=”side_bar”></div>
<input type=”hidden” name=”miledistance” id=”miledistance” value=”” />
<input type=”hidden” name=”address1″ id=”address1″ value=”” />
<input type=”hidden” name=”address2″ id=”address2″ value=””  />
<input type=”hidden” name=”waypoints_1″ id=”waypoints” value=””  />

</form>
<div id=”loading”  style=” text-align:center;border:none;z-index:1;display:none;”>
<img src=”http://carshare.vervesys.com/ajax-loader_new.gif&#8221; style=”border:none;”>
</div>

</td>
</tr>
<tr>
<td colspan=”2″ style=”width:100%;height:500px;” ><div id=”map_canvas” style=”float:left;width:100%;height:500px;”></div> </td>
</tr>
</table>
<input type=”hidden” name=”filename” id=”filename” value=””/>
</div>

</body>
</html>
================================================================================

gethint.php

=================================================================================
<?php

$address1=trim($_REQUEST[“address1”]);
$address2=trim($_REQUEST[“address2″]);

$Url=”http://maps.googleapis.com/maps/api/directions/json?origin=&#8221;.$address1.”&destination=”.$address2.”&sensor=false&alternatives=true”;//exit;
$Url=str_replace(” “,”%20″,$Url);
//http://maps.googleapis.com/maps/api/directions/json?origin=Seneca Planetarium Seneca College, 1750 Finch Ave E, Toronto, Toronto Division, Ontario M2J 5G3, Canada&destination=ny,us&sensor=false&alternatives=true
// create a new curl resource

//    $Url=”http://maps.googleapis.com/maps/api/directions/json?origin=Seneca%20Planetarium%20Seneca%20College,%201750%20Finch%20Ave%20E,%20Toronto,%20Toronto%20Division,%20Ontario%20M2J%205G3,%20Canada&destination=ny,us&sensor=false&alternatives=true&#8221;;

$ch = curl_init();
// set URL to download
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt ($ch, CURLOPT_POST, 1);
// set referer:

// user agent:
//curl_setopt($ch, CURLOPT_USERAGENT, “MozillaXYZ/1.0”);

// remove header? 0 = yes, 1 = no
curl_setopt($ch, CURLOPT_HEADER, 0);

// should curl return or print the data? true = return, false = print
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// timeout in seconds
//    curl_setopt($ch, CURLOPT_TIMEOUT, 1000);

// download the given URL, and return output
$output = curl_exec($ch);
/*$filename = “json/”.time().”.json”;

$handle = fopen($filename, ‘w+’);
chmod($handle,’777′);
if($handle)
{

if(!fwrite($handle, $output))
die(“couldn’t write to file.”);

}*/

curl_close($ch);
//echo $filename;

echo $output;
//echo $output;

?>

convert accentuated characters of french into english


function stripVowelAccent(str)
{
var s=str;

var rExps=[ /[\xC0-\xC2]/g, /[\xE0-\xE2]/g,
/[\xC8-\xCA]/g, /[\xE8-\xEB]/g,
/[\xCC-\xCE]/g, /[\xEC-\xEE]/g,
/[\xD2-\xD4]/g, /[\xF2-\xF4]/g,
/[\xD9-\xDB]/g, /[\xF9-\xFB]/g ];

var repChar=[‘A’,’a’,’E’,’e’,’I’,’i’,’O’,’o’,’U’,’u’];

for(var i=0; i<rExps.length; i++)
s=s.replace(rExps[i],repChar[i]);

return s;
}

How to pass value from child window to parent window


To open the child window this is the code used in parent window

<form method=post action=” name=f1>
<table border=0 cellpadding=0 cellspacing=0 width=550> <tr>
<td ><font size=2 face=’Verdana’>Your Name</font><input type=text name=’p_name’ size=’8′>
<a href=”javascript:void(0);” NAME=”My Window Name” title=” My title here ”
onClick=window.open(“child3.html”,”Ratting”,
“width=550,height=170,left=150,top=200,toolbar=1,status=1,”);>Click here to open the child window</a> 

</td></tr> </table></form>

Inside the Child window code is here

<html>
<head>

<script langauge=”javascript”>
function post_value(){
opener.document.f1.p_name.value = document.frm.c_name.value;
self.close();
}
</script>

<title>(Type a title for your page here)</title>
</head>

<body bgcolor=”#ffffff” text=”#000000″ link=”#0000ff” vlink=”#800080″ alink=”#ff0000″>

<form name=”frm” method=post action=”>
<table border=0 cellpadding=0 cellspacing=0 width=250>

<tr><td align=”center”> Your name<input type=”text” name=”c_name” size=12 value=test> <input type=button value=’Submit’ onclick=”post_value();”>
</td></tr>
</table></form>