Google Map API – Adding to a map to your site via iframe

There may be times when you want to add a map with markets to your website but you are using a platform like WordPress where adding html is easy adding the code for the Google Map API is not. A simple solution is to use a html iframe.

By setting  up a seperate html page with all of the required Google Map API code embedded in it, you can then call the iframe in WordPress (or any other place you can use HTML) and have a working map.

The basis usage of an iframe is just <iframe src=”URL“></iframe>, with additional options such as  height=”400″ width=”600″and frameborder=”0″.

The one little trick is to add a <a name=”start-here”></a> in the source html page just above <div id=”map_canvas”></div>

Then you use the iframe you add <iframe src=”./map.html#start-here” height=”400″ width=”600″ scrolling=”no” frameborder=”0″> </iframe>

The #start-here bit starts the iframe just at the start of your map so that it is easy to seamlessly add the map to your main project.

[ad#leader]

Google Map API – Markers with Pop Up Windows

Another need I had was to have map markers pulling data from an xml file that also had “pop up” windows functionality with information about that specific marker. As a result I put together the following bit of script.  The lat/lng and information about each marker point are loaded from an xml file named popupdata.xml and then added to the map.  When a marker point is clicked on, it pulls the html I have specified in the map javascript as well as the variables I have identified and populated in the xml file. While this example is quite simple(with only date and address and simple html), there are very interesting possibilities since you can have complex html and include pictures and  if you desire. If you are going to use this example for yourself, just add your Google Maps API key and enter the addresses and variables you want to add. You will need to add the variable names to both the javascript and the xml file. Since this will all be easier to understand with an example, I have included one.

You can visit a LIVE SAMPLE or download the full html page and associated data.xml file from HERE.
[ad#leader]

Free Windows host – freeasphost.net

If you are just dipping your feet in .NET or if you are on an extreme budget you can get free .NET 3.5 hosting from freeASPhost.net. You get .NET 3.5 200MB of storage and 2000MB of transfer. You get a MySQL DB but not MS SQL (which excludes the use of most .NET starter kits.) To get a MS SQL DB you will need an upgrade or a different hosting provider. Free Windows hosts are pretty rare given the cost of Microsoft products. If your needs are modest it might be the host for you.
[ad#post-banner]

Filezilla is a great FTP program

If you are in need of a FTP program and don’t want to pay for a commercial one, I recommend the open source filezilla. It comes it both a server and client edition, is free and has a great community behind it. It is frequentl updated and has all of the FTP program functionality you are looking for. Check it out.

Simple Marker Based on Address using the Google API

If you need to show a marker on a map based on an user inputted address, the Google API provides you a way. You can use the code below to create your own map you just need to get a Google Maps API key from Google Maps and insert it in line 6. In line 30 you can add html markup to modify how the call out box appears and what it contains. Just expand the code box below to check it out.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script src="http://maps.google.com/maps?file=api&v=2.x&key=YOUR GOOGLE MAPS API KEY FOR YOUR DOMAIN"
type="text/javascript"></script>
<script type="text/javascript">

var map;
var geocoder;

function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(27.174858, 78.042383), 12);
map.addControl(new GLargeMapControl());
geocoder = new GClientGeocoder();
}

function addAddressToMap(response) {
map.clearOverlays();
if (!response || response.Status.code != 200) {
alert("Sorry, we were unable to geocode that address");
} else {
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml('The Place you entered: '+place.address + '<br>');
}
}

function showLocation() {
var address = document.forms[0].q.value;
geocoder.getLocations(address, addAddressToMap);
}

</script>

</head>

<body onload="initialize()">
<span class="style1">
<form action="#" onsubmit="showLocation(); return false;">
<p>
<b>Search for an address:</b>
<input type="text" name="q" value="" class="address_input" size="40" />
<input type="submit" name="find" value="Search" />
</p>
</form>
<div id="map_canvas" style="width: 500px; height: 500px"></div>
</span>
</body>
</html>

Using CDOSYS to Send Email with GoDaddy

CDOSYS is part of the System.Web.Mail namespace and is installed by default on Windows 2000 and Windows XP platforms. It replaces CDONTS for sending SMTP email messages and can be used with GoDaddy IIS 6 and IIS 7 Windows hosting accounts. The following code sample demonstrates how to create, format, and send email with GoDaddy.

The server “relay-hosting.secureserver.net” is used to send email from your GoDaddy hosted domain. You must populate the SmtpMail object’s SmtpServer property with this value. GoDaddy’s hosting servers allow for email attachments up to 30 MB.


// language -- C#

// import namespace

using System.Web.Mail;

private void SendEmail()

{

const string SERVER = "relay-hosting.secureserver.net";

MailMessage oMail = new System.Web.Mail.MailMessage();

oMail.From = "emailaddress@domainname";

oMail.To = "emailaddress@domainname";

oMail.Subject = "Test email subject";

oMail.BodyFormat = MailFormat.Html; // enumeration

oMail.Priority = MailPriority.High; // enumeration

oMail.Body = "Sent at: " + DateTime.Now;

SmtpMail.SmtpServer = SERVER;

SmtpMail.Send(oMail);

oMail = null; // free up resources

}

GoDaddy SQL Server Database Setup – Connection String

Before you upload your ASP.NET 3.5 application onto your GoDaddy hosting server, you need to modify the connection strings section of your web.config file.

<connectionStrings>

<add name=”Personal” connectionString=” Server=whsql-v04.prod.mesa1.secureserver.net; Database=DB_675; User ID=user_id; Password=password; Trusted_Connection=False” providerName=”System.Data.SqlClient” /> <remove name=”LocalSqlServer”/> <add name=”LocalSqlServer” connectionString=” Server=whsql-v04.prod.mesa1.secureserver.net; Database=DB_675; User ID=user_id; Password=password; Trusted_Connection=False” providerName=”System.Data.SqlClient” />

</connectionStrings>

NOTE: You may want to back up the web.config file on your local computer or simply comment out your current connection strings before you make any changes. This way, you can easily return to developing your application on you local computer.

This is an example of the connection strings section that will connect an ASP.NET 3.5 application to one of the GoDaddy SQL Servers:
NOTE: You can find your server name, database name, user ID, and password in the SQL Server section of your GoDaddy Hosting Control Center. These connection string values map to host name, database name, user name, and password, respectively. The user name and password values are those specified during SQL database (not hosting account) creation.

Small Business/ Personal kit download UPDATE

After not being available for a week or so, Microsoft has updated their download page for Starter Kits. There have been some additional kit added such as, BlogEngine.NET Starter Kit, Kigg Starter Kit, Dropthings.com, FlexWiki, Umbraco and Yet Another Forum.

You can download all of the starter kits from the ASP.net site

Download Personal Starter Kit

Microsoft has (temporarily?) disabled the links to download older starter kits from its website. As such, I am hosting them here until they are re-enabled. If you want the download the Personal Web Starter Kit just click here – Personal Web Starter Kit Download
If you are in need of another starter kit that is not available from the Microsoft website, leave a comment I will upload it if I can.

WordPress 2.51 and IIS error – Notice: Undefined index: REQUEST_URI in \wp-settings.php on line 81

The original wordpress 2.5 error mentioned in the last post was fixed in the 2.51 release but there is an additional error that crops up. If you are getting an error similiar to the follwing:

Notice: Undefined index: REQUEST_URI in F:\Domains\mydomain.com\wwwroot\wp-settings.php on line 81

To solve this issue you need to edit the wp-settings.php file.  After line 79 or ”// Append the query string if it exists and isn’t null” add the following line:
  $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'],0);

This error is due to IIS not recognizing ‘REQUEST_URI’

If you don’t want to make the modification yourself you can download the modified wp-setting.php file from here.