<?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/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>CodeSnack</title>
	
	<link>http://codesnack.com/blog</link>
	<description>take a byte</description>
	<lastBuildDate>Tue, 21 Feb 2012 21:06:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CodeSnack" /><feedburner:info uri="codesnack" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>CodeSnack</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Windows 8 Picture Password on domain linked machine</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/4rX-LrtvaSA/</link>
		<comments>http://codesnack.com/blog/2012/02/21/windows-8-picture-password-on-domain-linked-machine/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 21:03:46 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=318</guid>
		<description><![CDATA[If you&#8217;ve been using Windows Developer Preview on a machine linked to a domain, you may have been disappointed to find that you do not have the option to try the new Picture Password mode of authentication. This is because Microsoft &#8230; <a href="http://codesnack.com/blog/2012/02/21/windows-8-picture-password-on-domain-linked-machine/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://codesnack.com/blog/2011/09/14/win8experience/' rel='bookmark' title='BUILD Keynote Day 1 &#8211; Windows 8 Experience'>BUILD Keynote Day 1 &#8211; Windows 8 Experience</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been using Windows Developer Preview on a machine linked to a domain, you may have been disappointed to find that you do not have the option to try the new Picture Password mode of authentication. This is because Microsoft has disabled it in domain linked machine by default for security reasons.  If you would like to try Picture Password you will need to change some settings in the registry (at your own risk!).  Here are the changes you need to make:</p>
<p style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="font-size: x-small;">[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System]</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="font-size: x-small;">&#8220;AllowDomainPicturePassword&#8221;=dword:00000001</span></span></span></p>
<p style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="font-size: x-small;">&#8220;AllowDomainPINLogon&#8221;=dword:00000001</span></span></span></p>
<p style="margin: 0in 0in 0pt;">
<p style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="font-family: Helvetica;">If you don&#8217;t know how to make this change, it might be a good idea to skip this tip!</span></span></span></p>
<p>Related posts:</p><ol>
<li><a href='http://codesnack.com/blog/2011/09/14/win8experience/' rel='bookmark' title='BUILD Keynote Day 1 &#8211; Windows 8 Experience'>BUILD Keynote Day 1 &#8211; Windows 8 Experience</a></li>
</ol>
<p><a href="http://feedads.g.doubleclick.net/~a/aufpzOhPL_QSiQMO4d-1Nfb4shM/0/da"><img src="http://feedads.g.doubleclick.net/~a/aufpzOhPL_QSiQMO4d-1Nfb4shM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/aufpzOhPL_QSiQMO4d-1Nfb4shM/1/da"><img src="http://feedads.g.doubleclick.net/~a/aufpzOhPL_QSiQMO4d-1Nfb4shM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2012/02/21/windows-8-picture-password-on-domain-linked-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://codesnack.com/blog/2012/02/21/windows-8-picture-password-on-domain-linked-machine/</feedburner:origLink></item>
		<item>
		<title>Visual Studio Async CTP (Version 3) Installation Issues</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/HoMMDR1Q8Rg/</link>
		<comments>http://codesnack.com/blog/2012/02/16/visual-studio-async-ctp-version-3-installation-issues/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 18:50:17 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=311</guid>
		<description><![CDATA[If you&#8217;ve been trying to install Visual Studio Async CTP (Version 3) and are having installation issues, I&#8217;ve got a potential fix for you.  Chances are you have the following hotfixes applied: KB2615527, KB2635973, KB2549864.  Uninstall these hot-fixes and you should be &#8230; <a href="http://codesnack.com/blog/2012/02/16/visual-studio-async-ctp-version-3-installation-issues/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://codesnack.com/blog/2011/09/28/fix-for-expression-blend-4-crashing-on-startup/' rel='bookmark' title='Fix for Expression Blend 4 crashing on startup'>Fix for Expression Blend 4 crashing on startup</a></li>
<li><a href='http://codesnack.com/blog/2009/05/22/visual-studio-2008-sp1-hotfixes-for-wpf/' rel='bookmark' title='Visual Studio 2008 SP1 hotfixes for WPF'>Visual Studio 2008 SP1 hotfixes for WPF</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been trying to install <a title="VS Async CTP (Version 3)" href="http://msdn.microsoft.com/en-us/vstudio/gg316360" target="_blank">Visual Studio Async CTP (Version 3)</a> and are having installation issues, I&#8217;ve got a potential fix for you.  Chances are you have the following hotfixes applied: KB2615527, KB2635973, KB2549864.  Uninstall these hot-fixes and you should be good to go.  Hope this helps!</p>
<p>Related posts:</p><ol>
<li><a href='http://codesnack.com/blog/2011/09/28/fix-for-expression-blend-4-crashing-on-startup/' rel='bookmark' title='Fix for Expression Blend 4 crashing on startup'>Fix for Expression Blend 4 crashing on startup</a></li>
<li><a href='http://codesnack.com/blog/2009/05/22/visual-studio-2008-sp1-hotfixes-for-wpf/' rel='bookmark' title='Visual Studio 2008 SP1 hotfixes for WPF'>Visual Studio 2008 SP1 hotfixes for WPF</a></li>
</ol>
<p><a href="http://feedads.g.doubleclick.net/~a/BADM5qVrHgyfqryrr7a0LxxOjs4/0/da"><img src="http://feedads.g.doubleclick.net/~a/BADM5qVrHgyfqryrr7a0LxxOjs4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/BADM5qVrHgyfqryrr7a0LxxOjs4/1/da"><img src="http://feedads.g.doubleclick.net/~a/BADM5qVrHgyfqryrr7a0LxxOjs4/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2012/02/16/visual-studio-async-ctp-version-3-installation-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://codesnack.com/blog/2012/02/16/visual-studio-async-ctp-version-3-installation-issues/</feedburner:origLink></item>
		<item>
		<title>Metro Snack #2: What is WinRT?</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/SramphJTopA/</link>
		<comments>http://codesnack.com/blog/2012/01/30/metro-snack-2-what-is-winrt/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 19:28:24 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[Metro]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=297</guid>
		<description><![CDATA[It doesn&#8217;t seem like a great idea to go into a series of posts talking about Metro-style apps without briefly defining the core components that they are built on. &#160;The most fundamental piece of the puzzle for these apps is &#8230; <a href="http://codesnack.com/blog/2012/01/30/metro-snack-2-what-is-winrt/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://codesnack.com/blog/2012/01/16/metrosnack-xaml-or-html5/' rel='bookmark' title='Metro Snack #1: Choosing XAML or HTML5 for Windows Developer Preview apps'>Metro Snack #1: Choosing XAML or HTML5 for Windows Developer Preview apps</a></li>
<li><a href='http://codesnack.com/blog/2012/01/05/metro-webview-source-workarounds/' rel='bookmark' title='Metro WebView Source and HTML workarounds'>Metro WebView Source and HTML workarounds</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<link rel="image_src" href="http://codesnack.com/blog/wp-content/uploads/2012/01/what_is_winrt.png"/><img class="alignnone size-full wp-image-298" title="What is WinRT?" src="http://codesnack.com/blog/wp-content/uploads/2012/01/what_is_winrt.png" alt="What is WinRT?" width="575" height="75" />
<p>It doesn&#8217;t seem like a great idea to go into a series of posts talking about Metro-style apps without briefly defining the core components that they are built on. &nbsp;The most fundamental piece of the puzzle for these apps is Windows Runtime, or WinRT for short. &nbsp;WinRT is probably best described as an unmanaged, native API that can be leveraged from many different languages via a mechanism called language projection. &nbsp;Read more to find out some more details about how WinRT works.</p>
<p><span id="more-297"></span></p>
<h2>How does this thing work? (in a nutshell)</h2>
<h3>Metadata</h3>
<p>Since WinRT is designed to be a native API, it can&#8217;t contain metadata directly in its code. &nbsp;To get around this limitation, WinRT stores its metadata&nbsp;in .winmd files that are encoded using the <a title="ECMA 335" href="http://www.ecma-international.org/publications/standards/Ecma-335.htm">ECMA 335&nbsp;metadata format (CLI)</a>. &nbsp;You might recognize this strategy if you&#8217;re a .NET developer since this is what .NET does. &nbsp;This enables things like reflection to be possible in WinRT.</p>
<h3>object-oriented type system</h3>
<p>Built on the metadata system is an object-oriented type system. &nbsp;In this type system can be found a lot of things that could be found in the .NET framework. &nbsp;There are also some new additions. &nbsp;I won&#8217;t go into details of what is or isn&#8217;t in the WinRT APIs in this post as a) there are a lot and b) I&#8217;ll be going into a lot of them in more detail as the series progresses.</p>
<h3>Components</h3>
<p>Any class that is built to target WinRT is called a WinRT component. &nbsp;Any WinRT supported language can be used to write a WinRT component. &nbsp;Since it is built upon the metadata structure, a WinRT component written in one language can be easily used from another language.</p>
<h2>What languages are supported?</h2>
<p>Currently, the languages that are supported are C++(WRL and C++/CX), C#, VB.NET and JavaScript. &nbsp;Technically, any .NET language can be used for WinRT development but only C# and VB.NET are supported for now. &nbsp;Language projections can be created to expose the WinRT API to other languages in the future.</p>
<h2>Give it a try</h2>
<p>If you haven&#8217;t tried it out yet, head over to the <a title="Windows Dev Center" href="http://msdn.microsoft.com/en-us/windows" target="_blank">Windows Dev Center</a>&nbsp;and download the Windows 8 Developer Preview. &nbsp;Then, get started with <a title="Metro style app development" href="http://msdn.microsoft.com/en-us/windows/apps/" target="_blank">Metro style app development</a>. You&#8217;ll need to choose whether to use XAML or HTML5 to build it. &nbsp;<a title="Metro Snack #1: Choosing XAML or HTML5 for Windows Developer Preview apps" href="http://codesnack.com/blog/2012/01/16/metrosnack-xaml-or-html5/" target="_blank">I&#8217;ve got some tips to help you decide.</a></p>
<p>Related posts:</p><ol>
<li><a href='http://codesnack.com/blog/2012/01/16/metrosnack-xaml-or-html5/' rel='bookmark' title='Metro Snack #1: Choosing XAML or HTML5 for Windows Developer Preview apps'>Metro Snack #1: Choosing XAML or HTML5 for Windows Developer Preview apps</a></li>
<li><a href='http://codesnack.com/blog/2012/01/05/metro-webview-source-workarounds/' rel='bookmark' title='Metro WebView Source and HTML workarounds'>Metro WebView Source and HTML workarounds</a></li>
</ol>
<p><a href="http://feedads.g.doubleclick.net/~a/cORH-rk71IOVUJYkAXLHHFo_vAA/0/da"><img src="http://feedads.g.doubleclick.net/~a/cORH-rk71IOVUJYkAXLHHFo_vAA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/cORH-rk71IOVUJYkAXLHHFo_vAA/1/da"><img src="http://feedads.g.doubleclick.net/~a/cORH-rk71IOVUJYkAXLHHFo_vAA/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2012/01/30/metro-snack-2-what-is-winrt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2012/01/what_is_winrt-150x75.png" />
		<media:content url="http://codesnack.com/blog/wp-content/uploads/2012/01/what_is_winrt.png" medium="image">
			<media:title type="html">What is WinRT?</media:title>
			<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2012/01/what_is_winrt-150x75.png" />
		</media:content>
	<feedburner:origLink>http://codesnack.com/blog/2012/01/30/metro-snack-2-what-is-winrt/</feedburner:origLink></item>
		<item>
		<title>Join the fight against SOPA and PIPA</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/Qzhacvm_1nE/</link>
		<comments>http://codesnack.com/blog/2012/01/18/join-the-fight-against-sopa-and-pipa/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 15:11:19 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[SOPA]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=283</guid>
		<description><![CDATA[Today is Stop SOPA Day and websites across the Internet are shutting down for the day and replacing their content with information regarding SOPA. Head over to Google or Reddit and join the cause. If you were hoping to look &#8230; <a href="http://codesnack.com/blog/2012/01/18/join-the-fight-against-sopa-and-pipa/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Today is Stop SOPA Day and websites across the Internet are shutting down for the day and replacing their content with information regarding SOPA. Head over to <a title="Google" href="http://google.com">Google </a>or <a title="Reddit" href="http://reddit.com">Reddit </a>and join the cause. If you were hoping to look up information on <a title="Wikipedia" href="http://en.wikipedia.org/wiki/Main_Page">Wikipedia</a> or buy something on <a title="Craigslist" href="http://craigslist.org">Craigslist</a> you&#8217;ll be out of luck today.</p>
<p>SOPA and PIPA are very dangerous laws that inherently break the way the Internet works. Please join the cause by <a title="Google's Petition" href="https://www.google.com/landing/takeaction/">signing the petition</a> or calling your Congressmen.</p>
<p>No related posts.</p>
<p><a href="http://feedads.g.doubleclick.net/~a/wkOq3oivZkRW2S24oIvtd4YZ5cc/0/da"><img src="http://feedads.g.doubleclick.net/~a/wkOq3oivZkRW2S24oIvtd4YZ5cc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/wkOq3oivZkRW2S24oIvtd4YZ5cc/1/da"><img src="http://feedads.g.doubleclick.net/~a/wkOq3oivZkRW2S24oIvtd4YZ5cc/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2012/01/18/join-the-fight-against-sopa-and-pipa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://codesnack.com/blog/2012/01/18/join-the-fight-against-sopa-and-pipa/</feedburner:origLink></item>
		<item>
		<title>Metro Snack #1: Choosing XAML or HTML5 for Windows Developer Preview apps</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/SXNC7GY6oH4/</link>
		<comments>http://codesnack.com/blog/2012/01/16/metrosnack-xaml-or-html5/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 16:05:29 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[Expression Blend]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Metro]]></category>
		<category><![CDATA[Snacks]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[metro]]></category>
		<category><![CDATA[winrt]]></category>
		<category><![CDATA[xaml]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=269</guid>
		<description><![CDATA[Windows 8 Metro Style app development starts with choosing a user interface technology path. Developers will need to choose whether they will create their user interface using XAML or HTML5. Choosing XAML means that the business logic for the application &#8230; <a href="http://codesnack.com/blog/2012/01/16/metrosnack-xaml-or-html5/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://codesnack.com/blog/2012/01/05/metro-webview-source-workarounds/' rel='bookmark' title='Metro WebView Source and HTML workarounds'>Metro WebView Source and HTML workarounds</a></li>
<li><a href='http://codesnack.com/blog/2011/09/12/html5journey/' rel='bookmark' title='HTML5+CSS3+jQuery: Learn with me'>HTML5+CSS3+jQuery: Learn with me</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img title="XAML or HTML5?" src="http://codesnack.com/blog/wp-content/uploads/2012/01/xamlorhtml51.png" alt="XAML or HTML5?" width="575" height="75" />Windows 8 Metro Style app development starts with choosing a user interface technology path. Developers will need to choose whether they will create their user interface using XAML or HTML5. Choosing XAML means that the business logic for the application can be implemented using C++, C#, or VB. HTML5 apps will mainly use JavaScript for this purpose (note: it is possible to call into C++/C#/VB code in an HTML5 app).</p>
<h2>Which should you choose?</h2>
<p><span id="more-269"></span></p>
<p>XAML and HTML5 applications in Windows 8 both use WinRT as a foundation and by virtue of this offer an almost identical set of features to the developer. However, if you are developing your Windows 8 user interface during the Developer Preview there are some important things to consider. Ultimately, the decision is yours and you should choose what you are comfortable with given the current limitations. The point of this post is to help you make an informed decision given what we have available to us now.</p>
<h3>Language Familiarity</h3>
<p>This one seems fairly obvious but there&#8217;s going to be a learning curve if you currently do not know XAML or HTML5. This is mitigated somewhat by the fact that you are going to be learning a lot of new things (WinRT, Windows 8 Metro Style App flow, etc.). I would treat language familiarity as a starting point for your decision if your application is fairly simple in nature. However, if you are building a new app that does not leverage an existing codebase I would strongly consider basing this decision based on all of the factors described in this post.</p>
<h3>Excellent Expression Blend Support for HTML5 Apps</h3>
<p>The version of Expression Blend that is included with the Developer Preview has wonderful support for creating Metro apps using HTML5. As you build your user interface, the changes will be reflected immediately using a live DOM. There is also an interactive mode that will allow you to test your application without even running it. The CSS editing features in Blend are also top-notch. From a UI design perspective, this makes HTML5 Metro development very attractive.</p>
<h3>No Expression Blend Support for XAML Apps</h3>
<p>While the Expression Blend support for HTML5 apps is fantastic, it is nonexistent for XAML. The Blend team spent a lot of time making this version of Blend work with HTML5 but unfortunately it appears that did not leave enough time for XAML support. XAML developers/designers that want to use Blend to create animations, brushes, etc. will have to use Blend 4 until this support is added.</p>
<h3>Visual Studio Designer for XAML has major bugs</h3>
<p>For me, this has been the biggest reason to potentially avoid XAML during the developer preview. I am not sure exactly what causes it, but every project I have attempted to work on so far has gotten into a state where the Visual Studio Designer will no longer load my XAML files. This is a fairly significant problem since there is no Expression Blend support for Metro apps using XAML in the Developer Preview. This leaves designers and developers with very limited tooling support for the UI. For a platform with a strong focus on design, this is not an ideal situation to be in.</p>
<h2>My personal conclusion</h2>
<p>The conclusion I&#8217;ve reached at this point is that learning HTML5 and WinJS is probably a good investment. The tooling story for XAML Metro apps right now is somewhat frustrating and leads to more headaches than seem necessary at this point. I am much more familiar with XAML-based user interface coding than HTML-based so this is a difficult pill for me to swallow. I am hopeful that the beta in February will bridge a lot of these gaps but, just in case, I&#8217;ve decided that any applications I develop during the Developer Preview will be developed using HTML5.</p>
<p>Related posts:</p><ol>
<li><a href='http://codesnack.com/blog/2012/01/05/metro-webview-source-workarounds/' rel='bookmark' title='Metro WebView Source and HTML workarounds'>Metro WebView Source and HTML workarounds</a></li>
<li><a href='http://codesnack.com/blog/2011/09/12/html5journey/' rel='bookmark' title='HTML5+CSS3+jQuery: Learn with me'>HTML5+CSS3+jQuery: Learn with me</a></li>
</ol>
<p><a href="http://feedads.g.doubleclick.net/~a/JDZSf_MzmmKIgmZOHUzSzKRV6k8/0/da"><img src="http://feedads.g.doubleclick.net/~a/JDZSf_MzmmKIgmZOHUzSzKRV6k8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/JDZSf_MzmmKIgmZOHUzSzKRV6k8/1/da"><img src="http://feedads.g.doubleclick.net/~a/JDZSf_MzmmKIgmZOHUzSzKRV6k8/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2012/01/16/metrosnack-xaml-or-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2012/01/xamlorhtml51.png" />
		<media:content url="http://codesnack.com/blog/wp-content/uploads/2012/01/xamlorhtml51.png" medium="image">
			<media:title type="html">XAML or HTML5?</media:title>
		</media:content>
	<feedburner:origLink>http://codesnack.com/blog/2012/01/16/metrosnack-xaml-or-html5/</feedburner:origLink></item>
		<item>
		<title>Metro WebView Source and HTML workarounds</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/fpWuNq0raBE/</link>
		<comments>http://codesnack.com/blog/2012/01/05/metro-webview-source-workarounds/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 20:15:46 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[Metro]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[metro]]></category>
		<category><![CDATA[webview]]></category>
		<category><![CDATA[win8]]></category>
		<category><![CDATA[windows 8]]></category>
		<category><![CDATA[winrt]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=234</guid>
		<description><![CDATA[In the process of writing my first Windows 8 Metro style app using C# and XAML, I came across some limitations of the current WebView control&#8217;s implementation.  The flow for the feature I was working on is fairly simple: Content &#8230; <a href="http://codesnack.com/blog/2012/01/05/metro-webview-source-workarounds/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://codesnack.com/blog/wp-content/uploads/2012/01/WebView1.png"><img class="alignnone size-full wp-image-259" title="WebView Workaround" src="http://codesnack.com/blog/wp-content/uploads/2012/01/WebView1.png" alt="WebView Workarounds" width="600" height="58" /></a></p>
<p>In the process of writing my first Windows 8 Metro style app using C# and XAML, I came across some limitations of the current WebView control&#8217;s implementation.  The flow for the feature I was working on is fairly simple:</p>
<ol>
<li>Content for a webpage is displayed in a <a title="WebView" href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.aspx" target="_blank">WebView </a>(using the WebView&#8217;s <a title="WebView.Source" href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.source.aspx" target="_blank">Source </a>property).</li>
<li>User browses the page until they find something they want to save.</li>
<li>User clicks a save button and the app parses the information into a readable format for saving in the app&#8217;s storage.</li>
</ol>
<p>This is a pretty straightforward concept and I thought the implementation would be just as intuitive. Judging by the similarity of the WebView control to the Silverlight <a title="WebBrowser" href="http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser(v=vs.95).aspx" target="_blank">WebBrowser </a>control, I went about implementing this functionality as I would have for Silverlight.  I set the WebView&#8217;s Source property to the initial Uri where I wanted the browsing to begin.  I wired up a test button that I thought would kick off the parsing process.  That&#8217;s when I started to run into problems.</p>
<p><span id="more-234"></span></p>
<h2>The first problem &#8211; No SaveToString()</h2>
<p>My initial attempt at the parser was based on the premise that I would have direct access to the HTML that was being rendered in the WebView control.  Initially, I thought the WebView would support something similar to <a title="WebBrowser.SaveToString()" href="http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.savetostring(v=VS.95).aspx" target="_blank">WebBrowser&#8217;s SaveToString()</a> method which returns the HTML being displayed currently as a string.  It doesn&#8217;t.</p>
<h2>The second problem &#8211; Source doesn&#8217;t update</h2>
<p>Since I didn&#8217;t have direct access to the HTML directly, my next attempt was going to be to pass the Uri for the content that&#8217;s currently being displayed.  Again, in the Silverlight WebBrowser control this would be as simple as using the Source property which updates as the user browses inside the WebBrowser control.  Unfortunately, the Metro WebView&#8217;s Source property does not update as the user browses and instead locks itself to whatever it was initially set to.  Stymied again.</p>
<h2>Workaround #1 &#8211; Retrieving the HTML using InvokeScript</h2>
<p>Thankfully, the WebView does support a handy method called InvokeScript which allows you to run a script on the page that is being displayed.  Combining that with the JavaScript eval function, we can call arbitrary JavaScript code on the content.  This JavaScript snippet will allow us to get the HTML that&#8217;s being rendered:</p>
<pre class="brush: javascript; gutter: true">document.documentElement.outerHTML;</pre>
<p>All we need to do is call that script on the page using InvokeScript() and it will return the HTML in a string:</p>
<pre class="brush: csharp; gutter: true">string html = webview.InvokeScript(&quot;eval&quot;, new string[] {&quot;document.documentElement.outerHTML;&quot;});
Parse(html);</pre>
<h2>Workaround #2 &#8211; Keeping track of the Source</h2>
<p>I still needed to solve the second problem because the image links in the HTML were relative.  I still needed access to the Source Uri.  It turns out there&#8217;s a slightly non-intuitive way to keep track of this by wiring up the WebView&#8217;s <a title="LoadCompleted" href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.loadcompleted.aspx" target="_blank">LoadCompleted event</a> which fires when top-level navigation completes and the content loads into the <a title="WebView" href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.aspx" target="_blank">WebView </a>control.  The <a title="LoadCompleted NavigationEventArgs" href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.navigation.navigationeventargs.aspx" target="_blank">NavigationEventArgs</a> in the LoadCompleted event handler contains a Uri property which represents the Uri that was just loaded in the WebView.  The following snippet will fetch the Uri:</p>
<pre class="brush: csharp; gutter: true">Uri source = null;

webview.LoadCompleted += (s,e) =&gt; {
     source = e.Uri;
}</pre>
<h2>Conclusion</h2>
<p>We are still in the very early days of Windows 8 Metro style app development and there are a lot of rough edges in the SDK and documentation (more in the XAML side than the HTML5 side but more on that later&#8230;).  Some things will simply not work the way we expect them to and we will have to adapt and work around them until they are hopefully fixed in future releases.</p>
<p>No related posts.</p>
<p><a href="http://feedads.g.doubleclick.net/~a/0WTkM04dsCgEhDBzaUU87Z1QBqE/0/da"><img src="http://feedads.g.doubleclick.net/~a/0WTkM04dsCgEhDBzaUU87Z1QBqE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/0WTkM04dsCgEhDBzaUU87Z1QBqE/1/da"><img src="http://feedads.g.doubleclick.net/~a/0WTkM04dsCgEhDBzaUU87Z1QBqE/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2012/01/05/metro-webview-source-workarounds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2012/01/WebView1-150x58.png" />
		<media:content url="http://codesnack.com/blog/wp-content/uploads/2012/01/WebView1.png" medium="image">
			<media:title type="html">WebView Workaround</media:title>
			<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2012/01/WebView1-150x58.png" />
		</media:content>
	<feedburner:origLink>http://codesnack.com/blog/2012/01/05/metro-webview-source-workarounds/</feedburner:origLink></item>
		<item>
		<title>Designing APIs for the 80% case</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/uN-jonZB4L0/</link>
		<comments>http://codesnack.com/blog/2011/12/22/making-apis-is-hard/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 18:51:28 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Infragistics]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=217</guid>
		<description><![CDATA[I just read a blog post by James Padolsey (Making APIs is hard).  He makes a comment that is at the core of how we design APIs in my day job. From the post: I am sitting here thinking about &#8230; <a href="http://codesnack.com/blog/2011/12/22/making-apis-is-hard/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>I just read a blog post by James Padolsey (<a href="http://james.padolsey.com/general/making-apis-is-hard/">Making APIs is hard</a>).  He makes a comment that is at the core of how we design APIs in my day job.</p>
<p>From the post:</p>
<blockquote><p>I am sitting here thinking about that end-user-programmer-guy. I guess this holy API should seek to provide exactly what this guy wants. The trick is knowing what he wants.</p></blockquote>
<p>While I don&#8217;t agree with the entire blog post (in particular, there&#8217;s way more to API design than just naming), I do believe James has partially nailed the essence of what makes API design difficult.</p>
<p>At <a href="http://www.infragistics.com"target="_blank"rel="external"title="Infragistics" >Infragistics</a>, we have a design tenet that states we will optimize for the 80% case while still remaining flexible enough to accommodate the other 20%.  What this means is, in 80% of the use cases for what we are designing the developer should be able to use it without consulting product guidance.  This requires a lot of research to determine what the 80% case is, but in the end the result is a product that is easy to use most of the time.</p>
<p>That&#8217;s not to say that we don&#8217;t care about the other 20%.  We just don&#8217;t design for that first. The basic idea is: the more common it is, the easier it should be.  On the flip side: the less common it is, the more difficult it can be.</p>
<p>No related posts.</p>
<p><a href="http://feedads.g.doubleclick.net/~a/IxlkUCnXivOjInfWlDunKhHQLd8/0/da"><img src="http://feedads.g.doubleclick.net/~a/IxlkUCnXivOjInfWlDunKhHQLd8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/IxlkUCnXivOjInfWlDunKhHQLd8/1/da"><img src="http://feedads.g.doubleclick.net/~a/IxlkUCnXivOjInfWlDunKhHQLd8/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2011/12/22/making-apis-is-hard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://codesnack.com/blog/2011/12/22/making-apis-is-hard/</feedburner:origLink></item>
		<item>
		<title>No Comment</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/2X5NZ29aJdc/</link>
		<comments>http://codesnack.com/blog/2011/12/15/no-comment/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 19:24:55 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[Blogging]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=211</guid>
		<description><![CDATA[Inspired in large part by Matt Gemmell&#8217;s decision to finally turn off comments, I have decided that I&#8217;m done with them too.  Frankly, I&#8217;m just tired of the spam.  Comments really don&#8217;t add much value to a blog post and &#8230; <a href="http://codesnack.com/blog/2011/12/15/no-comment/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Inspired in large part by <a title="Comments Off" href="http://mattgemmell.com/2011/11/29/comments-off/" target="_blank">Matt Gemmell&#8217;s decision to finally turn off comments</a>, I have decided that I&#8217;m done with them too.  Frankly, I&#8217;m just tired of the spam.  Comments really don&#8217;t add much value to a blog post and there will always be ways to provide feedback to me on anything I write.</p>
<p>So, if you have something productive to add to the conversation, tweet at me (<a title="Brent Schooley's Twitter Timeline" href="http://www.twitter.com/brentschooley" target="_blank">@brentschooley</a>) or find me on any of the social networks listed at the top right of this site.</p>
<p>No related posts.</p>
<p><a href="http://feedads.g.doubleclick.net/~a/u2VnB7eLpmLvp4iDg7qMQiTpH1A/0/da"><img src="http://feedads.g.doubleclick.net/~a/u2VnB7eLpmLvp4iDg7qMQiTpH1A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/u2VnB7eLpmLvp4iDg7qMQiTpH1A/1/da"><img src="http://feedads.g.doubleclick.net/~a/u2VnB7eLpmLvp4iDg7qMQiTpH1A/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2011/12/15/no-comment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://codesnack.com/blog/2011/12/15/no-comment/</feedburner:origLink></item>
		<item>
		<title>Design decisions, guided learning approach, and NetAdvantage Reporting</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/SGjmgy3Ppv0/</link>
		<comments>http://codesnack.com/blog/2011/11/16/design-decisions-guided-learning-approach-and-netadvantage-reporting/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 20:18:16 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[Infragistics]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=176</guid>
		<description><![CDATA[One of the products I work on at Infragistics, NetAdvantage Reporting, just launched its first version.  The team put a lot of work into making a polished product and I&#8217;m very proud of what was released.  One of the goals &#8230; <a href="http://codesnack.com/blog/2011/11/16/design-decisions-guided-learning-approach-and-netadvantage-reporting/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p><a></a>One of the products I work on at <a href="http://www.infragistics.com"target="_blank"rel="external"title="Infragistics" >Infragistics</a>, <a href="http://www.infragistics.com/dotnet/netadvantage/reporting.aspx#Overview"target="_blank"rel="external"title="NetAdvantage Reporting" >NetAdvantage Reporting</a>, just launched its first version.  The team put a lot of work into making a polished product and I&#8217;m very proud of what was released.  One of the goals of the product was to make it very easy to use.  In  the process of working towards that goal, many design decisions had to be made.  I go into detail about one of those (Guided learning) <a title="Guided Learning Approach" href="http://blogs.infragistics.com/blogs/reporting/archive/2011/11/16/design-decisions-guided-learning-approach.aspx" target="_blank">here on the Infragistics blogs</a>.</p>
<p>If you&#8217;re in the market for a new reporting tool or just feel like your current one could be better, you should definitely check out NetAdvantage Reporting.</p>
<p>No related posts.</p>
<p><a href="http://feedads.g.doubleclick.net/~a/oFEoMXPiyd0r2VnbNMSSm8Hf1tE/0/da"><img src="http://feedads.g.doubleclick.net/~a/oFEoMXPiyd0r2VnbNMSSm8Hf1tE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/oFEoMXPiyd0r2VnbNMSSm8Hf1tE/1/da"><img src="http://feedads.g.doubleclick.net/~a/oFEoMXPiyd0r2VnbNMSSm8Hf1tE/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2011/11/16/design-decisions-guided-learning-approach-and-netadvantage-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://codesnack.com/blog/2011/11/16/design-decisions-guided-learning-approach-and-netadvantage-reporting/</feedburner:origLink></item>
		<item>
		<title>It pays to be persistent with Siri</title>
		<link>http://feedproxy.google.com/~r/CodeSnack/~3/v7TvUcN5XI4/</link>
		<comments>http://codesnack.com/blog/2011/10/14/it-pays-to-be-persistent-with-siri/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 21:39:25 +0000</pubDate>
		<dc:creator>Brent Schooley</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://codesnack.com/blog/?p=165</guid>
		<description><![CDATA[Sometimes Siri can be stubborn but if you have a hunch that it will do something, just keep trying.  I really wanted Siri to tell me a story so I kept at it.  Eventually Siri relented me and gave me &#8230; <a href="http://codesnack.com/blog/2011/10/14/it-pays-to-be-persistent-with-siri/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Sometimes Siri can be stubborn but if you have a hunch that it will do something, just keep trying.  I really wanted Siri to tell me a story so I kept at it.  Eventually Siri relented me and gave me a pretty good laugh in the process:</p>

<a href='http://codesnack.com/blog/2011/10/14/it-pays-to-be-persistent-with-siri/img_0224/' title='Attempt #1'><img width="150" height="150" src="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0224-150x150.png" class="attachment-thumbnail" alt="Attempt #1" title="Attempt #1" /></a>
<a href='http://codesnack.com/blog/2011/10/14/it-pays-to-be-persistent-with-siri/img_0225/' title='Attempt #2'><img width="150" height="150" src="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0225-150x150.png" class="attachment-thumbnail" alt="Attempt #2" title="Attempt #2" /></a>
<a href='http://codesnack.com/blog/2011/10/14/it-pays-to-be-persistent-with-siri/img_0226/' title='Story'><img width="150" height="150" src="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0226-150x150.png" class="attachment-thumbnail" alt="Story" title="Story" /></a>
<a href='http://codesnack.com/blog/2011/10/14/it-pays-to-be-persistent-with-siri/img_0227/' title='Story (cont.)'><img width="150" height="150" src="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0227-150x150.png" class="attachment-thumbnail" alt="Story (cont.)" title="Story (cont.)" /></a>

<p>&nbsp;</p>
<p>No related posts.</p>
<p><a href="http://feedads.g.doubleclick.net/~a/02nlRsLnmfeejbYgHtCxrbu98LM/0/da"><img src="http://feedads.g.doubleclick.net/~a/02nlRsLnmfeejbYgHtCxrbu98LM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/02nlRsLnmfeejbYgHtCxrbu98LM/1/da"><img src="http://feedads.g.doubleclick.net/~a/02nlRsLnmfeejbYgHtCxrbu98LM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://codesnack.com/blog/2011/10/14/it-pays-to-be-persistent-with-siri/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0224-150x150.png" />
		<media:content url="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0224.png" medium="image">
			<media:title type="html">Attempt #1</media:title>
			<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0224-150x150.png" />
		</media:content>
		<media:content url="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0225.png" medium="image">
			<media:title type="html">Attempt #2</media:title>
			<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0225-150x150.png" />
		</media:content>
		<media:content url="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0226.png" medium="image">
			<media:title type="html">Story</media:title>
			<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0226-150x150.png" />
		</media:content>
		<media:content url="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0227.png" medium="image">
			<media:title type="html">Story (cont.)</media:title>
			<media:thumbnail url="http://codesnack.com/blog/wp-content/uploads/2011/10/IMG_0227-150x150.png" />
		</media:content>
	<feedburner:origLink>http://codesnack.com/blog/2011/10/14/it-pays-to-be-persistent-with-siri/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: codesnack.com @ 2012-02-21 18:02:08 -->

