<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Jason N. Gaylord - Dev</title><link>http://www.jasongaylord.com:80/Tags/Dev</link><description>Jason N. Gaylord - Dev</description><item><title>Only One Dialog Box is Allowed in Silverlight</title><link>http://www.jasongaylord.com:80/blog/only-one-dialog-box-is-allowed-in-silverlight</link><description>&lt;p&gt;Today I came across an interesting issue. I have a Silverlight project in which I’d like to be able to show the OpenFileDialog as well as a JavaScript alert. However, I was able to determine (and &lt;a href="http://stackoverflow.com/questions/1391579/simple-silverlight-open-file-dialog-errors" target="_blank"&gt;&lt;a href="http://jasong.us/K5YwgF" target="_blank"&gt;confirmed at StackOverflow&lt;/a&gt;&lt;/a&gt;), that the alert cannot happen first as the OpenFileDialog would be a second dialog on a single user action to the browser. By commenting out the alert, I was able to continue just as planned.&lt;/p&gt; &lt;p&gt;The error that results is the following:&lt;/p&gt; &lt;p&gt;&lt;a href="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Only-One-Dialog-Box-is-Allowed-in-Silver_F1D0/SNAGHTML1dc03d0.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="SNAGHTML1dc03d0" border="0" alt="SNAGHTML1dc03d0" src="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Only-One-Dialog-Box-is-Allowed-in-Silver_F1D0/SNAGHTML1dc03d0_thumb.png" width="244" height="115"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;The text reads: [FileDialog_UserInitiated] Arguments: &lt;/p&gt; &lt;p&gt;Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&amp;amp;Version=4.1.10111.0&amp;amp; File=System.Windows.dll&amp;amp;Key=FileDialog_UserInitiated&lt;/p&gt; &lt;p&gt;However, when browsing to the URL, you’ll notice that the link no longer exists.&lt;/p&gt; &lt;p&gt;I don’t use Silverlight much and so I haven’t come across this before. Hopefully this helps someone in the future.&lt;/p&gt;</description><pubDate>Mon, 21 May 2012 21:20:40 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/only-one-dialog-box-is-allowed-in-silverlight</guid></item><item><title>Visual Studio 11 - Now with some Color</title><link>http://www.jasongaylord.com:80/blog/visual-studio-11-ndash-now-with-some-color</link><description>&lt;p&gt;The Visual Studio is constantly reviewing items that have been posted to their &lt;a href="http://jasong.us/ydi2ri" target="_blank"&gt;User Voice site&lt;/a&gt;. One of the items that I&amp;rsquo;ve been asking for, &lt;a href="http://jasong.us/zYucyv" target="_blank"&gt;installation customization in Visual Studio&lt;/a&gt;, has been voted up to number 4 on the list. Keep the votes coming.&lt;/p&gt;
&lt;p&gt;Another item that I have voted for is &lt;a href="http://jasong.us/JwYL1r" target="_blank"&gt;adding color back to Visual Studio&lt;/a&gt;. Yesterday morning, the Visual Studio team &lt;a href="http://jasong.us/JwZi3z" target="_blank"&gt;announced&lt;/a&gt; that changes have been made and will be reflected in the Visual Studio Release Candidate. While I still feel there can be more work on the UI, I think it is heading back in the right direction. I get the consistent look that the teams are going for across products and Microsoft is betting heavily in the metro-style.&lt;/p&gt;
&lt;p&gt;Some of the items that have been changed include changes to the icons, adding in more color to icons and menu items, and creating a lighter background.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a quick before and after shot borrowed from their post:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://jasongaylord.com/Media/Default/Windows-Live-Writer/e67a1e277214_9151/img01_2.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="img01" border="0" alt="img01" src="http://jasongaylord.com/Media/Default/Windows-Live-Writer/e67a1e277214_9151/img01_thumb.png" width="244" height="62" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s what it looks like based on the state of your development process:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://jasongaylord.com/Media/Default/Windows-Live-Writer/e67a1e277214_9151/img02_2.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="img02" border="0" alt="img02" src="http://jasongaylord.com/Media/Default/Windows-Live-Writer/e67a1e277214_9151/img02_thumb.png" width="244" height="62" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hopefully we&amp;rsquo;ll continue to see more improvement before the RC.&lt;/p&gt;</description><pubDate>Wed, 09 May 2012 17:03:46 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/visual-studio-11-ndash-now-with-some-color</guid></item><item><title>Open Source Microsoft - Build MVC, WebAPI, Razor, and WebPages</title><link>http://www.jasongaylord.com:80/blog/open-source-microsoft-webapi-razor</link><description>&lt;p&gt;&lt;a href="http://jasong.us/GYXxN9" target="_blank"&gt;Scott Guthrie has announced on his blog&lt;/a&gt; that as of this very moment, ASP.NET MVC, ASP.NET WebAPI, and WebPages with Razor syntax have all been open sourced on CodePlex at &lt;a href="http://jasong.us/GXcyeJ"&gt;http://aspnetwebstack.codeplex.com&lt;/a&gt;. That&amp;rsquo;s huge news. Oh and the ASP.NET Web Stack can be repo&amp;rsquo;d using TFS, SubVersion, Mercurial, and newly added Git.&lt;/p&gt;
&lt;p&gt;So, you may be thinking &amp;ldquo;This sounds cool. But, what does it mean for me?&amp;rdquo; It means your awesome. It means that you can now take your favorite features and patches to their framework and submit it back to the team for review. It means you can use their framework when it is eventually ported over to &lt;a href="http://jasong.us/GXczzu" target="_blank"&gt;Mono&lt;/a&gt; and other open-source platforms. It means, you&amp;rsquo;ll eventually be able to run ASP.NET wherever you&amp;rsquo;d like.&lt;/p&gt;
&lt;p&gt;Be sure to check it out and provide feedback to the team. If you&amp;rsquo;re not sure what type of feedback to provide, choose from the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;ldquo;The ASP.NET team just knocked it out of the park with this: &lt;a href="http://aspnetwebstack.codeplex.com"&gt;http://aspnetwebstack.codeplex.com&lt;/a&gt;. Go OSS!&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;ScottGu and his team delivered yet again.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;Who said that Microsoft can&amp;rsquo;t release software using an open source license?&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;Congrats to the ASP.NET team for, yet again, exceeding expectations!&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your choice. In the meantime, great job Microsoft!&lt;/p&gt;</description><pubDate>Wed, 09 May 2012 17:03:25 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/open-source-microsoft-webapi-razor</guid></item><item><title>Preventing Web Applications from Inheriting Parent Dependencies (bin)</title><link>http://www.jasongaylord.com:80/blog/prevent-child-apps-from-inheriting-dependencies</link><description>&lt;p&gt;Have you ever created a web application for something specific such as a standalone web app (forum, photo gallery, web service, etc.) while using ASP.NET and received this:&lt;/p&gt; &lt;p&gt;&lt;a href="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Preventing-Dependencies-from_EFB4/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Preventing-Dependencies-from_EFB4/image_thumb.png" width="244" height="61"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;If you have, you probably became frustrated. I know I have. The reason&amp;nbsp; this occurs is that sub-applications under the main web application inherit the uplevel web.config settings. This means that the machine.config and other system config files filter into the main web’s web.config file as well.&lt;/p&gt; &lt;p&gt;You can prevent this from occurring as details quite well at &lt;a title="http://jasong.us/yXCV8P" href="http://jasong.us/yXCV8P" target="_blank"&gt;http://jasong.us/yXCV8P&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;To do this, you’ll need to pull your dependencies and wrap them in a location element and add a attribute as shown below:&lt;/p&gt; &lt;p&gt;This will now load only the dependencies within the application.&lt;/p&gt;&lt;pre class="brush: xml; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;location path="." inheritInChildApplications="false"&amp;gt;
    &amp;lt;system.web&amp;gt;
        &amp;lt;!-- Compilation section with assemblies --&amp;gt;
    &amp;lt;/system.web&amp;gt;
&amp;lt;/location&amp;gt;&lt;/pre&gt;
&lt;p&gt;You can also circumvent this issue by using sub-domain or another domain altogether.&lt;/p&gt;</description><pubDate>Mon, 12 Mar 2012 21:12:11 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/prevent-child-apps-from-inheriting-dependencies</guid></item><item><title>JavaScript onClick Navigation Issues within Google Chrome are Solved</title><link>http://www.jasongaylord.com:80/blog/onclick-location-href-within-google-chrome</link><description>&lt;p&gt;For the longest time, If I needed to use an &lt;font size="2" face="Consolas"&gt;onclick&lt;/font&gt; event for navigation (&lt;font size="2" face="Consolas"&gt;div&lt;/font&gt; or some other page element), I’d use something similar to:&lt;/p&gt;&lt;pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;div onClick="location.href('/admin');"&amp;gt;&amp;lt;!-- Something here --&amp;gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;
&lt;p&gt;However, Google Chrome interprets the &lt;font size="2" face="Consolas"&gt;href&lt;/font&gt; property as a method or an object initializer. Instead, to get the &lt;font size="2" face="Consolas"&gt;onclick&lt;/font&gt; navigation to work properly in Chrome, set the property to a value using a typical setter such as:&lt;/p&gt;&lt;pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;div onClick="location.href='/admin';"&amp;gt;&amp;lt;!-- Something here --&amp;gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;
&lt;p&gt;This simple change will allow Google Chrome to properly navigate to the page.&lt;/p&gt;
&lt;p&gt;Hope that helps!&lt;/p&gt;</description><pubDate>Thu, 08 Mar 2012 16:49:18 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/onclick-location-href-within-google-chrome</guid></item><item><title>Bring Back Visual Studio 11 Installation Customization</title><link>http://www.jasongaylord.com:80/blog/vs11beta-installation-customization</link><description>&lt;p&gt;Earlier today Microsoft released Visual Studio 11 Beta as a general release. One of the first things you may notice is that the installation customization of VS11 Beta has been removed. If you are installing VS11 on Windows 8 Beta, you’re looking at consuming around 20GB of disk.&lt;/p&gt; &lt;p&gt;So Microsoft already released the beta so their mind is made up, right?&lt;/p&gt; &lt;p&gt;Not exactly. The team is constantly looking at feedback on the &lt;a href="http://jasong.us/ydi2ri" target="_blank"&gt;http://visualstudio.uservoice.com&lt;/a&gt; website. One of the items that I’ve submitted is to bring back the customization. You can use up to three (3) of your User Voice votes for Visual Studio by voting for this item below:&lt;/p&gt; &lt;p&gt;“&lt;a href="http://jasong.us/zYucyv" target="_blank"&gt;We want to Bring Back Visual Studio 11 Installation Customization Options&lt;/a&gt;”&lt;/p&gt; &lt;p&gt;Thanks in advance for your support!&lt;/p&gt;</description><pubDate>Wed, 29 Feb 2012 23:56:41 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/vs11beta-installation-customization</guid></item><item><title>Using Data Annotations in the .NET Framework</title><link>http://www.jasongaylord.com:80/blog/data-annotations-in-dot-net</link><description>&lt;p&gt;Starting with .NET 4 or MVC3, a developer could use a data annotation on a property to force data validation. This is extremely powerful especially for MVC developers. The same data annotations can also be used when building custom modules for Orchard CMS.&lt;/p&gt; &lt;p&gt;The annotations built into the framework include the following:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;font size="2" face="Consolas"&gt;Required&lt;/font&gt; – Allows you to mark a property as being required. &lt;li&gt;&lt;font size="2" face="Consolas"&gt;StringLength&lt;/font&gt; – Allows a maximum string length to be specified for a property. &lt;li&gt;&lt;font size="2" face="Consolas"&gt;Range&lt;/font&gt; – Validates the value of the specified property is between a range of values. &lt;li&gt;&lt;font size="2" face="Consolas"&gt;RegularExpression&lt;/font&gt; – Allows you to specify a regular expression to validate the content against. A comprehensive list of regular expressions can be found at &lt;a title="http://jasong.us/wzAjYJ" href="http://jasong.us/wzAjYJ" target="_blank"&gt;http://regexlib.com/&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;In addition to these above, custom annotations can be built by inheriting from the base class &lt;font size="2" face="Consolas"&gt;ValidationAttribute&lt;/font&gt;.&lt;/p&gt; &lt;p&gt;An example of a custom data annotation is shown below. This sample asks for a start and an end date to be specified as strings. The assumption is that these strings will be in a correct date format. A property value will be specified as a string. The property value must be between the two dates specified.&lt;/p&gt;&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;public class DateRange : System.ComponentModel.DataAnnotations.ValidationAttribute
{
    public string StartDate { get; set; }
    public string EndDate { get; set; }

    public DateRange() {
        this.StartDate = new DateTime(1900, 1, 1).ToString();
        this.EndDate = new DateTime(2099, 1, 1).ToString();
    }

    public override bool IsValid(object value) {
        var valueToString = value as string;
            
        if (!string.IsNullOrEmpty(valueToString)) {
            DateTime dateTimeResult;
                
            if (DateTime.TryParse(valueToString, out dateTimeResult)) {
                return ((dateTimeResult &amp;gt;= DateTime.Parse(this.StartDate)) &amp;amp;&amp;amp; (dateTimeResult &amp;lt;= DateTime.Parse(this.EndDate)));
            }

            return false;
        }
        return true;
    }
}&lt;/pre&gt;
&lt;p&gt;Notice that in the code snippet above, I’m allowing null or empty strings to be passed in. Keep in mind that the &lt;font size="2" face="Consolas"&gt;Required&lt;/font&gt; annotation already checks for nulls or empty strings.&lt;/p&gt;
&lt;p&gt;To use the &lt;font size="2" face="Consolas"&gt;DateRange&lt;/font&gt; annotation, simply add it to a property in the model like below:&lt;/p&gt;&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;[DateRange(StartDate="1/1/2012", EndDate="12/31/2012", ErrorMessage="The date must be during the 2012 calendar year.")]
public string EventDate { get; set; }&lt;/pre&gt;
&lt;p&gt;Additional data annotations can be downloaded from a project started by &lt;a href="http://jasong.us/x6XWbz" target="_blank"&gt;Scott Kirkland&lt;/a&gt; at &lt;a title="http://jasong.us/yZqbAt" href="http://jasong.us/yZqbAt" target="_blank"&gt;http://dataannotationsextensions.org/&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Thu, 23 Feb 2012 21:58:59 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/data-annotations-in-dot-net</guid></item><item><title>Resolving an SmtpException stating 'Too many messages for this session'</title><link>http://www.jasongaylord.com:80/blog/resolving-smtpexception-too-many-messages-for-this-session</link><description>&lt;p&gt;Have you ever noticed an exception being thrown by your application stating something like the following:&lt;/p&gt;
&lt;pre class="brush: text; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;System.Net.Mail.SmtpException: Service not available, closing transmission channel. 
The server response was: #4.x.2 Too many messages for this session&lt;/pre&gt;
&lt;p&gt;This has been an issue since early versions of the &lt;span style="font-family: Consolas; font-size: x-small;" size="2" face="Consolas"&gt;System.Net.Mail&lt;/span&gt; namespace. The &lt;span style="font-family: Consolas; font-size: x-small;" size="2" face="Consolas"&gt;SmtpServer&lt;/span&gt; object never included a &lt;span style="font-family: Consolas; font-size: x-small;" size="2" face="Consolas"&gt;Dispose()&lt;/span&gt; method that properly shutdown the connection to the server. So, even if you are creating new objects, the GC never disposed of the original thus causing this exception.&lt;/p&gt;
&lt;p&gt;There are two workarounds for this exception as document on the &lt;a href="http://jasong.us/wXDVAH" target="_blank"&gt;Connect website&lt;/a&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Upgrade to the .NET Framework 4.0 or later. This version of the framework now includes a &lt;span style="font-family: Consolas; font-size: x-small;" size="2" face="Consolas"&gt;Dispose() &lt;/span&gt;method that properly closes the connection to the server. Anytime you are connecting to the server to send a message, you should dispose the object afterwards.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;If you are using older versions of the framework (.NET Framework 3.5 or earlier), you can set the &lt;span style="font-family: Consolas; font-size: x-small;" size="2" face="Consolas"&gt;MaxIdleTime&lt;/span&gt; property to 0 and the &lt;span style="font-family: Consolas; font-size: x-small;" size="2" face="Consolas"&gt;ConnectionLimit&lt;/span&gt; to 1 on the &lt;span style="font-family: Consolas; font-size: x-small;" size="2" face="Consolas"&gt;SmtpClient&lt;/span&gt;&amp;rsquo;s &lt;span style="font-family: Consolas; font-size: x-small;" size="2" face="Consolas"&gt;ServicePoint&lt;/span&gt; object. For example, your code may look like the following:&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;var client = new SmtpClient("hostname");
client.ServicePoint.MaxIdleTime = 0;
client.ServicePoint.ConnectionLimit = 1;
...
client.Send(new MailMessage(...));

// at this point, the connection will get closed 
// since the ServicePoint idle time is now 0.&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hope this helps to solve any issues you&amp;rsquo;ve had with this.&lt;/p&gt;</description><pubDate>Tue, 21 Feb 2012 16:33:11 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/resolving-smtpexception-too-many-messages-for-this-session</guid></item><item><title>Using HTML 5 Geolocation, Google Maps to Generate Driving Distance</title><link>http://www.jasongaylord.com:80/blog/using-html5-geolocation-and-google-maps</link><description>&lt;p&gt;HTML5 will introduce many new and exciting features including the addition of geolocation. Geolocation allows a device to determine a global position of the device (latitude and longitude), it&amp;rsquo;s accuracy (horizontal accuracy and vertical accuracy), altitude, and speed. The Geolocation feature in HTML 5 is already supported by most mainstream browsers. According to research performed by &lt;a href="http://diveintohtml5.info/geolocation.html#w3c" target="_blank"&gt;Mark Pilgrim&lt;/a&gt;, the following browser support Geolocation:&lt;/p&gt;
&lt;table border="0" cellspacing="0" cellpadding="3" width="600"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="86" align="center"&gt;&lt;strong&gt;IE&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="85" align="center"&gt;&lt;strong&gt;Firefox&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="84" align="center"&gt;&lt;strong&gt;Safari&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="87" align="center"&gt;&lt;strong&gt;Chrome&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="84" align="center"&gt;&lt;strong&gt;Opera&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="85" align="center"&gt;&lt;strong&gt;iPhone&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="87" align="center"&gt;&lt;strong&gt;Android&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="85" align="center"&gt;9.0+&lt;/td&gt;
&lt;td valign="top" width="85" align="center"&gt;3.5+&lt;/td&gt;
&lt;td valign="top" width="84" align="center"&gt;5.0+&lt;/td&gt;
&lt;td valign="top" width="88" align="center"&gt;5.0+&lt;/td&gt;
&lt;td valign="top" width="85" align="center"&gt;10.6+&lt;/td&gt;
&lt;td valign="top" width="85" align="center"&gt;3.0+&lt;/td&gt;
&lt;td valign="top" width="88" align="center"&gt;2.0+&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;There are a few &amp;ldquo;gotchas&amp;rdquo; to keep in mind when using Geolocation:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The browser may not support the HTML 5 geolocation API. Many older browsers relied on custom built APIs for relaying geolocation information to applications. &lt;a href="http://gearsblog.blogspot.com/2011/03/stopping-gears.html" target="_blank"&gt;Google Gears&lt;/a&gt;, now deprecated, is an example of an API that some browsers have implemented.&lt;/li&gt;
&lt;li&gt;The user must opt-in to the HTML 5 geolocation call for each website they visit. In Internet Explorer, the notification bar appears like:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Using-HTML-5-Geolocation-Google-Maps-to_8506/image_4.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Using-HTML-5-Geolocation-Google-Maps-to_8506/image_thumb_1.png" width="644" height="39" /&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The geolocation call may timeout. This is usually caused by a poor Internet connection or that the current area is not reporting (due to a lack of information) the geolocation yet. For more information on how HTML5 Geolocation works, &lt;a href="http://stackoverflow.com/questions/3041113/how-exactly-does-html5s-geolocation-work" target="_blank"&gt;click here to view the top response to the thread on&amp;nbsp; StackOverflow.com&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now that we&amp;rsquo;ve covered some of the information, let&amp;rsquo;s focus on the goal for this post. Our goal is to generate the driving distance between two locations. I&amp;rsquo;ve used this method to let potential &lt;a href="http://techbash.com/" target="_blank"&gt;TECHbash&lt;/a&gt; (see image below as an example) attendees know how far away they are from the conference center. Storefronts may want to implement something similar if they&amp;rsquo;d like to offer a special offering to local shoppers or from shoppers traveling further away.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Using-HTML-5-Geolocation-Google-Maps-to_8506/image_2.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Using-HTML-5-Geolocation-Google-Maps-to_8506/image_thumb.png" width="98" height="98" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: x-small;" size="2"&gt;&lt;em&gt;Above: Small UI update to show current distance from the TECHbash conference.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Let&amp;rsquo;s start by focusing on obtaining our current geolocation position.&lt;/p&gt;
&lt;h3&gt;Implementing HTML5 Geolocation&lt;/h3&gt;
&lt;p&gt;When using the HTML5 geolocation API, we must write some JavaScript. We can use the API in conjunction with JavaScript libraries such as jQuery. The geolocation API call is pretty simplistic. It accepts a callback method, an exception method (optional), and additional options (optional). While it is not required to pass in a callback method to handle errors, it is highly recommended.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span style="font-family: Courier New;" face="Courier New"&gt;navigator.geolocation.getCurrentPosition(&lt;em&gt;callback&lt;/em&gt;,&lt;em&gt;error&lt;/em&gt;,&lt;em&gt;options&lt;/em&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The callback method, which will return a &lt;a href="http://www.w3.org/TR/geolocation-API/#position" target="_blank"&gt;Position object&lt;/a&gt;, will contain a timestamp and coordinate information including the latitude, longitude, altitude, accuracy (horizontal accuracy), altitudeAccuracy (vertical accuracy), heading (direction degrees), and speed (meters per second). Only the latitude, longitude, and accuracy properties are guaranteed to have values.&lt;/p&gt;
&lt;p&gt;The error callback method, which will return a &lt;a href="http://www.w3.org/TR/geolocation-API/#position-error" target="_blank"&gt;PositionError object&lt;/a&gt;, will contain a code and a message. The code can be a value of 1 (permission denied), value of 2 (position unavailable), value of 3 (timeout), or value of 0 (unknown error). A message will be supplied from the browser regarding the error.&lt;/p&gt;
&lt;p&gt;The additional options object is an object with defined properties. At the time that this was published, the options object, &lt;a href="http://www.w3.org/TR/geolocation-API/#position-options" target="_blank"&gt;PositionOptions object&lt;/a&gt;, has three properties. They are enableHighAccuracy, timeout, and maximumAge.&lt;/p&gt;
&lt;p&gt;The final piece of our HTML5 Geolocation implementation is to use an open source JavaScript library called &lt;a href="http://www.modernizr.com/" target="_blank"&gt;Modernizr&lt;/a&gt;. Modernizr is a library that allows developers to take advantage of new HTML5 and CSS3 features while still &lt;a href="http://www.modernizr.com/docs/#support" target="_blank"&gt;supporting older browsers such as IE6, Firefox 3.5, and others&lt;/a&gt;. We&amp;rsquo;ll use a function in Modernizr to check for HTML5 Geolocation support.&lt;/p&gt;
&lt;p&gt;Now that we&amp;rsquo;ve covered that, let&amp;rsquo;s see what we have in place so far:&lt;/p&gt;
&lt;pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;function getCurrentPosition() {
	if (Modernizr.geolocation) {
		navigator.geolocation.getCurrentPosition(locationSuccess,locationError);
	} else {
		// TODO: Decide what to do when the browser doesn't support Geolocation
	}
}

function locationSuccess(position)
{
	var latitude = position.coords.latitude;
	var longitude = position.coords.longitude;
	// TODO: We have to finish this method
}

function locationError(err)
{
	// TODO: We need to complete our error handling
	if (err.code == 1) { // user won't grant permission }
	if (err.code == 2) { // position is currently unavailable }
	if (err.code == 3) { // a timeout has occurred }
}&lt;/pre&gt;
&lt;p&gt;Before we tweak this anymore, let&amp;rsquo;s move onto the Google Maps API.&lt;/p&gt;
&lt;h3&gt;Implementing the Google Maps API&lt;/h3&gt;
&lt;p&gt;Much like every other JavaScript library or API, the Google Maps library is constantly changing. At the time of this post, the current Google Maps API was version 3.5. You can add the library to your page by including the script like so:&lt;/p&gt;
&lt;pre class="brush: text; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;The sensor parameter is required. If you will be using a GPS to provide the sensor information to the Google Maps, then set this value to true. We will not in our case so we&amp;rsquo;ll set it to false.&lt;/p&gt;
&lt;p&gt;The portion of the API that we are most concerned with for our implementation is the DirectionsService. We&amp;rsquo;ll create a &lt;a href="http://code.google.com/apis/maps/documentation/javascript/services.html#DirectionsRequests" target="_blank"&gt;DirectionsRequest&lt;/a&gt; to send over to Google with a series of parameters. The two major parameters are our two endpoints. We can send these endpoints as a string or as a LatLng object. The other required parameter is the travelMode. Since most attendees will be driving, we&amp;rsquo;ll using the travelMode for driving. Our request will look like so:&lt;/p&gt;
&lt;pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;// TODO: Pass actual values into the lat and lon variables below
var start = new google.maps.LatLng(lat, lon);
var end = "1333 S Prospect St, Nanticoke, PA 18634";
var request = {origin:start, 
	        destination:end, 
	        travelMode:google.maps.DirectionsTravelMode.DRIVING};&lt;/pre&gt;
&lt;p&gt;Next, we need to handle the response from Google. To do this, we&amp;rsquo;ll call the route function of DirectionsService and obtain the response. If the response&amp;rsquo;s status code is OK, we&amp;rsquo;ll be able to process the response as expected. This is shown below.&lt;/p&gt;
&lt;pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;directionsService.route(request, function(response, status) {
	if (status == google.maps.DirectionsStatus.OK) {
		distance  = response.routes[0].legs[0].distance.value;
	} else {
		// TODO: Handle the Google Maps exception
	}
});&lt;/pre&gt;
&lt;p&gt;Finally, let&amp;rsquo;s tie in the rest of the Google Maps API stuff.&lt;/p&gt;
&lt;pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;var directionsService = new google.maps.DirectionsService();

function calculateRoute(lat, lon) {
	var distance = 0;
	var start = new google.maps.LatLng(lat, lon);
	var end = new google.maps.LatLng(41.195647, -75.992499);
	var request = {origin:start, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING};
	
	directionsService.route(request, function(response, status) {
		if (status == google.maps.DirectionsStatus.OK) {
			distance  = response.routes[0].legs[0].distance.value;
		} else {
			// TODO: Handle the Google Maps exception
		}
	});
	
	return distance;
}&lt;/pre&gt;
&lt;p&gt;Now that we&amp;rsquo;ve tied in the Google Maps API, let&amp;rsquo;s integrate this call into our HTML5 Geolocation script.&lt;/p&gt;
&lt;h3&gt;Putting it all Together&lt;/h3&gt;
&lt;p&gt;In our original locationRequest function, we grabbed the latitude and longitude values from the current position of the machine. So let&amp;rsquo;s add our call to the Google calculateRoute and combine that with a basic HTML5 page. Here is the final result:&lt;/p&gt;
&lt;pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
&amp;lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type"&amp;gt;
&amp;lt;title&amp;gt;The total distance between here&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
	&amp;lt;div&amp;gt;
		The total distance between here and &amp;lt;a href="http://techbash.com"&amp;gt;TECHbash 2012&amp;lt;/a&amp;gt; is: 
		&amp;lt;span id="distance"&amp;gt;&amp;lt;/span&amp;gt; miles.
	&amp;lt;/div&amp;gt;

	&amp;lt;script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js" 
		type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
	&amp;lt;script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.0.6-development-only.js" 
		type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
	&amp;lt;script src="http://maps.googleapis.com/maps/api/js?sensor=false" 
		type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
	&amp;lt;script type="text/javascript"&amp;gt;
		function getCurrentPosition() {
			if (Modernizr.geolocation) {
				navigator.geolocation.getCurrentPosition(locationSuccess,locationError);
			} else {
				// TODO: Decide what to do when the browser doesn't support Geolocation
			}
		}
		
		function locationSuccess(position)
		{
			var latitude = position.coords.latitude;
			var longitude = position.coords.longitude;

			calculateRoute(latitude, longitude);
		}
		
		function locationError(err)
		{
			// TODO: We need to complete our error handling
			if (err.code == 1) { 
				// user won't grant permission 
			}
			if (err.code == 2) { 
				// position is currently unavailable 
			}
			if (err.code == 3) { 
				// a timeout has occurred 
			}
		}
	
		var directionsService = new google.maps.DirectionsService();
		
		function calculateRoute(lat, lon) {
			var distance = 0;
			var start = new google.maps.LatLng(lat, lon);
			var end = new google.maps.LatLng(41.195647, -75.992499);
			var request = {origin:start, destination:end, 
				travelMode: google.maps.DirectionsTravelMode.DRIVING};
			
			directionsService.route(request, function(response, status) {
				if (status == google.maps.DirectionsStatus.OK) {
					distance  = response.routes[0].legs[0].distance.value;
					duration = response.routes[0].legs[0].duration.value;
					$("#distance").html(Math.round(distance / 1609.344));
				} else {
					// TODO: Handle the Google Maps exception
				}
			});
			
			return distance;
		}
		
		$(document).ready(function() { getCurrentPosition(); });
	&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/pre&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;You can learn more about the HTML5 Geolocation by using one of the resources below:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://dev.w3.org/geo/api/spec-source.html" target="_blank"&gt;W3C HTML5 Geolocation Spec&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/W3C_Geolocation_API" target="_blank"&gt;Wikipedia W3C Geolocation Spec&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://diveintohtml5.info/geolocation.html" target="_blank"&gt;Mark Pilgrim&amp;rsquo;s Dive into HTML5&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can learn more about Google&amp;rsquo;s Maps API by visiting the &lt;a href="http://code.google.com/apis/maps/documentation/javascript/basics.html" target="_blank"&gt;Google Maps API docs&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Thu, 16 Feb 2012 21:40:14 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/using-html5-geolocation-and-google-maps</guid></item><item><title>ASP.NET MVC 4 Beta Released</title><link>http://www.jasongaylord.com:80/blog/asp.net-mvc-4-beta-released</link><description>&lt;p&gt;The ASP.NET MVC 4 Beta and ASP.NET Web API Beta have just been released. You can visit the &lt;a href="http://www.asp.net/mvc/mvc4" target="_blank"&gt;asp.net&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/" target="_blank"&gt;msdn.microsoft.com&lt;/a&gt;, or &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=28942" target="_blank"&gt;Microsoft Download Center&lt;/a&gt; to download the latest bits.&lt;/p&gt;
&lt;p&gt;ASP.NET MVC 4 includes many new features including, but not limited to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;New Web API support built in&lt;/li&gt;
&lt;li&gt;New project templates such as the mobile project template.&lt;/li&gt;
&lt;li&gt;Support for Mobile apps&lt;/li&gt;
&lt;li&gt;Support for Recipes (similar to, but not quite, like recipes in the Orchard CMS)&lt;/li&gt;
&lt;li&gt;Support for Async methods (think new async features)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Be sure to check out both. I&amp;rsquo;ll be posting more on it later on.&lt;/p&gt;</description><pubDate>Thu, 16 Feb 2012 21:39:57 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/asp.net-mvc-4-beta-released</guid></item><item><title>Converting a .NET DateTime object to a JavaScript Date object</title><link>http://www.jasongaylord.com:80/blog/converting-a-.net-datetime-object-to-a-javascript-date-object</link><description>&lt;p&gt;When using a WCF or ASMX web service in ASP.NET, you might find the need to pass back a DateTime object via JSON. However, what you might not realize is that by passing a .NET DateTime object back to JavaScript, you&amp;rsquo;d receive an &amp;ldquo;Invalid date&amp;rdquo; script exception. The data being passed back to JavaScript may resemble the following:&lt;/p&gt;
&lt;pre class="brush: text; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;/Date(1315938182867-0400)/&lt;/pre&gt;
&lt;p&gt;The reason that the date is formatted in this way is that JavaScript uses Unix Epoch as the base date and time. This value is 1/1/1970 at 12:00:00 AM. JavaScript tracks dates as the number of milliseconds from the Unix Epoch value to the date submitted.&lt;/p&gt;
&lt;p&gt;To assist in the JavaScript date conversion, I have added an extension method for the DateTime object that resembles the following:&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;private static readonly long UnixEpochTicks = (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).Ticks; 
        
public static long? ToJsonTicks(this DateTime? value)
{
    return value == null ? (long?)null : (value.Value.ToUniversalTime().Ticks - UnixEpochTicks) / 10000;
}

public static long ToJsonTicks(this DateTime value)
{
    return (value.ToUniversalTime().Ticks - UnixEpochTicks) / 10000;
}&lt;/pre&gt;
&lt;p&gt;In JavaScript, I can now pass this value into a Date() object and get the correct DateTime value for my locale.&lt;/p&gt;
&lt;p&gt;Feel free to use this method in your applications. I offer no warranties or guarantees with the code above.&lt;/p&gt;</description><pubDate>Thu, 16 Feb 2012 21:42:48 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/converting-a-.net-datetime-object-to-a-javascript-date-object</guid></item><item><title>Port your Android or iPhone apps to Windows Phone 7</title><link>http://www.jasongaylord.com:80/blog/port-android-or-iphone-apps-to-wp7</link><description>&lt;p&gt;Did you know that your current Android or iPhone apps can be ported to Windows Phone 7? Now, there&amp;rsquo;s no &amp;ldquo;easy&amp;rdquo; button that will automagically convert the apps for you. However, &lt;a href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/06/09/leveraging-your-android-development-expertise-to-build-windows-phone-applications.aspx" target="_blank"&gt;in a post on June 9th, 2011&lt;/a&gt;, the Windows Phone team explained how Android apps can be converted. Microsoft has provided an easy package for Android developers. The package includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://wp7mapping.interoperabilitybridges.com/Home/Library?source=Android" target="_blank"&gt;Android to Windows Phone API mapping tool&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://windowsphone.interoperabilitybridges.com/articles/windows-phone-7-guide-for-android-application-developers" target="_blank"&gt;Windows Phone 7 Guide for Android Application Developers&lt;/a&gt; white paper, 90+ pages organized in 7 chapters&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In April, the team &lt;a href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/04/29/leveraging-your-iphone-development-expertise-to-build-windows-phone-7-applications.aspx" target="_blank"&gt;released an initial post&lt;/a&gt; explaining how iPhone apps can be ported to WP7. This package includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://wp7mapping.interoperabilitybridges.com/" target="_blank"&gt;iPhone to Windows Phone API mapping tool&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://windowsphone.interoperabilitybridges.com/articles/windows-phone-7-guide-for-iphone-application-developers" target="_blank"&gt;Windows Phone 7 Guide for iOS and iPhone Application Developers&lt;/a&gt; white paper, 90+ pages organized in 7 chapters&lt;/li&gt;
&lt;!--EndFragment--&gt;&lt;/ul&gt;
&lt;p&gt;More information about converting existing apps to Windows Phone 7 can be found at &lt;a title="http://windowsphone.interoperabilitybridges.com/" href="http://windowsphone.interoperabilitybridges.com/" target="_blank"&gt;http://windowsphone.interoperabilitybridges.com/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you plan on converting an Android or iPhone app, be sure to respond to this and let me know how things are going.&lt;/p&gt;</description><pubDate>Thu, 16 Feb 2012 21:43:06 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/port-android-or-iphone-apps-to-wp7</guid></item><item><title>Changing the Title in the Tile Icon of a Windows Phone 7 Application</title><link>http://www.jasongaylord.com:80/blog/windows-phone-7-tile-icon-title-change</link><description>&lt;p&gt;If you&amp;rsquo;ve built a Windows Phone 7 application, you may have noticed that if you pin your application to the Start menu, the name of your application appears in the lower, left-hand side of the tile. You can change the text in this tile, by right-clicking on the application and going to properties. On the Application menu, modify the Tile title properties. A sample of this area is displayed below:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Removing-the-Title-in-the-Tile-Icon-of-a_11B05/tile_options_2.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="tile_options" border="0" alt="tile_options" src="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Removing-the-Title-in-the-Tile-Icon-of-a_11B05/tile_options_thumb.png" width="244" height="90" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll notice that the title text is blank in my screenshot. To accomplish this, you&amp;rsquo;ll need to perform a little magic. If you wipe this out in Visual Studio 2010, you&amp;rsquo;ll receive the error message stating &amp;ldquo;An empty string is not allowed for Title&amp;rdquo; like the following:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Removing-the-Title-in-the-Tile-Icon-of-a_11B05/error_2.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="error" border="0" alt="error" src="http://jasongaylord.com/Media/Default/Windows-Live-Writer/Removing-the-Title-in-the-Tile-Icon-of-a_11B05/error_thumb.png" width="244" height="135" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, you can blank out this field my modifying the WMAppManifest.xml file located in your project&amp;rsquo;s properties folder. Modify the section of this file that is highlighted below:&lt;/p&gt;
&lt;pre class="brush: xml; auto-links: true; collapse: false; first-line: 1; gutter: true; highlight: [9]; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.0"&amp;gt;
    ...
    &amp;lt;Tokens&amp;gt;
      &amp;lt;PrimaryToken TokenID="BarefootToken" TaskName="_default"&amp;gt;
        &amp;lt;TemplateType5&amp;gt;
          &amp;lt;BackgroundImageURI IsRelative="true" IsResource="false"&amp;gt;Application_TileImage_173x173.png&amp;lt;/BackgroundImageURI&amp;gt;
          &amp;lt;Count&amp;gt;0&amp;lt;/Count&amp;gt;
          &amp;lt;Title&amp;gt;&amp;lt;/Title&amp;gt;
        &amp;lt;/TemplateType5&amp;gt;
      &amp;lt;/PrimaryToken&amp;gt;
    &amp;lt;/Tokens&amp;gt;
  &amp;lt;/App&amp;gt;
&amp;lt;/Deployment&amp;gt;&lt;/pre&gt;
&lt;p&gt;This will allow your title to be blank and also allow your tile to appear on your device without the title.&lt;/p&gt;</description><pubDate>Thu, 16 Feb 2012 21:43:31 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/windows-phone-7-tile-icon-title-change</guid></item><item><title>Using Web.config Transforms in ASP.NET</title><link>http://www.jasongaylord.com:80/blog/using-web-config-transforms-in-aspnet</link><description>&lt;p&gt;One of my team members was working on an issue today within an application. The application is setup to use web.config transformations. Web.config transforms are a great way to create multiple build configurations (including, but not limited to, the debug and release build configuration that are built-in) and allow different configuration settings based on the build. For instance, you may have a database connection set to your localhost when you are debugging locally. However, you can use web.config transforms to change the server name when you publish the application using the release build configuration. This can also be used to ensure that every time you publish an application as a release, debug and trace are disabled for your application.&lt;/p&gt;
&lt;p&gt;Our application is setup so that we use transforms to set the connectionString attribute of each SQL connection in the configuration. We have multiple connection strings in this area.. We had multiple connection strings such as:&lt;/p&gt;
&lt;pre class="brush: xml; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;connectionStrings&amp;gt;
    &amp;lt;clear/&amp;gt;
    &amp;lt;add name="DefaultSqlServer" connectionString="metadata=res://*/Data.Sql.SqlEntities.csdl|res://*/Data.Sql.SqlEntities.ssdl|res://*/Data.Sql.SqlEntities.msl;provider=System.Data.SqlClient;provider connection string=&amp;amp;quot;Data Source=localhost;Initial Catalog=Test;User ID=sa;Password=password;MultipleActiveResultSets=True&amp;amp;quot;" providerName="System.Data.EntityClient"/&amp;gt;
    &amp;lt;add name="DefaultProviderConnectionString" connectionString="Data Source=localhost;Initial Catalog=Test;User ID=sa;Password=password;" providerName="System.Data.SqlClient"/&amp;gt;
&amp;lt;/connectionStrings&amp;gt;&lt;/pre&gt;
&lt;p&gt;In other words, one connection is used for connecting to the SQL database using Entity Framework while the other is used to connect to the database using the built-in providers. When we published the application using the release build configuration, both connectionString values were set to the same. After digging around for some time we forgot a simple part of the transform.&lt;/p&gt;
&lt;p&gt;When performing web.config transforms on a Key/Value dictionary pair in the web.config file, make sure that use also include an xdt:Locator attribute that contains the method Match. This allows you to pair up the specific value to a particular key.&lt;/p&gt;
&lt;p&gt;So, your connection strings should resemble something like the following in your web.release.config file:&lt;/p&gt;
&lt;pre class="brush: xml; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;&amp;lt;add name="DefaultSqlServer" connectionString="..." xdt:Transform="SetAttributes(connectionString)" xdt:Locator="Match(name)" /&amp;gt;&lt;/pre&gt;
&lt;p&gt;In my case, I&amp;rsquo;m replacing the DefaultSqlServer value with the value defined in the connectionString above. I can replace other attributes by separating the attribute names in the SetAttributes method with a comma.&lt;/p&gt;
&lt;p&gt;For additional config transform options, be sure to visit the MSDN page at &lt;a title="http://jasong.us/mhgvPh" href="http://jasong.us/mhgvPh"&gt;http://jasong.us/mhgvPh&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Thu, 16 Feb 2012 21:43:51 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/using-web-config-transforms-in-aspnet</guid></item><item><title>Orchard CMS Command Line Exception</title><link>http://www.jasongaylord.com:80/blog/orchard-cms-command-line-exception</link><description>&lt;p&gt;Late last week when I was at CodeStock 2011, I ran into an error with the orchard.exe command line utility. The exception generated looked similar to the following:&lt;/p&gt;
&lt;pre class="brush: shell; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;c:\inetpub\wwwroot\Orchard\Modules\Orchard.Packaging\Services\FileBaseProjectSystem.cs(33): error CS0246: The type or namespace name 'FrameworkName' could not be found (are you missing a using directive or an assembly reference?)

Exception Details: System.Web.HttpCompileException: c:\inetpub\wwwroot\Orchard\Modules\Orchard.Packaging\Services\FileBaseProjectSystem.cs(33): error CS0246: The type or namespace name 'FrameworkName' could not be found (are you missing a using directive or an assembly reference?)&lt;/pre&gt;
&lt;p&gt;After talking with individuals on the Orchard team, this appears to be an open item that they hope to solve for Orchard 1.2. If you run into this, please contact me directly by responding with a comment or messaging me on Twitter so I can pass on a potential resolution. I&amp;rsquo;m hoping that we can track whether or not the supposed solution does actually solve this issue.&lt;/p&gt;
&lt;p&gt;Since, this is a random exception, we can use your help.&lt;/p&gt;</description><pubDate>Thu, 16 Feb 2012 21:44:14 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/orchard-cms-command-line-exception</guid></item><item><title>The WeatherDotCom Widget for Orchard CMS</title><link>http://www.jasongaylord.com:80/blog/weatherdotcom-widget-for-orchard</link><description>&lt;p&gt;If you&amp;rsquo;ve checked out my new website recently, you may have noticed that I have included the weather on the site. Mouse over on the right-hand side and you&amp;rsquo;ll notice a &amp;ldquo;bing-like&amp;rdquo; box that will appear. I&amp;rsquo;ll talk about this a bit more in a bit, but you&amp;rsquo;ll notice that the weather pulls for my local zip code. These are the results from the &lt;a href="http://www.weather.com/" target="_blank"&gt;Weather Channel&amp;rsquo;s weather.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To take advantage of this service, you must first register on their website at &lt;a title="http://jasong.us/lTxDfY" href="http://jasong.us/lTxDfY" target="_blank"&gt;http://www.weather.com/services/xmloap.html&lt;/a&gt;. During this process, you&amp;rsquo;ll be provided with a Partner ID and a License Key. Be sure to take note of these as you&amp;rsquo;ll need them at a later point.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p align="center"&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color: #666666;" color="#666666"&gt;Note: If you are not a programmer or web developer, you may want to skip past the next two sections and go to Adding the Widget to Orchard.&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt;Weather Data from the Web Service&lt;/h4&gt;
&lt;p&gt;I wanted to take advantage of all of the data being returned from the Weather Channel&amp;rsquo;s current conditions web service. So, I converted the result into two strongly-typed class objects. The first class object is called LocationInfo and is defined as:&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;public class LocationInfo
{
    public string LocationName { get; set; }
    public string Latitude { get; set; }
    public string Longitude { get; set; }
    public string Sunrise { get; set; }
    public string Sunset { get; set; }
    public string TimeZone { get; set; }
}&lt;/pre&gt;
&lt;p&gt;The second class object is called CurrentConditions and is defined as:&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;public class CurrentConditions
{
    public string Temperature { get; set; }
    public string FeelsLike { get; set; }
    public string Description { get; set; }
    public string DescriptionIconNumber { get; set; }
    public string BarometricPressure { get; set; }
    public string BarometricPressureDirection { get; set; }
    public string WindSpeed { get; set; }
    public string WindDirection { get; set; }
    public string WindGust { get; set; }
    public string Humidity { get; set; }
    public string Visibility { get; set; }
    public string UvIndex { get; set; }
    public string UvDescription { get; set; }
    public string Dewpoint { get; set; }
    public string MoonIconNumber { get; set; }
    public string MoonType { get; set; }
}&lt;/pre&gt;
&lt;p&gt;In both of these instances, these are the properties that will be exposed to any custom views being rendered. I&amp;rsquo;ve included both of these class objects in another class object that is returned when the call is made to obtain the current weather. This class object is called Weather and is defined as:&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;public class Weather
{        
    public LocationInfo LocationInfo { get; set; }
    public CurrentConditions CurrentConditions { get; set; }
    public DateTime TimeCached { get; set; }
    public String ApiStatus { get; set; }
}&lt;/pre&gt;
&lt;h4&gt;Customizing the Weather View&lt;/h4&gt;
&lt;p&gt;In my particular instance, I wanted to be able to cache the weather every 15 minutes. I also wanted to show a current weather image in the background and hide the text details for the weather. Then, I would show the text details in a div. To get this to work, I decided to add some custom JavaScript.&lt;/p&gt;
&lt;p&gt;The first step in this task was to randomly generate where my first &amp;ldquo;bing-like&amp;rdquo; box would appear hinting that a mouseover was needed. To do this, I randomly calculated the location from the top and left and subtracted the size of the details box. This helped me to better place the boxes while staying within the background image location.&lt;/p&gt;
&lt;pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;$(document).ready(function () {
    /* Randomize Divs */
    var ranHeight = Math.ceil(Math.random() * 115) + 5; /* Always 85 less than height */
    var ranIndent = Math.ceil(Math.random() * 120) + 5; /* Always 180 less than height */

    /* Get the Divs */
    var spot = $('#weatherSpot');
    var details = $('#weatherDetails');

    /* Add the new positions */
    spot.css("top", ranHeight + "px");
    details.css("top", ranHeight + "px");
    spot.css("right", ranIndent + 155 + "px");
    details.css("right", ranIndent + "px");
});&lt;/pre&gt;
&lt;p&gt;The next step in the process was to use jQuery to fade in and out the boxes.&lt;/p&gt;
&lt;pre class="brush: js; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;$('#weatherBlock').mouseenter(function () {
    $('#weatherSpot').fadeIn('slow', function () {
        // Nothing happens when animation completes
    });
}).mouseleave(function () {
    $('#weatherSpot').fadeOut('slow', function () {
        // Nothing happens when animation completes
    });
});

$('#weatherSpot').mouseenter(function () {
    $('#weatherDetails').fadeIn('slow', function () {
        // Nothing happens when animation completes
    });
}).mouseleave(function () {
    $('#weatherDetails').fadeOut('slow', function () {
        // Nothing happens when animation completes
    });
});&lt;/pre&gt;
&lt;p&gt;Finally, I needed to layout my view. Since it&amp;rsquo;s a custom view, I had complete control over the rendering and decision of the data. I choose to use many of the default fields.&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;@using System.Web.Hosting
@{
    Script.Include("weatherDotCom.js");
   
    var imgPath = "~/Themes/MyTheme/Content/weathericons/";
    var weathericon = "";

    weathericon = Url.Content(imgPath + Model.WeatherResults.CurrentConditions.DescriptionIconNumber + ".png");
}

&amp;lt;div id="weatherBlock" class="weatherBlock" style="background: url('@weathericon') no-repeat;"&amp;gt;
    &amp;lt;div id="weatherSpot" class="weatherSpot"&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div id="weatherDetails" class="weatherDetails"&amp;gt;
        &amp;lt;span class="weatherTemp"&amp;gt;@Model.WeatherResults.CurrentConditions.Temperature&amp;amp;deg;F&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;
        @Model.WeatherResults.CurrentConditions.Description&amp;lt;br /&amp;gt;
        Feels Like: @Model.WeatherResults.CurrentConditions.FeelsLike&amp;amp;deg;&amp;lt;br /&amp;gt;
        Wind: From @Model.WeatherResults.CurrentConditions.WindDirection at @Model.WeatherResults.CurrentConditions.WindSpeed mph
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;&lt;/pre&gt;
&lt;p&gt;I created custom weather icons for each of the potential weather patterns. The Weather Channel includes default images with your connection to their service.&lt;/p&gt;
&lt;p&gt;You may customize the widget as I have shown above or use the default view which is provided.&lt;/p&gt;
&lt;h4&gt;Adding the Widget to Orchard&lt;/h4&gt;
&lt;p&gt;To install the widget, you can log into your Orchard CMS version 1.1 dashboard and go to Modules (If you are running Orchard version 1.0, I&amp;rsquo;d strongly urge you to upgrade your instance as this instance is much more stable and more user friendly). In the Modules section, choose Gallery and type in Weather in the search box. Choose the WeatherDotCom widget and click Install. After its finished installing, you&amp;rsquo;ll be prompted to enable this feature.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;d like to install the widget offline, you can &lt;a href="http://jasong.us/kVwwY7" target="_blank"&gt;download it directly from the Orchard Gallery website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once it&amp;rsquo;s enabled, it&amp;rsquo;s now a new part that can be added to a page, a blog post, or as a widget. In most cases, you&amp;rsquo;ll want to add it as a widget. To add it as a Widget, choose Widgets in the dashboard. In the appropriate zone click the Add button. I&amp;rsquo;d recommend using it in AsideFirst, AsideSecond, or one of the zones found AfterMain. On the next screen, choose Web Part Record.&lt;/p&gt;
&lt;p&gt;When it&amp;rsquo;s added, you&amp;rsquo;ll have a property window screen that allows you to specify the properties for the widget. The screen looks like the following:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://jasongaylord.com.vserver01.cytanium.com/Media/Default/Windows-Live-Writer/Introducing-the-WeatherDotCom-Widget_B752/WeatherChannelProperties_2.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="WeatherChannelProperties" border="0" alt="WeatherChannelProperties" src="http://jasongaylord.com.vserver01.cytanium.com/Media/Default/Windows-Live-Writer/Introducing-the-WeatherDotCom-Widget_B752/WeatherChannelProperties_thumb.png" width="416" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;Conclusion&lt;/h4&gt;
&lt;p&gt;The source code and the widget can be downloaded by using the links below. If you find any bugs or have any suggestions, be sure to enter them on the CodePlex site, not the Orchard Gallery website, by using the &lt;a href="http://jasong.us/jSK0CU" target="_blank"&gt;Issue page&lt;/a&gt; or &lt;a href="http://jasong.us/j2PCWf" target="_blank"&gt;Discussion page&lt;/a&gt; respectively.&lt;/p&gt;
&lt;p&gt;&lt;a title="http://jasong.us/iVgLrU" href="http://jasong.us/iVgLrU" target="_blank"&gt;&lt;img src="http://jasong.us/jrk74Q" /&gt; Module Package for Orchard CMS&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://jasong.us/mhsING" href="http://jasong.us/mhsING" target="_blank"&gt;&lt;img src="http://jasong.us/jrk74Q" /&gt; Full Source Code&lt;/a&gt;&lt;/p&gt;</description><pubDate>Thu, 16 Feb 2012 21:45:08 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/weatherdotcom-widget-for-orchard</guid></item><item><title>Grow Your Website using Orchard</title><link>http://www.jasongaylord.com:80/blog/grow-your-website-using-orchard</link><description>&lt;p&gt;I&amp;rsquo;m just wrapping up a trip to Eastern Tennessee&amp;rsquo;s &lt;a href="http://codestock.org/" target="_blank"&gt;CodeStock 2011&lt;/a&gt; (in Knoxville to be precise). While I was down here, I presented on the &lt;a href="http://orchardproject.net/" target="_blank"&gt;Orchard CMS&lt;/a&gt;. Both the conference and talk were great and while I&amp;rsquo;m never really satisfied with any of my talks, I have recorded it. It will soon be available on the CodeStock website for all to view at a later date and time. However, I know that Michael Neel is quite busy and it may take him another day (or week) to get everything up there. So, I&amp;rsquo;ve jumped the gun and published it up myself. Be sure to check it out:&lt;br /&gt;&lt;br /&gt;&lt;iframe height="300" src="http://player.vimeo.com/video/24661843?title=0&amp;amp;byline=0&amp;amp;portrait=0" frameborder="0" width="400"&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://vimeo.com/24661843"&gt;Grow Your Website Using Orchard&lt;/a&gt; from &lt;a href="http://vimeo.com/jasongaylord"&gt;Jason Gaylord&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By now you probably have heard of a new content management system called Orchard. You may already have a CMS, but this one that&amp;rsquo;s been released by The Outercurve Foundation is different. We&amp;rsquo;ll discuss some of the features and benefits to using Orchard. We&amp;rsquo;ll also see some tips and tricks. By the end of this session, you&amp;rsquo;ll not only have an understanding of how to use Orchard, but will have a fully functional website as an added bonus.&lt;/p&gt;</description><pubDate>Thu, 16 Feb 2012 21:45:56 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/grow-your-website-using-orchard</guid></item><item><title>Preparing for CodeStock 2011</title><link>http://www.jasongaylord.com:80/blog/preparing-for-codestock-2011</link><description>&lt;p&gt;I arrived in Sevierville, TN last evening in preparation for CodeStock 2011. I&amp;rsquo;ll be presenting about the Orchard CMS tomorrow at 12:30pm in room 401. You can read more about the talk on the CodeStock site at &lt;a title="http://codestock.org/Sessions/grow-your-website-using-orchard.aspx" href="http://codestock.org/Sessions/grow-your-website-using-orchard.aspx"&gt;http://codestock.org/Sessions/grow-your-website-using-orchard.aspx&lt;/a&gt;. I&amp;rsquo;ll be posting pictures later on after visiting various stops.&lt;/p&gt;</description><pubDate>Thu, 02 Jun 2011 20:45:00 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/preparing-for-codestock-2011</guid></item></channel></rss>
