web stats analysis

Archive for August 18th, 2013

How to redirect all the post URL?

To redirect all the post URL.

Then write the below code intp header.php page:

            

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new_site.com");
?>

            
            

Your pagee has been redirect

How to Clear browser cookies, cache and history – Internet Explorer 8.0?

Clear browser cookies, cache and history – Internet Explorer 8.0.

Then follow the below steps:

Step:1-Open Internet Explorer.
Step:2-Click the Tools -> Internet Options.
Step:3-Click the General tab, under the Browser history section, click Delete.
Step:4-Check the Temporary Internet files, Cookies, and History check boxes, and then click Delete.

Your browser has been clear:

How to find distance between two places using google api?

How to find distance between two places using google api?

I try and get the solution:

Follow by below step:

Step:1-Open your ms visual studio.
Step:2-Go to file -> new -> website.
Step:3-Open your Default.aspx page.
Step:4-Write the below code between head tag after title tag.


<style type="text/css">
.style1
{
height: 30px;
}
</style>

<script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"
type="text/javascript"></script>

<script type="text/javascript">
function AutoComplete() {
try {
var txtinput = document.getElementById('TextBox1');
var complete = new google.maps.places.Autocomplete(txtinput);
complete.setTypes('changetype-geocode');
}
catch (err) {
// alert(err);
}
}

function distance() {
try {
var txtinput = document.getElementById('TextBox2');
var complete = new google.maps.places.Autocomplete(txtinput);
complete.setTypes('changetype-geocode');
}
catch (err) {
// alert(err);
}
}

google.maps.event.addDomListener(window, 'load', AutoComplete);
google.maps.event.addDomListener(window, 'load', distance);
</script>

Step:5-Then write below code between body tag.


<form id="form1" runat="server">
<div>
<table cellpadding="0" cellspacing="0" align="center" width="700">
<tr>
<td colspan="2" height="40">
<b>Distance calculation using Google API</b>
</td>
</tr>
<tr>
<td>
Enter Origin Place
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" Width="300"></asp:TextBox>
</td>
</tr>
<tr>
<td height="30">
Enter Destination Place
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server" Width="300"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="center" height="60">
<asp:Button ID="btnSearch" runat="server" Text="Calculate" OnClick="search_Click" />
</td>
</tr>
<tr>
<td colspan="2" align="center" height="40">
<br />
<br />
<asp:Label ID="lblfinal" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
<br />
</div>
</form>

Step:6-Right click on Default.aspx page and select view code.
Step:7-Add the below namespace.

• Using System.Net
• Using System.Xml
• Using System.IO
• Using System.Xml.XPath

Step:8-Write the below code into your page_load event.



protected void Page_Load(object sender, EventArgs e)
{
lblfinal.Text = "";
}

Step:8-Write the below code into your button click event.


protected void search_Click(object sender, EventArgs e)
{
//Declare variable to store XML result
string xmlResult = null;

//Pass request to google api with orgin and destination details
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://maps.googleapis.com/maps/api/distancematrix/xml?origins=" + TextBox1.Text + "&destinations=" + TextBox2.Text + "&mode=Car&language=us-en&sensor=false");

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

//Get response as stream from httpwebresponse
StreamReader stream = new StreamReader(response.GetResponseStream());

//Create instance for xml document
XmlDocument doc = new XmlDocument();

//Load response stream in to xml result
xmlResult = stream.ReadToEnd();

//Load xmlResult variable value into xml documnet
doc.LoadXml(xmlResult);

string output = "";

try
{
//Get specified element value using select single node method and verify it return OK (success ) or failed
if (doc.DocumentElement.SelectSingleNode("/DistanceMatrixResponse/row/element/status").InnerText.ToString().ToUpper() != "OK")
{
lblfinal.Text = "Enter valid city name";
return;
}

//Get DistanceMatrixResponse element and its values
XmlNodeList xnList = doc.SelectNodes("/DistanceMatrixResponse");
foreach (XmlNode xn in xnList)
{
if (xn["status"].InnerText.ToString() == "OK")
{
//Form a table and bind it orgin, destination place and return distance value, approximate duration
output = "<table align='center' width='600' cellpadding='0' cellspacing='0'>";
output += "<tr><td height='60' colspan='2' align='center'><b>Travel Details</b></td>";
output += "<tr><td height='40' width='30%' align='left'>Orgin Place</td><td align='left'>" + xn["origin_address"].InnerText.ToString() + "</td></tr>";
output += "<tr><td height='40' align='left'>Destination Place</td><td align='left'>" + xn["destination_address"].InnerText.ToString() + "</td></tr>";
output += "<tr><td height='40' align='left'>Travel Duration (apprx.)</td><td align='left'>" + doc.DocumentElement.SelectSingleNode("/DistanceMatrixResponse/row/element/duration/text").InnerText + "</td></tr>";
output += "<tr><td height='40' align='left'>Distance</td><td align='left'>" + doc.DocumentElement.SelectSingleNode("/DistanceMatrixResponse/row/element/distance/text").InnerText + "</td></tr>";
output += "</table>";

//finally bind it in the result label control
lblfinal.Text = output;
}
}
}
catch (Exception ex)
{
lblfinal.Text = "Error processing";
return;
}
}

Your code has been successfully work

How to get creation date of a file in c#?

Get creation date of a file in c#.

If you want to get creation date of file in c#
So,you can easily do it by follow below code:



DateTime creationTime = File.GetCreationTime(@"C:\demo.txt");
label1.Text = creationTime.ToString();

Get File Creation Time in C#,
Get File Time using c#,
How to get the correct file time in C#,
c# – How to get the datetime of a file located inside a file?

How to open existing website in asp.net?

Open existing website in asp.net

Follow below steps:

Step:1-Open your microsoft visual studio.
Step:2-Go to file -> open -> website.
Step:3-Your website has been open in asp.net.

open existing website in your asp.net,
Existing website open in your asp.net.