<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Jason N. Gaylord - Tech</title><link>http://www.jasongaylord.com:80/Tags/Tech</link><description>Jason N. Gaylord - Tech</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>So Where Have I Been Now?</title><link>http://www.jasongaylord.com:80/blog/i-planned-techbash2012</link><description>&lt;p&gt;I figured you may ask. Since my last post, I have been working hard to prepare and organize Northeastern PA&amp;rsquo;s only true technology conference, &lt;a href="http://techbash.com/" target="_blank"&gt;TECHbash 2012&lt;/a&gt;. The event was great! Everything was a huge success and the attendees seem to be pumped up for TECHbash 2013. Although we&amp;rsquo;re still 11 months away from our next event, we are already planning for the next one. If you think you may be interested in speaking, sponsoring, or volunteering, please let me know. We&amp;rsquo;ll have our first meeting regarding the event in August to begin carving out the details.&lt;/p&gt;
&lt;p&gt;Thanks to all that made this year&amp;rsquo;s event a success!&lt;/p&gt;</description><pubDate>Wed, 09 May 2012 18:46:37 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/i-planned-techbash2012</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>Should Microsoft and Amazon put Windows 8 on the Kindle?</title><link>http://www.jasongaylord.com:80/blog/should-amazon-use-windows8-for-kindlefire</link><description>&lt;p&gt;A &lt;a href="http://jasong.us/yZGnCq" target="_blank"&gt;co-worker of mine&lt;/a&gt; sent off a Fox News article yesterday about a &lt;a href="http://jasong.us/xiJKP3" target="_blank"&gt;Former Microsoft employee that is “fixing” Windows 8&lt;/a&gt;. After reading the article, my first take away was another person explaining the Windows 8 UI flaws. Seriously? Those articles are a &lt;a href="http://jasong.us/wN45XV" target="_blank"&gt;dime&lt;/a&gt; &lt;a href="http://www.extremetech.com/computing/96249-5-deal-breaking-flaws-in-windows-8" target="_blank"&gt;&lt;a href="http://jasong.us/xfOVeC" target="_blank"&gt;a&lt;/a&gt;&lt;/a&gt; &lt;a href="http://www.pcmag.com/article2/0,2817,2393269,00.asp" target="_blank"&gt;&lt;a href="http://jasong.us/xMVKZb" target="_blank"&gt;dozen&lt;/a&gt;&lt;/a&gt;. Whenever you change the user interface of any system there will always be resistance. Don’t believe me? How about when Facebook users were upset about the &lt;a href="http://www.usatoday.com/tech/news/story/2011-09-21/facebook-changes-reactions/50500830/1" target="_blank"&gt;&lt;a href="http://jasong.us/zG6tC7" target="_blank"&gt;Facebook UI changes&lt;/a&gt;&lt;/a&gt;? They didn’t up and leave to &lt;a href="http://insights.chitika.com/2011/failure-to-launch-google-growth-spurt-short-lived/" target="_blank"&gt;&lt;a href="http://jasong.us/yFR4WJ" target="_blank"&gt;Google+ now did they&lt;/a&gt;&lt;/a&gt;? Rather than dive into &lt;a href="http://professionalaspnet.com/archive/2012/03/14/Here_2700_s-What_2700_s-Right-With-Windows-8.aspx" target="_blank"&gt;&lt;a href="http://jasong.us/ymWxFK" target="_blank"&gt;what’s right with Windows 8&lt;/a&gt;&lt;/a&gt;, I’d like to explain my second take away a bit more.&lt;/p&gt; &lt;p&gt;I started to wonder, what if Amazon struck a deal with Microsoft to put Windows 8 on the second generation Kindle Fire? They’d obviously have to give something in return. So what if that something was their cloud offering? I mean, if ScottGu’s team can focus on the Azure UI, but the back end was Amazon, would that be the best of both worlds? My wife has a Kindle Fire. Comparing the screen size to my Samsung Series 7 Windows 8 slate, I can easily see Windows 8 on it. For one, the &lt;a href="http://blogs.computerworld.com/19014/amazon_kindle_fire_tablet" target="_blank"&gt;&lt;a href="http://jasong.us/we8ucn" target="_blank"&gt;Kindle does not have Google Apps&lt;/a&gt;&lt;/a&gt; (unless you &lt;a href="http://jasong.us/ySxptv" target="_blank"&gt;root the device&lt;/a&gt;). The reason for this is that Google can’t get over Amazon building a better UI than Android. Secondly, think of the power house that Microsoft and Amazon would create. Together, the two of them would help compete against both Apple and Google. Creativity would be injected into both. Let that soak in. &lt;/p&gt; &lt;p&gt;What if Microsoft started offering Amazon Payments, Kindle devices in their Store, and even search capabilities over Amazon’s entire Kindle library? What if Amazon was able to offer an updated and stronger cloud service, a larger footprint for Windows 8 devices, and even Microsoft Advertising across more devices and platforms? &lt;/p&gt; &lt;p&gt;What if?&lt;/p&gt;</description><pubDate>Thu, 15 Mar 2012 14:20:30 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/should-amazon-use-windows8-for-kindlefire</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>Finding Microsoft File Transfer Manager</title><link>http://www.jasongaylord.com:80/blog/find-microsoft-file-transfer-manager</link><description>&lt;p&gt;Earlier today, Microsoft released Windows 8 Beta. Of course, when I was downloading it, I had to leave and head to another building. So, I paused my download in the Microsoft File Transfer Manager. However, I couldn’t find it easily again. I finally found a blog post saying it was called TransferMgr.exe. I searched my machine and found it at "C:\Windows\Downloaded Program Files\TransferMgr.exe". Be sure to look for it there first in the event of needing it.&lt;/p&gt;</description><pubDate>Thu, 01 Mar 2012 02:23:01 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/find-microsoft-file-transfer-manager</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>TECHbash 2012: A Free Technology Conference in Northeastern Pennsylvania</title><link>http://www.jasongaylord.com:80/blog/techbash-2012-announcement</link><description>&lt;p&gt;Ever want to check out the latest technologies but have been too busy dealing with kids, co-workers, or angry birds? Now’s your chance. Push everything aside and get ready to attend the coolest conference in town. Well, it’s not in a town. Pennsylvania only has one of those. Rather, it’s at Luzerne County Community College in Nanticoke, PA. If you’re not familiar with Nanticoke, it’s a small township just south of the City of Wilkes-Barre and approximately 30 minutes south of Scranton, Pennsylvania. While the registration page is not available for TECHbash 2012 just yet, it doesn’t mean that you can’t prepare for the event. It’s really, really important that you do the following. It’s confusing so I’ll outline things for you:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;If you are a potential speaker, visit &lt;a title="http://techbash.com/news/call-for-speakers-2012" href="http://techbash.com/news/call-for-speakers-2012"&gt;http://techbash.com/news/call-for-speakers-2012&lt;/a&gt;. There are a few things we’ll need from you such as your first born, some DNA, your bank account information, … or maybe just a short bio, mugshot, topics, and short description of each proposed talk. But, don’t take my word for it, click the link above and see the “official” post.&lt;br/&gt;&lt;br/&gt; &lt;li&gt;If you are a potential sponsor, visit &lt;a title="http://techbash.com/news/sponsors-wanted" href="http://techbash.com/news/sponsors-wanted"&gt;http://techbash.com/news/sponsors-wanted&lt;/a&gt;. You’ll find additional information about the event and a method for obtaining the sponsorship packet.&lt;br/&gt;&lt;br/&gt; &lt;li&gt;If you are looking to just attend, learn some cool stuff, pick up some swag (software, shirts, etc.) and meet new people, we have nothing for you yet. I know. That’s horrible. Your pumped up, but can’t do anything. Well, that’s not entirely true. If you want to know when TECHbash 2012 registration will be available, you can sign-up for the notification list here: &lt;a title="http://techbash2012.kickofflabs.com/" href="http://techbash2012.kickofflabs.com/"&gt;http://techbash2012.kickofflabs.com/&lt;/a&gt;. In addition, besides just adding a reminder, you’ll get a special referral code. Whatever attendee gets the most people to add a reminder using their specific referral code will win a super cool prize.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Thanks for taking the time to learn more. On behalf of .NET Valley and the TECHbash coordination team, we look forward to seeing you at &lt;a href="http://techbash.com/" target="_blank"&gt;TECHbash 2012&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Fri, 17 Feb 2012 16:25:48 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/techbash-2012-announcement</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>State of Apple</title><link>http://www.jasongaylord.com:80/blog/state-of-apple-2011</link><description>&lt;p&gt;Now that Steve Jobs has officially passed away at the age of 56, take a moment and grieve. After that period has passed, reflect. Reflect on the state of Microsoft after Bill Gates left and dedicated the majority of his time to his foundation. Reflect on the state of Dell Computers when Michael Dell left. There was a reason he came back. And now Apple has lost it's leader as well. The original three from Apple are no longer there. What does the future hold? New Apple CEO, Tim Cook, has been critized for the lack of pop in his presentation earlier this week. If this is any indication of the future, what does this do to the state of Apple?&lt;/p&gt;
&lt;p&gt;Let's see how this affects stocks over the next few weeks.&lt;/p&gt;</description><pubDate>Thu, 06 Oct 2011 14:00:00 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/state-of-apple-2011</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>Calculating Dell Power Consumption for Servers</title><link>http://www.jasongaylord.com:80/blog/calculating-dell-server-power-consumption</link><description>&lt;p&gt;We are in the process of building out a new data center. One of the items I needed to know was a rough estimate of our new, monthly electrical bill. In some cases, you may need to show a return on investment (ROI) for going to a virtualized environment using VMWare or Microsoft Hyper-V. You can calculate the number of watts your devices use by visiting &lt;a href="http://www.dell.com/calc"&gt;http://www.dell.com/calc&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you need to calculate cost of power, you can convert watts to kilowatts (watts / 1000), then multiply that by 24 hours, 30 days, and the cost per kwh. So, if you live in an area that has a cost per kilowatt hour at 9.5 cents and your equipment uses 2500 watts, your total cost per month would be $171 per month.&lt;/p&gt;</description><pubDate>Fri, 01 Jul 2011 03:45:00 GMT</pubDate><guid isPermaLink="true">http://www.jasongaylord.com:80/blog/calculating-dell-server-power-consumption</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></channel></rss>
