<?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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Buu Nguyen's Blog</title>
	
	<link>http://www.buunguyen.net/blog</link>
	<description>Thoughts on Software Engineering</description>
	<lastBuildDate>Fri, 06 Jan 2012 07:47:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/BuuNguyensBlog" /><feedburner:info uri="buunguyensblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>BuuNguyensBlog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Paint War is released!!</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/Rn8MOz0psis/paint-war-is-released.html</link>
		<comments>http://www.buunguyen.net/blog/paint-war-is-released.html#comments</comments>
		<pubDate>Thu, 22 Dec 2011 12:30:49 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[mobiles]]></category>
		<category><![CDATA[paint war]]></category>
		<category><![CDATA[releases]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=620</guid>
		<description><![CDATA[This is the release month!  After qTrace, another product I spent much mind and heart on for many months has just been released: Paint War, the super fun and addicted (shamelessly biased!) iPad game.  Visit Paint War&#8217;s website or iTunes App Store to learn more about Paint War.  And don&#8217;t forget to give it [...]]]></description>
			<content:encoded><![CDATA[<p>This is the release month!  After <a href="http://www.buunguyen.net/blog/qtrace-is-released.html">qTrace</a>, another product I spent much mind and heart on for many months has just been released: <a href="http://itunes.apple.com/us/app/paint-war/id489396284?ls=1&amp;mt=8">Paint War</a>, the super fun and addicted (shamelessly biased!) iPad game.  Visit <a href="http://apps.kms-technology.com/paintwar/">Paint War&#8217;s website</a> or <a href="http://itunes.apple.com/us/app/paint-war/id489396284?ls=1&amp;mt=8">iTunes App Store</a> to learn more about Paint War.  And don&#8217;t forget to give it a try!</p>
<p><img src="http://apps.kms-technology.com/paintwar/images/screenshot_1.png" alt="Paint War" /></p>
<p><img src="http://apps.kms-technology.com/paintwar/images/screenshot_2.png" alt="PaintWar" /></p>
<p><img src="http://apps.kms-technology.com/paintwar/images/screenshot_3.png" alt="PaintWar" /></p>
<p><img src="http://apps.kms-technology.com/paintwar/images/screenshot_4.png" alt="PaintWar" /></p>
<p><img src="http://apps.kms-technology.com/paintwar/images/screenshot_5.png" alt="PaintWar" /></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=Rn8MOz0psis:cr1l0EAxnh0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=Rn8MOz0psis:cr1l0EAxnh0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=Rn8MOz0psis:cr1l0EAxnh0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=Rn8MOz0psis:cr1l0EAxnh0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=Rn8MOz0psis:cr1l0EAxnh0:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/paint-war-is-released.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/paint-war-is-released.html</feedburner:origLink></item>
		<item>
		<title>qTrace is released!</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/C8eTaQCltZU/qtrace-is-released.html</link>
		<comments>http://www.buunguyen.net/blog/qtrace-is-released.html#comments</comments>
		<pubDate>Mon, 05 Dec 2011 03:57:10 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[QASymphony]]></category>
		<category><![CDATA[defect reporting]]></category>
		<category><![CDATA[qas]]></category>
		<category><![CDATA[sdlc]]></category>
		<category><![CDATA[software engineering]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=612</guid>
		<description><![CDATA[After quite some time working on it, we finally released qTrace 1.0, the defect reporting tool you want to have  .

To find out more and download the trial version, please visit http://www.qasymphony.com.
]]></description>
			<content:encoded><![CDATA[<p>After quite some time working on it, we finally released qTrace 1.0, the defect reporting tool you want to have <img src='http://www.buunguyen.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p><iframe width="560" height="315" src="http://www.youtube.com/embed/P43ZJhSdZGI" frameborder="0" allowfullscreen></iframe></p>
<p>To find out more and download the trial version, please visit <a href="http://www.qasymphony.com/">http://www.qasymphony.com</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=C8eTaQCltZU:glan1iWEyZ8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=C8eTaQCltZU:glan1iWEyZ8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=C8eTaQCltZU:glan1iWEyZ8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=C8eTaQCltZU:glan1iWEyZ8:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=C8eTaQCltZU:glan1iWEyZ8:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/qtrace-is-released.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/qtrace-is-released.html</feedburner:origLink></item>
		<item>
		<title>Pro iOS Apps Performance Optimization</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/LC5zCHaEus4/pro-ios-apps-performance-optimization.html</link>
		<comments>http://www.buunguyen.net/blog/pro-ios-apps-performance-optimization.html#comments</comments>
		<pubDate>Sat, 03 Dec 2011 03:59:00 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=610</guid>
		<description><![CDATA[My former student and colleague, Khang Vo, has just published a book on iOS performance optimization.  Congratulations to him!

]]></description>
			<content:encoded><![CDATA[<p>My former student and colleague, <a href="http://vodkhang.com/">Khang Vo</a>, has just published a book on iOS performance optimization.  Congratulations to him!</p>
<p><a href="http://www.amazon.com/Apps-Performance-Optimization-Professional-Apress/dp/1430237171"><img src="http://ecx.images-amazon.com/images/I/41Dpn9KKwRL._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA300_SH20_OU01_.jpg" alt="" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=LC5zCHaEus4:-qskOnprv54:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=LC5zCHaEus4:-qskOnprv54:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=LC5zCHaEus4:-qskOnprv54:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=LC5zCHaEus4:-qskOnprv54:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=LC5zCHaEus4:-qskOnprv54:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/pro-ios-apps-performance-optimization.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/pro-ios-apps-performance-optimization.html</feedburner:origLink></item>
		<item>
		<title>Training screen casts (in Vietnamese) about C#, ASP.NET MVC, LINQ and Combres</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/iJk-8VdHvY4/training-screen-casts-in-vietnamese-about-c-asp-net-mvc-linq-and-combres.html</link>
		<comments>http://www.buunguyen.net/blog/training-screen-casts-in-vietnamese-about-c-asp-net-mvc-linq-and-combres.html#comments</comments>
		<pubDate>Mon, 15 Aug 2011 06:00:33 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Technologies]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[screen-casts]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=597</guid>
		<description><![CDATA[The series of MVC/C#/LINQ/Combres screen-casts (in Vietnamese) I produced for Microsoft Vietnam a while a go. Microsoft Vietnam recently allowed CiOne to distribute on their website so that everyone can access for free.

C# 3.0: http://cione.com.vn/Courses/172-1-90
C# 4.0: http://cione.com.vn/Courses/172-1-91
LINQ: http://cione.com.vn/Courses/172-1-92
ASP.NET MVC 2: http://cione.com.vn/Courses/171-1-0
Combres: http://cione.com.vn/Courses/172-1-93

]]></description>
			<content:encoded><![CDATA[<p>The series of MVC/C#/LINQ/Combres screen-casts (in Vietnamese) I produced for Microsoft Vietnam a while a go. Microsoft Vietnam recently allowed CiOne to distribute on their website so that everyone can access for free.</p>
<ul>
<li>C# 3.0: <a href="http://cione.com.vn/Courses/172-1-90">http://cione.com.vn/Courses/172-1-90</a></li>
<li>C# 4.0: <a href="http://cione.com.vn/Courses/172-1-91">http://cione.com.vn/Courses/172-1-91</a></li>
<li>LINQ: <a href="http://cione.com.vn/Courses/172-1-92">http://cione.com.vn/Courses/172-1-92</a></li>
<li>ASP.NET MVC 2: <a href="http://cione.com.vn/Courses/171-1-0">http://cione.com.vn/Courses/171-1-0</a></li>
<li>Combres: <a href="http://cione.com.vn/Courses/172-1-93">http://cione.com.vn/Courses/172-1-93</a></li>
</ul>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=iJk-8VdHvY4:d-lGYMJEh-A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=iJk-8VdHvY4:d-lGYMJEh-A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=iJk-8VdHvY4:d-lGYMJEh-A:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=iJk-8VdHvY4:d-lGYMJEh-A:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=iJk-8VdHvY4:d-lGYMJEh-A:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/training-screen-casts-in-vietnamese-about-c-asp-net-mvc-linq-and-combres.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/training-screen-casts-in-vietnamese-about-c-asp-net-mvc-linq-and-combres.html</feedburner:origLink></item>
		<item>
		<title>On Becoming a Technical Lead</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/C5v2q-CN4MU/on-becoming-a-technical-lead.html</link>
		<comments>http://www.buunguyen.net/blog/on-becoming-a-technical-lead.html#comments</comments>
		<pubDate>Mon, 01 Aug 2011 05:08:16 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[kms]]></category>
		<category><![CDATA[slides]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=591</guid>
		<description><![CDATA[Presentation I gave at the Success in IT Career event organized by KMS Technology last Saturday.
 On Becoming a Technical Lead 
 View more presentations from Buu Nguyen 

]]></description>
			<content:encoded><![CDATA[<p>Presentation I gave at the Success in IT Career event organized by KMS Technology last Saturday.</p>
<div style="width:425px" id="__ss_8741228"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/buunguyen/on-becoming-a-technical-lead" title="On Becoming a Technical Lead" target="_blank">On Becoming a Technical Lead</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/8741228" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/buunguyen" target="_blank">Buu Nguyen</a> </div>
</p></div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=C5v2q-CN4MU:YwTonCTynbo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=C5v2q-CN4MU:YwTonCTynbo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=C5v2q-CN4MU:YwTonCTynbo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=C5v2q-CN4MU:YwTonCTynbo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=C5v2q-CN4MU:YwTonCTynbo:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/on-becoming-a-technical-lead.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/on-becoming-a-technical-lead.html</feedburner:origLink></item>
		<item>
		<title>C# Training for Microsoft Customers</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/FaMMdZXCnBA/c-training-for-microsoft-customers.html</link>
		<comments>http://www.buunguyen.net/blog/c-training-for-microsoft-customers.html#comments</comments>
		<pubDate>Thu, 16 Jun 2011 10:58:50 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[dynamic binding]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=567</guid>
		<description><![CDATA[Slides for the C# training I conducted for Microsoft&#8217;s customers in Ho Chi Minh city on June 9th 2011.  The training covered C# 3.0, LINQ, C# 4.0 and Dynamic Binding.  
 C# 3.0 and 4.0 
 View more presentations from Buu Nguyen 

Some pictures of the training



]]></description>
			<content:encoded><![CDATA[<p>Slides for the C# training I conducted for Microsoft&#8217;s customers in Ho Chi Minh city on June 9th 2011.  The training covered C# 3.0, LINQ, C# 4.0 and Dynamic Binding.  </p>
<div style="width:425px" id="__ss_8325222"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/buunguyen/c-30-and-40" title="C# 3.0 and 4.0">C# 3.0 and 4.0</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/8325222" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/buunguyen">Buu Nguyen</a> </div>
</p></div>
<p>Some pictures of the training<br />
<a title="Me by buuqnguyen, on Flickr" href="http://www.flickr.com/photos/43457254@N03/5850967443/"><img src="http://farm3.static.flickr.com/2773/5850967443_8a47bba8d2_z.jpg" alt="Me" width="500" height="375" /></a></p>
<p><a title="Me by buuqnguyen, on Flickr" href="http://www.flickr.com/photos/43457254@N03/5851520516/"><img src="http://farm3.static.flickr.com/2742/5851520516_865f575f12_z.jpg" alt="Me" width="500" height="375" /></a></p>
<p><a title="Me by buuqnguyen, on Flickr" href="http://www.flickr.com/photos/43457254@N03/5851519704/"><img src="http://farm6.static.flickr.com/5156/5851519704_66ae247c7c_z.jpg" alt="Me" width="500" height="375" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=FaMMdZXCnBA:OvL3A186TU8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=FaMMdZXCnBA:OvL3A186TU8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=FaMMdZXCnBA:OvL3A186TU8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=FaMMdZXCnBA:OvL3A186TU8:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=FaMMdZXCnBA:OvL3A186TU8:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/c-training-for-microsoft-customers.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/c-training-for-microsoft-customers.html</feedburner:origLink></item>
		<item>
		<title>ASP.NET jQuery Cookbook</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/e5ADJ6eLfbI/asp-net-jquery-cookbook.html</link>
		<comments>http://www.buunguyen.net/blog/asp-net-jquery-cookbook.html#comments</comments>
		<pubDate>Mon, 09 May 2011 07:45:55 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=626</guid>
		<description><![CDATA[
Another book of which I was the technical reviewer was published: ASP.NET jQuery Cookbook. Access to the link to find out more about the book.

]]></description>
			<content:encoded><![CDATA[<div style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font: normal normal normal 13px/19px Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; padding: 0.6em; margin: 0px;">
<p>Another book of which I was the technical reviewer was published: <a href="http://www.packtpub.com/asp-net-jquery-cookbook/book">ASP.NET jQuery Cookbook</a>. Access to the link to find out more about the book.</p>
<p><a href="http://www.amazon.com/ASP-NET-jQuery-Cookbook-Sonal-Allana/dp/1849690464"><img style="border-style: initial; border-color: initial;" title="aspnetjquerycookbook" src="http://ecx.images-amazon.com/images/I/51PfnrPsVVL._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA300_SH20_OU01_.jpg" alt="aspnetjquerycookbook" width="300" height="300" /></a></div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=e5ADJ6eLfbI:vRIugz23hqU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=e5ADJ6eLfbI:vRIugz23hqU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=e5ADJ6eLfbI:vRIugz23hqU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=e5ADJ6eLfbI:vRIugz23hqU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=e5ADJ6eLfbI:vRIugz23hqU:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/asp-net-jquery-cookbook.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/asp-net-jquery-cookbook.html</feedburner:origLink></item>
		<item>
		<title>A catch-all .NET delegate and event handler</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/OOcosXW4fAo/a-catch-all-net-delegate-and-event-handler.html</link>
		<comments>http://www.buunguyen.net/blog/a-catch-all-net-delegate-and-event-handler.html#comments</comments>
		<pubDate>Fri, 15 Apr 2011 13:31:01 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[cil]]></category>
		<category><![CDATA[emit]]></category>
		<category><![CDATA[reflection]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=553</guid>
		<description><![CDATA[In a current project, I need to build a catch-all handler which could be used to wired to any static or instance delegate and event regardless of the actual delegate/event type.
For example, given the following definitions:

private delegate int Op(int i);
private delegate int BinaryOp(int i, int j);
class Test
{
    public Op OpDelegate;
   [...]]]></description>
			<content:encoded><![CDATA[<p>In a current project, I need to build a catch-all handler which could be used to wired to any static or instance delegate and event regardless of the actual delegate/event type.</p>
<p>For example, given the following definitions:</p>
<pre class="brush:csharp">
private delegate int Op(int i);
private delegate int BinaryOp(int i, int j);
class Test
{
    public Op OpDelegate;
    public event BinaryOp BinaryEvent;
}
</pre>
<p>I want to be able to write code like this:</p>
<pre class="brush:csharp">
obj.AddHandler(&quot;OpDelegate&quot;, args =&gt; (int)args[0] * (int)args[0]);
obj.AddHandler(&quot;BinaryEvent&quot;, args =&gt; (int)args[0] + (int)args[1]);
</pre>
<p>In the above code segment, code>obj</code> is an instance of the <code>Test</code> class.  <code>AddHandler</code> should be an extension method for <code>object</code> class.  The parameters include the name of the delegate or event and a catch-all handler of type <code>Func&lt;object[], object&gt;</code> and this handler might have been bound to some target.  In addition, the code in question mustn't need to know about the actual type of <code>obj</code> at compile time nor does it need to know about the actual signature of the delegate and event being wired.</p>
<p>What <code>AddHandler</code> needs to do is creating some delegate matching the definition of the delegate/event being wired and have that delegate forward the call to the <code>Func&lt;object[], object&gt;</code> argument.  That calls for a bit of code generation to build a delegate instance from a runtime generated method definition (which will have its signature match the delegate/event being wired).  Like when developing <a href="http://www.slideshare.net/buunguyen/fasterflect">Fasterflect</a>, I opt for CIL generation.</p>
<p>The code for the solution is below.  I will incorporate it into <a href="http://fasterflect.codeplex.com/">Fasterflect</a> as an add-on service.  Note that it makes use the <code>EmitHelper</code> class which could be found <a href="http://fasterflect.codeplex.com/SourceControl/changeset/view/e27658f5669b#Fasterflect%2fFasterflect%2fEmitter%2fEmitHelper.cs">here</a>.</p>
<pre class="brush:csharp">using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using Emitter;

public static class DynamicHandler
{
    public static Type AddHandler(this Type targetType, string fieldName,
        Func&lt;object[], object&gt; func)
    {
        return InternalAddHandler(targetType, fieldName, func, null, true);
    }

    public static Type AssignHandler(this Type targetType, string fieldName,
        Func&lt;object[], object&gt; func)
    {
        return InternalAddHandler(targetType, fieldName, func, null, false);
    }

    public static Type AddHandler(this object target, string fieldName,
        Func&lt;object[], object&gt; func)
    {
        return InternalAddHandler(target.GetType(), fieldName, func, target, true);
    }

    public static Type AssignHandler(this object target, string fieldName,
        Func&lt;object[], object&gt; func)
    {
        return InternalAddHandler(target.GetType(), fieldName, func, target, false);
    }

    private static Type InternalAddHandler(Type targetType, string fieldName,
        Func&lt;object[], object&gt; func, object target, bool combine)
    {
        Type delegateType;
        var eventInfo = targetType.GetEvent(fieldName);
        if (eventInfo != null &amp;&amp; !combine)
            throw new ArgumentException(&quot;AssignHandler cannot be used for event type&quot;);

        if (eventInfo != null)
        {
            delegateType = eventInfo.EventHandlerType;
            var dynamicHandler = BuildDynamicHandler(targetType, delegateType, func);
            eventInfo.GetAddMethod().Invoke(target, new Object[] {dynamicHandler});
        }
        else
        {
            var fieldInfo = targetType.Field(fieldName,
                                                target == null
                                                    ? Flags.StaticAnyVisibility
                                                    : Flags.InstanceAnyVisibility);
            var field = !combine ? null : target == null
                                            ? (Delegate) fieldInfo.Get()
                                            : (Delegate) fieldInfo.Get(target);
            delegateType = fieldInfo.FieldType;
            var dynamicHandler = BuildDynamicHandler(targetType, delegateType, func);
            field = field == null
                        ? dynamicHandler
                        : Delegate.Combine(field, dynamicHandler);
            (target ?? targetType).SetFieldValue(fieldName, field);
        }
        return delegateType;
    }

    public static Delegate BuildDynamicHandler(this Type delegateOwnerType, Type delegateType,
        Func&lt;object[], object&gt; func)
    {
        MethodInfo invokeMethod = delegateType.GetMethod(&quot;Invoke&quot;);
        Type returnType = invokeMethod.ReturnType;
        bool hasReturnType = returnType != Constants.VoidType;
        var paramTypes = invokeMethod.GetParameters().Select(p =&gt; p.ParameterType).ToArray();
        var dynamicMethod = new DynamicMethod(&quot;add_handler&quot;,
                                                hasReturnType ? returnType : null,
                                                new [] {typeof(Invoker)}.Concat(paramTypes).ToArray(),
                                                delegateOwnerType);
        var il = new EmitHelper(dynamicMethod.GetILGenerator());
        il.ldarg_0.end(); // &lt;this&gt;
        il.DeclareLocal(typeof(object[]));
        il.ldc_i4(paramTypes.Length); // &lt;this&gt; &lt;length&gt;
        il.newarr(typeof(object)); // &lt;this&gt; &lt;arr&gt;
        il.stloc_0.end(); // &lt;this&gt;
        for (int i = 0; i &lt; paramTypes.Length; i++)
        {
            il.ldloc_0 // &lt;this&gt; &lt;arr&gt;
                .ldc_i4(i) // &lt;this&gt; &lt;arr&gt; &lt;i&gt;
                .ldarg(i + 1) // &lt;this&gt; &lt;arr&gt; &lt;i&gt; &lt;arg_i+1&gt;
                .boxIfValueType(paramTypes[i]) // &lt;this&gt; &lt;arr&gt; &lt;i&gt; &lt;boxed_if_value:arg_i+1&gt;
                .stelem_ref.end(); // &lt;this&gt;
        }
        il.ldloc_0.end(); // &lt;this&gt; &lt;arr&gt;
        il.callvirt(Invoker.InvokeMethodInfo); // &lt;ret&gt;
        if (hasReturnType)
            il.unbox_any(returnType).ret();
        else
            il.pop.ret();
        return dynamicMethod.CreateDelegate(delegateType, new Invoker(func));
    }

    public class Invoker
    {
        public static readonly MethodInfo InvokeMethodInfo =
            typeof(Invoker).Method(&quot;Invoke&quot;, Flags.InstanceAnyVisibility);
        private readonly Func&lt;object[], object&gt; func;

        public Invoker(Func&lt;object[], object&gt; func)
        {
            this.func = func;
        }

        public object Invoke(object[] args)
        {
            return func(args);
        }
    }
}
</pre>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=OOcosXW4fAo:5UYOW6P4xvQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=OOcosXW4fAo:5UYOW6P4xvQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=OOcosXW4fAo:5UYOW6P4xvQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=OOcosXW4fAo:5UYOW6P4xvQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=OOcosXW4fAo:5UYOW6P4xvQ:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/a-catch-all-net-delegate-and-event-handler.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/a-catch-all-net-delegate-and-event-handler.html</feedburner:origLink></item>
		<item>
		<title>I’m a Microsoft MVP, again</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/lfSGT3H8BEk/im-a-microsoft-mvp-again.html</link>
		<comments>http://www.buunguyen.net/blog/im-a-microsoft-mvp-again.html#comments</comments>
		<pubDate>Mon, 04 Apr 2011 06:43:24 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mvp]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=550</guid>
		<description><![CDATA[I&#8217;ve just got news from Microsoft that I am, once again, a Microsoft MVP in ASP.NET/IIS (formerly ASP/ASP.NET).  This is exciting news.  A big thanks to all Microsoft employees and community members who have worked with me in various projects during the past year.

]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just got news from Microsoft that I am, once again, a Microsoft MVP in ASP.NET/IIS (formerly ASP/ASP.NET).  This is exciting news.  A big thanks to all Microsoft employees and community members who have worked with me in various projects during the past year.</p>
<p><a href="http://www.buunguyen.net/blog/wp-content/uploads/2010/04/MVP-h-550x222.png"><img class="aligncenter size-full wp-image-463" title="MVP-h-550x222" src="http://www.buunguyen.net/blog/wp-content/uploads/2010/04/MVP-h-550x222.png" alt="MVP-h-550x222" width="550" height="222" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=lfSGT3H8BEk:Eut8dr9-6mw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=lfSGT3H8BEk:Eut8dr9-6mw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=lfSGT3H8BEk:Eut8dr9-6mw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=lfSGT3H8BEk:Eut8dr9-6mw:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=lfSGT3H8BEk:Eut8dr9-6mw:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/im-a-microsoft-mvp-again.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/im-a-microsoft-mvp-again.html</feedburner:origLink></item>
		<item>
		<title>Speech at startup offline event</title>
		<link>http://feedproxy.google.com/~r/BuuNguyensBlog/~3/Ue4DInkEkGQ/speech-at-startup-offline-event.html</link>
		<comments>http://www.buunguyen.net/blog/speech-at-startup-offline-event.html#comments</comments>
		<pubDate>Wed, 23 Mar 2011 10:53:55 +0000</pubDate>
		<dc:creator>Buu Nguyen</dc:creator>
				<category><![CDATA[Conferences & Events]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[kms]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.buunguyen.net/blog/?p=534</guid>
		<description><![CDATA[Slides for my speech at an offline event about startups in Ho Chi Minh City.

View more presentations from Buu Nguyen

]]></description>
			<content:encoded><![CDATA[<p>Slides for my speech at an offline event about startups in Ho Chi Minh City.</p>
<div style="width: 425px;"><object id="__sse7356761" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=storiesaboutkmstechnology-110323054426-phpapp02&amp;stripped_title=stories-about-kms-technology&amp;userName=buunguyen" /><param name="name" value="__sse7356761" /><param name="allowfullscreen" value="true" /><embed id="__sse7356761" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=storiesaboutkmstechnology-110323054426-phpapp02&amp;stripped_title=stories-about-kms-technology&amp;userName=buunguyen" name="__sse7356761" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/buunguyen">Buu Nguyen</a></div>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=Ue4DInkEkGQ:ZPle2HaVu5s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=Ue4DInkEkGQ:ZPle2HaVu5s:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=Ue4DInkEkGQ:ZPle2HaVu5s:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BuuNguyensBlog?a=Ue4DInkEkGQ:ZPle2HaVu5s:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BuuNguyensBlog?i=Ue4DInkEkGQ:ZPle2HaVu5s:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.buunguyen.net/blog/speech-at-startup-offline-event.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.buunguyen.net/blog/speech-at-startup-offline-event.html</feedburner:origLink></item>
	</channel>
</rss>

