<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Chinh Do &#187; Silverlight</title>
	<atom:link href="http://www.chinhdo.com/category/programming/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chinhdo.com</link>
	<description>Chinh's not quite random thoughts on software development, .NET, gadgets, and other things.</description>
	<lastBuildDate>Sat, 06 Aug 2011 21:04:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Bag of Links #2</title>
		<link>http://www.chinhdo.com/20090212/bag-of-links-2/</link>
		<comments>http://www.chinhdo.com/20090212/bag-of-links-2/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 00:36:31 +0000</pubDate>
		<dc:creator>Chinh Do</dc:creator>
				<category><![CDATA[Dotnet/.NET - C#]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Software/tools]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.chinhdo.com/20090212/bag-of-links-2/</guid>
		<description><![CDATA[.NET/C# Programming Thread synchronization: Wait and Pulse demystified. By Nick Butler. Use a shortened GUID for file names and request strings. ShortGuid &#8211; A shorter and url friendly GUID class in C#. By Dave Transom. Top Ten Tips to Using XPath and XPointer. By John E. Simpson. Client-side caching for script methods access in ASP.NET [...]]]></description>
			<content:encoded><![CDATA[<h3>.NET/C# Programming</h3>
<ul>
<li><a href="http://www.codeproject.com/KB/threads/WaitPulse.aspx">Thread synchronization: Wait and Pulse demystified</a>. By Nick Butler.</li>
<li>Use a shortened GUID for file names and request strings. <a href="http://www.singular.co.nz/blog/archive/2007/12/20/shortguid-a-shorter-and-url-friendly-guid-in-c-sharp.aspx">ShortGuid &#8211; A shorter and url friendly GUID class in C#</a>. By Dave Transom.</li>
<li><a href="http://www.xml.com/pub/a/2002/08/14/xpath_tips.html">Top Ten Tips to Using XPath and XPointer</a>. By John E. Simpson.</li>
<li><a href="http://www.codeproject.com/KB/ajax/ScriptMethodClientCache.aspx?display=Print">Client-side caching for script methods access in ASP.NET AJAX</a>, by Jeffrey Zhao.</li>
<li>A very nice two-part <a href="http://www.west-wind.com/presentations/jQuery/default.aspx">introduction to jQuery</a>, by Rick Strahl.</li>
<li><a href="http://www.25hoursaday.com/CsharpVsJava.html">A COMPARISON OF MICROSOFT&#8217;S C# PROGRAMMING LANGUAGE TO SUN MICROSYSTEMS&#8217; JAVA PROGRAMMING LANGUAGE</a>. By Dare Obasanjo.</li>
<li><strong>Silverlight</strong>
<ul>
<li><a href="http://weblogs.asp.net/scottgu/pages/silverlight-2-end-to-end-tutorial-building-a-digg-search-client.aspx">Silverlight 2 End to End Tutorial: Building a Digg Search Client</a>, by Scott Guthrie.</li>
<li><a href="http://www.silverlightexamples.net/post/Fluid-Canvas-in-Silverlight.aspx">Fluid Canvas in Silverlight</a>, by neo.</li>
</ul>
</li>
<li><strong>WCF</strong>
<ul>
<li><a href="http://blogs.msdn.com/wenlong/archive/2007/10/27/performance-improvement-of-wcf-client-proxy-creation-and-best-practices.aspx">Performance Improvement for WCF Client Proxy Creation in .NET 3.5 and Best Practices</a>. By Wenlon Dong.</li>
<li><a href="http://blogs.conchango.com/simonevans/archive/2007/09/17/A-comprehensive-guide-to-using-MsmqIntegrationBinding-with-MSMQ-3.0-in-WCF.aspx">A comprehensive guide to using MsmqIntegrationBinding with MSMQ 3.0 in WCF</a>. By Simon Evans.</li>
<li>If your WSE 3.0 Mutual Certificate Authentication web service runs very slowly, try setting <a href="http://msdn.microsoft.com/en-us/library/microsoft.web.services3.design.securitypolicyassertion.establishsecuritycontext.aspx">establishSecurityContext</a> to true.</li>
</ul>
</li>
</ul>
<h3>PowerShell</h3>
<ul>
<li><a href="http://www.codeplex.com/PowerShellCX">PowerShell Community Extensions</a> has very useful cmdlets such as Get/Set-Clipboard, Write-GZip, Start-Process, Select-Xml and many others.</li>
<li>John D. Cook&#8217;s <a href="http://www.johndcook.com/PowerShellCookbook.html">PowerShell Cookbook</a> has lots of useful PowerShell recipes.</li>
</ul>
<h3>Apps and Tools</h3>
<ul>
<li>Microsoft <a href="http://www.microsoft.com/windows/products/winfamily/sharedaccess/default.mspx">Windows SteadyState</a> (free) is great for maintaining public-access computers.</li>
</ul>
<h3>Other Stuff</h3>
<ul>
<li><a href="http://www.theregister.co.uk/2008/08/22/anatomy_of_a_hack/">Anatomy of a malware scam &#8211; The evil genius of XP Antivirus 2008</a>. By Jesper M. Johansson. If you&#8217;ve had to help your relatives and friends clean up after XP Antivirus 2008/2009, read this very detailed analysis of the malware.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.chinhdo.com/20090212/bag-of-links-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Silverlight 2.0 Hello World Application</title>
		<link>http://www.chinhdo.com/20090127/silverlight-helloworld-2/</link>
		<comments>http://www.chinhdo.com/20090127/silverlight-helloworld-2/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 00:04:44 +0000</pubDate>
		<dc:creator>Chinh Do</dc:creator>
				<category><![CDATA[Dotnet/.NET - C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.chinhdo.com/?p=278</guid>
		<description><![CDATA[This is an update to my original article that was based on Silverlight 1.0 alpha. The code for the old article no longer worked with the current Silverlight runtime. Instead of the traditional and simple display of a string, this Hello World application uses animation in code to say &#8220;hello&#8221;. Pre-requisites You will need to [...]]]></description>
			<content:encoded><![CDATA[<p>This is an update to my <a href="http://www.chinhdo.com/20071010/silverlight-hello-world/">original article</a> that was based on Silverlight 1.0 alpha. The code for the old article no longer worked with the current Silverlight runtime.</p>
<p>Instead of the traditional and simple display of a string, this Hello World application uses animation in code to say &#8220;hello&#8221;.</p>
<h3>Pre-requisites</h3>
<p>You will need to have the following installed:</p>
<ul>
<li>Visual Studio 2008 with Service Pack 1</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=124807">Silverlight 2.0 Runtime</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=129043">Silverlight Tools for Visual Studio 2008 SP1</a></li>
</ul>
<h3>Create a New Silverlight Project</h3>
<ul>
<li>In Visual Studio 2008, choose File/New/Project and select Visual C#/Silverlight/Silverlight Application. The Silverlight project type is added when you install the Silverlight Tools.</li>
<li>Give your project a name and choose OK.
<p><a href="http://www.chinhdo.com/wp-content/uploads/2009/01/image5.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.chinhdo.com/wp-content/uploads/2009/01/image-thumb5.png" border="0" alt="New Silverlight Project" width="450" height="305" /></a></li>
<li>On the next dialog window, accept the default &#8220;Add a new ASP.NET Web project&#8230;&#8221; and choose OK.</li>
</ul>
<h3>Silverlight Project Files</h3>
<p>Since we will be drawing objects, we need a Canvas control instead of the default Grid. Change your Page.xaml file to read like this:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff">&lt;</span><span style="color: #800000">UserControl</span> <span style="color: #ff0000">x:Class</span><span style="color: #0000ff">="SilverlightHelloWorld.Page"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #ff0000">xmlns:x</span><span style="color: #0000ff">="http://schemas.microsoft.com/winfx/2006/xaml"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #ff0000">Width</span><span style="color: #0000ff">="520"</span> <span style="color: #ff0000">Height</span><span style="color: #0000ff">="140"</span> <span style="color: #ff0000">Loaded</span><span style="color: #0000ff">="UserControl_Loaded"</span><span style="color: #0000ff">&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Canvas</span> <span style="color: #ff0000">x:Name</span><span style="color: #0000ff">="MyCanvas"</span><span style="color: #0000ff">/&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">UserControl</span><span style="color: #0000ff">&gt;</span></pre>
</div>
</div>
<p>Press F7 when you have Page.xaml opened to switch to the code-behind file Page.xaml.cs, and replace the code there with this code:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff">using</span> System;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff">using</span> System.Collections.Generic;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff">using</span> System.Linq;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff">using</span> System.Net;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff">using</span> System.Windows;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff">using</span> System.Windows.Controls;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff">using</span> System.Windows.Documents;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff">using</span> System.Windows.Input;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff">using</span> System.Windows.Media;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff">using</span> System.Windows.Media.Animation;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff">using</span> System.Windows.Shapes;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff">using</span> System.Windows.Threading;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff">namespace</span> SilverlightHelloWorld</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">{</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">partial</span> <span style="color: #0000ff">class</span> Page : UserControl</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #008000">// private Storyboard _timer = new Storyboard();</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff">private</span> DispatcherTimer _timer;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff">private</span> List&lt;Cell&gt; cells = <span style="color: #0000ff">new</span> List&lt;Cell&gt;(); <span style="color: #008000">// list of all cells</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff">private</span> <span style="color: #0000ff">int</span> _xSize = 26; <span style="color: #008000">// width of the grid, in number of cells</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff">private</span> <span style="color: #0000ff">int</span> _ySize = 7; <span style="color: #008000">// height of the grid</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff">private</span> <span style="color: #0000ff">int</span> _numCells; <span style="color: #008000">// total number of cells</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff">private</span> <span style="color: #0000ff">int</span> _cellIdx = 0;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #008000">/// &lt;summary&gt;Represents a cell on the grid&lt;/summary&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff">private</span> <span style="color: #0000ff">class</span> Cell</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff">public</span> <span style="color: #0000ff">double</span> X; <span style="color: #008000">// x-coordinate of cell</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #0000ff">public</span> <span style="color: #0000ff">double</span> Y; <span style="color: #008000">// y-coordinate</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff">public</span> <span style="color: #0000ff">bool</span> On; <span style="color: #008000">// True if cell is "on"</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #0000ff">public</span> <span style="color: #0000ff">double</span> Order; <span style="color: #008000">// Display order</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff">public</span> Page()</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            InitializeComponent();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> UserControl_Loaded(<span style="color: #0000ff">object</span> sender, RoutedEventArgs e)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #008000">// Assign a random value to each cell </span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            Random rnd = <span style="color: #0000ff">new</span> Random(Environment.TickCount);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            _numCells = (<span style="color: #0000ff">int</span>)(_xSize * _ySize);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #0000ff">string</span> template = <span style="color: #006080">"                          "</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                + <span style="color: #006080">" x  x xxxx x    x     xx  "</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                + <span style="color: #006080">" x  x x    x    x    x  x "</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                + <span style="color: #006080">" xxxx xxxx x    x    x  x "</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                + <span style="color: #006080">" x  x x    x    x    x  x "</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                + <span style="color: #006080">" x  x xxxx xxxx xxxx  xx  "</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                + <span style="color: #006080">"                          "</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> y = 0; y &lt; _ySize; y++)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> x = 0; x &lt; _xSize; x++)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                    Cell cell = <span style="color: #0000ff">new</span> Cell();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                    cell.X = x * (<span style="color: #0000ff">this</span>.Width / _xSize);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                    cell.Y = y * (<span style="color: #0000ff">this</span>.Height / _ySize);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                    cell.Order = rnd.NextDouble();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                    cells.Add(cell);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; template.Length; i++)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                cells[i].On = template[i] == <span style="color: #006080">'x'</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #008000">// Sort the cells by the random values</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            cells.Sort(</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                <span style="color: #0000ff">delegate</span>(Cell c0, Cell c1)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                    <span style="color: #0000ff">return</span> c0.Order.CompareTo(c1.Order);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            );</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            _timer = <span style="color: #0000ff">new</span> System.Windows.Threading.DispatcherTimer();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            _timer.Interval = TimeSpan.FromMilliseconds(1);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            _timer.Tick += <span style="color: #0000ff">new</span> EventHandler(timer_Completed);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            _timer.Start();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff">void</span> timer_Completed(<span style="color: #0000ff">object</span> sender, EventArgs e)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff">if</span> (_cellIdx &lt; _numCells)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #008000">// Get the next cell</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                Cell cell = cells[_cellIdx];</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                <span style="color: #008000">// Draw the cell</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                Rectangle r = <span style="color: #0000ff">new</span> Rectangle();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                r.Stroke = <span style="color: #0000ff">new</span> SolidColorBrush(Colors.DarkGray);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #0000ff">if</span> (cell.On)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                    r.Fill = <span style="color: #0000ff">new</span> SolidColorBrush(Colors.Red);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                <span style="color: #0000ff">else</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                    r.Fill = <span style="color: #0000ff">new</span> SolidColorBrush(Colors.LightGray);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                r.Width = <span style="color: #0000ff">this</span>.Width / _xSize;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                r.Height = <span style="color: #0000ff">this</span>.Height / _ySize;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                r.SetValue(Canvas.LeftProperty, cell.X);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                r.SetValue(Canvas.TopProperty, cell.Y);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                MyCanvas.Children.Add(r);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                _cellIdx++;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff">else</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                _timer.Stop();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">}</pre>
</div>
</div>
<p>Save the file. Right click on SilverlightHellowordTestPage.aspx and choose Set As Start Page, then run the app.</p>
<h3>Hosting the Application</h3>
<p>To host the application on your web site, just copy the following files:</p>
<ul>
<li>Silverlight.js</li>
<li>SilverlightHelloWorldTestPage.html</li>
<li>ClientBin/SilverlightHelloWorld.xap</li>
</ul>
<p>Click <a href="http://www.chinhdo.com/wp-content/uploads/2009/01/SilverlightHello/SilverlightHelloWorldTestPage.html">here</a> to see the application in action.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chinhdo.com/20090127/silverlight-helloworld-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Finds of the Week &#8211; June 17, 2008</title>
		<link>http://www.chinhdo.com/20080617/finds-of-the-week-june-17-2008/</link>
		<comments>http://www.chinhdo.com/20080617/finds-of-the-week-june-17-2008/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 03:28:19 +0000</pubDate>
		<dc:creator>Chinh Do</dc:creator>
				<category><![CDATA[Dotnet/.NET - C#]]></category>
		<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Software/tools]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.chinhdo.com/20080617/finds-of-the-week-june-17-2008/</guid>
		<description><![CDATA[.NET, C# ReSharper 4.0 is released. Andre Loker shared a very cool trick available with C# 3.0: Getting rid of strings (2): use lambda expressions. Official Guidance: New Recommendations for Strings in .NET 2.0. By Dave Fetterman, BCL Team Blog. Scott Guthrie announced availability of Silverlight Beta 2. Looks like there are a ton more [...]]]></description>
			<content:encoded><![CDATA[<h3>.NET, C#</h3>
<ul>
<li><a href="http://www.jetbrains.com/resharper/download/index.html">ReSharper 4.0 is released</a>.</li>
<li>Andre Loker shared a very cool trick available with C# 3.0: <a href="http://blog.andreloker.de/post/2008/06/Getting-rid-of-strings-(2)-use-lambda-expressions.aspx">Getting rid of strings (2): use lambda expressions</a>.</li>
<li><a href="http://blogs.msdn.com/bclteam/archive/2005/06/01/424012.aspx">Official Guidance: New Recommendations for Strings in .NET 2.0</a>. By Dave Fetterman, BCL Team Blog.</li>
<li>Scott Guthrie announced <a href="http://weblogs.asp.net/scottgu/archive/2008/06/06/silverlight-2-beta2-released.aspx">availability of Silverlight Beta 2</a>. Looks like there are a ton more controls.</li>
<li><a href="http://www.blackwasp.co.uk/SendSmtpAsync.aspx">Sending SMTP Email Asynchronously</a> with SmtpClient.SendAsync().</li>
<li>Igor Ostrovsky gave an easy-to-digest summary of <a href="easy-to-digest high-level summary">concurrency in .NET Framework 3.5</a>.</li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/cc546569.aspx">Tools And Techniques to Identify Concurrency Issues</a>. By Rahul V. Patil and Boby George, MSDN Magazine. Lots of good information on concurrency issues, how to analyze/detect problems, and pointers to tools.</li>
<li>Did you know about <a href="http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx">AppDomain::UnhandledException</a> Event? I didn&#8217;t, until my Windows Service started to die without even leaving a nice goodbye&#8230; stacktrace. Well there was this mysterious looking entry in the Events Log. MSDN.</li>
<li>Add color to your Console apps with <a href="http://msdn.microsoft.com/en-us/library/system.consolecolor.aspx">ConsoleColor</a>. MSDN.</li>
<li><a href="http://developer.yahoo.com/performance/rules.html">Exceptional Performance : Best Practices for Speeding Up Your Web Site</a>. Yahoo! Developer Network.</li>
</ul>
<h3>General Development</h3>
<ul>
<li><a href="http://sixrevisions.com/tools/faster_web_page/">15 Tools to Help You Develop Faster Web Pages</a> by Jacob Gube (Six Revisions). </li>
<li>Nick Beradi showed you how to <a href="http://www.coderjournal.com/2008/06/turn-google-app-engine-into-a-content-delivery-network-cdn/">Turn Google App Engine into your own Personal Content Delivery Network (CDN)</a>. App Engine costs nothing to get started. Sign up for a free account, and you can develop and publish your application for the world to see, at no charge and with no obligation. A free account can use up to 500MB of persistent storage and enough CPU and bandwidth for about 5 million page views a month.</li>
<li>An interesting look at Gmail client-side code: <a href="http://css.dzone.com/news/gmail-architecture-part-1">Gmail Client Side Architecture Part 1</a>. By Sajith .M.R.</li>
</ul>
<h3>Software, Tools, etc.</h3>
<ul>
<li>FireFox 3 is out. To get the most of of it, check out <a href="http://lifehacker.com/396312/power-users-guide-to-firefox-3">lifehacker&#8217;s Power User&#8217;s Guide to Firefox 3</a>.</li>
</ul>
<h3>Gaming</h3>
<ul>
<li>Jeff Atwood discussed <a href="http://www.codinghorror.com/blog/archives/001135.html">Physics Based Games</a>.</li>
<li>If you are a PC gamer, don&#8217;t miss <a href="http://www.marketing-ninja.com/?p=409">Is the Market for PC Gaming Finished?</a> by Aaron Stannard (Aaronontheweb).</li>
</ul>
<h3>Something Different</h3>
<ul>
<li><a href="http://www.youtube.com/watch?v=LU8DDYz68kM">Battle at Kruger</a> (video).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.chinhdo.com/20080617/finds-of-the-week-june-17-2008/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Finds of the Week &#8211; Nov 28, 2007</title>
		<link>http://www.chinhdo.com/20071130/finds-of-the-week-20071128/</link>
		<comments>http://www.chinhdo.com/20071130/finds-of-the-week-20071128/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 05:50:15 +0000</pubDate>
		<dc:creator>Chinh Do</dc:creator>
				<category><![CDATA[Dotnet/.NET - C#]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.chinhdo.com/20071130/finds-of-the-week-nov-28-2007/</guid>
		<description><![CDATA[I took a break from blogging last week for the U.S. Thanksgiving holiday. Here are the Finds for this week. .NET Just in case you have not heard, Visual Studio 2008 has been released (ScottGu). I installed the released version earlier this week and everything looks good so far. The first thing I noticed was [...]]]></description>
			<content:encoded><![CDATA[<p>I took a break from blogging last week for the U.S. Thanksgiving holiday. Here are the Finds for this week.</p>
<h3>.NET</h3>
<ul>
<li>Just in case you have not heard, Visual Studio 2008 <a href="http://weblogs.asp.net/scottgu/archive/2007/11/19/visual-studio-2008-and-net-3-5-released.aspx">has been released</a> (ScottGu). I installed the released version earlier this week and everything looks good so far. The first thing I noticed was the very quick load time compared to 2005.</li>
<li><a href="http://blogs.msdn.com/tims/archive/2007/11/29/silverlight-1-1-is-now-silverlight-2-0.aspx">Silverlight 1.1 is now 2.0</a>. By Tim Sneath.</li>
<li>Dan Fernandez <a href="http://blogs.msdn.com/danielfe/archive/2007/11/19/top-15-things-to-love-about-visual-studio-2008-express.aspx">listed</a> the top 15 things to love about Visual Studio 2008 Express.</li>
<li>Service Pack 1 for .NET Framework 2.0 <a href="http://weblogs.asp.net/guybarrette/archive/2007/11/21/service-packs-for-the-net-framework-2-0-and-3-0.aspx">is available</a>. By Guy Barrette.</li>
<li>Aaronontheweb <a href="http://www.ajaxninja.com/?p=256">shared</a> 5 Hot ASP.NET Tips and Tricks for the week of 11/20/2007. By Aaronontheweb.</li>
<li>bloggingdeveloper wrote a nice article on <a href="http://www.bloggingdeveloper.com/post/How-To-Compress-ViewState-in-ASPNET-20-ViewState-Compression-with-SystemIOCompression.aspx">how to compress ViewState</a>.</li>
</ul>
<h3>Software and Tools</h3>
<ul>
<li>Odiogo can <a href="http://blog.madskristensen.dk/post/Make-your-blog-talk.aspx">make your blog talk</a>. By Mads Kristensen.</li>
<li>I have been a long-time user of MSN Money Porfolio and <a href="http://moneycentral.msn.com/investor/charts/charting.asp?symbol=US:SPY">stock charts</a> but lately I really liked the stuff Yahoo! has been adding to their Finance section. Their new <a href="http://finance.yahoo.com/charts#symbol=SPY;range=1y">Flash-based stock chart</a> is the best in its class. My favorite feature is the ability to drag left/right to go back/forward in time. Also their quotes are now streaming (AJAX)&#8230; meaning anywhere you see a price quote, it will be automatically refreshed. Real time quotes are available for as an optional service as well.
<p><img src="/images/200711/yahoo-finance-chart.jpg" alt="Yahoo! Finance Stock Chart" /></li>
<li>To track disk space usage, my tool of choice is <a href="http://windirstat.info/">Windirstats</a>. Windirstats is Open Source.
<p><img src="/images/200711/windirstats.jpg" alt="Windirstats" /></li>
</ul>
<h3>Tech, Windows Mobile, Gadgets</h3>
<ul>
<li>Google has just <a href="http://googleblog.blogspot.com/2007/11/lost-no-found.html">released </a>the beta version of My Location, a service that allows GPS like functionality with Google Maps on your mobile device without a GPS. It doesn&#8217;t work for me on my Samsung i760 though. I always get this error message: &#8220;Your current location is temporarily unavailable&#8221;.
<p><img src="/images/200711/google-maps-my-location.jpg" alt="Google Maps My Location" /></p>
<p><a href="http://googlesystem.blogspot.com/2007/11/google-maps-for-mobile-shows-your.html">Looks</a> like many others are getting the same error as well.
</li>
</ul>
<h3>And Now, Something Different</h3>
<p><a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&#038;articleId=9049579&#038;intsrc=news_ts_head">Be careful</a> where you put your cellphone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chinhdo.com/20071130/finds-of-the-week-20071128/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finds of the Week &#8211; 10/17/2007</title>
		<link>http://www.chinhdo.com/20071017/finds-of-the-week-20071017/</link>
		<comments>http://www.chinhdo.com/20071017/finds-of-the-week-20071017/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 21:43:23 +0000</pubDate>
		<dc:creator>Chinh Do</dc:creator>
				<category><![CDATA[Dotnet/.NET - C#]]></category>
		<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows Mobile / Pocket PC]]></category>
		<category><![CDATA[Visual Studio Tips & Tricks]]></category>
		<category><![CDATA[Windows Live Maps]]></category>

		<guid isPermaLink="false">http://www.chinhdo.com/20071017/finds-of-the-week-20071017/</guid>
		<description><![CDATA[As an attempt to make this blog appears more busy:-), I will begin my &#34;Finds of the Week&#34; series. Each week, I will share miscellaneous finds and thoughts I ran into that are related to mostly .NET development. Here are the finds for this week: .NET Parallel Performance: Optimize Managed Code For Multi-Core Machines; by [...]]]></description>
			<content:encoded><![CDATA[<p>As an attempt to make this blog appears more busy:-), I will begin my &quot;Finds of the Week&quot; series. Each week, I will share miscellaneous finds and thoughts I ran into that are related to mostly .NET development.</p>
<p>Here are the finds for this week:</p>
<h3>.NET</h3>
<ul>
<li><a href="http://blogs.msdn.com/alfredth/archive/2007/09/11/software-engineering-vs-fun.aspx">Parallel Performance: Optimize Managed Code For Multi-Core Machines</a>; by Daan Leijen and Judd Hall; via MSDN Magazine. In a few years&#39; time, I predict that most new PCs will be multi-core. This article talks about the new Task Parallel Library (TPL) and provides code samples.</li>
<li><a href="http://www.blogstorm.co.uk/blog/billion-dollar-javascript/">document.f.q.focus(); The Billion Dollar Line of JavaScript</a> (by gst, via blogstorm.co.ok) talks about how many people use the Search Box on their browser to navigate to various web sites, instead of typing in a URL, and how this practice translates into revenue for Google. Interesting read.</li>
<li>alessandro <a href="http://weblogs.asp.net/alessandro/archive/2007/09/30/image-element-with-an-empty-string-for-the-src-quot-quot-attribute-results-in-making-a-call-for-default-aspx.aspx"> pointed out</a> that and IMG element with an empty src attribute will call the browser to make a request to the default document (usually default.aspx).</li>
<li><a href="http://www.codeproject.com/dotnet/UnderstandWWF.asp">Understanding Windows Workflow Foundation</a> (by razi bin rais, via Codeproject.com) is a nice overview of Windows Workflow Foundation.</li>
<li><b>Where are the basic controls in Silverlight 1.1?</b> When I started experimenting with Silverlight recently (<a href="http://www.chinhdo.com/chinh/blog/20071010/silverlight-hello-world/">see my Silverlight Hello World application</a>), the first question that came to my mind was: where are all the basic controls such as button, checkbox, textbox, etc?
<p><img alt="XAML Intellisense drop-down" src="/images/200710/silverlight-controls-list.jpg" /></p>
<p>Don&#39;t worry! Apparently, they are not there because it&#39;s still an Alpha release. According to this <a href="http://blogs.msdn.com/tims/archive/2007/07/03/so-you-want-to-give-a-silverlight-presentation.aspx"> post</a> from Tim Sneath, the following controls are planned to be included in the released version of 1.1: Button, TextBox, Scrollbar, Slider, ListBox, CheckBox, RadioButton, ComboBox, and UserControl (no TreeView, RichTextBox, or DataGrid).</li>
</ul>
<p>&nbsp;</p>
<h3>Tools</h3>
<ul>
<li>Probably old news to most CSS pros, but just in case you have not heard, <a href="http://addons.mozilla.org/firefox/1843"> FireBug</a> is a very useful extension for FireFox/CSS development. Highly recommended if you ever work with CSS. I could have saved countless hours debugging HTML/CSS issues with this tool.</li>
<li><a href="http://www.google.com/url?sa=t&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fnotepad-plus.sourceforge.net%2F&amp;ei=_FUWR4bMKYq-hASR66XnAw&amp;usg=AFQjCNFyyViE6HrPfZyDrSzazzktyAEe1A&amp;sig2=qQNCYc1ta9XkcP2t8hUvMw"> Notepad++</a> is a new addition to my toolset. Supports syntax highlighting, regular expression search/replace, Unicode, Macros, and is light-weight.</li>
</ul>
<h4>Windows Mobile / Pocket PC</h4>
<ul>
<li><a href="http://www.microsoft.com/presspass/press/2007/oct07/10-15OSBUpdatesPR.mspx">Windows Live Search</a> for Windows Mobile now includes voice recognition.</li>
</ul>
<h3>Blogs</h3>
<ul>
<li><a href="http://blogs.msdn.com/saraford/default.aspx">Sara Ford&#39;s WebLog</a> is a treasure trove full of cool Visual Studio tips and tricks.</li>
</ul>
<h3>Miscellaneous</h3>
<ul>
<li>I am pretty bad with keeping in touch with people, and I have found that <a href="http://www.linkedin.com">LinkedIn</a>	makes it fairly easy to keep in touch with past colleages. Last week I had some free time so I decided to look up old colleagues on <a href="http://www.linkedin.com">LinkedIn</a>. It was great to hear from many people I worked with years ago. I found many people by simply searching on the name of the company we worked for.</li>
</ul>
<h3>And Now, Something Different</h3>
<p>Check out the <a href="http://maps.live.com">Windows Live Maps</a> Bird&#39;s Eye view below. See the black car entering the cul-de-sac? That&#39;s me and my car.</p>
<p><img alt="Microsoft Windows Live Maps - Chinh's Car" src="/images/200710/windows-live-maps-chinh-1.jpg" /></p>
<p>How do I know that&#8217;s my car? Well, for one thing, my car is black. But the real reason I know it&#8217;s me is that a moment later, my garage door opened half-way&#8230; as I was about to drive into the garage:</p>
<p><img alt="Microsoft Windows Live Maps - Chinh's Car" src="/images/200710/windows-live-maps-chinh-2.jpg" /></p>
<p>At first glance, it seems to be an amazing coincidence (like one-in-a-million amazing). What is the chance that Microsoft&#8217;s Bird&#8217;s Eye low flying plane would fly across my house and snap pictures just as I am about drive into my garage? However, after further calculations, it turns out that the real probability is around 1/8640 (5-second window over 43200 average seconds of day-light). Still a very small chance, but certainly not lottery-winning &#8220;amazing&#8221;. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.chinhdo.com/20071017/finds-of-the-week-20071017/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My Silverlight 1.1 Hello World Application</title>
		<link>http://www.chinhdo.com/20071010/silverlight-hello-world/</link>
		<comments>http://www.chinhdo.com/20071010/silverlight-hello-world/#comments</comments>
		<pubDate>Wed, 10 Oct 2007 22:57:37 +0000</pubDate>
		<dc:creator>Chinh Do</dc:creator>
				<category><![CDATA[Dotnet/.NET - C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.chinhdo.com/chinh/blog/20071010/silverlight-hello-world/</guid>
		<description><![CDATA[Update 1/27/2009: I posted an updated version of this article targeted for Silverlight Runtime 2.0 here Imagine being able to author rich Internet applications in your .NET language of choice, without having to mess with Javascript, cross-browser compatibility issues, or ActionScript. That&#8217;s the promise of Microsoft Silverlight 1.1. In this article, I will document my [...]]]></description>
			<content:encoded><![CDATA[<h3>Update 1/27/2009: I posted an updated version of this article targeted for Silverlight Runtime 2.0 <a href="http://www.chinhdo.com/20090127/silverlight-helloworld-2/" target="_blank">here</a></h3>
<p>Imagine being able to author rich Internet applications in your .NET language of choice, without having to mess with Javascript, cross-browser compatibility issues, or ActionScript. That&#8217;s the promise of Microsoft Silverlight 1.1. In this article, I will document my attempt at creating a Silverlight 1.1 &#8220;Hello World&#8221; application. My Hello World application is a little bit more fancy than the typical one&#8230; this one involves some animation, and drawing a few shapes from code.</p>
<p><a href="/chinh/blog/files/CdoHelloWorld/TestPage.html" target="_new"><img alt="Silverlight Hello" src="/chinh/blog/images/Silverlight-hello.jpg"></a></p>
<p>If you are new to Silverlight, Silverlight 1.1 (currently in Alpha) is the version that will include the .NET CLR and allow you to write Silverlight code with .NET languages such as C#.</p>
<p>Most Silverlight 1.1 C# examples I found on the web use the XAML file to declare and set object properties. In my example, I am going to create and draw most objects from the code behind c# class.</p>
<h3>Installing Visual Studio 2008</h3>
<p>If you don&#8217;t have Visual Studio 2008 already installed. You can download it from <a href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx">here</a>. Downloading and installing Visual Studio 2008 to my Virtual PC took about 3 hours (1 for the download and 2 for the install).</p>
<p>Note: It&#8217;s possible to <a href="http://weblogs.asp.net/mschwarz/archive/2007/06/04/silverlight-with-visual-studio-net-2005.aspx"><br />develop Silverlight 1.1 applications with Visual Studio 2005</a>, but the process is not integrated as with Visual Studio 2008</p>
<h3>Installing Silverlight Runtimes and Tools</h3>
<p>Install the following runtimes and tools from <a href="http://silverlight.net/GetStarted/">here</a>. I am linking to the main page instead of the individual downloads just in case the download links change.</p>
<ul>
<li>Microsoft Silverlight 1.0 Runtime.
<li>Microsoft Silverlight 1.1 Alpha September Refresh
<li>Microsoft Silverlight Tools Alpha Refresh for Visual Studio 2008 Beta 2 (July 2007) </li>
</ul>
<h3>Create a New Silverlight Project</h3>
<ul>
<li>In Visual Studio, choose File/New/Project and select Visual C#/Silverlight/Silverlight Project. The Silverlight project type is added when you install the Microsoft Silverlight Tools above.
<li>Give your project a name. </li>
</ul>
<p><img alt="Creating a new Silverlight Project" src="/chinh/blog/images/Silverlight-new-project.jpg"></p>
<h3>Silverlight Project Files</h3>
<p>After the project has been created, you are presented with the default Page.xaml file:</p>
<p><img alt="Page.xaml" src="/chinh/blog/images/Silverlight-page-xaml.jpg"></p>
<p>Your Solution should now have the following files:</p>
<p><img alt="Page.xaml" src="/chinh/blog/images/Silverlight-solution-files.jpg"></p>
<p>The two files that you will be working with are Page.xaml and TestPage.html. Page.xaml stores the markup for the design elements (for more info on XAML, see this <a href="http://msdn2.microsoft.com/en-us/library/ms752059.aspx">MSDN article</a>). TestPage.html is the regular HTML page that will host the main Silverlight object. Silverlight.js is the Javascript helper file for Silverlight applications.</p>
<p>For our example, we will be adding code to Page.xaml.cs. This is what Page.xaml.cs looks like initially:</p>
<p><img alt="Page.xaml" src="/chinh/blog/images/Silverlight-page.xaml.cs.jpg"></p>
<h3>Add Some Code</h3>
<p>Ready to write some code (complete source code at the end of the article)? First, we are going to add a Storyboard element to our Page.xaml. This Storyboard element serves as a timer for the animation we are going to display.</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Canvas.Resources</span><span>
</span> class="kwrd"&gt;&gt;
    <span class="kwrd">&lt;</span><span class="html">Storyboard</span> <span class="attr">x:Name</span><span>
</span>        class="kwrd"&gt;="mainTimer" <span class="attr">Duration</span><span class="kwrd">="00:00:00"</span><span>
</span>            class="kwrd"&gt;/&gt;
<span class="kwrd">&lt;/</span><span class="html">Canvas.Resources</span><span class="kwrd">&gt;</span></pre>
<p>Then, we add some code to the Page.xaml.cs file (click <a href="#simple">here</a></p>
<p>for simple &#8220;Hello World&#8221; version&#8230; if you just want a simple Hello World app):</p>
<div style="border-right: darkgray 2px solid; border-top: darkgray 2px solid; overflow: auto; border-left: darkgray 2px solid; width: 100%; border-bottom: darkgray 2px solid; height: 300px">
<pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Windows;
<span class="kwrd">using</span> System.Windows.Controls;
<span class="kwrd">using</span> System.Windows.Documents;
<span class="kwrd">using</span> System.Windows.Ink;
<span class="kwrd">using</span> System.Windows.Input;
<span class="kwrd">using</span> System.Windows.Media;
<span class="kwrd">using</span> System.Windows.Media.Animation;
<span class="kwrd">using</span> System.Windows.Shapes;
<span class="kwrd">using</span> System.Collections.Generic;

<span class="kwrd">namespace</span> CdoHelloWorld
{
    <span class="kwrd">public</span> <span class="kwrd">partial</span> <span class="kwrd">class</span> Page : Canvas
    {
        <span class="rem">/// &lt;summary&gt;Represents a cell on the grid&lt;/summary&gt;</span>
        <span class="kwrd">private</span> <span class="kwrd">class</span> Cell
        {
            <span class="kwrd">public</span> <span class="kwrd">double</span> X; <span class="rem">//
                x-coordinate of cell</span>
            <span class="kwrd">public</span> <span class="kwrd">double</span> Y; <span class="rem">//
                y-coordinate</span>
            <span class="kwrd">public</span> <span class="kwrd">bool</span> On; <span class="rem">//
                True if cell is "on"</span>
            <span class="kwrd">public</span> <span class="kwrd">double</span> Order; <span class="rem">//
                Display order</span>
        }

        <span class="kwrd">private</span> List&lt;Cell&gt; cells = <span class="kwrd">new</span> List&lt;Cell&gt;(); <span>
</span>            class="rem"&gt;// list of all cells
        <span class="kwrd">private</span> <span class="kwrd">int</span> xSize = 26; <span>
</span>            class="rem"&gt;// width of the grid, in number of cells
        <span class="kwrd">private</span> <span class="kwrd">int</span> ySize = 7; <span>
</span>            class="rem"&gt;// height of the grid
        <span class="kwrd">private</span> <span class="kwrd">int</span> numCells; <span class="rem">//
            total number of cells</span>
        <span class="kwrd">private</span> <span class="kwrd">int</span> cellIdx = 0;

        <span class="kwrd">public</span> <span class="kwrd">void</span> Page_Loaded(<span>
</span>            class="kwrd"&gt;object o, EventArgs e)
        {
            <span class="rem">// Required to initialize variables</span>
            InitializeComponent();

            <span class="rem">// Assign a random value to each cell </span>
            Random rnd = <span class="kwrd">new</span> Random(Environment.TickCount);
            numCells = (<span class="kwrd">int</span>)(xSize * ySize);

            <span class="kwrd">for</span> (<span class="kwrd">int</span> y = 0; y &lt; ySize; y++)
            {
                <span class="kwrd">for</span> (<span class="kwrd">int</span> x = 0; x &lt; xSize; x++)
                {
                    Cell cell = <span class="kwrd">new</span> Cell();
                    cell.X = x * (<span class="kwrd">this</span>.Width / xSize);
                    cell.Y = y * (<span class="kwrd">this</span>.Height / ySize);
                    cell.Order = rnd.NextDouble();
                    cells.Add(cell);
                }
            }

            <span class="kwrd">string</span> template = <span class="str">" "</span>
                            + <span class="str">" x x xxxx x x xx "</span>
                            + <span class="str">" x x x x x x x "</span>
                            + <span class="str">" xxxx xxxx x x x x "</span>
                            + <span class="str">" x x x x x x x "</span>
                            + <span class="str">" x x xxxx xxxx xxxx xx "</span>
                            + <span class="str">" "</span>;

            <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; template.Length; i++)
            {
                <span class="kwrd">if</span> (template[i] == <span class="str">'x'</span>)
                {
                    cells[i].On = <span class="kwrd">true</span>;
                }
                <span class="kwrd">else</span>
                {
                    cells[i].On = <span class="kwrd">false</span>;
                }
            }

            <span class="rem">// Sort the cells by the random values</span>
            cells.Sort(
                <span class="kwrd">delegate</span>(Cell c0, Cell c1)
                {
                    <span class="kwrd">return</span> c0.Order.CompareTo(c1.Order);
                }
            );

            mainTimer.Completed += <span class="kwrd">new</span> EventHandler(mainTimer_Completed);
            mainTimer.Begin();
        }

        <span class="kwrd">void</span> mainTimer_Completed(<span class="kwrd">object</span> sender, EventArgs e)
        {
            <span class="rem">// Get the next cell</span>
            Cell cell = cells[cellIdx];

            <span class="rem">// Draw the cell</span>
            Rectangle r = <span class="kwrd">new</span> Rectangle();
            r.Stroke = <span class="kwrd">new</span> SolidColorBrush(Colors.DarkGray);
            <span class="kwrd">if</span> (cell.On)
            {
                r.Fill = <span class="kwrd">new</span> SolidColorBrush(Colors.Red);
            }
            <span class="kwrd">else</span>
            {
                r.Fill = <span class="kwrd">new</span> SolidColorBrush(Colors.LightGray);
            }
            r.Width = <span class="kwrd">this</span>.Width / xSize;
            r.Height = <span class="kwrd">this</span>.Height / ySize;
            r.SetValue(Canvas.LeftProperty, cell.X);
            r.SetValue(Canvas.TopProperty, cell.Y);
            Children.Add(r);
            cellIdx++;

            <span class="kwrd">if</span> (cellIdx &lt;= numCells)
            {
                <span class="rem">// restart the timer</span>
                mainTimer.Begin();
            }
        }

    }
}</pre>
</div>
<p>Here&#8217;s the simple version of the code:</p>
<pre class="csharpcode">TextBlock t = <span class="kwrd">new</span> TextBlock();
t.Text = <span class="str">"Hello world!"</span>;
Children.Add(t);</pre>
<h3>Firefox Bug and Workaround</h3>
<p>There is a known problem that causes the Silverlight object to not show up in Firefox. To fix the problem, remove the DOCTYPE declaration from the HTML file. See <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1146052&amp;SiteID=1">this MSDN forum thread.</a></p>
<h3>Deploying Silverlight Applications to Your Web Server</h3>
<p>To deploy my application, I simply copied the files including the ClientBin directory to my web server. Any web server will do (the server that hosts my Hello World application is an apache server).</p>
<h3>And Now, Ladies and Gentlements, My Hello World Silverlight App</h3>
<p>Click <a href="/chinh/blog/files/CdoHelloWorld/TestPage.html" target="_new">here</a>.</p>
<h3>Source Code</h3>
<p><a href="/chinh/blog/files/CdoHelloWorld/CdoHelloWorld.zip">Download complete source code for this article</a>.</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.chinhdo.com%2f20071010%2fsilverlight-hello-world%2f"><img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.chinhdo.com%2f20071010%2fsilverlight-hello-world%2f" border="0"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chinhdo.com/20071010/silverlight-hello-world/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

