<?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>LA.NET [EN]</title>
	
	<link>http://blogs.msmvps.com/luisabreu</link>
	<description>Ramblings about C#, .NET and Programming</description>
	<lastBuildDate>Fri, 18 May 2012 21:14:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Laneten" /><feedburner:info uri="laneten" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Another one “bytes” the dust: my ASP.NET MVC book is out! :)</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/1RNinTzZQNk/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/05/18/another-one-bytes-the-dust-my-asp-net-mvc-book-is-out/#comments</comments>
		<pubDate>Fri, 18 May 2012 21:14:12 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/?p=1700</guid>
		<description><![CDATA[Once more, released by FCA and in Portuguese! It covers ASP.NET MVC 2, 3&#160; and 4 (this release presents the new stuff introduced by the current beta). Btw, I should also mention that if anything changes from beta to RC or RTM, you’ll be able to get the updated info from the FCA site. Hope [...]]]></description>
			<content:encoded><![CDATA[<p>Once more, <a href="http://www.fca.pt/cgi-bin/fca_main.cgi/?op=2&amp;isbn=978-972-722-742-6">released by FCA and in Portuguese</a>! It covers ASP.NET MVC 2, 3&#160; and 4 (this release presents the new stuff introduced by the current beta). Btw, I should also mention that if anything changes from beta to RC or RTM, you’ll be able to get the updated info from the <a href="http://www.fca.pt">FCA</a> site. Hope you guys like it <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Winking smile" src="http://blogs.msmvps.com/luisabreu/files/2012/05/wlEmoticon-winkingsmile.png" /></p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/WWSfucPRhqNjKZM3YVc4Zo-g7ng/0/da"><img src="http://feedads.g.doubleclick.net/~a/WWSfucPRhqNjKZM3YVc4Zo-g7ng/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/WWSfucPRhqNjKZM3YVc4Zo-g7ng/1/da"><img src="http://feedads.g.doubleclick.net/~a/WWSfucPRhqNjKZM3YVc4Zo-g7ng/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/1RNinTzZQNk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/05/18/another-one-bytes-the-dust-my-asp-net-mvc-book-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2012/05/wlEmoticon-winkingsmile.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/pOfd2K4Qr8g/wlEmoticon-winkingsmile1.png" medium="image">
			<media:title type="html">Winking smile</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/05/18/another-one-bytes-the-dust-my-asp-net-mvc-book-is-out/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/pOfd2K4Qr8g/wlEmoticon-winkingsmile1.png" length="1135" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2012/05/wlEmoticon-winkingsmile1.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Can’t renew your Metro developer license? Then this is for you!</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/La5mLqiuXQE/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/05/07/cant-renew-your-metro-developer-license-then-this-is-for-you/#comments</comments>
		<pubDate>Mon, 07 May 2012 20:04:34 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Trivia]]></category>
		<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/?p=1694</guid>
		<description><![CDATA[As you know if you read this blog, I’ve been unable to write any Metro JavaScript code for a few days because I couldn’t renew my developer license. Well, after complaining in the forums, I had the good fortunate to receive some attention from Mike Wong, who was kind enough to take this problem with [...]]]></description>
			<content:encoded><![CDATA[<p>As you <a href="http://blogs.msmvps.com/luisabreu/blog/2012/05/03/the-unbelievable-metro-dev-lic-renewing-problem/">know</a> if you read this blog, I’ve been unable to write any Metro JavaScript code for a few days because I couldn’t renew my developer license. Well, after <a href="http://social.msdn.microsoft.com/Forums/en-US/toolsforwinapps/thread/6648c763-8cfb-48d3-aad8-2eb3862cc21e">complaining</a> in the forums, I had the good fortunate to receive some attention from <a href="http://social.msdn.microsoft.com/profile/mike%20wong/?ws=usercard-mini">Mike Wong</a>, who was kind enough to take this problem with the developer team. I must say that I wasn’t pleased with the initial solution and that I really unleashed all my rage on pour Mike. Fortunately, he redirected it to the team and come back with a solution which *doesn’t* involve reinstalling windows (this is really important to me because all my machines are only running Windows 8). So, here is what you need to do if you face the dreaded Metro license renew error:</p>
<ol>
<li>Remove all the Metro apps&#160; you’ve installed which were built with your license. This typically means uninstalling all the apps you’ve opened in VS and hit F5 or CTRL+F5;</li>
<li>Wait two days. I know it looks like a joke, but I’m serious: you need to wait for two days;</li>
<li>After the those 2 days wait, you’re ready to rock-n-roll: it’s renewal time!</li>
</ol>
<p>And that it’s. After the weekend, I was finally able to renew my license. Once again, special thanks to Mike Wong! Now, it’s time to code <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Smile" src="http://blogs.msmvps.com/luisabreu/files/2012/05/wlEmoticon-smile.png" /></p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/LDQoOYqzu7E4xvbg4TAmoCnJiDo/0/da"><img src="http://feedads.g.doubleclick.net/~a/LDQoOYqzu7E4xvbg4TAmoCnJiDo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/LDQoOYqzu7E4xvbg4TAmoCnJiDo/1/da"><img src="http://feedads.g.doubleclick.net/~a/LDQoOYqzu7E4xvbg4TAmoCnJiDo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/La5mLqiuXQE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/05/07/cant-renew-your-metro-developer-license-then-this-is-for-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2012/05/wlEmoticon-smile.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/oGWidSgvNiE/wlEmoticon-smile1.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/05/07/cant-renew-your-metro-developer-license-then-this-is-for-you/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/oGWidSgvNiE/wlEmoticon-smile1.png" length="1046" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2012/05/wlEmoticon-smile1.png</feedburner:origEnclosureLink></item>
		<item>
		<title>The unbelievable Metro dev lic renewing problem!</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/gu2C5RXg0dc/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/05/03/the-unbelievable-metro-dev-lic-renewing-problem/#comments</comments>
		<pubDate>Thu, 03 May 2012 09:31:15 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Trivia]]></category>
		<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/?p=1691</guid>
		<description><![CDATA[This is simply unbelievable! As an early “Win 8 dev adopter”, I’m really stumped with the error I’m getting for the last couple of days. Being an early adopter means getting all sort of problems and being subject to changes which breaks everything you’ve written with the previous release. Sometimes, it’s not fun, but I [...]]]></description>
			<content:encoded><![CDATA[<p>This is simply unbelievable! As an early “Win 8 dev adopter”, I’m really stumped with the error I’m getting for the last couple of days. Being an early adopter means getting all sort of problems and being subject to changes which breaks everything you’ve written with the previous release. Sometimes, it’s not fun, but I can live with that.</p>
<p><strong>What I can’t really understand is why I’m unable to deploy any app since Tuesday because my initial license is no longer valid and I’m always getting an error while trying to renew it</strong>. In order words, even though I want to write Metro code and provide feedback and ask questions in the forums, I’m simply unable to do (for 2 days now!) that because I can’t renew my license. This is not the way to bring more people to the platform! Want to use a lic system? Fine, but make sure that it works!!!</p>
<p>Did I mentioned that I’m pissed??</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/0sDiyTnXny1uE7Ilrdq5uoKKA1s/0/da"><img src="http://feedads.g.doubleclick.net/~a/0sDiyTnXny1uE7Ilrdq5uoKKA1s/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/0sDiyTnXny1uE7Ilrdq5uoKKA1s/1/da"><img src="http://feedads.g.doubleclick.net/~a/0sDiyTnXny1uE7Ilrdq5uoKKA1s/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/gu2C5RXg0dc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/05/03/the-unbelievable-metro-dev-lic-renewing-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/05/03/the-unbelievable-metro-dev-lic-renewing-problem/</feedburner:origLink></item>
		<item>
		<title>HTML5, 2nd edition is out</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/dcyJmUAnngg/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/04/19/html5-2nd-edition-is-out/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 09:13:47 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/?p=1689</guid>
		<description><![CDATA[I’ve been so busy in these last months that I’ve almost missed the release of the 2nd edition of my HTML5 book. I’ve added a new chapter on SVG and I’ve also added several new sections and examples to the existing chapters which illustrate how you can combine the new features introduced by HTML5 to [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been so busy in these last months that I’ve almost missed the release of the 2nd edition of my <a href="http://www.fca.pt/cgi-bin/fca_main.cgi/?isbn=978-972-722-739-6&amp;op=2">HTML5 book</a>. I’ve added a new chapter on SVG and I’ve also added several new sections and examples to the existing chapters which illustrate how you can combine the new features introduced by HTML5 to improve your web sites. These new sections were added based on the feedback I’ve received from the 1st edition readers. I really hope these changes will help those who are interested in getting started with HTML5.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/cDFL_X5R5Mul4Y6Rq-Hz5o-Gnrs/0/da"><img src="http://feedads.g.doubleclick.net/~a/cDFL_X5R5Mul4Y6Rq-Hz5o-Gnrs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/cDFL_X5R5Mul4Y6Rq-Hz5o-Gnrs/1/da"><img src="http://feedads.g.doubleclick.net/~a/cDFL_X5R5Mul4Y6Rq-Hz5o-Gnrs/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/dcyJmUAnngg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/04/19/html5-2nd-edition-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/04/19/html5-2nd-edition-is-out/</feedburner:origLink></item>
		<item>
		<title>IIS 7.5 error  413:Request Entity Too Large</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/3nrtMTN7YYo/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/03/28/iis-7-5-error-413request-entity-too-large/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 11:20:55 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/?p=1679</guid>
		<description><![CDATA[In these last days, we’ve finished moving an existing web site to a new server which was running IIS 7.5. This site had an upload service which used streaming for allowing the upload of some interestingly sized files. We’ve already had it running without any problems in IIS 6 and 7 (though in this case, [...]]]></description>
			<content:encoded><![CDATA[<p>In these last days, we’ve finished moving an existing web site to a new server which was running IIS 7.5. This site had an upload service which used streaming for allowing the upload of some interestingly sized files. We’ve already had it running without any problems in IIS 6 and 7 (though in this case, we tested it using Windows 7), so it was a surprise to see that nobody could make an upload after the migration. The streaming service was returning the 413.Request Entity Too Large.</p>
<p>After some digging, I’ve managed to find a <a href="http://forums.iis.net/t/1169257.aspx">discussion</a> in the IIS Forums which suggested that the problem was related with the uploadReadAheadSize attribute of the <a href="http://www.iis.net/ConfigReference/system.webServer/serverRuntime">serverRuntime</a> element. And sure enough, changing its default value in the apphost config file solved this problem because we were using SSL and that means the request entity body must be preloaded (and when that happens, the SSL preload will use that value for doing its thing).</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/2_-9GGvTAd4qNJ6WjgnaGUd3_PQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/2_-9GGvTAd4qNJ6WjgnaGUd3_PQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/2_-9GGvTAd4qNJ6WjgnaGUd3_PQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/2_-9GGvTAd4qNJ6WjgnaGUd3_PQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/3nrtMTN7YYo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/03/28/iis-7-5-error-413request-entity-too-large/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/03/28/iis-7-5-error-413request-entity-too-large/</feedburner:origLink></item>
		<item>
		<title>Windows 8 adventures: contexts and ApplicationContentUriRules section</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/0jkPkMlK98g/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/03/09/windows-8-adventures-contexts-and-applicationcontenturirules-section/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 10:08:11 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/?p=1677</guid>
		<description><![CDATA[It took me some time, but I finally managed to get the concepts of local vs. web contexts. It took some time not because they’re that difficult, but because the Windows 8 Metro docs are still a mess (which is understandable, since we’re still at beta – pardon me, I mean Consumer Preview) and finding [...]]]></description>
			<content:encoded><![CDATA[<p>It took me some time, but I finally managed to get the concepts of local vs. web contexts. It took some time not because they’re that difficult, but because the Windows 8 Metro docs are still a mess (which is understandable, since we’re still at beta – pardon me, I mean Consumer Preview) and finding someone with the time to explain it to me was not really as easy as I thought it would be. Anyways, that’s past, so lets get started.</p>
<p>WinJS app’s code can only be run in one of two contexts: local or Web. The need for having two contexts is motivated by the need to run code coming from different origins. For instance, you might need to embed a map in your app to enhance the way you present data to your users. In fact, you’ll probably need to interact with that map through code. Now, currently this might mean embedding a script reference to Google or Bing maps, and that really means we’ll have code written by others being executed in our app. Another good example of running external code is advertising. Typically, this also means adding a reference to an external script</p>
<p>If all the resources would run with the same privileges, then we might get into trouble because we can’t really know what all the 3rd party libraries do and we can’t really guarantee that all of them don’t have any malicious code (I’m sorry, but that’s just life!). And that’s why we have the concept of local vs. web context. The execution context under which a resource runs is responsible for granting features and imposing restrictions. For instance, all pages running in the local context can have full access to the WinRT and to the WinJS (some of those features depend on configuring the manifest to ask them to the final user) or even make cross domain calls (through XHR), but can’t reference any external scripts nor execute code by using the “javascript:code” scheme in an URI. Now, when code runs in the web context, some of these restrictions go away (ex.: external script references are allowed), but you’ll have new ones. For instance, you won’t be able to access the WinRT and you’ll only be able to access part of the WinJS features (for a list of these limitations, please read <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465373.aspx">this</a>).</p>
<p>Now, the important question: when does a resource gets executed in the local context and when does it get executed in the web context? Generally, people say that local content (i.e., content maintained inside the app’s package) runs in the local context and all external resources run in the web context. Even though this is correct in most cases, this definition is not really accurate. In fact, the platform will resort to the http scheme of a resource’s URI to see if it should be executed in the local or in the web context. All the resources using the ms-appx, run the in the local context and everything using the http, https or ms-appx-web scheme will be run in the web context. Now, ms-appx is used by default to reference resources maintained inside the app’s package (and you won’t be seeing them often unless you’re getting stuff from an external package). We all know what http and https are used for, so there’s not much to say here. What about ms-appx-web? Well, that’s the interesting one…You can use it to make a local resource run in the web context. When will you want to do this? Well, it might be a good option when you’re building mashups. For instance, suppose you want to add a map and need to write some JS code to interact with it. Since maps are added through external references, then you can’t insert them in your top page because that page will always run in local context. In that case, you can always build another local page which references the external map and has JS code to interact with it. Then, you can add an iframe to your top page which references that auxiliary local page through the ms-appx-web scheme (instead of using the default ms-appx scheme).</p>
<p>Btw, if you’re writing code and you need to know if you’re currently running in the local or in the web context, the easiest way to perform that check is to see if the Windows object exists or not (Windows, not window, ok?)</p>
<p>Now that we know the difference between both contexts and how resources are executed in one or the other, we still need to take a look at the ApplicationContentUriRules section (if you’re using the UI manifest editor, then I’m talking about the Content URIs tab). If you look at the docs, you’ll notice that this element “specifies the boundary of an app in terms of internet domain and URLs that the system hosting the app considers part of the app”. In other words, you can use this section to grant some extra privileges to external content which is going to be loaded in the web context. If I’m not mistaken, you’ll need to add an include rule to this section for any external content that tries to access the clipboard or get geo info from the geolocation object. Notice that you still won’t be getting any access to the WinRT. You can also add exclude rules and these should be useful when you want to allow a domain to access these features, while at the same time preventing a specific URI from being able to access them (this is possible because the URI specified can use a pattern for matching).</p>
<p>And I think this should make things clearer, right? Bottom line: a resource can only run in the local or in the web context and you can use the ApplicationContentUriRules section to allow external resources to access to the clipboard and geolocation objects.</p>
<p>And that it’s for now. Stay tuned for more.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/TVW6p0lsSXonisTgB3uxWrPBh3k/0/da"><img src="http://feedads.g.doubleclick.net/~a/TVW6p0lsSXonisTgB3uxWrPBh3k/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/TVW6p0lsSXonisTgB3uxWrPBh3k/1/da"><img src="http://feedads.g.doubleclick.net/~a/TVW6p0lsSXonisTgB3uxWrPBh3k/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/0jkPkMlK98g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/03/09/windows-8-adventures-contexts-and-applicationcontenturirules-section/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/03/09/windows-8-adventures-contexts-and-applicationcontenturirules-section/</feedburner:origLink></item>
		<item>
		<title>Microsoft SQL Server 2012 Integration Services book release</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/-m9wX6F_kxI/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/03/06/microsoft-sql-server-2012-integration-services-book-release/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 09:16:27 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/?p=1675</guid>
		<description><![CDATA[Pedro Perfeito’s MS SQL Server 2012 Integration Service’s book is&#160; now available for pre-order from Packt. If you’re looking for a good reading in this area, then this is probably a book you should consider. Post Footer automatically generated by Add Post Footer Plugin for wordpress.]]></description>
			<content:encoded><![CDATA[<p><a href="http://pedrocgd.blogspot.com/">Pedro Perfeito</a>’s <a href="http://www.packtpub.com/microsoft-sql-server-2012-integration-services-expert-cookbook/book">MS SQL Server 2012 Integration Service’s</a> book is&#160; now available for pre-order from Packt. If you’re looking for a good reading in this area, then this is probably a book you should consider.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/qKWQ_wRJUMlpcfc-THJsceI0DlA/0/da"><img src="http://feedads.g.doubleclick.net/~a/qKWQ_wRJUMlpcfc-THJsceI0DlA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/qKWQ_wRJUMlpcfc-THJsceI0DlA/1/da"><img src="http://feedads.g.doubleclick.net/~a/qKWQ_wRJUMlpcfc-THJsceI0DlA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/-m9wX6F_kxI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/03/06/microsoft-sql-server-2012-integration-services-book-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/03/06/microsoft-sql-server-2012-integration-services-book-release/</feedburner:origLink></item>
		<item>
		<title>Windows 8 adventures: initialization events</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/f_MQ0gtAvT0/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/01/27/windows-8-adventures-initialization-events/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 13:30:44 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2012/01/27/windows-8-adventures-initialization-events/</guid>
		<description><![CDATA[If you’ve been doing Web development from some time now and you’ve looked at several of the Windows 8 samples, you’re probably wondering which event you should handle if you’re interested in doing work as soon as you can. The first option you have is to handle the DOMContentLoaded event. As you probably know, this [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been doing Web development from some time now and you’ve looked at several of the Windows 8 samples, you’re probably wondering which event you should handle if you’re interested in doing work as soon as you can. The first option you have is to handle the <a href="https://developer.mozilla.org/en/DOM/DOM_event_reference/DOMContentLoaded">DOMContentLoaded</a> event. As you probably know, this event will be fired when the current document has been parsed (but might not have been totally loaded – ex.: images might still being downloaded, but you can interact with all the DOM elements).</p>
<p>Since you’re writing a Windows 8 application, them you should also know that the WinJS library will handle this event. Internally, the library does some housekeeping, which lead to the generation of several WinJS custom events. Currently, you’ll end up with the following sequence of events: <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229840.aspx">loaded</a> (fired right after the DOMContentLoaded event), mainwindowactivated (similar to activated; in fact, it’s generated from the internal WinJS activated event handler), <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br212679.aspx">activated</a> (occurs after WinRT activation has occurred), <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229844.aspx">ready</a> (occurs when the application is ready and all the housekeeping has been done).</p>
<p>Since we’re talking about events, then&#160; don’t forget that you must always call the WinJS.Application.start method or you won’t get any of the WinJS events. This happens because, under the hood,&#160; WinJS queues events and it will only start processing them after you call that method.</p>
<p>And that’s it for now. Stay tuned for more.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/4N0VR4hW2QUYB3lyOh-F8m0iKpA/0/da"><img src="http://feedads.g.doubleclick.net/~a/4N0VR4hW2QUYB3lyOh-F8m0iKpA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/4N0VR4hW2QUYB3lyOh-F8m0iKpA/1/da"><img src="http://feedads.g.doubleclick.net/~a/4N0VR4hW2QUYB3lyOh-F8m0iKpA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/f_MQ0gtAvT0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/01/27/windows-8-adventures-initialization-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/01/27/windows-8-adventures-initialization-events/</feedburner:origLink></item>
		<item>
		<title>Windows 8 adventures: error handling and the async pattern</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/oTpIn4j_Ctg/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/01/20/windows-8-adventures-error-handling-and-the-async-pattern/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 10:12:33 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2012/01/20/windows-8-adventures-error-handling-and-the-async-pattern/</guid>
		<description><![CDATA[In the previous post, we’ve started looking at the async pattern in Windows 8 Metro apps developed with JavaScript. By now, you know that all async operations are wrapped in Promise objects which you can use to be notified when that operation has ended (besides other interesting things!). We’ve also seen how we can “improve” [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous <a href="http://blogs.msmvps.com/luisabreu/blog/2012/01/19/windows-8-adventures-the-async-pattern-in-javascript/">post</a>, we’ve started looking at the async pattern in Windows 8 Metro apps developed with JavaScript. By now, you know that all async operations are wrapped in Promise objects which you can use to be notified when that operation has ended (besides other interesting things!). We’ve also seen how we can “improve” the code readability associated with several async operations which are executed in chain.</p>
<p>What I didn’t mention at the time is that the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229728.aspx">then</a> method expects three parameters (all functions). Besides the success function, you can also pass two other functions which will be called, respectively, for reporting an error and for reporting progress. If you follow my <a href="http://blogs.msmvps.com/luisabreu/blog/2012/01/19/windows-8-adventures-the-async-pattern-in-javascript/">previous advice</a> and return new Promises from the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229728.aspx">then</a> method, then you can get “global” error handling by adding a final then method which defines the global method function. Here’s an improved version of the createFolderAndFile function:<br />
<pre><pre>&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;createFolderAndFile&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #66747b;&quot;&gt;
 //create new folder inside temp folder 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt; var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;tempFolder &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;ApplicationData&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;current&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;temporaryFolder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;
 tempFolder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;createFolderAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;testFolder&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;, 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt; Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;CreationCollisionOption&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;openIfExists&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) 
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;folder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt; return &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;folder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;createFileAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;testFile.txt&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) 
 }) 
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;file&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt; return &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;file&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;openAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;FileAccessMode&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;readWrite&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); 
 })
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;dataStream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt; var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;stream &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;dataStream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;getOutputStreamAt&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ffcd22;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt; var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;writer &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Streams&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;DataWriter&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;stream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt; writer&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;writeString&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;Howdy, there!&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt; return &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;writer&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;storeAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() 
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() { 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt; return &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;stream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;flushAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() 
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() {}, &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() { }); }); }) 
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;err&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #66747b;&quot;&gt;//handle error here! &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;});; 
}&lt;/span&gt;</pre></pre><br />
Notice that there’s a slight change and we’re returning the result of the storeAsync().then call so that all eventual errors can be handled in the error function passed to the last then method call. You can test this behaviour by adding throw statements in several places in the previous code and by setting a breakpoint inside that anonymous error function.</p>
<p>And that’s all for now. Stay tuned for more.
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/FifCQ_tF6ZRp3Nk-vp_iZI--cCc/0/da"><img src="http://feedads.g.doubleclick.net/~a/FifCQ_tF6ZRp3Nk-vp_iZI--cCc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/FifCQ_tF6ZRp3Nk-vp_iZI--cCc/1/da"><img src="http://feedads.g.doubleclick.net/~a/FifCQ_tF6ZRp3Nk-vp_iZI--cCc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/oTpIn4j_Ctg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/01/20/windows-8-adventures-error-handling-and-the-async-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/01/20/windows-8-adventures-error-handling-and-the-async-pattern/</feedburner:origLink></item>
		<item>
		<title>Windows 8 adventures: the async pattern in JavaScript</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/mHt43RuaCqc/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/01/19/windows-8-adventures-the-async-pattern-in-javascript/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 15:05:06 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2012/01/19/windows-8-adventures-the-async-pattern-in-javascript/</guid>
		<description><![CDATA[After a small detour into ASP.NET MVC, I’m back into my “Windows 8 application development study”. One of the things you’ll notice when writing Windows 8 Metro applications is that most APIs don’t expose any synchronous methods. If an operation takes more than 15ms to be executed, then you’ll be getting an asynchronous call. And [...]]]></description>
			<content:encoded><![CDATA[<p>After a small detour into ASP.NET MVC, I’m back into my “Windows 8 application development study”. One of the things you’ll notice when writing Windows 8 Metro applications is that most APIs don’t expose any synchronous methods. If an operation takes more than 15ms to be executed, then you’ll be getting an asynchronous call. And notice that asynchronous is not an option here! It’s simply the only way to go.</p>
<p>If you’re developing Windows 8 Metro apps with JavaScript, then it won’t be long until you meet the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211867.aspx">WinJS.Promise</a> object (which I’ll be calling Promise from now on). Most (if not all) of the asynchronous method you’ll be using end up returning a Promise. For instance, if you’re trying to create a new file, you’ll probably be using the createFileAsync method. This method returns a Promise which you can then use for being called back when that operation is performed. To illustrate this point, lets see some code which creates a new file inside a new folder. Here’s our first try:<br />
<pre><pre>&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;createFolderAndFile&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #66747b;&quot;&gt;
 //create new folder inside temp folder &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;
 var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;tempFolder &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;ApplicationData&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;current&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;temporaryFolder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;; 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt; tempFolder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;createFolderAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;testFolder&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;
 Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;CreationCollisionOption&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;openIfExists&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) 
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;folder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt; folder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;createFileAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;testFile.txt&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;)
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;file&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt; file&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;openAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;FileAccessMode&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;readWrite&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) 
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;dataStream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;
 var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;stream &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;dataStream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;getOutputStreamAt&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ffcd22;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;
 var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;writer &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Streams&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;DataWriter&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;stream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt; writer&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;writeString&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;Howdy, there!&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt; writer&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;storeAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() 
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() { 
&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #66747b;&quot;&gt; //don&#039;t do anything in callbacks &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;
 stream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;flushAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() 
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() { }, &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;err&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;r &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;; }); 
 }); 
 }); 
 }); 
 }); 
}&lt;/span&gt;</pre></pre><br />
Wow!!! I’ve written the code and I’m already lost here! Fortunately, you can improve this code by returning promises from your .then methods. By doing that, you can write code which is a little bit more linear. Here’s our initial example rewritten:<br />
<pre>&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;createFolderAndFile&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #66747b;&quot;&gt;//create new folder inside temp folder &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;tempFolder &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;ApplicationData&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;current&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;temporaryFolder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;tempFolder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;createFolderAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;testFolder&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;CreationCollisionOption&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;openIfExists&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;folder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;return &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;folder&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;createFileAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;testFile.txt&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) }) .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;file&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;return &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;file&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;openAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;FileAccessMode&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;readWrite&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); }) .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;dataStream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;) { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;stream &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;dataStream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;getOutputStreamAt&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ffcd22;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;var &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;writer &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Storage&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;Streams&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;DataWriter&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;stream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;writer&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;writeString&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #ec7600;&quot;&gt;&quot;Howdy, there!&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;return &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;writer&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;storeAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() { &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;stream&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;flushAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() .&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #f1f2f3;&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() {},&lt;/span&gt;&lt;span style=&quot;background: #22282a; color: #93c763;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a; color: teal;&quot;&gt;() {}); }); }); }&lt;/span&gt;</pre><br />
I’d say that this is better (at least, from a readability point of view). What do you think?</p>
<p>Btw, I’m almost positive that you’ve notice the empty then calls on the flishAsync method? Well, I’m still not sure why, but the thing is that “empty” call is needed in order for the bytes to be saved to the file. If you remove the .then call, you’ll end up with an empty file (no, are we talking about a bug here?? )</p>
<p>And that’s it for now. Stay tuned for more.
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/Mzm7h8PJsY8eukq-5OyDuvToYd0/0/da"><img src="http://feedads.g.doubleclick.net/~a/Mzm7h8PJsY8eukq-5OyDuvToYd0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Mzm7h8PJsY8eukq-5OyDuvToYd0/1/da"><img src="http://feedads.g.doubleclick.net/~a/Mzm7h8PJsY8eukq-5OyDuvToYd0/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/mHt43RuaCqc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/01/19/windows-8-adventures-the-async-pattern-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/01/19/windows-8-adventures-the-async-pattern-in-javascript/</feedburner:origLink></item>
		<item>
		<title>Windows 8 adventures: getting to know context menus</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/iMhIxs3HX5A/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/01/12/windows-8-adventures-getting-to-know-contexto-menus/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 12:37:03 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2012/01/12/windows-8-adventures-getting-to-know-contexto-menus/</guid>
		<description><![CDATA[In the previous post, I’ve talked about the new Flyout control. Today, we’ll take a quick look at the context menu. In practice, you’ll show a context menu when you need to show a menu which gives the user immediate access to actions on text or UI objects. By default, there are predefined context menus [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous <a href="http://blogs.msmvps.com/luisabreu/blog/2012/01/11/windows-8-adventures-using-the-flyout-control/">post</a>, I’ve talked about the new Flyout control. Today, we’ll take a quick look at the context menu. In practice, you’ll show a context menu when you need to show a menu which gives the user immediate access to actions on text or UI objects.</p>
<p>By default, there are predefined context menus for text and hyperlinks. For text, the default context menu ends up showing the traditional cut, copy and paste commands. For hyperlinks, you end up with commands which allow you to copy the link or to open the link in a new window. For instance, suppose you’ve got a textarea in your default landing page:</p>
<p>  <pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;p&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;textarea &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;rows=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;4&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;cols=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;50&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;textarea&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;p&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;/span&gt;</pre></pre></p>
<p>After writing texto and right clicking over any text selection, you’ll end up with the following default context menu:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu.png"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 7px;border-left: 0px;padding-right: 0px" border="0" alt="contextmenu" src="http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu_thumb.png" width="264" height="189" /></a></p>
<p>Now, it’s important to notice that the options shown may vary. For instance, if the text is read only, you’ll only see the copy option. To illustrate this option, lets add a new paragraph to our landing page:</p>
<p><pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;p &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;paragraph1&amp;quot;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;data-win-selectable=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;Some demo text just for testing purposes...
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;p&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;/span&gt;</pre></pre></p>
<p>Now, you’ve probably noticed the use of the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh440973.aspx">data-win-selectable</a> attribute. You need to resort to this attribute when you want to make p’s content selectable. The next image shows the results:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu2.png"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 7px;border-left: 0px;padding-right: 0px" border="0" alt="contextmenu2" src="http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu2_thumb.png" width="244" height="105" /></a>&#160;</p>
<p>If you’ve been paying attention to the HTML evolution, then you know that the HTML5 spec introduces the <a href="http://msdn.microsoft.com/en-us/library/ms537837(v=vs.85).aspx">contenteditable</a> attribute which can be used to make the content of an element editable. Even though the docs say that setting this attribute to true is enough for making the element selectable (and it is!), there’s a bug in the current preview release associated with the context menu: whenever you apply the contenteditable attribute to an element, you can select text, but right clicking over that selection will not show you the context menu. Since we’re talking about bugs, it’s also important to notice that right clicking over selected text will also end up showing the appbar (if there’s one). I expect to see both these problems solved until we get a final release.</p>
<p>Now that we’ve already discussed some of the basics, you might be wondering about the code needed to show a context menu. The strategy is rather simple: </p>
<ol>
<li>we start by setting up an event handler for the context menu event;</li>
<li>we prevent the default behaviour from within that handler;</li>
<li>we create a new <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br208693.aspx">PopupMenu</a> control and populate it with the required <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.popups.uicommand(v=vs.85).aspx">UICommand</a> entries;</li>
<li>we show the menu in the appropriate place by using the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.popups.popupmenu.showasync.aspx">showAsync</a> or <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.popups.popupmenu.showforselectionasync.aspx">showForSelectionAsync</a> method.</li>
</ol>
<p>To illustrate these points, we’ll replace the default context menu shown when the user right clicks over the selected text of the paragraph presented in the beginning of this post. As I’ve said, the first thing we need to do is set up an event handler for the context menu event of our paragraph. This can be done from within an initialization function which, for instance, is called from within the DOMContentLoaded event handler:</p>
<p><pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;getElementById&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;paragraph1&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;addEventListener&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;context menu&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;showContextMenu&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;);&lt;/span&gt;</pre></pre></p>
<p>Lets take a look at the code used inside the showContextMenu function:</p>
<p><pre><pre>&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;showContextMenu&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;evt&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;) {
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;evt&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;preventDefault&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;();
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;var &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;menu &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Popups&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;PopupMenu&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;();
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;menu&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;commands&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Popups&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UICommand&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;Copy&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ffcd22&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;));
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;menu&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;commands&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Popups&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UICommandSeparator&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;());
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;menu&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;commands&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Windows&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Popups&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UICommand&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;Search&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ffcd22&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;));&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;menu&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;showAsync&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;({ &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;evt&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;screenX&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;evt&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;screenY &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;}, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;above&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(cmd) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #66747b&quot;&gt;//handle command
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;});
}&lt;/span&gt;</pre></pre></p>
<p>After preventing the default context menu from being shown, we start by creating the PopupMenu which will replace the default&#160; context menu. This new context menu is populated with two UICommand instances and one separator (represented programmatically by a UICommandSeparator instance). All UICommand instances expect at least two parameters: a string which will be displayed in the menu and a callback function which will be invoked when that option is selection (which you can set to null!). Optionally, you can also pass a third parameter, which is used for setting the command identifier (in the previous example, I’ve resorted to an integer, but you can pass any object you want).</p>
<p>In this example, I’ve opted for using the showAsync method and for placing the menu according to the screen coordinates of the event object. Notice also that I’m passing a success callback to the then method, which will be called when the context menu is dismissed. The cmd parameter will only hold a valid value when you pick a command from the menu. When that happens, you’ll end up receiving the UICommand that has been selected by the user. You can then inspect that object and decide what you should do. The next image shows our new context menu in action:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu3.png"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 7px;border-left: 0px;padding-right: 0px" border="0" alt="contextmenu3" src="http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu3_thumb.png" width="260" height="129" /></a></p>
<p>And that’s it for now. Stay tuned for more about Windows 8 Metro dev.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/SznZ0mPd_UXgVlQitkBoUit7XpQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/SznZ0mPd_UXgVlQitkBoUit7XpQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/SznZ0mPd_UXgVlQitkBoUit7XpQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/SznZ0mPd_UXgVlQitkBoUit7XpQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/iMhIxs3HX5A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/01/12/windows-8-adventures-getting-to-know-contexto-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu_thumb.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/otYPUH3AWek/contextmenu-150x150.png" medium="image">
			<media:title type="html">contextmenu</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu2_thumb.png" medium="image">
			<media:title type="html">contextmenu2</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu3_thumb.png" medium="image">
			<media:title type="html">contextmenu3</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/01/12/windows-8-adventures-getting-to-know-contexto-menus/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/otYPUH3AWek/contextmenu-150x150.png" length="9002" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2012/01/contextmenu-150x150.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Windows 8 adventures: using the Flyout control</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/dYhkXTXL80I/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/01/11/windows-8-adventures-using-the-flyout-control/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 10:32:20 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2012/01/11/windows-8-adventures-using-the-flyout-control/</guid>
		<description><![CDATA[According to the docs, the Flyout control allows us to add lightweight popups which relate to what the user is currently doing. Creating a flyout is a simple operation which evolves a couple of steps: create the HTML snippet shown by the flyout; create the Flyout control and associate it with the HTML snippet created [...]]]></description>
			<content:encoded><![CDATA[<p>According to the docs, the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211726.aspx">Flyout</a> control allows us to add lightweight popups which relate to what the user is currently doing. Creating a flyout is a simple operation which evolves a couple of steps:</p>
<ol>
<li>create the HTML snippet shown by the flyout;</li>
<li>create the Flyout control and associate it with the HTML snippet created in step 1;</li>
<li>control the dismissal of the flyout and perform a specific operation when the flyout is dismissed (if required).</li>
</ol>
<p>To illustrate its use, let’s build a simple app which shows a flyout in response to a button click.  Here’s the HTML snippet responsible for the button and for the contents presented by the flyout:<br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;p&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; 
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;input &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;button&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;show Flyout&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;showFlyout&quot; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;/&amp;gt; 
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;p&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; 
&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;flyout&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;data-win-control=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;WinJS.UI.Flyout&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;Your account will be charged!&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;input &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;button&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;confirmFlyout&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;Confirm&quot; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;/&amp;gt;
 &amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;
&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;info&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;/span&gt;</pre></pre><br />
The info div is used for showing a message which explains how the flyout was dismissed (since flyouts can be dismissed by just clicking outside them, we’ll be using this div to show a message which says how the flyout was dismissed). Notice that we don’t need to hide the flyout by setting its display to none because it will be automatically hidden from the display when we associate it with the Flyout control that is created during the ready event:<br />
<pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;WinJS&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Utilities&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;ready&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;initializeSample&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;);&lt;/span&gt;</pre><br />
<pre>&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;var &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;_flyout &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;;&lt;/span&gt;</pre><br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;initializeSample&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;() {
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;WinJS&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;processAll&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;()
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;() {
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;_flyout &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;WinJS&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;getControl&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;getElementById&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;flyout&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;)); 
&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;_flyout&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;addEventListener&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;afterhide&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;performFlyoutAction&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;);
 });
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;getElementById&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;confirmFlyout&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;addEventListener&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt; &quot;click&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;confirmFlyoutDlg&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;); 
&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt; document&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;getElementById&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;showFlyout&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;addEventListener&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;click&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;showFlyout&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;); 
}&lt;/span&gt;</pre></pre><br />
The initializeSample function will only be called after the <a href="https://developer.mozilla.org/en/Gecko-Specific_DOM_Events">DOMContentLoaded</a> event has been fired. Internally, the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211903.aspx">ready</a> method will resort to a <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211867.aspx">Promise</a> in order to execute the initializeSample callback. If you prefer, you can still rely on the DOMContentLoaded event to run your initialization logic.</p>
<p>After initializing all the controls defined in the HTML document (notice the WinJS.UI.processAll method call), we initialize a global variable with a reference to our Flyout control and set up an event handler which will be called in response to the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211720.aspx">afterhide</a> event (this event is raised by the flyout after is has been fully hidden). You’ve probably noticed that we’ve hooked up the click events raised by the showFlyout and confirmFlyout buttons.</p>
<p>In the showFlyout button click’s event, we’re just showing the flyout:<br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;showFlyout&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;evt&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;) {
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;_flyout&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;show&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;evt&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;target&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;top&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;);
}&lt;/span&gt;</pre></pre><br />
Showing the flyout requires us to pass an anchor control (in this case, we’re passing it the object responsible for raising the event) and specify it’s relative position to the anchor control (in this case, we’re showing it over the button). The relative position is used as a hint and the flyout position will also be influenced by the current available space (for instance, if our button is placed at the top of the screen, then you shouldn’t really be surprised to see the flyout shown below it, event though you’ve passed top as the flyout’s relative position).</p>
<p>The confirmFlyout’s click event handler will only be called when the user clicks over the button shown by the flyout. Since flyouts can also be dismissed by just clicking outside of them, then we’ll use this event handler to change the value of another global variable (_flyoutConfirmed) before closing the flyout:<br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;var &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;_flyoutConfirmed &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;;
&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;confirmFlyoutDlg&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;() {
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;_flyoutConfirmed &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;_flyout&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;hide&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(); 
}&lt;/span&gt;</pre></pre><br />
We’ll be using this global variable from within the flyout’s afterhide event handler to see if the flyout was dismissed because the user clicked outside of the flyout or because the user clicked in the confirmFlyout button:<br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;performFlyoutAction&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;() {
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;getElementById&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;info&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;innerHTML &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;= 
&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt; _flyoutConfirmed &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;? &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;YES&quot; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;NO&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;_flyoutConfirmed &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;; 
}&lt;/span&gt;</pre></pre><br />
In this example, we’re just writing yes or no to a div, but you can easily adapt the code to start some action in response to a flyout’s button click. Notice that we’re also reseting the _flyoutConfirmed variable so that future flyout dismissals are correctly processed</p>
<p>Besides the methods and events shown in this small example, the Flyout control exposes others properties, methods and events. You can find more info about them in the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211726.aspx">online docs</a>.</p>
<p>And that’s all for now. Stay tuned for more.
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/KBtQnRmFXY6jMab5Irux3qtxLR4/0/da"><img src="http://feedads.g.doubleclick.net/~a/KBtQnRmFXY6jMab5Irux3qtxLR4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/KBtQnRmFXY6jMab5Irux3qtxLR4/1/da"><img src="http://feedads.g.doubleclick.net/~a/KBtQnRmFXY6jMab5Irux3qtxLR4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/dYhkXTXL80I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/01/11/windows-8-adventures-using-the-flyout-control/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/01/11/windows-8-adventures-using-the-flyout-control/</feedburner:origLink></item>
		<item>
		<title>Windows 8 adventures: playing with the Tooltip control</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/R3d40_XdWaM/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/01/09/windows-8-adventures-playing-with-the-tooltip-control/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 12:06:57 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2012/01/09/windows-8-adventures-playing-with-the-tooltip-control/</guid>
		<description><![CDATA[The Tooltip control is one of the new controls introduced by WinRT JavaScript API. After looking at the docs, I’ve decided to see how I could use it in a real world scenario. Since it’s a Windows 8 control, I knew that I could instantiate it by applying the win-data-control attribute to a div (and, [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229763.aspx#properties">Tooltip</a> control is one of the new controls introduced by WinRT JavaScript API. After looking at the docs, I’ve decided to see how I could use it in a real world scenario. Since it’s a Windows 8 control, I knew that I could instantiate it by applying the win-data-control attribute to a div (and, of course, don’t Forget to initialize the controls by calling WinJS.UI.process/All method):<br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;data-win-control=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;WinJS.UI.Tooltip&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;
data-win-options=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;{placement: &#039;right&#039;}&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; 
 Testing another tooltip 
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;/span&gt;</pre></pre><br />
The <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229766.aspx">placement</a> property is used to hint the place where the tooltip should be set (it accepts the strings top, left, right and bottom). Now, the next step is understanding how we can associate the tooltip with an existing control. After checking the property list, I didn’t find any property which would let me associate the tooltip with an existing control. I did, however, find an <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229762.aspx">innerHTML</a> property, that can be used for setting the HTML shown by the control. And that’s when I thought about putting the Tooltip’s associated control inside the Tooltip’s div:<br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;data-win-control=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;WinJS.UI.Tooltip&quot; 
&lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt; data-win-options= 
&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt; &quot;{placement: &#039;right&#039;, innerHTML: &#039;Testing another tooltip&#039;}&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; 
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;input &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;button&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;This is a simple button&quot; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;/&amp;gt; 
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;/span&gt;</pre></pre><br />
And sure enough, it worked: putting the mouse over the button is all that it takes to see the custom tooltip:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/simpletooltip.png"><img style="padding-top: 0px;padding-left: 0px;margin: 7px;padding-right: 0px;border: 0px" src="http://blogs.msmvps.com/luisabreu/files/2012/01/simpletooltip_thumb.png" alt="simpletooltip" width="370" height="26" border="0" /></a></p>
<p>Well, the tooltip is shown, but the results aren’t probably the one you’d expect since you’re probably expecting to see the tooltip being presented besides the button. If you think about it for a minute, then the problema is rather obvious. By default, div’s display is set to block and that means it’ll occupy a whole line, relegating the tooltip’s text to the next line. One possible solution is chaning the div’s display CSS property by using a CSS class rule:<br />
<pre>&lt;span style=&quot;background: #22282a;color: #678cb1&quot;&gt;.tooltip &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;{ &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #8c8cb4&quot;&gt;display&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;inline-block&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;; }&lt;/span&gt;</pre><br />
And then, we need to apply the class to the tooltip’s div:<br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;data-win-control=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;WinJS.UI.Tooltip&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;&lt;strong&gt;
 class=&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&lt;strong&gt;&quot;tooltip&quot;&lt;/strong&gt; 
&lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt; data-win-options=
&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt; &quot;{placement: &#039;right&#039;, innerHTML: &#039;Testing another tooltip&#039;}&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; 
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;input &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;button&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;This is a simple button&quot; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;/&amp;gt; 
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;/span&gt;</pre></pre><br />
And then, everything works as expected:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/toolti.png"><img style="padding-top: 0px;padding-left: 0px;margin: 7px;padding-right: 0px;border: 0px" src="http://blogs.msmvps.com/luisabreu/files/2012/01/toolti_thumb.png" alt="toolti" width="244" height="38" border="0" /></a></p>
<p>If you want, you can also define the HTML shown by the tooltip in another HTML element. In order to do that, you need to set the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229759.aspx">contentElement</a> property. Here’s how you can do that:<br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;data-win-control=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;WinJS.UI.Tooltip&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;
 data-win-options= 
&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt; &quot;{placement: &#039;right&#039;, innerHTML: &#039;Testing another tooltip&#039;}&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; 
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;input &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;button&quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;This is a simple button&quot; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;/&amp;gt; 
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; 
&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;contentTooltipContainer&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; 
 &amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;contentTooltip&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; Just a simple toggle button... &amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt; 
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;/span&gt;</pre></pre><br />
Notice that I’m wrapping the HTML element which is used by the Tooltip in a another div so that I can hide it from the UI (by applying a CSS rule which targets the contentTooltipContainer ID). If you don’t do that, the div’s content will be shown in the UI. Looking at the docs, there’s another important property which needs some explaining: I’m talking about the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229761.aspx">infotip</a> property. When you set it to true, you’re saying that the tooltip should be displayed for a little bit more time than usual. This is a good option when you have more than one line of text or when you need to worry about the finger occlusion problem (setting infotip to true requires a longer holding time before it appears, and once it’s opened, the underlying item will not be activated when the user lifts his or her finger). Here’s the result I’ve ended up with:<a href="http://blogs.msmvps.com/luisabreu/files/2012/01/adjustingtooltip.png"><img style="padding-top: 0px;padding-left: 0px;margin: 7px;padding-right: 0px;border: 0px" src="http://blogs.msmvps.com/luisabreu/files/2012/01/adjustingtooltip_thumb.png" alt="adjustingtooltip" width="307" height="61" border="0" /></a></p>
<p>Before ending, there’s still time to mention the existence of the HTML title attribute. If you’ve been doing Web development, you probably know that you can add a tooltip by setting the title attribute. However, creating a tooltip by setting the title attribute is a rather limited approach. For instance, you can only pass it text and you have no multi-touch support. Whenever you need any of these options, you should rely on the Tooltip control.</p>
<p>And that’s it for now. Stay tuned for more.
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/ZuhY00E80sv7UwupEufPpngURgo/0/da"><img src="http://feedads.g.doubleclick.net/~a/ZuhY00E80sv7UwupEufPpngURgo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ZuhY00E80sv7UwupEufPpngURgo/1/da"><img src="http://feedads.g.doubleclick.net/~a/ZuhY00E80sv7UwupEufPpngURgo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/R3d40_XdWaM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/01/09/windows-8-adventures-playing-with-the-tooltip-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2012/01/simpletooltip_thumb.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/IOwWeBOOb-s/simpletooltip-150x96.png" medium="image">
			<media:title type="html">simpletooltip</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/toolti_thumb.png" medium="image">
			<media:title type="html">toolti</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/adjustingtooltip_thumb.png" medium="image">
			<media:title type="html">adjustingtooltip</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/01/09/windows-8-adventures-playing-with-the-tooltip-control/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/IOwWeBOOb-s/simpletooltip-150x96.png" length="455" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2012/01/simpletooltip-150x96.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Windows 8 adventures: getting external data from a local server might not be as easy as you expect…</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/YiTFfjMw1hg/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/01/05/windows-8-adventures-getting-external-data-from-a-local-server-might-not-be-as-easy-as-you-expect/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 14:51:42 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2012/01/05/windows-8-adventures-getting-external-data-from-a-local-server-might-not-be-as-easy-as-you-expect/</guid>
		<description><![CDATA[After a couple of days playing with the Windows 8 controls (more about them in future post), I’ve decided that it was time to see how to get remote data through the WinJS.xhr helper. To make things really simple, I’ve decided to create an HTML page on the server which would be obtained through WinJS.xhr [...]]]></description>
			<content:encoded><![CDATA[<p>After a couple of days playing with the Windows 8 controls (more about them in future post), I’ve decided that it was time to see how to get remote data through the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229787.aspx">WinJS.xhr</a> helper. To make things really simple, I’ve decided to create an HTML page on the server which would be obtained through WinJS.xhr helper. I’ve ended up with the following code on my WinRT page’s DOMContentLoaded event:<br />
<pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;addEventListener&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&quot;DOMContentLoaded&quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;,
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;e&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;) {
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt; WinJS&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;xhr&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;({ &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&lt;a href=&quot;http://localhost/samplepage.html&quot;&gt;http://localhost/samplepage.html&lt;/a&gt; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;})
 .&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;handleResponse&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;handleError&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;); },
 &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;);&lt;/span&gt;</pre></pre><br />
The WinJS.xhr method expects an anonymous object which you can use to set several of the parameters associated with remote call (notice that his call ends up being performed by the XMLHttpRequest object). In our simple example, we’re only setting the URLfor the call (according to the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229787.aspx">docs</a>, you can also set several other parameters)</p>
<p>The WinJS.xhr method returns, once again, a Promise objet. In this case, the handleReponse method will be called when everything runs without any glitches. If there are any problems, the WinRT runtime ends up calling our handleError method. In this case, both methods end up receiving an instance of the XMLHttpRequest object used for performing the call.</p>
<p>The first time I’ve ran my demo app, it took a while until… my error handler got called. Initially, I thought that the URL was wrong, so I’ve copied it and pasted it into the URL address of Chrome. Nop, there was nothing wrong with the HTML. So, I’ve went ahead and I’ve searched the forums and started emailing some guys. After some time, I got lucky and I’ve found this <a href="http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/f980fedb-eb7e-4ff9-a3fc-a5ed8e1419ec">post</a>. <a href="http://www.linkedin.com/in/tiagonmas">Tiago</a> also gave me a hand by explaining that there was a difference between the local vs. Web context difference. It was only a matter of time until finding the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh452759.aspx">checknetisolation</a> tool.</p>
<p>According to the docs, localhost access is forbidden for security reasons and that means you’re into trouble when you’re developing apps which access local services. And that’s where this tool comes in: you can use it to create a rule which relaxes the WinRT localhost loopback restriction. To create a new rule, you must run the following command:</p>
<p>checknetisolation loopbackexempt –a –n=your_app_name</p>
<p>Alternatively, you can pass your app’s SID (in that case, you –p instead of –n), but I think that using your app’s name is easier. This brings us to the next question: what’s the name of my app? It turns out that the easiest way to get your app’s name is to open the manifest and copy the value of the Package Family Name entry in the Packaging tab:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/manifest.png"><img style="padding-top: 0px;padding-left: 0px;margin: 7px;padding-right: 0px;border: 0px" src="http://blogs.msmvps.com/luisabreu/files/2012/01/manifest_thumb.png" alt="manifest" width="436" height="182" border="0" /></a></p>
<p>Now, running the following instruction is all that you need to get that loopback restriction removed for our win8tests app:</p>
<p>checknetisolation loopbackexempt –a –n=win8tests_t2ggmrgk4m9fg</p>
<p>Before going on, we should always use the –s option to see if everything went well:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/checking.png"><img style="padding-top: 0px;padding-left: 0px;margin: 7px;padding-right: 0px;border: 0px" src="http://blogs.msmvps.com/luisabreu/files/2012/01/checking_thumb.png" alt="checking" width="429" height="183" border="0" /></a></p>
<p>As you can see, our rule is in place and everything should work out just fine…say again? are you sure? Unfortunately, it wasn’t working out fine…I was still getting the timeout and the error function that I’ve passed to the Promise object was still being called.</p>
<p>In despair, I’ve went back to the initial <a href="http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/f980fedb-eb7e-4ff9-a3fc-a5ed8e1419ec">post</a> and asked if there was anything I was missing. And the answer was yes, there was: I hadn&#8217;t opened port 80 on my firewall. It seems like WinRT xhr calls are always “served” as remote calls and they were being blocked by the firewall. After opening the HTTP 80 port (inbound rules), everything started running smoothly!</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/firewall.png"><img style="padding-top: 0px;padding-left: 0px;margin: 7px;padding-right: 0px;border: 0px" src="http://blogs.msmvps.com/luisabreu/files/2012/01/firewall_thumb.png" alt="firewall" width="252" height="331" border="0" /></a></p>
<p>Btw, one extra note: if you’re trying to get a resource from an intranet machine, then you’ll probably need to require Home/work Networking capability in your manifest.</p>
<p>And that’s it for now. Stay tuned for more.
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/MiJJKmPNtsBTSFWOTb_FxJOWMqE/0/da"><img src="http://feedads.g.doubleclick.net/~a/MiJJKmPNtsBTSFWOTb_FxJOWMqE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/MiJJKmPNtsBTSFWOTb_FxJOWMqE/1/da"><img src="http://feedads.g.doubleclick.net/~a/MiJJKmPNtsBTSFWOTb_FxJOWMqE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/YiTFfjMw1hg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/01/05/windows-8-adventures-getting-external-data-from-a-local-server-might-not-be-as-easy-as-you-expect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2012/01/manifest_thumb.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/xYU59kYmYjI/manifest-150x150.png" medium="image">
			<media:title type="html">manifest</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/checking_thumb.png" medium="image">
			<media:title type="html">checking</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/firewall_thumb.png" medium="image">
			<media:title type="html">firewall</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/01/05/windows-8-adventures-getting-external-data-from-a-local-server-might-not-be-as-easy-as-you-expect/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/xYU59kYmYjI/manifest-150x150.png" length="15777" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2012/01/manifest-150x150.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Windows 8 Adventures: Oh my god, it’s so easy to debug JavaScript apps!</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/stte2q4RRws/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/01/04/windows-8-adventures-oh-my-god-its-so-easy-to-debug-javascript-apps/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 10:24:49 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2012/01/04/windows-8-adventures-oh-my-god-its-so-easy-to-debug-javascript-apps/</guid>
		<description><![CDATA[After installing the Windows 8 Developer Preview With Developer Tools, I’ve finally managed to debug my JavaScript applications. Hurray and hurrah!!! And I must confess that the experience is really good! Even though I’ve been using Windows 8 for some time now, the truth is that the Widows 8 Developer Preview version I’ve decided to [...]]]></description>
			<content:encoded><![CDATA[<p>After installing the <a href="http://msdn.microsoft.com/en-us/windows/apps/br229516">Windows 8 Developer Preview With Developer Tools</a>, I’ve finally managed to debug my JavaScript applications. Hurray and hurrah!!! And I must confess that the experience is really good! </p>
<p>Even though I’ve been using Windows 8 for some time now, the truth is that the Widows 8 Developer Preview version I’ve decided to install at the time didn’t allow me to build Metro Style apps nor to debug existing applications (btw, I’ve decided to go with that version because it was the only one which allowed me to upgrade from Windows 7 and, at the time, the page didn’t mention that you could only only build Metro style apps from the Developer Tools version).</p>
<p>Back to business: so, what do we get when we debug a Windows 8 Metro JavaScript app? We get *all* the goodies we’re used to when debugging HTML+JS pages. Ok, here’s a screen capture which shows VS2011 running a debug session:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/debugging.png"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 7px;border-left: 0px;padding-right: 0px" border="0" alt="debugging" src="http://blogs.msmvps.com/luisabreu/files/2012/01/debugging_thumb.png" width="427" height="334" /></a></p>
<p>As you’d expect, you can add breakpoints to your JavaScript code and you can check the values of your objects by looking at the traditional watch and locals windows. You can also navigate through the current stack trace (and this means you inspect the Win RT JS code which ends up calling your functions). JavaScript developers will also notice the existence of the console window, which allows you to inspect your code or run JavaScript code.</p>
<p>Even more interesting is the DOM Explorer window (which you can see in the first tab). The next image shows that window in detail:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/domexplorer.png"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 7px;border-left: 0px;padding-right: 0px" border="0" alt="domexplorer" src="http://blogs.msmvps.com/luisabreu/files/2012/01/domexplorer_thumb.png" width="446" height="210" /></a></p>
<p>Yep, you have total access to the DOM used by your Win 8 Metro JavaScript! You can see the styles which have been applied to an element and you can even change them. If you’ve got a dual monitor system, you can even see where each HTML element is on your app’s UI:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/all.png"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 7px;border-left: 0px;padding-right: 0px" border="0" alt="all" src="http://blogs.msmvps.com/luisabreu/files/2012/01/all_thumb.png" width="422" height="126" /></a></p>
<p>This should be a really huge help for building those nasty layouts. Btw, if you’re building an app for several devices, then you’ll probably be happy to know that you can use the simulator. To use the simulator, you must change the default properties of your project (to access the dialog, right click your project in Solution Explorer and choose the properties option):</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/simulator.png"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 7px;border-left: 0px;padding-right: 0px" border="0" alt="simulator" src="http://blogs.msmvps.com/luisabreu/files/2012/01/simulator_thumb.png" width="432" height="308" /></a></p>
<p>After setting the debugger to launch dropdown to Simulator, you can simply hit F5 and you’ll end up with the simulator. Even though the simulator takes some time to start, it’s well worth it because you’ll end up with an environment where you can change the current screen resolution, change the way you interact with the app (mouse vs. touch) or even change the current orientation of your screen:</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/simulator2.png"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 7px;border-left: 0px;padding-right: 0px" border="0" alt="simulator2" src="http://blogs.msmvps.com/luisabreu/files/2012/01/simulator2_thumb.png" width="432" height="268" /></a></p>
<p>This should be really useful for everyone who needs to build an app for several devices and is stuck with a PC (like me!).</p>
<p>And that’s it for now. Stay tuned for more.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/iWOf_loXNkP-s29Rrx1whdQnJbo/0/da"><img src="http://feedads.g.doubleclick.net/~a/iWOf_loXNkP-s29Rrx1whdQnJbo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/iWOf_loXNkP-s29Rrx1whdQnJbo/1/da"><img src="http://feedads.g.doubleclick.net/~a/iWOf_loXNkP-s29Rrx1whdQnJbo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/stte2q4RRws" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/01/04/windows-8-adventures-oh-my-god-its-so-easy-to-debug-javascript-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2012/01/debugging_thumb.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/P7rpogzogjw/debugging-150x150.png" medium="image">
			<media:title type="html">debugging</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/domexplorer_thumb.png" medium="image">
			<media:title type="html">domexplorer</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/all_thumb.png" medium="image">
			<media:title type="html">all</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/simulator_thumb.png" medium="image">
			<media:title type="html">simulator</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2012/01/simulator2_thumb.png" medium="image">
			<media:title type="html">simulator2</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/01/04/windows-8-adventures-oh-my-god-its-so-easy-to-debug-javascript-apps/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/P7rpogzogjw/debugging-150x150.png" length="16205" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2012/01/debugging-150x150.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Windows 8 Adventures: setting properties from the HTML</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/oEQOKiYzz7s/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2012/01/03/windows-8-adventures-setting-properties-from-the-html/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 13:03:21 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2012/01/03/windows-8-adventures-setting-properties-from-the-html/</guid>
		<description><![CDATA[Yesterday I’ve started playing with the Windows 8 developer bits and I’ve decided to follow the JavaScript online docs. Windows 8 introduces lots of new things, but I’ve decided to start simple. It didn’t take long until I got into trouble though…One of the first controls that got me into trouble was the TimePicker control. [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I’ve started playing with the Windows 8 developer bits and I’ve decided to follow the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211363.aspx">JavaScript online docs</a>. Windows 8 introduces lots of new things, but I’ve decided to start simple. It didn’t take long until I got into trouble though…One of the first controls that got me into trouble was the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229736.aspx">TimePicker</a> control. The quick start docs are enough to start working with most of its features. And everything was fine, until I’ve tried running this code:</p>
<p>  <pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;DOCTYPE &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;meta &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;charset=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;utf-8&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;/&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;Win8Tests&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #66747b&quot;&gt;&amp;lt;!-- WinJS references --&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;link &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;rel=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;stylesheet&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;href=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/winjs/css/ui-dark.css&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;/&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;text/javascript&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;src=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/WinJS/js/base.js&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;br /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;text/javascript&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;src=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/WinJS/js/ui.js&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;br /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;text/javascript&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;src=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/WinJS/js/binding.js&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;br /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;text/javascript&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;src=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/WinJS/js/controls.js&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;br /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;text/javascript&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;src=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/WinJS/js/res.js&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;br /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;text/javascript&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;src=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/WinJS/js/animations.js&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;br /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;text/javascript&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;src=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/WinJS/js/uicollections.js&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;br /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;type=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;text/javascript&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;src=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/WinJS/js/wwaapp.js&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&lt;br /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #66747b&quot;&gt;&amp;lt;!-- Win8Tests references --&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;link &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;rel=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;stylesheet&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;href=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/css/default.css&amp;quot; &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;/&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;src=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;/js/default.js&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div &lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;timer&amp;quot; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;data-win-options=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;{current: &#039;12:15&#039;, disabled: true}&amp;quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #293134;color: #e0e2e4&quot;&gt;data-win-control=&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;WinJS.UI.TimePicker&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&nbsp;&nbsp;&nbsp;&nbsp;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;&amp;gt;
&lt;/span&gt;</pre></pre></p>
<p>Before talking about the problem, lets try to understand what’s going on here…</p>
<p>I’ve started by adding several (probably all?) of the client JavaScript libraries which will let me use the Win RT API from JavaScript (notice that I’ve included more libraries than needed for this small demo, but at least I know that all the required libraries have been included and I’m not missing any script reference). If you’ve just started looking at Windows 8 HTML code, then you’re probably wondering why we have all those data-XXX attributes applied to the div. </p>
<p>In the previous example, they’re used for transforming a simple div into a Windows 8 TimePicker control. You see, if you choose to build an Win RT app with HTML and JavaScript, you can reuse most (if not all!) of the traditional HTML controls. But there’s more: you can also use the new <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465493.aspx#what_is_the_windows_library">Windows 8 controls</a>. One of the options for instantiating these controls is to apply the data-win-control attribute to a div and specify the type of control that should be created (in the previous example, we’ve used the WinJs.UI.TimePicker control). Notice that opting for this strategy means that you’ll need to call the process or the processAll method from your JavaScript code. I’ve decided to call the processAll method from the DOMContentLoaded event:</p>
<p><pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;addEventListener&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;DOMContentLoaded&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;e&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;) {
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;WinJS&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;processAll&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;;
});&lt;/span&gt;</pre></pre></p>
<p>Alternatively, you can instantiate a control from your JavaScript code, but we’ll leave that for a future post. Going back to our HTML code, it shouldn’t be surprising to discover that the data-win-options attribute is used for initializing the properties of the control from the HTML markup. In our example, I’m trying to disable the control and set the time to 12h15. The problem is that I was always getting the default 12h00 time (btw, if you don’t set any value, you’ll end up with the current time):</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2012/01/timepicker.png"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 7px;border-left: 0px;padding-right: 0px" border="0" alt="timepicker" src="http://blogs.msmvps.com/luisabreu/files/2012/01/timepicker_thumb.png" width="244" height="40" /></a></p>
<p>hum…what’s going on here? Shouldn’t this work? According to the docs, string properties can be wrapped in ‘ ‘ and it should work without any glitches. Unfortunately, the problem was rather simple: it’s a limitation of the current build and <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br229736.aspx">“You can always use the standard American English in this release”</a>. And yes, changing the way date, time and number are formatted (in the regional settings of the control panel) solved the problem. Anyways, I’m living in Madeira (still part of Portugal, I believe – sorry, local joke <img src='http://blogs.msmvps.com/luisabreu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ), so I really want to see my data formatted in Portuguese. So, how can I solve this problem without changing the locale? Well, one solution to the problem is to work with the Promise object that processAll returns. Here’s a modified version of the JavaScript I’ve used initially:</p>
<p><pre><pre>&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;addEventListener&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;DOMContentLoaded&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;e&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;) {
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;WinJS&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;processAll&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;initializePicker&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Error&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;);
});
&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;initializePicker&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;() {
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;var &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;picker &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;WinJS&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;getControl&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;document&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;getElementById&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ec7600&quot;&gt;&amp;quot;timer&amp;quot;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;));
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;picker&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;current &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #93c763&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #f1f2f3&quot;&gt;Date&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ffcd22&quot;&gt;2012&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ffcd22&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ffcd22&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ffcd22&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background: #22282a;color: #ffcd22&quot;&gt;15&lt;/span&gt;&lt;span style=&quot;background: #22282a;color: teal&quot;&gt;);
}&lt;/span&gt;</pre></pre></p>
<p>One of the interesting concepts of Win RT is that most operations that “take time” are asynchronous. processAll must go through all the DOM and initialize all the Windows 8 controls it finds. That’s why it’s an async operation and, like all asynchronous operations, it ends up returning a <a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211867.aspx">Promise</a> object. After getting a Promise object, we can configure it to invoke a callback method when the encapsulated operation is done. In our case, we’re also passing an error function that should be invoked if the “encapsulated” operation generates an error (notice that we can still pass one additional function, that would be called for progress feedback). Our initializePicker function is rather simple: we’re getting a reference to the Windows 8 control (notice the WinJS.UI.getControl method) and creating a new Date object (with the correct time) that is used for initializing the TimePicker’s current property.</p>
<p>And that’s it for now. Stay tuned for more!</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/VpibVmfSiKOGXsDTMoTr32LICDA/0/da"><img src="http://feedads.g.doubleclick.net/~a/VpibVmfSiKOGXsDTMoTr32LICDA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/VpibVmfSiKOGXsDTMoTr32LICDA/1/da"><img src="http://feedads.g.doubleclick.net/~a/VpibVmfSiKOGXsDTMoTr32LICDA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/oEQOKiYzz7s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2012/01/03/windows-8-adventures-setting-properties-from-the-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2012/01/timepicker_thumb.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/B9g7gXZTWIU/timepicker-150x43.png" medium="image">
			<media:title type="html">timepicker</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2012/01/03/windows-8-adventures-setting-properties-from-the-html/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/B9g7gXZTWIU/timepicker-150x43.png" length="746" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2012/01/timepicker-150x43.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Happy new year everyone!</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/GN4PriH05sY/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/12/31/happy-new-year-everyone/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 14:32:32 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Trivia]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/12/31/happy-new-year-everyone/</guid>
		<description><![CDATA[Just a quick post to wish you all a happy new year! Post Footer automatically generated by Add Post Footer Plugin for wordpress.]]></description>
			<content:encoded><![CDATA[<p>Just a quick post to wish you all a happy new year!
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/nH_m-fpF7Qa1FUHyoSWgzYtWmsE/0/da"><img src="http://feedads.g.doubleclick.net/~a/nH_m-fpF7Qa1FUHyoSWgzYtWmsE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/nH_m-fpF7Qa1FUHyoSWgzYtWmsE/1/da"><img src="http://feedads.g.doubleclick.net/~a/nH_m-fpF7Qa1FUHyoSWgzYtWmsE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/GN4PriH05sY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/12/31/happy-new-year-everyone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/12/31/happy-new-year-everyone/</feedburner:origLink></item>
		<item>
		<title>Reflexões ao almoço de um Madeirense orgulhoso que teima em continuar a ser Português</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/vUsXm_vjlvk/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/11/23/reflexes-ao-almoo-de-um-madeirense-orgulhoso-que-teima-em-continuar-a-ser-portugus/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 15:10:06 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Trivia]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/11/23/reflexes-ao-almoo-de-um-madeirense-orgulhoso-que-teima-em-continuar-a-ser-portugus/</guid>
		<description><![CDATA[Enough is enough! I tipically don’t discuss politics but this time I’ll make an exception . Since it’s about Madeira and Portugal, I’ll write in Portuguese.&#160; Se me dissessem no ano passado que hoje estaria a escrever um post político no meu blog e que ainda por cima estaria a defender algumas decisões tomadas pelo [...]]]></description>
			<content:encoded><![CDATA[<p>Enough is enough! I tipically don’t discuss politics but this time I’ll make an exception . Since it’s about Madeira and Portugal, I’ll write in Portuguese.&#160; </p>
<p>Se me dissessem no ano passado que hoje estaria a escrever um post político no meu blog e que ainda por cima estaria a defender algumas decisões tomadas pelo Governo Regional, eu diria que isso seria impossível. Não gosto de política, nem gosto dos partidos políticos. Mas a paciência tem limites e a informação apresentada nos meios de comunicação social é tão má, que me vejo forçado a gastar a minha hora de almoço a escrever sobre estes tópicos. </p>
<p>Durante os últimos meses, a Madeira tem sido constantemente atacada por todos os meios de comunicação social que insistem em duas teorias perversas e completamente desfasadas da realidade. A primeira é que a região é constituída por parasitas, que se limitam a roubar o dinheiro dos restantes contribuintes do estado Português (esses sim, trabalhadores incansáveis, que andam constantemente a sustentar os mandriões dos Madeirenses). A segunda, ainda mais desfasada da realidade, assenta na teoria de que o problema financeiro de Portugal só existe devido à divida total da Madeira (que ascende, ao que parece, aos 6.3 M milhões de euros).</p>
<p>Estas teorias ganham eco através do péssimo jornalismo feito num país onde muitos são pobres, alguns são remediados e poucos são ricos. Não é de agora que tenho dúvidas em relação à qualidade do jornalismo em Portugal. Por exemplo, veja-se este <a href="http://forum.autohoje.com/off-topic/50617-aquilo-de-que-portugal-realmente-precisa-mario-crespo.html">artigo de opinião</a>, supostamente escrito pelo Mário Crespo (alguém que gosta de passar a ideia de ser um profissional a sério!), sobre a aquisição dos Falcon… Qualquer pessoa que não conheça a realidade pensa que esta compra foi apenas um capricho dos governantes. Pena que um jornalista da sua “craveira” não se tenha dado ao trabalho de investigar a realidade. Se o tivesse feito, não se teria também esquecido de dizer que estes aviões são usados, por exemplo, para efetuar a transferência de órgãos (sim, estamos a falar de salvar vidas humanas, ou acham que os órgãos são transferidos nos aviões comerciais da TAP?) e para garantir o número de horas dos nossos pilotos da Força Aérea (sem horas de voo, não têm brevet para voarem!). Mas enfim, num país onde a mediocridade é normal, também não se poderia esperar que os jornalistas fossem diferentes, certo?</p>
<p>Mas de volta à manipulação que tem sido feita sobre a Madeira, não posso deixar de referenciar duas noticias que saíram nos últimos dias: “<a href="http://www.publico.pt/Pol%C3%ADtica/tres-milhoes-de-euros-para-iluminacoes-e-fogodeartificio-na-madeira-1521908">Três milhões de euros para iluminações e fogo-de-artifício na Madeira</a>” (o Público) e “<a href="http://economico.sapo.pt/noticias/madeira-tem-carta-branca-para-contratar-funcionarios-publicos_132069.html">Madeira tem carta branca para contratar funcionários públicos</a>” (Diário Económico). Perante estes “roubos” efetuados pelos parasitas Madeirenses, não é invulgar encontrarmos vários comentários anti-Madeira. Já vi de tudo: desde o tradicional “venda-se já” (como se não estivéssemos numa economia de mercado, onde existe o conceito de propriedade privada!) ao já usual “Mamadeira” (forma como os contribuintes não Madeirenses gostam de designar a “Pérola do Atlântico”). Um exemplo típico deste comportamento é o comentário do sr. Open Mind (ao que parece, do Porto) que adicionou o seguinte comentário à noticia da iluminação (optei por colocar um que não fere as suscetibilidades dos mais novos):</p>
<blockquote><p>“E a roubalheira continua!</p>
</blockquote>
<blockquote><p>O regabofe continua! Aqui no continente corta-se nos apoios a crianças, jovens, idoso, na saúde, corta-se os subsidios, aumenta-se a carga horária de trabalho, os impostos e sei lá que mais, para este louco continuar a gastar sem qualquer controlo! Isto é inadmissivel! (&#8230;)”</p>
</blockquote>
<p>São comentários como este que me fazem ter a certeza de que nunca vamos sair do buraco onde nos encontramos. Mas vamos lá começar pelo início. E nada como analisar o Orçamento de Estado de 2011. Vejamos, então, o que diz o Correio da Manhã em relação às <a href="http://www.correiodosacores.net/view.php?id=29730">verbas retiradas do OE para a Madeira</a>:</p>
<blockquote><p>“Se o Orçamento de Estado para 2011 passar na Assembleia da República, vão ser transferidos para a Madeira 191,5 milhões de euros para cobrir custos da insularidade; 8,3 milhões de euros ao abrigo do fundo de coesão; e 50 milhões de euros para fazer face aos prejuízos dos temporais ocorridos este ano. No total, são transferidos do Orçamento de Estado para a Madeira 251,1 milhões de euros.”</p>
</blockquote>
<p>Como é óbvio, a verba enviada para a Madeira é bem inferior à dos Açores (e sempre foi, ao contrário do que alguns jornalistas tentam fazer parecer) e inclui as verbas usadas na chamada Lei de Meios, que servem para ajudar a ilha a recuperar dos prejuízos do temporal. Para simplificar, vamos usar o valor 260 milhões como sendo o valor totalmente suportado pelos contribuintes não residentes da Madeira que é cedido à região. Agora, vejamos a receita projetada no <a href="http://srpf.gov-madeira.pt/droc/orcamentos/ORAM2010RECT/DLR_14-2010.pdf">mapa do orçamento regional da Madeira de 2011</a>: valor final: 1.6M milhões. Bom, eu não tenho formação em economia ou finanças, mas parece-me que afinal os Madeirenses não estão a parasitar os contribuintes do continente, certo? Ou seja, o valor cedido do OE de estado é importante (que não restem dúvidas disto!), mas está longe de representar a única fonte de receitas do orçamento regional (ou de ser responsável pelas obras de infraestruturas efetuadas ao longo dos anos – vamos deixar a discussão das obras para outra altura).</p>
<p>Antes de passarmos à análise das notícias dos jornais Público e Diário Económico, nada como fazer um aparte e esclarecer outro mito que por aí circula. A teoria geral é: “pois bem, estão a ver? Nós pagamos impostos e o nosso dinheiro vai para a ‘Mamadeira’. Os impostos deles ficam na ilha”. Esta teoria é defendida pelo “grande comentador” Miguel de Sousa Tavares (mente iluminada, que todas as semanas ocupa espaço precioso na sic, a debitar baboseiras sobre todos os tópicos possíveis). Infelizmente esta teoria não corresponde à verdade, como é possível verificar através da <a href="http://app.parlamento.pt/webutils/docs/doc.pdf?path=6148523063446f764c3246795a5868774d546f334e7a67774c325276593342734c57526c593168305a5867765a47566a4f5451745743356b62324d3d&amp;fich=dec94-X.doc&amp;Inline=true">Lei das Finanças Regionais</a>. Se é verdade que a maioria dos impostos (ex.: IRS, IVA e selo) é, efetivamente, devolvida às regiões, o mesmo não acontece com impostos extra (como a 5% de redução média dos ordenados da função pública ou a retenção de 50% do subsidio de Natal) ou com IRC (onde a afetação devolvida à região depende da sede da empresa e/ou da existência de representação legal na região).</p>
<p>Portanto, a realidade é que existem muitos Madeirenses que estão a contribuir orgulhosamente (eu incluo-me nesse grupo) para equilibrar as contas públicas da nação (ao contrário do que, por exemplo, acontece com os Açores, onde a penalização não afeta todos os funcionários públicos). Já agora, e se o leitor não se importar, vamos deixar a discussão do pseudo-perdão de Guterres da divida regional e a existência de impostos mais baixos para outro post…e nessa altura, podemos até comparar a situação da Madeira e dos Açores com a existente nas Canárias, região autónoma da vizinha Espanha…</p>
<p>E, sem mais demoras, passo à primeira notícia, escrita pelo Sr. Tolentino Nóbrega, cuja cegueira política contra AJJ (para a qual tem, provavelmente, boas razões), levou à escrita de um artigo onde se depreende que a iluminação de Natal custa 3 milhões aos contribuintes continentais e é apenas feita por laxismo/opulência do “regime jardinista”. Nesta altura, a primeira falácia deve estar esclarecida (recordar receita total esperada da região de 1.6M milhões em 2011). Em relação à segunda, qualquer pessoa que conheça a Madeira sabe que ela só tem dois bens “transacionáveis”: turismo e praça financeira (hoje não vamos falar da praça financeira, mas se continuar a ouvir o Sr. Louçã a dizer asneiras na TV – e ainda por cima, dizem-me que o homem é formado em economia e, pasme-se, dá aulas sobre essa área na universidade – não vou ter outro remédio senão adicionar um outro tópico sobre este assunto tão importante para a sobrevivência económica da ilha). </p>
<p>Para quem não sabe, a quadra natalícia é o cartaz turístico da região. É aqui que tem de se investir (e não gastar, como apregoa o Sr. Tolentino!)&#160; porque o retorno turístico é enorme. Em vez de analisar o ajuste direto (que é um tópico que interessa a toda a gente, incluindo os contribuintes Madeirenses), o Sr. Tolentino preferiu, ao que consta, inventar e então deu-se ao trabalho de escrever as seguintes pérolas:</p>
<blockquote><p>“ Só nas iluminações natalícias, o executivo vai despender cerca de dois milhões de euros. A adjudicação foi feita por ajuste directo à Luzosfera, depois de ter sido anulado o concurso público devido aos pedidos de impugnação interpostos por outros concorrentes, que contestaram a escolha daquela empresa. “</p>
</blockquote>
<blockquote><p>“A Luzosfera, do grupo SIRAM, liderada pelo ex-deputado regional Sílvio Santos (PSD), ganha assim mais meio milhão de euros em relação ao valor anual da sua própria proposta a concurso. A celebração do contrato por ajuste directo decorreu na semana passada e o início dos trabalhos de montagem das iluminações foi imediato.”</p>
</blockquote>
<blockquote><p>”O Funchal, ao contrário de outras cidades que reduziram as iluminações natalícias devido às medidas de austeridade, mantém o mesmo programa de festas dos anos anteriores, incluindo a duração de 12 minutos de queima de fogo do réveillon. Municípios de todo o país estão a reduzir ou a dispensar as iluminações para conter despesas, tendo a Câmara de Lisboa diminuído os gastos para 150 mil euros (menos 700 mil do que no ano passado), enquanto o Porto cortou o investimento para cerca de metade.”</p>
</blockquote>
<p>Com noticias destas, tenho de reconhecer que, se vivesse noutra zona do país, e pensando eu que andava a sustentar os mandriões dos Madeirenses, também estaria revoltado e a praguejar (aliás, a minha primeira reação ao ajusto direto foi mesmo um tradicional ‘WTF?’). </p>
<p>Mas acontece que o Sr. Tolentino, ao que parece nascido na Madeira, desconhece que o cartaz turístico da Madeira é a quadra natalícia e respetiva passagem de ano! Sim, Sr. Tolentino, no Natal a ocupação hoteleira ronda os 100%. E sim, os turistas vêm cá para ver as tais luzinhas e o tal desperdício de queima de fogo que o Sr. refere no seu artigo.</p>
<p>Para além da hotelaria, importa ainda notar que o porto fica repleto de navios de cruzeiro (em média, só no dia 31, temos tido entre 6 e 9 navios!). Se nos concentrarmos só nos navios, é fácil de perceber que as tais luzinhas e o espetáculo de queima de fogo chamam muita gente. Para ter uma pequena noção de valores, é só consultar este <a href="http://www.abola.pt/mundos/ver.aspx?id=299718">artigo</a>, onde é possível verificar que o cancelamento das escalas de 2 navios de cruzeiro no porto do Funchal (em consequência da greve de 24 de Novembro) pode resultar na perda de 500 milhões de euros na economia regional! Portanto, Sr. Tolentino, se há dinheiro que ainda é bem investido na ilha, é este, que é gasto nesta quadra e que acaba por trazer cá vários milhares de turistas.</p>
<p>Parece-me também que querer comparar a afluência de turistas à Madeira (no final do ano) com o que acontece com os outros municípios é, no mínimo, estranho. Será que os restantes municípios de Portugal têm uma afluência tão grande de turistas nesta quadra como a Madeira? Bem, nunca ouvi dizer isso, mas posso estar errado…</p>
<p>Infelizmente, os leitores do continente não tiveram a oportunidade de ler o <a href="http://www.jornaldamadeira.pt/not2008.php?Seccao=14&amp;id=201201&amp;sdata=2011-11-22">esclarecimento</a> efetuado pelo governo regional em relação a esta notícia. Vejamos, então, os pontos mais interessantes desse esclarecimento. Em primeiro lugar, parece que a alegação efetuada (de que teriam havido pedidos de impugnação) não corresponde à realidade:</p>
<blockquote><p>“ O Concurso Público das iluminações não foi anulado devido a pedidos de impugnação interpostos mas, sim, a irregularidades cometidas por todos os concorrentes, o que levou à sua exclusão, tendo o Governo Regional determinado a não adjudicação deste procedimento. Refira-se que, em causa, está um Concurso Público, autorizado pela resolução 1031/2011, do Conselho de Governo de 14 de Julho, que versava a criação e construção dos motivos decorativos, montagem e desmontagem das iluminações decorativas, nas Festas de Natal e Fim-de-ano 2011/2012, 2012/2013 e 2013/2014, nas Festas de Carnaval 2012/2013 e 2013/2014 e Festas do Vinho da Madeira 2012/2013 e 2013/2014 na Região. A este Concurso Público, que tinha como valor base, os 8.626.500,00 euros, concorreram quatro concorrentes, que apresentaram propostas que variavam entre os 4.313.251,50 euros e os 7.885.104,00 euros, propostas que, tal como atrás é dito, apresentavam irregularidades e não preenchiam os requisitos exigíveis por lei.”</p>
</blockquote>
<p>Para além disso, parece que as 4 empresas concorrentes foram convidadas a apresentar propostas de ajuste direto:</p>
<blockquote><p>“4. Posto isto, dadas as limitações temporais e de modo a garantir a concretização de uma das vertentes mais importantes do emblemático e maior cartaz turístico da Região, o Governo Regional, através da Secretaria Regional do Turismo e Transportes, optou por recorrer ao procedimento de ajuste directo, um dos mecanismos previstos nos casos em que os concursos públicos ficam desertos. De salientar que, sendo o turismo o principal motor da economia regional e, este evento em concreto, o principal cartaz turístico da Região, o interesse público de salvaguardar a sua realização em conformidade ao que estava previsto determinou que se recorresse a todos os mecanismos que garantissem a sua efectividade. Mesmo assim, importa aqui referir que só foram incluídas neste ajude directo, as iluminações das Festas de Natal e Fim-de-ano 2011/2012 e do Carnaval 2012, dado que, para as seguintes festividades, se procederá à abertura de um Concurso Público Internacional.     <br />5. No âmbito do referido ajuste directo, foram endereçados convites para apresentação de propostas aos quatro concorrentes que já tinham apresentado os seus projectos ao concurso público. Para este procedimento, foi estabelecido um preço base no valor de 2.068.000,00 euros, valor que teve em conta os preços médios apresentados no âmbito do Concurso Público, assim como os custos de investimento associados ao arranque inicial dos trabalhos e à logística necessária para a sua efectivação no terreno, face ao prazo que era necessário cumprir para a abertura das iluminações, a 8 de Dezembro.”</p>
</blockquote>
<p>E, segundo o governo, apenas 2 dos 4 participantes concorreram:</p>
<blockquote><p>“6.&#160;&#160;&#160;&#160;&#160; Dos 4 convites endereçados, apenas 2 concorrentes apresentaram propostas, concretamente as empresas “Som ao Vivo, Lda.” – no valor de 2.067.997,60 – e “Luzosfera, Construções Lda.” – no valor de 1.975.414,44 euros.     <br />7.&#160;&#160;&#160;&#160;&#160; O ajuste directo foi adjudicado à Empresa Luzosfera, no passado dia 8 de Novembro, pelo valor de 1.975.414,44 euros, mais IVA, sendo que a adjudicação deste procedimento não suscitou quaisquer recursos/reclamações.”</p>
</blockquote>
<p>Para além disso, nenhuma das empresas recorreu ao Tribunal Administrativo, conforme afirma o Sr. Tolentino:</p>
<blockquote><p>“8.&#160;&#160;&#160;&#160;&#160; Por outro lado, e ao contrário do que refere a noticia, importa aqui esclarecer que os últimos dois Concursos das iluminações não foram parar ao Tribunal Administrativo. Apenas o Concurso de Fogo-de-artifício 2010/2011 foi alvo de uma acção contenciosa, tendo, tanto o Tribunal Administrativo do Funchal quanto o Tribunal Central Administrativo do Sul, dado razão à Região.”</p>
</blockquote>
<p>Finalmente, e ao contrário do que é sugerido, a adjudicação do fogo-de-artifício ainda não foi efetuada ainda:</p>
<blockquote><p>“9.&#160;&#160;&#160;&#160;&#160; Finalmente, e no que se refere às declarações proferidas sobre o Concurso do fogo-de-artifício – e não estando o mesmo ainda encerrado – esta Secretaria Regional não irá tecer quaisquer declarações nem alimentar polémicas.”</p>
</blockquote>
<p>Se nenhuma das empresas contestar estas alegações do governo, gostaria de saber como é que é possível continuarmos a ter notícias tão falaciosas nos jornais Portugueses! Sr. Tolentino, o que senhor deveria ter feito era investigar ao máximo a forma como foi feito o ajuste direto e não levantar suspeitas sem apresentar argumentos concretos e verdadeiros. Mas ao que parece, a Madeira vende tanto como o Benfica, e por isso nada como atiçar a opinião pública contra os parasitas residentes na ilha…</p>
<p>Se ainda houvesse alguma dúvida quanto à tentativa de transformar o problema nacional num problema causado pela Madeira, veja-se o título da capa do Diário Económico de hoje (23 de Novembro): </p>
<blockquote><h4>“Madeira tem carta branca para contratar funcionários públicos”</h4>
</blockquote>
<p>E depois, o primeiro parágrafo da <a href="http://economico.sapo.pt/noticias/madeira-tem-carta-branca-para-contratar-funcionarios-publicos_132069.html">notícia online</a> diz o seguinte:</p>
<blockquote><p>“O controlo do recrutamento de trabalhadores nas administrações regionais poderá não ficar, afinal, sob a alçada do Ministério das Finanças. A medida está prevista na proposta do Orçamento do Estado para 2012 entregue à Assembleia da República a 17 de Outubro, e tem como objectivo centralizar no ministério tutelado por Vítor Gaspar as decisões sobre as admissões de efectivos na função pública da Madeira e Açores.”</p>
</blockquote>
<p>Será que li mal, ou diz Madeira e Açores? Então o título não deveria ser: Regiões Autónomas com carta branca para contratar funcionários públicos? Ou será que os Açores já não são uma região autónoma? Que raio de jornalismo é este? A ironia está no facto de serem os Açores (e não a Madeira) que não estão a penalizar todos os seus funcionários públicos, como acontece no restante país…</p>
<p>Este texto não está a ser escrito por um defensor do Governo Regional, mas sim por uma pessoa que acha que a verdade é mais importante do que estar constantemente a debitar falácias que apenas contribuem para clivagens desnecessárias entre os Portugueses (sim, ainda me considero Português!)</p>
<p>Infelizmente, terminou a hora de almoço e por isso não me vou poder alongar na questão da divida Madeirense (por acaso, existem vários aspetos importantes aqui que mereciam a pena serem discutidos). Fica para uma próxima vez…</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/bQh9vk2u8kDaQPKa4fXdPgtF0Ow/0/da"><img src="http://feedads.g.doubleclick.net/~a/bQh9vk2u8kDaQPKa4fXdPgtF0Ow/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/bQh9vk2u8kDaQPKa4fXdPgtF0Ow/1/da"><img src="http://feedads.g.doubleclick.net/~a/bQh9vk2u8kDaQPKa4fXdPgtF0Ow/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/vUsXm_vjlvk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/11/23/reflexes-ao-almoo-de-um-madeirense-orgulhoso-que-teima-em-continuar-a-ser-portugus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/11/23/reflexes-ao-almoo-de-um-madeirense-orgulhoso-que-teima-em-continuar-a-ser-portugus/</feedburner:origLink></item>
		<item>
		<title>Book review: Supercharged JavaScript Graphics</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/4q5xPfIIQNk/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/11/16/book-review-supercharged-javascript-graphics/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 21:12:04 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/11/16/book-review-supercharged-javascript-graphics/</guid>
		<description><![CDATA[Disclaimer: I’ve received a free copy of this book for review. Nowadays, HTML5, CSS and JavaScript are everywhere. And since these are really hot technologies, it’s really easy to find lots of books about these topics. This really ends up being a problem because it’s not easy to find one which fits makes everyone happy. [...]]]></description>
			<content:encoded><![CDATA[<p>Disclaimer: I’ve received a free copy of this book for review.</p>
<p>Nowadays, HTML5, CSS and JavaScript are everywhere. And since these are really hot technologies, it’s really easy to find lots of books about these topics. This really ends up being a problem because it’s not easy to find one which fits makes everyone happy. Interestingly,&nbsp; <a href="http://www.amazon.com/Supercharged-JavaScript-Graphics-canvas-jQuery/dp/1449393632/ref=sr_1_1?ie=UTF8&amp;qid=1321477165&amp;sr=8-1">Supercharged JavaScript Graphics</a> seems to be able to do just that.</p>
<p>Let me be more specific: it’s a book which will make anyone with a decent knowledge of HTML, CSS and JavaScript interested in web graphics technics happy. I say this because the author introduces a range of topics and technics related with graphics which will surely teach you something new. Interestingly, the book doesn’t concentrate only in the new HTML5 features (ex.: canvas) and you’ll end up doing lots of graphic work with the pre-HTML5 features. Overall, I’m recommending this book for anyone who needs to improve their skills on graphics for the Web. Score: 8/1&#8217;0.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/cU0ZXcl0vjbQ3HuOFK_UrgX_2mY/0/da"><img src="http://feedads.g.doubleclick.net/~a/cU0ZXcl0vjbQ3HuOFK_UrgX_2mY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/cU0ZXcl0vjbQ3HuOFK_UrgX_2mY/1/da"><img src="http://feedads.g.doubleclick.net/~a/cU0ZXcl0vjbQ3HuOFK_UrgX_2mY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/4q5xPfIIQNk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/11/16/book-review-supercharged-javascript-graphics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/11/16/book-review-supercharged-javascript-graphics/</feedburner:origLink></item>
		<item>
		<title>I’m still here…really!</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/7GzZEdY77UM/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/11/16/im-still-herereally/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 20:58:23 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/11/16/im-still-herereally/</guid>
		<description><![CDATA[It’s been more than one month since I’ve written something in this blog. Unfortunately, I’ve been really busy with work and lots of investigation in several areas…but I think now I’ll be able to return to my daily routines and I’ll try to write at least one post per day . So, what have I [...]]]></description>
			<content:encoded><![CDATA[<p>It’s been more than one month since I’ve written something in this blog. Unfortunately, I’ve been really busy with work and lots of investigation in several areas…but I think now I’ll be able to return to my daily routines and I’ll try to write at least one post per day <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Winking smile" src="http://blogs.msmvps.com/luisabreu/files/2011/11/wlEmoticon-winkingsmile.png">. </p>
<p>So, what have I been doing lately? Glad you’ve asked<img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Smile" src="http://blogs.msmvps.com/luisabreu/files/2011/11/wlEmoticon-smile.png"> I’ve been playing with the latest bits of ASP.NET (Web Forms and MVC). The next release will have some interesting features and that’s why I decided to write a&nbsp; book about ASP.NET MVC (once again, in Portuguese). This won’t be a big book (like the one about Web Forms), but it will cover all the important details related with MVC projects.</p>
<p>Since my previous experiences have gone really well, I’ve decided once again to ask for the help of the community: if you understand Portuguese and you want to help me improve this book, just drop me a line at labreu _at_gmail.com. I can only have a limited number of reviewers and (unfortunately!) I can only offer a free copy of the book when it’s out for all your hard work <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Smile" src="http://blogs.msmvps.com/luisabreu/files/2011/11/wlEmoticon-smile.png"></p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/nSxbSrJCKzO13xlTo4YfAIFanmE/0/da"><img src="http://feedads.g.doubleclick.net/~a/nSxbSrJCKzO13xlTo4YfAIFanmE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/nSxbSrJCKzO13xlTo4YfAIFanmE/1/da"><img src="http://feedads.g.doubleclick.net/~a/nSxbSrJCKzO13xlTo4YfAIFanmE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/7GzZEdY77UM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/11/16/im-still-herereally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2011/11/wlEmoticon-winkingsmile.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/4hSLzDl9jvc/wlEmoticon-winkingsmile.png" medium="image">
			<media:title type="html">Winking smile</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2011/11/wlEmoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2011/11/wlEmoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/11/16/im-still-herereally/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/4hSLzDl9jvc/wlEmoticon-winkingsmile.png" length="1135" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2011/11/wlEmoticon-winkingsmile.png</feedburner:origEnclosureLink></item>
		<item>
		<title>MVP award for another year</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/LxYv_q7kqA4/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/10/03/mvp-award-for-another-year/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 11:48:55 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Trivia]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/10/03/mvp-award-for-another-year/</guid>
		<description><![CDATA[Even though I though this was it, the fact is that MS renewed my ASP.NET MVP status for another year! (not sure why, but the notification email ended up in the spam area – bad boy Gmail!, bad body! ) Thanks MS! Post Footer automatically generated by Add Post Footer Plugin for wordpress.]]></description>
			<content:encoded><![CDATA[<p>Even though I though this was it, the fact is that MS renewed my ASP.NET MVP status for another year! (not sure why, but the notification email ended up in the spam area – bad boy Gmail!, bad body! <img style="border-bottom-style: none;border-left-style: none;border-top-style: none;border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blogs.msmvps.com/luisabreu/files/2011/10/wlEmoticon-smile.png" />) Thanks MS!</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/FWi_v5GYtHjZK14BHjw9ylr7ODM/0/da"><img src="http://feedads.g.doubleclick.net/~a/FWi_v5GYtHjZK14BHjw9ylr7ODM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/FWi_v5GYtHjZK14BHjw9ylr7ODM/1/da"><img src="http://feedads.g.doubleclick.net/~a/FWi_v5GYtHjZK14BHjw9ylr7ODM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/LxYv_q7kqA4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/10/03/mvp-award-for-another-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2011/10/wlEmoticon-smile.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/5i5f1iTsLQU/wlEmoticon-smile.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/10/03/mvp-award-for-another-year/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/5i5f1iTsLQU/wlEmoticon-smile.png" length="1041" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2011/10/wlEmoticon-smile.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Book review: Parallel Programming with Microsoft VS 2010</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/9k4j82CRrMA/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/09/28/book-review-parallel-programming-with-microsoft-vs-2010/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 12:19:15 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/09/28/book-review-parallel-programming-with-microsoft-vs-2010/</guid>
		<description><![CDATA[[Disclaimer: I’ve received a free copy of this book for reviewing] A few days ago, I’ve received a copy of the Parallel Programming With MS VS 2010 book. Before delving into the parallel lib, the books starts by presenting several interesting concepts related with parallel/multithreaded programming. From chapter 2 onwards, it’s all about the Parallel [...]]]></description>
			<content:encoded><![CDATA[<p>[Disclaimer: I’ve received a free copy of this book for reviewing]</p>
<p>A few days ago, I’ve received a copy of the <a href="http://www.amazon.com/Parallel-Programming-Microsoft-Visual-Studio/dp/0735640602/ref=sr_1_1?ie=UTF8&amp;qid=1317210032&amp;sr=8-1">Parallel Programming With MS VS 2010</a> book. Before delving into the parallel lib, the books starts by presenting several interesting concepts related with parallel/multithreaded programming. From chapter 2 onwards, it’s all about the Parallel Lib. Chapter 2 presents several concepts related with adding task parallelism in your apps and Chapter 3 moves forward and tries to present several interesting ideas associated with data parallelism. Chapter 5 wraps it up by presenting several PLINQ related concepts. In Chapter 5, the author presents the concurrent collections and Chapter 6 wraps it up by talking a little bit about the available options for customizing the parallel lib.</p>
<p>I must say that I was really excited when I received the book. After all, multithreading programming is one of the areas that I really like to dig into. Unfortunately, the excitement was gone after reading the first 3/4 chapters. I’ve got two problems with this book: the first is it presents the code step by step and then it shows all the code. In other words, the book has lots of extra pages which really don’t add anything to it. The second issue I have with the book is that it doesn’t go deep enough. The examples shown are rather simple and, in my opinion, don’t really bring much more than the online docs. Overall, I’m giving it a 5/10.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/35DJUTBc68lq6OpsT7AVS_W9P60/0/da"><img src="http://feedads.g.doubleclick.net/~a/35DJUTBc68lq6OpsT7AVS_W9P60/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/35DJUTBc68lq6OpsT7AVS_W9P60/1/da"><img src="http://feedads.g.doubleclick.net/~a/35DJUTBc68lq6OpsT7AVS_W9P60/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/9k4j82CRrMA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/09/28/book-review-parallel-programming-with-microsoft-vs-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/09/28/book-review-parallel-programming-with-microsoft-vs-2010/</feedburner:origLink></item>
		<item>
		<title>More thoughts about the new UI user experience</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/5_kzcHqRcno/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/09/15/more-thoughts-about-the-new-ui-user-experience/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 08:13:23 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/09/15/more-thoughts-about-the-new-ui-user-experience/</guid>
		<description><![CDATA[After playing a little bit more with the new Windows 8 preview, I’m a little more used to the new metro UI. I’ve already removed all the default crap (oops, applications…that’s what I meant) and I’ve added shortcuts for most of the apps I use daily. I’m still trying to figure out how to place [...]]]></description>
			<content:encoded><![CDATA[<p>After playing a little bit more with the new Windows 8 preview, I’m a little more used to the new metro UI. I’ve already removed all the default crap (oops, applications…that’s what I meant) and I’ve added shortcuts for most of the apps I use daily. I’m still trying to figure out how to place a shortcut for a folder or an application which works in “xcopy mode”…I’ll probably have to write some code for that, but I’ll need to dig a little more before being sure.</p>
<p>I do like the new Windows taskbar. It’s really great to be able to see the app icon in the correct screen. Another thing which I like is the new explorer window. Now it comes with a ribon…I’ve heard several complaints about it, but the truth is that I like it. btw, it brings some new things out of the box. For instance, now you can open the cmd from the folder you’re viewing (check the next image). To be honest, I’m a little surprised there’s no power Shell shortcut (come on, this is 2011 and we all love power shell, right? <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Smile" src="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile4.png" />).</p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2011/09/explorer.jpg"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 3px 10px 3px 0px;border-left: 0px;padding-right: 0px" border="0" alt="explorer" src="http://blogs.msmvps.com/luisabreu/files/2011/09/explorer_thumb.jpg" width="275" height="178" /></a></p>
<p>The task manager is another app which has seen several improvements. When you activate the more details window, you’ll end up getting a fair ammount of info presented in a very useful way. For instance, there’s a users tab where you can see the apps associated to each user that is logged in to the machine. Another nice detail is the new copy dialog. </p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2011/09/taskmanager.jpg"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 3px 10px 3px 0px;border-left: 0px;padding-right: 0px" border="0" alt="taskmanager" src="http://blogs.msmvps.com/luisabreu/files/2011/09/taskmanager_thumb.jpg" width="258" height="238" /></a></p>
<p>Another interesting improvemente is the new copy file dialog. As you can see in the next image, now we are faced with a graphic which show the corrente throughput. Even better: we can pause the current copy operation (notice the small icons on the top right corner of the dialog windows). </p>
<p><a href="http://blogs.msmvps.com/luisabreu/files/2011/09/copydialog.jpg"><img style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;margin: 3px 10px 3px 0px;border-left: 0px;padding-right: 0px" border="0" alt="copydialog" src="http://blogs.msmvps.com/luisabreu/files/2011/09/copydialog_thumb.jpg" width="244" height="158" /></a></p>
<p>Another good news: there’s an out of the box mount option for ISO images (almost sure it wasn’t here before)…There surely more, but I’ll leave it for future posts. Stay tuned for more.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/rfdcPB05TWUtOMl9dJBaeyTVVQM/0/da"><img src="http://feedads.g.doubleclick.net/~a/rfdcPB05TWUtOMl9dJBaeyTVVQM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/rfdcPB05TWUtOMl9dJBaeyTVVQM/1/da"><img src="http://feedads.g.doubleclick.net/~a/rfdcPB05TWUtOMl9dJBaeyTVVQM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/5_kzcHqRcno" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/09/15/more-thoughts-about-the-new-ui-user-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile4.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/JqIb57QsOi4/wlEmoticon-smile4.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2011/09/explorer_thumb.jpg" medium="image">
			<media:title type="html">explorer</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2011/09/taskmanager_thumb.jpg" medium="image">
			<media:title type="html">taskmanager</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2011/09/copydialog_thumb.jpg" medium="image">
			<media:title type="html">copydialog</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/09/15/more-thoughts-about-the-new-ui-user-experience/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/JqIb57QsOi4/wlEmoticon-smile4.png" length="1046" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile4.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Windows 8 first impressions</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/LT6qZ7KrYDQ/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/09/14/windows-8-first-impressions/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 21:35:34 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[Windows8]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/09/14/windows-8-first-impressions/</guid>
		<description><![CDATA[I’ve decided to use it in my home machine…couldn’t resist it, you know The first impressions are positive, though I’m not sure if this metro thingy is something I want to use in my day to day work. I would really be glad to end up with slick and fast UI + tools. After all, [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve decided to use it in my home machine…couldn’t resist it, you know <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Smile" src="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile3.png"></p>
<p>The first impressions are positive, though I’m not sure if this metro thingy is something I want to use in my day to day work. I would really be glad to end up with slick and fast UI + tools. After all, I’m a&nbsp; dev, not a game player. So, how do I turn it off? If there’s a way, please share it with me <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Smile" src="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile3.png"></p>
<p>There’s one thing that pissed me: no more Windows menu (you know, the one that was shown when you hit the windows key…). So how do I hibernate my pc now? I’ve already changed the default power plan and I’ve added the hibernate option to the shut down options menu…but that menu is no longer available and the window key will redirect you between the desktop and the metro UI. The only way I managed to see this shut down options was when I hit ctrl+alt+del and stumbled upon a power off icon…oh well, let’s see how things go after using it for another day…</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/PdS6zyt5DifHfWOErrnunVcQOBc/0/da"><img src="http://feedads.g.doubleclick.net/~a/PdS6zyt5DifHfWOErrnunVcQOBc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/PdS6zyt5DifHfWOErrnunVcQOBc/1/da"><img src="http://feedads.g.doubleclick.net/~a/PdS6zyt5DifHfWOErrnunVcQOBc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/LT6qZ7KrYDQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/09/14/windows-8-first-impressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile3.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/-tSu0_W3z-Q/wlEmoticon-smile3.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
		<media:content url="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile3.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/09/14/windows-8-first-impressions/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/-tSu0_W3z-Q/wlEmoticon-smile3.png" length="1046" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile3.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Exceptions in .NET– part VII</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/P5wfJXQ82WE/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/09/13/exceptions-in-net-part-vii/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 20:58:28 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/09/13/exceptions-in-net-part-vii/</guid>
		<description><![CDATA[Before going on, I need to confess one thing: I’m really frustrated! Why? simple: I was watching the damn build keynote and it stopped…right in the middle of the whole JS app for Windows 8…oh well, it’s probably a sign that it’s time to go back to my blog… As you probably recall, in the [...]]]></description>
			<content:encoded><![CDATA[<p>Before going on, I need to confess one thing: I’m really frustrated! Why? simple: I was watching the damn build keynote and it stopped…right in the middle of the whole JS app for Windows 8…oh well, it’s probably a sign that it’s time to go back to my blog…</p>
<p>As you probably recall, in the previous post I’ve started presenting some guidelines for working with exceptions in C#. Today, I’ll keep doing that and I’ll introduce another guideline: it’s ok to catch an exception and re-throw it as “something” else if:</p>
<ul>
<li>you handle only the exceptions you know how to</li>
<li>don’t forget to pass the old exception as the inner one in the new one.</li>
</ul>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background-color: #000000;overflow: auto;padding: 2px 5px"><span style="color:#f3f3f3">Person GetPerson(Int32 id){</span><br /> <span style="color:#f3f3f3">    </span><span style="color:#a2c4fd">try</span><span style="color:#f3f3f3"> {</span><br /> <span style="color:#f3f3f3">        </span><span style="color:#75ffa2">//open SQL Server database</span><br /> <span style="color:#f3f3f3">        </span><span style="color:#75ffa2">//can throw SqlException</span><br /> <span style="color:#f3f3f3">    }</span><br /> <span style="color:#f3f3f3">    </span><span style="color:#a2c4fd">catch</span><span style="color:#f3f3f3">(SqlException ex) {</span><br /> <span style="color:#f3f3f3">        </span><span style="color:#75ffa2">//log the error</span><br /> <span style="color:#f3f3f3">        </span><span style="color:#75ffa2">//re-throw it as something else</span><br /> <span style="color:#f3f3f3">        </span><span style="color:#a2c4fd">throw</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">new</span><span style="color:#f3f3f3"> InexistingPersonException(id, ex);</span><br /> <span style="color:#f3f3f3">    }</span><br /> <span style="color:#f3f3f3">}</span></div>
</p></div>
</p></div>
<p>Since we’re opening a database connection, we know we might end up with an SqlException whenever we open that database connection. Getting the information from a database is really an implementation detail and that’s probably someone who is consuming your code doesn’t need to know about.</p>
<p>Another interesting to notice is that I’ve passed the caught exception to the InexistingPersonException constructor. By doing this, I guarantee that the original exception isn’t lost and that may help me find the problem when someone calls back and complains about that exception.</p>
<p>Oh look, it’s saying that the day 1 keynote video will be available shortly! It’s probably best to wrap this post up right now <img style="border-bottom-style: none;border-left-style: none;border-top-style: none;border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile2.png"></p>
<p>And that’s it for now. Stay tuned for more.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/MHYsX6D7VbO4B8loGE-Ptcxwmp8/0/da"><img src="http://feedads.g.doubleclick.net/~a/MHYsX6D7VbO4B8loGE-Ptcxwmp8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/MHYsX6D7VbO4B8loGE-Ptcxwmp8/1/da"><img src="http://feedads.g.doubleclick.net/~a/MHYsX6D7VbO4B8loGE-Ptcxwmp8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/P5wfJXQ82WE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/09/13/exceptions-in-net-part-vii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile2.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/VejgXM4aI3A/wlEmoticon-smile2.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/09/13/exceptions-in-net-part-vii/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/VejgXM4aI3A/wlEmoticon-smile2.png" length="1041" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile2.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Exceptions in .NET– part VI</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/H8AVgCnaQcc/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/09/13/exceptions-in-net-part-vi/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 23:13:49 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/09/13/exceptions-in-net-part-vi/</guid>
		<description><![CDATA[As promised, today I’ll start presenting some interesting guidelines you should follow when working with exceptions. If there’s one guideline you should *always* follow, this is it: don’t catch every exception there is…especially if you’re developing libraries which will be used by other developers. It’s important to realize that whenever you catch an exception, you’re [...]]]></description>
			<content:encoded><![CDATA[<p>As promised, today I’ll start presenting some interesting guidelines you should follow when working with exceptions. If there’s one guideline you should *always* follow, this is it: don’t catch every exception there is…especially if you’re developing libraries which will be used by other developers.</p>
<p>It’s important to realize that whenever you catch an exception, you’re saying that you’re expecting it and you know how to deal with it. In my experience, it’s far too common to see code like this (btw, I’ve used it before in previous posts, which was probably a bad idea…anyways, don’t do it<img class="wlEmoticon wlEmoticon-smile" style="border-style: none" src="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile1.png" alt="Smile" />):</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background-color: #000000;overflow: auto;padding: 2px 5px"><span style="color: #a2c4fd">try</span><span style="color: #f3f3f3"> {</span><br />
<span style="color: #f3f3f3">    </span><span style="color: #75ffa2">//some code</span><br />
<span style="color: #f3f3f3">}</span><br />
<span style="color: #a2c4fd">catch</span><span style="color: #f3f3f3">(</span><span style="color: #fdf8b9">Exception</span><span style="color: #f3f3f3"> ex) {</span><br />
<span style="color: #f3f3f3">    </span><span style="color: #75ffa2">//just &#8220;eat it&#8221;</span><br />
<span style="color: #f3f3f3">}</span></div>
</div>
</div>
<p>Whenever you write code like this, you’re saying that you know how to handle all the exceptions that might be thrown. Really? Are you sure about that? What do you expect to do whenever you get an <a href="http://msdn.microsoft.com/en-us/library/system.outofmemoryexception.aspx">OutOfMemoryException</a>? Do you really know to handle it? And what about all the other exceptions which might be thrown? Things are even worse if you do something like this in a library which is going to be used by other developers. For starters, it’s difficult to know how the application which is consuming your library will respond to exceptions. Probably it can do more than you…probably, not…And that’s why it’s vital to let those exceptions your type can’t handle flow through the call stack. The worse thing that will happen is getting an unhandled exception which ends up killing the process. And this is not such a bad thing because 1.) most unhandled exceptions will probably be caught during development and 2.) sometimes ending the process is the best way to ensure that no data is corrupted.</p>
<p>Notice that the problem isn’t really catching any exception. It’s swallowing it! So, if you need to log all exceptions and you’re writing library code, then this is the correct way to do it:</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background-color: #000000;overflow: auto;padding: 2px 5px"><span style="color: #a2c4fd">try</span><span style="color: #f3f3f3"> {</span><br />
<span style="color: #f3f3f3">    </span><span style="color: #75ffa2">//some code</span><br />
<span style="color: #f3f3f3">}</span><br />
<span style="color: #a2c4fd">catch</span><span style="color: #f3f3f3">(</span><span style="color: #fdf8b9">Exception</span><span style="color: #f3f3f3"> ex) {</span><br />
<span style="color: #f3f3f3">    </span><span style="color: #75ffa2">//just log it</span><br />
<span style="color: #f3f3f3">    </span><span style="color: #a2c4fd">throw</span><span style="color: #f3f3f3">;</span><br />
<span style="color: #f3f3f3">}</span></div>
</div>
</div>
<p>And now you’ll get your logging and you’re letting the exception flow through the call stack without changing its origin. And everybody is happy and you can go home an enjoy dinner in family…</p>
<p>And that’s it for now. Stay tuned for more.
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/VJE0S91SnMRMz0Xq5PUXG3pbD50/0/da"><img src="http://feedads.g.doubleclick.net/~a/VJE0S91SnMRMz0Xq5PUXG3pbD50/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/VJE0S91SnMRMz0Xq5PUXG3pbD50/1/da"><img src="http://feedads.g.doubleclick.net/~a/VJE0S91SnMRMz0Xq5PUXG3pbD50/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/H8AVgCnaQcc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/09/13/exceptions-in-net-part-vi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile1.png" />
		<media:content url="http://feedproxy.google.com/~r/Laneten/~5/qq7BQQIe3Iw/wlEmoticon-smile1.png" medium="image">
			<media:title type="html">Smile</media:title>
		</media:content>
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/09/13/exceptions-in-net-part-vi/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/Laneten/~5/qq7BQQIe3Iw/wlEmoticon-smile1.png" length="1041" type="image/jpg" /><feedburner:origEnclosureLink>http://blogs.msmvps.com/luisabreu/files/2011/09/wlEmoticon-smile1.png</feedburner:origEnclosureLink></item>
		<item>
		<title>Exceptions in .NET–part V</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/rA3auAKfcaE/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/09/09/exceptions-in-netpart-v/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 12:04:52 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/09/09/exceptions-in-netpart-v/</guid>
		<description><![CDATA[When someone with lots of experience in Win32 programming starts using .NET, they tend to be shocked with the regular use of exceptions. In fact, they tend to ask why do we define APIs which don’t return error codes and rely heavily on exceptions. Well, it’s a matter of “culture”. Notice that .NET and OO [...]]]></description>
			<content:encoded><![CDATA[<p>When someone with lots of experience in Win32 programming starts using .NET, they tend to be shocked with the regular use of exceptions. In fact, they tend to ask why do we define APIs which don’t return error codes and rely heavily on exceptions. Well, it’s a matter of “culture”. Notice that .NET and OO allows a developer to be very productive. For instance, just look at all those fluent APIs we have. For instance, here’s a snippet from Fluent NH:</p>
<div class="wlWriterEditableSmartContent" style="margin: 0px;float: none;padding: 0px">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background-color: #000000;overflow: auto;padding: 2px 5px"><span style="color: #f3f3f3">HasMany( pat =&gt; pat.Documentos)</span><br />
<span style="color: #f3f3f3">.Access.CamelCaseField( </span><span style="color: #fdf8b9">Prefix</span><span style="color: #f3f3f3">.Underscore )</span><br />
<span style="color: #f3f3f3">.AsBag( )</span><br />
<span style="color: #f3f3f3">.Cascade.All( )</span><br />
<span style="color: #f3f3f3">.Inverse(  )</span><br />
<span style="color: #f3f3f3">.KeyColumn( </span><span style="color: #6afd51">&#8220;IdPats&#8221;</span><span style="color: #f3f3f3"> )</span><br />
<span style="color: #f3f3f3">.Not.LazyLoad( );</span></div>
</div>
</div>
<p>When I write code like this, I’m assuming that all of those methods calls will be executed without errors. Code would need to be much more tedious if we had to check for errors in all those calls. I mean, we have lots of things going on here and we didn’t even went into the IL… It’s really hard to write defensive code for all of this and, in this case, I’m ok with getting an exception in the mappings that ends up terminating my app. Even though this might be a chock for people coming from Win32, the truth is that the productivity gains from doing this kind of things makes it “all right” to rely heavily in exceptions when you’re writing ,NET code.</p>
<p>So, we simply rely in catching known exceptions and understanding that things will go well most of the times. Notice, however, that we do get several interesting assurances from the CLR to mitigate state corruption:</p>
<ul>
<li>a thread can’t be aborted when executing code is inside a catch or finally block;</li>
<li>we can rely on CERs (constrained execution regions) to reduce potential exceptions (more about this in a future post);</li>
</ul>
<p>Even though these assurances do help, there will be times when you end up with corrupted data. In these cases, you probably should terminate your app’s process immediately. I’d say that the bottom line is that managed code has a different philosophy  and it probably is a good option if you’re writing  applications which can be terminated when data corruption occurs.</p>
<p>And that’s it for now. On the next post I’ll present some of the guidelines I try to follow when working with exceptions. Stay tuned for more.
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/g1Ln7TXemokK7udnbv_9q_aEJ4A/0/da"><img src="http://feedads.g.doubleclick.net/~a/g1Ln7TXemokK7udnbv_9q_aEJ4A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/g1Ln7TXemokK7udnbv_9q_aEJ4A/1/da"><img src="http://feedads.g.doubleclick.net/~a/g1Ln7TXemokK7udnbv_9q_aEJ4A/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/rA3auAKfcaE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/09/09/exceptions-in-netpart-v/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/09/09/exceptions-in-netpart-v/</feedburner:origLink></item>
		<item>
		<title>Exceptions in .NET–part IV</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/sD2ZUd6VZgQ/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/09/09/exceptions-in-netpart-iv/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 11:24:01 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/09/09/exceptions-in-netpart-iv/</guid>
		<description><![CDATA[In one of the previous posts, I’ve mentioned that the CLR allows an instance of any type to be thrown for an exception (notice that this isn’t allowed by the CLS). In practice, this means that you should be able to throw ints or strings from CLR languages which allow you to write non-CLS compliant [...]]]></description>
			<content:encoded><![CDATA[<p>In one of the <a href="http://blogs.msmvps.com/luisabreu/blog/2011/09/08/exceptions-in-net-part-ii/">previous</a> posts, I’ve mentioned that the CLR allows an instance of any type to be thrown for an exception (notice that this isn’t allowed by the CLS). In practice, this means that you should be able to throw ints or strings from CLR languages which allow you to write non-CLS compliant code. Since most people will use C# or VB.NET, they think that they’re only allowed to handle Exception derived exceptions and so they think that using the Exception type in a catch block is enough for getting all the exceptions. In other words, people think they would catch all the exceptions by writing this code:</p>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background-color: #000000;overflow: auto;padding: 2px 5px"><span style="color:#a2c4fd">try</span><span style="color:#f3f3f3"> {</span><br />     <span style="color:#f3f3f3"></span><span style="color:#75ffa2">//some code</span><br /> <span style="color:#f3f3f3">}</span><br /> <span style="color:#a2c4fd">catch</span><span style="color:#f3f3f3">(</span><span style="color:#fdf8b9">Exception</span><span style="color:#f3f3f3"> ex) {</span><br />     <span style="color:#f3f3f3"></span><span style="color:#75ffa2">//catches everything!</span><br />     <span style="color:#f3f3f3"></span><span style="color:#75ffa2">//really???</span><br /> <span style="color:#f3f3f3">}</span></div>
</p></div>
</p></div>
<p>And life was good until you needed to, say, consume some managed C++ code (which, for instance, interacted with some legacy code) that would end up throwing an exception which wasn’t derived from the base Exception type. There was a solution for this problem:</p>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background-color: #000000;overflow: auto;padding: 2px 5px"><span style="color:#a2c4fd">try</span><span style="color:#f3f3f3"> {</span><br />     <span style="color:#f3f3f3"></span><span style="color:#75ffa2">//some code</span><br /> <span style="color:#f3f3f3">}</span><br /> <span style="color:#a2c4fd">catch</span><span style="color:#f3f3f3">(</span><span style="color:#fdf8b9">Exception</span><span style="color:#f3f3f3"> ex) {</span><br />     <span style="color:#f3f3f3"></span><span style="color:#75ffa2">//catches everything!</span><br />     <span style="color:#f3f3f3"></span><span style="color:#75ffa2">//really??? the answer is nop (&lt;2.0)</span><br /> <span style="color:#f3f3f3">}</span><br /> <span style="color:#a2c4fd">catch</span><span style="color:#f3f3f3"> {</span><br />     <span style="color:#f3f3f3"></span><span style="color:#75ffa2">//but this does catch everything </span><br />     <span style="color:#f3f3f3"></span><span style="color:#75ffa2">//(in all versions)</span><br /> <span style="color:#f3f3f3">}</span></div>
</p></div>
</p></div>
<p>By using the catch all block, you are, in fact, catching all exceptions. In other words, the first catch block catches all the CLS compatible exceptions (ie, all Exception derived exceptions) and the second ends up catching all non-CLS compatible exceptions.</p>
<p>Now, the *GOOD NEWS*: you only need to worry about this if you’re running .NET 1.1. And that’s because MS recognized that it needed to “solve” this problem and introduced the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.runtimewrappedexception.aspx">RuntimeWrappedException</a> class. Whenever you add the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.runtimecompatibilityattribute.aspx">RuntimeCompatibilityAttribute</a> to an assembly (which is done automatically by the C# compiler), all non-CLS compliant exceptions are wrapped by a RuntimeWrappedException object. This means that from 2.0 onwards, you can really catch all exceptions by using the 1st code snippet I’ve shown. Btw, if you want you can get the real thrown exception by accessing the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.runtimewrappedexception.wrappedexception.aspx">WrappedException</a> property (notice that it references an Object and not an exception).</p>
<p>And that’s it for now. Stay tuned for more.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/OLwxs9V-hooaakentKa08kdmbog/0/da"><img src="http://feedads.g.doubleclick.net/~a/OLwxs9V-hooaakentKa08kdmbog/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/OLwxs9V-hooaakentKa08kdmbog/1/da"><img src="http://feedads.g.doubleclick.net/~a/OLwxs9V-hooaakentKa08kdmbog/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/sD2ZUd6VZgQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/09/09/exceptions-in-netpart-iv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/09/09/exceptions-in-netpart-iv/</feedburner:origLink></item>
		<item>
		<title>Exceptions in .NET– part III</title>
		<link>http://feedproxy.google.com/~r/Laneten/~3/jpTSgzAQoHQ/</link>
		<comments>http://blogs.msmvps.com/luisabreu/blog/2011/09/08/exceptions-in-net-part-iii/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 12:34:29 +0000</pubDate>
		<dc:creator>luisabreu</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Basics]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blogs.msmvps.com/luisabreu/blog/2011/09/08/exceptions-in-net-part-iii/</guid>
		<description><![CDATA[As I’ve said before, you’re supposed to throw an exception when a method cannot complete its task in the way it’s supposed to do it. Before throwing an exception, you should consider two things: which type of exception should you throw? What’s the message that&#160; you’re going to pass into the Exception constructor? The first [...]]]></description>
			<content:encoded><![CDATA[<p>As I’ve <a href="http://blogs.msmvps.com/luisabreu/blog/2011/09/07/exceptions-in-netpart-i/">said before</a>, you’re supposed to throw an exception when a method cannot complete its task in the way it’s supposed to do it. Before throwing an exception, you should consider two things:</p>
<ul>
<li>which type of exception should you throw? </li>
<li>What’s the message that&#160; you’re going to pass into the Exception constructor?</li>
</ul>
<p>The first step is really important: you should choose an exception type which is meaningful. This is an important decision because you need to consider what will happen when you throw that exception. You should start by looking at the predefined exceptions introduced by .NET. If none of those brings the semantics you’re looking for, then you should probably create a new one. In this case, I’d say that you’re better off by reusing Exception as the base type of the new exception (in fact, if you need to create several exceptions for a specific application, then it’s best to make the hierarchy shallow and wide, ie, with as few base classes as possible).</p>
<p>After choosing the exception type, you should also give some thought about the message you’re passing in when you instantiate that exception. As I’ve said before, this should be a technical message, so don’t be afraid to get into details. Whenever an exception isn’t caught, it will end up as an unhandled exception. In practice, this means that it will probably end up in the event log and, when that happens, this message should be a good starting point for us to know how to handle the current problem. Since this message shouldn’t really be shown to the user, then you probably don’t need to worry about localizing it.</p>
<p>Having said this, I must confess that there is a place where I don’t follow these guidelines: whenever I need to develop WCF services, I tend to catch eventual expected exceptions and transform them into new exceptions, with user friendly messages tackled into its, which are propagated into the client (WPF or Silverlight).</p>
<p>If you decide to create a new Exception derived class, then you can expect to have some tedious work ahead of you. For instance, suppose you’ve got a method which changes the value of a property. Furthermore, suppose you want to improve the semantics of your code by generating an IncorrectNameException whenever the string that is passed in is not limited to 30 characters…In that case, the first thing we need to do is build a new Exception derived class:</p>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background-color: #000000;overflow: auto;padding: 2px 5px"><span style="color:#f3f3f3">[</span><span style="color:#fdf8b9">Serializable</span><span style="color:#f3f3f3">]</span><br /> <span style="color:#a2c4fd">public</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">sealed</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">class</span><span style="color:#f3f3f3"> </span><span style="color:#fdf8b9">IncorrectNameException</span><span style="color:#f3f3f3">:</span><span style="color:#fdf8b9">Exception</span><span style="color:#f3f3f3">, </span><span style="color:#2b91af">ISerializable</span><span style="color:#f3f3f3"> {</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">private</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">readonly</span><span style="color:#f3f3f3"> </span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3"> _incorrectName;</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">public</span><span style="color:#f3f3f3"> IncorrectNameException(</span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3"> incorrectName = </span><span style="color:#a2c4fd">null</span><span style="color:#f3f3f3">, </span><br />         <span style="color:#f3f3f3"></span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3"> message = </span><span style="color:#a2c4fd">null</span><span style="color:#f3f3f3">, </span><br />         <span style="color:#f3f3f3"></span><span style="color:#fdf8b9">Exception</span><span style="color:#f3f3f3"> innerException = </span><span style="color:#a2c4fd">null</span><span style="color:#f3f3f3">)</span><br />     <span style="color:#f3f3f3">:</span><span style="color:#a2c4fd">base</span><span style="color:#f3f3f3">(message, innerException) {</span><br />         <span style="color:#f3f3f3">_incorrectName = incorrectName;</span><br />     <span style="color:#f3f3f3">}</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">private</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">const</span><span style="color:#f3f3f3"> </span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3"> serializedFieldName = </span><span style="color:#6afd51">&quot;incorrectName&quot;</span><span style="color:#f3f3f3">;</span><br />     <span style="color:#f3f3f3">[</span><span style="color:#fdf8b9">SecurityPermission</span><span style="color:#f3f3f3">(</span><span style="color:#2b91af">SecurityAction</span><span style="color:#f3f3f3">.LinkDemand, </span><br />         <span style="color:#f3f3f3">Flags = </span><span style="color:#2b91af">SecurityPermissionFlag</span><span style="color:#f3f3f3">.SerializationFormatter)]</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">private</span><span style="color:#f3f3f3"> IncorrectNameException( </span><span style="color:#fdf8b9">SerializationInfo</span><span style="color:#f3f3f3"> info, </span><br />         <span style="color:#f3f3f3"></span><span style="color:#fdf8b9">StreamingContext</span><span style="color:#f3f3f3"> context ) </span><br />         <span style="color:#f3f3f3">: </span><span style="color:#a2c4fd">base</span><span style="color:#f3f3f3">( info, context ) {</span><br />         <span style="color:#f3f3f3">_incorrectName = ( </span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3"> )info.GetValue( </span><br />                     <span style="color:#f3f3f3">serializedFieldName, </span><span style="color:#a2c4fd">typeof</span><span style="color:#f3f3f3">(</span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3">) );</span><br />     <span style="color:#f3f3f3">}</span></p>
<p>     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">public</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">override</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">void</span><span style="color:#f3f3f3"> GetObjectData(</span><span style="color:#fdf8b9">SerializationInfo</span><span style="color:#f3f3f3"> info, </span><br />         <span style="color:#f3f3f3"></span><span style="color:#fdf8b9">StreamingContext</span><span style="color:#f3f3f3"> context) {</span><br />         <span style="color:#f3f3f3">info.AddValue( serializedFieldName, _incorrectName );</span><br />         <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">base</span><span style="color:#f3f3f3">.GetObjectData(info, context);</span><br />     <span style="color:#f3f3f3">}</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">public</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">override</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">string</span><span style="color:#f3f3f3"> Message {</span><br />         <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">get</span><span style="color:#f3f3f3"> {</span><br />             <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">return</span><span style="color:#f3f3f3"> </span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3">.IsNullOrEmpty( _incorrectName )</span><br />                        <span style="color:#f3f3f3">? </span><span style="color:#a2c4fd">base</span><span style="color:#f3f3f3">.Message</span><br />                        <span style="color:#f3f3f3">: </span><span style="color:#a2c4fd">base</span><span style="color:#f3f3f3">.Message + </span><span style="color:#6afd51">&quot;&#8211;&gt;&quot;</span><span style="color:#f3f3f3"> + _incorrectName;</span><br />         <span style="color:#f3f3f3">}</span><br />     <span style="color:#f3f3f3">}</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">public</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">override</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">bool</span><span style="color:#f3f3f3"> Equals(</span><span style="color:#a2c4fd">object</span><span style="color:#f3f3f3"> obj) {</span><br />         <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">var</span><span style="color:#f3f3f3"> aux = obj </span><span style="color:#a2c4fd">as</span><span style="color:#f3f3f3"> </span><span style="color:#fdf8b9">IncorrectNameException</span><span style="color:#f3f3f3">;</span><br />         <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">if</span><span style="color:#f3f3f3">(aux == </span><span style="color:#a2c4fd">null</span><span style="color:#f3f3f3">) {</span><br />             <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">return</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">false</span><span style="color:#f3f3f3">;</span><br />         <span style="color:#f3f3f3">}</span><br />         <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">return</span><span style="color:#f3f3f3"> _incorrectName == aux._incorrectName &amp;&amp; </span><br />                                  <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">base</span><span style="color:#f3f3f3">.Equals( obj );</span><br />     <span style="color:#f3f3f3">}</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">public</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">override</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">int</span><span style="color:#f3f3f3"> GetHashCode() {</span><br />         <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">return</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">base</span><span style="color:#f3f3f3">.GetHashCode();</span><br />     <span style="color:#f3f3f3">}</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">public</span><span style="color:#f3f3f3"> </span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3"> IncorrectName { </span><span style="color:#a2c4fd">get</span><span style="color:#f3f3f3"> { </span><span style="color:#a2c4fd">return</span><span style="color:#f3f3f3"> _incorrectName; } }</span><br /> <span style="color:#f3f3f3">}</span></div>
</p></div>
</p></div>
<p>The first interesting point is that we should always make the new exception serializable. Besides applying the Serializable attribute, I’ve also implemented the interface and overrode the GetObjectData inherited from the base Exception class (the serialization part is simple and it will only save/restore the value of the _incorrectName field). In order to personalize the message, I’ve also opted for overriding the Message property so that it appends the name of the field to the message that is passed in the constructor. Btw, and since I’ve mentioned the constructor, notice how I’m taking advantage of optional parameters (instead of writing three constructors, I’m writing just one! – the second one is only there for deserialization purposes). I’ve also overridden the Equals method (and the GetHashCode) to ensure that the comparison between two instances of this type is perfomed correctly.</p>
<p>The code isn’t really complicated, but, as I’ve said before, is rather tedious. If you want, you can also use generics to create a new generic type which you can reuse for all your exceptions types (in this case, it’s clearly a good idea to transform the String parameter into a generic type parameter!). </p>
<p>After defining the class, we’re ready to throw our custom exceptions:</p>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterEditableSmartContent">
<div style="border: #000080 1px solid;color: #000;font-family: 'Courier New', Courier, Monospace;font-size: 10pt">
<div style="background-color: #000000;overflow: auto;padding: 2px 5px"><span style="color:#a2c4fd">private</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">const</span><span style="color:#f3f3f3"> </span><span style="color:#fdf8b9">Int32</span><span style="color:#f3f3f3"> _maxNameSize = 30;</span><br /> <span style="color:#a2c4fd">static</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">void</span><span style="color:#f3f3f3"> ChangeName(</span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3"> name) {</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">if</span><span style="color:#f3f3f3">(</span><span style="color:#fdf8b9">String</span><span style="color:#f3f3f3">.IsNullOrEmpty( name ) || </span><br />         <span style="color:#f3f3f3">name.Length &gt; _maxNameSize) {</span><br />         <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">throw</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">new</span><span style="color:#f3f3f3"> </span><span style="color:#fdf8b9">IncorrectNameException</span><span style="color:#f3f3f3">( name, </span><span style="color:#6afd51">&quot;The passed in name doesn&#039;t comply with the maximum name size rule&quot;</span><span style="color:#f3f3f3"> );</span><br />     <span style="color:#f3f3f3">}</span><br />     <span style="color:#f3f3f3"></span><span style="color:#75ffa2">//rest of the code goes here</span><br /> <span style="color:#f3f3f3">}</span><br /> <span style="color:#a2c4fd">private</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">static</span><span style="color:#f3f3f3"> </span><span style="color:#a2c4fd">void</span><span style="color:#f3f3f3"> Main( </span><span style="color:#a2c4fd">string</span><span style="color:#f3f3f3">[] args ) {</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">try</span><span style="color:#f3f3f3"> {</span><br />         <span style="color:#f3f3f3">ChangeName( </span><span style="color:#6afd51">&quot;This is a really really huge name so it will probably trigger the exception&quot;</span><span style="color:#f3f3f3"> );</span><br />     <span style="color:#f3f3f3">}</span><br />     <span style="color:#f3f3f3"></span><span style="color:#a2c4fd">catch</span><span style="color:#f3f3f3">(</span><span style="color:#fdf8b9">IncorrectNameException</span><span style="color:#f3f3f3"> ex) {</span><br />         <span style="color:#f3f3f3"></span><span style="color:#fdf8b9">Console</span><span style="color:#f3f3f3">.WriteLine( ex.Message);</span><br />     <span style="color:#f3f3f3">}</span><br /> <span style="color:#f3f3f3">}</span></div>
</p></div>
</p></div>
<p>I couldn’t end this post without mentioning that I’d wouldn’t really create this new exception type in a “real world” application (at least, not in my domain code). The reason is simple: .NET already offers an ArgumentException class which is more than adequate for this kind of error. In fact, I would leave these verifications for the <a href="http://msdn.microsoft.com/en-us/devlabs/dd491992">code contract framework</a>, which does a very good job in verifying pre and post conditions and invariants!</p>
<p>And that’s it for now. Stay tuned for more.</p>
<p><font color="#B4B4B4" size="-2">Post Footer automatically generated by <a href="http://www.freetimefoto.com/add_post_footer_plugin_wordpress" style="color: #B4B4B4; text-decoration:underline;">Add Post Footer Plugin</a> for wordpress.</font></p>

<p><a href="http://feedads.g.doubleclick.net/~a/IpPmsBNY9Eo3AOX5xfnbMfGFsAE/0/da"><img src="http://feedads.g.doubleclick.net/~a/IpPmsBNY9Eo3AOX5xfnbMfGFsAE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/IpPmsBNY9Eo3AOX5xfnbMfGFsAE/1/da"><img src="http://feedads.g.doubleclick.net/~a/IpPmsBNY9Eo3AOX5xfnbMfGFsAE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Laneten/~4/jpTSgzAQoHQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.msmvps.com/luisabreu/blog/2011/09/08/exceptions-in-net-part-iii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	<feedburner:origLink>http://blogs.msmvps.com/luisabreu/blog/2011/09/08/exceptions-in-net-part-iii/</feedburner:origLink></item>
	</channel>
</rss>

