<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>An Insomniac Geek</title>
	
	<link>http://insomniacgeek.com</link>
	<description>I was about to write about procrastination, but I'll do that later</description>
	<lastBuildDate>Fri, 29 Apr 2011 09:21:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AnInsomniacGeek" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="aninsomniacgeek" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>How to stop QuickTime stealing your mp3 links on Windows 7</title>
		<link>http://insomniacgeek.com/how-to-stop-quicktime-stealing-your-mp3-links-on-windows-7/</link>
		<comments>http://insomniacgeek.com/how-to-stop-quicktime-stealing-your-mp3-links-on-windows-7/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 11:32:47 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://insomniacgeek.com/how-to-stop-quicktime-stealing-your-mp3-links-on-windows-7/</guid>
		<description><![CDATA[So you have QuickTime installed? I’m terrible sorry. You may have noted that even if you have told Windows 7 to use your favorite media player (which I’ll hope in most cases is anything but QuickTime), QuickTime still starts to play links you click on on the web. Even when you have done everything possible, [...]]]></description>
			<content:encoded><![CDATA[<p>So you have QuickTime installed? I’m terrible sorry. </p>
<p>You may have noted that even if you have told Windows 7 to use your favorite media player (which I’ll hope in most cases is anything but QuickTime), QuickTime still starts to play links you click on on the web.</p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/03/image.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Windows Media Player as the default player" border="0" alt="Windows Media Player as the default player" src="http://insomniacgeek.com/wp-content/uploads/2011/03/image_thumb.png" width="644" height="462" /></a></p>
<p>Even when you have done everything possible, going to a web site that has a link to a MP3 file, an embedded QuickTime player will start:</p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/03/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://insomniacgeek.com/wp-content/uploads/2011/03/image_thumb1.png" width="644" height="457" /></a></p>
<p>As it turns out, most MP3 links are returned with a content type of audio/mpeg, which QuickTime associates itself with at installation.</p>
<p>Here’s the solution:</p>
<p>1. Start the Registry Editor by pressing WinKey+R and then Regedit. Press enter.</p>
<p>2. Browse to HKEY_CLASSES_ROOT\MIME\Database\Content Type\audio/mpeg</p>
<p>3. Double click the CLSID string value</p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/03/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://insomniacgeek.com/wp-content/uploads/2011/03/image_thumb2.png" width="398" height="179" /></a></p>
<p>4. Replace the string with this (if you want the Windows Media Player):<em> {cd3afa76-b84f-48f0-9393-7edc34128127}</em></p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/03/image3.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="CLSID set to Windows Media Player" border="0" alt="CLSID set to Windows Media Player" src="http://insomniacgeek.com/wp-content/uploads/2011/03/image_thumb3.png" width="644" height="299" /></a></p>
<p>You can also do this for .mp4 audio and video files, which have the content type<em> audio/mp4</em> and<em> video/mp4</em> respectively.</p>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/how-to-stop-quicktime-stealing-your-mp3-links-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClickOnce 4.0 package for the C++ 2008 SP1 Redist ATL Security Update</title>
		<link>http://insomniacgeek.com/clickonce-4-0-package-for-the-c-2008-sp1-redist-atl-security-update/</link>
		<comments>http://insomniacgeek.com/clickonce-4-0-package-for-the-c-2008-sp1-redist-atl-security-update/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:19:13 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://insomniacgeek.com/clickonce-4-0-package-for-the-c-2008-sp1-redist-atl-security-update/</guid>
		<description><![CDATA[ClickOnce is a great technology that simplifies the setup and install process for the end user. I ended up in a project where there was a need to install the latest SQL Server Compact Edition 4.0 in private distribution mode in a .NET v4 solution. In theory, that’s just the case of distributing the SQL [...]]]></description>
			<content:encoded><![CDATA[<p>ClickOnce is a great technology that simplifies the setup and install process for the end user. I ended up in a project where there was a need to install the latest SQL Server Compact Edition 4.0 in private distribution mode in a .NET v4 solution. In theory, that’s just the case of distributing the SQL CE runtime DLL’s to the destination folder. But wait, there’s a catch. The latest SQL CE v4.0 is dependent on the <a href="http://www.microsoft.com/downloads/en/details.aspx?familyid=2051A0C1-C9B5-4B0A-A8F5-770A549FD78C&amp;displaylang=en" target="_blank">Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package ATL Security Update.</a> (msvcr90.dll version 9.0.30729.4148) Well, that shouldn’t be a problem, just open up the prerequisites dialog in VS 2010 and put a check mark into….. oh darn. There is no bootstrapper package for the 2008 VC++ Redist in Visual Studio 2010, just the newest 2010 VC++ redist package.</p>
<p>So what to do?</p>
<p>Well, just create you own bootstrapper package, and here I will guide you through the steps.</p>
<p>First, create a new folder in the package install location for the bootstrapper. The default location is C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages. Create a folder named <em>vcredist_2008SP1_x86</em>. Download the <a href="http://www.microsoft.com/downloads/en/details.aspx?familyid=2051A0C1-C9B5-4B0A-A8F5-770A549FD78C&amp;displaylang=en" target="_blank">Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package ATL Security Update</a> and save the vcredist_x86.exe&nbsp; into this new folder.</p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/01/image5.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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://insomniacgeek.com/wp-content/uploads/2011/01/image_thumb5.png" width="710" height="478"></a></p>
<p>Create a <em>product.xml</em> file in the new location and enter the following:</p>
<pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8" ?&gt; 

&lt;Product
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  ProductCode="Microsoft.Visual.C++.9.0.x86"
&gt;

  &lt;!-- Defines list of files to be copied on build --&gt;
  &lt;PackageFiles&gt;
    &lt;PackageFile Name="vcredist_x86.exe" HomeSite="VCRedistExe"/&gt;
  &lt;/PackageFiles&gt;
  &lt;InstallChecks&gt;
    &lt;MsiProductCheck Property="VCRedistInstalled" Product="{1F1C2DFC-2D24-3E06-BCB8-725134ADF989}"/&gt;
  &lt;/InstallChecks&gt;

  &lt;!-- Defines how to invoke the setup for the Visual C++ 10.0 redist --&gt;
  &lt;!-- TODO: Needs EstrimatedTempSpace, LogFile, and an update of EstimatedDiskSpace --&gt;
  &lt;Commands Reboot="Defer"&gt;
    &lt;Command PackageFile="vcredist_x86.exe"
         Arguments=' /q:a '
         &gt;

      &lt;!-- These checks determine whether the package is to be installed --&gt;
      &lt;InstallConditions&gt;
        &lt;BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/&gt;
        &lt;!-- Block install if user does not have admin privileges --&gt;
        &lt;FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/&gt;

        &lt;!-- Block install on Win95 --&gt;
        &lt;FailIf Property="Version9X" Compare="VersionLessThan" Value="4.10" String="InvalidPlatformWin9x"/&gt;

        &lt;!-- Block install on NT 4 or less --&gt;
        &lt;FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/&gt;

      &lt;/InstallConditions&gt;

      &lt;ExitCodes&gt;
        &lt;ExitCode Value="0" Result="Success"/&gt;
        &lt;ExitCode Value="3010" Result="SuccessReboot"/&gt;
        &lt;DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" /&gt;
      &lt;/ExitCodes&gt;

    &lt;/Command&gt;
  &lt;/Commands&gt;
&lt;/Product&gt;
</pre>
<p>&nbsp;</p>
<p>Create a new folder inside vcredist_2008SP1_x86 and name it <em>en</em>. In the <em>en</em> folder, create a package.xml, and copy paste the following:</p>
<pre class="brush: xml;">&lt;?xml version="1.0" encoding="utf-8" ?&gt;

&lt;Package
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  Name="DisplayName"
  Culture="Culture"
&gt;

    &lt;!-- Defines a localizable string table for error messages--&gt;
    &lt;Strings&gt;
        &lt;String Name="DisplayName"&gt;Visual C++ 2008 SP1 Runtime Libraries (x86)&lt;/String&gt;
        &lt;String Name="Culture"&gt;en&lt;/String&gt;
        &lt;String Name="AdminRequired"&gt;You do not have the permissions required to install Visual C++ 2008 SP1 Runtime Libraries (x86). Please contact your administrator.&lt;/String&gt;
        &lt;String Name="InvalidPlatformWin9x"&gt;Installation of Visual C++ 2008 SP1 Runtime Libraries (x86) is not supported on Windows 95. Contact your application vendor.&lt;/String&gt;
        &lt;String Name="InvalidPlatformWinNT"&gt;Installation of Visual C++ 2008 SP1 Runtime Libraries (x86) is not supported on Windows NT 4.0. Contact your application vendor.&lt;/String&gt;
        &lt;String Name="GeneralFailure"&gt;A failure occurred attempting to install Visual C++ 2008 SP1 Runtime Libraries (x86).&lt;/String&gt;
        &lt;String Name="VCRedistExe"&gt;http://download.microsoft.com/download/9/7/7/977B481A-7BA6-4E30-AC40-ED51EB2028F2/vcredist_x86.exe&lt;/String&gt;
    &lt;/Strings&gt;

&lt;/Package&gt;
</pre>
<p>&nbsp;</p>
<p>Now, when you restart Visual Studio 2010, you should have a new package for the <a href="http://www.microsoft.com/downloads/en/details.aspx?familyid=2051A0C1-C9B5-4B0A-A8F5-770A549FD78C&amp;displaylang=en" target="_blank">Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package ATL Security Update</a>:</p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/01/image7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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://insomniacgeek.com/wp-content/uploads/2011/01/image_thumb7.png" width="591" height="457"></a></p>
<p>And when the end user runs the ClickOnce setup, it will automatically install the VC++ redist if it’s not installed already.</p>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/clickonce-4-0-package-for-the-c-2008-sp1-redist-atl-security-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with WTL on Visual Studio 2010</title>
		<link>http://insomniacgeek.com/getting-started-with-wtl-on-visual-studio-2010/</link>
		<comments>http://insomniacgeek.com/getting-started-with-wtl-on-visual-studio-2010/#comments</comments>
		<pubDate>Sat, 22 Jan 2011 14:10:25 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://insomniacgeek.com/getting-started-with-wtl-on-visual-studio-2010/</guid>
		<description><![CDATA[Now that you have downloaded the latest WTL release (v8.1 at the time of this writing), you will find out that it doesn’t have any project wizards for Visual Studio 2010. That’s a relatively easily fix. Just go ahead and download the latest build from the repository at AppWiz.tar.gz-view=tar. Extract the .tar file and you [...]]]></description>
			<content:encoded><![CDATA[<p>Now that you have downloaded the latest <a href="http://wtl.sourceforge.net/" target="_blank">WTL release</a> (v8.1 at the time of this writing), you will find out that it doesn’t have any project wizards for Visual Studio 2010. That’s a relatively easily fix. Just go ahead and download the latest build from the repository at <a title="AppWiz.tar.gz-view=tar" href="http://wtl.svn.sourceforge.net/viewvc/wtl/trunk/wtl/Wizards/AppWiz.tar.gz?view=tar">AppWiz.tar.gz-view=tar</a>. Extract the .tar file and you will find the JavaScript install scripts for VS 2010:</p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/01/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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://insomniacgeek.com/wp-content/uploads/2011/01/image_thumb.png" width="493" height="311"></a></p>
<p>I recommend you to extract the files to the same location were you installed the WTL files. In my case this would be c:\WTL.&nbsp; Double click the setup100.js file (or setp100x.js for <a href="http://www.microsoft.com/express/downloads/#2010-Visual-CPP" target="_blank">Visual Studio 2010 Express</a>) to install the WTL Project Wizard.</p>
<h3>Add the WTL include path to the default include directories</h3>
<p>One thing you may have noticed in VS2010 (compared to earlier versions) is that there is no way to set the global paths of VC++ directories in Tools-&gt;Options:</p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/01/image1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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://insomniacgeek.com/wp-content/uploads/2011/01/image_thumb1.png" width="644" height="143"></a></p>
<p>Bummer. How to solve that? You really don’t want to have to include the WTL include path in every VC++ project. Here’s how to set the global paths and include the WTL include path. It’s really not that intuitive, if I would say.</p>
<p>First you will need to have a project open in VS 2010. Then go to View-&gt;Other Windows-&gt;Property Manager. In the Property Manager, expand the project and the platforms nodes. Multi-select the two Microsoft.Cpp.Win32.user items. (By holding down the Ctrl key and select them each by the mouse).</p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/01/image2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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://insomniacgeek.com/wp-content/uploads/2011/01/image_thumb2.png" width="230" height="244"></a></p>
<p>Right click and select properties</p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/01/image3.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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://insomniacgeek.com/wp-content/uploads/2011/01/image_thumb3.png" width="644" height="166"></a></p>
<p>Now you finally can set the global default search paths for the VC++ include directories. In my case I have added the C:\WTL\Include path. Save the properties settings restart Visual Studio.</p>
<p>If you open one of the samples in the WTL folders, you may stumble upon a peculiar error that says: <strong>error CVT1100: duplicate resource.&nbsp; type:MANIFEST, name:1, language:0&#215;0409</strong></p>
<p><a href="http://insomniacgeek.com/wp-content/uploads/2011/01/image4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; 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://insomniacgeek.com/wp-content/uploads/2011/01/image_thumb4.png" width="644" height="89"></a></p>
<p>This is because the way manifest files are handled in VS 2010 has changed. What you can do is to open the resource file (.rc), edit it by selecting “View Code” and remark out the line</p>
<pre>//CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "res\\BmpView.exe.manifest"</pre>
<p>Now, happy WTL’ing in Visual Studio 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/getting-started-with-wtl-on-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to detect the dark or light theme in Windows Phone 7</title>
		<link>http://insomniacgeek.com/how-to-detect-the-dark-or-light-theme-in-windows-phone-7/</link>
		<comments>http://insomniacgeek.com/how-to-detect-the-dark-or-light-theme-in-windows-phone-7/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 16:08:00 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://blog.insomniacgeek.com/?p=105</guid>
		<description><![CDATA[If the user of the Windows Phone 7 device switches from the default dark theme to the light theme, how do you detect which one is in use? In the MSDN article Theme Resources for Windows Phone, there are two interesting resource keys that you can query. These are the PhoneDarkThemeVisibility and PhoneLightThemeVisibility keys. So [...]]]></description>
			<content:encoded><![CDATA[<p>If the user of the Windows Phone 7 device switches from the default dark theme to the light theme, how do you detect which one is in use? In the MSDN article Theme Resources for Windows Phone, there are two interesting resource keys that you can query. These are the <em>PhoneDarkThemeVisibility</em> and <em>PhoneLightThemeVisibility</em> keys. So based on these we can determine if we should use a dark or light background image in our application, like so:</p>
<pre class="brush: csharp">var isLightTheme = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"];
var imageBrush = new ImageBrush();
var imageUri = new Uri(isLightTheme == Visibility.Visible ? "background-light.jpg" : "background-dark.jpg", UriKind.Relative);
imageBrush.ImageSource = new System.Windows.Media.Imaging.BitmapImage(imageUri);
MainPanorama.Background = imageBrush;</pre>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/how-to-detect-the-dark-or-light-theme-in-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Theme Colors</title>
		<link>http://insomniacgeek.com/windows-phone-7-theme-colors/</link>
		<comments>http://insomniacgeek.com/windows-phone-7-theme-colors/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 03:02:00 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://blog.insomniacgeek.com/?p=104</guid>
		<description><![CDATA[The Windows Phone 7 has two different background color modes; dark or light. In addition, there are ten accent colors to choose from. There’s currently no simple way of detecting which theme and accent color that the user has selected his or her device. However, since the colors of the current theme is injected into [...]]]></description>
			<content:encoded><![CDATA[<p>The Windows Phone 7 has two different background color modes; dark or light. In addition, there are ten accent colors to choose from.</p>
<table border="0" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="200"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/image_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/image_thumb.png" width="148" height="244"></a></td>
<td valign="top" width="200"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/image_4.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/image_thumb_1.png" width="148" height="244"></a></td>
</tr>
</tbody>
</table>
<p>There’s currently no simple way of detecting which theme and accent color that the user has selected his or her device. However, since the colors of the current theme is injected into to applications resources, one can at least read out the various colors from there.</p>
<p>The background color can be determined using this piece of code:</p>
<pre class="brush: csharp;">Color backgroundColor = (Color)Application.Current.Resources["PhoneBackgroundColor"];</pre>
<p>And in a similar fashion the foreground and accent colors can be determined like this:</p>
<pre class="brush: csharp;">Color foregroundColor = (Color)Application.Current.Resources["PhoneForegroundColor"];
Color accentColor = (Color)Application.Current.Resources["PhoneAccentColor"];</pre>
<p>All the various resource names are described here; <a href="http://msdn.microsoft.com/en-us/library/ff769552(VS.92).aspx" target="_blank">Theme Resources for Windows Phone</a>.</p>
<table border="0" cellspacing="0" cellpadding="2" width="530">
<tbody>
<tr>
<td valign="top" width="177"><strong>Theme</strong></td>
<td valign="top" width="185"><strong>Background Color Value</strong></td>
<td valign="top" width="166"><strong>Foreground Color Value</strong></td>
</tr>
<tr>
<td valign="top" width="177">Dark</td>
<td valign="top" width="185">#FF000000</td>
<td valign="top" width="166">#FFFFFFFF</td>
</tr>
<tr>
<td valign="top" width="177">Light</td>
<td valign="top" width="190">#FFFFFFFF</td>
<td valign="top" width="177">#DE000000</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="456">
<tbody>
<tr>
<td valign="top" width="272"><strong>Accent color</strong></td>
<td valign="top" width="182"><strong>Value</strong></td>
</tr>
<tr>
<td valign="top" width="312"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/01-WP7-magenta-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="01-WP7-magenta-accent" border="0" alt="01-WP7-magenta-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/01-WP7-magenta-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="200">
<h5><font style="font-weight: normal">#FFFF0097</font></h5>
</td>
</tr>
<tr>
<td valign="top" width="318"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/02-WP7-purple-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="02-WP7-purple-accent" border="0" alt="02-WP7-purple-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/02-WP7-purple-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="207">#FFA200FF</td>
</tr>
<tr>
<td valign="top" width="317"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/03-WP7-teal-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="03-WP7-teal-accent" border="0" alt="03-WP7-teal-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/03-WP7-teal-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="211">#FF00ABA9</td>
</tr>
<tr>
<td valign="top" width="315"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/04-WP7-lime-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="04-WP7-lime-accent" border="0" alt="04-WP7-lime-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/04-WP7-lime-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="213">#FF8CBF26</td>
</tr>
<tr>
<td valign="top" width="314"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/05-WP7-brown-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="05-WP7-brown-accent" border="0" alt="05-WP7-brown-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/05-WP7-brown-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="214">#FFA05000</td>
</tr>
<tr>
<td valign="top" width="314"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/06-WP7-pink-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="06-WP7-pink-accent" border="0" alt="06-WP7-pink-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/06-WP7-pink-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="214">#FFE671B8</td>
</tr>
<tr>
<td valign="top" width="314"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/07-WP7-orange-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="07-WP7-orange-accent" border="0" alt="07-WP7-orange-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/07-WP7-orange-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="214">#FFF09609</td>
</tr>
<tr>
<td valign="top" width="314"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/08-WP7-blue-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="08-WP7-blue-accent" border="0" alt="08-WP7-blue-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/08-WP7-blue-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="214">#FF1BA1E2</td>
</tr>
<tr>
<td valign="top" width="314"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/09-WP7-red-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="09-WP7-red-accent" border="0" alt="09-WP7-red-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/09-WP7-red-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="214">#FFE51400</td>
</tr>
<tr>
<td valign="top" width="314"><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/10-WP7-green-accent_2.png"><img style="background-image: none; border-right-width: 0px; margin: 3px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="10-WP7-green-accent" border="0" alt="10-WP7-green-accent" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/Windows-Phone-7-Theme-Colors_14586/10-WP7-green-accent_thumb.png" width="135" height="43"></a></td>
<td valign="top" width="214">#FF339933</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/windows-phone-7-theme-colors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NuGet packages for Mvvm Light</title>
		<link>http://insomniacgeek.com/nuget-packages-for-mvvm-light/</link>
		<comments>http://insomniacgeek.com/nuget-packages-for-mvvm-light/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 15:45:00 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[MVVM Light]]></category>
		<category><![CDATA[NuGet]]></category>

		<guid isPermaLink="false">http://blog.insomniacgeek.com/?p=103</guid>
		<description><![CDATA[PLEASE NOTE: These aren&#8217;t the packages that are on the official NuGet pubished list. There is a MVVM Light NuGet package that will cause error and problems on WP7 projects (by incorrectly installing SL4 assemblies). Please contact the author of that package if you are experiencing problems with that. These ones you can download here [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #f00">PLEASE NOTE: These aren&#8217;t the packages that are on the official NuGet pubished list. There is a MVVM Light NuGet package that will cause error and problems on WP7 projects (by incorrectly installing SL4 assemblies). Please contact the author of that package if you are experiencing problems with that. These ones you can download here (see below) works fine with WP7.</span></p>
<p><a href="http://nuget.codeplex.com">NuGet </a>is an utility that helps you install and reference open source packages into your Visual Studio 2010 project. It helps you to solve the pain points&nbsp; of doing the boring steps of :</p>
<ol>
<li>Browse to the home page of the open source project binaries/files.
<li>Download the latest version
<li>Right click on properties for the downloaded zip package and select un-block.
<li>Unzip to a temporary/specific folder
<li>Add reference to the assemblies on your Visual Studio project. </li>
</ol>
<p>Imagine how easy it would be if you just could select Add Package –&gt; <a href="http://mvvmlight.codeplex.com/" target="_blank">MVVM Light</a> to your new or existing project. Well, that is exactly what NuGet and this post is all about.</p>
<p><a href="http://www.galasoft.ch/mvvm/getstarted/" target="_blank">MVVM Light</a> is an excellent MVVM framework toolkit developed by Silverlight MVP <a href="http://twitter.com/lbugnion" target="_blank">Laurent Bugnion</a>.</p>
<h2>Install NuGet</h2>
<p>You will need to download and install the latest <a href="http://nuget.codeplex.com/" target="_blank">NuGet</a> from the <a href="http://www.codeplex.com/" target="_blank">CodePlex</a> project site: <a title="http://nupack.codeplex.com/" href="http://nuget.codeplex.com/">http://nuget.codeplex.com/</a> . Go to the Downloads page and click on the NuGet.Tools.vsix link.</p>
<p><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_4.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="NuPack download page" border="0" alt="NuPack download page" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_thumb_1.png" width="531" height="242"></a></p>
<h2>Download the MVVM Light NuGet packages</h2>
<p>I have created <a href="http://nuget.codeplex.com/" target="_blank">NuGet</a> packages for the following <a href="http://mvvmlight.codeplex.com/" target="_blank">MVVM Light</a> project types, which at this time of writing was version 3.0 SP1:</p>
<p><a href="http://insomniacgeek.com/Downloads/MVVM.Light.NuPackages.zip" target="_blank">MVVM Light NuGetPackages</a></p>
<p>Or separately:</p>
<p><a href="http://insomniacgeek.com/Downloads/Mvvm.Light.Silverlight3.3.0.0.31674.nupkg.zip" target="_blank">MVVM Light Silverlight 3</a></p>
<p><a href="http://insomniacgeek.com/Downloads/Mvvm.Light.Silverlight4.3.0.0.28574.nupkg.zip" target="_blank">MVVM Light Silverlight 4</a></p>
<p><a href="http://insomniacgeek.com/Downloads/Mvvm.Light.WP7.3.0.0.27833.nupkg.zip" target="_blank">MVVM Light Windows Phone 7</a></p>
<p><a href="http://insomniacgeek.com/Downloads/Mvvm.Light.WPF35SP1.3.0.0.31869.nupkg.zip" target="_blank">MVVM Light WPF 3.5 SP1</a></p>
<p><a href="http://insomniacgeek.com/Downloads/Mvvm.Light.WPF4.3.0.0.29166.nupkg.zip" target="_blank">MVVM Light WPF 4</a></p>
<p>&nbsp;</p>
<h2>&nbsp;</h2>
<h2>&nbsp;</h2>
<h2>Add a package to an existing or new project</h2>
<p>Download any of the above packages for the targeted project type to a folder of your choice, let’s say c:\NuPackages. Bring the NuPack console up be selecting View-&gt;Other Windows-&gt;Package Manager Console. In the NuPack console, select the Manage package sources button:</p>
<p><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_6.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Select package source button" border="0" alt="Select package source button" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_thumb_2.png" width="411" height="122"></a></p>
<p>And select the path to where you downloaded the <a href="http://mvvmlight.codeplex.com/" target="_blank">MVVM Light</a> NuPackages and click Add:</p>
<p><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_8.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Add path to packages" border="0" alt="Add path to packages" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_thumb_3.png" width="478" height="199"></a></p>
<p>&nbsp;</p>
<p>Going back to the console, select the new package path in the dropdown, also make sure that you have a project selected:</p>
<p><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_12.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Select path and project" border="0" alt="Select path and project" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_thumb_5.png" width="735" height="98"></a></p>
<p>Type in the command to add your desired <a href="http://mvvmlight.codeplex.com/" target="_blank">MVVM Light</a> package, in this case the Windows Phone 7 package:</p>
<p><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_14.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Add-Package command" border="0" alt="Add-Package command" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_thumb_6.png" width="232" height="34"></a></p>
<p>Hopefully, everything will work and you have added the <a href="http://mvvmlight.codeplex.com/" target="_blank">MVVM Light</a> dependencies in your project:</p>
<p><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_16.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Package added successfully" border="0" alt="Package added successfully" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_thumb_7.png" width="541" height="64"></a></p>
<p><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_18.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Project references set" border="0" alt="Project references set" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_thumb_8.png" width="279" height="168"></a></p>
<p>Alternatively, you can use the GUI as well, right click on the Reference node in the project and select Add Package Reference.</p>
<p><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_20.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Add Package Reference" border="0" alt="Add Package Reference" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_thumb_9.png" width="240" height="81"></a></p>
<p>And select the desired package:</p>
<p><a href="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_22.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Select MVVM Light NuPackage" border="0" alt="Select MVVM Light NuPackage" src="http://insomniacgeek.com/files/media/image/Windows-Live-Writer/NuPackages-for-Mvvm-Light_90D8/image_thumb_10.png" width="644" height="446"></a></p>
<p>Happy <a href="http://mvvmlight.codeplex.com/" target="_blank">MVVM Light</a> Coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/nuget-packages-for-mvvm-light/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix Resource not found error with your ASP.NET MVC project</title>
		<link>http://insomniacgeek.com/how-to-fix-resource-not-found-error-with-your-asp-net-mvc-project/</link>
		<comments>http://insomniacgeek.com/how-to-fix-resource-not-found-error-with-your-asp-net-mvc-project/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 03:07:00 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>

		<guid isPermaLink="false">http://blog.insomniacgeek.com/?p=102</guid>
		<description><![CDATA[Once in a while when you have downloaded a ASP.NET MVC project, it will fail to start. All you get is a 404 error, or a Resource not found.&#160; Here&#8217;s how to fix that. Go to the properties page of the Web project and select the Web tab. In the Start Action section, set it [...]]]></description>
			<content:encoded><![CDATA[<p>
Once in a while when you have downloaded a ASP.NET MVC project, it will fail to start. All you get is a 404 error, or a Resource not found.&nbsp; Here&rsquo;s how to fix that. Go to the properties page of the Web project and select the Web tab. In the Start Action section, set it to Specific Page, but leave the textbox empty.</p>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/how-to-fix-resource-not-found-error-with-your-asp-net-mvc-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use CDN links in your ASP.NET MVC application to serve static content from a cookieless domain</title>
		<link>http://insomniacgeek.com/how-to-use-cdn-links-in-your-asp-net-mvc-application-to-serve-static-content-from-a-cookieless-domain/</link>
		<comments>http://insomniacgeek.com/how-to-use-cdn-links-in-your-asp-net-mvc-application-to-serve-static-content-from-a-cookieless-domain/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 23:42:00 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[CDN]]></category>

		<guid isPermaLink="false">http://blog.insomniacgeek.com/?p=101</guid>
		<description><![CDATA[Problem: When you develop your ASP.NET MVC application and use a link to a static content, such as css, jpg&#8217;s etc, you may want to server these from a CDN or at least a domain that doesn&#8217;t server cookies with the request. For those of you who have been using the Google Page Speed add-in [...]]]></description>
			<content:encoded><![CDATA[<p>
Problem:<br />
When you develop your ASP.NET MVC application and use a link to a static content, such as css, jpg&rsquo;s etc, you may want to server these from a CDN or at least a domain that doesn&rsquo;t server cookies with the request. For those of you who have been using the Google Page Speed add-in for FireFox, you know what I&rsquo;m talking about:</p>
<p>
<a href="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/How.NETMVCapplicationtoservestaticconten_11DA8/Untitled1_4.png"><img alt="Untitled1" border="0" height="399" src="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/How.NETMVCapplicationtoservestaticconten_11DA8/Untitled1_thumb_1.png" style="border-width: 0px; margin: 3px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="Untitled1" width="594" /></a></p>
<p>
So the question is, how do you get your markup that normally may look something like this:</p>
<pre class="brush: xml;">
</pre>
<link href="/Content/SiteFinal.css" rel="stylesheet" type="text/css" />
<p>
to look something like this on your production server:</p>
<pre class="brush: xml;">
</pre>
<link href="http://mycdn.net/Content/SiteFinal.css" rel="stylesheet" type="text/css" />
<p>
When you are developing using the local web server (Cassini), you don&rsquo;t want the CDN links in your code, but after you have published the page to prod, you want it to use the CDN link. One way to make this work is to make an extension helper method that creates the correct link based on if you run in dev or prod. Here is my suggestion:</p>
<pre class="brush: csharp;">
public static MvcHtmlString CDNLink(this HtmlHelper html,
string tagName,
string contentTag,
string contentUrl,
object htmlAttributes)
{
var contentLink = new TagBuilder(tagName);
var contentServerUrl = ConfigurationManager.AppSettings[&quot;ContentServerUrl&quot;];
contentServerUrl = string.IsNullOrEmpty(contentServerUrl) ? &quot;{0}&quot; : contentServerUrl;
contentLink.MergeAttribute(contentTag, string.Format(contentServerUrl, contentUrl));
contentLink.MergeAttributes((IDictionary<string, string="">)htmlAttributes, true);
return MvcHtmlString.Create(contentLink.ToString());
}</string,></pre>
<p>
&nbsp;</p>
<p>
It is pretty straightforward to use:</p>
<pre class="brush: xml;">
<%=html.cdnlink("link", new="" string="">
{
{&quot;rel&quot;, &quot;stylesheet&quot;},
{&quot;type&quot;,&quot;text/css&quot;}
}) %&gt;</%=html.cdnlink("link",></pre>
<p>
<%=html.cdnlink("link", new="" string=""></p>
<p>
&lt;%=html.cdnlink(&quot;link&quot;, new=&quot;&quot; string=&quot;&quot;&gt;</p>
<p>
Pass the tag name (&ldquo;link&rdquo;), the content attribute (&ldquo;href&rdquo;), the actual content link (&ldquo;file.css&rdquo;) and optional HTML attributes. In your web.config file, add an application settings for the content server url like this in dev</p>
<pre class="brush: xml;">
<appsettings>
<add key="ContentServerUrl" value="{0}">
</add></appsettings></pre>
<pre class="brush: xml;">
And in prod, use something like this:</pre>
<pre class="brush: xml;">
<appsettings>
<add key="ContentServerUrl" value="http://mycdn.net/{0}">
</add></appsettings></pre>
<p>
There you go, hope you will find it useful.</p>
<p>
&nbsp;</p>
<p></%=html.cdnlink("link",></p>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/how-to-use-cdn-links-in-your-asp-net-mvc-application-to-serve-static-content-from-a-cookieless-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>But once in a while he chokes. And then the brother actually has to pad him on the back to get it cleaned up</title>
		<link>http://insomniacgeek.com/but-once-in-a-while-he-chokes-and-then-the-brother-actually-has-to-pad-him-on-the-back-to-get-it-cleaned-up/</link>
		<comments>http://insomniacgeek.com/but-once-in-a-while-he-chokes-and-then-the-brother-actually-has-to-pad-him-on-the-back-to-get-it-cleaned-up/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 17:36:00 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[DotnetRocks]]></category>

		<guid isPermaLink="false">http://blog.insomniacgeek.com/?p=100</guid>
		<description><![CDATA[&#160; Quote of the day, on Intel i7 series of processors with 6 cores and hyperthreading: &#160; &#34;You have six with six brain damaged cousins.&#160; And sometimes you can hand a cousine: here eat this while I&#39;m doing the real work, and everything is fine. But once in a while he chokes. And then the [...]]]></description>
			<content:encoded><![CDATA[<p>
&nbsp;</p>
<div id="cke_pastebin">
Quote of the day, on Intel i7 series of processors with 6 cores and hyperthreading:</div>
<div>
&nbsp;</div>
<div id="cke_pastebin">
<em>&quot;You have six with six brain damaged cousins.&nbsp;</em></div>
<div id="cke_pastebin">
<em>And sometimes you can hand a cousine: here eat this while I&#39;m doing the real work, and everything is fine.</em></div>
<div id="cke_pastebin">
<em>But once in a while he chokes. And then the brother actually has to pad him on the back to get it cleaned up.&quot;</em></div>
<div>
&nbsp;</div>
<div id="cke_pastebin">
- <a href="http://twitter.com/richcampbell" target="_blank">Richard Campbell</a>, in <a href="http://www.dotnetrocks.com/default.aspx?showNum=582" target="_blank">DotNetRocks episode 582</a>, at about 48:44</div>
<div>
&nbsp;</div>
<div>
To get some more wisdom from Mr Campbell, listen to the excellent podcasts <a href="http://twitter.com/richcampbell" target="_blank">RunAsRadio</a> and <a href="http://www.dotnetrocks.com/" target="_blank">DotNetRocks</a>.&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/but-once-in-a-while-he-chokes-and-then-the-brother-actually-has-to-pad-him-on-the-back-to-get-it-cleaned-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install IIs 7.5 on Windows 7</title>
		<link>http://insomniacgeek.com/how-to-install-iis-7-5-on-windows-7/</link>
		<comments>http://insomniacgeek.com/how-to-install-iis-7-5-on-windows-7/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 23:56:00 +0000</pubDate>
		<dc:creator>InsomniacGeek</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[IIs]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://blog.insomniacgeek.com/?p=99</guid>
		<description><![CDATA[This post will guide you through the steps of installing the Internet Information Services v7.5 (IIs) on Windows 7. You must have administrator privileges to perform this operation. 1. Go to Control Panel &#8211;&#62; Programs and Features &#8211;&#62; Turn Windows features on or off. 2. Put a checkmark in the World Wide Web Services. This [...]]]></description>
			<content:encoded><![CDATA[<p>
This post will guide you through the steps of installing the Internet Information Services v7.5 (IIs) on Windows 7. You must have administrator privileges to perform this operation.</p>
<p>
1. Go to Control Panel &ndash;&gt; Programs and Features &ndash;&gt; Turn Windows features on or off.</p>
<p>
<a href="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_2.png"><img alt="Control Panel, Programs and Features, Turn Windows features on or off" border="0" class="wlDisabledImage" height="109" src="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_thumb.png" style="border-width: 0px; margin: 3px; display: inline;" title="Control Panel, Programs and Features, Turn Windows features on or off" width="404" /></a></p>
<p>
2. Put a checkmark in the World Wide Web Services. This will select the most common features for the web server. In my case, I also have selected the ASP.NET, and Basic and Windows Authentication features. Some features may not be available depending on which edition of Windows 7 you have. <a href="http://technet.microsoft.com/en-us/library/cc753473.aspx" target="_blank">This article will give an overview on Available Web Server (IIS) Role Services in IIS 7.5</a> for the various editions.</p>
<p>
<a href="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_6.png"><img alt="Turn Windows features on and off, select World Wide Web Services" border="0" class="wlDisabledImage" height="484" src="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_thumb_2.png" style="border-width: 0px; margin: 3px; display: inline;" title="Turn Windows features on and off, select World Wide Web Services" width="354" /></a></p>
<p>
3. Click Ok and Windows will install the selected features.</p>
<p>
<a href="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_8.png"><img alt="Windows makes changes to features." border="0" class="wlDisabledImage" height="190" src="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_thumb_3.png" style="border-width: 0px; margin: 3px; display: inline;" title="Windows makes changes to features." width="370" /></a></p>
<p>
4. Verify that the installation succeeded by browsing to <a href="http://localhost">http://localhost</a>. This should display the IIs logo.</p>
<p>
<a href="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_9.png"><img alt="Showing the IIS logo" border="0" class="wlDisabledImage" height="484" src="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_thumb_1.png" style="border-width: 0px; margin: 3px; display: inline;" title="Showing the IIS logo" width="600" /></a></p>
<p>
5. If you have done this after installation Visual Studio 2010 (and .NET Framework v4) you will only have the default .NET v2 application pools:</p>
<p>
<a href="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_11.png"><img alt=".NET Framework v2 application pools" border="0" class="wlDisabledImage" height="176" src="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_thumb_4.png" style="margin: 3px; border: 0px; display: inline;" title=".NET Framework v2 application pools" width="644" /></a></p>
<p>
so in order to get the .NET Framework v4 integration and application pools, you will have to register the .NET Framework v4 with IIS. Open an elevated command prompt change directory to <em>C:\Windows\Microsoft.NET\Framework\v4.0.30319</em></p>
<p>
and type: <em>aspnet_regiis.exe -i</em></p>
<p>
Now, the .NET Framework v4 application pools are available:</p>
<p>
<a href="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_13.png"><img alt=".NET Framework v4 application pools" border="0" class="wlDisabledImage" height="221" src="http://insomniacgeek.com/files/media/image/WindowsLiveWriter/HowtoinstallIIs7onWindows7_1223D/image_thumb_5.png" style="margin: 3px; border: 0px; display: inline;" title=".NET Framework v4 application pools" width="644" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://insomniacgeek.com/how-to-install-iis-7-5-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

