<?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>Dr. WPF &#187; Mix</title>
	<atom:link href="http://drwpf.com/blog/category/mix/feed/" rel="self" type="application/rss+xml" />
	<link>http://drwpf.com/blog</link>
	<description>Drinking (and serving) the WPF Kool-Aid since 2002</description>
	<lastBuildDate>Sun, 09 May 2010 06:59:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Jaime&#039;s Mix09 Recap Series</title>
		<link>http://drwpf.com/blog/2009/03/30/jaimes-mix09-recap-series/</link>
		<comments>http://drwpf.com/blog/2009/03/30/jaimes-mix09-recap-series/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 14:36:13 +0000</pubDate>
		<dc:creator>Dr. WPF</dc:creator>
				<category><![CDATA[Mix]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://drwpf.com/blog/?p=50</guid>
		<description><![CDATA[
Jaime Rodriguez has just released a fantastic 3-part series summarizing the big things to directly or indirectly come out of Mix09.&#160; I highly recommend it for anyone working within WPF and/or Silverlight:

Part 1:&#160; Features and Announcements
Part 2:&#160; What about WPF?
Part 3:&#160; The Client Continuum

It&#8217;s great to get a little insider insight into the thinking behind [...]]]></description>
			<content:encoded><![CDATA[<div class="jbr">
<p>Jaime Rodriguez has just released a fantastic 3-part series summarizing the big things to directly or indirectly come out of Mix09.&nbsp; I highly recommend it for anyone working within WPF and/or Silverlight:</p>
<ul>
<li>Part 1:&nbsp; <a target="_blank" href="http://blogs.msdn.com/jaimer/archive/2009/03/29/my-mix09-recap-series-part-1.aspx">Features and Announcements</a></li>
<li>Part 2:&nbsp; <a target="_blank" href="http://blogs.msdn.com/jaimer/archive/2009/03/28/mix09-recap-series-part2.aspx">What about WPF?</a></li>
<li>Part 3:&nbsp; <a target="_blank" href="http://blogs.msdn.com/jaimer/archive/2009/03/30/mix09-recap-series-part3.aspx">The Client Continuum</a></li>
</ul>
<p>It&#8217;s great to get a little insider insight into the thinking behind Microsoft&#8217;s ongoing client strategy.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://drwpf.com/blog/2009/03/30/jaimes-mix09-recap-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight:  How I Really Feel About the Iridescent Thong</title>
		<link>http://drwpf.com/blog/2009/03/21/silverlight-how-i-really-feel-about-the-iridescent-thong/</link>
		<comments>http://drwpf.com/blog/2009/03/21/silverlight-how-i-really-feel-about-the-iridescent-thong/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 05:12:30 +0000</pubDate>
		<dc:creator>Dr. WPF</dc:creator>
				<category><![CDATA[Mix]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://drwpf.com/blog/?p=49</guid>
		<description><![CDATA[
First, I have to give huge props to Microsoft for throwing an excellent party in Vegas this past week!&#160; The week was definitely packed with excitement and backed by great content.&#160; Be sure to check out the recorded sessions if you were not able to attend Mix09.
This post represents my response to this year&#8217;s big [...]]]></description>
			<content:encoded><![CDATA[<div class="jbr">
<p>First, I have to give huge props to Microsoft for throwing an excellent party in Vegas this past week!&nbsp; The week was definitely packed with excitement and backed by great content.&nbsp; Be sure to check out <a target="_blank" href="http://videos.visitmix.com/MIX09">the recorded sessions</a> if you were not able to attend Mix09.</p>
<p>This post represents my response to this year&#8217;s big <em>unverbalized</em> question&#8230;</p>
<p><em><strong>What about WPF?</strong></em></p>
<p>Yes, this year&#8217;s conference felt like it was all about Silverlight 3.&nbsp; I think Microsoft would readily acknowledge that this was by design (no pun intended).&nbsp; And this was actually fine with me, since the Silverlight platform has made such great strides over the past couple of years.&nbsp; It certainly deserves the attention it is now getting.</p>
<p>I have a reputation for making fun of Silverlight from time to time.&nbsp; Truth be told, I bare no ill will toward Silverlight at all.&nbsp; I&#8217;ve even delivered Silverlight training on several occasions.&nbsp; I think of her as a kid sister to WPF (which plays the role of big sister, in case you were curious about either platform&#8217;s gender).&nbsp; Privately I&#8217;m pulling for Silverlight to make good, but that doesn&#8217;t stop me from publicly taking shots at her whenever the opportunity arises.&nbsp; It&#8217;s all in good fun&#8230; really! &nbsp;:)</p>
<p>I&#8217;m not exactly sure what role I&#8217;d give myself in all of this.&nbsp; Some might say that WPF and I are BFFs, but I&#8217;d argue against the latter F.&nbsp; To me, <em>&quot;forever&quot;</em> is a word that has no place in technology.&nbsp; When it comes to WPF, my devotion only goes as far as the platform presently supports.&nbsp; I am her student; I am her practitioner; I am even her disciple; but make no mistake&#8230; if something better comes along, I will turn her out like a two-bit whor&#8230; rible analogy!&nbsp; Let me change directions&#8230;</p>
<p>Based on what I see on the horizon right now, I think WPF and I still have a bright future together.&nbsp; Silverlight gets more impressive with each release, but it has quite a ways to go before it reaches parity with WPF.&nbsp; I just spent the better part of a conference watching web developers &quot;ooh&quot; and &quot;ah&quot; over features that I&#8217;ve been using in WPF for years now.&nbsp; (Imagine how they&#8217;d feel if they had something as basic as a trigger!&nbsp; See&#8230; there I go again&#8230;&nbsp; I just can&#8217;t help myself.&nbsp;;))</p>
<p>Additionally, I&#8217;m a platform guy.&nbsp; So much of what I do now requires a full trust environment with access to platform APIs.&nbsp; Until Silverlight breaks out of the sandbox and allows me to harness platform-specific features (which is not likely in the near-term, since it is so focused on cross-platform reach and a small footprint), I think WPF and I will stay pretty tight.</p>
<p><strong><em>Why bring all this up now?&nbsp;</em></strong></p>
<p>I&#8217;ve received a number of&#8230; shall we say&#8230; <em>&quot;concerned&quot;</em> inquiries lately about the shrewdness of adopting WPF for new or future projects while Microsoft has such an obvious slant toward Silverlight.&nbsp;</p>
<p>My honest recommendation to anyone deciding between WPF and Silverlight is unchanged over the last couple of years.&nbsp; The platform has to be chosen based solely on the project requirements.&nbsp; If Silverlight meets the requirements of your project and you need cross-platform reach, then you should definitely target Silverlight.&nbsp; End of story.</p>
<p>On the other hand, if you&#8217;re developing a full trust, Windows application, you will likely be far more successful with the more mature (and in my humble opinion, more elegant) big sister, WPF.</p>
<p><strong>Impending Doom</strong></p>
<p>Some emails have expressed an explicit fear that WPF is about to be abandoned by Microsoft and then disappear completely.&nbsp; Let me put my response to such concerns in terms that only a geek can truly appreciate&#8230;&nbsp;</p>
<p><em><a target="_blank" href="http://www.panix.com/~wlinden/adams.html"><font size="4">Don&#8217;t Panic!</font></a></em></p>
<p>To allay your fears, let me point you toward two very big buoys floating in the waters around Redmond: <em>Expression Blend</em> and <em>Visual Studio 2010</em>.&nbsp; The user interfaces these products are actively being built in WPF.&nbsp; Blend always has been a WPF application.&nbsp; For information on the upcoming Visual Studio 2010 UI, check out <a target="_blank" href="http://blogs.msdn.com/jasonz/archive/2009/02/20/a-new-look-for-visual-studio-2010.aspx">Jason Zander&#8217;s blog</a>.&nbsp; Feel free to anchor yourselves to these buoys.&nbsp; If these projects change direction, make sure you follow!&nbsp; (Can you imagine a Visual Studio user interface written in Silverlight?&nbsp; Even I think that would be awesome!)</p>
<p>I would also point out that many new features highlighted at Mix09 actually represent nice WPF advances too.&nbsp; I know Silverlight received most of the glory, but new Blend 3 features like <a target="_blank" href="http://videos.visitmix.com/MIX09/C01F">Sketch Flow</a>, <a target="_blank" href="http://videos.visitmix.com/MIX09/C27M">Behaviors</a>, and the <a target="_blank" href="http://videos.visitmix.com/MIX09/C28M">new Adobe importers</a> are actually just as pertinent to WPF as they are to Silverlight.&nbsp; And of course, there was the <a target="_blank" href="http://videos.visitmix.com/MIX09/T39F">sneak peak at WPF 4</a>.</p>
<p><strong>The Big &quot;If&quot;</strong></p>
<p>So what happens down the road <em>&quot;if&quot;</em> Silverlight does reach parity with WPF and it finally breaks out of the sandbox?&nbsp;</p>
<p>Should that ever happen, my response to potentially losing WPF would basically be a shrug and a big, <em>&quot;So what?&quot;</em>&nbsp; If Silverlight v.Next++ gives me everything I need for Windows client development and supports the same collaborative workflow as WPF, then why would I (or anyone) mourn the loss of WPF?&nbsp; At that point, I&#8217;d be more concerned if WPF <em>*was*</em> still around.</p>
<p>Again, let me be clear&#8230;&nbsp; I think this latter scenario is a big <em>&quot;If&quot;</em> and should things go in that direction, I don&#8217;t think we&#8217;re talking near-term.&nbsp; Microsoft can move very fast when the correct motivations are in place, but even at full speed, I think this would be a multi-year scenario.</p>
<p>Again, my take is that nothing lasts forever in technology.&nbsp; Both WPF and Silverlight will eventually be replaced by something bigger and better&#8230; or maybe smaller and better&#8230; who knows?&nbsp; For now, I&#8217;m a WPF junkie and a Silverlight user.</p>
<p><strong>Now the Important Stuff&#8230;</strong></p>
<p>Here are the Sudoku puzzles I conquered on my return flight from Vegas: <a href="http://drwpf.com/Apps/JAGS/JAGS10K.application?400600200090300805000089600300000760000040000024000008001930000208004010009007002">One</a>, <a href="http://drwpf.com/Apps/JAGS/JAGS10K.application?050003060100402900079800000040000600090040020002000010000008370008309002010700050">Two</a>, and <a href="http://drwpf.com/Apps/JAGS/JAGS10K.application?527080300000000807030006040090000708060000030402000010040700020105000000003090685">Three</a>.&nbsp;(See <a target="_blank" href="http://drwpf.com/blog/?p=47">JAGS 10K Instructions</a>&nbsp;for mouse play.)&nbsp;</p>
<p>Yep, three of them!&nbsp; Usually, I only make it through a single puzzle, but I was unexpectedly bumped to first class on this flight where I basqued in the glory of geek icons such as <a target="_blank" href="http://scorbs.com/">Scorbs</a>, <a target="_blank" href="http://weblogs.asp.net/scottgu/default.aspx">The Gu</a>, the WPF&nbsp;<a target="_blank" href="http://wpfwonderland.wordpress.com/">Wonder Man</a>, and even <a target="_blank" href="http://designerslove.net/">Nate Dunlap</a>!&nbsp; Their collective auras must have increased my puzzle IQ.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://drwpf.com/blog/2009/03/21/silverlight-how-i-really-feel-about-the-iridescent-thong/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>JAGS 10K, Platinum Edition</title>
		<link>http://drwpf.com/blog/2009/02/12/jags-10k-platinum-edition/</link>
		<comments>http://drwpf.com/blog/2009/02/12/jags-10k-platinum-edition/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 14:18:43 +0000</pubDate>
		<dc:creator>Dr. WPF</dc:creator>
				<category><![CDATA[Mix]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://drwpf.com/blog/?p=47</guid>
		<description><![CDATA[
There&#8217;s still time to vote in the Mix 10K Challenge!&#160;
Voting closes on Monday, February 16, 2009.&#160; If you haven&#8217;t yet voted, check it out.&#160; You simply rate the entries on a scale of 1 to 5.&#160; Feel free to start with my JAGS 10K entry&#160;(Just Another Game of Sudoku in 10K).&#160;  
A New Release [...]]]></description>
			<content:encoded><![CDATA[<div class="jbr">
<p>There&#8217;s still time to vote in the <a target="_blank" href="http://2009.visitmix.com/MIXtify/TenKGallery.aspx">Mix 10K Challenge</a>!&nbsp;</p>
<p>Voting closes on Monday, February 16, 2009.&nbsp; If you haven&#8217;t yet voted, check it out.&nbsp; You simply rate the entries on a scale of 1 to 5.&nbsp; Feel free to start with <a target="_blank" href="http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0130">my JAGS 10K entry</a>&nbsp;(Just Another Game of Sudoku in 10K).&nbsp; <img src='http://drwpf.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><strong>A New Release of JAGS 10K is Now Available</strong></p>
<p>On my recent return flight from San Antonio, I had the opportunity to tackle one of the toughest games of Sudoku yet.&nbsp; Only 20 cells were given.&nbsp; A typical &quot;hard&quot;&nbsp;puzzle gives you at least 25.</p>
<p>Naturally, I decided to attempt it within JAGS 10K (using the super secret method of loading a custom puzzle described in my <a target="_blank" href="http://drwpf.com/blog/?p=46">previous post</a>).&nbsp; Afterall, every developer should eat his own dogfood!</p>
<p>This attempt revealed that the golden release of JAGS 10K is lacking in a very key feature.&nbsp; Namely, there is no way to make visual cues within a cell.&nbsp; Most Sudoku players&nbsp;rely on these marks when solving a puzzle on paper.&nbsp; Without this ability on the computer, solving a tough puzzle is nearly impossible (unless you&#8217;re Dr. Spencer Reid from CBS&#8217;s <a target="_blank" href="http://www.cbs.com/primetime/criminal_minds/"><em>Criminal Minds</em></a>&#8230; yes, I&#8217;m a fan).</p>
<p>Clearly, I had some work to do!&nbsp; As such, I took some time this past weekend to add the required new feature and I&#8217;m happy to say that the new release is now <a target="_blank" href="http://drwpf.com/apps/jags/publish.htm">available for installation here</a>.</p>
<p><strong>Previous Features</strong></p>
<p>All of the original features are still there.&nbsp; You can play an auto-generated puzzle of a specific difficulty or you can load a puzzle from the web.</p>
<p><em><strong>Mouse Play:&nbsp; </strong></em>Some people commented on the lack of discoverability for mouse play.&nbsp; Unfortunately, 10K does not afford you any room for including instructions within the app and the stock cursors just don&#8217;t do it for this particular user interaction.&nbsp; So here&#8217;s the mouse play secret again&#8230; simply click on a cell and then drag down (or right) to increase the number and up (or left) to decrease it.&nbsp; (Designers:&nbsp; If it helps, I&#8217;ve been told by a few people that this is similar to how Blend&#8217;s&nbsp;property editor works for numerical properties.)</p>
<p><strong>New Features</strong></p>
<p>In JAGS 10K, Version 2.0, you can now hold down the Ctrl key to reveal visual cues that can then be toggled on or off, as seen here:</p>
<p><img height="209" alt="" width="405" border="1" src="http://drwpf.com/blog/Portals/0/Images/ShowMarks.jpg" /></p>
<p>When you release the Ctrl key, you will see only the markers that are toggled on:</p>
<p><img height="209" alt="" width="405" border="1" src="http://drwpf.com/blog/Portals/0/Images/JustMarks.jpg" />&nbsp;</p>
<p>Now you can truly solve any level of puzzle!&nbsp;</p>
<p>To make it even better, I added a more accessible way to specify a custom puzzle.&nbsp; Now you can simply pass the gameboard as a URL parameter.&nbsp; This allows you to easily share a puzzle with your friends.&nbsp; In fact, if you&#8217;d like to take a crack at it, here is that tough puzzle from my return flight:</p>
<p><a href="http://drwpf.com/Apps/JAGS/JAGS10K.application?000200000002930000005000670000000058070000020560000000014000900000076100000003000">http://drwpf.com/Apps/JAGS/JAGS10K.application?000200000002930000005000670000000058070000020560000000014000900000076100000003000</a></p>
<p>Enjoy! It took me nearly an hour to solve!&nbsp; Maybe you can beat me.</p>
<p>I also fixed a bug or two&nbsp;in the app and I added a minimize button (per Mladen&#8217;s suggestion in the comments for my official entry), so you can quickly hide the game if your boss walks in to your office! <img src='http://drwpf.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>Code Size</strong></p>
<p>So I&#8217;m sure you&#8217;re asking, &quot;What did these enhancements do to the size of the code?&quot;&nbsp; As you might expect, it increased it quite a bit.&nbsp; The size of the code actually went up by about 20 percent!</p>
<p>My first inclination was to simply release the updated version as <em>&quot;JAGS 12K&quot;</em>.&nbsp; But alas, if you can&#8217;t play by the rules, you shouldn&#8217;t play at all!&nbsp; So I&#8217;ve spent the last several nights getting extremely creative in the code.&nbsp; I&#8217;m happy to say that the code for this v.2 release is now once again 10K (exactly 10,240 bytes, to be precise).</p>
<p><strong>Source Code</strong></p>
<p>If you saw my original post, you know that it took a lot of work to get down to 10K in the first place.&nbsp; Explaining my latest tricks would take too long, so I&#8217;ve decided to instead just post the code for anyone who is really that interested.&nbsp; You can <a href="http://drwpf.com/blog/Portals/0/Samples/Jags10kSource.zip">download the project here</a>.&nbsp; <em>Caution: Don&#8217;t expect it to be very legible!</em></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://drwpf.com/blog/2009/02/12/jags-10k-platinum-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JAGS 10K has been posted</title>
		<link>http://drwpf.com/blog/2009/02/05/jags-10k-has-been-posted/</link>
		<comments>http://drwpf.com/blog/2009/02/05/jags-10k-has-been-posted/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 18:25:56 +0000</pubDate>
		<dc:creator>Dr. WPF</dc:creator>
				<category><![CDATA[Mix]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://drwpf.com/blog/?p=46</guid>
		<description><![CDATA[
My&#160;aforementioned Mix10K entry has now been posted.&#160; Please check it out, give it a rating, and let me know what you think.
I have just uploaded several new games, including some from The New York Times, The LA Times, and The Hindu (in honor of my original introduction to Sudoku).&#160; I even included the puzzles from [...]]]></description>
			<content:encoded><![CDATA[<div class="jbr">
<p>My&nbsp;<a href="http://drwpf.com/blog/?p=45">aforementioned</a> Mix10K entry has now been posted.&nbsp; Please <a href="http://2009.visitmix.com/MIXtify/TenKDisplay.aspx?SubmissionID=0130">check it out</a>, give it a rating, and let me know what you think.</p>
<p>I have just uploaded several new games, including some from The New York Times, The LA Times, and The Hindu (in honor of my original introduction to Sudoku).&nbsp; I even included the puzzles from my recent flight to San Antonio (just because I could <img src='http://drwpf.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ).</p>
<p>If you&#8217;re not into the syndicated games, you can also play auto-generated games at the difficulty level you select.</p>
<p>Enjoy your game!</p>
<p><em><strong>Secret Bonus Feature for Hardcore Sudoku Players</strong></em></p>
<p>I allow you to specify a gameboard on the command line.&nbsp; This requires you to locate the executable file, jags.exe, in the click once application cache (C:\Users\<em>[ProfileName]</em>\AppData\Local\Apps\2.0\<em>[obscure path]</em>\jags.exe).&nbsp; Simply pass an 81-character string of digits on the command line. Each 9-digit substring represents a row of the puzzle. Zeros (0s) represent empty cells.</p>
<p>If you actually use this feature, you may indeed have a problem.&nbsp; Consider joining Sudokuholics Anonymous.&nbsp; Maybe I&#8217;ll see you there!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://drwpf.com/blog/2009/02/05/jags-10k-has-been-posted/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Size Matters</title>
		<link>http://drwpf.com/blog/2009/01/31/size-matters/</link>
		<comments>http://drwpf.com/blog/2009/01/31/size-matters/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 21:12:17 +0000</pubDate>
		<dc:creator>Dr. WPF</dc:creator>
				<category><![CDATA[Mix]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://drwpf.com/blog/?p=45</guid>
		<description><![CDATA[
Ha! I did get a blog entry posted in January. (And I&#8217;m not dead, in case you were wondering&#8230; just swamped with work. Only a few weeks until my current project is complete and then I should have time to post some new stuff!)
Anyway, I thought I&#8217;d write a little blurb about my recent entry [...]]]></description>
			<content:encoded><![CDATA[<div class="jbr">
<p>Ha! I <em>did </em>get a blog entry posted in January. (And I&#8217;m <em>not</em> dead, in case you were wondering&#8230; just swamped with work. Only a few weeks until my current project is complete and then I should have time to post some new stuff!)</p>
<p>Anyway, I thought I&#8217;d write a little blurb about my recent entry into the <a href="http://2009.visitmix.com/MIXtify/TenKGallery.aspx" target="_blank">Mix 10K Smart Coding Challenge</a>. I did not plan to participate in this contest because of other demands on my time. Then Wednesday night someone mentioned that there were only two days left. I took a quick peek at some of the existing entries and I suddenly got the urge to give it a shot. Not that I thought I could do better&#8230; (I know my limitations when it comes to design! <img src='http://drwpf.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) Rather, it was the caliber of other participants that drew me in. Plus, the idea of squishing coolness into a mere 10K of code just seemed like fun. I just needed an idea!</p>
<p><img style="margin-left: 5px; margin-right: 5px; border: black 1px solid;" src="http://drwpf.com/blog/Portals/0/Images/sshardsudoku.jpg" border="1" alt="" width="217" height="294" align="right" />That&#8217;s when I saw one of my favorite Christmas stocking stuffers sitting on the corner of my desk&#8230; <em>Sit &amp; Solve Sudoku</em>. The shape of this little book says it all!</p>
<p>I love a good puzzle! I first discovered Sudoku a couple of years ago when spending a few weeks in India. Now it&#8217;s one of my favorite leisure activities when trapped on a plane.</p>
<p>Yes, I&#8217;m aware there are lots of online Sudoku games out there. But I&#8217;ll wager that very few, if any, are written using less than 10K of code! So there was my challenge. And I&#8217;m happy to say that I met that challenge.</p>
<p>You should be able to check out my entry, <em>JAGS 10K</em>, in the contest gallery shortly. I submitted it yesterday but it has yet to appear on the site.</p>
<p>I&#8217;ll add a link here when the app goes live. In the meantime, below is a sneak peak:</p>
<p><img style="border: black 1px solid;" src="http://drwpf.com/blog/Portals/0/Images/Jags10k.jpg" border="1" alt="" width="385" height="360" /></p>
<p>I probably won&#8217;t win any awards for this little game, but I&#8217;m pretty proud of it nonetheless! I had a blast packing it full of features and whittling it down to size.</p>
<p><strong><span style="font-size: small;">Introduction to JAGS 10K</span></strong></p>
<p>First, the name <em>JAGS 10K</em> stands for <em>&#8220;Just Another Game of Sudoku (in 10K)&#8221;</em>. It is quite possibly the smallest, fully functional version of Sudoku ever created! (hyperbole intended! <img src='http://drwpf.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</p>
<p><strong>Instructions</strong></p>
<p>If you&#8217;ve never played Sudoku before, the rules are quite simple&#8230; Fill in the grid such that every row, column, and 3&#215;3 box contains every digit from 1 to 9. That&#8217;s it!</p>
<p><strong>Game Play</strong></p>
<p>You can play JAGS 10K using the keyboard, the mouse, or both. For keyboard play, simply select a cell using the tab or arrow keys and press the desired number. Press 0 (zero) or Delete to clear a cell. For mouse play, simply click an empty cell and drag the mouse downward to cycle through the available digits. Release the mouse when you find the digit you desire.</p>
<p>The application will generate custom games for you, or it can obtain recently published games from the web. Just launch the app, choose your difficulty level, and enjoy!</p>
<p><strong>Cutting it Down to Size</strong></p>
<p>I thought it would be fun to share a few of the tricks I used to bring this application within the 10K limit. You can think of the remainder of this post as my tips for the next 10K challenge. <img src='http://drwpf.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>First, I should point out that JAGS 10K is written in WPF (duh!). But most of the tricks described here would work equally well in WPF or that other XAML-based platform. (You know what I&#8217;m talking about, right? That web platform. What was it called again? I&#8217;m sure you know what I mean, anyway&#8230; that technology whose logo looks like a big blue iridescent thong! Oh never mind.)</p>
<p>I should also point out that calling this contest a &#8220;smart&#8221; coding challenge is a bit of a misnomer. I would call it a &#8220;clever&#8221; coding challenge, at best. (But then they couldn&#8217;t play off the <em>&#8220;art&#8221;</em> in smart, so that wouldn&#8217;t fly.) In any event, making an application run in 10K or less involves the intentional implementation of some very poor coding practices! Using these tricks for a production application is <em>not</em> advisable.</p>
<p><strong>First Things First&#8230; Make it Work</strong></p>
<p>I began by simply writing the application the way I would any new WPF project. I always start with the view model and an extremely simple view to prove out the view model. This provides a very basic proof of concept app, without the eye candy (styling and visual appeal).</p>
<p>I was able to create a very simple Sudoku game in just a few short hours. I used fully descriptive variable names during this phase (since it&#8217;s rather important that one understand and easily follow the code they are creating). I also used a brute force algorithm for generating new game boards. I won&#8217;t bore you with the details, but I will readily admit that it is inelegant and architected purely to keep the code simple.</p>
<p><strong>Downsizing via the Obvious Stuff</strong></p>
<p>Once I had the game working the way I wanted, it was time to cut it down to size. At this point, it was about 60K. Clearly, when trying to get under 10 kilobytes, every byte counts! (Literally.) There are some very obvious things you can do: remove all white space, rename all variables using 1 character names, drop all the &#8220;private&#8221; qualifiers, group similar variables and declare them using a comma-delimited list, etc. After doing these things, I was down to about 20K.</p>
<p>Now for some of the less obvious tricks&#8230;</p>
<p><strong>Use integers instead of enum values</strong></p>
<p>The WPF and <em>BlueThong</em> platforms contain a lot of enums with long, descriptive value names. Typing out these names uses up precious bytes. In my code, I instead specified enum members via their explicit integral values, which are easily discovered using reflector.</p>
<p>For example, instead of using:</p>
<pre><span style="font-family: Courier New;">  ResizeMode=<span style="color: #339966;">ResizeMode</span>.CanResizeWithGrip;</span></pre>
<p>You might use:</p>
<pre><span style="font-family: Courier New;">  ResizeMode=(<span style="color: #339966;">ResizeMode</span>)3;</span></pre>
<p>Voila! You&#8217;ve just saved 15 bytes!</p>
<p>CAUTION: This is one of those shortcuts that you would never want to do in real code! If Microsoft decides to reorder enum values in a future update, the application will surely break.</p>
<p><strong>Use a series of if statements instead of a switch statement</strong></p>
<p>The following example combines the enum trick with the elimination of a switch statement to further reduce size (at the slight expense of performance). When processing keyboard input, each KeyDown event provides the key that was pressed using the System.Windows.Input.Key enum. Rather than writing typical code that looks like this:</p>
<pre><span style="font-family: Courier New;">  <span style="color: #0000ff;">switch</span> (e.Key)
  {
      <span style="color: #0000ff;">case</span> <span style="color: #339966;">Key</span>.Back:
      <span style="color: #0000ff;">case</span> <span style="color: #339966;">Key</span>.Delete:
          f();
          <span style="color: #0000ff;">break</span>;</span>

<span style="font-family: Courier New;">     <span style="color: #0000ff;">case</span> <span style="color: #339966;">Key</span>.NumPad0:
     <span style="color: #0000ff;">case</span> <span style="color: #339966;">Key</span>.D0:
           b();
           <span style="color: #0000ff;">break</span>;
  }</span></pre>
<p>I instead wrote code like this:</p>
<pre><span style="font-family: Courier New;"><span style="color: #0000ff;">  int</span> v=(<span style="color: #0000ff;">int</span>)e.Key;
<span style="color: #0000ff;">  if</span>(v==2||v==32)f();
<span style="color: #0000ff;">  if</span>(v==34||v==74)b();</span></pre>
<p>Even in its most compact form, the switch statement above requires 94 bytes, whereas the less optimal series of if statements using known integral values only requires 56 bytes. An instant savings of almost 40 bytes!</p>
<p><strong>Reuse Global Variables</strong></p>
<p>If you find yourself declaring a lot of similar variables in different methods, consider just declaring the variable once in the global scope of your class and reusing it in those various methods.</p>
<p><strong>Remember that code may be more compact than markup</strong></p>
<p>Instead of this:</p>
<pre><span style="font-family: Courier New;">  &lt;<span style="color: #993300;">ComboBox</span> <span style="color: #ff0000;">Name</span>=<span style="color: #0000ff;">"c"</span>&gt;
    &lt;<span style="color: #993300;">s:String</span>&gt;Easy&lt;/<span style="color: #993300;">s:String</span>&gt;
    &lt;<span style="color: #993300;">s:String</span>&gt;Medium&lt;/<span style="color: #993300;">s:String</span>&gt;
    &lt;<span style="color: #993300;">s:String</span>&gt;Hard&lt;/<span style="color: #993300;">s:String</span>&gt;
  &lt;/<span style="color: #993300;">ComboBox</span>&gt;</span></pre>
<p>You can do this:</p>
<pre><span style="font-family: Courier New;">  &lt;<span style="color: #993300;">ComboBox</span> <span style="color: #ff0000;">Name</span>=<span style="color: #0000ff;">"c"/</span>&gt;</span></pre>
<p>With this in the code behind:</p>
<pre><span style="font-family: Courier New;">  c.ItemsSource=<span style="color: #0000ff;">new string</span>[]{<span style="color: #993300;">"Easy"</span>,<span style="color: #993300;">"Medium"</span>,<span style="color: #993300;">"Hard"</span>}</span></pre>
<p>Another 40-byte savings!</p>
<p><strong>Instantiate variables using the var keyword</strong></p>
<p>Since this contest targets .NET 3.5 and the current releases of the .NET languages, there are some additional cool tricks at our disposal. For example, instead of doing this:</p>
<pre><span style="font-family: Courier New;">  <span style="color: #008080;">ListBoxItem</span> x=<span style="color: #0000ff;">new</span> <span style="color: #008080;">ListBoxItem</span>();</span></pre>
<p>You can do the following to save some bytes:</p>
<pre><span style="font-family: Courier New;">  <span style="color: #0000ff;">var </span>x=<span style="color: #0000ff;">new</span> <span style="color: #008080;">ListBoxItem</span>();</span></pre>
<p><strong>Use abbreviated property declarations</strong></p>
<p>If you don&#8217;t need to access their private backing fields, declare properties using abbreviated notation:</p>
<pre><span style="font-family: Courier New;"><span style="color: #0000ff;">  public string</span> T{<span style="color: #0000ff;">get</span>;<span style="color: #0000ff;">set</span>;}</span></pre>
<p><strong>Leverage an existing framework class for INotifyPropertyChanged support</strong></p>
<p>Remember, its <em>size</em> that matters&#8230; not efficiency. When I was looking for those last 100 bytes, I realized that a lot of space was wasted implementing the INotifyPropertyChanged interface on my view model class.</p>
<p>My original class began like this:</p>
<pre><span style="font-family: Courier New;"><span style="color: #0000ff;">  public class</span> <span style="color: #008080;">P </span>: <span style="color: #008080;">INotifyPropertyChanged</span>
  {
      <span style="color: #0000ff;">public event</span> <span style="color: #008080;">PropertyChangedEventHandler</span> PropertyChanged;
      <span style="color: #0000ff;">void</span> N(<span style="color: #0000ff;">string</span> n)
      {
          <span style="color: #0000ff;">if</span> (PropertyChanged != <span style="color: #0000ff;">null</span>)
              PropertyChanged(<span style="color: #0000ff;">this</span>, <span style="color: #0000ff;">new</span> <span style="color: #008080;">PropertyChangedEventArgs</span>(n));
      }</span></pre>
<p>Clearly this contains long class names that are out of my control. Even with the white space removed, the above support for INotifyPropertyChanged requires a full 193 bytes.</p>
<p>Knowing that the framework contains several classes that already implement INotifyPropertyChanged, I set out with reflector to find one that could be leveraged for my needs. I decided GroupStyle was a good candidate, so I changed my class to derive from it, as shown here:</p>
<pre><span style="font-family: Courier New;">  <span style="color: #0000ff;">public class </span><span style="color: #008080;">P</span>:<span style="color: #008080;">GroupStyle</span>
  {
      <span style="color: #0000ff;">void</span> N(<span style="color: #0000ff;">string</span> n){OnPropertyChanged(<span style="color: #008080;">new PropertyChangedEventArgs</span>(n));}</span></pre>
<p>Using this simple trick, I now had full support for property change notifications for about half the asking price (96 bytes instead of 193). Tricky, eh?</p>
<p><strong>Leverage Resources</strong></p>
<p>Watch for lengthy elements that appear multiple times in your markup and surface those as resources. For example, if you notice that you are applying the same drop shadow effect in multiple locations, declare it as a resource and simply use a StaticResource reference to reuse it. (Okay, this is just good general advice for structuring resources, but it is even more important when you are up against a 10K size limit. <img src='http://drwpf.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
<p><strong>Make a few hard choices about Form vs. Function</strong></p>
<p>Visual coolness costs big bytes! Markup-declared animations are very verbose. Styles are really lengthy because of all their Setters. The same is true for the Triggers collection on an element or within a style or template.</p>
<p>By the time I had developed the game engine and view model, I had already exhausted the majority of my 10K allotment. I then had to choose very carefully how I would design the actual user interface. I didn&#8217;t have room for gratuitous animations or other flashiness. In the end, I decided that my 10K app was more about function than form. (This decision may cost me in the voting, but I&#8217;m okay with that.) I was still able to pull off a nice look and feel (using a grand total of 10,195 bytes, or 9.96K) and I&#8217;m really happy with the overall product! In fact, I think I&#8217;ll bid you adieu now and go play another game of Sudoku!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://drwpf.com/blog/2009/01/31/size-matters/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Mix08: The Good, the Bad, and the Ugly</title>
		<link>http://drwpf.com/blog/2008/03/12/mix08-the-good-the-bad-and-the-ugly/</link>
		<comments>http://drwpf.com/blog/2008/03/12/mix08-the-good-the-bad-and-the-ugly/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 11:40:47 +0000</pubDate>
		<dc:creator>Dr. WPF</dc:creator>
				<category><![CDATA[Mix]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://drwpf.com/blog/?p=30</guid>
		<description><![CDATA[Having recently returned from&#160;Mix 08&#160;(yes, I stayed a few days beyond the conference), I thought I should follow up with my thoughts on this year&#8217;s event:
The Good


Silverlight 2 Beta&#160; (We&#8217;ve come a long way since JavaScript!)
The Balmer / Kawasaki Interview&#160; (Very entertaining on both sides)
Deep Zoom&#160; (No, it&#8217;s not one of those pay-per-view shows that [...]]]></description>
			<content:encoded><![CDATA[<p class="jbr">Having recently returned from&nbsp;Mix 08&nbsp;(yes, I stayed a few days beyond the conference), I thought I should follow up with my thoughts on this year&#8217;s event:</p>
<p class="jbr"><strong>The Good</strong></p>
<div>
<ul>
<li><a target="_blank" href="http://silverlight.net/GetStarted/#betajump">Silverlight 2 Beta</a>&nbsp; (We&#8217;ve come a long way since JavaScript!)</li>
<li><a target="_blank" href="http://sessions.visitmix.com/?selectedSearch=KYN0802">The Balmer / Kawasaki Interview</a>&nbsp; (Very entertaining on both sides)</li>
<li><a target="_blank" href="http://memorabilia.hardrock.com/">Deep Zoom</a>&nbsp; (No, it&#8217;s not one of those pay-per-view shows that they are promoting for $14.95 in your hotel room&#8230; you know&#8230; the ones where they feel it is important to stress that movie titles do <em>not</em> appear on your hotel bill.)</li>
<li>Meeting some community cohorts (like <a target="_blank" href="http://karlshifflett.wordpress.com/">Karl</a> and <a target="_blank" href="http://jmorrill.hjtcentral.com/">Jeremiah</a>)</li>
<li>Shaving off that <a target="_blank" href="http://designerslove.net/?p=167">ridiculous mustache</a> (huh? a woman with a mustache?)</li>
<li>Open Bar for the Mix party at <a target="_blank" href="http://www.taorestaurant.com/lasvegas/">Tau</a></li>
<li>Me (after my 2nd Sapphire and Tonic at Tau)</li>
</ul>
</div>
<p><strong>The Mediocre</strong></p>
<ul>
<li>The binding support in Silverlight 2 Beta&nbsp; (<font color="#993300">Alright, I originally had this under <em>The Bad</em>, but it was brought to my attention (thanks Nick) that the issues around data context inheritance have been fixed in the final&nbsp;Mix release.&nbsp; I updated my code and sure enough, it works!&nbsp; Nice!!&nbsp; Still&#8230;&nbsp;&nbsp;</font>I shouldn&#8217;t need to write code to establish the source of a binding.&nbsp; Once there is support for ElementName and RelativeSource, I will move this up to <em>The Good</em> section.&nbsp; And if you give me support for data validation and support for binding to XML data via XPath expressions (along with an XmlDataSource, of course), then I&#8217;ll create <em>The Excellent</em> section just for Silverlight binding!)</li>
</ul>
<p style="margin-right: 0px"><strong>The Bad</strong></p>
<ul>
<li>The price of just about anything within the confines of <a target="_blank" href="http://www.venetian.com/">The Venetian</a></li>
<li>The air quality anywhere near a Vegas casino</li>
<li>The faux vinyl, burlapesque manpurse given to each attendee</li>
<li>The scenery at <a target="_blank" href="http://www.taolasvegas.com/taobeach/">Tau Beach</a> during the Mix party</li>
<li>Me (after my&nbsp;5th Sapphire and Tonic at Tau)</li>
</ul>
<p><strong>The Ugly</strong></p>
<ul>
<li>The templating support in Silverlight 2 Beta&nbsp; (Have we just given up on the notion of a <em>lookless</em> control model?)</li>
<li>The T-shirt in the aforementioned manpurse&nbsp; (Come on guys&#8230; this is a designer-heavy event!&nbsp; I recognize that last year&#8217;s T-shirt design set a pretty high bar, but did you just give up and not even try this year?&nbsp; Even setting&nbsp;the design aside, the souvenir quality alone is enough to automatically relegate it to the Good Will box.&nbsp; For those unable to attend, I&#8217;m sure you&#8217;ll be able to pick one up at your nearest second hand store under a sign that says <em>&quot;7$ each or 2 for $10&quot;</em>.)</li>
<li>Me (after my 7th Sapphire and Tonic at Tau)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://drwpf.com/blog/2008/03/12/mix08-the-good-the-bad-and-the-ugly/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>up all mixed am I</title>
		<link>http://drwpf.com/blog/2008/02/28/up-all-mixed-am-i/</link>
		<comments>http://drwpf.com/blog/2008/02/28/up-all-mixed-am-i/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 01:13:47 +0000</pubDate>
		<dc:creator>Dr. WPF</dc:creator>
				<category><![CDATA[Mix]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://drwpf.com/blog/?p=29</guid>
		<description><![CDATA[As usual, it&#8217;s been a crazy few weeks leading up to Mix, but I swear I can hear Phantom music everytime I step into an elevator, so we must be really close now!
It should be another good conference this year and I hope to see a lot of you there.  You will be able to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.visitmix.com/" target="_blank"><img src="http://drwpf.com/blog/Portals/0/Images/Mix08.png" border="0" alt="" hspace="3" vspace="3" width="223" height="216" align="right" /></a>As usual, it&#8217;s been a crazy few weeks leading up to Mix, but I swear I can hear Phantom music everytime I step into an elevator, so we must be really close now!</p>
<p>It should be another good conference this year and I hope to see a lot of you there.  You will be able to recognize me because I&#8217;ll be the geeky looking one wearing jeans and a t-shirt.  In fact, I&#8217;d encourage you to approach anyone you see fitting this description and simply ask, <em>&#8220;Are you him/her?&#8221;</em></p>
<p>Hopefully things will slow down a bit in March and I&#8217;ll be able to increase my posts here and in the forums.  (Although I&#8217;m happy to say that 6 months after joining the MSDN forums, I&#8217;ve <em>finally</em> acquired my <a href="http://drwpf.com/blog/?p=16" target="_blank">4th star</a>. Yes, it took much longer than anticipated&#8230;  but oh well&#8230;  when life gives you lemons, throw them at someone!)</p>
<p>See you in Vegas!  (But will <em>you</em> see <em>me</em>?)</p>
]]></content:encoded>
			<wfw:commentRss>http://drwpf.com/blog/2008/02/28/up-all-mixed-am-i/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
