<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Vertigo: Blog</title><link>http://www.vertigo.com/Blog.aspx</link><description>Vertigo Blog</description><item><title>Hello </title><link>http://blogs.vertigo.com/personal/davids/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Wed, 02 May 2012 10:39:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/davids/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>davids</dc:creator><description><![CDATA[<div class="ExternalClassA2A4180505144FBA805E11736B79815E"><p>​Day 00002 at Vertigo; I'm the new guy. I upgraded my <a href="http://en.wikipedia.org/wiki/Just_another_Perl_hacker">JAPH</a> for Vertigo:</p>
<pre>map{print &quot;$_ &quot;}
split(/\d/, 
	join('', 
		map /(\w)\w/gi, 
		qw(Jaubsctd1a Aenfogthhiejrk2b Vlemrmtniqgnov3c Hoapcqkresrt)
	)
);
</pre>
<p><span style="text-transform:none;text-indent:0px;letter-spacing:normal;display:inline !important;font:13px verdana, arial, tahoma, calibri, geneva, sans-serif;white-space:normal;float:none;word-spacing:0px"></span> </p></div>
That is all.]]></description></item><item><title>Sneak Preview: 3D Video Support in the Silverlight Media Framework</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=23</link><pubDate>Tue, 29 Mar 2011 09:33:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=23#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class="ExternalClassE5D4D0A4B4DC411194288172D7E65500"><div class="ExternalClassDFC8179B0549482CA4B5D03878911D10 ms-rteThemeForeColor-2-0"><p class="ms-rteFontSize-2 ms-rteFontFace-1">I'm excited to announce that the upcoming 2.5 release of the Silverlight Media Framework (also known as the Media Platform Player Framework) will include support for playback of stereoscopic 3D video content. This powerful new functionality will allow developers to easily integrate 3D video content into their player experiences, and will allow dynamically changing, enabling and disabling 3D mode based on an end-user's preferences. </p>
<p class="ms-rteFontSize-2 ms-rteFontFace-1">Content providers can now provide a single encode of a stream, which the player can then dynamically display in a range of different 3D modes or standard 2D mode based on the user's preferences (and hardware/3D glasses availability). This dynamism provides a powerful tool for online broadcast of 3D content in that it does not leave any users out in the cold, unable to consume the content. You can now reach your entire user base, with 3D as an optional feature, with only a single video source! </p>
<p><span class="ms-rteFontSize-2 ms-rteFontFace-1">Here's a sneak preview of what will be included, as well as some background on how it all works:</span> <br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/032911_1633_SneakPrevie1.jpg" alt="" /><span style="font-size:14pt"><strong> </strong></span></p>
<p><span style="font-size:14pt"></span><span style="font-size:14pt"><strong>What's Included</strong></span> </p>
<ul class="ms-rteFontSize-2 ms-rteFontFace-1"><li><div>Anaglyph Stereoscopic 3D video plugin, packaged with the SMF 2.5 source code </div>
<ul><li>Support for Anaglyph 3D, Greyscale 3D, Left eye only modes </li></ul></li>
<li><div><a href="http://www.3dvisionlive.com/">NVidia 3DVision</a> Active Shutter Stereoscopic 3D plugin available for separate download </div>
<ul><li>NVidia's plugin is available at <span style="font-family:'arial', 'sans-serif';color:black;font-size:10pt"><a href="http://www.3dvisionlive.com/apps"><font color="#0000ff">www.3dvisionlive.com/apps</font></a></span></li></ul></li>
<li><div>Support for 3<sup>rd</sup> party Stereoscopic 3D plugins </div>
<ul><li>Tools to build your own Stereoscopic 3d implementation </li></ul></li>
<li><div>Simple implementation of 3D support for consuming applications: </div>
<ul><li>A new &quot;S3DProperties&quot; property has been added to the PlaylistItem class </li>
<li>Simply set up the appropriate S3D Properties, add a reference to the S3D plugin you'd like to use, and 3D will work automatically! </li></ul></li>
<li><div>Stereoscopic 3D supported for: </div>
<ul><li>Progressive Download (WMV, MP4) </li>
<li>Smooth Streaming </li></ul></li>
<li><div>Four new sample applications will be included in the Samples project to demonstrate how to use the Anaglyph 3D plugin: </div>
<ul><li>Simple Anaglyph 3D example </li>
<li>Multi-mode Anaglyph 3D example (toggling 3D on and off, changing modes) </li>
<li>3D support via HTML playlists </li>
<li>3D support via JavaScript playlists </li></ul></li>
<li><span>Full documentation will be available on </span><a href="http://smf.codeplex.com/">http://smf.codeplex.com</a><span><span> when SMF 2.5 is released</span> </span></li></ul>
<p><strong><span style="font-size:14pt"><span>Building Your Own S3D SMF-based Video Player</span></span><br /></strong><span><span class="ms-rteFontFace-1 ms-rteFontSize-2">The documentation to be released with SMF 2.5 will include full instructions on how to include 3D video content in your player, complete with sample applications. For a peek at how easy the setup will be, here's a quick how-to video: </span><a class="ms-rteFontFace-1 ms-rteFontSize-2" href="http://ecn.channel9.msdn.com/o9/content/smf/howto/v2/videos/smf3d.wmv">http://ecn.channel9.msdn.com/o9/content/smf/howto/v2/videos/smf3d.wmv</a><span class="ms-rteFontFace-1 ms-rteFontSize-2"> </span><p class="ms-rteFontFace-1 ms-rteFontSize-2"><span>The code generated during this video will also be available on Codeplex on the release date. </span></p>
<p><span style="font-size:14pt"><strong>Writing your own S3D Plugin<br /></strong></span><span class="ms-rteFontFace-1 ms-rteFontSize-2">The SMF 2.5 documentation will also include details on how to build a Stereoscopic 3D plugin of your own that will integrate with the new I3DPlugin interface. </span></p>
<p><strong><span style="font-size:14pt">How Does Stereoscopic 3D Work? </span><br /></strong><span class="ms-rteFontFace-1 ms-rteFontSize-2">Three of the most widely used 3D video display technologies are </span><a class="ms-rteFontFace-1 ms-rteFontSize-2" href="http://en.wikipedia.org/wiki/Anaglyph_image">passive complementary color anaglyph</a><span class="ms-rteFontFace-1 ms-rteFontSize-2"> (just referred to as &quot;anaglyph&quot; in this post), </span><a class="ms-rteFontFace-1 ms-rteFontSize-2" href="http://en.wikipedia.org/wiki/Polarized_3D_glasses">passive polarized</a><span class="ms-rteFontFace-1 ms-rteFontSize-2">, and </span><a class="ms-rteFontFace-1 ms-rteFontSize-2" href="http://en.wikipedia.org/wiki/LC_shutter_glasses">active liquid crystal shutter</a><span class="ms-rteFontFace-1 ms-rteFontSize-2">, each with pros and cons. Let's take a quick look at all three, and discuss how they work in the Silverlight Media Framework: </span></p></span></p>
<p> </p>
<p> </p>
<p><strong><span style="font-size:12pt">Anaglyph</span><br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/032911_1633_SneakPrevie2.jpg" alt="" /><br /></strong><br /><span class="ms-rteFontFace-1 ms-rteFontSize-2">The anaglyph approach to 3D uses two complementary colors as a filter for each eye. Most often, red and cyan are the colors used, and these are the colors currently supported by the SMF's Anaglyph S3D plugin. An anaglyph image (below) is displayed such that the left eye will view only red colors in the spectrum, and the right eye will view only blue and green colors (which combine to make cyan) to create the 3D effect.</span><br class="ms-rteFontFace-1 ms-rteFontSize-2" /><img class="ms-rteFontFace-1 ms-rteFontSize-2" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/032911_1633_SneakPrevie3.jpg" alt="" /><span class="ms-rteFontFace-1 ms-rteFontSize-2"> </span></p>
<p class="ms-rteFontFace-1 ms-rteFontSize-2">The SMF's anaglyph plugin creates an anaglyph image by taking a base video source with the left eye and right eye images side by side or top and bottom, and uses Silverlight pixel shaders to apply color filters to the images and superimpose them together to form a single image. We based the red-cyan anaglyph formula on Peter Wimmer's <a href="http://3dtv.at/Knowhow/AnaglyphComparison_en.aspx">anaglyph forumula</a> – we used the <a href="http://en.wikipedia.org/wiki/Rec._709">ITU BT.709</a> color matrix coefficients instead of the ITU BT.601 coefficients used by Peter. </p>
<p class="ms-rteFontFace-1 ms-rteFontSize-2"><span style="text-decoration:underline">Pros:</span> </p>
<ul class="ms-rteFontFace-1 ms-rteFontSize-2"><li>No special hardware is required to display the image </li>
<li>The glasses are very cheap (paper glasses can be purchased for less than 50 cents online) </li>
<li>The technology has very wide reach, and makes it the most common 3D display technology for images on the internet. </li></ul>
<p class="ms-rteFontFace-1 ms-rteFontSize-2"><span style="text-decoration:underline">Cons:<br /></span>The major disadvantages to anaglyph display are around the quality of the image being viewed: </p>
<ul class="ms-rteFontFace-1 ms-rteFontSize-2"><li>The left and right images are displayed superimposed on top of each other. </li>
<li><span>Due to the color filters, color resolution is lost. One technique to counter the color loss is to display a grayscale or monochrome anaglyph image: a colorless image suffers no color loss. The anaglyph plugin in the SMF supports a grayscale option – the pixel shaders have a modified algorithm that will turn a video stream with color images into a monochrome image before applying the red-cyan color filter.</span><br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/032911_1633_SneakPrevie4.jpg" alt="" /><span> </span></li></ul>
<p><strong><span style="font-size:12pt">Polarized</span><br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/032911_1633_SneakPrevie5.jpg" alt="" /><br /></strong><span class="ms-rteFontFace-1 ms-rteFontSize-2">You probably experienced polarized 3D the last time you saw a 3D movie in a theater. Linear polarization (as used by IMAX), and circular polarization (as used by RealD) work in a similar manner: the left and right eye images are superimposed through polarizing filters. In linear polarization, the polarized lenses in the glasses are oriented 90 degrees offset from each other (one vertically, and one horizontally), and in circular polarization one of the lenses is mounted in reverse (the advantage being that you can tilt your head and still maintain left/right separation).</span><br class="ms-rteFontFace-1 ms-rteFontSize-2" /><img class="ms-rteFontFace-1 ms-rteFontSize-2" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/032911_1633_SneakPrevie6.png" alt="" /><span class="ms-rteFontFace-1 ms-rteFontSize-2"> </span></p>
<p class="ms-rteFontFace-1 ms-rteFontSize-2">The Silverlight Media Framework does not currently have support for polarized 3D, since most users don't have interlaced polarized displays (LCD computer monitors such as <a href="http://www.vrlogic.com/html/hyundai.html">this one</a>). However, 3<sup>rd</sup> party developers are free to create a 3D plugin for interlaced polarized displays for the SMF. The approach would involve using pixel shaders to convert the frame compatible images into interlaced images. </p>
<p class="ms-rteFontFace-1 ms-rteFontSize-2"><span style="text-decoration:underline">Pros:</span> </p>
<ul class="ms-rteFontFace-1 ms-rteFontSize-2"><li>The color loss with anaglyph is eliminated using polarization, and the technology works well on the &quot;<a href="http://en.wikipedia.org/wiki/Silver_screen">silver screen</a>&quot;. </li>
<li>This achieves a superior image quality vs. anaglyph, though there is still resolution loss. </li></ul>
<p class="ms-rteFontFace-1 ms-rteFontSize-2"><span style="text-decoration:underline">Cons: </span></p>
<ul class="ms-rteFontFace-1 ms-rteFontSize-2"><li>The glasses are more expensive than anaglyph glasses, and special projection hardware is required to make this work. <strong></strong></li>
<li>This limits the versatility and reach of this technology, particularly with online video!<strong> </strong></li>
<li><span>Polarization only works with silver screen projection (such as in a theater) or interlaced polarized digital displays. Silver screens are inconvenient for home use and interlaced polarized displays are very rare. </span></li></ul>
<p><strong><span style="font-size:12pt">Active Shutter</span><br /></strong><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/032911_1633_SneakPrevie7.jpg" alt="" /><br /><span class="ms-rteFontFace-1 ms-rteFontSize-2">The anaglyph and polarized approaches are considered &quot;passive&quot; because to the glasses themselves don't have any active pieces. In contrast, Active LCD shutter technology uses powered glasses that filter each eye differently at different times. NVidia's </span><a class="ms-rteFontFace-1 ms-rteFontSize-2" href="http://www.3dvisionlive.com/">3D Vision</a><span class="ms-rteFontFace-1 ms-rteFontSize-2"> solution uses a 120Hz monitor to present the left and right eye images on alternating frames, while still maintaining a full 60Hz signal per eye. The glasses shut out the image to the left and right eye every 1/120</span><sup class="ms-rteFontFace-1 ms-rteFontSize-2">th</sup><span class="ms-rteFontFace-1 ms-rteFontSize-2"> of a second, syncing with the image on the monitor via an IR transmitter. </span></p>
<p class="ms-rteFontFace-1 ms-rteFontSize-2">NVidia worked with Vertigo to create an active shutter 3D Vision plugin for the Silverlight Media Framework, which will be available on NVidia's site. </p>
<p class="ms-rteFontFace-1 ms-rteFontSize-2"><span style="text-decoration:underline">Pros: </span></p>
<ul class="ms-rteFontFace-1 ms-rteFontSize-2"><li><div>Full resolution per eye, since the images are not superimposed. </div>
<ul><li>This allows full 1080p HD images to be viewed without any resolution loss, creating great looking video. </li></ul></li>
<li>No restrictions on viewing angle </li>
<li>Works on any PC with a recent (~5 years old or younger) NVidia GPU and 120Hz monitor and an <a href="http://store.nvidia.com/DRHM/store?Action=DisplayProductDetailsPage&amp;SiteID=nvidia&amp;Locale=en_US&amp;Env=BASE&amp;productID=111286000&amp;resid=TXaPxAoBAlcAAC9I90QAAAAe&amp;rests=1301416377324">NVIDIA 3D Vision IR emitter</a> </li></ul>
<p class="ms-rteFontFace-1 ms-rteFontSize-2"><span style="text-decoration:underline">Cons: </span></p>
<ul class="ms-rteFontFace-1 ms-rteFontSize-2"><li>Powered glasses are more expensive than polarized or anaglyph </li></ul>
<p class="ms-rteFontFace-1 ms-rteFontSize-2">Personally, I have to say that the NVidia Active Shutter technology is the most stunning 3D experience I've viewed so far – 3D video looks so much better in full resolution HD! </p>
<p><span style="font-size:14pt"><strong>Sample 3D Video Content<br /></strong></span><span class="ms-rteFontFace-1 ms-rteFontSize-2">Finally, Microsoft and NVidia have made the following sample video content available for developers: </span></p>
<p class="ms-rteFontFace-1 ms-rteFontSize-2"><strong>Smooth Streaming<br /></strong>Left Eye First, Side by Side:        <a href="http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_1080p30_SxS_LeftFirst.ism/manifest">http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_1080p30_SxS_LeftFirst.ism/manifest</a> <br />Right Eye First, Side by Side:        <a href="http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_1080p30_SxS_RightFirst.ism/manifest">http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_1080p30_SxS_RightFirst.ism/manifest</a> <br />Left Eye First, Top and Bottom:        <a href="http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_1080p30_TxB_LeftFirst.ism/manifest">http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_1080p30_TxB_LeftFirst.ism/manifest</a> <br />Right Eye First, Top and Bottom:    <a href="http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_1080p30_TxB_RightFirst.ism/manifest">http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_1080p30_TxB_RightFirst.ism/manifest</a> </p>
<p class="ms-rteFontFace-1 ms-rteFontSize-2"><strong>Progressive Download WMVs</strong><br />Left Eye First, Side by Side:        <a href="http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_720p30_SxS_LeftFirst.wmv">http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_720p30_SxS_LeftFirst.wmv</a><br />Right Eye First, Side by Side:        <a href="http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_1080p30_SxS_RightFirst.wmv">http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_720p30_SxS_RightFirst.wmv</a> <br />Left Eye First, Top and Bottom:        <a href="http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_720p30_TxB_LeftFirst.wmv">http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_720p30_TxB_LeftFirst.wmv</a> <br />Right Eye First, Top and Bottom:    <a href="http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_720p30_TxB_RightFirst.wmv">http://devplatem.vo.msecnd.net/3D/NVIDIA_3DV_PC_720p30_TxB_RightFirst.wmv</a> </p>
<p><span style="font-size:14pt"><strong>Have fun<br /></strong></span><span class="ms-rteFontFace-1 ms-rteFontSize-2">3D is exploding onto consumer devices like the </span><a class="ms-rteFontFace-1 ms-rteFontSize-2" href="http://www.nintendo.com/3ds">Nintendo 3DS</a><span class="ms-rteFontFace-1 ms-rteFontSize-2">, and I expect to see a big jump in 3D video online over the upcoming years. I'm very much looking forward to seeing the applications consumers of the Silverlight Media Framework create using this new addition to the SMF!</span></p></div></div>]]></description></item><item><title>Hacking an HTC Touch Pro2 to run Android</title><link>http://blogs.vertigo.com/personal/ericl/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Tue, 08 Mar 2011 20:08:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/ericl/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>ericl</dc:creator><description><![CDATA[<div class="ExternalClassFF292379F02F4CBA8B3E054687A4CB34"><p><img width="192" height="149" class="ms-rtePosition-2" alt="android-logo.png" src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/android-logo.png" style="margin:5px;width:101px;height:106px" />Recently, I stumbled across an old Engadget<span style="text-decoration:underline"> <a href="http://www.engadget.com/2010/03/11/htc-touch-pro-2-gets-a-new-lease-of-android-life-loves-it-vide/"><span style="color:blue">post</span></a></span> about how hackers were loading Android onto their WinMo phones. Since I had a HTC Touch Pro 2 (WinMo 6.1), one of the supported phones, I decided that I too wanted a 'HackDroid'. </p>
<p>   <br /></p>
<p> </p>
<p>After reading a few blog postings about how it could be done, eventually I stumbled across single website that had a <a href="http://reefermattness.scepterr.info/ProjectAndroid2.2BLAZN.092810.cab"><span style="color:blue;text-decoration:underline">cab file for installation</span></a>, a <a href="http://www.youtube.com/watch?v=RfxPjGO3LQk&amp;playnext_from=TL&amp;videos=N4ROtC7GXYI"><span style="color:blue;text-decoration:underline">short video of the installation experience</span></a>, and all the <a href="http://sites.google.com/site/androidport/links-extras"><span style="color:blue;text-decoration:underline">tools</span></a> in a single place. </p>
<p>What I liked about the project is that you do not need to flash the device with new firmware, making this a fairly row risk procedure. Android doesn't replace the native WinMo OS, but instead is stored on the phone's SD card, and after Android is booted, replaces WinMo in the RAM. If anything goes wrong, none of the phone's permanent ROM is changed, so rebooting takes the phone back into WinMo. </p>
<p>After watching a video of the installation experience, I borrowed a microSD card from a friend and gave it a try. </p>
<p>The version installed by the cab is v2.2 (Froyo), originally released May 20, 2010. The cab also placed a shortcut icon in my home screen which kicks off the boot process. </p>
<p>Android booting up: </p>
<p><img src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/030911_0351_HackinganHT1.jpg" alt="" /><span style="font-family:times new roman;font-size:12pt"> </span></p>
<p>After about a minute of warmup time, I was presented with the login screen. Success! </p>
<p><img src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/030911_0351_HackinganHT2.png" alt="" /><span style="font-family:times new roman;font-size:12pt"> </span></p>
<p>   </p>
<p>Desktop: </p>
<p><img src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/030911_0351_HackinganHT3.png" alt="" /><span style="font-family:times new roman;font-size:12pt"> <img src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/030911_0351_HackinganHT4.png" alt="" /></span></p>
<p>I immediately called work to tell them I was feeling sick and wouldn't be in for work the next day: </p>
<p><img src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/030911_0351_HackinganHT5.png" alt="" /><span style="font-family:times new roman;font-size:12pt"> </span></p>
<p>   </p>
<p>Unfortunately, the camera hardware drivers aren't working yet, so I saw this when I tried to take a picture. </p>
<p><img src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/030911_0351_HackinganHT6.png" alt="" /><span style="font-family:times new roman;font-size:12pt"> </span></p>
<p>   </p>
<p>The app store worked, and I was able to download games and utilities. The game of the year seems to be Angry Birds, so I made that my test case. Although it's slow, and there were some rendering issues, the game downloaded, installed, and ran. </p>
<p><img src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/030911_0351_HackinganHT7.png" alt="" /><span style="font-family:times new roman;font-size:12pt"> </span></p>
<p>   </p>
<p>Here's an example of a rendering issue. Sometimes graphic elements would get scrambled. </p>
<p><img src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/030911_0351_HackinganHT8.png" alt="" /><span style="font-family:times new roman;font-size:12pt"> </span></p>
<p>   </p>
<p>Pandora worked great: </p>
<p>   </p>
<p><img src="http://blogs.vertigo.com/personal/ericl/Blog/Lists/Photos/030911_0351_HackinganHT9.png" alt="" /><span style="font-family:times new roman;font-size:12pt"> </span></p>
<p>   </p>
<p> </p>
<p>The rough edges do show at times. For instance, I did have to run the installer three times before I successfully booting into Android; a friend had a similar experience. </p>
<p>Also, the system is a little unstable, so expect to pull the battery once in a while. Once, I adjusted the sound during a call and the phone went to speakerphone at max volume, and then proceeded to lock up. I could still hear the caller on the other side of the line, confused. This was pretty embarrassing, since I was in the office at the time. </p>
<p>   </p>
<p>In the end, it seems like a great start to this project, and I'm really excited with what they've done so far. </p></div>]]></description></item><item><title>Social Marketing of Premium Online Media Experiences</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=22</link><pubDate>Mon, 07 Mar 2011 15:16:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=22#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class="ExternalClass7DB711CA435945E3919A083A46F7B17F"><div>Here at Vertigo, we often come across &quot;Social Integration&quot; as a feature request for an application, particularly in our premium online video experiences. All too often, we see apps on the web that treat social integration as a checkbox on a feature list: Did I provide a link out to Facebook and Twitter? Check! </div>
<div><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/030711_2315_SocialMarke1.jpg" alt="" /> </div>
<div>What these basic social implementations often lack is a broader understanding of the client's overall social media and social marketing strategy. Companies with a clearly defined social marketing strategy understand that there's more to social media than just allowing your users to link to your application. </div>
<div>We've been fortunate to work with many clients who understand that the true power of social media lies in building tools that empower your fans to participate in the creation of your content, creating a two-way conversation that doesn't exist in the world of traditional broadcast media. They also understand that this level of participation and engagement has direct and measurable marketing benefits and impact on the monetization of their content. </div>
<div> </div>
<div><strong><span style="font-size:14pt">Conan's take</span> <br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/030711_2315_SocialMarke2.jpg" alt="" /><br /></strong>This <a href="http://tech.fortune.cnn.com/2011/02/10/conan-2-0/">article</a> in Fortune describes how Conan O'Brien discovered the power of social media in reviving his career. His show on TBS is now considered to be at the forefront of online social-savvy: clips from the show are released on YouTube to generate interest (a move that most players in the broadcast world oppose, taking licensed shows off of YouTube), and each show warrants a new Twitter hash tag. The TV audience and the live audience at the taping participate in a real-time conversation on Twitter and actually get to participate and drive the content: </div>
<blockquote><div>&quot;Between his bits, O'Brien would come backstage and ask, &quot;How's the tweets? How's the audience?&quot; By reading the hashtag stream, Bleyaert recalls, O'Brien and his team could see, for example, that &quot;some guy in the fifth row was using Twitter to try and pick up a 'girl in the white hat, three rows in front of the stage,' &quot; and O'Brien would instantly incorporate that into his next bit.&quot; </div></blockquote>
<div>Conan's advertisers and guests promoting their books/shows/etc. also reap the benefits of this social engagement – when you make a guest appearance on the show, you gain access not just to a TV audience, but to a massive online social audience as well. </div>
<div> </div>
<div><span style="font-size:14pt"><strong>Bringing participation to premium online video experiences</strong></span><br />Vertigo has recently had the opportunity to build premium online media experiences that take a similar approach: </div>
<ul style="margin-left:38pt"><li>Focus on engagement </li>
<li>Give your fans a <a href="http://sethgodin.typepad.com/seths_blog/files/flippingfunnelPRO.pdf">megaphone</a> to tell the world what they think </li>
<li>Allow 2-way participation in the content being viewed </li>
<li>Provide tools that make the content more relevant to specific users </li>
<li>Allow rapid creation of clips to provide shareable content while it's still relevant </li></ul>
<div>Some examples:<br /><br /><strong><span style="font-size:14pt">NBC's Sunday Night Football Extra 2010 and NHL Extra 2011:</span><br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/030711_2315_SocialMarke3.jpg" alt="" /> </strong></div>
<div>NBC Sports has done a great job driving forward a modern social media strategy via their online companions to sports broadcasts. Here are some of the features we worked to build with NBC to drive greater engagement from their fan base: </div>
<ol><li>Allow users to have a (moderated) conversation with each other via Twitter within the application </li>
<li>Allow users to participate in an ongoing conversation throughout the game by asking questions of Mike Florio from <a href="http://profootballtalk.nbcsports.com/">Pro Football Talk</a> </li>
<li>Provide a way for fans to wear their colors online by voting for their team in a Twitter Battle, driven by Twitter hash tags. </li>
<li>NBC posts highlight clips of key plays within a minute or two of their happening live (via the <a href="http://archive.msdn.microsoft.com/RCE">Silverlight Rough Cut Editor</a>). This allows fans to very quickly share out that bone-crunching tackle while the content is still hot and relevant. </li>
<li>Built a preview window that allows fans to share specific plays of their choosing with their friends. This empowers users to find the content they care about and drive what they discuss online, not restricting them to editorially-selected clip content. This is content that is relevant to each specific user, and provides a tool for users to create their own take on the content, allowing another avenue for participation in the event.<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/030711_2315_SocialMarke4.png" alt="" /> </li></ol>
<div><strong><span style="font-size:14pt">Microsoft's PDC 2010:</span><br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/030711_2315_SocialMarke5.jpg" alt="" /></strong> </div>
<div>The 2010 PDC event moved a large physical conference almost completely online. Microsoft recognized from the outset that to enable the level of networking and personal connections that happen at a physical conference, an aggressive social media strategy would need to be put in place. To help Microsoft achieve that goal, we built the following features in the PDC 2010 experience: </div>
<ol><li>Added a Twitter hash tag per session to allow users to discuss the content live in real-time </li>
<li>Allowed real-time Q&amp;A and Polling to allow the online audience to interact with the presenter and affect the content being presented. </li>
<li>Quickly created clips and on-demand content with the Rough Cut Editor. </li>
<li>Allowed bookmarking of specific locations in each session to allow users to share and discuss content relevant to them. </li></ol>
<div><span style="font-size:14pt"><strong>More engagement = more value<br /></strong></span>At the end of the day, what is the intrinsic value of all this additional participation and engagement? The answer is that it creates far more involved users. Those users will watch more video, and generate more revenue. They will also become evangelists of your content, drawing in a much larger overall audience (and again, more revenue). Moreover, those users will transcend the concept of a user, and become fans. Those fans will become a built-in marketing base (and marketing mechanism via the megaphone you gave them) for any future projects that follow similar participatory models. Finally, just like Conan's guests gain access to a huge social following by appearing on his show, the content and advertisers in your video experience will gain exposure to your social audience, which has a great deal of inherent value. An example here is NBC's Mike Florio, who now has a daily online broadcast, <a href="http://hqplayer.nbcsports.com/Player.html?PID=44">Pro Football Talk Live</a>, that complements his appearance on the weekly Sunday Night Football online broadcasts.<strong> </strong></div>
<div><span style="font-size:14pt"><strong></strong></span> </div>
<div><span style="font-size:14pt"><strong>You're not in control<br /></strong></span>One of the hesitations I often hear expressed about opening up your content to your users and fan base is the loss of control. What if my fans want the content to go in a different direction than I do? In my opinion, you're better off at least knowing that this is what your fans want, and having a 2-way channel available to discuss it with them. If you want to carve a bold vision and move in a direction you think your fans don't want now, but will like eventually, you have the tools to engage with them and let them know your thinking. And otherwise, maybe your fans have a good idea you haven't thought of: Betty White may not come to mind as a Saturday Night Live host, but perhaps listening to your online fans will net you a big success, as NBC did with the Betty White Facebook campaign. </div>
<div>Another concern is that if you open up the discussion to the world, people who don't like you can tarnish your image. While there are tools that can help mitigate blatantly offensive content appearing on your site, you'll probably have to accept a bit of risk that negative feedback will be made public. My opinion here is &quot;that's OK&quot;. You're never going to please everybody, and the value of having a public discussion about your content most likely outweighs any negativity out in the ether. Furthermore, this kind of feedback can serve as a type of analytics system. If your fan base passionately speaks out about a buggy feature or a content decision they dislike, at least you know it! If you're committed to the path of building a great experience your users will love, you should have faith that your efforts will pay off and the love will drown out any negative feelings in the public sphere.</div>
<div> </div>
<div> </div>
</div>]]></description></item><item><title>WCF PollingDuplex with Silverlight 4 and Ajax | POC results</title><link>http://blogs.vertigo.com/personal/karuna/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Tue, 01 Mar 2011 16:44:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/karuna/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>karuna</dc:creator><description><![CDATA[<div class="ExternalClass02027EE9DDCA4EBDB8547C719D078D4B"><p>I was recently playing around with WCF services, seeing what I could learn about duplex communications. I came up with the idea to build a demo application that would connect a HTML5 “audience” website with a Silverlight 4 “presentation” application. The specific idea was to have a GrokTalk audience use their iPads to send messages from Safari with AJAX calls to a WCF service, which would, in turn, forward data to a Silverlight application that would display the results. In turn, SL4 would return messages through WCF back to the HTML5 web clients, updating the browser with refreshed information. </p>
<p>I'm between projects. What the heck?</p>
<p>Well, that was the original, albeit admittedly contrived, idea. As it turns out, this original architecture did not pass the POC phase. While exploring the idea, however, I learned a bit about the current strengths and limitations of WCF's PollingDuplex binding and will summarize what I discovered here. </p>
<p>With the release of Silverlight 4, a new mode, called MultipleMessagesPerPoll, was added to PollingDuplex binding. For previous versions of Silverlight, duplex communications between WCF and Silverlight were achieved by having the client poll the server, and the server using its response as an opportunity to send data back to the client. One limitation of this initial PollingDuplex implementation is that the client cannot respond to the incoming server responses. A more severe limitation is that the server could only send one message per response. With the server only able to send one response per poll cycle, the queue for outgoing messages to the client could become quickly backlogged, even in a matter of a few seconds. </p>
<p>With Silverlight 4, PollingDuplex binding now has the MultipleMessagesPerPoll mode available. Now when WCF receives a poll request from the client, it is able to send multiple messages to the client using HTTP chunking. In fact, WCF attempts to hold open the response connection for as long as it can, until it times out or it experiences interference from the network. As soon as the connection is lost, the client sends a new request and the process repeats itself. Yavor Georgiev provides a more detailed explanation <a href="http://blogs.msdn.com/b/silverlightws/archive/2010/06/25/http-duplex-improvements-silverlight-4.aspx"><font color="#0000ff">here</font></a>.</p>
<p>While the MultipleMessagesPerPoll mode is a definite improvement over the original PollingDuplex implementation, it turns out to have some<span style="color:rgb(31, 73, 125)"> </span>limitations. First, for the non-server operating system (XP/Vista/Windows7), WCF will either reject or queue new client requests after the first 10 simultaneous connection are made. For server operating systems, the picture is a bit brighter. While IIS6 allows each long running connection to consume a thread from the pool (placing a serious limitations on the number of possible clients), with IIS7 on Windows Server 2008, asynchronous connections do not require their own thread, allowing for thousands of concurrent connections. </p>
<p>A more serious problem, however, then surfaced. A known issue with the current release of Silverlight <a href="http://blogs.msdn.com/b/silverlightws/archive/2010/12/15/pollingduplex-using-multiplemessagesperpoll-issue-in-latest-sl4-gdrs.aspx"><font color="#0000ff">causes faults in the PollingDuplex client channel</font></a>:<span style="color:rgb(31, 73, 125)"></span></p>
<blockquote dir="ltr" style="margin-right:0px"><div><i>This behavior is a regression introduced in SL4 GDR1 and is visible when the following conditions are put together:</i><span style="color:rgb(31, 73, 125)"></span></div>
<div><i>-Use of PollingDuplex <br />-DuplexMode is set to MultipleMessagesPerPoll <br />-Http stack is set to BrowserHttpWebRequest (the default stack) <br />-Client browser is IE8 with SL4 GDR1 or later runtime <br />-A poll completes after ServerPollTimeout and there is no content to consume by the client</i></div>
<div><i>Should you have all these conditions filled the client channel will fault. The issue will not manifest if you use any other browser.</i></div></blockquote>
<div><em></em><span style="color:rgb(31, 73, 125)"></span> </div>
<div>As luck would have it, this configuration was an exact match to mine. The only available workaround for IE8 currently available is to change the BrowserHttpWebRequest stack to ClientHttp. This change, however, then causes the same channel faults in Chrome 9 and Firefox 3.5. Microsoft states that they are currently working on a fix.  </div>
<div> </div>
<div>In addition to the limitations with PollingDuplex between Silverlight 4 and WCF, during my POC research, I also discovered a number of blocking issues with using a <a href="http://en.wikipedia.org/wiki/Comet_(programming)"><font color="#0000ff">Comet programming model</font></a> between WCF and an AJAX (non-ASP.Net) web site when viewed from iPad's Safari. While true duplex communication is not currently available between AJAX clients and a WCF service, I explored a number of ways to achieve similar results. During my research and discussions with coworkers, HTML5's HTTP WebSockets was suggested as a possible solution. The WebSockets API implements an <i>onmessage</i> callback for creating a persistent communications between server and client. It's an exciting technology and raises hopes for duplex communications as the HTML5 specification continues to mature and browser support becomes more prevalent. Although WebSockets, as well as other emerging features of HTML5, are currently available with Chrome, Chrome, unfortunately, is not currently available on the iPad. </div>
<div> </div>
<div>A final additional finding is that WCF does not provide support for WebSockets, although Glenn Block has <a href="http://blogs.msdn.com/b/silverlightws/archive/2010/12/15/pollingduplex-using-multiplemessagesperpoll-issue-in-latest-sl4-gdrs.aspx"><font color="#0000ff">posted</font></a> that Microsoft is working on an implementation. <a href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/07/27/silverlight-and-websockets.aspx"><font color="#0000ff">That implementation</font></a>, however, actually uses an embedded Silverlight 4 application that connects to WCF using PollingDuplex for browsers that do not support WebSockets. But in terms of using just AJAX without Silverlight as a fallback, my research did not find a way to communicate with WCF. </div>
<div> </div>
<div>Of course, I could create a similar result if I were to make significant changes to my architecture. I could drop the idea of using Safari on the iPad. There are also other technologies available in place of WCF, including Bayeaux, BOSH and JSONRequest -- all being solutions that were outside the scope of my explorations. Some of the problems with WCF PollingDuplex are slated to be fixed in the near future. Additionally, increased HTML5 support across browsers promises to make duplex communication between the browser and server more of a reality instead of a long sought-after dream. </div>
<div><br /></div>
<div>For those who have read this far, I would say, stay tuned. . . . It sounds as some major improvements are on the horizon. </div></div>]]></description></item><item><title>Delight Your Customers</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=21</link><pubDate>Thu, 17 Feb 2011 20:15:39 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=21#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class="ExternalClass8DB68C649FB64214BD7BE6C4185C46A0"><p>After giving a presentation on building premium media experiences up in Seattle earlier today, I'm sitting in SeaTac airport right now on a lengthy delay due to bad weather in San Francisco.  I'm flying Virgin America, and the folks at the desk let us know that our 7:00 flight will likely be delayed until 10:20 due to weather.  However, since the weather could change at any moment, the flight may take off at any time, and we should check in every 15 minutes to make sure we don't miss the flight.  So, that means that not only is my flight delayed for 3 hours, but I'm stuck in the boarding area.
</p><p>The agent (who I later learned is named Angie), also announced &quot;Please check in every 15 minutes – we'll do everything we can to notify you if the departure time changes.&quot;  I rolled my eyes at this statement – how many times have I heard airlines promise to do &quot;everything they can&quot; for me, when they actually mean they'll do absolutely nothing for me?  Feeling a bit snarky, I walked up to Angie and told her that I'd like to go get some dinner at a restaurant in the airport.  I asked her whether she would send me a text message if the departure time changed.  She replied, &quot;I can't text you, but I'd be happy to call your cell phone!&quot;
</p><p>I was floored.  Perhaps I'm too jaded an air traveler, but it's so rare to hear a high-level promise like that from an airline and actually see people on the ground follow through on it with such personalized service.  I happily went on my way to a nice relaxed dinner, and despite the nasty delay that will get me into SFO after the BART stops running, I feel like a very happy customer right now.
</p><p>One of the greatest advantages that small companies in insurgent positions in the market have over their larger competitors is the ability to discard far-reaching policies and bureaucratic edicts.  Instead, these smaller, more agile organizations can empower their employees on the ground to adapt to the situation at hand, and just do whatever it takes to delight each customer they encounter.  These type of organizations understand that the best marketing mechanism they posses are the daily interactions they have with each of their customers.  To quote <a href="http://www.azlyrics.com/lyrics/cake/shortskirtlongjacket.html">Cake</a>, these organizations &quot;use a machete to cut through red tape&quot;.
</p><p>I like to think that when we at Vertigo interact with our customers, we take a very similar attitude towards the way we work.  Not being bound by the restrictive rules typical of a larger organization gives us the freedom to experiment with new approaches that make sense for each client, whether that be a new architecture, unusual support hours, or a design process that eschews the usual conventions.  As an organization constantly on the leading/bleeding edge of new technologies, we're always trying to strike a good balance between breaking new ground and finding an efficient way to put our best practices into place on a larger scale.  To me, the key is to preserve the ability of each project team to adapt to the circumstances of their particular client's needs, while still making use of established patterns wherever possible to save time and add polish to existing features.
</p><p>Hats off to Angie and to Virgin America for continuing to serve as an example for nimble, small organizations who win by delighting their customers!</p></div>]]></description></item><item><title>Put Your Face on It </title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=20</link><pubDate>Tue, 01 Feb 2011 09:57:54 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=20#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class="ExternalClassBEAE0B45C7A24C57BBFF9A712CA0DF6D"><p>My wife is a big fan of <a href="http://www.lushusa.com/about/handmade-products/index.html">Lush</a> soaps, and I've noticed that the cans of lush products in our shower had stickers with people's faces on them.  
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/020111_1758_PutYourFace1.jpg" alt="" /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/020111_1758_PutYourFace2.jpg" alt="" />
	</p><p>This is what Lush's website has to say about these stickers:
</p><p style="margin-left:36pt">&quot;What has held us together for over 30 years is the pleasure we take from our work. Pouring a soap, mixing a cream, creating a fragrance, or rhythmically pressing 1,000 shampoo bars by hand give our lives meaning.  This makes us proud of what we produce and so we like to put our own individual 'mark' on each product before we sell it. The face sticker smiling out at you from every LUSH product tells you when it was made, the 'best before' date, and who was proud to make the product, by hand.&quot;
</p><p>This is a great way to personalize a product and engage with customers.  I wasn't surprised to read that this attitude extends to <a href="http://www.marketsentinel.com/blog/2010/10/lush%E2%80%99s-social-media-strategy-beats-body-shop%E2%80%99s/">Lush's social media strategy</a>, which uses tools such as Facebook and Twitter to engage on a personal level with their customers.  The linked article describes how this approach is handily beating the &quot;Post corporate messaging on Facebook&quot; approach being used by Lush's closest competitor, The Body Shop.
</p><p>This got me thinking about software, and how we organize teams of people to build it.  One of the most important factors in producing high quality software is to ensure that each member of team building it is intrinsically motivated and takes personal pride in the entire product they're producing.  In other words, that each member of the team is willing to put their face on a sticker and proudly slap it on their work. 
</p><p>When building complex software systems with large teams, potentially across several different partner companies, one of the keys to bringing together a successful project on time and on budget is the cohesion of all the team members.  The biggest pitfall in these large projects is often that each team member or partner company concentrates strictly on the piece of the system they are building, and disconnected silos of functionality end up forming.  The left hand doesn't know what the right is doing, and when it's time for all the pieces to come together, they don't!
</p><p>The way Lush operates ensures that a specific person is responsible for (and proud of) an entire product that they're delivering.  This is in contrast to other companies that may see each employee as a siloed station along an assembly line. 
</p><p>
 </p><p>Similarly, successful software projects have team members who take ownership of the project as a whole, and not just their silo.  People in the mindset of putting a sticker with their face on a product will keep track of dependencies between the different silos, perform testing across multiple partner companies to ensure that the bridge between each component is reliable and proven, and ensure that they're proud of the entire product their team is building, rather than just their specific functional area.  
</p><p>This is one reason that I believe in assigning <strong>vertical</strong> areas of ownership to each member on a team.  If a single person is responsible for an entire feature, from the UI to the middle tier logic to the database, they will know exactly how it is supposed to work, which design makes sense, and will drive the feature to completion and testing.  Most importantly, it guarantees that the feature works end-to-end, and drives features to become real and working as fast as possible.  Of course, even in the vertical approach, designers will still work primarily on the UI, and a SQL expert may do the bulk of the DB work.  The key is that each vertical feature has an owner looking after it, regardless of the owner's particular skill set.
</p><p> In horizontal areas of ownership, where one person owns the DB, another owns the cloud services, and another owns the UI, a siloed attitude of &quot;that's not in my purview&quot; can arise.  There's also no driving force to making a feature work end-to-end, as people can see their part as &quot;complete&quot; even when it isn't wired up and working.  
</p><p>As a project lead, I want to see Jim's face on a sticker slapped on to the &quot;Login&quot; feature, and Mary's face on a sticker slapped on the &quot;Post to Facebook&quot; feature.  That lets me know that those features have dedicated owners who take pride in the entire user experience of each part of the application, and who focus on delivering a real, working feature, rather than a disconnected component.  
</p><p>What does your team do to put your faces on the products that you build by hand every day?</p></div>]]></description></item><item><title>PDC 2010: Using Silverlight and Azure to Give Global Reach to a Local Conference</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=19</link><pubDate>Thu, 04 Nov 2010 15:26:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=19#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class="ExternalClassD206D07A03544D9BB948F63971BDEBD0"><p class="ms-rteFontSize-2"><span class="ms-rteThemeForeColor-2-0">When Microsoft announced that this year's</span> <a href="http://www.microsoftpdc.com/">Professional Developers Conference</a> <span class="ms-rteThemeForeColor-2-0">would be limited to 1,000 attendees and held on the Microsoft Campus in Redmond, some were surprised at the departure from the typical conference site at the LA Convention Center and the smaller than usual limit on the number of attendees. In fact, the 2010 PDC turned out to be the largest PDC that Microsoft has ever done. By making use of</span> <a href="http://www.silverlight.net/">Silverlight</a> <span class="ms-rteThemeForeColor-2-0">and</span> <a href="http://www.iis.net/download/SmoothStreaming">IIS Smooth Streaming</a> <span class="ms-rteThemeForeColor-2-0">technology, Microsoft was able to extend the traditional reach of the PDC to a much larger global audience than had ever previously been possible. </span></p>
<p class="ms-rteFontSize-2"><span class="ms-rteThemeForeColor-2-0">Vertigo is proud to have participated in this groundbreaking event by building an interactive </span><a href="http://smf.codeplex.com/">Silverlight Media Framework</a>-<span class="ms-rteThemeForeColor-2-0">based video player and PDC conference application that allowed the widest level of participation ever for a PDC. The online consumption</span> <a href="http://www.microsoft.com/presspass/press/2010/nov10/11-01Statement.mspx">numbers</a> <span class="ms-rteThemeForeColor-2-0">that Steve Ballmer mentioned in his PDC Summary are pretty staggering, considering that only 1,000 people physically attended the conference: </span></p>
<p class="ms-rteFontSize-2 ms-rteThemeForeColor-2-0" style="margin-left:36pt">&quot;In addition to more than 30,000 developers at 250 PDC events worldwide, another 100,000 developers viewed the event online using Silverlight, with 10% of the online audience taking advantage of simultaneous translation into Japanese, Spanish, French and Chinese. This is incredible reach.&quot; </p>
<p class="ms-rteFontSize-2 ms-rteThemeForeColor-2-0">Beyond this amazing breadth of reach is the depth of participation that the online PDC experience enabled. By integrating real-time Q&amp;A, polls, and Twitter conversations, users watching remotely don't just watch remotely – they actually get to participate in the sessions as if they were right there in the room. Additionally, international users enjoyed simultaneous translation into 5 different languages to allow a level of understanding of the content that may not have been possible outside the online experience. </p>
<p class="ms-rteFontSize-2"><span class="ms-rteThemeForeColor-2-0">Let's take a look at some of the features of the application:</span> </p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><strong><span class="ms-rteThemeForeColor-2-0" style="font-size:14pt">Live HD Streaming of 2 Video Feeds per Session with DVR Capability<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin1.png" alt="" /></span> </strong></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2 ms-rteThemeForeColor-2-0">The PDC player shows 2 synced up video feeds simultaneously: the &quot;slide deck/code view&quot; feed, which shows what the presenter is actually doing on the presentation computer, and the feed showing the actual presenter in a smaller video rectangle. These feeds can be swapped so that the more interesting feed can be seen in the larger video window at any time. Users enter live presentations at the live point, but can DVR back to any point in the presentation they wish via the timeline. Users can also use the DVR controls to jump back 15 seconds if they missed something, or to rewind or fast forward while watching the video content. <br /></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><span style="font-size:14pt"><strong><span class="ms-rteThemeForeColor-2-0">Live Multi-Language Audio</span><br class="ms-rteThemeForeColor-2-0" /><img class="ms-rteThemeForeColor-2-0" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin2.png" alt="" /> </strong></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><span class="ms-rteFontSize-2"><span class="ms-rteThemeForeColor-2-0">In order to extend the reach of the PDC internationally,</span> </span><a class="ms-rteFontSize-2" href="http://microsoftstudios.com/">Microsoft Studios</a><span class="ms-rteFontSize-2 ms-rteThemeForeColor-2-0"> organized a phalanx of translators in their facility during the conference to provide live audio translation in 4 languages (Chinese, Japanese, French, and Spanish) for each of the 4 sessions – that's 16 different translations happening simultaneously and live. The player allows users to switch seamlessly to an alternate audio track to listen to these translations. This is a huge feature, as it allowed international viewers to understand the content being discussed in a way they may never have been able to except in this unique online experience. <br /></span><span class="ms-rteThemeForeColor-2-0" style="font-size:14pt"><strong></strong></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteThemeForeColor-2-0"><span style="font-size:14pt"><strong>Live Closed Captioning<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin3.png" alt="" /> </strong></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2 ms-rteThemeForeColor-2-0">The complement to live audio translation, live presentation of Closed Captions for each of the 4 simultaneous sessions (again provided by the folks at MS Studios) provided a way for users with hearing disabilities or those users who did not have the ability to play audio in their environment to consume the content. <br /></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteThemeForeColor-2-0"><span style="font-size:14pt"><strong>Sharing/Deep Linking<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin4.png" alt="" /></strong></span> </p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2"><span class="ms-rteThemeForeColor-2-0">Each of the PDC's sessions can be shared out via Twitter. In addition to this, a specific location within a video can be deep-linked to using the bookmark feature to allow users to direct their colleagues to specific segments of a video covering a topic of interest. For example,</span> <a href="http://player.microsoftpdc.com/Session/276fa8c4-c2e2-41b2-b552-80490c2a196c/25035.5">here's a deep link to Eric Schmidt discussing the PDC online experience on Channel 9 Live</a> <span class="ms-rteThemeForeColor-2-0">(this is a great discussion of what it took for all the partners involved to make the PDC online event come together). The Channel 9 feed is a 7 and a half hour video, but the bookmark/deep linking allows me to single out the topic within the Channel 9 show that I'm interested in. <br /></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><strong class="ms-rteThemeForeColor-2-0"><span style="font-size:14pt">Multiple Content Delivery Networks (CDNs)</span><br /></strong><span class="ms-rteFontSize-2"><span class="ms-rteThemeForeColor-2-0">Because the PDC's online video content is distributed internationally, the team set up a system to identify which CDN would provide the best video delivery experience to the user and have the player select that network as the video delivery endpoint. For instance, users in China were directed to stream video cached by</span> </span><a class="ms-rteFontSize-2" href="http://www.chinacache.com/">ChinaCache</a><span class="ms-rteFontSize-2">. <span class="ms-rteThemeForeColor-2-0">Users in the United States currently pull video content from </span></span><a class="ms-rteFontSize-2" href="http://www.microsoft.com/windowsazure/cdn/default.aspx">Windows Azure's CDN</a><span class="ms-rteFontSize-2"><span class="ms-rteThemeForeColor-2-0">, and live feeds were delivered by</span> </span><a class="ms-rteFontSize-2" href="http://www.akamai.com/">Akamai</a><span class="ms-rteFontSize-2">. <br /></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteThemeForeColor-2-0"><span style="font-size:14pt"><strong>Real-Time Polling and Q&amp;A<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin5.png" alt="" /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin6.png" alt="" /> </strong></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteThemeForeColor-2-0"><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin7.png" alt="" /><span style="font-size:14pt"><strong> </strong></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2"><span class="ms-rteThemeForeColor-2-0">A key goal of the PDC online experience was to allow users to engage with the live sessions and participate in the same way that a user in the same physical room as the session would. To this end, the player allowed users to ask questions and receive back answers, and to participate in polls initiated by the presenter of the session. These were driven by services running on</span> <a href="http://www.microsoft.com/windowsazure/windowsazure/">Windows Azure</a> <span class="ms-rteThemeForeColor-2-0">to ensure scalability for a large number of users. <br /></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteThemeForeColor-2-0"><span style="font-size:14pt"><strong>Twitter<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin8.png" alt="" /></strong></span> </p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2 ms-rteThemeForeColor-2-0">The final piece of the puzzle in bringing an online conference into social parity with the experience of physically attending the conference is to allow attendees to engage with other attendees, and to foster discussions and conversations among the audience about the material. Each session at the PDC was given an identifying hash tag, and users could engage in a conversation with each other about the material in real-time as it was being presented via Twitter from within the PDC application. An advantage to the online approach is that these discussions can happen in parallel with the session itself without causing a distraction or interruption to the session (and anything a user might miss while conversing can simply be re-watched by DVR-ing backwards).<span><strong> <br /></strong></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><span style="font-size:14pt"><strong><span class="ms-rteThemeForeColor-2-0">Ratings and Metrics</span><br class="ms-rteThemeForeColor-2-0" /><img class="ms-rteThemeForeColor-2-0" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin9.png" alt="" /> </strong></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2 ms-rteThemeForeColor-2-0">Another key goal of the PDC online experience was to track metrics data about both the health of the video ecosystem (number of video failures, number of video starts, etc.), and the value of each session's content to the users. At the conclusion of each session, users are asked to rate and comment on the session. Here's the cool part: that feedback is then consumed in real-time by the PDC application and used to guide other users to what the community considers to be the most important content. More on this in the next section: <br /></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><span class="ms-rteThemeForeColor-2-0" style="font-size:14pt"><strong>PDC Now<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin10.png" alt="" /></strong></span> </p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2 ms-rteThemeForeColor-2-0">The PDC Now page allowed for a central hub and landing page for the application that guides users to the most valuable content. Live content was always featured front-and-center, but the deep value of this page lies in its display of the ratings and metrics data gathered from all of the active players on the internet. As you can see above, users can browse content based on data such as the most popular or most watched videos, or view sessions based on which were the most highly rated by viewers. The player also displays data about the number of users currently viewing each session (see the yellow arrow above). <br /></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><span style="font-size:14pt"><strong><span class="ms-rteThemeForeColor-2-0">Guide</span><br class="ms-rteThemeForeColor-2-0" /><img class="ms-rteThemeForeColor-2-0" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin11.png" alt="" /> </strong></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2 ms-rteThemeForeColor-2-0">The guide section (of which both a Silverlight and HTML version were built) provided additional ways for users to explore content – by the PDC schedule, by session, or by speaker. While browsing for content on the Guide or PDC Now pages, the active video simply minimizes to the bottom-right corner and continues to play with audio. This allows users to explore content without losing track of the information being presented in their active session. <br /></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteThemeForeColor-2-0"><span style="font-size:14pt"><strong>Skip Into<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin12.png" alt="" /></strong> </span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2 ms-rteThemeForeColor-2-0">Each live session begins with a few minutes of video slate while the encoders are fired up but the session has not yet started. However, we don't want users to have to sit though that slate once the session becomes Video on Demand content. We also don't want to spend time editing out the slate, so a solution was devised to allow the player to use a &quot;Skip Into&quot; time to begin the video at the exact time the session actually starts. <br /></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteThemeForeColor-2-0"><span style="font-size:14pt"><strong>Download Materials<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin13.png" alt="" /></strong></span> </p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteThemeForeColor-2-0"><span class="ms-rteFontSize-2">Users can access all the relevant Powerpoint decks as well as downloadable WMV copies of the session videos in the Download Materials section.</span> <br /></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><span style="font-size:14pt"><strong><span class="ms-rteThemeForeColor-2-0">News Feed</span><br class="ms-rteThemeForeColor-2-0" /><img class="ms-rteThemeForeColor-2-0" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin14.png" alt="" /> </strong></span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2 ms-rteThemeForeColor-2-0">The RSS-based news feed allows users to keep in touch with the latest news from the conference. <br /></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><strong><span class="ms-rteThemeForeColor-2-0" style="font-size:14pt">Windows Phone 7 App<br /><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin15.jpg" alt="" /></span> </strong></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2"><span class="ms-rteThemeForeColor-2-0">Vertigo also built a Windows Phone 7 app that allows smooth streaming video content to be viewed using the Silverlight Media Framework for Windows Phone. See</span> <a href="http://blogs.msdn.com/b/benriga/archive/2010/10/27/pdc-on-your-windows-phone-7.aspx">Ben Riga's blog post</a> <span class="ms-rteThemeForeColor-2-0">for more details. </span></p>
<p class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F"><span class="ms-rteThemeForeColor-2-0" style="font-size:14pt"><strong>Dream Team<br /></strong></span><span class="ms-rteFontSize-2 ms-rteThemeForeColor-2-0">Pulling off an event as large and broad-reaching as the PDC online experience is a huge effort involving many partners. For a look at all of the partners involved in this effort and their roles:</span><span class="ms-rteFontSize-2"><strong> </strong></span></p>
<div class="ExternalClassEC0782C2CDD543B1990334A7FB5D071F ms-rteFontSize-2"><ul><li><a href="http://www.istreamplanet.com/"><strong>iStreamPlanet</strong></a><br /><span class="ms-rteThemeForeColor-2-0">Encoding and delivery of the live and on-demand video.</span><strong> </strong></li></ul></div>
<div class="ExternalClass8856D2C2B3C34F70826DFC6B5BA67CF0 ms-rteFontSize-2"><ul><li><div><a href="http://www.vertigo.com/"><strong>Vertigo</strong></a><strong> </strong></div>
<p><span class="ms-rteThemeForeColor-2-0">Built and operated the PDC online player application, schedules, and Windows Phone 7 app.</span> </p></li>
<li><div><a href="http://www.southworks.net/"><strong>Southworks</strong></a><strong> </strong></div>
<p class="ms-rteThemeForeColor-2-0">Creation and operation of the Content Management System that allowed all of the complex data about the event to be managed in real-time. </p></li>
<li><a href="http://www.inlethd.com/?q=products/spinnaker"><strong>Inlet</strong></a><br /><span class="ms-rteThemeForeColor-2-0">Manufacturer of the Spinnaker encoders used for the live video content.</span> <br /><br /></li>
<li><a href="http://www.akamai.com/"><strong>Akamai</strong></a><br /><span class="ms-rteThemeForeColor-2-0">Content Delivery for live streams.</span><strong> </strong><strong></strong></li></ul></div>
<ul class="ms-rteFontSize-2"><li><div><a href="http://www.chinacache.com/"><strong>ChinaCache</strong></a><strong> </strong></div>
<p><span class="ms-rteThemeForeColor-2-0">Natively delivering content into China via their CDN.</span><strong> </strong></p></li>
<li><div><a href="http://www.microsoft.com/windowsazure/cdn/default.aspx"><strong>Azure CDN</strong></a><strong> </strong></div>
<p><span class="ms-rteThemeForeColor-2-0">Delivering all on-demand video via the Azure CDN solution.</span><strong> </strong></p></li>
<li><a href="http://microsoftstudios.com/"><strong>MS Studios</strong></a><br /><span class="ms-rteThemeForeColor-2-0">Provided closed captioning, audio translation, and origination of the video streams in Redmond.</span><strong> <br /><br /></strong></li>
<li><div class="ms-rteThemeForeColor-2-0"><strong>MS DPE Team </strong></div>
<p><span class="ms-rteThemeForeColor-2-0">Organized all partners and deliverables and oversaw the PDC online event operation.</span><strong> </strong></p></li>
<li><div><a href="http://www.iis.net/"><strong>IIS Media Services Team</strong></a><strong> </strong></div>
<p><span class="ms-rteThemeForeColor-2-0">Provided support for smooth streaming technology.</span><strong> </strong></p></li>
<li><div><a href="http://www.silverlight.net/"><strong>MS Silverlight Team</strong></a><strong> </strong></div>
<p><span class="ms-rteThemeForeColor-2-0">Provided support for Silverlight technology used by the player.</span> </p></li>
<li><a href="http://www.evertz.com/products/HD9084"><strong>Evertz</strong></a><br /><span class="ms-rteThemeForeColor-2-0">Manufacturer of the Closed Captioning encoders.</span><strong class="ms-rteThemeForeColor-2-0"> </strong></li></ul>
<p class="ms-rteFontSize-2 ms-rteThemeForeColor-2-0">I want to send a big thank you both to the talented designers and developers at Vertigo who helped the PDC application become a reality, as well as all of our partners on this project who worked very hard to make the streaming live video experience itself a reality. <br /></p>
<p><span class="ms-rteThemeForeColor-2-0" style="font-size:14pt"><strong>Full Screen<br /></strong></span><span class="ms-rteFontSize-2 ms-rteThemeForeColor-2-0">Let's end it with a screenshot of what the player looks like in full screen, where the secondary video transitions to a Picture-in-Picture mode</span><span class="ms-rteThemeForeColor-2-0">:</span><img class="ms-rteThemeForeColor-2-0" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/110410_2121_PDC2010Usin16.png" alt="" /><span style="font-size:14pt"><strong> </strong></span></p>
<p><span style="font-size:14pt"><br /></span> </p></div>]]></description></item><item><title>Sunday Night Football Extra 2010: Back and Better than Ever</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=18</link><pubDate>Wed, 22 Sep 2010 17:09:37 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=18#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass866C95AF32BA424ABD7CD3D2D40739A9><p>I'm proud to announce the launch of Vertigo's latest live HD video experience: NBC's <a href="http://snfextraplayer.nbcsports.com/Player.html">Sunday Night Football Extra 2010</a><span style="color:#1f497d">!  </span>You can check out the live action every Sunday Night this season. 
</p><p>We first worked with NBC last year, building the Sports Emmy®-nominated <a href="http://www.vertigo.com/SNF.aspx">SNF Extra 2009 application</a><span style="color:#1f497d">.  </span>We've since partnered with NBC to build the 2010 Vancouver Winter Olympics video experience, as well as this year's US Open (golf) and Wimbledon live HD video players. Vertigo's team for this project has returned to Sunday Night Football again this fall with the ambition to design<strong> the most engaging live sports experience ever created for the web</strong>.  
</p><p>A great way to get a feel for the application in only a couple of minutes is to watch this video <a href="http://bit.ly/snfextrapromo">http://bit.ly/snfextrapromo</a>, which provides a quick high-level run down of all the features in the application.  For some more depth, let's crack open the application, take a look at some of the goals we set out with, and discuss how we solved some tricky design challenges to create an industry-leading live video experience for the web!<strong>
		</strong>
	</p><p><span style="font-size:14pt"><strong>Great looking, High Definition video<br></strong></span>Using Microsoft's <a href="http://www.iis.net/download/smoothstreaming">IIS Smooth Streaming</a> technology and working with our partners at <a href="http://www.istreamplanet.com/">iStreamPlanet</a> and <a href="http://www.akamai.com/">Akamai</a>, the video you see in this player will once again serve as the standard for clean, smooth, multi-bitrate, adaptive HD video on the web.  The core video player is built using the open source <a href="http://smf.codeplex.com/">Silverlight Media Framework</a>, which Vertigo developed in cooperation with Microsoft.<strong><span style="color:#1f497d">
			</span><span style="font-size:14pt">
			</span></strong></p><p><strong><span style="font-size:14pt">Picture-in-Picture (PIP)</span><span style="color:#1f497d"><br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight2.png" alt=""></span><span style="font-size:14pt"><br></span></strong>One of the major goals for this project was to make the entire application more engaging to users.  What better place to start driving engagement than in the actual video being consumed?  The PIP provides the following: 
</p><ul style="margin-left:74pt"><li>The PIP control allows viewers to see the action from an alternate camera angle while watching the simulcast feed in the main window.  
</li><li>The menu on the PIP provides a streamlined way to switch to another camera angle, or to swap the main video into the PIP and start watching an alternate angle in the main window. 
</li><li>Great viewing experience: This year, we decided to make the PIP a first-class video player in its own right.  
</li><li>Full Screen Scaling: To provide a great experience on televisions and large monitors, the PIP will scale up in size when users move into full screen mode.  This keeps the PIP relevant, even from across the room. 
</li><li>Draggable: Don't like where the PIP is positioned?  Drag it anywhere you'd like! 
</li><li>Collapsible: If you'd like a totally clean video experience, you can use the Minus button to collapse the PIP and remove it from your field of view. 
</li></ul><p>  <span style="font-size:14pt"><strong>The Ultimate Timeline <br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight3.png" alt=""><br></strong></span>One reason that Sunday Night Football is such a fun event to work on is all of the interesting data we have to work with.  One of the biggest challenges we faced was how to visualize all of that data without creating a noisy or distracting user interface.  We also had to envision how to allow users to socially interact with all of this data, and how to create data of their own that might be interesting to their own social circles.  Here's how we addressed these challenges: 
</p><ul style="margin-left:74pt"><li><strong>Positional Thumbnail Preview: </strong>When mousing over the timeline, the player displays a preview image of what's happening in the video at the point you're hovering.  This allows users to quickly browse an entire game and look for interesting action. 
</li><li><strong>Play by Play Data: </strong>We use team-color-coded markers on the timeline to indicate when key plays occur. When mousing over one of the key play timeline markers, data from the NFL displays inside the timeline preview image indicating the details of the play that happened. 
</li><li><div><strong>Deep Linking to Plays: </strong>Users can select any point on the timeline to share a deep link into that location within the video with their social network.  This feature allows a user to brag to her friends about a big sack on a 3<sup>rd</sup> down on Facebook, or to tweet the location of a close-up shot of a player who attended her high school a few years ago on Twitter.  
</div><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight4.png" alt="">   
</p></li></ul><p><span style="font-size:14pt"><strong>Flexible Video Modes<br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight5.png" alt=""></strong></span><br>We have so much great functionality this year that we faced a major design challenge in deciding where to put it all!  Job #1 of a good online video player is to provide big<span style="color:#1f497d">,</span> beautiful video with minimal distractions and visual noise, but our audience of football fans also loves statistics, social interaction, highlight clips and updates from the sidelines. To have our cake and eat it too, we decided to create 2 video modes: &quot;Big Video&quot;, and &quot;Engage&quot;.  
</p><p>The application starts in Big Video Mode, where you get a large space to watch the action with optimal video size and quality. 
</p><p><em>Big Video Mode:</em><br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight6.png" alt="">
	</p><p><br>When you want to dive in to all of the additional content and fun features offered by the player, clicking the reveal button transitions to a (still very respectably sized) video window, exposing all the additional functionality.  This approach allows interaction with the statistics and social features while still watching the video. 
</p><p><em><br>Engage Mode:</em><br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight7.png" alt="">
	</p><p><span style="font-size:14pt"><strong>Multi-speed DVR Controls</strong></span><span style="color:#1f497d"><br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight8.png" alt=""></span><span style="font-size:14pt"><strong><br></strong></span>To give our users full control over the action, we provide instant replay, slow motion, and 4x/8x fast forward and rewind DVR controls.  Direct every play, see that last catch over and over, and even decide on that last penalty call for yourself!<span style="font-size:14pt"><strong>
			</strong></span>
	</p><p><span style="font-size:14pt"><strong>Twitter Battle<br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight9.png" alt=""><br></strong></span>When it comes down to it, football fans tune in to see a <strong>battle</strong> on the gridiron every Sunday.  To let fans be a part of that battle, we included the Twitter Battle as a leading social feature. 
</p><ul style="margin-left:74pt"><li>Users are encouraged to Vote/Tweet for their favorite team. 
</li><li>&quot;Tug of war&quot; results are shown within the app 
</li><li>The Tweets contain links back to the player to garner larger audiences and add fuel the battle 
</li></ul><p> <span style="font-size:14pt"><strong>Twitter Integration, Ask Mike Florio<br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight10.png" alt=""><br></strong></span>Some of the most popular features in the 2009 SNF application were the interactive Chat with Mike Florio that allowed fans to see their questions answered in real time, and Andrea Kremer's tweets from the sidelines.  However, those features were scattered across the application.  To improve on the concept of interactive Chat with Mike Florio and tweeting with Andrea Kremer, we unified and aggregated all of the Twitter streams including: Q&amp;A from Mike Florio, Andrea's tweets from the sideline, and even stand-out tweets from the fans in the Twitter Battle!  
</p><p><span style="font-size:14pt"><strong>Highlight Clips<br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight11.png" alt=""><br></strong></span>While SNF Extra 2010 gives users greater control than ever over their game experience, sometimes you just want a nice big thumbnail to take you to that last touchdown.  NBC's editors can also use the <a href="http://rce.codeplex.com/">Silverlight Rough Cut Editor</a> to create drive cut-downs and other aggregated highlight content on the fly.  
</p><p><span style="font-size:14pt"><strong>Statistics<br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092310_0009_SundayNight12.png" alt=""><br></strong></span>For those fans that love to keep up to date on all the details, the Statistics section provides in-game updates every 1 minute.<span style="color:#1f497d">
		</span>
	</p><p><span style="font-size:14pt"><strong>Team Effort <br></strong></span>I'd like to thank the entire team at Vertigo for all of your dedication, enthusiasm, and creativity in creating a beautiful, innovative piece of software.  I'd also like to thank our partners at NBC Sports, iStreamPlanet, Microsoft, Akamai, Ascender, Inlet, and TweetRiver for your commitment and expertise that make the Sunday Night Football experience possible!</p></div>]]></description></item><item><title>Toad night light</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=50</link><pubDate>Tue, 24 Aug 2010 19:44:40 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=50#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass382F38769666493A897948FA4B879D9C><p>I turn on a light each night to attract insects for toads (which seems a little odd now that I think about it). The other night I went outside to look at the moon and planets, and I noticed that I had forgotten to turn on the light. On my way back to the house, there were several toads waiting in their usual spot, looking at me wondering what happened to their light.</p>  <p><a href="http://lostsprings.com/photos.aspx?cat=Animals&amp;photo=P5280299"><img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px" title="" border=0 alt="" src="http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Attachments/50/P52802993_3_41F04447.jpg" width=231 height=214></a>   <a href="http://lostsprings.com/photos.aspx?cat=Animals&amp;photo=IMG_1431"><img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px" title="" border=0 alt="" src="http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Attachments/50/IMG_14313_1_41F04447.jpg" width=282 height=214></a></p></div>]]></description></item><item><title>Red-eyed devil katydid</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=49</link><pubDate>Mon, 23 Aug 2010 07:24:55 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=49#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassAA241CCA852D4C4685320218929B709E><p>We came across another red-eyed devil (type of katydid) over the weekend. They are more unique since they are quite large, and very aggressive. When provoked, they rear back in defensive stand and will bite if possible. The bite does not hurt too bad since they don’t inject any type of poison, but can break the skin. Here are photos of one we found before.</p>  <p><a href="http://lostsprings.com/photos.aspx?cat=Bugs&amp;photo=P6238573"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="" border=0 alt="" src="http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Attachments/49/P62385731_3_6A2F7DDC.jpg" width=262 height=214></a>    <a href="http://lostsprings.com/photos.aspx?cat=Bugs&amp;photo=P6238553"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="" border=0 alt="" src="http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Attachments/49/P62385531_1_6A2F7DDC.jpg" width=247 height=214></a></p></div>]]></description></item><item><title>PDX Code Camp Session: WP7 Tips & Tricks</title><link>http://blogs.vertigo.com/personal/jesse/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Mon, 24 May 2010 08:28:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/jesse/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>jesse</dc:creator><description><![CDATA[<div class=ExternalClassF41164A5CD964F3CAAD7B8B5C3E0ECDD><div>
<p><a href="http://www.teamjohnston.net/blogs/jesse/image.axd?picture=Chow.png"><img style="border-bottom:0px;border-left:0px;margin:0px 25px 0px 0px;display:inline;border-top:0px;border-right:0px" title=Chow border=0 alt=Chow align=left src="http://www.teamjohnston.net/blogs/jesse/image.axd?picture=Chow_thumb.png" width=127 height=244></a> I presented the Windows Phone 7 Tips &amp; Tricks session with <a href="http://newtonapps.com/">Allen Newton</a> Saturday at Portland Code Camp.  Good times.  In our talk we showed a sample application &quot;PDX Chow&quot; that demonstrates a number of phone development concepts:</p>
<ul>
<li>MVVM architecture with Laurent Bugnion's <a href="http://www.galasoft.ch/mvvm/getstarted/">MVVM Light</a> </li>
<li>Panorama control </li>
<li>Inversion of Control / Dependency Injection </li>
<li>Navigation using commanding and context </li>
<li>Page orientation events </li>
<li>Accessing phone features with tasks </li>
<li>ApplicationBar wrapper class that is fully Blendable and supports attached behaviors </li>
<li>Application life-cycle events </li>
<li>Accessing WCF services</li></ul>
<p>The slide deck and code for the sample app are available for download <a href="http://downloads.vertigo.com/pdxcodecamp2010/WP7 Tips &amp; Tricks.zip">here</a>.  Enjoy!</p></div></div>]]></description></item><item><title>Roadrunners</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=48</link><pubDate>Thu, 20 May 2010 06:25:54 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=48#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass42A50E5444894DB69FC53A7248B3D6FA><p>I have seen several roadrunners on the land lately. Here is one that jumped up on a fence outside my work window a while back. </p>  <p><a href="http://lostsprings.com/photos.aspx?cat=Animals&amp;photo=P8012052"><img src="http://lostsprings.com/data/photos/Animals/P8012052.JPG" width=211 height=280></a></p></div>]]></description></item><item><title>The pigs visit at night</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=47</link><pubDate>Thu, 13 May 2010 06:46:56 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=47#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassE8F8A71A4EA54256B508C7CF21613878><p>At first they were cute, little wild pigs sneaking up to our yard in the late evening eating spilled bird seed and food we put out for the deer. But now they are really a pain… they come up every night, tip over the bird baths, move landscaping rocks around, and root up the plants. I tried larger rocks, but they keep persisting in their quest to root up everything. I can hear them outside my window when working late, mocking me, with their <em>squealy</em> pig laughter while they root up another trailing purple lantana.</p></div>]]></description></item><item><title>Vertigo @ NAB</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=17</link><pubDate>Mon, 12 Apr 2010 18:05:45 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=17#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass4A2B9AE7751E478D8EEDA04BEF71A92B><p>Vertigo is in attendance at <a href="http://www.nabshow.com/2010/default.asp">NAB</a>, where we're talking about our recent work delivering High Definition Media content over the web. You can swing by the Microsoft booth to talk with myself or Mike Moser, where we'll be showing off some cool demos. On Tuesday, we'll run a quick tutorial every hour on the hour demonstrating how to build a <a href="http://smf.codeplex.com/">SMF</a> 2.0-based video player in just a few minutes. 
</p><p>Also – be sure to check out our video players running in Inlet and Omneon's booths demonstrating live ad insertion. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/041310_0107_VertigoNAB1.jpg" alt=""><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/041310_0105_VertigoNAB1.jpg" alt="">
	</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/041310_0107_VertigoNAB2.jpg" alt=""><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/041310_0107_VertigoNAB3.jpg" alt=""><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/041310_0107_VertigoNAB4.jpg" alt=""></p></div>]]></description></item><item><title>Video from Vertigo's events at MIX 10</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=16</link><pubDate>Thu, 18 Mar 2010 12:55:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=16#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClassC447A7B7A94A4AF496713B9AA902C3C7>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3><font face=Calibri>I just got back into the office after spending a week in Las Vegas for the annual</font></font><font size=3><font face=Calibri> Microsoft </font></font><a href="http://live.visitmix.com/"><font size=3 face=Calibri>MIX Conference</font></a>.<font size=3 face=Calibri> Vertigo had a huge presence at MIX this year, where the media work we've focused on for the last year was on display.  I personally had a great time, and I want to thank everyone who worked hard to make this conference a success!</font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri></font> </p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri>Here's a summary of the videos on the MIX site that relate to Vertigo's work.  </font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri></font> </p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri><strong>Keynote:</strong></font></p><font size=3 face=Calibri>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri>Vertigo was once again featured the main MIX keynote.  A ~5 minute video about our Olympics player was shown about 6 minutes into it!  You can see the keynote here: </font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><a href="http://live.visitmix.com/MIX10/Sessions/KEY01"><font size=3 face=Calibri>http://live.visitmix.com/MIX10/Sessions/KEY01</font></a><font size=3 face=Calibri> (jump to 6:30 into the video)  </font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri></font> </p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri>Scott Stanfield, our CEO, later went onstage and did a live demo of an app we built for Netflix for the Windows Phone 7.  </font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal> </p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri>Vertigo also built the live Smooth Streaming player that allowed users to watch the keynote live.</font></p></font>
<p style="margin:0in 0in 0pt" class=MsoNormal><strong><font size=3 face=Calibri></font></strong> </p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri><strong>Smooth Streaming:</strong></font></p><font size=3 face=Calibri>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri>Scott did a great session with my colleague Mike Hanley, where they demoed doing a “Do It Yourself” Camera to Screen smooth streaming demo – pretty entertaining if you’re into video, smooth streaming, or even cinematography – you can watch it here:</font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><a href="http://live.visitmix.com/MIX10/Sessions/EX32"><font size=3 face=Calibri>http://live.visitmix.com/MIX10/Sessions/EX32</font></a><font size=3 face=Calibri>.</font></p></font>
<p style="margin:0in 0in 0pt" class=MsoNormal><strong><font size=3 face=Calibri></font></strong> </p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri><strong>Olympics:</strong></font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri>Scott and I presented a session focusing on the work we did for the Olympics, how things worked behind the scenes, and why it matters.  You can watch it here: </font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><a href="http://live.visitmix.com/MIX10/Sessions/EX33"><font size=3 face=Calibri>http://live.visitmix.com/MIX10/Sessions/EX33</font></a><font size=3 face=Calibri>.</font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri></font> </p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri>Jason Suess (the Olympics PM at Microsoft) did a presentation focusing on the possibilities that the new open-source Rough Cut Editor provides, and how we used it during the Olympics:</font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri><a href="http://live.visitmix.com/MIX10/Sessions/CL26">http://live.visitmix.com/MIX10/Sessions/CL26</a></font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal> </p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri><strong>Silverlight Media Framework:</strong></font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri>Eric Schmidt ran a presentation on the Silverlight Media Framework that Vertigo has developed and released on CodePlex:</font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri><a href="http://live.visitmix.com/MIX10/Sessions/CL25">http://live.visitmix.com/MIX10/Sessions/CL25</a></font></p>
<p style="margin:0in 0in 0pt" class=MsoNormal><font size=3 face=Calibri></font> </p>
<p style="margin:0in 0in 0pt" class=MsoNormal> </p></div>]]></description></item><item><title>Online Video with the Silverlight Media Framework (2-17-10 Presentation Materials)</title><link>http://blogs.vertigo.com/personal/krohling/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Sun, 21 Feb 2010 23:43:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/krohling/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>krohling</dc:creator><description><![CDATA[<div class=ExternalClass984025DFAA3844A5BEB26A336EB9D740>
<div>Online Video with the Silverlight Media Framework (2-17-10 Bay .NET User Group Presentation)</div>
<ul>
<li><a href="http://blogs.vertigo.com/personal/krohling/Shared%20Documents/SMFPresentationDeck2-17-10.pdf">Presentation Deck</a></li>
<li><a href="http://blogs.vertigo.com/personal/krohling/Shared%20Documents/SMFPresentationExampleCode2-17-10.zip">Example Code</a> (Dependencies Removed)</li>
<ul>
<li>Download SMF: <a href="http://smf.codeplex.com/">http://smf.codeplex.com</a></li>
<li>Download the Smooth Streaming Media Element <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2b1ce605-3b99-49ad-8a26-1250f2acbbf6&amp;displayLang=en">here</a></li></ul></ul></div>]]></description></item><item><title>Live Olympic Coverage from Vancouver</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=49</link><pubDate>Mon, 15 Feb 2010 11:59:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=49#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass661CE60D7FA442B6B09E61B81BE00270>
<p>What exactly is being broadcast live for the 2010 Winter Olympic Games in Vancouver? </p>
<p>It depends on where you live and the relationship to your cable or satellite provider. </p>
<p>First, these tips only apply to U.S. digital Internet broadcast, which NBC has the rights to. Other countries, your mileage may vary since they are negotiated separately with the governing body, the IOC. </p>
<p>A list of all the live events for the US can be found here: <a href="http://www.nbcolympics.com/video/live-full-replays.html">NBC Live Full Replays</a> </p>
<p>I can save you some trouble: only hockey and curling are live. That’s about half the competition in terms of hours, but it’s a lot. You will need to navigate the through the “entitlement” process in order to see it. For Comcast, you need your username@comcast.net and password to authenticate. It's a one-time deal, per browser. I know it's a pain, but the live content is worth it. </p>
<p>NBC announced the planned, live digital coverage in a press release on Feb. 8. <a href="http://bit.ly/NBCOlyLive">http://bit.ly/NBCOlyLive</a>. Essentially, 400 hours live, with more than 1000 hours of full-event replays, all in Silverlight.</p>
<p>If you live in the US and you don’t pass the crazy satellite/cable checks, you can still enjoy Olympic content, just not full-replay and live. You can watch all the highlights you want, shortly after the live event. </p>
<p>My favorite highlight so far is the <a href="http://www.nbcolympics.com/video/assetid=8c4385a1-390c-470c-bd9a-129357cc250d.html#red+mittens+shortage">red mitten shortage</a>. Seriously though, this goal shot by US Women's hockey is amazing: <a href="http://bit.ly/lamoureuxs">http://bit.ly/lamoureuxs</a>.</p>
<p>I hear that Canadian IP addresses will enjoy all the events live, courtesy of CTV at <a href="http://www.ctvolympics.ca/">http://www.ctvolympics.ca/</a>. They are using a simliar version of the player Vertigo built for NBC. I think the same goes for Norway: <a href="http://www.nrkol.no/index.html">http://www.nrkol.no/index.html</a>.</p>
<p> </p></div>]]></description></item><item><title>Olympic Error Handling and Fiddler as a Remote Proxy</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=15</link><pubDate>Fri, 15 Jan 2010 18:01:20 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=15#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClassAEB68EE7E7DA45109F647F886FEB4515><p>As we're nearing the opening ceremonies for the <a href="http://www.vertigo.com/Olympics.aspx">2010 Olympic Winter Games</a>, our team is busy testing failure and recovery scenarios. We want to ensure that even if something goes wrong in our video delivery stream, users will have as seamless an experience as possible, and will have their video quickly and automatically restored. In the event that a catastrophic failure occurs in the video delivery stream, we make several attempts to automatically re-connect to resolve the problem: 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/011610_0201_OlympicErro1.png" alt="">
	</p><p>Failing that, we provide a means to manually retry the reconnection attempt, or to simply browse to other video content. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/011610_0201_OlympicErro2.png" alt="">
	</p><p>In order to test the different scenarios that can lead to these kinds of errors, we often use <a href="http://www.fiddler2.com/fiddler2/">Fiddler</a> as a debugging tool. We often use the Autoresponder feature to return &quot;502 Unavailable&quot; responses to requests for valid, working video chunks in order to trigger these error scenarios for testing purposes. The other day, I encountered a situation where I needed to trigger an error in full-screen mode. As you may know, in Silverlight full screen mode, clicking on another application outside the full screen Silverlight app will exit full screen mode. I needed to trigger a video failure via Fiddler in full screen mode, but could not use Fiddler without exiting full screen and invalidating my test. 
</p><p>The solution to this problem is to use Fiddler on another computer as a remote proxy. This allowed me to do anything I wanted on my main computer, controlling the responses to the network traffic on another machine. Thanks to Olga Lepekhina and David Woods for pointing me to this solution. 
</p><p>To make it work, open up Fiddler on another computer on your network. Open up Tools -&gt; Fiddler Options, and open the Connections tab. Check the box for &quot;Allow remote computers to connect&quot;, and restart Fiddler: 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/011610_0201_OlympicErro3.png" alt="">
	</p><p>On your main computer, go to Internet Explorer's Internet Options and click the LAN settings button on the Connection tab. Check the &quot;Use a proxy server for your LAN&quot; box. You can then enter the IP address of the other machine (the one running Fiddler), along with port 8888. (You may need to click the Advanced button to enter these settings). 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/011610_0201_OlympicErro4.png" alt="">
	</p><p>This works in Firefox too, via a similar procedure: 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/011610_0201_OlympicErro5.png" alt=""></p></div>]]></description></item><item><title>Additional Features Released for NBCOlympics.com Video Player Powered by Vertigo</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=14</link><pubDate>Mon, 21 Dec 2009 13:42:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=14#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClassD2F7D86A82E040C1855A1E8E95B61396>
<p><a href="http://www.nbcolympics.com/video/assetid=8415321a-01d1-4930-ab08-b2d1dfd0643c.html"><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/121709_0039_AdditionalF8.png" alt="" border=0></a>
	</p><p>Last month, our team at Vertigo announced the release of the NBCOlympics.com <a href="http://www.nbcolympics.com/video/assetid=3e664381-be35-4d69-ad18-faf0873683a1.html">HD video player</a> and <a href="http://www.nbcolympics.com/photos/galleryid=258422.html">Deep Zoom photo experience</a> powered by Vertigo for NBC's coverage of the 2010 Olympic Winter Games. These players are live today, and you can use them to explore a wide range of content from previous years, as well as interviews with athletes and other previews. See our <a href="http://vertigo.com/Olympics.aspx">post here</a> for the full details. 
</p><p>Our team is pleased to announce that an additional set of features was released last week! A dive into those new features appears in the second part of this post. 
</p><p><span style="font-size:14pt"><strong>Part 1: Original Features </strong></span>
	</p><p>The video and photo experiences for NBCOlympics.com released in November featured: 
</p><p><em>Video Experience </em>
	</p><ul><li><strong>HD-quality video using Microsoft's IIS Smooth Streaming Technology<br></strong>Gorgeous HD-quality video in full 720p, streamed in a manner that adaptively adjusts to any connection speed.<strong>
			</strong><br><br>
		</li><li><strong>DVR &quot;Trick Play&quot; control <br></strong>Direct your own video experience using slow motion, fast forward, and rewind. The &quot;dongle&quot; control also allows for more fine-grained control to find the exact moment you're looking for. <br><br>
		</li><li><strong>Rich Data Integration <br></strong>Go deep and find out all you need to know about every key play with Key Events and Play by Play data, including a fully interactive video timeline. <br><br>
		</li><li><strong>Embedded Player <br><a href="http://www.nbcolympics.com/video/embed/"></strong>Embed</a> a lightweight version of our player in your blog! <br><br>
		</li><li><strong>Advanced advertising integration <br></strong>A sophisticated advertising engine that includes support for DVR functionality. This also includes capability for affiliate branding integration. <br><br>
		</li><li><strong>Error handling and recovery <br></strong>We've put a great deal of effort into ensuring that the video our users experience is delivered in a highly reliable manner. If something goes wrong, our player has a lot of smarts built in that allow it to analyze problems and quickly recover or offer other options for viewing. <br><br>
		</li><li><div><strong>Logging <br></strong>The NBCOlympics.com player powered by Vertigo will be one of the best instrumented web applications ever built. With so many users connecting to so much video, it is important to keep close tabs on everything that's going on. We're using the following logging providers: 
</div><ul><li>Conviva for real-time health monitoring<strong>
					</strong>
				</li><li>Omniture and Quantcast for metrics and activity tracking<strong>
					</strong>
				</li><li>Nielsen for usage tracking<strong>
					</strong>
				</li><li>Microsoft for video health logging<strong>
						<br><br></strong>
				</li></ul></li><li><strong>Alerts <br></strong>Stay up to date with the latest events. <br><br>
		</li><li><strong>Boss Button <br></strong>Because sometimes it's just too tempting to watch all that great content even when you're at work… 
</li></ul><p><em>Photo Experience </em>
	</p><ul><li>Slideshow mode allows easy one-by-one viewing of automatically advancing galleries. 
</li><li>Grid Mode allows free-form and quick navigation of larger galleries. 
</li><li>Scroll to zoom in and out of photos 
</li></ul><p><span style="font-size:14pt"><strong>Part 2: Extra Feature Set Released Last Week </strong></span>
	</p><p>This set of improvements consists of a range of goodies that enhance the video experience by allowing you to explore the tremendous amount of content available much more deeply. Let's take a look: 
</p><p><strong>Support for live video<br></strong>The opening ceremonies on February 12th are almost here, and the player is now ready to handle streaming of live coverage of the Olympic games! 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/121709_0039_AdditionalF1.png" alt="">
	</p><p><br><strong>Video Content Explorer<br></strong>The video content explorer (accessible from the &quot;Explore More Videos&quot; button) allows users to view the full range of Olympic video content within the full screen mode of the player. You can explore videos recommended to you based on what you're currently watching, the most popular videos across the site, featured videos, or hot clips under &quot;Must See&quot;. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/121709_0039_AdditionalF2.png" alt="">
	</p><p> 
 </p><p><strong>Top Athletes<br></strong>The Top Athletes tab allows you to explore video content from a different angle – you can browse through your favorite international athletes and find all of their related video content.<strong>
		</strong>
	</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/121709_0039_AdditionalF3.png" alt="">
	</p><p> 
 </p><p><strong>Sports<br></strong>Similarly, the sports tab allows you to explore videos within a specific Olympic sport.<strong>
		</strong>
	</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/121709_0039_AdditionalF4.png" alt="">
	</p><p> 
 </p><p><strong>Schedule<br></strong>When the Olympic games start, there will be a lot of activity to keep track of! Found in the &quot;Inside This Video&quot; overlay, the schedule view allows a time/schedule-based approach to exploring video content, and also provides a glimpse of upcoming events.<strong>
		</strong>
	</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/121709_0039_AdditionalF5.png" alt="">
	</p><p> 
 </p><p><strong>Related Athletes<br></strong>If you're interested in more information about the athletes participating in the video you're watching, you can find full details in the Related Athletes pane, accessible from the &quot;Inside This Video&quot; overlay. If you want to explore even further, you can flip over each athlete's &quot;trading card&quot; to find a list of all videos in which they appear. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/121709_0039_AdditionalF6.png" alt="">
	</p><p><br><strong>Twitter<br></strong>Keep tabs on the latest community buzz about the event you're watching with the built in Twitter client. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/121709_0039_AdditionalF7.png" alt="">
	</p><p> 
 </p><p>I'd like to send a big thank you out to everyone on Vertigo's Olympics team as well as our partner organizations for their dedication and hard work in bringing together this unique experience. We're looking forward to seeing it in action during the winter games in February! 
</p>&gt;</div>]]></description></item><item><title>Quick Tip: Radians vs. Degrees</title><link>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=15</link><pubDate>Thu, 17 Dec 2009 11:37:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=15#Comments</comments><dc:creator>vertigosurface</dc:creator><description><![CDATA[<div class=ExternalClassB5B5EA0BEAFE4E279A3D3D746CE5FDF8><div class=ExternalClass21F99BBC85D743C2816DE2A0501AEFC9>   <p>You can build Surface applications using WPF or XNA. While the two are different from one another, once you get used to it, switching between WPF and XNA isn’t too bad. </p>    <p>There is one thing that always trips me up though: when the manipulation processor reports back <strong>rotation delta</strong> in the Delta event, it will be reported in either radians or degrees. It all depends on what you’re programming in. If you’re using WPF, it will be in degrees. If you’re using XNA, it will be in radians. Looking at the online help for the Surface SDK confirms this difference as well.</p>    <p>Converting from one to the other is simple:</p>    <p><a href="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/15/radiandegree_2_7652EB9A.png"><img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px" title=radiandegree border=0 alt=radiandegree src="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/15/radiandegree_thumb_7652EB9A.png" width=260 height=131></a> </p>    <p>So, if you’re trying to do some kind of custom rotation calculation and things aren’t working as you expected, make sure you’re using the correct units!</p>    <p>Paul Osburn      <br>Engineering Director, Surface</p>    <p></p> </div></div>]]></description></item><item><title>Hard Rock at PDC09</title><link>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=13</link><pubDate>Wed, 25 Nov 2009 18:35:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=13#Comments</comments><dc:creator>vertigosurface</dc:creator><description><![CDATA[<div class=ExternalClass7650F80003734265A1068E98A408E840><p>It was a good week at PDC09 for the <a href="http://www.vimeo.com/6442068" target="_blank">Hard Rock Worldwide Memorabilia</a> application. </p>  <p><img alt="Hard Rock Worldwide Memorabilia Application for Microsoft Surface" src="http://www.vertigo.com/images/detail/HardRock-Memo-2.jpg"></p>  <p>At the show, the Surface team dedicated a Surface (sounds kinda repetitive) to all things Hard Rock, which included the custom attract and memorabilia applications Vertigo and <a href="http://www.duncanchannon.com/" target="_blank">Duncan/Channon</a> created with Hard Rock. It was the same Surface experience you’ll get (minus the atmosphere, music, cocktails, food, etc.) when you visit <a href="http://www.hardrock.com/locations/cafes3/cafe.aspx?LocationID=507&amp;MIBEnumID=3" target="_blank">Hard Rock’s new cafe on the Vegas strip</a>.</p>  <p>We also got word that the Worldwide Memorabilia application was runner up in Microsoft’s Touch First Developer challenge. </p>  <p><img style="border-right-width:0px;margin:0px 17px 0px 0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" border=0 align=left src="http://photos-h.ak.fbcdn.net/hphotos-ak-snc1/hs191.snc1/6440_101564493561_99041713561_2043672_1198621_s.jpg"></p>  <p align=left>There were over 40 entries across six different countries. Runner-up … so close. There must be fabulous prizes for runner-up though. Maybe an autographed photo of the Surface team? Or perhaps a toaster. Either would be exciting.</p>  <p> </p>  <p> </p>  <p> </p>  <p>Paul Osburn    <br>Engineering Director</p></div>]]></description></item><item><title>Vertigo at PDC09</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=48</link><pubDate>Mon, 16 Nov 2009 16:28:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=48#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass7D4945096E8440CEABB992ECD7B51334><div>The Microsoft Professional Developer's Conference (PDC) starts tomorrow. We're down here, along with a few thousand of our closest Microsoft friends, in Los Angeles, preparing for a long and interesting week.</div>
<div> </div>
<div>Vertigo has a few things going on, related to the PDC:</div>
<div> </div>
<div><strong>Live from the PDC</strong></div>
<div>You can enjoy the Microsoft PDC live, even if you're not here. Simply tune into <a href="http://www.microsoftpdc.com">www.microsoftpdc.com</a> and watch the Tuesday and Wednesday keynotes, immediately followed by hours of live broadcast from the Channel 9 team. Vertigo built the DVR-style player that you'll be interacting with. </div>
<div> </div>
<div><strong>Broadcast Live with Silverlight</strong></div>
<div>To learn how we built the PDC live player (and the Sunday Night Football Extra and 2010 Olympic Winter Games players), you can find me presenting in Vishal Sood's session, Tuesday at 1:30pm in 515A.</div>
<div><a href="http://microsoftpdc.com/Sessions/SVR14">http://microsoftpdc.com/Sessions/SVR14</a></div>
<div> </div>
<div><strong>DeepZoom in the Olympics</strong></div>
<div>I'm with Bill Crow (from Seadragon / Live Labs) doing a special Deep Zoom demo during his Tuesday lunchtime session. We'll be in 408B from 12:30 to 1:30. Bill's spending the majority of the session talking about how he works with his smart team of developers.</div>
<div><strong><a href="http://microsoftpdc.com/Sessions/VTL30">http://microsoftpdc.com/Sessions/VTL30</a></strong></div>
<div><strong></strong> </div>
<div><strong>The Underground at PDC 09</strong></div>
<div>Unless I hear otherwise, I'm doing a short demo of SNF and Olympics at the PDC Underground, Wednesday evening.</div>
<div><a href="http://undergroundatpdc.com/">http://undergroundatpdc.com/</a></div>
<div> </div>
<div><strong>On the Floor</strong></div>
<div>Surface: We're showing the Surface project we did for Hard Rock in the Surface team's booth. <a href="http://bit.ly/Cj46h">http://bit.ly/Cj46h</a></div>
<div> </div>
<div>Windows 7: We're in the Touch booth, showing off work we're doing for one of our fantastic clients, Take Comics.</div>
<div> </div>
<div><strong>Codeplex</strong></div>
<div>We have a project going live on Codeplex, but I can't talk about it until later this week.</div>
<div> </div>
<div>If you want to track my whereabouts, follow me at <a href="http://twitter.com/seesharp">http://twitter.com/seesharp</a></div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div><strong></strong> </div>
<div> </div>
<div> </div></div>]]></description></item><item><title>"Run as a different user" in Windows 7</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=47</link><pubDate>Mon, 02 Nov 2009 09:49:48 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=47#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass434D6A4A4B5F473A9FA7A800F4FC3DD9><p>In Windows Vista, it was possible to run as administrator by right clicking on a file and choosing “Run as administrator”. However, it wasn’t possible to run as a different user. When developing software, this can be really useful for testing—seeing if your program works with a specially-configured limited user, for example.</p>  <p>In Windows 7 it appears to be the same issue; here’s the menu obtained by right-clicking in Windows 7:</p>  <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/47/RunAsAdmin_2_789E55D2.png"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="Option in Windows 7 when right-clicking an executable file to run as administrator" border=0 alt="Option in Windows 7 when right-clicking an executable file to run as administrator" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/47/RunAsAdmin_thumb_789E55D2.png" width=396 height=140></a></p>  <p>However, in Windows 7, <strong>holding down the SHIFT key</strong> and then right-clicking adds a new option: “Run as different user”:</p>  <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/47/RunAsDifferentUser_2_789E55D2.png"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="Right-clicking in Windows 7 provides Run as different user" border=0 alt="Right-clicking in Windows 7 provides Run as different user" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/47/RunAsDifferentUser_thumb_789E55D2.png" width=408 height=126></a> </p>  <p>This then allows the execution of the program or file by any user:</p>  <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/47/RunAsDialog_2_789E55D2.png"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="Run as a different user dialog allows entry of credentials" border=0 alt="Run as a different user dialog allows entry of credentials" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/47/RunAsDialog_thumb_789E55D2.png" width=443 height=275></a> </p>  <p><strong>Warning:</strong></p>  <p>In the past on x86 Vista, I used the <a href="http://technet.microsoft.com/en-us/sysinternals/cc300361.aspx">ShellRunAs</a> program from Windows Sysinternals to do this. When I tried this on my x64 Windows 7 machine, I found that it did not work correctly. The program ran, but my program was unable to open its own config file, and so it didn’t run correctly. I’m guessing that this might be an issue with ShellRunAs and x64. Since this functionality is now built into Windows 7 and works with x64, this isn’t really a problem for me. </p>  <p>For a bit more about this, see <a href="http://forum.sysinternals.com/forum_posts.asp?TID=19939">http://forum.sysinternals.com/forum_posts.asp?TID=19939</a>.</p></div>]]></description></item><item><title>Brown Bag - Prism 2.0</title><link>http://blogs.vertigo.com/personal/krohling/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Wed, 21 Oct 2009 10:02:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/krohling/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>krohling</dc:creator><description><![CDATA[<div class=ExternalClass3816E89D193641BBB9D8FE8F2083F817><div>
<div class=ExternalClassB707EF6E83EC463281EB61DE954F948E>Since arriving here at Vertigo about a month ago (a little less actually) I've heard several folks express interest in learning a bit more about Prism.  Having just recently done a deep dive into it a short time ago myself I figured it was a good time to spread what I knew about it so I decided to put together a brown bag session.  If for no other reason really than b/c I like cornering people in a room and making them listen to me ramble for an hour.</div>
<div class=ExternalClassB707EF6E83EC463281EB61DE954F948E> </div>
<div class=ExternalClassB707EF6E83EC463281EB61DE954F948E>Therein I discussed the high level components that make up the framework as well as some when to's and when not to's when deciding wether or not to use Prism.  Caveat: This is all really biased with my own opinions so please don't assume anyone else agrees with me.  As with all interesting things debate is inevitable.  Here are the topics I covered and see the links below for access to the deck and code.</div>
<div class=ExternalClassB707EF6E83EC463281EB61DE954F948E>
<ul>
<li>What is Prism?</li>
<li>Commands</li>
<li>Regions</li>
<li>Event Aggregation</li>
<li>Modules</li>
<li>Putting it all together - an example</li>
<li>When does using Prism make sense?</li>
<li>More Info</li></ul></div>
<div><a href="http://blogs.vertigo.com/personal/krohling/Shared%20Documents/Prism%202.pdf">Download the deck</a><a href="http://blogs.vertigo.com/personal/krohling/Personal%20Documents/Prism%202.pdf"></a></div>
<div><a href="http://blogs.vertigo.com/personal/krohling/Shared%20Documents/Playground.zip">Download the sample code</a></div></div></div>]]></description></item><item><title>Quick Tip: Freeing Up Resources when Using the Surface Simulator</title><link>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Wed, 14 Oct 2009 13:22:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>vertigosurface</dc:creator><description><![CDATA[<div class=ExternalClass84590E77BD1A42B9B1C99D4B5A14DBE4><div class=ExternalClass3BA6E7E65BF34D8ABE5849CD4782257A>   <p>On my machine, running the Surface Simulator that comes with Surface SDK SP1 works great. My resolution is high enough (the Simulator requires a resolution of 1280x960 or higher to run) and I’ve got enough memory to keep everybody happy.</p>    <p>Sometimes you might need to develop on a machine that may be a bit less powerful that what is needed to run things smoothly. To free up some resources you can kill the Surface Attract application once the Simulator starts. This doesn’t help much since the Surface Shell stops the attract app as soon as your application runs. </p>    <p>So, one thing you can do is to stop the attract application AND the Surface Shell once the simulator starts. Then run your application from Visual Studio as usual. On a machine with limited resources, especially memory, not running the shell does help. You won’t see any access points and you won’t get all of the functionality the shell provides, but it does seem to work pretty well.</p>    <p><a href="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/4/SimulatorwithoutShell_2_03D2529F.jpg"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title=Simulator-without-Shell border=0 alt=Simulator-without-Shell src="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/4/SimulatorwithoutShell_thumb_03D2529F.jpg" width=400 height=333></a>   <br><em>Simulator Running without the Surface Shell</em></p>    <p>A word of warning though … I wouldn’t consider running the Surface Simulator without the Surface Shell best practice. Sure, it’s fun to live on the edge, but the Surface Shell provides a lot of functionality for you. More importantly, when your application runs on a Surface unit it will be running in the shell. For Surface development I’ve found it better to have my development environment reflect, as closely as possible, my production environment. I usually find bugs quicker that way.</p>    <p>Also, make sure you don’t kill the Surface Input process. Instead of multi-touch you would get no-touch.</p>    <p>Paul Osburn      <br>Engineering Director, Surface</p> </div></div>]]></description></item><item><title>Starting a Surface App</title><link>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=10</link><pubDate>Wed, 14 Oct 2009 13:15:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=10#Comments</comments><dc:creator>vertigosurface</dc:creator><description><![CDATA[<div class=ExternalClass0470051698E74DBAA68A666F61F41AB6>
<div class=ExternalClass0A7917667F3D44BE9C336B2F19106905>
<p>When a user starts your Surface application from the Launcher, your app has 10 seconds to start up or the Surface Shell will shut it down and let the user know that your application could not be started. This seems reasonable to me as ensuring a great user experience on the Surface is top priority. A fast start is important.</p>
<p><a href="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/10/ChristmasTree_2_22E43B45.jpg"><img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px" title=ChristmasTree border=0 alt=ChristmasTree src="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/10/ChristmasTree_thumb_22E43B45.jpg" width=277 height=331></a> </p>
<p></p>
<p>By default a SurfaceWindow has the AutoSignalLoadComplete attribute set to true. This means that the Launcher is notified automatically when the window load completes. When the Launcher is notified that the application is loaded, the Launcher loading screen disappears and your app is front and center.</p>
<p>This is fine for a lot of Surface applications but some require a bit more planning. After all, this is the user’s first impression of your application. You’ve got a chance to impress them or disappoint/frustrate them. If your loading sequence is complex it’s best to step back and plan it out. Sketching the flow of the startup sequence on a whiteboard or piece of paper is usually good enough.</p>
<p><a href="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/10/StartupWhiteboard_2_22E43B45.jpg"><img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px" title=StartupWhiteboard border=0 alt=StartupWhiteboard src="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/10/StartupWhiteboard_thumb_22E43B45.jpg" width=404 height=404></a> </p>
<p>One application we built needed to create a complex 3D object, download map information and retrieve a good amount of other data (text, images, etc.) on startup. The UI was “frozen” while the polygons for the 3D object were being rendered. In our case it made sense to have the Launcher load screen displayed while the object was being created. Once the object was created, however, we were ready to have the user see our app. Once we displayed something to the user the application started retrieving the data it needs. Sometimes that data comes from the Internet, sometimes it comes from a local source.</p>
<p>We needed a bit more control if we wanted to ensure a smooth and cool startup experience. So we set AutoSignalLoadComplete to false:</p><pre class=code><font face=Consolas><span style="color:blue">&lt;</span><span style="color:#a31515">s</span><span style="color:blue">:</span><span style="color:#a31515">SurfaceWindow </span><span style="color:red">x</span><span style="color:blue">:</span><span style="color:red">Class</span></font><font face=Consolas><span style="color:blue">=&quot;MyNamespace.MainWindow&quot;
    </span><span style="color:red">xmlns</span></font><font face=Consolas><span style="color:blue">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
    </span><span style="color:red">xmlns</span><span style="color:blue">:</span><span style="color:red">x</span></font><font face=Consolas><span style="color:blue">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
    </span><span style="color:red">xmlns</span><span style="color:blue">:</span><span style="color:red">s</span></font><font face=Consolas><span style="color:blue">=&quot;http://schemas.microsoft.com/surface/2008&quot;
</span><span style="color:red">    <font color="#000000">AutoSignalLoadComplete</font></span></font><span style="color:blue"><font color="#000000" face=Consolas>=&quot;False&quot;&gt;</font>
</span></pre><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a>
<p>Doing that means you need to tell the Launcher once (and only once) that your app has finished loading. That’s easy enough. Based on your planning, let the Launcher know your app is finished loading at the right time.</p><pre class=code><font face=Consolas><span style="color:green">// Let the Launcher know that it can dismiss the loading screen
</span><span style="color:#2b91af">ApplicationLauncher</span>.SignalApplicationLoadComplete();</font></pre><a href="http://11011.net/software/vspaste"></a>
<p>While controlling the startup experience is easy, ensuring a good user experience may take a little planning depending on the complexity of your application.</p>
<p> </p>
<p>Paul Osburn <br>Engineering Director, Surface</p></div></div>]]></description></item><item><title>Circular ScatterViewItems Made Simple</title><link>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Tue, 13 Oct 2009 15:55:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>vertigosurface</dc:creator><description><![CDATA[<div class=ExternalClass5B299D4821904FC88CDF174A5A805CAC><p>After building Surface applications over the past year we realized that we’ve learned some things along the way. Sharing some of those lessons learned (and documenting them so we can find them later) seemed like the next step. If you can add to or improve upon what we’ll post in the blog, make sure to leave a comment. We like learning new things.</p>  <p>I’m not big on the obligatory ‘first post,’ so I’ll end the introduction there and get right to it.</p>  <p>For one of our projects I needed to create a circular ScatterViewItem that the user could interact with. It should contain everything in it … that is to say, it should clip its contents. A clipping path was the obvious choice. </p>  <p>So I tried using an EllipseGeometry for the clipping path of the ScatterViewItem:</p>  <pre class=code><font face=Consolas><span style="color:blue">&lt;</span><span style="color:#a31515">s</span><span style="color:blue">:</span><span style="color:#a31515">ScatterViewItem </span><span style="color:red">Background</span><span style="color:blue">=&quot;DarkMagenta&quot; </span><span style="color:red">Width</span><span style="color:blue">=&quot;80&quot; </span><span style="color:red">Height</span></font><font face=Consolas><span style="color:blue">=&quot;80&quot;&gt;
    &lt;</span><span style="color:#a31515">s</span><span style="color:blue">:</span><span style="color:#a31515">ScatterViewItem.Clip</span></font><font face=Consolas><span style="color:blue">&gt;
        &lt;</span><span style="color:#a31515">EllipseGeometry </span><span style="color:red">RadiusX</span><span style="color:blue">=&quot;40&quot; </span><span style="color:red">RadiusY</span><span style="color:blue">=&quot;40&quot; </span><span style="color:red">Center</span></font><font face=Consolas><span style="color:blue">=&quot;40,40&quot;/&gt;
    &lt;/</span><span style="color:#a31515">s</span><span style="color:blue">:</span><span style="color:#a31515">ScatterViewItem.Clip</span></font><font face=Consolas><span style="color:blue">&gt;
&lt;/</span><span style="color:#a31515">s</span><span style="color:blue">:</span><span style="color:#a31515">ScatterViewItem</span><span style="color:blue">&gt;</span></font></pre>
<a href="http://11011.net/software/vspaste"></a>

<p>This works great until you try resizing the item. The clipping geometry doesn’t stay in sync with the ScatterViewItem as the size changes. Makes sense since I’m hard-coding the radius and center values. </p>

<p><a href="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/3/CircularSVI1_2_7C5CF8D9.jpg"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="Can't Resize Circular ScatterViewItem" border=0 alt="Can't Resize Circular ScatterViewItem" src="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/3/CircularSVI1_thumb_7C5CF8D9.jpg" width=240 height=226></a> </p>

<p>As the size of the ScatterViewItem changes we need to update the size and center of the EllipseGeometry. The simplest way I found to do this is to override the GetLayoutClip method for the ScatterViewItem.</p>

<pre class=code><font face=Consolas><span style="color:blue">protected override </span><span style="color:#2b91af">Geometry </span>GetLayoutClip(<span style="color:#2b91af">Size </span>layoutSlotSize)
{
    <span style="color:blue">return new </span><span style="color:#2b91af">EllipseGeometry</span>(
        <span style="color:blue">new </span><span style="color:#2b91af">Point</span>(layoutSlotSize.Width / 2, layoutSlotSize.Height / 2), 
        layoutSlotSize.Width / 2, 
        layoutSlotSize.Height / 2);
}</font></pre>
<a href="http://11011.net/software/vspaste"></a>

<p>Each time the item goes through its layout logic the custom clip will be applied using the current width and height values for the ScatterViewItem. I created a user control and sub-classed the ScatterViewItem. This made it easy to override the GetLayoutClip method.</p>

<p>Using the new custom ScatterViewItem looks like this:</p>

<pre class=code><span style="color:blue">&lt;</span><span style="color:#a31515">c</span><span style="color:blue">:</span><span style="color:#a31515">CustomScatterViewItem </span><span style="color:red">Background</span><span style="color:blue">=&quot;Chartreuse&quot; </span><span style="color:red">Width</span><span style="color:blue">=&quot;80&quot; </span><span style="color:red">Height</span><span style="color:blue">=&quot;80&quot;/&gt;</span></pre>
<a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a>

<p>Now I’m able to resize the circular ScatterViewItem and as I resize it, the clipping path is updated as expected. Plus its bright green, which is nice.</p>

<p><a href="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/3/CircularSVI2_2_7C5CF8D9.jpg"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="A Circular ScatterViewItem you Can Resize!" border=0 alt="A Circular ScatterViewItem you Can Resize!" src="http://blogs.vertigo.com/personal/vertigosurface/Blog/Lists/Posts/Attachments/3/CircularSVI2_thumb_7C5CF8D9.jpg" width=240 height=226></a></p>

<p> </p>

<p>Paul Osburn 
  <br>Engineering Director, Surface</p></div>]]></description></item><item><title>Snakebite</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=44</link><pubDate>Fri, 02 Oct 2009 08:54:00 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=44#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass2F7D1D099AFB4E9EAF08FAA5914C2C50><p>I was bitten by a <a href="http://en.wikipedia.org/wiki/Agkistrodon_piscivorus">water moccasin</a> (also called cottonmouth) a while back. The kids and I were coming back from a July 4th fireworks display and decided to stop by a stream to see what was out at the time. We came across a water snake and I thought it would be a good idea to get a better look. I was sure it was a non-venomous water snake so I reached down and picked it up.</p>  <p>I was wrong… I could tell from the burning in my finger and the immediate swelling it was a water moccasin. We drove home to drop off the dog and I told the kids we’ll have to go to the hospital, but it was not serious, I would get some anti-venom and a few aspirin and be sent home.</p>  <blockquote>   <p><img title=image style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=275 alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Posts/Attachments/44/IMG_2174_3_2472D875.jpg" width=344 border=0>  <br>Driving to hospital, hand and fingers starting to swell.</p> </blockquote>  <p>I drove to the hospital which was around 30 minutes away. The swelling increased and my entire hand was swollen. We got to the hospital and the doctor was worried since it continued to swell, now it was half way down my forearm and I could not move my finders. They were worried I would need surgery and called in a helicopter so I could be transported to Austin.</p>  <p>This was unexpected. I asked if I could drive to Austin and they said no, I asked if the kids could fly in the helicopter with me and they said no. This was not good… my wife was out of town, it was midnight, I could hear a helicopter landing outside, and they wanted to know what to do with the kids. </p>  <blockquote>   <p><a href="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Posts/Attachments/44/S6306727_2_2472D875.jpg"><img title=S6306727 style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=285 alt=S6306727 src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Posts/Attachments/44/S6306727_thumb_2472D875.jpg" width=344 border=0></a>       <br>In first hospital, before transferred to Austin. Swelling down to elbow.</p> </blockquote>  <p>They called our neighbor but they did not answer. Luckily they called back and said they would be able to pick up and watch the kids. I said bye to the kids as I was wheeled out of the hospital and loaded into the helicopter. It was an interesting flight into Austin, and also very expensive, it cost $16,000.</p>  <p>The Austin emergency room was really busy and I was in the hallway for 1 – 2 hours. It turns out that hospital emergency rooms are pretty interesting at 1:00am – 3:00am on a Saturday night. My arm was swollen to my elbow and they gave me some morphine. I thought it was supposed to be trippy or something, but it was only scary since it was hard to breathe. </p>  <p>I went to the ICU next even though I was not critical, but they wanted to closely monitor the affects of the venom. There is a concern from swelling but more concern from internal bleeding, organ damage, and permanent tissue damage. I was in ICU for a few days and then released from the hospital since the swelling started to subside and there were not any signs of internal or tissue damage.</p>  <p>The total cost billed to the insurance company was $47,000 and the insurance company allowed $36,000. This included the expensive $16,000 helicopter ride.</p>  <p>It was not the snake’s fault, it was just defending itself from some goof picking it up. There are stories about water moccasins attacking people; it usually happens to a friend of a friend, often times skiing on a lake or swimming in a query, and involves a nest (or colony or pack) of snakes that aggressively attack the victim. This is an urban legend.</p>  <ul>   <li>Water moccasins are solitary, they don’t live in colonies or packs. </li>    <li>They don’t attack, they try to get away and only bite as a last resort (like when someone picks them up or steps on them). </li>    <li>They don’t repeatedly bite and don’t always inject venom. </li>    <li>More people die each year from bee stings or falling off ladders. People still have serious problems and permanent damage, but it’s very uncommon to die from a water moccasin bite. </li> </ul>  <p>Lessons learned.</p>  <ul>   <li>Take a closer look the next time you pick up a water snake. </li>    <li>Drive yourself to the hospital in a car with automatic transmission if possible. </li>    <li>Make sure to lock your car when going into the emergency room since it might be sitting there for a while. </li>    <li>Try to position yourself with a good view when flying in an EMS helicopter. </li>    <li>Speak up if you take morphine and you can’t breathe, I guess it could be difficult depending how much trouble you have breathing, but wave your arms or something. </li> </ul>  <p>Most snakes encountered are harmless and non-venomous, I happen to come across one that was venomous, but it was entirely my fault I was bitten.</p></div>]]></description></item><item><title>Twelve plus one = Eleven plus two</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=43</link><pubDate>Wed, 30 Sep 2009 06:30:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=43#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassDFCAE860AFA848F6B04155D20268DCD4><p>'<strong>Twelve plus one</strong>' contains the same letters as '<strong>eleven plus two</strong>'. I did not come up with this, but thought it was interesting.</p></div>]]></description></item><item><title>Get Ready for Sunday Night Football!</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=12</link><pubDate>Thu, 10 Sep 2009 15:49:16 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=12#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass3F2730FF10474FE6800595B408931C86><p>I'm proud to announce the launch of NBC Sport's <a href="http://snfextra.nbcsports.com/"><strong>Sunday Night Football Extra</strong></a> live HD video experience, designed and built by our team here at Vertigo, in partnership with Microsoft and NBC.  Tune in tonight, 2009-09-10 at 5 PT/8 ET to watch the Pittsburgh Steelers take on the Tennessee Titans on NFL opening day. Our team has spent the last couple of months bringing this compelling, immersive video experience to life using Microsoft's Smooth Streaming technology.  
</p><p>Follow the action tonight at <a href="http://snfextra.nbcsports.com">http://snfextra.nbcsports.com</a>. Some key features: 
</p><p><strong>•         Stunning HD Quality video</strong>
		<br>Moving to full-screen mode allows you to access 720p at 3.45 Mbps - great looking HD video.  Try hooking up your laptop to your TV and watching in full-screen mode!   
</p><p><strong>•         Adaptive streaming using Microsoft's Smooth Streaming technology</strong><br>Your Sunday Night Football viewing experience will be automatically adjusted to best match your internet bandwidth and your computer's performance.  If you have a fast internet connection, you'll automatically see the best quality video. 
</p><p><strong>•         Live Alternate cameras: Action from any angle<br></strong>While you watch the action in the main feed, you can keep an eye on four alternate camera angles, showing you the action from the sidelines, the endzone, the center-field cable, or to focus on the stars of the game.  You can switch these camera views into the main video window at any time to focus on the details. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/091009_2249_GetReadyfor1.jpg" alt=""><strong>
		</strong></p><p><strong>•         DVR controls give you the power to direct your own experience<br></strong>With DVR controls such as slow-motion, rewind, fast-forward, and instant replay, you can create your very own Sunday Night Football experience!  Want to see an instant replay of that great tackle Bob Sanders made?  Want to see Adam Vinatieri split the uprights again in slow motion? Instant response as you move through the timeline. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/091009_2249_GetReadyfor2.jpg" alt="">
	</p><p><strong>•         Interactive Timeline and Key Plays Menu<br></strong>That timeline at the bottom of the video is smarter than your average video scrubber bar!  The team-colored diamonds surrounding the timeline the key plays throughout the game, allowing you to quickly jump to the action.  This markers track the action live, appearing as soon as the action happens in your video.  Open the menu to get more details about each play. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/091009_2249_GetReadyfor3.jpg" alt="">
	</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/091009_2249_GetReadyfor4.jpg" alt="">
	</p><p><strong>•         Interactive Q&amp;A with NBC's Mike Florio<br></strong>Wondering if Peyton Manning will miss Marvin Harrison this year?  Chat with NBC's Mike Florio during the game, and have your questions get answered by the experts! 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/091009_2249_GetReadyfor5.jpg" alt=""><strong>
		</strong></p><p><strong>•         Stats<br></strong>Real-time stats data come in live with the game to give you all the info you need.
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/091009_2249_GetReadyfor6.jpg" alt="">
	</p><p><strong>•         Highlight clips<br></strong>Highlights of the big plays come in soon after the plays happen so you can review all the best moments of the game.
</p><p>I'd like to send a big thank you out to all the folks on this team and at our partner organizations for all of their hard work in creating this one of a kind video experience! 
</p><p>Obligatory screenshot:
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/091009_2249_GetReadyfor7.jpg" alt=""></p></div>]]></description></item><item><title>Scorpion in swimsuit, not pleasant</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=40</link><pubDate>Fri, 07 Aug 2009 13:40:00 GMT</pubDate><slash:comments>4</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=40#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassA143E715F2B34EC28278893EC4413A67><font face="Helvetica, Arial, sans-serif"><img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/scorpion.png" align=right height=129 hspace=10 width=161>I
put on my swimsuit and felt a sharp burning sting. It turns out a
scorpion was inside my swimsuit and stung me 3 times in the leg
before I could get them off... it could have been a lot worse.<p>
It was a little more serious than usual since my lips were tingling for a while afterwards.<p>I find scorpions really interesting, it was not their fault, they were just hiding in a nice dark area when some big human distributed their new home.</font>

</div>]]></description></item><item><title>Pick a good password when using SQL Azure…</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=44</link><pubDate>Thu, 06 Aug 2009 17:53:40 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=44#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass35B808EF95E54B93819F99EDD36AF57C><p>I think Microsoft’s decision to make SQL Azure more like SQL Server (and less like Windows Azure Storage) is great. Relational databases are complex, and having to learn a whole new technology for cloud usage seemed like a very significant barrier to entry. In addition, this makes it much easier to design an application that could be run on-premises or in the cloud—you don’t need a completely different data storage technology. (By the way, I like Azure Storage—it’s just that the previous version of SQL Data Services offered very similar functionality to Azure Storage, and we didn’t really need two of them!)</p>  <p>I’m less comfortable with some of the security aspects of SQL Azure. Specifically, if I understand correctly, developers and DBAs will access their cloud database instance using SQL Server authentication—in short, a username and password.</p>  <p>The issue here is that usually there are a lot of layers of security between attackers and the database in a traditional deployment—for example, usually the database is behind a corporate or hosting firewall. This firewall prevents users from outside the organization from accessing the database instance. Often this firewall needs something like a digital certificate or a smart card to gain access—this makes the firewall fairly formidable to attackers.</p>  <p>However, with SQL Azure, (as I understand it) there is no firewall—the only thing between you (and millions of potential attackers) is a username and password. (Presumably there’s also the equivalent of a database or server name.) The point is that the password becomes very important in this scheme—you should be sure to pick a really <a href="http://www.microsoft.com/protect/yourself/password/create.mspx">strong password</a>. (There’s also an interesting Wikipedia <a href="http://en.wikipedia.org/wiki/Password_strength">article</a> about strong passwords.)</p>  <p>At least until I understand better, I’d be a bit uncomfortable using SQL Azure for really sensitive data—modern computers and networks are fast enough that even a really strong password just takes time. I’m hoping that I’m being too paranoid here—perhaps there is a whole layer of security in SQL Azure that I’m just not aware of yet. But picking a strong password still never hurts!</p></div>]]></description></item><item><title>Example scenarios of Windows Azure pricing</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=43</link><pubDate>Fri, 17 Jul 2009 18:44:05 GMT</pubDate><slash:comments>9</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=43#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClassB39ACD0C3426409EA723D150D51EC1FC><p>Recently Microsoft announced <a href="http://www.microsoft.com/azure/pricing.mspx">pricing</a> of Windows Azure. There are different pricing models, but the consumption-based model is the one that’s currently well-defined.</p>  <p>I was curious about what all the hourly rates would add up to for a few representative types of sites using Azure. Therefore, created some assumptions about usage for some different types of sites to see what the monthly bill would come out to. </p>  <p>Just to be clear, <strong>these are just estimates—for any given application, the monthly charges could be quite different! </strong>Also, I don’t have much experience with how much load a single web role in Azure can support, so the estimates about how many would be necessary for a given level of traffic are just guesses.</p>  <p><strong>Small web application</strong></p>  <p>Let’s assume we want to host a small web application on Azure. It only has a few users, but we want it to be fairly available, so we need to have at least two web roles, so when one is updating or the hardware is failing, the other one is available. </p>  <p>Assumptions:</p>  <ul>   <li>Web Edition of SQL Azure is sufficient (up to 1 GB database) </li>    <li>1000 hits / day </li>    <li>2 web roles are sufficient to support the traffic </li>    <li>10 KB web site requests </li>    <li>100 KB web site responses </li>    <li>Average of one .NET Services call per hit (for authentication) </li>    <li>31 days per month </li>    <li>Billing does not round up for bandwidth—I have no idea if they do or not, and it’s just pennies either way </li>    <li>They do round up for .NET Services calls that are less than 100K (it says so on their pricing page) </li> </ul>  <table border=1 cellspacing=0 cellpadding=2 width=449><tbody>     <tr>       <td valign=top width=104><strong>Resource</strong></td>        <td valign=top width=95><strong>Price</strong></td>        <td valign=top width=120><strong>Amount used</strong></td>        <td valign=top width=128><strong>Cost per month</strong></td>     </tr>      <tr>       <td valign=top width=104>Web roles</td>        <td valign=top width=95>$0.12 / hour</td>        <td valign=top width=120>2 roles</td>        <td valign=top width=128>$178.56</td>     </tr>      <tr>       <td valign=top width=104>SQL Azure (Web Edition)</td>        <td valign=top width=95>$9.99 / month</td>        <td valign=top width=120>1 instance</td>        <td valign=top width=128>$9.99</td>     </tr>      <tr>       <td valign=top width=104>Bandwidth in</td>        <td valign=top width=95>$0.10 / GB</td>        <td valign=top width=120>0.31 GB</td>        <td valign=top width=128>$0.03</td>     </tr>      <tr>       <td valign=top width=104>Bandwidth out</td>        <td valign=top width=95>$0.15 / GB</td>        <td valign=top width=120>3.1 GB</td>        <td valign=top width=128>$0.47</td>     </tr>      <tr>       <td valign=top width=104>.NET Services</td>        <td valign=top width=95>$0.15 / 100K</td>        <td valign=top width=120>31,000 messages</td>        <td valign=top width=128>$0.15</td>     </tr>   </tbody></table>  <p>Total monthly charge: $189.20</p>  <p>Here’s a chart of how the various resources compare in cost for this example:</p>  <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/43/SmallSiteCosts_4_223B5989.png"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="Chart showing costs for &quot;small web application&quot;. Most of the cost comes from the two web roles." border=0 alt="Chart showing costs for &quot;small web application&quot;. Most of the cost comes from the two web roles." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/43/SmallSiteCosts_thumb_1_223B5989.png" width=494 height=287></a> </p>  <p><strong></strong></p>  <p><strong>Medium web application</strong></p>  <p>Assumptions:</p>  <ul>   <li>Business Edition of SQL Azure is needed (up to 10 GB database) </li>    <li>10,000 hits/day </li>    <li>4 web roles are sufficient to support the traffic </li>    <li>10 KB web site requests </li>    <li>100 KB web site responses </li>    <li>Average of three .NET Services calls per hit </li> </ul>  <table border=1 cellspacing=0 cellpadding=2 width=457><tbody>     <tr>       <td valign=top width=118><strong>Resource</strong></td>        <td valign=top width=100><strong>Price</strong></td>        <td valign=top width=114><strong>Amount used</strong></td>        <td valign=top width=123><strong>Cost per month</strong></td>     </tr>      <tr>       <td valign=top width=118>Web roles</td>        <td valign=top width=100>$0.12 / hour</td>        <td valign=top width=114>4 roles</td>        <td valign=top width=123>$357.12</td>     </tr>      <tr>       <td valign=top width=118>SQL Azure (Business Edition)</td>        <td valign=top width=100>$99.99 / month</td>        <td valign=top width=114>1 instance</td>        <td valign=top width=123>$99.99</td>     </tr>      <tr>       <td valign=top width=118>Bandwidth in</td>        <td valign=top width=100>$0.10 / GB</td>        <td valign=top width=114>3.1 GB</td>        <td valign=top width=123>$0.31</td>     </tr>      <tr>       <td valign=top width=118>Bandwidth out</td>        <td valign=top width=100>$0.15 / GB</td>        <td valign=top width=114>31 GB</td>        <td valign=top width=123>$4.65</td>     </tr>      <tr>       <td valign=top width=118>.NET Services</td>        <td valign=top width=100>$0.15 / 100K</td>        <td valign=top width=114>930,000 messages</td>        <td valign=top width=123>$1.50</td>     </tr>   </tbody></table>  <p>Total monthly charge: $463.57</p>  <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/43/MedSiteCosts_2_223B5989.png"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="Chart showing costs for &quot;medium web application&quot;. Much of the cost comes from the four web roles." border=0 alt="Chart showing costs for &quot;medium web application&quot;. Much of the cost comes from the four web roles." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/43/MedSiteCosts_thumb_223B5989.png" width=493 height=290></a> </p>  <p><strong></strong></p>  <p><strong>Small video d</strong><strong>elivery site</strong></p>  <p>This is a small site that allows users to watch videos online. I was curious what the costs would be for a site that uses a lot more bandwidth and storage than the examples above.</p>  <p>Assumptions:</p>  <ul>   <li>Uses Azuze Storage to store videos </li>    <li>1000 hits/day </li>    <li>2 web roles sufficient to support the traffic </li>    <li>10 KB web site requests </li>    <li>10 MB web site responses (a reasonable sized video) </li>    <li>100 GB of storage space for videos in Azure storage </li>    <li>One storage transaction request per web request </li> </ul>  <table border=1 cellspacing=0 cellpadding=2 width=453><tbody>     <tr>       <td valign=top width=110><strong>Resource</strong></td>        <td valign=top width=118><strong>Price</strong></td>        <td valign=top width=112><strong>Amount used</strong></td>        <td valign=top width=111><strong>Cost per month</strong></td>     </tr>      <tr>       <td valign=top width=110>Web roles</td>        <td valign=top width=118>$0.12 / hour</td>        <td valign=top width=112>2 roles</td>        <td valign=top width=111>$178.56</td>     </tr>      <tr>       <td valign=top width=110>Storage</td>        <td valign=top width=118>$0.15 / GB stored / month</td>        <td valign=top width=112>100 GB</td>        <td valign=top width=111>$15.00</td>     </tr>      <tr>       <td valign=top width=110>Storage transactions</td>        <td valign=top width=118>$0.01 / 10K</td>        <td valign=top width=112>31,000 requests</td>        <td valign=top width=111>$0.04</td>     </tr>      <tr>       <td valign=top width=110>Bandwidth in</td>        <td valign=top width=118>$0.10 / GB</td>        <td valign=top width=112>0.31 GB</td>        <td valign=top width=111>$0.03</td>     </tr>      <tr>       <td valign=top width=110>Bandwidth out</td>        <td valign=top width=118>$0.15 / GB</td>        <td valign=top width=112>310 GB</td>        <td valign=top width=111>$46.50</td>     </tr>   </tbody></table>  <p>Total monthly charge: $240.13</p>  <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/43/VideoSiteCosts_4_223B5989.png"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title="Chart showing costs for &quot;small video delivery site&quot;. Again, much of the cost is the two web roles." border=0 alt="Chart showing costs for &quot;small video delivery site&quot;. Again, much of the cost is the two web roles." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/43/VideoSiteCosts_thumb_1_223B5989.png" width=489 height=293></a> </p>  <p><strong>Thoughts</strong></p>  <p>For each of these examples, the web roles dominated the cost—partly because I had at least two of them (see next paragraph). Bandwidth was relatively inexpensive, even for the video site. In addition, the .NET Services and storage costs were relatively low in all of these examples. However, for some sites and services, the bandwidth or other resources might become the dominant cost—for example, a service that mainly served many large videos or files directly from Azure storage. Interestingly, even the business edition of SQL Azure is cheaper than two web roles for a month.</p>  <p>One interesting tradeoff is that you need to have at least two web roles to ensure that your application is available, given failures and updates. For a really small application it seems like overkill (and really adds to the expense if the application doesn’t consume a lot of other resources). However, I’m hard-pressed to imagine a situation, even with a relatively small application, where it would be fine for it to be unavailable for minutes at a time on a relatively frequent basis. Note that you could save quite a bit in hosting costs if you were able to go with a single web role.</p>  <p>Another question is how this compares with traditional, on-premises hosting. It seems like one factor is the timeframe of the deployment. If it’s a very short-lived site (like an event site), then this is incredibly cost effective—you don’t need to buy a bunch of servers and deploy and configure them, but the site isn’t up for long enough to incur huge charges in Azure. For a longer-lived site, it’s not quite so clear cut, but it does still seem compelling, especially considering the level of redundancy and stability that you get. </p>  <p>Yet another question is how it compares with traditional hosting. Generally, it tends to be more expensive than dedicated hosting, but also much more flexible. Often hosting providers require contracts with specific levels of resources—if your needs change, it can be difficult to change the resourcing level—especially if expected demand doesn’t materialize.</p></div>]]></description></item><item><title>Update maxBufferSize with maxReceivedMessageSize</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=29</link><pubDate>Sun, 31 May 2009 10:50:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=29#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass091DCDFEDDD14B53A925B3BEB0F7AA9F>
<p>I was working with a WCF service client application that failed. First, I had to <a href="http://blogs.vertigo.com/personal/chris/Blog/archive/2009/05/29/catch-and-abort-before-dispose.aspx">modify the try-catch and using blocks</a>. Then, I was able to see the real problem.</p><cite>The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.</cite> 
<p>This came as no surprise to me since it needed to send and receive large amounts of data. I updated my configuration file with a new binding to use 1MB instead of 64KB. (I was using a TCP binding.)</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Lucida Console,Monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">bindings</span><span style="color:#0000ff">&gt;<br><span style="margin-left:20pt"></span>&lt;</span><span style="color:#a31515">netTcpBinding</span><span style="color:#0000ff">&gt;<br><span style="margin-left:40pt"></span>&lt;</span><span style="color:#a31515">binding</span><span style="color:#0000ff"> </span><span style="color:#ff0000">name</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">myTcpBinding</span>&quot;<span style="color:#0000ff"> </span><span style="color:#ff0000">maxReceivedMessageSize</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">1048576</span>&quot;<span style="color:#0000ff"> /&gt;<br><span style="margin-left:20pt"></span>&lt;/</span><span style="color:#a31515">netTcpBinding</span><span style="color:#0000ff">&gt;<br>&lt;/</span><span style="color:#a31515">bindings</span><span style="color:#0000ff">&gt;<br></span></blockquote>
<p>I also updated the <span style="font-family:Consolas,Lucida Console,Monospace">endpoint</span> element in the <span style="font-family:Consolas,Lucida Console,Monospace">service</span> element by adding the <span style="font-family:Consolas,Lucida Console,Monospace">bindingConfiguration</span> attribute with the binding's name as its value. I performed both changes on the client and the server.</p>
<p>However, I still received exactly the same message because changing <span style="font-family:Consolas,Lucida Console,Monospace">maxReceivedMessageSize</span> wasn't enough. I also needed to update the <span style="font-family:Consolas,Lucida Console,Monospace">maxBufferSize</span> attribute of the same <span style="font-family:Consolas,Lucida Console,Monospace">binding</span> element.</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Lucida Console,Monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">bindings</span><span style="color:#0000ff">&gt;<br><span style="margin-left:20pt"></span>&lt;</span><span style="color:#a31515">netTcpBinding</span><span style="color:#0000ff">&gt;<br><span style="margin-left:40pt"></span>&lt;</span><span style="color:#a31515">binding</span><span style="color:#0000ff"> </span><span style="color:#ff0000">name</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">myTcpBinding</span>&quot;<span style="color:#0000ff"> </span><span style="color:#ff0000">maxBufferSize</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">1048576</span>&quot; <span style="color:#ff0000">maxReceivedMessageSize</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">1048576</span>&quot;<span style="color:#0000ff"> /&gt;<br><span style="margin-left:20pt"></span>&lt;/</span><span style="color:#a31515">netTcpBinding</span><span style="color:#0000ff">&gt;<br>&lt;/</span><span style="color:#a31515">bindings</span><span style="color:#0000ff">&gt;<br></span></blockquote></div>]]></description></item><item><title>Catch and Abort before Dispose</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=30</link><pubDate>Fri, 29 May 2009 08:57:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=30#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass312F105F38EB4DCAB3C83A41632F5846>
<p>My WCF service client kept giving me the generic fault message.</p><cite>The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.</cite> 
<p>I enabled fault text in the configuration file.</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Consolas,Lucida Console,Monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">serviceDebug</span><span style="color:#0000ff"> </span><span style="color:#ff0000">includeExceptionDetailInFaults</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">true</span>&quot;<span style="color:#0000ff"> /&gt;<br></span></blockquote>
<p>However, it still gave me the generic fault message. Here's how my client-side code looked.</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Consolas,Lucida Console,Monospace"><span style="color:#0000ff">try<br></span>{<br><span style="margin-left:20pt"></span><span style="color:#0000ff">using</span>(<span style="color:#0000ff">var</span> client = <span style="color:#0000ff">new</span> <span style="color:#2b91af">ControlServiceClient</span>())<br><span style="margin-left:20pt"></span>{<br><span style="margin-left:40pt"></span>client.DoSomething();<br><span style="margin-left:40pt"></span>client.DoSomethingElse();<br><span style="margin-left:20pt"></span>}<br>}<br><span style="color:#0000ff">catch</span>(<span style="color:#2b91af">Exception</span> ex)<br>{<br><span style="margin-left:20pt"></span><span style="color:#2b91af">Debug</span>.WriteLine(ex);<br>}<br></blockquote>
<p>The problem is the placement of the <a href="http://msdn.microsoft.com/en-us/library/yh598w02.aspx">using</a> block. If one of the methods in it throws an exception, program flow moves to the catch block. However, leaving a using block invokes the <a href="http://msdn.microsoft.com/en-us/library/system.idisposable.dispose.aspx">Dispose</a> method of the <a href="http://msdn.microsoft.com/en-us/library/system.idisposable.aspx">IDisposable</a> interface. In this case, the service client's implementation of Dispose will invoke <a href="http://msdn.microsoft.com/en-us/library/ms575273.aspx">Close</a> which throws another exception, hiding the first one. To fix it, I moved the using statement outstide of the try-catch block and introduced a call to <a href="http://msdn.microsoft.com/en-us/library/ms575270.aspx">Abort</a>.</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Consolas,Lucida Console,Monospace"><span style="color:#0000ff">using</span>(<span style="color:#0000ff">var</span> client = <span style="color:#0000ff">new</span> <span style="color:#2b91af">ControlServiceClient</span>())<br>{<br><span style="margin-left:20pt"></span><span style="color:#0000ff">try<br><span style="margin-left:20pt"></span></span>{<br><span style="margin-left:40pt"></span>client.DoSomething();<br><span style="margin-left:40pt"></span>client.DoSomethingElse();<br><span style="margin-left:20pt"></span>}<br><span style="margin-left:20pt"></span><span style="color:#0000ff">catch</span>(<span style="color:#2b91af">Exception</span> ex)<br><span style="margin-left:20pt"></span>{<br><span style="margin-left:40pt"></span>client.Abort();<br><span style="margin-left:40pt"></span><span style="color:#2b91af">Debug</span>.WriteLine(ex);<br><span style="margin-left:20pt"></span>}<br>}<br></blockquote>
<p>Invoking Abort does not throw an exception and prevents the Dispose implementation from invoking Close.</p></div>]]></description></item><item><title>UserControl in DataTemplate must be in a Panel</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=28</link><pubDate>Wed, 27 May 2009 09:00:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=28#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass1CA1CAEA7DC04A929507DC02ADEF5002>
<p>While investigating MVVM in Silverlight 2, I came across a problem putting a UserControl in a DataTemplate used by an ItemsControl. I started with the following XAML for the DataTemplate used by my ItemsControl in the page.</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Lucida Console,Monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">UserControl.Resources</span><span style="color:#0000ff">&gt;<br><span style="margin-left:20pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">DataTemplate</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Key</span><span style="color:#0000ff">=&quot;ListDataTemplate&quot;&gt;<br><span style="margin-left:40pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">a</span><span style="color:#0000ff">:</span><span style="color:#a31515">DetailControl</span><span style="color:#ff0000"> DataContext</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">Binding</span><span style="color:#0000ff">}&quot; /&gt;<br><span style="margin-left:20pt"></span>&lt;/</span><span style="color:#a31515">DataTemplate</span><span style="color:#0000ff">&gt;<br>&lt;/</span><span style="color:#a31515">UserControl.Resources</span><span style="color:#0000ff">&gt;</span></blockquote>
<p>I don't know why but the data didn't bind correctly in my DetailControl so for every row in the data bound to the list control I ended up with user controls in my list that had no data. Wrapping the user control in a Grid in the DataTemplate corrected the problem.</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Lucida Console,Monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">UserControl.Resources</span><span style="color:#0000ff">&gt;<br><span style="margin-left:20pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">DataTemplate</span><span style="color:#ff0000"> x</span><span style="color:#0000ff">:</span><span style="color:#ff0000">Key</span><span style="color:#0000ff">=&quot;ListDataTemplate&quot;&gt;<br><span style="margin-left:40pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;<br><span style="margin-left:60pt"></span></span><span style="color:#ff00ff"></span><span style="color:#008000">&lt;!-- Data-binding fails if I don't wrap it in a panel. --&gt;<br><span style="margin-left:60pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">a</span><span style="color:#0000ff">:</span><span style="color:#a31515">DetailControl</span><span style="color:#ff0000"> DataContext</span><span style="color:#0000ff">=&quot;{</span><span style="color:#a31515">Binding</span><span style="color:#0000ff">}&quot; /&gt;<br><span style="margin-left:40pt"></span>&lt;/</span><span style="color:#a31515">Grid</span><span style="color:#0000ff">&gt;<br><span style="margin-left:20pt"></span>&lt;/</span><span style="color:#a31515">DataTemplate</span><span style="color:#0000ff">&gt;<br>&lt;/</span><span style="color:#a31515">UserControl.Resources</span><span style="color:#0000ff">&gt;</span></blockquote></div>]]></description></item><item><title>Big centipede escapes</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=39</link><pubDate>Fri, 15 May 2009 10:31:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=39#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass5E5C6CAA95ED42ABBEB21FEAF081A972><font face="Helvetica, Arial, sans-serif">The kids found a
<a href="http://bugguide.net/node/view/29132">Giant
Redheaded Centipede</a> crawling around outside so we caught it
and put Bob (kids named it Bob right away) in a cage to observe for a
few days. It started off well, it ate 7 mealworms the first evening,
but we were surprised to discover it had escaped the next morning. Now
we have a 7&quot; centipede crawling around somewhere.</font>
</div>]]></description></item><item><title>Localization in ASP.NET MVC</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=47</link><pubDate>Fri, 08 May 2009 21:03:03 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=47#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass63FDED76F78D44F7ACEADCDABB0D6FF5><p>Based on a <a href="http://blog.eworldui.net/post/2008/05/ASPNET-MVC---Localization.aspx">post by Matt Hawley</a>, I created a few extension methods to the HtmlHelper class to provide resource/localization support.  My version is a little simpler, since it assumes the use of the standard MVC views (WebFormView).  Here are the steps you’ll need to perform to create a similar class.</p>  <ol>  <li> Reference the required assemblies and namespaces<br> <div style="font-family:Consolas;font-size:8pt;color:black;background:white"> <pre style="margin:0px"><span style="color:blue">using</span> System.Web;</pre>
<pre style="margin:0px"><span style="color:blue">using</span> System.Web.Mvc;</pre>
</div>
</li>

<li>
Declare a static class (I prefer it in the same namespace as the class your extending)<br>
<div style="font-family:Consolas;font-size:8pt;color:black;background:white">
<pre style="margin:0px"><span style="color:blue">namespace</span> System.Web.Mvc</pre>
<pre style="margin:0px">{</pre>
<pre style="margin:0px">    <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">class</span> <span style="color:#2b91af">HtmlHelperExtensions</span></pre>
<pre style="margin:0px">    {</pre>
</div>
<div style="font-family:Consolas;font-size:8pt;color:black;background:white">
<pre style="margin:0px">    }</pre>
<pre style="margin:0px">}</pre>
</div>
</li>

<li>
Create a global resource method; this method will be used to access .resx files in &lt;ApplicationRoot/App_GlobalResources
<div style="font-family:Consolas;font-size:8pt;color:black;background:white">
<pre style="margin:0px"><span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">string</span> GlobalResource(<span style="color:blue">this</span> HtmlHelper htmlHelper, <span style="color:blue">string</span> classKey, <span style="color:blue">string</span> resourceKey)</pre>
<pre style="margin:0px">{</pre>
<pre style="margin:0px">    <span style="color:blue">object</span> resource = HttpContext.GetGlobalResourceObject(classKey, resourceKey);</pre>
<pre style="margin:0px">    <span style="color:blue">string</span> resourceString = resource <span style="color:blue">as</span> <span style="color:blue">string</span>;</pre>
<pre style="margin:0px">    <span style="color:blue">return</span> resourceString;</pre>
<pre style="margin:0px">}</pre>
</div>
</li>

<li>
Create a local resource method; this method will be used to access .resx files in the App_LocalResources relative to your views<br>
For example: \Views\Home\App_LocalResources\Index.aspx.resx<br>
<i>Note that the name of the resourse file must match the name of your view!</i>
<div style="font-family:Consolas;font-size:8pt;color:black;background:white">
<pre style="margin:0px"><span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">string</span> LocalResource(<span style="color:blue">this</span> HtmlHelper htmlHelper, <span style="color:blue">string</span> resourceKey)</pre>
<pre style="margin:0px">{</pre>
<pre style="margin:0px">    WebFormView webFormView = htmlHelper.ViewContext.View <span style="color:blue">as</span> WebFormView;</pre>
<pre style="margin:0px">    <span style="color:blue">if</span> (webFormView != <span style="color:blue">null</span>)</pre>
<pre style="margin:0px">    {</pre>
<pre style="margin:0px">        <span style="color:blue">string</span> virtualPath = webFormView.ViewPath;</pre>
<pre style="margin:0px">        <span style="color:blue">object</span> resource = HttpContext.GetLocalResourceObject(virtualPath, resourceKey);</pre>
<pre style="margin:0px">        <span style="color:blue">string</span> resourceString = resource <span style="color:blue">as</span> <span style="color:blue">string</span>;</pre>
<pre style="margin:0px">        <span style="color:blue">return</span> resourceString;</pre>
<pre style="margin:0px">    }</pre>
<pre style="margin:0px">    <span style="color:blue">else</span></pre>
<pre style="margin:0px">    {</pre>
<pre style="margin:0px">        <span style="color:blue">return</span> <span style="color:blue">null</span>;</pre>
<pre style="margin:0px">    }</pre>
<pre style="margin:0px">}</pre>
</div>
</li>

<li>
Call Html.GlobalResource or Html.LocalResource from your view, depending on which resource you're trying to access<br>
<div style="font-family:Consolas;font-size:8pt;color:black;background:white">
<pre style="margin:0px"><span style="color:blue">&lt;</span><span style="color:#a31515">link</span> <span style="color:red">href</span><span style="color:blue">=&quot;</span><span style="background:#ffee62">&lt;%</span>= Html.LocalResource(&quot;IndexCss&quot;) <span style="background:#ffee62">%&gt;</span><span style="color:blue">&quot;</span> <span style="color:red">rel</span><span style="color:blue">=&quot;stylesheet&quot;</span> <span style="color:red">type</span><span style="color:blue">=&quot;text/css&quot;</span> <span style="color:blue">/&gt;</span></pre>
or<br>
<div style="font-family:Consolas;font-size:8pt;color:black;background:white">
<pre style="margin:0px"><span style="color:blue">&lt;</span><span style="color:#a31515">title</span><span style="color:blue">&gt;</span><span style="background:#ffee62">&lt;%</span><span style="color:blue">=</span> Html.GlobalResource(<span style="color:#a31515">&quot;Strings&quot;</span>, <span style="color:#a31515">&quot;ApplicationName&quot;</span>) <span style="background:#ffee62">%&gt;</span><span style="color:blue">&lt;/</span><span style="color:#a31515">title</span><span style="color:blue">&gt;</span></pre>
</div>
</div>

</li>

</ol>

<p>
If you look closely, you'll notice that the GlobalResource call takes two parameters, the first is the name of the resource file (without the extension) and the second is the resource value to retrieve.  The reason for this is because you will very likely have more than one global resource file, and you can specify which file to retrieve resources from this way.
</p></div>]]></description></item><item><title>Releasing Image Handles in WPF </title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=17</link><pubDate>Thu, 30 Apr 2009 14:20:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=17#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClass457A9962C9544505B32E772F8186B405>
<div>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri>On a recent WPF project, I needed to display images stored on the local hard drive that at some point during program execution would need to be deleted from the hard drive. The trick was, I needed to still display the images after they were deleted.</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri>In our control's ViewModel we have an Icon property, which would be bound to the Source property of an Image control.</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span><span style="color:blue">public</span> <span style="color:#2b91af">BitmapImage</span> Icon</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span><span style="color:blue">get</span> { <span style="color:blue">return</span> _icon; }</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span><span style="color:blue">set</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>_icon = <span style="color:blue">value</span>;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>OnPropertyChanged(&quot;Icon&quot;);</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;text-indent:0.5in"><span style="font-size:8pt;color:blue;font-family:Consolas">&lt;</span><span style="font-size:8pt;color:#a31515;font-family:Consolas">Image</span><span style="font-size:8pt;color:red;font-family:Consolas"> x</span><span style="font-size:8pt;color:blue;font-family:Consolas">:</span><span style="font-size:8pt;color:red;font-family:Consolas">Name</span><span style="font-size:8pt;color:blue;font-family:Consolas">=&quot;Img&quot; </span><span style="font-size:8pt;color:red;font-family:Consolas">Source</span><span style="font-size:8pt;color:blue;font-family:Consolas">=&quot;{</span><span style="font-size:8pt;color:#a31515;font-family:Consolas">Binding</span><span style="font-size:8pt;color:red;font-family:Consolas"> Path</span><span style="font-size:8pt;color:blue;font-family:Consolas">=<span style="background:yellow">Icon</span>}&quot; /&gt;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3>Although not quite the behavior we were looking for, you would expect that simply replacing the value of the Icon property with some default image would release the handle on the old image. It turns out the handle is not released, at least not immediately. I've read some posts that mention a memory leak due to the Image control not cleaning up event handler references. I suppose that could have been the cause.</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3>Regardless, we needed to continue displaying the image being deleted, not just replace the image with a default image. </font><font face=Calibri size=3>Here's the solution that seemed to work.</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri>Initially, I manually load the bitmap image that the Image control is bound to. This method is called in the ViewModel constructor. If the image is not found, a globalized, default &quot;missing image&quot; image is used.</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;text-indent:0.5in"><span style="font-size:8pt;color:blue;font-family:Consolas">public</span><span style="font-size:8pt;font-family:Consolas"> <span style="color:blue">void</span> SetDefaultIcon()</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span><span style="color:#2b91af">BitmapImage</span> img = <span style="color:blue">new</span> <span style="color:#2b91af">BitmapImage</span>();</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span><span style="color:blue">try</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>img.BeginInit();</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>img.UriSource = <span style="color:blue">new</span> <span style="color:#2b91af">Uri</span>(<span style="color:blue">this.</span>IconPath, <span style="color:#2b91af">UriKind</span>.RelativeOrAbsolute);</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>img.CacheOption = <span style="color:#2b91af">BitmapCacheOption</span>.OnLoad;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>img.CreateOptions = <span style="color:#2b91af">BitmapCreateOptions</span>.None;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>img.EndInit();</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span><span style="color:blue">catch</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span><span style="color:green">// Use a &quot;missing image&quot; icon.</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>img = <span style="color:#2b91af">MediaUtilities</span>.GetBitMapImage(<br><span style="color:#2b91af">                    CultureResource</span>.NoImage,<br>                    System.Drawing.Imaging.<span style="color:#2b91af">ImageFormat</span>.Png);</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>Icon = img;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3>Note:</font><span style="font-size:8pt;color:#2b91af;font-family:Consolas"> <font size=3>CultureResource</font></span><font size=3><span style="font-family:Consolas">.NoImage</span><font face=Calibri> (the &quot;missing image&quot; image) is a globalized bitmap of type System.Drawing.Bitmap, and needs to be converted to a WPF BitmapImage, thus it has a different load mechanism. (Scroll down for the method, if interested.)</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri>When I need to release the handle on the bitmap image in order to delete the image from the hard drive, I replace the icon with a new one in memory.</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span><span style="color:blue">public</span> <span style="color:blue">void</span> ReloadIconWithCopy()</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span><span style="color:blue">try</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>  </span><span>          </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>Icon = <span style="color:blue">new</span> <span style="color:#2b91af">BitmapImage</span>(</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas">                    <span style="color:blue">new</span> <span style="color:#2b91af">Uri</span>(<span style="color:blue">this.</span>IconPath, <span style="color:#2b91af">UriKind</span>.RelativeOrAbsolute));</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span><span style="color:blue">catch</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>                </span>Icon = <span style="color:#2b91af">MediaUtilities</span>.GetBitMapImage(<br>                    <span style="color:#2b91af">CultureResource</span>.NoImage,<br>                    System.Drawing.Imaging.<span style="color:#2b91af">ImageFormat</span>.Png);</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3>After reloading the image, I'm able to delete it from the hard drive.</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri>For those interested, below is the utility method for converting the “missing image” icon from a System.Drawing.Bitmap to a WPF BitmapImage. It's not related to releasing the handles.</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;color:blue;font-family:Consolas">public</span><span style="font-size:8pt;font-family:Consolas"> <span style="color:blue">static</span> <span style="color:blue">class</span> <span style="color:#2b91af">MediaUtilities</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas">{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span><span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span><span style="color:gray">///</span><span style="color:green"> Converts a System.Drawing.Bitmap to a System.Windows.Media.Imaging.BitmapImage.</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span><span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span><span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;param name=&quot;sourceBitmap&quot;&gt;&lt;/param&gt;</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span><span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;param name=&quot;sourceImageFormat&quot;&gt;&lt;/param&gt;</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span><span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;returns&gt;&lt;/returns&gt;</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span><span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:#2b91af">BitmapImage</span> GetBitMapImage(System.Drawing.<span style="color:#2b91af">Bitmap</span> sourceBitmap, System.Drawing.Imaging.<span style="color:#2b91af">ImageFormat</span> sourceImageFormat)</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span><span style="color:#2b91af">MemoryStream</span> ms = <span style="color:blue">new</span> <span style="color:#2b91af">MemoryStream</span>();</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span><span style="color:#2b91af">BitmapImage</span> result = <span style="color:blue">new</span> <span style="color:#2b91af">BitmapImage</span>();</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>sourceBitmap.Save(ms, sourceImageFormat);</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>result.BeginInit();</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>result.StreamSource = <span style="color:blue">new</span> <span style="color:#2b91af">MemoryStream</span>(ms.ToArray());</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>            </span>result.EndInit();</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>    </span><span>        </span><span style="color:blue">return</span> result;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"><span>        </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas">}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:8pt;font-family:Consolas"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri>So if you're having trouble releasing handles on Images in your WPF app, or otherwise being hit by the WPF Image memory leak, you might give this mechanism a try. It worked for me.  :)</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri> </p></div></font></font></div>]]></description></item><item><title>Binding Animation KeyFrame Values in WPF</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=16</link><pubDate>Thu, 23 Apr 2009 12:58:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=16#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClass46D231FB66E6468E8FD8D4154C00AAF2>
<p>Recently, I encountered a requirement for my WPF application (actually a Surface application) where I needed to navigate between two controls. One control, we'll call it <span style="font-family:Consolas">Control1</span>, can be dragged around the screen by the user. The other control, we'll call it <span style="font-family:Consolas">Control2</span>, has a similar shape to <span style="font-family:Consolas">Control1</span>, but is larger, and has a fixed location on the screen. Essentially, I needed <span style="font-family:Consolas">Control1</span> to morph into <span style="font-family:Consolas">Control2</span>. </p>
<p>To summarize the requirements: </p>
<ul>
<li><span style="font-family:Consolas">Control1</span> is moveable around the screen. </li>
<li><span style="font-family:Consolas">Control2</span> has a fixed location on the screen. </li>
<li><span style="font-family:Consolas">Control1</span> needs to appear to morph into <span style="font-family:Consolas">Control2</span>. </li></ul>
<p><img alt="" src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/042309_1958_BindingAnim1.png"> </p>
<p>I'm using the Model-View-ViewModel pattern for this application, which helps me leverage WPF's data binding support. My hope was that I would be able to implement this transition from <span style="font-family:Consolas">Control1</span> to <span style="font-family:Consolas">Control2</span> by using storyboards and data binding. I wasn't certain, however, that data binding was supported in animation properties. </p>
<p>To fake <span style="font-family:Consolas">Control1</span> growing into <span style="font-family:Consolas">Control2</span>, and moving across the screen to its home position, I decided to use an animation of <span style="font-family:Consolas">Control2</span>'s <span style="font-family:Consolas">ScaleTransform</span> and <span style="font-family:Consolas">TranslateTransform</span> properties. Since <span style="font-family:Consolas">Control1</span> is moveable, the begin values of the animation must be set dynamically. Hopefully, I would be able to bind the begin points of <span style="font-family:Consolas">Control2</span>'s animations to properties in the view model of its container. I added a <span style="font-family:Consolas">Point</span> property to hold this data, which would need to be set when the user triggers the transition to <span style="font-family:Consolas">Control2</span>. </p>
<p> </p>
<p><pre><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">public</span> <span style="color:blue">class</span> <span style="color:#2b91af">ControlContainerViewModel : INotifyPropertyChanged</span><br>{<br><span style="color:blue">  private</span> <span style="color:#2b91af">Point</span> _control1location;<br><br><span style="color:blue">  public</span> <span style="color:#2b91af">Point</span> Control1Location<br>  {<br><span style="color:blue">    set<br></span>    {<br>      _control1location = <span style="color:blue">value</span>;<br>      PropertyChanged(<span style="color:#a31515">&quot;Control1Location&quot;</span>);<br>    }<br><span style="color:blue">    get</span> { <span style="color:blue">return</span> _control1location; }<br>  }<br>} </span>
</pre>
<p></p>
<p> </p>
<p>The storyboards in the container for <span style="font-family:Consolas">Control1</span> and <span style="font-family:Consolas">Control2</span> are shown below. Notice the highlighted values, which are bound to my <span style="font-family:Consolas">Control1Location</span> property. The animation occurs over the span of one second, so notice the <span style="font-family:Consolas">KeyTime</span>s of <span style="color:blue;font-family:Consolas">&quot;00:00:00&quot;</span> and <span style="color:blue;font-family:Consolas">&quot;00:00:01&quot;</span>. For the sake of brevity, I left out the <span style="font-family:Consolas">ScaleTransform</span> animation, as well as <span style="font-family:Consolas">KeySpline</span>s. </p>
<p> </p>
<p><span style="font-size:8pt;font-family:Consolas"><span style="color:#a31515"></span><span style="color:blue">&lt;</span><span style="color:#a31515">Storyboard</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Key</span><span style="color:blue">=&quot;TransitionControl1ToControl2&quot;&gt;<br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:green">&lt;!-- Make Control2 visible at the beginning and hide Control1. --&gt;</span><span style="color:blue"> <br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">ObjectAnimationUsingKeyFrames</span><span style="color:red"> BeginTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;Control1&quot; </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Visibility)&quot;&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">  &lt;</span><span style="color:#a31515">DiscreteObjectKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Value</span><span style="color:blue">=&quot;{</span><span style="color:#a31515">x</span><span style="color:blue">:</span><span style="color:#a31515">Static</span><span style="color:red"> Visibility</span><span style="color:blue">.</span><span style="color:red">Hidden</span><span style="color:blue">}&quot;/&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">ObjectAnimationUsingKeyFrames</span><span style="color:blue">&gt;<br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">ObjectAnimationUsingKeyFrames</span><span style="color:red"> BeginTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;Control2&quot;</span><span style="color:red"> </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Visibility)&quot;&gt;<br>  </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">DiscreteObjectKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Value</span><span style="color:blue">=&quot;{</span><span style="color:#a31515">x</span><span style="color:blue">:</span><span style="color:#a31515">Static</span><span style="color:red"> Visibility</span><span style="color:blue">.</span><span style="color:red">Visible</span><span style="color:blue">}&quot;/&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">ObjectAnimationUsingKeyFrames</span><span style="color:blue">&gt; <br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:green">&lt;!-- Animate Control2 from Control1's position to its home position. --&gt;</span><span style="color:blue"> <br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:red"> BeginTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;Control2&quot;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)&quot;&gt;<br>  </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> <span style="background-color:yellow">Value</span></span><span style="color:blue;background-color:yellow">=&quot;{</span><span style="color:#a31515;background-color:yellow">Binding</span><span style="color:red;background-color:yellow"> Path</span><span style="color:blue"><span style="background-color:yellow">=Control1Location.X}&quot;/&gt;<br></span></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">  &lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:01&quot;</span><span style="color:red"> Value</span><span style="color:blue">=&quot;0&quot;/&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:blue">&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue"><br>&lt;</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:red"> BeginTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;Control2&quot;<br>    </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)&quot;&gt;<br>  </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> <span style="background-color:yellow">Value</span></span><span style="color:blue;background-color:yellow">=&quot;{</span><span style="color:#a31515;background-color:yellow">Binding</span><span style="color:red;background-color:yellow"> Path</span><span style="color:blue"><span style="background-color:yellow">=Control1Location.Y}&quot;/&gt;</span></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue"><br>  &lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:01&quot;</span><span style="color:red"> Value</span><span style="color:blue">=&quot;0&quot;/&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:blue">&gt;<br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;<br><br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">Storyboard</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Key</span><span style="color:blue">=&quot;TransitionControl2ToControl1&quot;&gt;<br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:green">&lt;!-- Animate Control2 to Control1's position. --&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:red"> BeginTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;Control2&quot;<br>    </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)&quot;&gt;<br>  </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Value</span><span style="color:blue">=&quot;0&quot;/&gt;<br>  </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:01&quot;</span><span style="color:red"> <span style="background-color:yellow"><strong>Value</strong></span></span><strong><span style="color:blue;background-color:yellow">=&quot;{</span><span style="color:#a31515;background-color:yellow">Binding</span><span style="color:red;background-color:yellow"> Path</span></strong><span style="color:blue"><span style="background-color:yellow"><strong>=</strong>Control1<strong>Location.X}&quot;/&gt;<br></strong></span></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:blue">&gt;<br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:red"> BeginTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;Control2&quot;<br>    </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)&quot;&gt;<br>  </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Value</span><span style="color:blue">=&quot;0&quot;/&gt;<br>  </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:01&quot;</span><span style="color:red"> <span style="background-color:yellow">Value</span></span><span style="color:blue;background-color:yellow">=&quot;{</span><span style="color:#a31515;background-color:yellow">Binding</span><span style="color:red;background-color:yellow"> Path</span><span style="color:blue"><span style="background-color:yellow">=Control1Location.Y}&quot;/&gt;<br></span></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:blue">&gt;<br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:green">&lt;!-- Make Control1 visible and hide Control2 at the end of the translation animation. --&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">ObjectAnimationUsingKeyFrames</span><span style="color:red"> BeginTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;Control1&quot; </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Visibility)&quot;&gt;<br>  </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">DiscreteObjectKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:01&quot;</span><span style="color:red"> Value</span><span style="color:blue">=&quot;{</span><span style="color:#a31515">x</span><span style="color:blue">:</span><span style="color:#a31515">Static</span><span style="color:red"> Visibility</span><span style="color:blue">.</span><span style="color:red">Visible</span><span style="color:blue">}&quot;/&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">ObjectAnimationUsingKeyFrames</span><span style="color:blue">&gt;<br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">ObjectAnimationUsingKeyFrames</span><span style="color:red"> BeginTime</span><span style="color:blue">=&quot;00:00:00&quot;</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;Control2&quot;<br>    </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Visibility)&quot;&gt;<br>  </span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">DiscreteObjectKeyFrame</span><span style="color:red"> KeyTime</span><span style="color:blue">=&quot;00:00:01&quot;</span><span style="color:red"> Value</span><span style="color:blue">=&quot;{</span><span style="color:#a31515">x</span><span style="color:blue">:</span><span style="color:#a31515">Static</span><span style="color:red"> Visibility</span><span style="color:blue">.</span><span style="color:red">Hidden</span><span style="color:blue">}&quot;/&gt;<br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">ObjectAnimationUsingKeyFrames</span><span style="color:blue">&gt;<br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;</span></span> </p>
<p> </p>
<p>So as long as I set the value of the <span style="font-family:Consolas">Control1Location</span> property before starting this animation, it should all work…right? </p>
<p>It turns out that this <strong>almost</strong> worked. For some strange reason, the storyboard properties do not seem to know they're bound <strong>until the second time</strong> the animation is run. I tried every way imaginable to notify the UI that the property was set, but each time the animation was first run, the bound animation keyframe values were 0.0, which I assume meant they were unset. The second time running the animation, the set values would be bound correctly. The issue wasn't related to raising the <span style="font-family:Consolas">PropertyChanged</span> event a second time—just running the animation a second time. </p>
<p>By much trial and error, I discovered an admittedly hacky way to apparently get the binding to &quot;wake up&quot; before running the first animation. </p>
<p> </p>
<p><span style="font-size:8pt;color:green;font-family:Consolas">// HACK: This is a hack to get the storyboard bindings to &quot;wake up&quot; for first time use.<br></span><span style="font-size:8pt;color:green;font-family:Consolas">// Without it, the first run of the storyboards does not seem to respect the bindings.<br></span><span style="font-size:8pt;color:green;font-family:Consolas">// Any subsequent run of the storyboards works correctly.<br><br></span><span style="font-size:8pt;font-family:Consolas"><span style="color:#2b91af">BindingOperations</span>.IsDataBound((<span style="color:#2b91af">Storyboard</span>)Resources[<span style="color:#a31515">&quot;TransitionControl1ToControl2&quot;</span>],<br>    </span><span style="font-size:8pt;font-family:Consolas"><span style="color:#2b91af">Storyboard</span>.AccelerationRatioProperty); <span style="color:green">// Arbitrary property.<br><br></span></span><span style="font-size:8pt;font-family:Consolas"><span style="color:#2b91af">BindingOperations</span>.IsDataBound((<span style="color:#2b91af">Storyboard</span>)Resources[<span style="color:#a31515">&quot;TransitionControl2ToControl1&quot;</span>],<br>    </span><span style="font-size:8pt;font-family:Consolas"><span style="color:#2b91af">Storyboard</span>.AccelerationRatioProperty); <span style="color:green">// Arbitrary property. </span></span></p>
<p> </p>
<p>It seems that calling any of the static <span style="font-family:Consolas">BindingOperations</span> methods against the two storyboards causes the binding to wake up. I chose a lighter-weight method <span style="font-family:Consolas">IsDataBound()</span>, and picked an arbitrary property that was not used in my storyboards. I'm convinced that this same wake up is occurring on the first run of the animation, but by calling a <span style="font-family:Consolas">BindingOperations</span> method we're forcing the wake up beforehand. </p>
<p>Okay, it's not pretty, but it gets the job done. <span style="font-family:Wingdings">J</span> </p></div>]]></description></item><item><title>Gunnar Optiks (aka Sunglasses for Heavy Computer Users)</title><link>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=18</link><pubDate>Mon, 20 Apr 2009 03:21:51 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=18#Comments</comments><dc:creator>kenm</dc:creator><description><![CDATA[<div class=ExternalClass211FF27CD92C43BAAEBF5E3EFF289DE7><p>Lately, my eyes have been feeling a lot of strain after hours and hours of developing everyday which has also led to headaches. I didn’t used to have this problem but I guess age is finally catching up to me. After doing some research I realized that this is a very common problem but there are some solutions (of varying success). Some people who suffer from chronic eye strain due to heavy computer use recommend taking frequent breaks away from the monitor. Others recommend tweaking the brightness, contrast and gamma of the computer’s video output until you find that magical setting that is easy on the eyes yet doesn’t destroy the quality of the image – not easy to do. After having tried both of those recommendations, the strain on my eyes did get a little better but only slightly so. Then I heard about Gunnar Optiks glasses.</p>  <p>It might seem a little strange to wear what are basically sunglasses while sitting at your computer but the concept is very similar to sunglasses that you wear while outdoors which protect your eyes from harsh light and ultra-violet radiation from the sun. The Gunnar glasses help protect your eyes from harsh indoor fluorescent lights and the light emitted by your computer monitor. I can’t honestly say that I understand exactly how they work but I can honestly say that they <strong><em>do</em></strong> work, almost completely eliminating the eye strain I used to feel.</p>  <p>Not everything is rosy with these glasses however. For one thing, the price is pretty steep. The particular model of glasses I purchased on Amazon.com was $120 which seemed a little crazy to me at the time. However, if they help keep my eyes healthy and allow me to sit for longer periods at the computer without needing to take a break then they will pay for themselves very quickly. </p>  <p>The other problem I have with the glasses is the yellow tinting which is not distracting at all but does slightly discolor what I’m looking at on screen. If I’m working on something which requires that I get the color precisely right then I need to pull the glasses down briefly. It’s not a huge problem for me but something to keep in mind if you’re a graphic designer for whom precise color is very important.</p>  <p>I should also say that I wear contact lenses and the glasses in no way interfere with them. In fact, one of Gunnar’s advertised benefits is that the curvature of the lenses and the frame causes the humidity around your eyes to rise slightly so they don’t get dried out as easily. I can’t attest to whether this is true but I’ve never had a problem with dry eyes.</p>  <p>So, the upshot of all this is that I would strongly recommend these glasses to anyone who uses a computer for 6+ hours per day and already has a problem with eye strain or suffers from light sensitivity. They did take me a couple of days before I felt comfortable using them on a regular basis but now I can’t imagine sitting at the computer without them.</p>  <p><a title="http://www.gunnars.com/" href="http://www.gunnars.com/">http://www.gunnars.com/</a></p>  <p><img title="" border=0 alt="" src="https://www.gunnaroptiks.com/store/secure/images/products/305.jpg" width=780 height=330></p></div>]]></description></item><item><title>Test for Multiple Cultures! </title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=11</link><pubDate>Fri, 03 Apr 2009 12:33:37 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=11#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass95FCEF162CD1496D9436E533B06F8F37><p><span style="color:#1f497d">A Silverlight project I'm working on fell victim to <a href="http://www.codinghorror.com/blog/archives/001248.html"></span>&quot;Ugly American Programming&quot;<span style="color:#1f497d"> this week – we neglected to thoroughly test the application in non-English languages.  This is particularly important for Rich Internet Applications that run on each user's client machine.  Each user can have a different culture set in the Regional and Language Options, which looks like this in Vista:
</span></p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/040309_1933_TestforMult1.png" alt=""><span style="color:#1f497d">    
</span></p><p><span style="color:#1f497d">The problem we ran into was that European users were getting a FormatException when executing <strong>double.Parse(value)</strong> where &quot;value&quot; was set to a decimal number such as &quot;0.05&quot;.  In European cultures, double.Parse() expects a comma in lieu of a decimal.  For example, when I change my regional settings from English to French, the format for decimals changes from &quot;X.Y&quot; to &quot;X,Y&quot;.  
</span></p><p><span style="color:#1f497d">English:
</span></p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/040309_1933_TestforMult2.png" alt=""><span style="color:#1f497d">
		</span></p><p><span style="color:#1f497d">French:
</span></p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/040309_1933_TestforMult3.png" alt=""><span style="color:#1f497d">    
</span></p><p><span style="color:#1f497d">It's good practice to always specify &quot;CultureInfo.InvariantCulture&quot; as a second argument to double.Parse() to avoid these problems:
</span></p><p><span style="color:#1f497d"><strong>double.Parse(value,CultureInfo.InvariantCulture);
</strong></span></p><p><span style="color:#1f497d">I should really know better – I see this number format every day on my drive in to work courtesy of the folks who programmed my Swedish car:
</span></p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/040309_1933_TestforMult4.png" alt=""></p></div>]]></description></item><item><title>For Some Reason You Can Still Do This: Using a Serial Mouse with Vista</title><link>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=9</link><pubDate>Mon, 30 Mar 2009 16:04:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=9#Comments</comments><dc:creator>davidb</dc:creator><description><![CDATA[<div class=ExternalClass427FD1E9F522494CAEC1DE78AD49DBD9><img src="http://blogs.vertigo.com/personal/davidb/Blog/Lists/Photos/MousePen.png" height=480 width=640>
<p>
A few months ago, a coworker needed a serial mouse for a side project, and was asking around for someone who still had one.  I recalled not throwing away my old Appoint Mouse Pen—it has a PS/2 plug with a DE-9 adapter—so was able lend it.  He returned the thing today, and just for kicks, we decided to see if it’d work with Vista.
</p>
<p>
It does.
</p>
<p>
The only trick was finding the manual way to add new mouse drivers—the Control Panel’s Add Hardware wouldn’t recognize it:
<ul>
<li>
From the Computer Management Snap-in—right-click on Computer and select Manage—go to Device Manager.
</li>
<li>
Right-click on Mice and other pointing devices, and select Scan for hardware changes.
</li>
</ul>
</p>
<img src="http://blogs.vertigo.com/personal/davidb/Blog/Lists/Photos/AddMouse.png" height=357 width=643></div>]]></description></item><item><title>DynamicTypeService error in Silverlight projects</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=38</link><pubDate>Thu, 26 Mar 2009 07:11:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=38#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass707BAD66118542AB83F72BDDE266FAA1><body>
<font face="Helvetica, Arial, sans-serif">I ran into an
error with web services when updating an application from Silverlight 2
to Silverlight 3. <br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif">Custom
tool error: Failed to generate file: Unable to find service
'DynamicTypeService'.  Ensure that the application is
installed correctly.</font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">This turned out
to be a problem with the upgrade process and not Silverlight 3. I did
the following to resolve the problem.<br>
</font>
<ol>
  <li><font face="Helvetica, Arial, sans-serif">Delete
the file <b>\Program Files\Microsoft Visual Studio
9.0\Common7\IDE\Microsoft.VisualStudio.ServicesProxy.dll</b>.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Reinstall
Silverlight 3, which installs an updated
Microsoft.VisualStudio.ServicesProxy.dll.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Open
the solution and update each web service.</font></li>
</ol>
<font face="Helvetica, Arial, sans-serif"><br>
<br>
</font>
</div>]]></description></item><item><title>VS Live Keynote and Silverlight 101 Presentation</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=47</link><pubDate>Thu, 26 Feb 2009 09:21:27 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=47#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass2E25548387A9430A8C10DA87BA7AF357><p>It’s been a busy past 24 hours.</p>  <p>Yesterday, I delivered part of the VS Live keynote at the Hyatt in San Francisco. I covered three of Vertigo’s big video projects, the <a href="http://gallery1.demconvention.com">Democratic National Convention</a>, the CBS Inauguration and the Mojave Experiment.</p>  <p>I also showed live streaming with Expression Encoder 2, mostly based on what I learned from Jit Ghosh’s excellent blog entry on <a href="http://blogs.msdn.com/jitghosh/archive/2007/11/30/demo-live-streams-in-silverlight.aspx">live streaming</a>.</p>  <p>Today, 2/26/2009, in my Silverlight 101 session, my goal was to teach people how to learn Silverlight. Note: that’s not teach them Silverlight, but how to get started. </p>  <p>Following the journalistic check list of “who, what, where, when, why and how”, I have a categorized set of links on my delicious account at <a href="http://delicious.com/scottstanfield/silverlight101">http://delicious.com/scottstanfield/silverlight101</a>. I cover why you might use Silverlight (games, line-of-business apps, video, data visualization). How to install. Who’s talking about it, etc.</p>  <p>For the first time, I’ve actually managed to blog a presentation <em>before </em>it starts. I hope this helps!</p></div>]]></description></item><item><title>Suddenly my user controls don’t load in Expression Blend</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=15</link><pubDate>Wed, 25 Feb 2009 17:12:21 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=15#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClassE7DA97F1FF784B249ACEDDBA013AD97C><p>One aspect of software development that we at Vertigo strive for is making the workflow between engineers and designers as efficient as possible. For a Silverlight or WPF project, this means engineers should write their UIs to editable in Expression Blend. A designer can then create the visual design by using Blend to edit the same codebase that the engineers are working on. This is a more efficient workflow than having designers feed engineers large chunks of tool-generated XAML to be manually migrated into the &quot;dev&quot; codebase.
</p><p>Hopefully, soon, I or some of my colleagues will begin posting about some of the core concepts required to make a Silverlight or WPF project &quot;Blendable.&quot; Unfortunately, this post is much less interesting.
</p><p>Here's the problem I encountered: <strong>All of a sudden, some of my previously-Blendable WPF controls woudn't load in Expression Blend.</strong>
	</p><p>The exception displayed in the Blend designer window was something like &quot;could not find resources/mycontrolname.xaml.&quot; For the life of me, I and my colleague could not figure out what we did to break Blendability.
</p><p>Here's a short list of commonalities between the controls that broke:
</p><ul><li>They are SurfaceUserControls (user controls for the Surface PC).
</li><li>They load &quot;design-time&quot; data when viewed in design mode, such as Blend or Visual Studio's designer (Cider).
</li><li>They contain FlowDocument viewers (one contains a RichTextBox and one contains a FlowDocumentScrollViewer).
</li><li>The FlowDocuments loaded into the viewers are constructed by loading loose FlowDocument-compliant XAML with the <span style="color:#1f497d;font-family:Consolas">XamlReader.Load()</span> method (System.Windows.Markup).
</li></ul><p>I'm not sure what exactly was causing the issue, but here's the solution that fixed the problem:
</p><p><strong>Uninstall Windows Update KB 962902</strong>, which is <strong>Expression Media 2 SP2</strong>.
</p><p>That was it. If anyone has any knowledge of this issue, please let me know. Thanks!</p></div>]]></description></item><item><title>MSDN Developer Conference in San Francisco</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=46</link><pubDate>Mon, 23 Feb 2009 12:13:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=46#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass2289ACACBE2C404CAF7A3AAA28BA4266>
<p>This morning, I participated in the MSDN DevCon (<a title="http://msdndevcon.com/Pages/SanFrancisco.aspx" href="http://msdndevcon.com/Pages/SanFrancisco.aspx">http://msdndevcon.com/Pages/SanFrancisco.aspx</a>), talking about our experience with WPF. </p>
<p><strong>Family.Show v3</strong>. You can find the latest build, released today, at <a href="http://www.vertigo.com/familyshow">http://www.vertigo.com/familyshow</a>.</p>
<p>Tim Sneath's announcement is here: <a href="http://blogs.msdn.com/tims/archive/2009/02/23/announcing-family-show-v3-our-wpf-reference-application.aspx">http://blogs.msdn.com/tims/archive/2009/02/23/announcing-family-show-v3-our-wpf-reference-application.aspx</a></p>
<p><strong>WPF Samples and XAML Cheat Sheet</strong>. I’ll get this packaged up and uploaded tonight.</p>
<p><strong>MIX ‘09. </strong>I showed some great WPF samples from the MIX 10k Challenge. My favorites were Jags 10K, Typist, and Forest (WPF). My top two Silverlight entries were Chain Reaction and the Genetic Algorithm simulator.</p>
<p><strong>WIN 7</strong>. I showed the crazy-boot-off-the-VHD feature in Win7. I love it. It’ll be a good week before I can figure out the steps to blog about it, but in the meantime, know that Windows 7 is coming, and it looks great.</p></div>]]></description></item><item><title>Bypass Image Caching in Silverlight 2.0</title><link>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=14</link><pubDate>Sat, 31 Jan 2009 09:47:39 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=14#Comments</comments><dc:creator>kenm</dc:creator><description><![CDATA[<div class=ExternalClass6AA78244D5B1421CB5DA8C9C4D27ABFB><p>Recently, I’ve been creating a simple Silverlight app to display a bunch of weather images because, living in Florida, it’s always good to know what kind weather might be coming your way. Basically, there are a number of public images I want to display such as national weather fronts, webcam images from the beach and visible/infrared satellite maps which are all publically accessible URLs. Silverlight has a handy Image control with a Source property so I figured it would be very easy to add a bunch of these to a Silverlight control and either manually or automatically update them.</p>  <p>However, one thing I quickly realized was that the images were not being updated even though my app was definitely requesting the latest image from the server. A brief debugging session revealed the problem: even though I was telling the Image controls to reload their Sources, no outbound URL request was ever being made after the first one. A little Googling led me to the discovery that Silverlight practices automatic image caching which is nice except that there appears to be no way to turn it off.</p>  <p>While image caching is probably the appropriate behavior under most circumstances, there are some situations such as mine and maybe some financial apps in which you want to be displaying the most up-to-date image from the requested URL. Microsoft should have provided a switch to turn caching off completely or maybe just on a per-request basis.</p>  <p>So this was an annoying setback but there is a pretty simple solution. It appears that Silverlight simply uses the URL of the image as the caching key so all you really need to do is change the URL slightly while still giving the web server the correct information about the image you want. The easiest way to do that is to append a querystring parameter that is never the same, such as a GUID or an integer counter. Really it could be anything but I find that appending a GUID is the simplest method and pretty much guaranteed to always be unique within this context.</p>  <p>In order to test this I created a small Silverlight app with 2 Buttons and an Image control. One button requests an image using the same URL all the time and therefore will always get the image from the cache after the initial request. The second button appends the GUID to the image’s URL and tricks Silverlight into thinking that it’s a request for a different image than what is already in its cache.</p>  <p><a href="http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Attachments/14/image_2_463BDC73.png"><img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px" title=image border=0 alt=image src="http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Attachments/14/image_thumb_463BDC73.png" width=461 height=347></a> </p>  <p>Here is the XAML and code-behind for the control:</p>  <div>   <div style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">     <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   1:</span> <span style="color:#0000ff">&lt;</span><span style="color:#800000">UserControl</span> <span style="color:#ff0000">x:Class</span><span style="color:#0000ff">=&quot;SLWxControl.Page&quot;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   2:</span>     <span style="color:#ff0000">xmlns</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> </pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   3:</span>     <span style="color:#ff0000">xmlns:x</span><span style="color:#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span> </pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   4:</span>     <span style="color:#ff0000">Width</span><span style="color:#0000ff">=&quot;700&quot;</span> <span style="color:#ff0000">Height</span><span style="color:#0000ff">=&quot;520&quot;</span><span style="color:#0000ff">&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   5:</span>     <span style="color:#0000ff">&lt;</span><span style="color:#800000">Grid</span> <span style="color:#ff0000">x:Name</span><span style="color:#0000ff">=&quot;LayoutRoot&quot;</span> <span style="color:#ff0000">Background</span><span style="color:#0000ff">=&quot;LightSlateGray&quot;</span><span style="color:#0000ff">&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   6:</span>         <span style="color:#0000ff">&lt;</span><span style="color:#800000">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   7:</span>             <span style="color:#0000ff">&lt;</span><span style="color:#800000">RowDefinition</span> <span style="color:#ff0000">Height</span><span style="color:#0000ff">=&quot;50&quot;</span> <span style="color:#0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   8:</span>             <span style="color:#0000ff">&lt;</span><span style="color:#800000">RowDefinition</span> <span style="color:#ff0000">Height</span><span style="color:#0000ff">=&quot;*&quot;</span> <span style="color:#0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   9:</span>         <span style="color:#0000ff">&lt;/</span><span style="color:#800000">Grid.RowDefinitions</span><span style="color:#0000ff">&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  10:</span>         <span style="color:#0000ff">&lt;</span><span style="color:#800000">StackPanel</span> <span style="color:#ff0000">Orientation</span><span style="color:#0000ff">=&quot;Horizontal&quot;</span> <span style="color:#ff0000">HorizontalAlignment</span><span style="color:#0000ff">=&quot;Center&quot;</span><span style="color:#0000ff">&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  11:</span>             <span style="color:#0000ff">&lt;</span><span style="color:#800000">Button</span> <span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;btnReload&quot;</span> <span style="color:#ff0000">Width</span><span style="color:#0000ff">=&quot;120&quot;</span> <span style="color:#ff0000">Height</span><span style="color:#0000ff">=&quot;30&quot;</span> <span style="color:#ff0000">Content</span><span style="color:#0000ff">=&quot;Reload&quot;</span> <span style="color:#ff0000">Grid</span>.<span style="color:#ff0000">Row</span><span style="color:#0000ff">=&quot;0&quot;</span> </pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  12:</span>                     <span style="color:#ff0000">Click</span><span style="color:#0000ff">=&quot;btnReload_Click&quot;</span> <span style="color:#0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  13:</span>             <span style="color:#0000ff">&lt;</span><span style="color:#800000">Button</span> <span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;btnReloadNoCache&quot;</span> <span style="color:#ff0000">Width</span><span style="color:#0000ff">=&quot;120&quot;</span> <span style="color:#ff0000">Height</span><span style="color:#0000ff">=&quot;30&quot;</span> <span style="color:#ff0000">Content</span><span style="color:#0000ff">=&quot;Reload (No Cache)&quot;</span> </pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  14:</span>                     <span style="color:#ff0000">Grid</span>.<span style="color:#ff0000">Row</span><span style="color:#0000ff">=&quot;0&quot;</span> <span style="color:#ff0000">Click</span><span style="color:#0000ff">=&quot;btnReloadNoCache_Click&quot;</span> <span style="color:#ff0000">Margin</span><span style="color:#0000ff">=&quot;4&quot;</span> <span style="color:#0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  15:</span>         <span style="color:#0000ff">&lt;/</span><span style="color:#800000">StackPanel</span><span style="color:#0000ff">&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  16:</span>         </pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  17:</span>         <span style="color:#0000ff">&lt;</span><span style="color:#800000">Image</span> <span style="color:#ff0000">Name</span><span style="color:#0000ff">=&quot;imgBeach&quot;</span> <span style="color:#ff0000">Grid</span>.<span style="color:#ff0000">Row</span><span style="color:#0000ff">=&quot;1&quot;</span><span style="color:#0000ff">/&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  18:</span>     <span style="color:#0000ff">&lt;/</span><span style="color:#800000">Grid</span><span style="color:#0000ff">&gt;</span></pre>

    <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><p><span style="color:#606060">  19:</span> <span style="color:#0000ff">&lt;/</span><span style="color:#800000">UserControl</span><span style="color:#0000ff">&gt;</span></p><p><span style="color:#0000ff"></span> </p></pre>

    <div>
      <div style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px">
        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   1:</span> <span style="color:#0000ff">public</span> <span style="color:#0000ff">partial</span> <span style="color:#0000ff">class</span> Page : UserControl</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   2:</span> {</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   3:</span>     <span style="color:#0000ff">private</span> <span style="color:#0000ff">const</span> <span style="color:#0000ff">string</span> IMAGE_URL = </pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   4:</span>         <span style="color:#006080">&quot;http://sciencecentercam.fas.harvard.edu/axis-cgi/jpg/image.cgi?resolution=hugesize&amp;camera=1&amp;compression=50&quot;</span>;</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   5:</span>  </pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   6:</span>     <span style="color:#0000ff">public</span> Page()</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   7:</span>     {</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   8:</span>         InitializeComponent();</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">   9:</span>         LoadImage(<span style="color:#0000ff">true</span>);</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  10:</span>     }</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  11:</span>  </pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  12:</span>     <span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> LoadImage(<span style="color:#0000ff">bool</span> allowCaching)</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  13:</span>     {</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  14:</span>         <span style="color:#0000ff">string</span> imageUrl = (allowCaching) ? IMAGE_URL : <span style="color:#0000ff">string</span>.Format(<span style="color:#006080">&quot;{0}&amp;guid={1}&quot;</span>, IMAGE_URL, Guid.NewGuid());</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  15:</span>         imgBeach.Source = <span style="color:#0000ff">new</span> BitmapImage(<span style="color:#0000ff">new</span> Uri(imageUrl, UriKind.RelativeOrAbsolute));</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  16:</span>     }</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  17:</span>  </pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  18:</span>     <span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> btnReload_Click(<span style="color:#0000ff">object</span> sender, RoutedEventArgs e)</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  19:</span>     {</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  20:</span>         LoadImage(<span style="color:#0000ff">true</span>);</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  21:</span>     }</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  22:</span>  </pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  23:</span>     <span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> btnReloadNoCache_Click(<span style="color:#0000ff">object</span> sender, RoutedEventArgs e)</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  24:</span>     {</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  25:</span>         LoadImage(<span style="color:#0000ff">false</span>);</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  26:</span>     }</pre>

        <pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, 'Courier New', courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px"><span style="color:#606060">  27:</span> }</pre>
      </div>
    </div>
  </div>
</div>

<p>The only problem I can see with this solution is that Silverlight will continually cache these images so this might cause a dramatic memory leak in the app which could be very bad. I have yet to figure out how to manipulate the cache or whether it’s even possible to do so. If it is possible then the preferred solution might be to check for the existence of an image in the cache first and then delete it before trying to request an updated image from the server.</p></div>]]></description></item><item><title>Visual Studio 2008, missing user-handled column in Exceptions window </title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=37</link><pubDate>Thu, 15 Jan 2009 05:51:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=37#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass27B1855CEA914C7D927DF5C07B896018><small><font face="Helvetica, Arial, sans-serif">Sometimes
I find that the <b>User-handled</b> column in the <b>Exceptions</b>
window is missing in Visual Studio 2008.<br>
<br>
<img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/exceptions-dialog1.png" height=281 width=537><br>
<br>
</font></small><small><font face="Helvetica, Arial, sans-serif">It can be displayed by
selecting <b>Tools</b> / <b>Options…</b>
/ <b>Debugging</b> / <b>General</b> / and
checking <b>Enable Just My Code (Managed Only)</b>.<br>
</font></small><br>
<small><font face="Helvetica, Arial, sans-serif"><img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/exceptions-dialog3.png" height=329 width=552><br>
<br>
Then the User-handled column is available.<br>
<br>
<img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/exceptions-dialog2.png" height=281 width=537><br>
<br>
</font></small>
</div>]]></description></item><item><title>Great quote I saw referenced by 37 Signals</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=46</link><pubDate>Mon, 05 Jan 2009 09:52:27 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=46#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClassF25962265D2E4A01BA8B690B6EEC1DD2><p><span style="font-family:Arial;font-size:10pt">Beauty is more important in computing than anywhere else in technology because software is so complicated. Beauty is the ultimate defense against complexity.
</span></p><p><span style="font-family:Arial;font-size:10pt">—David Gelernter, Machine Beauty: Elegance and the Heart of Technology
</span></p></div>]]></description></item><item><title>Getting started with Silverlight unit testing</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=45</link><pubDate>Mon, 29 Dec 2008 08:43:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=45#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass52A3E8338C0C4266B24679408DE82887>
<p>Microsoft recently released the final versions of their unit testing components for Silverlight 2. While <a href="http://weblogs.asp.net/scottgu/archive/2008/04/02/unit-testing-with-silverlight.aspx">Scott Guthrie</a> and <a href="http://www.jeff.wilcox.name/2008/03/silverlight2-unit-testing/">Jeff Wilcox</a> have blogged about it, their blogs targeted pre-release versions (specifically Beta 2), and things have changed quite a bit since then. I've been working on some cross-cutting Silverlight classes recently, and thought I would take the opportunity to build some unit tests for what I was working on. It turns out that configuring a unit testing environment isn't very straightforward, so I thought I would provide an updated (and simplified) set of instructions here. </p>
<h2>Step 1: Download the Silverlight Toolkit Source </h2>
<ol>
<li>Head over to <a href="http://www.codeplex.com/Silverlight">http://www.codeplex.com/Silverlight</a> </li>
<li>Under the <em>Get Started</em> section, click the <a href="http://www.codeplex.com/Silverlight/Release/ProjectReleases.aspx">Download the latest release</a> link </li>
<li>Download the <em>Silverlight Toolkit - Binaries, Samples, Documentation, Unit Tests and Sources </em></li></ol>
<h2>Step 2: Update your Silverlight installation with the unit testing binaries </h2>
<ol>
<li>Navigate to the Source\Binaries folder of the extracted Silverlight Toolkit source downloaded in Step 1 </li>
<li>Copy the <strong>Microsoft.Silverlight.Testing.dll</strong> and <strong>Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll</strong> files to the <em>C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client</em> </li></ol>
<h2>Step 3: Download the Silverlight Unit Test Framework </h2>
<ol>
<li>Go to <a href="http://code.msdn.microsoft.com/silverlightut">http://code.msdn.microsoft.com/silverlightut</a> </li>
<li>Click the download new templates link </li></ol>
<h2>Step 4: Configuring Visual Studio 2008 </h2>
<ol>
<li>Navigate to the extracted Visual Studio Templates downloaded in Step 3 </li>
<li>Copy <strong>SilverlightTestClass_CSharp.zip</strong> to <em>C:\Users\&lt;YourUserNameHere&gt;\Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#</em> </li>
<li>Copy <strong>SilverlightTestProject_CSharp.zip</strong> to <em>C:\Users\&lt;YourUserNameHere&gt;\Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual C#</em> </li></ol>
<p>If you prefer Visual Basic, copy the VB versions to the corresponding Visual Basic template folders. </p>
<h2>Step 5: Double-Check Visual Studio </h2>
<ol>
<li>Open Visual Studio </li>
<li>Select File -&gt; New -&gt; Project </li>
<li>Select Visual C#, (the root, not one of the sub-types; this part is <strong>critical</strong>) </li>
<li>Under the <em>My Templates</em> section, select <strong>Silverlight Test Project</strong> </li></ol>
<p>Hope this helps!</p></div>]]></description></item><item><title>PathGeometry Figures Property XAML Attribute Syntax in Silverlight</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=27</link><pubDate>Thu, 04 Dec 2008 10:45:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=27#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass91DEC9B22E214DA4A56C761A1C5ADD42>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.pathgeometry.figures(VS.95).aspx">MSDN documentation</a> is incorrect. In the current released version of Silverlight 2, 2.0.31005.0, you cannot use attribute syntax for the Figures property of a PathGeometry in XAML. For instance, the following will fail, throwing a XamlParseException.</p>
<blockquote dir=ltr style="font-family:Consolas,Lucida Console,Monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Path</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;Black&quot;&gt;</span> 
<div style="margin-left:27pt"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Path.Data</span><span style="color:#0000ff">&gt;</span> 
<div style="margin-left:27pt"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">PathGeometry</span><span style="color:#ff0000"> Figures</span><span style="color:#0000ff">=&quot;M0,0L9,0 9,9 0,9Z&quot; /&gt;</span></div><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Path.Data</span><span style="color:#0000ff">&gt;</span></div><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Path</span><span style="color:#0000ff">&gt;</span></blockquote>
<p>This is true for path geometries used in clipping regions as well. The following will fail in the same way.</p>
<blockquote dir=ltr style="font-family:Consolas,Lucida Console,Monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;23&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;23&quot;</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;Black&quot;&gt;</span> 
<div style="margin-left:27pt"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle.Clip</span><span style="color:#0000ff">&gt;</span> 
<div style="margin-left:27pt"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">PathGeometry</span><span style="color:#ff0000"> Figures</span><span style="color:#0000ff">=&quot;M0,0L9,0 9,9 0,9Z&quot; /&gt;</span></div><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Rectangle.Clip</span><span style="color:#0000ff">&gt;</span></div><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Rectangle</span><span style="color:#0000ff">&gt;</span></blockquote>
<p>Instead, you must use the more verbose element syntax.</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Lucida Console,Monospace"><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle</span><span style="color:#ff0000"> Width</span><span style="color:#0000ff">=&quot;23&quot;</span><span style="color:#ff0000"> Height</span><span style="color:#0000ff">=&quot;23&quot;</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;Black&quot;&gt;<br><span style="margin-left:30pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Rectangle.Clip</span><span style="color:#0000ff">&gt;<br><span style="margin-left:60pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">PathGeometry</span><span style="color:#0000ff">&gt;<br><span style="margin-left:90pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">PathGeometry.Figures</span><span style="color:#0000ff">&gt;<br><span style="margin-left:120pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">PathFigure</span><span style="color:#ff0000"> StartPoint</span><span style="color:#0000ff">=&quot;0,0&quot;</span><span style="color:#ff0000"> IsClosed</span><span style="color:#0000ff">=&quot;True&quot;&gt;<br><span style="margin-left:150pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">LineSegment</span><span style="color:#ff0000"> Point</span><span style="color:#0000ff">=&quot;9,0&quot; /&gt;<br><span style="margin-left:150pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">LineSegment</span><span style="color:#ff0000"> Point</span><span style="color:#0000ff">=&quot;9,9&quot; /&gt;<br><span style="margin-left:150pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;</span><span style="color:#a31515">LineSegment</span><span style="color:#ff0000"> Point</span><span style="color:#0000ff">=&quot;0,9&quot; /&gt;<br><span style="margin-left:120pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">PathFigure</span><span style="color:#0000ff">&gt;<br><span style="margin-left:90pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">PathGeometry.Figures</span><span style="color:#0000ff">&gt;<br><span style="margin-left:60pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">PathGeometry</span><span style="color:#0000ff">&gt;<br><span style="margin-left:30pt"></span></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Rectangle.Clip</span><span style="color:#0000ff">&gt;<br></span><span style="color:#ff00ff"></span><span style="color:#0000ff">&lt;/</span><span style="color:#a31515">Rectangle</span><span style="color:#0000ff">&gt;</span></blockquote>
<p>This is not true for the Data property of a Path. The following will work as expected.</p>
<blockquote dir=ltr style="font-family:Consolas,Lucida Console,Monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Path</span><span style="color:#ff0000"> Fill</span><span style="color:#0000ff">=&quot;Black&quot;</span><span style="color:#ff0000"> Data</span><span style="color:#0000ff">=&quot;M0,0L9,0 9,9 0,9Z&quot; /&gt;</span></blockquote></div>]]></description></item><item><title>KeyDown and MessageBox don't mix well in Silverlight</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=41</link><pubDate>Tue, 02 Dec 2008 15:20:00 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=41#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass054B9A76A7994E3D955DFD45F0EE1987>
<p>I recently attempted to add keyboard support for deletion to a DataGrid control in a Silverlight application. </p>
<p>To help decide which event I should use—KeyUp or KeyDown—I decided to see how Microsoft Excel handled the Delete button. A quick test revealed that Excel deleted on KeyDown, and I figured if it was good enough for Excel, it was good enough for my app.</p>
<p>Therefore, I coded up the Delete button to use the KeyDown event, and (thoughtfully) added a confirm MessageBox dialog for the user asking if they actually wanted to delete the item. However, as soon as I started testing it, I noticed that it worked fine in Firefox but it would sometimes cause IE to crash and close.</p>
<p>After doing some debugging, I found that a serious-sounding exception (System.ExecutionEngineException) was getting thrown at the MessageBox.Show call (here it is recreated in a new project):</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/41/ExecutionEngineExceptionScreenshot_2_2413E66B.png"><img title="Visual Studio debugging with the ExecutionEngineException being thrown by the MessageBox.Show() method." style="display:inline" height=679 alt="Visual Studio debugging with the ExecutionEngineException being thrown by the MessageBox.Show() method." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/41/ExecutionEngineExceptionScreenshot_thumb_2413E66B.png" width=523 border=0></a> </p>
<p>My first thought was that it was a bug with IE—mainly because of the violence of the crash. However, at lunch, I mentioned this to a colleague, and he mentioned that a crucial difference between KeyUp and KeyDown is that KeyDown <strong>repeatedly fires </strong>as long as the key is held down, whereas KeyUp does not. He suggested that the exception (and subsequent browser crash) might be caused by multiple events being fired.</p>
<p>A bit more research revealed that this was the issue. I was getting multiple events fired from the KeyDown, which were then trying to display more than one MessageBox at the same time. Since the MessageBox is modal, only one can be displayed at a time, and trying to display another caused the error.</p>
<p>Changing to the KeyUp event fixed the entire issue!</p></div>]]></description></item><item><title>System.Windows.MessageBox in Silverlight 2.0 RTW</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=39</link><pubDate>Tue, 02 Dec 2008 14:58:42 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=39#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass23086FDA8E404686A7AB1FE9289F3FF2><p>A common user interaction is the humble MessageBox. Doing a quick web search of “silverlight messagebox” tends to produce a number of results lamenting how MessageBox is not available in Silverlight, and discussing various techniques to simulate a MessageBox.</p>  <p>While it’s true that there wasn’t a MessageBox until the Release Candidate, there <strong>IS </strong>a MessageBox class in the final (RTW, Release To Web) version of Silverlight 2.0! </p>  <p>It’s System.Windows.MessageBox. It’s a bit limited:</p>  <ul>   <li>It doesn’t display an icon on Windows (although according to the <a href="http://msdn.microsoft.com/en-us/library/system.windows.messagebox(VS.95).aspx">docs</a>, the Macintosh version does display an icon!) </li>    <li>It offers a choice of a single button called OK or two buttons: OK and Cancel. </li> </ul>  <p>One nice part of the MessageBox is that it allows customization of the title bar text (unlike the Javascript alert() and confirm() dialogs). And it’s a bit less code than other alternatives, and it’s more visually consistent across various browsers than the Javascript alternatives. Here’s the code to generate a MessageBox with all the options: </p>  <pre>MessageBox.Show(&quot;<span style="color:#8b0000">This is the messageBoxText</span>&quot;,
                &quot;<span style="color:#8b0000">This is the caption</span>&quot;, 
                MessageBoxButton.OKCancel);</pre>

<p>This renders like this on Windows Vista:</p>

<p><a href="http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Attachments/39/MessageBox_2_72ADF810.png"><img title="Screenshot of MessageBox, showing custom caption, message, and OK and Cancel buttons." style="display:inline" height=152 alt="Screenshot of MessageBox, showing custom caption, message, and OK and Cancel buttons." src="http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Attachments/39/MessageBox_thumb_72ADF810.png" width=251 border=0></a> </p>

<p>If you only want the OK button, just pass MessageBoxButton.OK as the last parameter:</p>

<p><a href="http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Attachments/39/OneButtonMessageBox_2_72ADF810.png"><img title="MessageBox showing custom caption and message, with only OK button." style="display:inline" height=152 alt="MessageBox showing custom caption and message, with only OK button." src="http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Attachments/39/OneButtonMessageBox_thumb_72ADF810.png" width=209 border=0></a> </p>

<p>Finally, there’s a simpler overload that only takes the messageBoxText:</p>

<pre>MessageBox.Show(&quot;<span style="color:#8b0000">This is the messageBoxText</span>&quot;);</pre>

<p>This generates a MessageBox with only the OK button and no text in the title bar:</p>

<p><a href="http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Attachments/39/MessageBoxnooptions_2_72ADF810.png"><img title="MessageBox with no text in the caption and only the OK button." style="display:inline" height=152 alt="MessageBox with no text in the caption and only the OK button." src="http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Attachments/39/MessageBoxnooptions_thumb_72ADF810.png" width=209 border=0></a> </p>

<p>In addition, the Show method returns a MessageBoxResult, which has the following values: OK, Yes, No, Cancel, None. According to the docs, the Yes, No, and None values are currently unused. (This makes sense, as there are only OK and Cancel buttons.)</p>

<p>Here’s a link to the documentation: <a title="http://msdn.microsoft.com/en-us/library/system.windows.messagebox(VS.95).aspx" href="http://msdn.microsoft.com/en-us/library/system.windows.messagebox(VS.95).aspx">http://msdn.microsoft.com/en-us/library/system.windows.messagebox(VS.95).aspx</a></p></div>]]></description></item><item><title>Snapshot of XAML control, save to image</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=36</link><pubDate>Fri, 21 Nov 2008 12:52:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=36#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass29334FBB0DCE4318AA38D374A7157460><body>
<small><font face="Helvetica, Arial, sans-serif">You
can use the
<b>RenderTargetBitmap</b> class to generate an image from a
UI element. For
example, say you want to generate an image from the XAML
element <i>ThePanel</i>.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">&lt;</font><font color="#a31515">StackPanel</font><font color="#ff0000"> Name</font><font color="#0000ff">=&quot;ThePanel&quot;</font><font color="#ff0000"> Orientation</font><font color="#0000ff">=&quot;Horizontal&quot;&gt;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#a31515">    </font><font color="#0000ff">&lt;</font><font color="#a31515">Rectangle</font><font color="#ff0000"> Width</font><font color="#0000ff">=&quot;50&quot;</font><font color="#ff0000"> Height</font><font color="#0000ff">=&quot;50&quot;</font><font color="#ff0000"> Fill</font><font color="#0000ff">=&quot;Red&quot; /&gt;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#a31515">    </font><font color="#0000ff">&lt;</font><font color="#a31515">Rectangle</font><font color="#ff0000"> Width</font><font color="#0000ff">=&quot;50&quot;</font><font color="#ff0000"> Height</font><font color="#0000ff">=&quot;50&quot;</font><font color="#ff0000"> Fill</font><font color="#0000ff">=&quot;Orange&quot; /&gt;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#a31515">    </font><font color="#0000ff">&lt;</font><font color="#a31515">Rectangle</font><font color="#ff0000"> Width</font><font color="#0000ff">=&quot;50&quot;</font><font color="#ff0000"> Height</font><font color="#0000ff">=&quot;50&quot;</font><font color="#ff0000"> Fill</font><font color="#0000ff">=&quot;YellowGreen&quot; /&gt;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#0000ff">&lt;/</font><font color="#a31515">StackPanel</font><font color="#0000ff">&gt;</font></font><br>
  </small></blockquote>
<small><font face="Helvetica, Arial, sans-serif">
You can use <b>RenderTargetBitmap</b> to generate an
image,
and <b>PngBitmapEncode</b>
to save to a PNG file.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">void</font><font color="#000000"> SaveImage(</font><font color="#2b91af">Visual</font><font color="#000000"> visual, </font><font color="#0000ff">int</font><font color="#000000"> width, </font><font color="#0000ff">int</font><font color="#000000"> height, </font><font color="#0000ff">string</font><font color="#000000"> filePath)</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// generate the image</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#2b91af">RenderTargetBitmap</font><font color="#000000"> bitmap = </font><font color="#0000ff">new</font><font color="#000000"> </font><font color="#2b91af">RenderTargetBitmap</font><font color="#000000">(width, height, </font><font color="#800000">96</font><font color="#000000">, </font><font color="#800000">96</font><font color="#000000">, </font><font color="#2b91af">PixelFormats</font><font color="#000000">.Pbgra32);</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    bitmap.Render(visual);</font></font><br>
  <br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// create image file</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#2b91af">PngBitmapEncoder</font><font color="#000000"> image = </font><font color="#0000ff">new</font><font color="#000000"> </font><font color="#2b91af">PngBitmapEncoder</font><font color="#000000">();</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    image.Frames.Add(</font><font color="#2b91af">BitmapFrame</font><font color="#000000">.Create(bitmap));</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#0000ff">using</font><font color="#000000"> (</font><font color="#2b91af">Stream</font><font color="#000000"> fs = </font><font color="#2b91af">File</font><font color="#000000">.Create(filePath))</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    {</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">        image.Save(fs);</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    }</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">}</font>
  </font><br>
  </small></blockquote>
<small><font face="Helvetica, Arial, sans-serif">Calling
the
<i>SaveImage</i> method.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#008000">// full path to the image</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#0000ff">string</font><font color="#000000"> filePath = </font><font color="#2b91af">Path</font><font color="#000000">.Combine(System.</font><font color="#2b91af">Environment</font><font color="#000000">.CurrentDirectory, </font><font color="#a31515">&quot;sample.png&quot;</font><font color="#000000">);</font></font><br>
  <br>
  <font face="Helvetica, Arial, sans-serif"><font color="#008000">// generate image from XAML element</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">SaveImage(</font><font color="#0000ff">this</font><font color="#000000">.ThePanel, </font><font color="#800000">500</font><font color="#000000">, </font><font color="#800000">500</font><font color="#000000">, filePath); </font></font><br>
  </small></blockquote>
<small><font face="Helvetica, Arial, sans-serif">
If you are creating the control dynamically, be sure to call <b>Arrange</b>
on
the control before generating the image.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#008000">// full path to the image</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#0000ff">string</font><font color="#000000"> filePath = </font><font color="#2b91af">Path</font><font color="#000000">.Combine(System.</font><font color="#2b91af">Environment</font><font color="#000000">.CurrentDirectory, </font><font color="#a31515">&quot;sample.png&quot;</font><font color="#000000">);</font></font><br>
  <br>
  <font face="Helvetica, Arial, sans-serif"><font color="#008000">// create instance of control</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#2b91af">Button</font><font color="#000000"> button = </font><font color="#0000ff">new</font><font color="#000000"> </font><font color="#2b91af">Button</font><font color="#000000">();</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">button.Content = </font><font color="#a31515">&quot;Nifty Button&quot;</font><font color="#000000">;</font></font><br>
  <br>
  <font face="Helvetica, Arial, sans-serif"><font color="#008000">// layout control before generating image</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">button.Arrange(</font><font color="#0000ff">new</font><font color="#000000"> </font><font color="#2b91af">Rect</font><font color="#000000">(</font><font color="#800000">0</font><font color="#000000">, </font><font color="#800000">0</font><font color="#000000">, </font><font color="#800000">500</font><font color="#000000">, </font><font color="#800000">500</font><font color="#000000">));</font></font><br>
  <br>
  <font face="Helvetica, Arial, sans-serif"><font color="#008000">// generate image from XAML element</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">SaveImage(button, </font><font color="#800000">500</font><font color="#000000">, </font><font color="#800000">500</font><font color="#000000">, filePath); </font>
  </font><br>
  </small></blockquote>
<small><font face="Helvetica, Arial, sans-serif"><br>
<br>
</font></small>
</div>]]></description></item><item><title>Our Microsoft Surface Travel Kit</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=43</link><pubDate>Fri, 07 Nov 2008 14:13:54 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=43#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass947E644A00824DA4A2F4A7F7A9C31BD6><p>We’re taking one of our <a href="http://www.surface.com">Microsoft Surface</a> units to the <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp</a> tomorrow. As a Platinum Sponsor, we have our own room to do some show-and-tell. Since we’re expecting a big crowd (over 1200 people have registered!), we wanted to create a space that allows a lot of people to join in.</p>  <p><a href="http://blogs.vertigo.com/personal/scott/Blog/Lists/Posts/Attachments/43/surfaceatvertigo_6_646C493D.jpg"><img title=surface-at-vertigo style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=350 alt=surface-at-vertigo src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Posts/Attachments/43/surfaceatvertigo_thumb_2_646C493D.jpg" width=614 border=0></a></p>  <p>Jack and Paul S. are “painting” on the Surface unit. Overhead, a <a href="http://www.camcorderinfo.com/content/Canon-Vixia-HF10-Camcorder-Review-34711.htm">Canon HF-10</a> HD camera captures the action, sending the output over HDMI to the Sony 42” LCD TV. Alan can see the hands over the Surface as well as what’s shown on the Surface.</p>  <p>Paul O. is at the helm, driving the code demos on the attached keyboard and LCD. He can toggle the TV between the HD camera and the code shown on his screen. This way the audience gathered around can see how we’re building our demos.</p>  <p>The <a href="http://www.fishman.com/products/details.asp?id=106">Fishman SoloAmp</a> PA on the far left ensures we don’t have to yell! We’re doing these demos <strong>all day Saturday</strong> and don’t want to lose our voices.</p>  <p>I’m also bringing my <a href="http://www.segway.com/">Segway</a>.</p></div>]]></description></item><item><title>Silicon Valley Code Camp</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=41</link><pubDate>Tue, 04 Nov 2008 08:54:00 GMT</pubDate><slash:comments>4</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=41#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass0E73499FFB194CBAB8EC98D97520B954><div class=ExternalClass3798EEABB0734B80A0055CCEB8F1A6EF>   <div>     <p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3>I noticed there’s not much coverage of WPF at Code Camp, so I'm swapping out my Silverlight 2 Deep Zoom session to focus on the big set of new features just released for Windows clients developers in WPF. Here's my session:</font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"> </p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3> </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><b><font size=3><font face=Calibri>7 Best Features of WPF 3.5 SP1</font></font></b></p>      <p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><font face=Calibri size=3> </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><font face=Calibri size=3>The August 2008 release of the .NET Framework (version 3.5 SP1) includes exciting new improvements for WPF developers like GPU-accelerated bitmap effects, the “diet” .NET framework, and a totally custom setup experience. </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><font face=Calibri size=3> </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><font face=Calibri size=3>Then, just last week at the PDC2008 in Los Angeles, Microsoft surprised us with even more WPF goodness by releasing the WPF DataGrid, Office-style Ribbon controls, and VSM (Visual State Manager) support in Blend. </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><font face=Calibri size=3> </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><font face=Calibri size=3>I’ll demo all of these in a fast-paced, slide-free (well maybe just a couple) session. There’s a lot to cover, so get here early. And if I can get it to work, I’ll show the all-new Visual Studio 10, built from the ground-up in WPF!</font></p>      <p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><font face=Calibri size=3> </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><font face=Calibri size=3><strong>11:15am Saturday, Room 3525</strong></font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3> </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3> </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3>Also, the Vertigo team is packing up one of their <b>Surface PCs </b>to bring for everyone to play with! You can find it in the Platinum sponsor area in room 4223. Stop by for some true hands-on demos. </font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font size=3></font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font size=3></font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font size=3>Just testing this new feature:</font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"> </p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font size=3></font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"><a href="http://go.microsoft.com/fwlink/?linkid=124807"><img src="http://memorabilia.hardrock.com/Widget/Ping.gif?type=install&amp;item=025746" style="margin:0;padding:0;border:0" width=400 height=400></a></p>      <p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font></p>      <p class=MsoNormal style="margin:0in 0in 0pt"> </p>      <p class=MsoNormal style="margin:0in 0in 0pt"> </p>   </div> </div></div>]]></description></item><item><title>Windows 7 on an Asus EEE PC 901</title><link>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=12</link><pubDate>Thu, 30 Oct 2008 08:16:30 GMT</pubDate><slash:comments>19</slash:comments><comments>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=12#Comments</comments><dc:creator>kenm</dc:creator><description><![CDATA[<div class=ExternalClass6DB1A752BE934E189AA80212EACFE370><p>A couple of weeks ago I got one of those tiny Asus EEE PCs which is in the new class of computers called netbooks. It’s pretty small and light but just large enough to be really useful as a laptop. Originally, it came loaded with Linux which I left on for about a day before I longed for some of my regular Windows apps. So I dug out the product key for an old Dell laptop that I no longer use and installed Windows XP Pro on the netbook. While very slightly slower than the Linux that was on there before, the performance of XP on this machine is perfectly acceptable for my uses which are browsing the net, watching videos and reading books in PDF format.</p>  <p>Not being a big fan of XP anymore, I did try putting Vista on the Asus but it just felt a little too sluggish for my taste. However, watching the Windows 7 keynote on Tuesday morning I was a little stunned to see Steven Sinofsky show a netbook running the new OS. Actually, I was stunned, then skeptical and then finally curious. So I got my hands on a copy of the PDC build of Windows 7, first noticing that it was actually several hundred megabytes smaller than Vista 32-bit with SP1 integrated.</p>  <p>Playing it safe, I began by installing Windows 7 into a virtual machine with only 1GB of RAM allocated just to become familiar with the OS and see how it performed within those memory constraints. My first impressions were that it didn’t look terribly different from Vista but also that it was a very snappy OS even with just 1GB of RAM. Having installed Vista in a similar environment, my unscientific opinion is that Windows 7 is at least as fast as Vista and perceptibly faster. </p>  <p>So, having been satisfied with Windows 7 in a virtual sandbox, I was now ready to install it on my netbook… at 10 o’clock at night. I tried to keep my expectations low because I wasn’t even sure I would get past the initial setup dialog. Happily, the install proceeded quickly through selecting the partition for installation and then copying/expanding the files. However, it soon got bogged down during the later stages of installing and configuring the OS, sometimes spending upwards of 10 to 20 minutes displaying nothing but a blank screen and an intermittent blink of the hard drive light. Trying to be patient, I just let it run and it eventually appeared to install and then rebooted. It was now 1am.</p>  <p>After the reboot, something strange began to happen. All I got was a black screen, no hard drive light and no response to keyboard or mouse input. Figuring I was probably sunk, I did a hard reset and got the same black screen. I tried another hard reset except this time I must not have pressed the power button for long enough because it just put the machine to sleep. I believe that sleep is only supported if the OS has working chipset and video drivers so I was a little puzzled. At the very least it showed that it actually did boot into Windows. So I pressed the power button again to wake it up and was relieved to see a login dialog. </p>  <p>After logging in, I got the usual “personalizing” and “configuring” first-use messages so the system wasn’t usable yet. After about another 10 or 15 minutes, I finally got a fully functional Windows 7 desktop. The thing that initially amazed me was that it had Aero running with transparency enabled and I hadn’t even loaded any drivers yet! And even with the maximum eye candy running it didn’t perform too badly. I really had no expectation that my little Asus was capable of running Aero because I only got Vista Basic when I had previously installed Vista. That said, even though the glass effects in Windows 7 looked really nice there definitely was some lag in performance so I left Aero running and just turned off transparency. That allowed me to still enjoy the benefits of video hardware acceleration without the overhead imposed by the glass effects. So the machine was now fully installed and it was just after 2am.</p>  <p>Unfortunately, it wasn’t all sunshine and light because there were some things that just didn’t want to work. Most of the Asus software and drivers wouldn’t install, throwing up a message that the OS wasn’t supported. However, the most important driver (wireless networking) did install just fine, as did the Bluetooth driver. The only things I’m really missing are the shortcut function keys that control the volume. Other than that, I haven’t found much to complain about. A couple of times IE has temporarily gotten into a non-responsive state but there have been no application crashes or incompatibilities and not a single blue screen thus far. I’ll try to install some more software on it later and see where application compatibility begins to break down. It looks like IIS and .NET are installed so I may even try to do some development on it. Curiously, the .NET Framework version is 3.5.1 as opposed to just 3.5.</p>  <p>So my initial skepticism that netbooks could run Windows 7 has quickly gone away. In fact, it appears that Asus is already <a href="http://hothardware.com/cs/forums/t/40444.aspx" target="_blank">planning</a> to release a Windows 7 based netbook as early as next summer! As for my Windows 7 netbook, it seems to be just as usable as Windows XP Pro was and is much, much nicer to look at. I was just amazed and impressed that the correct Aero-compatible video drivers were installed by default. I’m definitely keeping Windows 7 on this machine permanently and now I can’t wait for the open Beta early next year!</p>  <p><strong>System Specs</strong></p>  <table cellspacing=0 cellpadding=2 width=400 border=1><tbody>     <tr>       <td valign=top width=88>Model</td>        <td valign=top width=312>Asus EEE PC 901</td>     </tr>      <tr>       <td valign=top width=88>CPU</td>        <td valign=top width=312>Intel 1.6GHz Atom</td>     </tr>      <tr>       <td valign=top width=88>RAM</td>        <td valign=top width=312>1GB</td>     </tr>      <tr>       <td valign=top width=88>OS</td>        <td valign=top width=312>Windows 7 32-bit Build 6801</td>     </tr>      <tr>       <td valign=top width=88>Install Size</td>        <td valign=top width=312>~9GB on a 16GB SSD drive</td>     </tr>      <tr>       <td valign=top width=88>Battery Life</td>        <td valign=top width=312>~6 hours (about the same as with XP and Linux)</td>     </tr>   </tbody></table>  <p><strong>Screenshots</strong></p>  <p><img title="Windows 7 on an Asus EEE PC 901" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=496 alt="Windows 7 on an Asus EEE PC 901" src="http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Attachments/12/image_9_175B5606.png" width=482 border=0> </p>  <p><img title="Windows 7 on an Asus EEE PC 901" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=569 alt="Windows 7 on an Asus EEE PC 901" src="http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Attachments/12/image_10_175B5606.png" width=758 border=0> </p>  <p><img title="Windows 7 on an Asus EEE PC 901" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=455 alt="Windows 7 on an Asus EEE PC 901" src="http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Attachments/12/image_11_175B5606.png" width=771 border=0> </p>  <p><img title="Windows 7 on an Asus EEE PC 901" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=460 alt="Windows 7 on an Asus EEE PC 901" src="http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Attachments/12/image_12_175B5606.png" width=781 border=0></p></div>]]></description></item><item><title>Azure Development Lesson #1: Installing and Running the Samples</title><link>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=11</link><pubDate>Tue, 28 Oct 2008 06:33:05 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=11#Comments</comments><dc:creator>kenm</dc:creator><description><![CDATA[<div class=ExternalClass78D3916F9DCB4302A40D8DB9D38B29B2><p>I started going through the Azure SDK and samples last night and got tripped up on a few issues. Here are some of the steps to get started with the basics of Azure development:</p>  <p>1. To get started, you'll need Visual Studio 2008 with SP1 and make sure you also have SQL Server 2005 (or 2008) Express installed with the SQLEXPRESS instance name. The SDK samples require this.</p>  <p>2. Install the Azure SDK from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=BB893FB0-AD04-4FE8-BB04-0C5E4278D3E9&amp;displaylang=en.">http://www.microsoft.com/downloads/details.aspx?FamilyId=BB893FB0-AD04-4FE8-BB04-0C5E4278D3E9&amp;displaylang=en.</a></p>  <p>3. Install the Azure Tools for Visual Studio from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=63D0D248-1B08-4F7D-ABDE-62EB75CB1E69&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyId=63D0D248-1B08-4F7D-ABDE-62EB75CB1E69&amp;displaylang=en</a>. Not required to run the SDK samples but you will need to install it to run the hands on lab.</p>  <p>4. Read this page, <a href="http://msdn.microsoft.com/en-us/library/dd179419.aspx">http://msdn.microsoft.com/en-us/library/dd179419.aspx</a>. The RunDevStore.cmd step is critical because if this fails then nothing else will work. There will be a yellow warning once it gets to the end but you can disregard this. Just make sure there are no red errors.</p>  <p>5. Download, build and run the hands on lab sample from this page, <a href="http://mbrownchicago.spaces.live.com/blog/cns!2221DC39E0C749A4!1040.entry?wa=wsignin1.0">http://mbrownchicago.spaces.live.com/blog/cns!2221DC39E0C749A4!1040.entry?wa=wsignin1.0</a>. It probably will build correctly but throw a runtime error saying that it could not find the Microsoft.ServiceHosting.ServiceRuntime assembly. For some reason this assembly is not installed in the SDK's bin folder but in a ref folder. You can either copy the assembly into the bin folder or add the ref folder into your machine's PATH environment variable.</p>  <p>6. Finally, it probably goes without saying, but run everything with administrative rights.</p>  <p>If all goes well then this is what you should see when you run the hands on lab, with the Development Fabric UI running in the background.</p>  <p><a href="http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Attachments/11/Clipboard07_2_4F9E802F.jpg"><img title=Clipboard07 style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=494 alt=Clipboard07 src="http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Attachments/11/Clipboard07_thumb_4F9E802F.jpg" width=692 border=0></a></p>  <p>In addition to the samples and hands on lab, you can also learn more about Azure development from online videos such as <a href="http://msdn.microsoft.com/en-us/azure/cc994380.aspx" target="_blank">here</a>, <a href="http://channel9.msdn.com/posts/Charles/Steve-Marx-Windows-Azure-for-Developers/" target="_blank">here</a> and <a href="http://channel9.msdn.com/posts/Charles/Manuvir-Das-Introducing-Windows-Azure/" target="_blank">here</a>.</p></div>]]></description></item><item><title>VSM Redux – Silverlight 2 RTW</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=10</link><pubDate>Mon, 27 Oct 2008 11:16:50 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=10#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass27FCC9146B3643AAA0F73124AAC4D289><p>Silverlight's Visual State Manager (VSM) exhibited a couple of problems in Silverlight 2 Beta 2 which I described in my <a href="http://blogs.vertigo.com/personal/bobc/Blog/archive/2008/09/02/VSMShield.aspx">earlier blog post</a>.  To summarize, in SL2 Beta 2:
</p><ol><li>Radio Buttons, Checkboxes, and ListBoxItems ran into problems when trying to animate the same property for Normal, Mouseover, and Checked states.
</li><li>Animating Brushes was buggy, and caused bad behavior.
</li></ol><p>So, now that Silverlight 2 has been completed and the final Release To Web (RTW) version is out, do these problems still exist, or have they been solved?  Let's find out!
</p><p>To start with, I upgraded <a href="http://pagebrooks.com">Page Brooks'</a> excellent <a href="http://pagebrooks.com/demos/ColorAnimationVSM/SilvelightLightBulbMatrixTestPage.html">light bulb demo app</a> to SL 2 RTW.  This app demonstrated problem #2 (brush animation bugs) very succinctly.  I then added in some code to test out radio buttons to determine if they would still lose their states when animating the same property across multiple state groups.  Here's what the test app looks like:
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil1.png" alt=""><br><span style="font-size:16pt;text-decoration:underline">Radio Button Test – Problem #1</span>
	</p><p>To start out, let's take a look at the standard radio button behavior on the bottom radio button:
</p><p><span style="text-decoration:underline">Normal</span>        <span style="text-decoration:underline">Mouse Over</span>    <span style="text-decoration:underline">Checked</span>
	</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil2.png" alt="">        <img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil3.png" alt="">        <img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil4.png" alt=""><br>Notice that the Normal and MouseOver states (which are in the same state group – &quot;Common States&quot;) animate the background highlighting, and the Checked state animates the black dot in the center.  So, the 2 state groups are each modifying a different property, and mousing over a checked RadioButton still animates the background highlighting.  
</p><p>However, many custom controls are built in a way that animates the same property across multiple state groups.  Let's see what happens when we do so.  The two circles on the top are custom radio button styles, but all 3 radio buttons are in the same group.  The custom radio buttons' backgrounds are grey normally.  They should turn yellow on Mouse over, and black on being checked.  So, I'll mouse over the first radio button:<br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil5.png" alt="">
		<br>Now I'll select the first radio button:<br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil6.png" alt=""><br>So far, so good.  However, I'll now mouse over the checked radio button again:<br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil7.png" alt=""><br>The radio button failed to maintain its checked state, instead applying the mouse over state.  When I mouse back out, the checked state does not restore:<br><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil8.png" alt=""><br>So, it seems this problem of animating the same property across multiple VSM state groups still exists in Silverlight 2 RTW.
</p><p><span style="font-size:16pt;text-decoration:underline">Brush Animation Test – Problem #2
</span></p><p>Moving on, let's test out the brush animation bug.  In Silverlight 2 Beta 2, VSM would incorrectly animate changes to the properties (color) of a brush.  Every once in a while, the brush color would fail to change.  In  Page's program, the light bulbs should light up from left to right.  A picture of the bug is below:
</p><p><a href="http://pagebrooks.com/demos/ColorAnimationVSM/SilvelightLightBulbMatrixTestPage.html"><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil9.png" alt="" border=0></a>
	</p><p>So, now, let's try it in the upgraded SL2 RTW version of the code:
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/102708_1816_VSMReduxSil10.png" alt="">
	</p><p>Moving the mouse very quickly back and forth across the light bulbs produced no errant unlit bulbs at all.  It looks like the Brush animation problem has been fixed in the new version of Silverlight!</p></div>]]></description></item><item><title>Walk the Visual Tree</title><link>http://blogs.vertigo.com/personal/jimbg/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Fri, 24 Oct 2008 16:58:00 GMT</pubDate><slash:comments>6</slash:comments><comments>http://blogs.vertigo.com/personal/jimbg/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>jimbg</dc:creator><description><![CDATA[<div class=ExternalClass31B0E8F03324422BB11D8E3EF51B63A2>
<div>
<p>How do you obtain a reference to an ancestor (within the visual tree) of a Silverlight FrameworkElement, given its name?  The question seems pretty straight forward.  FrameworkElement exposes a method, aptly named FindName, which appears to do just that.  Easy solution, right?  Well....maybe.</p>
<p>Using the FindName method works great, as long as the object you're looking for resides within the same XAML namescope as the FrameworkElement.  How do you know if your target object is in the same XAML namescope as your FrameworkElement?  Does the XAML for the FrameworkElement contain the XAML for the target?  If so, then it's in the same namescope.  Should the XAML for the target be nested somewhere along the way (such as within a few levels of UserControls), then you're out of luck.</p>
<p>So what happens if your target isn't in the same XAML namescope as your FrameworkElement?  It's still part of the visual tree, so there should be some way to walk the tree down.  FrameworkElement doesn't appear to expose any members to facilitate this type of action.  Still, there must be a way to do it.</p>
<p>I eventually discovered how to recurse through a visual tree, regardless of the XAML namescope.  The key to doing this lies within the <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.visualtreehelper(VS.95).aspx">VisualTreeHelper</a> class.  I put together a simple class that would wrap the calls to VisualTreeHelper, and handle the object recursion for me. </p>
<p>This was my first implementation:</p>
<blockquote>
<div style="font-size:10pt;background:white;color:black;font-family:Courier New">
<p style="margin:0px"><span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">class</span> <span style="color:#2b91af">VisualTreeWalker</span></p>
<p style="margin:0px">{</p>
<p style="margin:0px">    <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:#2b91af">FrameworkElement</span> FindName(<span style="color:blue">string</span> name, <span style="color:#2b91af">DependencyObject</span> reference)</p>
<p style="margin:0px">    {</p>
<p style="margin:0px">        <span style="color:blue">return</span> FindNameInternal(name, reference);</p>
<p style="margin:0px">    }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">private</span> <span style="color:blue">static</span> <span style="color:#2b91af">FrameworkElement</span> FindNameInternal(<span style="color:blue">string</span> name, <span style="color:#2b91af">DependencyObject</span> reference)</p>
<p style="margin:0px">    {</p>
<p style="margin:0px">        <span style="color:blue">foreach</span> (<span style="color:#2b91af">DependencyObject</span> obj <span style="color:blue">in</span> GetChildren(reference))</p>
<p style="margin:0px">        {</p>
<p style="margin:0px">            <span style="color:#2b91af">FrameworkElement</span> elem = obj <span style="color:blue">as</span> <span style="color:#2b91af">FrameworkElement</span>;</p>
<p style="margin:0px">            <span style="color:blue">if</span> (elem != <span style="color:blue">null</span> &amp;&amp; elem.Name == name)</p>
<p style="margin:0px">            {</p>
<p style="margin:0px">                <span style="color:blue">return</span> elem;</p>
<p style="margin:0px">            }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">            elem = FindNameInternal(name, obj);</p>
<p style="margin:0px">            <span style="color:blue">if</span> (elem != <span style="color:blue">null</span>)</p>
<p style="margin:0px">            {</p>
<p style="margin:0px">                <span style="color:blue">return</span> elem;</p>
<p style="margin:0px">            }</p>
<p style="margin:0px">        }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">        <span style="color:blue">return</span> <span style="color:blue">null</span>;</p>
<p style="margin:0px">    }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">private</span> <span style="color:blue">static</span> <span style="color:#2b91af">IEnumerable</span>&lt;<span style="color:#2b91af">DependencyObject</span>&gt; GetChildren(<span style="color:#2b91af">DependencyObject</span> reference)</p>
<p style="margin:0px">    {</p>
<p style="margin:0px">        <span style="color:blue">int</span> childCount = <span style="color:#2b91af">VisualTreeHelper</span>.GetChildrenCount(reference);</p>
<p style="margin:0px">        <span style="color:blue">for</span> (<span style="color:blue">int</span> i = 0; i &lt; childCount; i++)</p>
<p style="margin:0px">        {</p>
<p style="margin:0px">            <span style="color:blue">yield</span> <span style="color:blue">return</span> <span style="color:#2b91af">VisualTreeHelper</span>.GetChild(reference, i);</p>
<p style="margin:0px">        }</p>
<p style="margin:0px">    }</p>
<p style="margin:0px">}</p></div></blockquote>
<p>Here is an example where we are attempting to find a nested TextBlock named <i>ChildControl</i>:</p>
<blockquote>
<div style="font-size:10pt;background:white;color:black;font-family:Courier New">
<p style="margin:0px"><span style="color:#2b91af">TextBlock</span> test = (<span style="color:#2b91af">TextBlock</span>)<span style="color:#2b91af">VisualTreeWalker</span>.FindName(<span style="color:#a31515">&quot;ChildControl&quot;</span>, <span style="color:blue">this</span>);</p></div></blockquote>
<p>The code performs a top-down search through the visual tree, exhausting each new branch before moving onto the next.  Even though I was pleased with the results, I starting thinking about ways to improve it.  What if I want to look for a specific type, rather than the base FrameworkElement?  It shouldn't be very difficult to add this functionality, and this would be a good excuse to work with Generics on the method level.  I couldn't resist.</p>
<p>This was my next implementation: </p>
<blockquote>
<div style="font-size:10pt;background:white;color:black;font-family:Courier New">
<p style="margin:0px"><span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">class</span> <span style="color:#2b91af">VisualTreeWalker</span></p>
<p style="margin:0px">{</p>
<p style="margin:0px">    <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:#2b91af">FrameworkElement</span> FindName(<span style="color:blue">string</span> name, <span style="color:#2b91af">DependencyObject</span> reference)</p>
<p style="margin:0px">    {</p>
<p style="margin:0px">        <span style="color:blue">return</span> FindName&lt;<span style="color:#2b91af">FrameworkElement</span>&gt;(name, reference);</p>
<p style="margin:0px">    }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">public</span> <span style="color:blue">static</span> T FindName&lt;T&gt;(<span style="color:blue">string</span> name, <span style="color:#2b91af">DependencyObject</span> reference) <span style="color:blue">where</span> T : <span style="color:#2b91af">FrameworkElement</span></p>
<p style="margin:0px">    {</p>
<p style="margin:0px">        <span style="color:blue">if</span> (<span style="color:blue">string</span>.IsNullOrEmpty(name))</p>
<p style="margin:0px">        {</p>
<p style="margin:0px">            <span style="color:blue">throw</span> <span style="color:blue">new</span> <span style="color:#2b91af">ArgumentNullException</span>(<span style="color:#a31515">&quot;name&quot;</span>);</p>
<p style="margin:0px">        }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">        <span style="color:blue">if</span> (reference == <span style="color:blue">null</span>)</p>
<p style="margin:0px">        {</p>
<p style="margin:0px">            <span style="color:blue">throw</span> <span style="color:blue">new</span> <span style="color:#2b91af">ArgumentNullException</span>(<span style="color:#a31515">&quot;reference&quot;</span>);</p>
<p style="margin:0px">        }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">        <span style="color:blue">return</span> FindNameInternal&lt;T&gt;(name, reference);</p>
<p style="margin:0px">    }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">private</span> <span style="color:blue">static</span> T FindNameInternal&lt;T&gt;(<span style="color:blue">string</span> name, <span style="color:#2b91af">DependencyObject</span> reference) <span style="color:blue">where</span> T : <span style="color:#2b91af">FrameworkElement</span></p>
<p style="margin:0px">    {</p>
<p style="margin:0px">        <span style="color:blue">foreach</span> (<span style="color:#2b91af">DependencyObject</span> obj <span style="color:blue">in</span> GetChildren(reference))</p>
<p style="margin:0px">        {</p>
<p style="margin:0px">            T elem = obj <span style="color:blue">as</span> T;</p>
<p style="margin:0px">            <span style="color:blue">if</span> (elem != <span style="color:blue">null</span> &amp;&amp; elem.Name == name)</p>
<p style="margin:0px">            {</p>
<p style="margin:0px">                <span style="color:blue">return</span> elem;</p>
<p style="margin:0px">            }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">            elem = FindNameInternal&lt;T&gt;(name, obj);</p>
<p style="margin:0px">            <span style="color:blue">if</span> (elem != <span style="color:blue">null</span>)</p>
<p style="margin:0px">            {</p>
<p style="margin:0px">                <span style="color:blue">return</span> elem;</p>
<p style="margin:0px">            }</p>
<p style="margin:0px">        }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">        <span style="color:blue">return</span> <span style="color:blue">null</span>;</p>
<p style="margin:0px">    }</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">private</span> <span style="color:blue">static</span> <span style="color:#2b91af">IEnumerable</span>&lt;<span style="color:#2b91af">DependencyObject</span>&gt; GetChildren(<span style="color:#2b91af">DependencyObject</span> reference)</p>
<p style="margin:0px">    {</p>
<p style="margin:0px">        <span style="color:blue">int</span> childCount = <span style="color:#2b91af">VisualTreeHelper</span>.GetChildrenCount(reference);</p>
<p style="margin:0px">        <span style="color:blue">for</span> (<span style="color:blue">int</span> i = 0; i &lt; childCount; i++)</p>
<p style="margin:0px">        {</p>
<p style="margin:0px">            <span style="color:blue">yield</span> <span style="color:blue">return</span> <span style="color:#2b91af">VisualTreeHelper</span>.GetChild(reference, i);</p>
<p style="margin:0px">        }</p>
<p style="margin:0px">    }</p>
<p style="margin:0px">}</p></div></blockquote>
<p>Here is a new example where we are attempting to find a nested TextBlock named <i>ChildControl</i>:</p>
<blockquote>
<div style="font-size:10pt;background:white;color:black;font-family:Courier New">
<p style="margin:0px"><span style="color:#2b91af">TextBlock</span> test = <span style="color:#2b91af">VisualTreeWalker</span>.FindName&lt;<span style="color:#2b91af">TextBlock</span>&gt;(<span style="color:#a31515">&quot;ChildControl&quot;</span>, <span style="color:blue">this</span>);</p></div></blockquote>
<p>Once I was satisfied with this new implementation, I couldn't help but think of ways to improve it even more.  Wouldn't it be cool to have some functionality that would return all instances of a specific type?  Ooh.  How cool would it be to impliment searching off of a name pattern in addition to an exact match?</p>
<p>Well, I'll leave those up to you.  Go ahead and give it a shot.  You're already thinking about how you would write the code, aren't you?</p></div></div>]]></description></item><item><title>Silverlight 2 Birthday Widget, Part II</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=22</link><pubDate>Tue, 14 Oct 2008 11:30:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=22#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[And here she is...just one of several hundred Hard Rock Memorabila widgets to choose from. This one's from Rob Zombie - the most disturbing double-bass you will ever see up close. Enjoy!
<br/><br/>
<object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="600" height="450"><param name="background" value="#141414" /><param name="splashScreenSource" value="http://memorabilia.hardrock.com/Splash.xaml" /><param name="source" value="http://memorabilia.hardrock.com/Widget/HardRock.Memorabilia.Silverlight.Widget.xap" /><param name="enableHtmlAccess" value="true" /><param name="initParams" value="item=050938" /><a href="http://go.microsoft.com/fwlink/?linkid=124807"><img src="http://memorabilia.hardrock.com/Widget/Ping.gif?type=install&item=050938" style="background:#141414 url(http://memorabilia.hardrock.com/Widget/Install/050938.jpg) no-repeat center;margin:0;padding:0;border:0;" width="600" height="450" /></a></object>]]></description></item><item><title>Silverlight 2 Birthday Widget, Part I</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=21</link><pubDate>Tue, 14 Oct 2008 11:30:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=21#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[I’m sure everyone is very busy this morning with the official launch of Silverlight 2 and so are we, but we’re also excited to announce another very special release. The Hard Rock Memorabilia Widget is now live on the latest Silverlight 2 RTM bits at <a href="http://memorabilia.hardrock.com" target="_blank">memorabilia.hardrock.com</a>!
<br/><br/>
This is our biggest release since the initial launch of the memorabilia site at MIX ’08. The Widget lets users take any memorabilia item in the collection “back home” with them to their own sites, blogs, etc. It’s truly a mini-embeddable version of the Hard Rock Memorabilia site – a tiny, 50K XAP file with all the features of the memorabilia site (e.g. Deep Zoom, stories, videos, links, plus custom splash and install screens, full-screen support, and even a few easter eggs).
<br/><br/>
Check it out for yourself by zooming to any item in the collection and grabbing the embed code from the item's Share tray.
<br/><br/>
<img src="http://blogs.vertigo.com/personal/willa/Blog/Lists/Photos/050938.JPG" />]]></description></item><item><title>SharePoint and IE error: “Error in Loading DLL”</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=14</link><pubDate>Tue, 07 Oct 2008 14:47:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=14#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClassDD6BCE7A15064CE5A99A0BC324A8C7EA>
<p>Just recently, I began getting a JavaScript error whenever I browse our company's SharePoint 2003 and 2007-driven sites. This is the error I was receiving: </p>
<p><img alt="Error in loading DLL" src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/100708_2147_SharePointa1.gif"> </p>
<p>No one else in the company seemed to be having the same problem, so I doubt it was caused by a Windows Update. I can think of two possible culprits: </p>
<ul>
<li>I recently uninstalled SilverLight 2 Beta 2 and the Visual Studio tools + Expression products, and installed a SilverLight release candidate. </li>
<li>I recently added Visual Basic to my Visual Studio 2008 Team Suite installation, and re-applied SP1 for VS 2008. </li></ul>
<p>I was also receiving this error on my blog when clicking the link to &quot;Launch blog program to post.&quot; </p>
<p><img alt="This feature requires Microsoft Internet Explorer 6.0 or later and a Windows SharePoint Services-compatible blog editor such as Microsoft Office Word 2007 or later." src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/100708_2147_SharePointa2.gif"> </p>
<p>This message is very strange since I'm browsing with <strong>IE 7</strong>. </p>
<p>It turns out that <strong>the solution to the problem was to repair my Microsoft Office 2007 installation</strong>. I suspect that the installation of one of the <a href="http://blogs.technet.com/josebda/archive/2007/03/26/searching-the-visible-moss-2007-code-for-activex-references.aspx">SharePoint ActiveX components (see Jose Baretto's Blog)</a> had become corrupted somehow. My guess is that Stssync, the component used to synchronize Outlook to SharePoint lists, was the culprit, but this is just a wild guess. </p></div>]]></description></item><item><title>Return of the Mac (How to squash Silverlight bugs on a Mac using Remote Debugging and Fiddler)</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=9</link><pubDate>Fri, 26 Sep 2008 16:52:04 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=9#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass407E61532914495CBCCE3F3FAEC34789><p>Occasionally, differences between the PC and Mac versions of the Silverlight runtime will crop up, and you'll notice that your code works fine on PCs, but has problems on a Mac. If this is the case, you'll need to remotely debug the problem from a PC with Visual Studio, or use Fiddler to scan network traffic. 
</p><p><strong>Remote Debugging </strong>
	</p><p style="margin-left:36pt">1) First, you'll want to install the <a href="http://go.microsoft.com/fwlink/?LinkID=119973">Silverlight Developer runtime for the Mac</a>. This will install a Silverlight Debugging configuration tool – run it. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092608_2351_Returnofthe1.png" alt="">
	</p><p style="margin-left:36pt">2) When you run this tool, it will setup your Mac to allow debugging via a specific port, allow you to specify a Remote Debugging password, and generate a ConfigurePCForSilverlightDebugging.exe file for you to run on your PC. 
</p><p style="margin-left:36pt">3) Copy that .exe file to your PC and run it. 
</p><p style="margin-left:36pt">4) Enter the password you entered on the Mac. 
</p><p style="margin-left:36pt"><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092608_2351_Returnofthe2.png" alt="">
	</p><p style="margin-left:36pt">5) Your PC is now ready to debug remotely! 
</p><p style="margin-left:36pt">6) Now, launch Visual Studio, and select Debug -&gt; Attach to Process. 
</p><p style="margin-left:36pt">7) Select &quot;Silverlight Remote Cross-Platform Debugging&quot; as the Transport. 
</p><p style="margin-left:36pt">8) Enter the network name of the Mac as the qualifier. 
</p><p style="margin-left:36pt">9) Finally, change the &quot;Attach to&quot; option to &quot;Silverlight&quot;. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092608_2351_Returnofthe3.png" alt="">
	</p><p style="margin-left:36pt">10) You now see all the processes running on the Mac, and you can attach to the one you want. 
</p><p style="margin-left:36pt">11) Optionally, you may want to install Remote Desktop for Mac so that you can use the Mac to terminal into your PC, attach the debugger, and then work in the browser from the Mac. This allows you to manage everything you need to do from one location. 
</p><p><strong>Fiddler </strong>
	</p><p>Fiddler runs on the .NET Framework, and is generally only useable on PCs. However, you can route the network traffic from a Mac through a port on a PC in order to run a network trace against a Mac using Fiddler. To do so: 
</p><p style="margin-left:36pt">1) Open up Fiddler on your PC, and go to Tools -&gt; Fiddler Options. 
</p><p style="margin-left:36pt">2) Check the box for &quot;Allow remote computers to connect&quot;. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092608_2351_Returnofthe4.png" alt="">
	</p><p style="margin-left:36pt">3) Next, on the Mac, go to System Preferences -&gt; Network -&gt; Advanced, and click the Proxies tab. 
</p><p style="margin-left:36pt">4) Use a proxy for Web/HTTP, and enter the network name of the PC on which you're running Fiddler. Enter Port 8888. 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/092608_2351_Returnofthe5.jpg" alt="">
	</p><p>Now, when you go to a site on the Mac, the traffic should appear in Fiddler on your PC.</p></div>]]></description></item><item><title>Rebooting the server--sometimes it works!</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=37</link><pubDate>Wed, 24 Sep 2008 15:29:18 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=37#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass2B8F1745DA5A4BBC84AFE906D535B848><p>For the most part I really like Microsoft Windows. But when something doesn't work the way I expect it to, I often reboot the computer. I'd say it fixes the problem something like 10% to 20% of the time, which is relatively infrequently, but it's <strong>so easy </strong>to do that it's often the first thing I try.</p> <p>Recently, we had an issue in a production system where the date format being passed to the database was suddenly different. We had not changed any code, and no updates had been applied to the server for several weeks. Instead of passing the time as &quot;0:00&quot; for midnight, or &quot;12:00 AM&quot;, it was passing the time as &quot;12:00&quot;, which is <strong>noon, rather than midnight</strong>. This caused a variety of failures.</p> <p>We looked into it, and determined that nothing had changed. We could not duplicate the issue with the same code on any other machines--they all worked correctly.</p> <p>This was all a bit stressful, as the application was significantly reduced in functionality due to the issue, and the clock was ticking.</p> <p>After a bit, we decided that we might as well reboot the server. This isn't the first thing I try with a production server because it brings it down, and the 10% to 20% payoff isn't high enough to be the first thing to do.</p> <p>Anyway, we rebooted the server, and it resolved the issue. <strong>It actually worked!</strong></p> <p>A subsequent set of diagnostics on the server revealed no hardware issues with the server. Perhaps an infamous &quot;cosmic ray&quot; flipped a bit in RAM somewhere...</p></div>]]></description></item><item><title>Web browser features I'm missing in Silverlight: copy and paste, search, and font resizing</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=36</link><pubDate>Wed, 24 Sep 2008 15:16:29 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=36#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClassEFBDB378C61A4AFA93A129DBFF3CA887><p>Recently, the team I work with started adding a new Silverlight module to our large web application. </p> <p>There are lots of great reasons to use SIlverlight:</p> <ul> <li>Simpler and faster development compared to ASP.NET AJAX</li> <li>More responsive user interface, and the possibility of a richer user experience</li> <li>Better performance than ASP.NET AJAX with interpreted Javascript</li> <li>Less exposure to differences between browsers</li></ul> <p>However, in the relatively data-centric enterprise web application we're currently working on, we're also starting to notice some of the browser features that we take for granted in an HTML web application that we are missing in Silverlight:</p> <ul> <li><strong>Copy and paste</strong>--users cannot select static text in a Silverlight grid or label and paste it into another application</li> <li><strong>Search within a page</strong>--users cannot search for a customer name or account number in a large table of data displayed on a page</li> <li><strong>Font resizing</strong>--users cannot resize the font in a Silverlight control to make it easier to read</li></ul> <p>All of these can be implemented in Silverlight with custom code, but it ends up being a fair amount of effort, especially the copy and paste across multiple controls, and the searching within a page across all controls.</p> <p>Just to be clear, what I'm talking about here are the features that are built into web browsers, and therefore are available to all HTML web applications. For example, here's a screenshot of searching for the word &quot;android&quot; in the news.com homepage in Microsoft Internet Explorer 7:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/36/Searchinsideawebbrowser_4.png"><img height=587 alt="Searching for the word &quot;android&quot; in news.com's homepage using IE 7" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/36/Searchinsideawebbrowser_thumb_1.png" width=636 border=0></a> </p> <p>In Silverlight, the browser doesn't have direct access to the content in the Silverlight control, so it cannot search it. This can be useful when you have a list of customers as some part of a workflow page (everyone who is late paying their bill, for example), and you want to find a specific customer by name on the page.</p> <p>And here's an example of selecting text across multiple HTML tags from news.com:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/36/Selecttextinbrowser_2.png"><img height=585 alt="Selection of text across multiple HTML tags on news.com homepage in IE 7" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/36/Selecttextinbrowser_thumb.png" width=622 border=0></a> </p> <p>Here's what I get when I copy and paste this selection:</p> <p><a href="http://news.cnet.com/8301-13579_3-10049887-37.html"><font color="#400080">This week in Apple App Store angst</font></a> <p><font color="#400080">1 hour, 25 minutes ago</font> <p><font color="#400080">Developers are still wondering what Apple considers improper iPhone applications, and now might not even be able to compare rejection notes in hopes of figuring that out.</font> <p><font color="#400080">(Posted in </font><a href="http://news.cnet.com/8300-13579_3-37.html"><font color="#400080">Apple</font></a><font color="#400080"> by Tom Krazit) </font> <p><a href="http://news.cnet.com/8301-1009_3-10049925-83.html"><font color="#400080">Firefox update fixes a dozen flaws</font></a> <p><font color="#400080">54 minutes ago</font> <p><font color="#400080">Update spans Firefox 2 and Firefox 3 and will be pushed out to current users to take affect the next time the browser relaunches.</font> <p><font color="#400080">(Posted in </font><a href="http://news.cnet.com/8300-1009_3-83.html"><font color="#400080">Security</font></a><font color="#400080"> by Robert Vamosi)</font> <p>Not a perfect reproduction, but good enough for many situations, and great considering that the news.com developers didn't need to do any development to get it working! This type of copy and paste can be crucial when you want to copy a customer's account number into an email or other document without mistyping it, or when you want to copy a larger amount of table data into Excel for some ad-hoc analysis. <p>The ability to change font sizes is great for accommodating different users--both users who have vision issues (and want a larger font), and for power users with excellent vision who want to fit more data onto their monitors (and want a smaller font). <p>For some web applications these features aren't important--for example, at home I use my bank's web-based bill pay system, and I've never used any of these features while doing that. However, in an enterprise system with lots of customers, accounts, and information, these features often become very useful.</p> <p>Does this mean data-centric enterprise applications should not be implemented in Silverlight? Certainly not! (See some of the advantages listed above!) I just want to point out that there are some subtle things that users will lose, and it's important to be aware of these when choosing the technology, and to be prepared to add them in Silverlight if and where necessary.</p></div>]]></description></item><item><title>Make sure Silverlight application runs on different languages</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=35</link><pubDate>Wed, 24 Sep 2008 12:09:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=35#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassF6B97F3CD42549C8B4BDF30C670CB80F><font face="Helvetica, Arial, sans-serif" size=-1>It's
a good idea to make sure your Silverlight application runs correctly
when running on a system that uses a different language. This is not
localizing an application (changing the user interface), but just
making sure it executes as expected.<br>
<br>
For example,
the following code executes correctly running as <i>English
(United States)</i>.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif" size=-1><font color="#008000">// get data, could be from an XML file or some other data source</font><br>
  <font color="#0000ff">string</font><font color="#000000"> someNumber = </font><font color="#a31515">&quot;1.23&quot;</font><font color="#000000">;</font><br>
  <font color="#0000ff">string</font><font color="#000000"> someDate = </font><font color="#a31515">&quot;2/15/1564&quot;</font><font color="#000000">;</font><br>
  <br>
  <font color="#008000">// convert data, everything is fine
running as English</font><br>
  <font color="#0000ff">double</font><font color="#000000"> number = </font><font color="#0000ff">double</font><font color="#000000">.Parse(someNumber);</font><br>
  <font color="#2b91af">DateTime</font><font color="#000000"> date = </font><font color="#2b91af">DateTime</font><font color="#000000">.Parse(someDate);</font>
  <br>
  </font>
</blockquote>
<font face="Helvetica, Arial, sans-serif" size=-1>But
fails when running as <i>Dutch (Belgium)</i>.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif" size=-1><font color="#008000">// get data, could be from an XML file or some other data source</font><br>
  <font color="#0000ff">string</font><font color="#000000"> someNumber = </font><font color="#a31515">&quot;1.23&quot;</font><font color="#000000">;</font><br>
  <font color="#0000ff">string</font><font color="#000000"> someDate = </font><font color="#a31515">&quot;2/15/1564&quot;</font><font color="#000000">;<br>
  <br>
  </font></font><font color="#008000" face="Helvetica, Arial, sans-serif" size=-1>// not good, returns 123.0
instead of 1.23 when running as Dutch</font><font face="Helvetica, Arial, sans-serif" size=-1><br>
  </font><font color="#0000ff" face="Helvetica, Arial, sans-serif" size=-1>double</font><font color="#000000" face="Helvetica, Arial, sans-serif" size=-1> number = </font><font color="#0000ff" face="Helvetica, Arial, sans-serif" size=-1>double</font><font color="#000000" face="Helvetica, Arial, sans-serif" size=-1>.Parse(someNumber);</font><font face="Helvetica, Arial, sans-serif" size=-1><br>
  <br>
  </font>
  <font color="#008000" face="Helvetica, Arial, sans-serif" size=-1>// not good, throws a FormatException when running as Dutch</font><font face="Helvetica, Arial, sans-serif" size=-1><br>
  </font><font color="#2b91af" face="Helvetica, Arial, sans-serif" size=-1>DateTime</font><font color="#000000" face="Helvetica, Arial, sans-serif" size=-1> date = </font><font color="#2b91af" face="Helvetica, Arial, sans-serif" size=-1>DateTime</font><font color="#000000" face="Helvetica, Arial, sans-serif" size=-1>.Parse(someDate);</font><font face="Helvetica, Arial, sans-serif" size=-1>
  <br>
  </font></blockquote>
<font face="Helvetica, Arial, sans-serif" size=-1>This
can be fixed by specifying the <a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx">culture
specific</a> format when
parsing the string.<br>
</font>
<blockquote><font color="#008000" face="Helvetica, Arial, sans-serif" size=-1></font><font face="Helvetica, Arial, sans-serif" size=-1><font color="#666666">// get data, could be from an XML file or some other data source<br>
  </font><font color="#666666">string</font><font color="#666666"> someNumber = </font><font color="#666666">&quot;1.23&quot;</font><font color="#666666">;<br>
  </font><font color="#666666">string</font><font color="#666666"> someDate = </font><font color="#666666">&quot;2/15/1564&quot;</font><font color="#666666">;<br>
  <br>
  </font></font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1>// good, returns 1.23 when running as Dutch</font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1><br>
  </font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1></font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1>double</font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1> number = </font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1>double</font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1>.Parse(someNumber, </font><font color="#2b91af" face="Helvetica, Arial, sans-serif" size=-1>CultureInfo</font><font color="#000000" face="Helvetica, Arial, sans-serif" size=-1>.InvariantCulture<font color="#666666">);</font></font><font face="Helvetica, Arial, sans-serif" size=-1><br>
  </font><font color="#000000" face="Helvetica, Arial, sans-serif" size=-1></font><font face="Helvetica, Arial, sans-serif" size=-1><br>
  </font><font color="#000000" face="Helvetica, Arial, sans-serif" size=-1></font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1>// good, returns correct date when when running as Dutch</font><font face="Helvetica, Arial, sans-serif" size=-1><br>
  </font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1></font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1>DateTime</font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1> date = </font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1>DateTime</font><font color="#666666" face="Helvetica, Arial, sans-serif" size=-1>.Parse(someDate, </font><font color="#2b91af" face="Helvetica, Arial, sans-serif" size=-1>CultureInfo</font><font color="#000000" face="Helvetica, Arial, sans-serif" size=-1>.InvariantCulture<font color="#666666">);</font></font><font face="Helvetica, Arial, sans-serif" size=-1><font color="#666666">
  </font><br>
  </font></blockquote>
<font face="Helvetica, Arial, sans-serif" size=-1>The
point is not the specific parse calls, but there is a
potential problem anytime you format or parse a string.<br>
<br>
<b>Help catch problems</b><br>
You can use <a href="http://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx">FxCop</a>
or <a href="http://msdn.microsoft.com/en-us/library/y8hcsad3.aspx">Visual
Studio Code Analysis</a> to help find globalization (and other)
problems. <br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif" size=-1><img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/language01.png" height=230 width=340></font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif" size=-1><b>Testing</b><br>
You can use <i>Regional and Language Options</i>
under control panel to help test.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif" size=-1><img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/language02.png" height=464 width=407></font><br>
</blockquote>
<ul>
  <li><font face="Helvetica, Arial, sans-serif" size=-1>Run <b>Regional and Language Options</b>
from control panel.</font></li>
  <li><font face="Helvetica, Arial, sans-serif" size=-1>Select the <b>Formats</b> tab.</font></li>
  <li><font face="Helvetica, Arial, sans-serif" size=-1>Select a language such as <i>Dutch
(Belgium)</i> under <b>current format</b>.</font></li>
  <li><font face="Helvetica, Arial, sans-serif" size=-1>Press <b>Apply</b>.</font></li>
  <li><font face="Helvetica, Arial, sans-serif" size=-1>Run your application and test.</font></li>
</ul>
<font face="Helvetica, Arial, sans-serif" size=-1><br>
</font>

</div>]]></description></item><item><title>Silverlight, handling events for nested controls</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=34</link><pubDate>Tue, 23 Sep 2008 12:51:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=34#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass290CDDFB12A14556B7BBCF610FC1DD49><small><font face="Helvetica, Arial, sans-serif">Silverlight
does not have as much support to handle events from unreferenced child
controls as WPF. For example, say you have the following control
hierarchy and
Page needs to handle events from the Child Controls.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/events01.png" height=263 width=314></font></small><br>
</blockquote>
<small><font face="Helvetica, Arial, sans-serif">This
is easy in WPF since you can use <a href="http://msdn.microsoft.com/en-us/library/ms752308.aspx">commands</a>,
or
<a href="http://msdn.microsoft.com/en-us/library/ms598899.aspx">UIElement.AddHandler</a>.
For example:<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">public</font><font color="#000000"> MainWindow()</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    InitializeComponent();</font></font></small><br>
  <br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// subscribe to events
raised by any child, Child Control is a Button in this example</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#0000ff">this</font><font color="#000000">.AddHandler(</font><font color="#2b91af">Button</font><font color="#000000">.ClickEvent, </font><font color="#0000ff">new</font><font color="#000000"> </font><font color="#2b91af">RoutedEventHandler</font><font color="#000000">(ChildClicked));</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">}</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">        </font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">private</font><font color="#000000"> </font><font color="#0000ff">void</font><font color="#000000"> ChildClicked(</font><font color="#0000ff">object</font><font color="#000000"> sender, </font><font color="#2b91af">RoutedEventArgs</font><font color="#000000"> e)</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// called when event is raised by any child</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">}</font>
  </font></small><br>
</blockquote>
<small><font face="Helvetica, Arial, sans-serif">Or
you can declare the event handler in XAML.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">&lt;</font><font color="#a31515">Window</font><font color="#ff0000"> x</font><font color="#0000ff">:</font><font color="#ff0000">Class</font><font color="#0000ff">=&quot;WpfEvents.MainWindow&quot;</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000"> </font><font color="#ff0000"> xmlns</font><font color="#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000"> </font><font color="#ff0000"> xmlns</font><font color="#0000ff">:</font><font color="#ff0000">x</font><font color="#0000ff">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000"> </font><font color="#ff0000"> xmlns</font><font color="#0000ff">:</font><font color="#ff0000">controls</font><font color="#0000ff">=&quot;clr-namespace:WpfEvents&quot;</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000"> </font><font color="#ff0000"> Title</font><font color="#0000ff">=&quot;WPF Events&quot;</font><font color="#ff0000"> Height</font><font color="#0000ff">=&quot;200&quot;</font><font color="#ff0000"> Width</font><font color="#0000ff">=&quot;200&quot;</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><b><font color="#000000"> </font><font color="#ff0000"> </font></b><font color="#ff0000">Button.Click</font><font color="#0000ff">=&quot;ChildClicked&quot;&gt;</font>
  </font></small><br>
</blockquote>
<small><font face="Helvetica, Arial, sans-serif">Back
to Silverlight, it
does not support commands or UIElement.AddHandler. There are several
options:<br>
<br>
<b>Hookup each event handler</b><br>
You can specify the event handler for each child control but that is
the whole point... we want to handle events
even though we don't have a reference to the individual child controls.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#008000">//
hooking up events requires a reference to each control</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">this</font><font color="#000000">.ChildControl1.Click += </font><font color="#0000ff">new</font><font color="#000000"> </font><font color="#2b91af">RoutedEventHandler</font><font color="#000000">(ChildControl1_Click);</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">this</font><font color="#000000">.ChildControl2.Click += </font><font color="#0000ff">new</font><font color="#000000"> </font><font color="#2b91af">RoutedEventHandler</font><font color="#000000">(ChildControl2_Click);</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">this</font><font color="#000000">.ChildControl3.Click += </font><font color="#0000ff">new</font><font color="#000000"> </font><font color="#2b91af">RoutedEventHandler</font><font color="#000000">(ChildControl3_Click);</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">this</font><font color="#000000">.ChildControl4.Click += </font><font color="#0000ff">new</font><font color="#000000"> </font><font color="#2b91af">RoutedEventHandler</font><font color="#000000">(ChildControl4_Click);</font></font></small><br>
</blockquote>
<small><font face="Helvetica, Arial, sans-serif"><b>Bubble
up
the events</b><br>
You can write code that bubbles up the events (re-raises the events).
This usually becomes undesirable, especially when you have controls
nested at several levels.<br>
<br>
<b>Use global Events class</b><br>
One option is to create a global Events class. <br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/events02.png"></font></small><br>
</blockquote>
<ul>
  <li><small><font face="Helvetica, Arial, sans-serif">There
is only one instance of the Events class in the application. </font></small></li>
  <li><small><font face="Helvetica, Arial, sans-serif">It
contains a list of global events and helper methods to raise the events.</font></small></li>
  <li><small><font face="Helvetica, Arial, sans-serif">Any
object can subscribe to events.</font></small></li>
  <li><small><font face="Helvetica, Arial, sans-serif">Any
object can raise events.</font></small></li>
  <li><small><font face="Helvetica, Arial, sans-serif">That
means the main page can handle events from any child control, children
can handle events from the main page, and siblings can handle events
from each other.</font></small></li>
  <li><small><font face="Helvetica, Arial, sans-serif">A
reference to the control is not required to handle events.<br>
    </font></small></li>
</ul>
<small><font face="Helvetica, Arial, sans-serif">Example
Events class.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">public</font><font color="#000000"> </font><font color="#0000ff">static</font><font color="#000000"> </font><font color="#0000ff">class</font><font color="#000000"> </font><font color="#2b91af">Events</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// example global event that can be handled
by any object in the application</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000"></font></font></small><small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#0000ff">public</font><font color="#000000"> </font><font color="#0000ff">static</font><font color="#000000"> </font><font color="#0000ff">event</font><font color="#000000"> </font><font color="#2b91af">EventHandler</font><font color="#000000"> ChildControlClicked;</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#0000ff">public</font><font color="#000000"> </font><font color="#0000ff">static</font><font color="#000000"> </font><font color="#0000ff">void</font><font color="#000000"> RaiseChildControlClicked(</font><font color="#0000ff">object</font><font color="#000000"> sender, </font><font color="#2b91af">EventArgs</font><font color="#000000"> args)</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    {</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">        </font><font color="#0000ff">if</font><font color="#000000"> (ChildControlClicked != </font><font color="#0000ff">null</font><font color="#000000">)</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">        {</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">            ChildControlClicked(sender,args);</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">        }</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    }</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">}</font>
  </font></small><br>
</blockquote>
<small><font face="Helvetica, Arial, sans-serif">Example
of raising an event.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#008000">// raise global event</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#2b91af">Events</font><font color="#000000">.RaiseChildControlClicked(</font><font color="#0000ff">this</font><font color="#000000">, </font><font color="#2b91af">EventArgs</font><font color="#000000">.Empty);</font></font></small><br>
</blockquote>
<small><font face="Helvetica, Arial, sans-serif">Example
of handling an event.<br>
</font></small>
<blockquote><small><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">public</font><font color="#000000"> Page()</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    InitializeComponent();</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// subscribe to global event</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#008000"></font><font color="#000000">    </font><font color="#2b91af">Events</font><font color="#000000">.ChildControlClicked += </font><font color="#0000ff">new</font><font color="#000000"> System.</font><font color="#2b91af">EventHandler</font><font color="#000000">(Events_ChildControlClicked);</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">}</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000"></font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000"></font><font color="#0000ff">private</font><font color="#000000"> </font><font color="#0000ff">void</font><font color="#000000"> Events_ChildControlClicked(</font><font color="#0000ff">object</font><font color="#000000"> sender, System.</font><font color="#2b91af">EventArgs</font><font color="#000000"> e)</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// called when the event is raised, it could be raised by</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#008000"></font><font color="#000000">    </font><font color="#008000">// any object in the
application, this object does not need</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#008000"></font><font color="#000000">    </font><font color="#008000">// a reference to the object that raised
the event</font></font></small><br>
  <small><font face="Helvetica, Arial, sans-serif"><font color="#008000"></font><font color="#000000">}</font></font></small><br>
</blockquote>
<small><font face="Helvetica, Arial, sans-serif"><font color="#000000"></font>
<br>
</font></small>
</div>]]></description></item><item><title>Styles and templates for built in Silverlight controls</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=33</link><pubDate>Mon, 22 Sep 2008 15:02:00 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=33#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassEB39704923E441BC8B4E7CCA618816C1><font face="Helvetica, Arial, sans-serif">It can be useful
to look at styles and templates for built in Silverlight controls;
learn how controls work, figure out why something is not working as
expected, or copy styles and templates into your own project. Here are
several ways to look at the styles and templates for Silverlight
controls.<br>
<br>
<b>Check the documentation</b><br>
Microsoft documents the styles and templates for Silverlight controls.
Currently, this is available at <a href="http://msdn.microsoft.com/en-us/library/cc278075(vs.95).aspx">http://msdn.microsoft.com/en-us/library/cc278075(vs.95).aspx</a>,
but could change in the future.<br>
<br>
<b>Use Blend</b><br>
Select a control and then </font><font face="Helvetica, Arial, sans-serif"><b>Edit a Copy </b>from
the</font><font face="Helvetica, Arial, sans-serif">
<b>Edit Control Parts (Template)</b> menu. You can see the
style resource in the XAML file.<br>
<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/control-template01.png"></font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><br>
<b>Look directly in the assembly</b><br>
The styles and templates can be extracted from the
assembly since they are a resource in the assembly.<br>
</font>
<ul>
  <li><font face="Helvetica, Arial, sans-serif">Use <strike>Lutz
Roeder's</strike> Red Gate's <a href="http://www.red-gate.com/products/reflector/">.NET
Reflector</a> to open the assembly that contains the Silverlight
controls. This is %PROGRAMFILES% \Microsoft
SDKs\Silverlight\v2.0\Reference Assemblies\System.Windows.dll for now,
but can change in the future. </font></li>
</ul>
<ul>
  <li><font face="Helvetica, Arial, sans-serif">Open
    <b>System.Windows.g.resources</b> under <b>Resources</b>.</font></li>
</ul>
<ul>
  <li><font face="Helvetica, Arial, sans-serif">Save
    <b>themes/generic.xaml</b> to a local file.</font><br>
  </li>
</ul>
<blockquote><font face="Helvetica, Arial, sans-serif"><img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/control-template02.png"></font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif"><br>
</font>
</div>]]></description></item><item><title>Email notifications when check into Team System</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=32</link><pubDate>Thu, 18 Sep 2008 19:26:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=32#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassBB1A087C11C14A628288A05B3EC34F63><font face="Helvetica, Arial, sans-serif">Some might find
it useful to create project alerts in Team System. You can do this by:<br>
<br>
1) Select <b>Team </b>/ <b>Project Alerts</b>.<br>
<br>
   <img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/project-alert01.png" height=239 width=257><br>
<br>
2) Enter email for the desired alerts. For example, get notified
when something is checked in.<br>
<br>
  <img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/project-alert02.png"><br>
<br>
3) It might be a good idea to create a rule in your email program to
move notifications into a project folder.<br>
</font>
</div>]]></description></item><item><title>Open New Safari Window in Silverlight</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=26</link><pubDate>Wed, 10 Sep 2008 15:27:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=26#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass81379D486A7B45998C396C9AFAD69FA0>
<p>I suggest following the directions found <a href="http://blogs.windowsclient.net/tamirk/archive/2008/05/26/quick-silverlight-tip-how-to-open-new-window-or-tab-by-using-hyperlinkbutton-and-ctrl-shift-modifiers.aspx">here</a> but if you need a different solution try the following instead.</p>
<p>Add this method to your Silverlight in a convenient place, such as your application class.</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Consolas,Lucida Console,Monospace"><span style="color:#0000ff">public</span> <span style="color:#0000ff">static</span> <span style="color:#0000ff">void</span> OpenBrowser(<span style="color:#0000ff">string</span> url)<br>{<br><span style="margin-left:30pt"></span><span style="color:#0000ff">if</span>(<span style="color:#2b91af">HtmlPage</span>.BrowserInformation.UserAgent.Contains(<span style="color:#ff00ff">&quot;Safari&quot;</span>))<br><span style="margin-left:30pt"></span>{<br><span style="margin-left:60pt"></span><span style="color:#2b91af">HtmlElement</span> anchor= <span style="color:#2b91af">HtmlPage</span>.Document.GetElementById(<span style="color:#ff00ff">&quot;externalAnchor&quot;</span>);<br><span style="margin-left:60pt"></span>anchor.SetProperty(<span style="color:#ff00ff">&quot;href&quot;</span>, url);<br><span style="margin-left:60pt"></span><span style="color:#2b91af">HtmlElement</span> button= <span style="color:#2b91af">HtmlPage</span>.Document.GetElementById(<span style="color:#ff00ff">&quot;externalButton&quot;</span>);<br><span style="margin-left:60pt"></span>button.Invoke(<span style="color:#ff00ff">&quot;click&quot;</span>, <span style="color:#0000ff">null</span>);<br><span style="margin-left:30pt"></span>}<br><span style="margin-left:30pt"></span><span style="color:#0000ff">else<br><span style="margin-left:60pt"></span></span><span style="color:#2b91af">HtmlPage</span>.Window.Navigate(<span style="color:#0000ff">new</span> <span style="color:#2b91af">Uri</span>(url, <span style="color:#2b91af">UriKind</span>.RelativeOrAbsolute), <span style="color:#ff00ff">&quot;_blank&quot;</span>);<br>}<br></blockquote>
<p>Then, add this code anywhere in the HTML.</p>
<blockquote dir=ltr style="margin-right:0px;font-family:Consolas,Consolas,Lucida Console,Monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">a</span><span> </span><span style="color:#ff0000">id</span><span style="color:#0000ff">=&quot;externalAnchor&quot;</span><span> </span><span style="color:#ff0000">style</span><span style="color:#0000ff">=&quot;</span><span style="color:#ff0000">display</span><span>:</span><span style="color:#0000ff">none</span><span>;</span><span style="color:#0000ff">&quot;&gt;&lt;/</span><span style="color:#a31515">a</span><span style="color:#0000ff">&gt;</span><br><span style="color:#0000ff">&lt;</span><span style="color:#a31515">input</span><span> </span><span style="color:#ff0000">id</span><span style="color:#0000ff">=&quot;externalButton&quot;</span><span> </span><span style="color:#ff0000">type</span><span style="color:#0000ff">=&quot;button&quot;</span><span> </span><span style="color:#ff0000">onclick</span><span style="color:#0000ff">=&quot;window.open(document.getElementById('externalAnchor').href)&quot;</span><span> </span><span style="color:#ff0000">style</span><span style="color:#0000ff">=&quot;</span><span style="color:#ff0000">display</span><span>:</span><span style="color:#0000ff">none</span><span>;</span><span style="color:#0000ff">&quot;</span><span> </span><span style="color:#0000ff">/&gt;</span></blockquote></div>]]></description></item><item><title>The Scroll Button Dilemma</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=7</link><pubDate>Thu, 04 Sep 2008 14:12:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=7#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass7D1E1A52BF3B454999305968E1122F11>
<p><img alt="" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/090308_1912_Silverlight1.jpg" align=left>To quote StrongBad, &quot;<a href="http://www.hrwiki.org/index.php/Scroll_Button_Songs">Scroll buttons never looked so good! Scrollin' up and down like you knew they would...</a>&quot; </p>
<p>Or, perhaps not.  We recently encountered a problem when trying to implement scroll buttons in Silverlight 2 Beta 2 that would:  </p>
<p>1) Smoothly scoll up and down when being held down.<br>2) Use VSM (Visual State Manager) for MouseOver and Pressed animations.  </p>
<p>Here's how we solved the problem and created scroll buttons truly worthy of some StrongBad adulation: </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/090308_2345_TheScrollBu1.png"> </p>
<p>The problem is that instances of Button controls will never raise MouseLeftButtonUp and MouseLeftButtonDown events.   In other words, Button instances only support handling the Click event directly, not the Mouse Up/Down events.  We didn't want our users to have to repeatedly click in order to scroll - we wanted the scroll button to just smoothly scroll as long as the mouse button was held down.</p>
<p><a href="http://silverlight.net/forums/t/17446.aspx">This Silverlight.NET forum discussion</a> features an excerpt from a help document that describes the behavior:  <span style="color:black">  </span></p>
<p>&quot;Certain control classes (for example Button) provide control-specific handling for mouse events such as MouseLeftButtonDown. The control-specific handling typically involves handling the event at a class level rather than at the instance level, and marking the MouseLeftButtonDown event data's Handled value as true such that the event cannot be handled by instances of the control class, nor by other elements (at a class or instance level) anywhere further along the event route. In the case of Button, the class design does this so that the event Click can be raised instead.&quot; </p>
<p>So, Buttons will swallow the MouseLeftButtonDown/Up events by setting Handled to &quot;true&quot;.   </p>
<p>Our first thought was to just use an element (other than Button) which doesn't exhibit this behavior.  However, using VSM requires using an element that has a customizable control template (derives from the Control class), and it seems as if all the controls that can be used by VSM exhibit the same event swallowing behavior as Buttons.    </p>
<p>So, our solution was to build a custom &quot;ScrollButton&quot; class which inherits from Button.  The ScrollButton class overrides the OnMouseLeftButtonDown and OnMouseLeftButtonUp handlers, and resets Handled back to &quot;false&quot; after executing the base method.  This fairly simple change causes the events to fire properly, allowing our scroll buttons to actually scroll when held down.  The code is below: </p>
<p><span style="font-size:10pt"><span style="color:blue">public</span> <span style="color:blue">partial</span> <span style="color:blue">class</span> <span style="color:#2b91af">ScrollButton</span> : <span style="color:#2b91af">Button<br></span>{<br>     <span style="color:blue">public</span> ScrollButton()<br>     {<br>          <span style="color:blue">this</span>.MouseLeftButtonDown += <span style="color:blue">new</span> <span style="color:#2b91af">MouseButtonEventHandler</span>(ScrollButton_MouseLeftButtonDown);<br>          <span style="color:blue">this</span>.MouseLeftButtonUp += <span style="color:blue">new</span> <span style="color:#2b91af">MouseButtonEventHandler</span>(ScrollButton_MouseLeftButtonUp);<br>     }<br><br>     <span style="color:blue">void</span> ScrollButton_MouseLeftButtonDown(<span style="color:blue">object</span> sender, <span style="color:#2b91af">MouseButtonEventArgs</span> e)<br>     {<br>          <span style="color:blue">this</span>.Content = <span style="color:purple">&quot;mouse down&quot;</span>;<br>     }<br><br><span style="color:blue">     void</span> ScrollButton_MouseLeftButtonUp(<span style="color:blue">object</span> sender, <span style="color:#2b91af">MouseButtonEventArgs</span> e)<br>     {<br>          <span style="color:blue">this</span>.Content = <span style="color:purple">&quot;mouse up&quot;</span>;<br>     }<br><span style="color:black"><br>     </span><span style="color:blue">protected</span> <span style="color:blue">override</span> <span style="color:blue">void</span> OnMouseLeftButtonDown(<span style="color:#2b91af">MouseButtonEventArgs</span> e)<br>     {<br>          <span style="color:blue">base</span>.OnMouseLeftButtonDown(e);<br>          e.Handled = <span style="color:blue">false</span>;<br>     }<br><span style="color:black"><br></span><span style="color:blue">     protected</span> <span style="color:blue">override</span> <span style="color:blue">void</span> OnMouseLeftButtonUp(<span style="color:#2b91af">MouseButtonEventArgs</span> e)<br>     {<br>          <span style="color:blue">base</span>.OnMouseLeftButtonUp(e);<br>          e.Handled = <span style="color:blue">false</span>;<br>     } </span></p>
<p><span style="font-size:10pt">}</span></p></div>]]></description></item><item><title>Don't Fence Me In (I’m just a TextBox)</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=8</link><pubDate>Thu, 04 Sep 2008 08:47:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=8#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClassBA27508CEE8C43279C9FF4D92BBABB55>
<p>In Silverlight 2 Beta 2, setting BorderThickness=&quot;0&quot; or BorderBrush=&quot;Transparent&quot; on a TextBox fails to hide the border around the TextBox.  I couldn't get a TextBox I was building to lose its border: </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/090308_2110_DontFenceMe1.png"> </p>
<p>This seemed like a bug to me, but a Silverlight Program Manager explained it <a href="http://silverlight.net/forums/t/17558.aspx">this way in a Silverlight.net thread</a>:  </p>
<p>&quot;<span style="font-size:10pt">The new visual style for TextBox uses gradients inside a Grid. This default style ignores the border thickness and border brush.</span>&quot;  </p>
<p>Since this behavior seems to be intentional, a template needs to be used to hide the border.  A poster in the thread above suggests using a ScrollViewer in lieu of the TextBox, and it seemed to work for us: </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/090308_2110_DontFenceMe2.png"> </p>
<p>See below for a quick example of how to implement this.  </p>
<p><span style="text-decoration:underline">Abridged XAML for TextBox:</span>  </p>
<p>&lt;<span style="font-size:10pt"><span style="color:#a31515">TextBox </span><span style="color:red">Style</span><span style="color:blue">=&quot;{</span><span style="color:#a31515">StaticResource</span><span style="color:red"> TextBoxNoBorder</span><span style="color:blue">}&quot;</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;TextSiteURL&quot; /&gt;</span></span>  </p>
<p><span style="text-decoration:underline">Template for the TextBoxNoBorder style:</span><span style="font-size:10pt;color:blue"> </span></p>
<p><span style="font-size:10pt"><span style="color:blue">&lt;</span><span style="color:#a31515">Style</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Key</span><span style="color:blue">=&quot;TextBoxNoBorder&quot;</span><span style="color:red"> TargetType</span><span style="color:blue">=&quot;TextBox&quot;&gt;<br>     &lt;</span><span style="color:#a31515">Setter</span><span style="color:red"> Property</span><span style="color:blue">=&quot;Template&quot;&gt;<br>          &lt;</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;<br>               &lt;</span><span style="color:#a31515">ControlTemplate</span><span style="color:red"> TargetType</span><span style="color:blue">=&quot;TextBox&quot;&gt;<br>                    &lt;</span><span style="color:#a31515">Grid</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;RootElement&quot;&gt;<br>                         &lt;</span><span style="color:#a31515">ScrollViewer</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;ContentElement&quot;</span><span style="color:red"> BorderThickness</span><span style="color:blue">=&quot;0&quot; /&gt;<br>                    &lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt;<br>               &lt;/</span><span style="color:#a31515">ControlTemplate</span><span style="color:blue">&gt;<br>          &lt;/</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;<br>     &lt;/</span><span style="color:#a31515">Setter</span><span style="color:blue">&gt;<br>&lt;/</span><span style="color:#a31515">Style</span><span style="color:blue">&gt;</span></span></p></div>]]></description></item><item><title>Silverlight/WPF: Returning Image Data from a Converter</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Wed, 03 Sep 2008 10:55:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass97D90B69C5F4467A92650A3B3C01136F>
<div>Recently, when working with a class that implemented IValueConverter, I encountered some behavior I found unintuitive when returning an image URI value from the Convert() method.  My Convert() method was returning a URI string as the Source value for an Image XAML element.  This worked on the initial load, but never on reloading the DataContext.  I found that in order for the image to change when the DataContext changes, the Converter must return a new BitmapImage as the Source value for the Image XAML element. </div>
<div> </div>
<div>For an introduction to IValueConverter, check out <a href="http://blogs.msdn.com/bencon/archive/2006/05/10/594886.aspx">this blog post</a>.</div>
<div> </div>
<div>My Converter was set up to examine the DataContext of the parent control, and return a specific image depending on settings in the DataContext.  The XAML for the image looks like this:</div>
<div> </div>
<div><font size=2><font color="#0000ff"><font color="#0000ff">&lt;</font></font><font color="#a31515"><font color="#a31515">Image</font></font><font color="#ff0000"><font color="#ff0000"> x</font></font><font color="#0000ff"><font color="#0000ff">:</font></font><font color="#ff0000"><font color="#ff0000">Name</font></font><font color="#0000ff"><font color="#0000ff">=&quot;frontImage&quot;</font></font><font color="#ff0000"><font color="#ff0000"> Source</font></font><font color="#0000ff"><font color="#0000ff">=&quot;{</font></font><font color="#a31515"><font color="#a31515">Binding</font></font> <font color="#ff0000"><font color="#ff0000">Converter</font></font><font color="#0000ff"><font color="#0000ff">={</font></font><font color="#a31515"><font color="#a31515">StaticResource</font></font><font color="#ff0000"><font color="#ff0000"> ThumbnailImageConverter</font></font><font color="#0000ff"><font color="#0000ff">}}&quot;</font></font><font color="#ff0000"><font color="#ff0000"> </font></font></font><font color="#0000ff"><font color="#0000ff"><font size=2>/&gt;</font></div>
<div></font></font> </div>
<div>The abridged code for the original converter class appears below:</div>
<div> </div>
<div><font size=2><font color="#0000ff"><font color="#0000ff">public</font></font> <font color="#0000ff"><font color="#0000ff">class</font></font> <font color="#2b91af"><font color="#2b91af">ThumbnailImageConverter</font></font> : </font><font size=2><font color="#2b91af"><font color="#2b91af">IValueConverter<br></font></font>{<br><font color="#0000ff"><font color="#0000ff">     #region</font></font> IValueConverter Members<br><br>     <font color="#0000ff"><font color="#0000ff">public</font></font> <font color="#0000ff"><font color="#0000ff">object</font></font> Convert(<font color="#0000ff"><font color="#0000ff">object</font></font> value, <font color="#2b91af"><font color="#2b91af">Type</font></font> targetType, <font color="#0000ff"><font color="#0000ff">object</font></font> parameter, System.Globalization.<font color="#2b91af"><font color="#2b91af">CultureInfo</font></font> culture)<br>     {<br>     <font color="#0000ff"><font color="#0000ff">if</font></font> (value <font color="#0000ff"><font color="#0000ff">is</font></font> <font color="#2b91af"><font color="#2b91af">Show</font></font>)<br>     {<br>          <font color="#2b91af"><font color="#2b91af">Show</font></font> show = (<font color="#2b91af"><font color="#2b91af">Show</font></font>)value;<br>          <font color="#0000ff"><font color="#0000ff">if</font></font> ((show == <font color="#0000ff"><font color="#0000ff">null</font></font>) || (!show.CanPlay))<br>          {<br>               </font><font size=2><font color="#008000"><font color="#008000">//No video<br>               </font></font><font color="#0000ff"><font color="#0000ff">return</font></font> <font color="#800080"><font color="#800080">&quot;/Images/NoVideo.png&quot;</font></font>;<br>           }<br>          </font><font size=2><font color="#0000ff"><font color="#0000ff">else<br>          </font></font>{<br>               </font><font size=2><font color="#008000"><font color="#008000">//Video available<br>               </font></font><font color="#0000ff"><font color="#0000ff">return</font></font> <font color="#800080"><font color="#800080">&quot;/Images/VideoAvailable.png&quot;</font></font>;<br>          }<br>     }<br>     }</font></div>
<div>
<p><font size=2><font color="#0000ff"><font color="#0000ff">     public</font></font> <font color="#0000ff"><font color="#0000ff">object</font></font> ConvertBack(<font color="#0000ff"><font color="#0000ff">object</font></font> value, <font color="#2b91af"><font color="#2b91af">Type</font></font> targetType, <font color="#0000ff"><font color="#0000ff">object</font></font> parameter, System.Globalization.<font color="#2b91af"><font color="#2b91af">CultureInfo</font></font> culture)<br>     {<br><font color="#0000ff"><font color="#0000ff">           throw</font></font> <font color="#0000ff"><font color="#0000ff">new</font></font> <font color="#2b91af"><font color="#2b91af">NotImplementedException</font></font>();<br>     }<br></font><font size=2><font color="#0000ff"><font color="#0000ff">     #endregion<br></font></font>}</font></p></div>
<div>However, I found that when the DataContext for the Image's parent control changed, the image would never change over to the correct value.  The change only seems to get picked up when the Converter returns a new Bitmap, as shown below:<font size=2> </font></div>
<div>
<div><font size=1><font color="#2b91af"><font color="#2b91af"><br></font></font></font><font size=2><font color="#0000ff"><font color="#0000ff">if</font></font> ((show == <font color="#0000ff"><font color="#0000ff">null</font></font>) || (!show.CanPlay))<br>{<br><font color="#008000"><font color="#008000">     //No video </font></font></font></div>
<div><font color="#0000ff"><font color="#0000ff"><font size=2><font color="#0000ff"><font color="#0000ff">     return</font></font><font color="#000000"> </font><font color="#0000ff"><font color="#0000ff">new</font></font><font color="#000000"> </font><font color="#2b91af"><font color="#2b91af">BitmapImage</font></font><font color="#000000">(</font><font color="#0000ff"><font color="#0000ff">new</font></font><font color="#000000"> </font><font color="#2b91af"><font color="#2b91af">Uri</font></font><font color="#000000">(</font><font color="#800080"><font color="#800080">&quot;/Images/NoVideo.png&quot;</font></font><font color="#000000">, </font><font color="#2b91af"><font color="#2b91af">UriKind</font></font></font><font color="#000000" size=2>.Relative));<br></font></font></font><font size=2>     }<br></font><font size=2><font color="#0000ff"><font color="#0000ff">else<br></font></font>{<br><font color="#008000"><font color="#008000">     //Video Available</font></font></font></div>
<div><font size=2><font color="#0000ff"><font color="#0000ff"><font color="#0000ff"><font color="#0000ff">     return</font></font><font color="#000000"> </font><font color="#0000ff"><font color="#0000ff">new</font></font><font color="#000000"> </font><font color="#2b91af"><font color="#2b91af">BitmapImage</font></font><font color="#000000">(</font><font color="#0000ff"><font color="#0000ff">new</font></font><font color="#000000"> </font><font color="#2b91af"><font color="#2b91af">Uri</font></font><font color="#000000">(</font><font color="#800080"><font color="#800080">&quot;/Images/VideoAvailable.png&quot;</font></font><font color="#000000">, </font><font color="#2b91af"><font color="#2b91af">UriKind</font></font><font color="#000000">.Relative));</font></font></font>          <br>}</font></div></div></div>]]></description></item><item><title>“Shield” Yourself from Animation Problems in Silverlight Visual State Manager</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=5</link><pubDate>Tue, 02 Sep 2008 16:12:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=5#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass4F3A9A2862CA409CA3BAEBECB3E193ED>
<p>While working on Vertigo's <a href="http://www.vertigo.com/dnc.aspx">high definition video player for the Democratic National Convention</a>, our team encountered some challenges with Silverlight 2 Beta 2's Visual State Manager. In this post, I'll discuss how we overcame these challenges, and our solution to make working with VSM simple, quick, and easy. For an introduction to Visual State Manager, check out Scott Guthrie's Silverlight 2 Beta 2 intro <a href="http://weblogs.asp.net/scottgu/archive/2008/06/06/silverlight-2-beta2-released.aspx">here</a>. </p>
<p><span style="font-size:14pt"><strong><font size=4>Problem #1: Radio Button and ListBoxItem Selection States</font></strong> </span></p>
<p>Radio buttons and ListBoxItems both have a &quot;selected&quot; state. The XAML for the VisualStateGroups for a ListBoxItem look like this (the same states are used for Radio buttons): </p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">&lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateManager.VisualStateGroups</span><span style="color:blue">&gt;<br>     &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateGroup</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;CommonStates&quot;&gt;<br>          &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;Normal&quot; /&gt;<br>          &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;MouseOver&quot;&gt;<br>               &lt;</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;<br>                    </span><span style="color:green">&lt;!-- Animate the MouseOver --&gt;<br>               </span><span style="color:blue">&lt;/</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;<br>          &lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:blue">&gt;<br>     &lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateGroup</span><span style="color:blue">&gt;<br>     &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateGroup </span><span style="color:red">x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;SelectionStates&quot;&gt;<br>          &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;Selected&quot;&gt;<br>             &lt;</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;<br></span><span style="color:green">                    &lt;!-- Animate the Selection --&gt;<br>             </span><span style="color:blue">&lt;/</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;<br>          &lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:blue">&gt;<br>        &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;Unselected&quot;/&gt;<br>     &lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateGroup</span><span style="color:blue">&gt;<br>&lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateManager.VisualStateGroups</span><span style="color:blue">&gt; </span></span></p>
<p>Notice that there are 2 VisualStateGroups – one for &quot;CommonStates&quot;, and one for &quot;SelectionStates&quot;. Keep in mind that a control must be in one state from each VisualStateGroup at all times. This means that when a ListBoxItem or RadioButton is in the &quot;Selected&quot; state, it must also be in either the Normal/default state or in the MouseOver state: </p>
<p><span style="text-decoration:underline">Possible States<br></span>Normal &amp; Unselected<br>MouseOver &amp; Unselected<br>Normal &amp; Selected<br>MouseOver &amp; Selected </p>
<p>This becomes a problem when you need to define a 3-state setup for your buttons, when the same property has different values in all 3 states. If the &quot;Selected&quot; Visual State modifies a property that is also modified by the &quot;MouseOver&quot; Visual State, a conflict occurs. </p>
<p>For example, let's say we want to modify the text color on a ListBox Item or button. When you select the button, it will appear in the &quot;selected&quot; state: </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/090208_2055_ShieldYours1.png"> </p>
<p>However, when you mouse out of the button's area, the button will return to the &quot;normal&quot; state, even though the button is also in the &quot;selected&quot; state. Since the button is both &quot;selected&quot; and &quot;normal&quot;, and both those states modify the text color, the last state to transition &quot;wins&quot;.  Your selected button will show both states, with the normal state on top, making the text appear thin and unreadable:</p>
<p><img alt="" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/090208_2055_ShieldYours2.png"> </p>
<p><span><font size=2>Note that the same problem exists for CheckBoxes, which have a &quot;CheckStates&quot; VisualStateGroup.</font></span></p>
<p><span><font size=4><strong>Problem #2: Animating Brushes</strong> </font></span></p>
<p>We noticed that when using a ColorAnimation within VSM to change the color of a brush, strange behavior occurs. Either the animation does not occur, or it occurs on an adjacent control. This only happens on 1 out of every 10 transitions - a representative from Microsoft acknowledges the problem in <a href="http://silverlight.net/forums/t/18263.aspx">this Silverlight forum discussion</a>. </p>
<p>To see it for yourself, take a look at <a href="http://pagebrooks.com/demos/ColorAnimationVSM/SilvelightLightBulbMatrixTestPage.html">this sample application</a> built by Page Brooks to illustrate the problem.  Mouse over the dots back and forth - you'll notice states getting stuck. The <a href="http://pagebrooks.com/files/source/silverlight/coloranimationvsm.zip">source code</a> is also available. </p>
<p><a href="http://pagebrooks.com/demos/ColorAnimationVSM/SilvelightLightBulbMatrixTestPage.html"><img alt="" src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/090208_2055_ShieldYours3.png"></a> </p>
<p><span><font size=4><strong>Our Solution to Both Problems: Opacity-Only Animations and the &quot;Selected Shield&quot;</strong> </font></span></p>
<p>To circumvent these problems, we only ever animate <strong>opacity</strong>. We build a unique element (Grid, Canvas, whatever) for each Visual State, all having an opacity set to 0 other than the element for the &quot;Normal&quot; state. We then simply animate using a DoubleAnimation, changing the opacity on each element. </p>
<p>If our elements include only opaque items, such as images, this would be enough. However, if our elements contain transparent items, we still have a problem. Our selected state will be set to an opacity of 1 along with the MouseOver state, so both will appear to bleed into each other. To solve this, we also include an opaque &quot;Shield&quot; element in the selected state. We set the Z-orders of these elements so that the selected element appears on top of the shield, and the shield element appears on top of the MouseOver and Normal elements. See below for an example of this setup in the XAML. </p>
<p>Of course, having to make multiple copies of the exact same XAML elements is not optimal, and ends up requiring more lines of code. However, it is the only way we have found to totally squash both of these problems. </p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">&lt;</span><span style="color:#a31515">ControlTemplate</span><span style="color:red"> TargetType</span><span style="color:blue">=&quot;ListBoxItem&quot;&gt;</span><span style="color:purple"><br></span><span style="color:blue">     &lt;</span><span style="color:#a31515">Grid</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;LBGrid&quot;</span><span style="color:red"> Background</span><span style="color:blue">=&quot;Transparent&quot;</span><span style="color:red"> Cursor</span><span style="color:blue">=&quot;Hand&quot;&gt;<br><br>         &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateManager.VisualStateGroups</span><span style="color:blue">&gt;<br>               &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateGroup</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;CommonStates&quot;&gt;<br>                    &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;Normal&quot; /&gt;<br>                    &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;MouseOver&quot;&gt;<br>                         &lt;</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;<br>                              &lt;</span><span style="color:#a31515">DoubleAnimation</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;canvasNormal&quot;</span><span style="color:red"> Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Opacity)&quot;</span><span style="color:red"> Duration</span><span style="color:blue">=&quot;00:00:00.001&quot;</span><span style="color:red"> To</span><span style="color:blue">=&quot;0&quot;/&gt;<br>                              &lt;</span><span style="color:#a31515">DoubleAnimation</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;canvasMouseOver&quot;</span><span style="color:red"> Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Opacity)&quot;</span><span style="color:red"> Duration</span><span style="color:blue">=&quot;00:00:00.001&quot;</span><span style="color:red"> To</span><span style="color:blue">=&quot;1&quot;/&gt;<br>                         &lt;/</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;<br>                    &lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:blue">&gt;<br>               &lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateGroup</span><span style="color:blue">&gt;<br>               &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateGroup</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;SelectionStates&quot;&gt;<br>                    &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;Selected&quot;&gt;<br>                         &lt;</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;<br>                              &lt;</span><span style="color:#a31515">DoubleAnimation</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;canvasNormal&quot;</span><span style="color:red"> Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Opacity)&quot;</span><span style="color:red"> Duration</span><span style="color:blue">=&quot;00:00:00.001&quot;</span><span style="color:red"> To</span><span style="color:blue">=&quot;0&quot;/&gt;<br>                              &lt;</span><span style="color:#a31515">DoubleAnimation</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;canvasMouseOver&quot;</span><span style="color:red"> Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Opacity)&quot;</span><span style="color:red"> Duration</span><span style="color:blue">=&quot;00:00:00.001&quot;</span><span style="color:red"> To</span><span style="color:blue">=&quot;0&quot;/&gt;<br>                              &lt;</span><span style="color:#a31515">DoubleAnimation</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;canvasSelectedShield&quot;</span><span style="color:red"> Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Opacity)&quot;</span><span style="color:red"> Duration</span><span style="color:blue">=&quot;00:00:00.001&quot;</span><span style="color:red"> To</span><span style="color:blue">=&quot;1&quot;/&gt;<br>                              &lt;</span><span style="color:#a31515">DoubleAnimation</span><span style="color:red"> Storyboard.TargetName</span><span style="color:blue">=&quot;canvasSelected&quot;</span><span style="color:red"> Storyboard.TargetProperty</span><span style="color:blue">=&quot;(UIElement.Opacity)&quot;</span><span style="color:red"> Duration</span><span style="color:blue">=&quot;00:00:00.001&quot;</span><span style="color:red"> To</span><span style="color:blue">=&quot;1&quot;/&gt;<br>                         &lt;/</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt;<br>                    &lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:blue">&gt;<br>               &lt;</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualState</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;Unselected&quot;/&gt;<br>          &lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateGroup</span><span style="color:blue">&gt;<br>     &lt;/</span><span style="color:#a31515">vsm</span><span style="color:blue">:</span><span style="color:#a31515">VisualStateManager.VisualStateGroups</span><span style="color:blue">&gt;<br><br>     &lt;</span><span style="color:#a31515">Grid.ColumnDefinitions</span><span style="color:blue">&gt;<br>          &lt;</span><span style="color:#a31515">ColumnDefinition</span><span style="color:red"> Width</span><span style="color:blue">=&quot;255&quot;/&gt;<br>          &lt;/</span><span style="color:#a31515">Grid.ColumnDefinitions</span><span style="color:blue">&gt;<br>     &lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt;<br>          &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;24&quot;/&gt;<br>          &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;3&quot;/&gt;<br>     &lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt;</span></span>   <span style="font-size:10pt;color:blue;font-family:Courier New"> </span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">     &lt;</span><span style="color:#a31515">Canvas</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;canvasMouseOver&quot;</span><span style="color:red"> Grid.Column</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Grid.Row</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Opacity</span><span style="color:blue">=&quot;0&quot;&gt;<br>          &lt;</span><span style="color:#a31515">Rectangle</span><span style="color:red"> Canvas.Left</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Canvas.Top</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Stretch</span><span style="color:blue">=&quot;Fill&quot;</span><span style="color:red"> VerticalAlignment</span><span style="color:blue">=&quot;Stretch&quot;</span><span style="color:red"> Width</span><span style="color:blue">=&quot;255&quot;</span><span style="color:red"> Height</span><span style="color:blue">=&quot;24&quot; &gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">          &lt;</span><span style="color:#a31515">Rectangle.Fill</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">               &lt;</span><span style="color:#a31515">LinearGradientBrush</span><span style="color:red"> StartPoint</span><span style="color:blue">=&quot;0.511514,-0.00480887&quot;</span><span style="color:red"> EndPoint</span><span style="color:blue">=&quot;0.511514,1.0625&quot;&gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">               &lt;</span><span style="color:#a31515">LinearGradientBrush.GradientStops</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">                    &lt;</span><span style="color:#a31515">GradientStop</span><span style="color:red"> Color</span><span style="color:blue">=&quot;#80FFFFFF&quot;</span><span style="color:red"> Offset</span><span style="color:blue">=&quot;0&quot;/&gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">                    &lt;</span><span style="color:#a31515">GradientStop</span><span style="color:red"> Color</span><span style="color:blue">=&quot;#805B7F9C&quot;</span><span style="color:red"> Offset</span><span style="color:blue">=&quot;0.34322&quot;/&gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">                    &lt;</span><span style="color:#a31515">GradientStop</span><span style="color:red"> Color</span><span style="color:blue">=&quot;#80FFFFFF&quot;</span><span style="color:red"> Offset</span><span style="color:blue">=&quot;1&quot;/&gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">               &lt;/</span><span style="color:#a31515">LinearGradientBrush.GradientStops</span><span style="color:blue">&gt;<br>               </span></span><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">&lt;/</span><span style="color:#a31515">LinearGradientBrush</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">          &lt;/</span><span style="color:#a31515">Rectangle.Fill</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">          &lt;/</span><span style="color:#a31515">Rectangle</span><span style="color:blue">&gt;<br>     &lt;/</span><span style="color:#a31515">Canvas</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">     &lt;</span><span style="color:#a31515">Canvas</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;canvasNormal&quot;</span><span style="color:red"> Grid.Column</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Grid.Row</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Background</span><span style="color:blue">=&quot;Transparent&quot;</span><span style="color:red"> Opacity</span><span style="color:blue">=&quot;1&quot;&gt;<br>          &lt;</span><span style="color:#a31515">Rectangle</span><span style="color:blue"> /&gt;<br>     &lt;/</span><span style="color:#a31515">Canvas</span><span style="color:blue">&gt;<br><br>     &lt;</span><span style="color:#a31515">Canvas</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;canvasSelectedShield&quot;</span><span style="color:red"> Grid.Column</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Grid.Row</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Background</span><span style="color:blue">=&quot;#ABBDD1&quot;</span><span style="color:red"> Opacity</span><span style="color:blue">=&quot;0&quot;/&gt;<br><br>     &lt;</span><span style="color:#a31515">Canvas</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;canvasSelected&quot;</span> <span style="color:red">Grid.Column</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Grid.Row</span><span style="color:blue">=&quot;0&quot;</span> <span style="color:red">Opacity</span><span style="color:blue">=&quot;0&quot;&gt;<br></span><span style="color:blue">          &lt;</span><span style="color:#a31515">Rectangle</span><span style="color:red"> Canvas.Left</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Canvas.Top</span><span style="color:blue">=&quot;0&quot;</span><span style="color:red"> Stretch</span><span style="color:blue">=&quot;Fill&quot;</span><span style="color:red"> VerticalAlignment</span><span style="color:blue">=&quot;Stretch&quot;</span><span style="color:red"> Width</span><span style="color:blue">=&quot;255&quot;</span><span style="color:red"> Height</span><span style="color:blue">=&quot;24&quot; &gt;<br>           &lt;</span><span style="color:#a31515">Rectangle.Fill</span><span style="color:blue">&gt;<br>               &lt;</span><span style="color:#a31515">LinearGradientBrush</span><span style="color:red"> StartPoint</span><span style="color:blue">=&quot;0.525718,0.0128409&quot;</span><span style="color:red"> EndPoint</span><span style="color:blue">=&quot;0.525718,1.0513&quot;&gt;<br>                    &lt;</span><span style="color:#a31515">LinearGradientBrush.GradientStops</span><span style="color:blue">&gt;<br>                         &lt;</span><span style="color:#a31515">GradientStop</span><span style="color:red"> Color</span><span style="color:blue">=&quot;#80FFFFFF&quot;</span><span style="color:red"> Offset</span><span style="color:blue">=&quot;0&quot;/&gt;<br>                         &lt;</span><span style="color:#a31515">GradientStop</span><span style="color:red"> Color</span><span style="color:blue">=&quot;#807E9EB8&quot;</span><span style="color:red"> Offset</span><span style="color:blue">=&quot;0.360731&quot;/&gt;<br>                         &lt;</span><span style="color:#a31515">GradientStop</span><span style="color:red"> Color</span><span style="color:blue">=&quot;#80FDFDFD&quot;</span><span style="color:red"> Offset</span><span style="color:blue">=&quot;1&quot;/&gt;<br>                    &lt;/</span><span style="color:#a31515">LinearGradientBrush.GradientStops</span><span style="color:blue">&gt;<br>               &lt;/</span><span style="color:#a31515">LinearGradientBrush</span><span style="color:blue">&gt;<br>          &lt;/</span><span style="color:#a31515">Rectangle.Fill</span><span style="color:blue">&gt;<br>          &lt;/</span><span style="color:#a31515">Rectangle</span><span style="color:blue">&gt;<br>     &lt;/</span><span style="color:#a31515">Canvas</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt;<br></span></span><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">&lt;/</span><span style="color:#a31515">ControlTemplate</span><span style="color:blue">&gt;</span></span> </p></div>]]></description></item><item><title>Democratic National Convention: A Resounding Success for Vertigo!</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Fri, 29 Aug 2008 13:59:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClassC350B998F83B42ADBDD5DEF7DE312A7A><p>Vertigo's DNC team is sitting in the Denver airport right now after an exciting and exhausting week at the Democratic National Convention.  We built the High Definition video website for the convention, and it was a huge success! We had a massive number of people around the world watch the convention live on our site, and what we achieved is an internet first. Never before has a live event of this historical importance been made available in quality that exceeds most HDTV broadcasts. 
</p><p>Additionally, our site broadcast the ENTIRE convention, not just the hour of primetime coverage offered by the TV networks, and the proceedings in their entirety are offered in Video On Demand form on the site. 
</p><p>You can check it out at <a href="http://gallery.demconvention.com/">gallery.demconvention.com</a>.
</p><p>For more information and pictures from our trip, check out the convention feature page on Vertigo's site here:
</p><p><a href="http://www.vertigo.com/dnc.aspx">http://www.vertigo.com/dnc.aspx</a>
	</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/082408_2028_VertigoArri1.png" alt=""></p></div>]]></description></item><item><title>Direct Disk and Partition Access in Managed Code</title><link>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=8</link><pubDate>Fri, 29 Aug 2008 11:11:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=8#Comments</comments><dc:creator>davidb</dc:creator><description><![CDATA[<div class=ExternalClass983E6E1435E34D9BB89F4CE6A8C486E2><div>
<p>A couple times a year, Vertigo supports a computer recycling drive. I happen to have a lot of old hard drives that I really wanted to give away, but not without wiping first. Not knowing how to do direct disk access in Win32, I was about to install an old compiler and implement something for DOS, invoking subfunction <a href="http://skola.jozjan.net/Operacne systemy/OS/fat32.htm#Int 21h Func 7305h Extended Absolute Disk Read/Write">7305h</a>. Fortunately, in passing, I came across the Win32 function, <a href="http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx">CreateFile</a>. Despite its name, CreateFile actually produces handles for accessing files [which don't have to be new]. Further, it can also target partitions and physical drives, passing in as the filename:</p>
<ul>
<li><code>\.\PhysicalDrive<em>n</em></code> - access hard disk <em>n</em></li>
<li><code>\\.\<em>s</em>:</code> - access partition <em>s</em></li></ul>
<p>These cases require full R/W access—the documentation states <code>GENERIC_READ | GENERIC_WRITE</code> is sufficient—and read and write sharing. So opening the x: partition for synchronous access would be:</p><pre>String fileName =  L&quot;\\.\x:&quot;;
pin_ptr pName = &amp;(fileName-&gt;ToCharArray()[0]);
HANDLE hFile =
    CreateFile(
        L&quot;\\.\x:&quot;,
        FILE_ALL_ACCESS,
        FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL,
        OPEN_EXISTING,
        0,
        NULL);
pName = nullptr;

if (hFile == INVALID_HANDLE_VALUE)
{
    if (GetLastError() == 0)
    {
        <em>Throw Exception: Drive/partition does not exist.</em>
    }
    else
    {
        <em>Throw Exception: Can't open drive/partition.</em>                
    }
}</pre>
<p>The file handle can then then be wrapped in a <a href="http://msdn.microsoft.com/en-us/library/microsoft.win32.safehandles.safefilehandle.aspx">SafeFileHandle</a> so it can be closed with disposal:</p><pre>SafeFileHandle^ safeFileHandle = nullptr;
try
{
    safeFileHandle = 
        gcnew SafeFileHandle((IntPtr)hFile, true);  // Current thread owns handle.

    <em>...</em>

}
finally
{
    if (safeFileHandle != nullptr)
    {
        delete safeFileHandle;
    }
}</pre>
<p>In turn, this can be passed into a <a href="http://msdn.microsoft.com/en-us/library/system.io.filestream.aspx">FileStream</a> <a href="http://msdn.microsoft.com/en-us/library/b6fz1x84.aspx">constructor</a>, through which the actual I/O can be performed:</p><pre>// FileAccess::Read can be used for read access.
fileStream = gcnew FileStream(safeFileHandle, FileAccess::Write);</pre>
<p>The FileStream is now available for writing [or reading]:</p><pre>fileStream-&gt;Write(
    byteArray,
    0,
    byteArray-&gt;Length);</pre>
<p>In addition, the FileStream's position can be changed:</p><pre>fileStream-&gt;Position = <em>position</em>;</pre>
<p>Notes: 
<ul>
<li>While opening partitions and physical drives doesn't require Administrator access, many of the related I/O functions do—and for good reason!</li>
<li>To get a physical disk's size, use the <a href="http://msdn.microsoft.com/en-us/library/aa363216(VS.85).aspx">DeviceIOControl</a> function, passing in <a href="http://msdn.microsoft.com/en-us/library/aa365178(VS.85).aspx">IOCTL_DISK_GET_LENGTH_INFO</a>:<pre>DWORD bytesReturned;
GET_LENGTH_INFORMATION getLengthInformation;

if (FALSE == DeviceIOControl(
        hFile,
        IOCTL_DISK_GET_LENGTH_INFO.
        NULL,
        0,
        &amp;getLengthInformation,
        sizeof(GET_LENGTH_INFORMATION),
        &amp;bytesReturned,
        NULL))
{
    <em>Throw Exception: Can't get disk length</em>
}

Int64 diskLength = getLengthInformation.Length.QuadPart;</pre></li>
<li>The <a href="http://msdn.microsoft.com/en-us/library/system.io.driveinfo.aspx">DriveInfo</a> class doesn't reveal a partition's full size—perhaps it takes file system overhead into account. To get a partition's length, use the DeviceIOControl function, passing in <a href="http://msdn.microsoft.com/en-us/library/aa365180(VS.85).aspx">IOCTL_DISK_GET_PARTITION_INFO_EX</a>:<pre>DWORD bytesReturned;
PARTITION_INFORMATION_EX partitionInfo;

if (FALSE == DeviceIOControl(
        hFile,
        IOCTL_DISK_GET_PARTITION_INFO_EX,
        NULL,
        0,
        &amp;partitionInfo,
        sizeof(PARTITION_INFORMATION_EX),
        &amp;bytesReturned,
        NULL))
{
    <em>Throw Exception: Can't get partition info.</em>
}

Int64 partitionLength = partitionInfo.PartitionLength.QuadPart;</pre></li>
<li>Partitions should be dismounted before writing, using the DeviceIOControl function with <a href="http://msdn.microsoft.com/en-us/library/aa364562(VS.85).aspx">FSCTL_DISMOUNT_VOLUME</a>: <pre>DWORD bytesReturned;

if (FALSE == DeviceIoControl(
        hFile,
        FSCTL_DISMOUNT_VOLUME ,
        NULL,
        0,
        NULL,
        0,
        &amp;bytesReturned,
        NULL))
{
    <em>Throw Exception: Partition can't be dismounted.</em>
}</pre></li>
<li>It seems that you can't have partially-written sectors when you <a href="http://msdn.microsoft.com/en-us/library/system.io.filestream.flush.aspx">flush</a>. 
<li>I tested the direct physical disk and partition I/O on 32-bit Vista and XP, and was able to access IDE drives. However, I couldn't get the API's to work with my USB floppy drive.</li>
<li>I never tested these API's with dynamic or encrypted partitions.</li>
<li>While the interop will require more work, these API's can be accessed in C#. <a href="http://www.pinvoke.net/">pinvoke.net</a> has entries for <a href="http://www.pinvoke.net/default.aspx/kernel32/CreateFile.html">CreateFile</a> and <a href="http://www.pinvoke.net/default.aspx/kernel32/DeviceIoControl.html">DeviceIOControl</a>.</li>
<li>In most cases, a few random passes is probably good enough for wiping disks and partitions—be sure to use <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.rngcryptoserviceprovider.aspx">RNGCryptoServiceProvider</a> or one of the <a href="http://msdn.microsoft.com/en-us/library/aa375534.aspx">CNG RNG algorithms</a> as a source. For more security, patterns included in <a href="http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html">this article</a>, targetting specific disk encodings, can be written instead.</li>
<li>Needless to say, <strong>direct disk and partition I/O is inherently dangerous</strong>—though using the Win32 and .NET framework API's isn't as error-prone as the DOS interrupt ones. However, use them <strong>at your own risk</strong>. Also, be sure to implement a good, descriptive user confirmation before starting to write.</li></ul>
<p></p></div></div>]]></description></item><item><title>Entity Framework RTM Installation Experience</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=13</link><pubDate>Thu, 28 Aug 2008 18:31:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=13#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClass9999EFB7DF454135B875BF0C418C2233>
<p>If you haven't been paying much attention to the release schedule of the Microsoft ADO.NET Entity Framework, you might not even know that it was finally released with SP1 of Visual Studio 2008. Having stirred up so much controversy among ORM enthusiasts, I was hoping for some election-year-worthy rhetoric and hyperbole from its critics, and either a flurry of praise or complaints from EF-user-hopefuls. Its release, however, was eerily quiet. I guess we'll just have to wait and see what comes up. </p>
<p>I was curious to see how the SP1 installation affected my existing EF Beta 2 installation and applications, so I installed SP1 without uninstalling EF Beta 2. The first thing I noticed when attempting to create a new Entity Data Model in a new application was this message: </p>
<p><img alt="Error: this template attempted to load an untrusted component 'Microsoft.Data.Entity.Design, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.  For more information on this problem and how to enable this template, please see documentation on Customizing Project Templates." src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/082908_0131_EntityFrame1.png"> </p>
<p>I had to double-take to see that I actually have two &quot;ADO.NET Entity Data Model&quot; templates in the Add New Item dialog. One of templates causes the error and the other one does not. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/082908_0131_EntityFrame2.png"> </p>
<p>This is obviously because I had not uninstalled EF Beta 2. To fix this problem, uninstall the following programs: </p>
<ol>
<li>ADO.NET Entity Framework Tools Preview </li>
<li>ADO.NET Entity Framework 1.0 (Pre-Release Version) <em>(not really required to fix this issue, but it should be uninstalled anyway)</em> </li></ol>
<p>Next, I tried opening and running an old EF Beta 2 demo application I wrote. When attempting to open the .edmx file in the designer, I received the following error: </p>
<p><strong>&quot;Error 5: The required attribute 'Provider' is missing.&quot; </strong></p>
<p>Similarly, attempting to build the solution gave me this error: </p>
<p><strong>&quot;Schema specified is not valid. Errors: Rockstars.ssdl(2,2) : error 0005: The required attribute 'Provider' is missing.&quot; </strong></p>
<p>Apparently, the storage model (SSDL) schema has changed a bit. To fix the problem, I found the <span style="font-size:8pt;color:#a31515;font-family:Consolas">edmx:StorageModels</span> element in my .edmx file and edited the code as shown below. (You may need to right-click on the .edmx file in Solution Explorer, and choose Open With --&gt; XML Editor.) </p>
<p>From this: </p>
<p><span style="font-family:Consolas"><span style="color:blue">&lt;!--</span><span style="color:green"> SSDL content </span><span style="color:blue">--&gt; </span></span><br><span style="font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">edmx:StorageModels</span><span style="color:blue">&gt; </span></span><br><span style="font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">Schema</span><span style="color:blue"> </span><span style="color:red">Namespace</span><span style="color:blue">=</span>&quot;<span style="color:blue">RockstarsModel.Store</span>&quot;<span style="color:blue"> </span><span style="color:red">Alias</span><span style="color:blue">=</span>&quot;<span style="color:blue">Self</span>&quot;<span style="color:blue"> </span><span style="color:red;background-color:yellow">ProviderManifestToken</span><span style="color:blue;background-color:yellow">=</span><span style="background-color:yellow">&quot;<span style="color:blue">09.00.3054</span>&quot;</span><span style="color:blue"> </span><span style="color:red">xmlns</span><span style="color:blue">=</span>&quot;<span style="color:blue">http://schemas.microsoft.com/ado/2006/04/edm/ssdl</span>&quot;<span style="color:blue">&gt;</span></span> </p>
<p>to this: </p>
<p><span style="font-family:Consolas"><span style="color:blue">&lt;!--</span><span style="color:green"> SSDL content </span><span style="color:blue">--&gt; </span></span><br><span style="font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">edmx:StorageModels</span><span style="color:blue">&gt; </span></span><br><span style="font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">Schema</span><span style="color:blue"> </span><span style="color:red">Namespace</span><span style="color:blue">=</span>&quot;<span style="color:blue">RockstarsModel.Store</span>&quot;<span style="color:blue"> </span><span style="color:red">Alias</span><span style="color:blue">=</span>&quot;<span style="color:blue">Self</span>&quot;<span style="color:blue"> </span><span style="color:red;background-color:yellow">Provider</span><span style="color:blue;background-color:yellow">=</span><span style="background-color:yellow">&quot;<span style="color:blue">System.Data.SqlClient</span>&quot;<span style="color:blue"> </span><span style="color:red">ProviderManifestToken</span><span style="color:blue">=</span>&quot;<span style="color:blue">2005</span>&quot;</span><span style="color:blue"> </span><span style="color:red">xmlns</span><span style="color:blue">=</span>&quot;<span style="color:blue">http://schemas.microsoft.com/ado/2006/04/edm/ssdl</span>&quot;<span style="color:blue">&gt;</span></span> </p>
<p>The other build error I was receiving was this: </p>
<p><strong>&quot;The type or namespace name 'RockstarsModel' could not be found (are you missing a using directive or an assembly reference?)&quot; </strong>(In case you haven't figured it out yet, my program is called &quot;Rockstars.&quot;)<strong> </strong></p>
<p>This is due to a change in the way the generated data classes are namespaced. Previously, the generated data classes were placed in a top-level &quot;model&quot; namespace to represent the conceptual model (CSDL). This namespace had to be imported (or classes fully-qualified in code) in order to consume the data classes. In the RTM version, the classes are generated in your solution's default top-level namespace, so no import is necessary. The code gets re-generated at almost every move, so your old project will get updated to the new namespace pattern. </p>
<p>To fix my error I removed this line of code: </p>
<p><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">using</span> RockstarsModel;</span> </p>
<p>The most touted new feature in the RTM is the EntityDataSource. I'm a little skeptical that it's just another wizard, but hopefully I'll get a chance to look at it and blog about it. Other changes that may be of interest can be read about <a href="http://blogs.msdn.com/adonet/archive/2008/08/12/entity-framework-rtm-breaking-changes.aspx">here</a>. Some that caught my eye are: </p>
<ul style="margin-left:38pt">
<li>In the SSDL (store definition), you can no longer use a period in the name of an Entity, Association, EntityContainer, EntitySet, AssociationSet, or Function. </li>
<li>The public DisposeContext() method has been removed from the EntityDataSourceView class. </li>
<li>The event argument classes for the EntityDataSource have been re-architected. This affects ASP.NET users who used the ContextCreating, ContextCreated, ContextDisposing, Selecting, Selected, Updating, Inserting, Deleting, and Deleted events. </li></ul>
<p>All in all, the installation was pretty smooth, and migrating my Beta 2 application was pretty simple. </p></div>]]></description></item><item><title>Vertigo Arrives at the Democratic National Convention!</title><link>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Sun, 24 Aug 2008 13:28:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/bobc/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>bobc</dc:creator><description><![CDATA[<div class=ExternalClass9D81AB15DB4A4F23859F302A7B2969C1><p>Over the last couple of months, Vertigo has been building the High Definition, Silverlight-driven video website for the Democratic National Convention.  6 members of our team arrived in Denver yesterday, and we'll be supporting the site throughout the convention, which runs from Monday August 25 to Thursday August 28.  
</p><p>This is an exciting project for Vertigo, as we're breaking new ground.  This is one of the biggest events to have ever invested this heavily in <strong>live</strong>, high definition quality coverage.  The site allows Video on Demand as well as a full schedule, and will be available during and after the event.  The site will really begin to &quot;light up&quot; this week as the live coverage begins, and a slew of high definition VODs begin to appear in our video gallery.  The site can be viewed here:<br><br><a href="http://gallery.demconvention.com/">http://gallery.demconvention.com</a>  
</p><p>We got the opportunity to tour the convention floor at the Pepsi center last night, and I was very impressed by the visual design of the stage, as well as all the effort being put into the event.  <a href="http://www.flickr.com/photos/27392445@N06/sets/72157606924969638/show/">Check out the pictures from our trip here.</a>
	</p><p>Some screenshots from the app appear below. Note that the second image is actually a screenshot – not a picture we took! 
</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/082408_2028_VertigoArri1.png" alt="">
	</p><p><img src="http://blogs.vertigo.com/personal/bobc/Blog/Lists/Photos/082408_2028_VertigoArri2.png" alt="">
	</p><p>  </p></div>]]></description></item><item><title>Avoiding Inheritance - Response</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=25</link><pubDate>Thu, 21 Aug 2008 17:47:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=25#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClassBF5EDD71DCDF42789EAAF311181EC4B8>
<p>Recently, there was an article on <a href="http://www.managed-world.com/2008/06/15/AvoidingInheritanceDependenciesUsingGenericsAndLambdas.aspx">avoiding inheritance</a> on the <a href="http://go.microsoft.com/fwlink/?linkid=84795&amp;clcid=409">Visual Studio start page news channel</a>. In general, I like the content of the article. I don't think there is any misinformation, but I do think there is some misrepresentation. I believe this article is overly critical of inheritance. I hope the author isn't simply being fashionable by deriding inheritance in favor of generics and lambdas.</p><cite>One realization I have come to when talking with many other developers is that there is a good number of developers that don't realize that inheritance introduces dependencies directly into your classes.</cite> 
<p>This is a problem of education, not abstraction. This doesn't mean inheritance is flawed; it means the developers' knowledge is incomplete.</p><cite>Your derived class is now dependant [<a href="http://www.merriam-webster.com/dictionary/dependent">sic</a>] upon the interface and behavior of your base class. Worded another way, your derived class is now <b>strongly coupled</b> to your base class.</cite> 
<p>Correct: that is by design. That is a known and welcome aspect of <a href="http://en.wikipedia.org/wiki/Inheritance_%2528computer_science%2529">inheritance</a>. If Foo inherits Bar, a Foo <a href="http://en.wikipedia.org/wiki/Is-a">is a</a> Bar and I expect it to behave as such.</p><cite>For instance, if I need to add another abstract method I didn't originally think of, every single class that derives from that base class now must change in order to implement that behavior.</cite> 
<p>If you're adding an abstract method, it means you <em>want</em> derived classes to implement it. Otherwise, either add a virtual method or derive a new class that contains the new abstract method.</p><cite>Or, if I change the behavior of one of the methods in my base class, I can find myself in a situation where one of my derived classes will break because they were relying on that base class behavior to act a given way….</cite> 
<p>This problem isn't restricted to class hierarchies; this will happen with <em>any</em> code. Any time you change code anywhere, you need to re-test your application. If you're writing a class library for consumption by others, you're only alternative to potentially breaking a client is to add a new method with the new behavior or create an entirely new class (e.g. the <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx">ConfigurationManager class</a> instead of the <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationsettings.aspx">ConfigurationSettings class</a>). The .NET framework even has an attribute (the <a href="http://msdn.microsoft.com/en-us/library/system.obsoleteattribute.aspx">ObsoleteAttribute class</a>) specifically for dealing with legacy. There are plenty of instances of this in the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.aspx">System.Runtime.InteropServices</a> namespace.</p>
<p>Everything else about the article is pretty good. His use of the <a href="http://en.wikipedia.org/wiki/Command_pattern">Command</a> pattern is a fine example of when to use generics instead of inheritance. I have a couple of additions to his discussion.</p>
<ul>
<li><cite>And because of leveraging a common base class, we can use polymorphism to reuse this code even more (like having a list of commands that we can execute in a script or elsewhere).</cite> 
<p>I think this is still useful but he didn't come back to it in his re-implementation using generics. Here, he can still benefit from an interface. Having his GenericCommand&lt;TReceiver&gt; implement, say, ICommand (having the same definition as his Command abstract class) enables generic containers and iteration.</p></li>
<li><cite>First of all, for every home device that we wish to turn on and off, we would be introducing two new classes into our code.</cite> 
<p>In his example where he addresses this with generics, .NET will introduce new classes (e.g. GenericCommand`1[Garage]), but they're created at run-time. You won't find them if you use, say, <a href="http://www.aisto.com/roeder/dotnet/">Reflector</a> to look at the assembly. This doesn't invalidate the way he addresses this concern since those generated classes aren't introduced into <em>our</em> code.</p></li>
<li><cite>If we change our Execute() method in our base class from abstract to virtual in order to introduce common behavior, how do you guarantee that the base method is called when it should be? In a derived class, should you call the base method before your own execution code, or after? What if I want common code in my base class that will be executed both before and after the behavior in my derived classes?</cite> 
<p>The answer to all of these is &quot;use the <a href="http://en.wikipedia.org/wiki/Template_Method">Template Method</a> pattern.&quot; In fact, using lambdas to defer the actual implementation of the command behavior to a separate entity as he does is in essence a use of the <a href="http://en.wikipedia.org/wiki/Strategy_pattern">Strategy</a> pattern, a relative of the Template Method pattern. (BTW, <a href="http://en.wikipedia.org/wiki/Strategy_pattern#Python">Wikipedia's Python example of the Strategy pattern</a> can be re-implemented in C# without loss of generality by using the same techniques found in this article.)</p></li></ul></div>]]></description></item><item><title>Finding a control’s position in Silverlight 2.0</title><link>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=11</link><pubDate>Mon, 11 Aug 2008 10:26:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=11#Comments</comments><dc:creator>jeffv</dc:creator><description><![CDATA[<div class=ExternalClassE504E5892F92406190E2FBAE0FFC0711><div>
<div style="border-right:medium none;padding-right:0in;border-top:medium none;padding-left:0in;padding-bottom:4pt;border-left:medium none;padding-top:0in;border-bottom:#4f81bd 1pt solid;mso-element:para-border-div"></div>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>Ever found yourself with a need to know a controls position in silverlight 2.0, but weren’t using a canvas layout?</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>You could be implementing a combo box, or a review popup, or a semi-transparent detail panel on a glass pane, and suddenly found that the control you were hoping to trigger this behavior from has no idea where it is.<span style="">  </span>This triggering control, of course, it positioned using a Grid or StackPanel, so it will layout nicely in a variety screen sizes and shapes.<span style="">  </span>Unfortunately, this means it doesn’t have a X or Y position. Does this mean you have to convert your app to use just a Canvas and implement your own layout logic?</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>The answer is no, you can find the position using UIElement.<span style="">TransformToVisual</span>() on the Current Application’s RootVisual. <span style=""> </span>The parameter you pass is the control whose location is of interest. <span style=""> </span>This method returns a transform object.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span style="font-size:10pt;color:#2b91af;font-family:'Courier New'">GeneralTransform </span><font size=3><font face=Calibri><span style="">myButtonTransform</span> =</font></font><span style="font-size:10pt;color:#2b91af;font-family:'Courier New'"> Application</span><span style="font-size:10pt;font-family:'Courier New'">.Current.RootVisual.</span><font size=3><font face=Calibri><span style="">TransformToVisual</span>(myButton);</font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>Now for this to work, the actual object returned by </font><span style="font-size:10pt;color:#2b91af;font-family:'Courier New'">TransformToVisual</span><font face=Calibri size=3> needs to be of the type </font><span style="font-size:10pt;color:#2b91af;font-family:'Courier New'">MatrixTransform </span><span style=""><font face=Calibri size=3>. Typically the RootVisual is a </font></span><span style="font-size:10pt;color:#2b91af;font-family:'Courier New'">UserControl</span><font size=3><font face=Calibri><span style="">, and providing anoth</span>er<span style=""> transform hasn’t been applied, it meets this requirement</span> ( as of SL 2.0 Beta2)<span style="">.</span><span style="">  </span></font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;color:blue;font-family:'Courier New'">if</span><font face=Calibri size=3> (<span style="">myButtonTransform</span> </font><span style="font-size:10pt;color:blue;font-family:'Courier New'">is</span><span style="font-size:10pt;font-family:'Courier New'"> <span style="color:#2b91af">MatrixTransform)<br>{<br></span><span style="">      </span><span style="color:blue">double</span> xPosition = ((<span style="color:#2b91af">MatrixTransform</span>)myButtonTransform).Matrix.OffsetX;<br><span style="">      </span><span style="color:blue">double</span> yPosition = ((<span style="color:#2b91af">MatrixTransform</span>)myButtonTransform).Matrix.OffsetY;<br><span style="">      </span><span style="color:green">// do stuff with the positions...</span><span style="color:#2b91af"><br>}</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;color:#2b91af;font-family:'Courier New'"> </span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style=""><font size=3><font face=Calibri>Oops!<span style="">  </span></font></font></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri><span style="">The values of xPosition and yPosition have been loaded with are negative values, so we’ll need to make them positive before using them.</span><span style="">  </span>What follows are the xPosition and yPosition being converted to positive values, each a different way.</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3> </font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:'Courier New'"><span style="">      </span><span style="color:blue">double</span> xPosition = <span style="color:#2b91af">Math</span>.Abs(((<span style="color:#2b91af">MatrixTransform</span>)myButtonTransform).Matrix.OffsetX);</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:'Courier New'"><span style="">      </span><span style="color:blue">double</span> yPosition = -(((<span style="color:#2b91af">MatrixTransform</span>)myButtonTransform).Matrix.OffsetY);</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3> </font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri>Of course, multiplying by -1 would also work.<span style=""></span></font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3> </font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3> </font></p></div></div>]]></description></item><item><title>Live mouse traps</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=31</link><pubDate>Mon, 11 Aug 2008 07:01:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=31#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassAF8C1A46B2EB41448E5A69B10904884A><font face="Helvetica, Arial, sans-serif"><img alt="" src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/mouse.png" align=right height=105 hspace=10 vspace=10 width=204>We have some mice running around the house and I
bought some live mouse traps to catch the mice and release them where
they can live out their happy mouse life. I thought one of the live
mouse trap's instructions was kind of odd:</font><br>
<blockquote><font face="Helvetica, Arial, sans-serif">&quot;Bla,
bla about setting it up. </font><font face="Helvetica, Arial, sans-serif">After you catch the
mice, you can submerge the cage in water.&quot;</font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">I don't think
most people who buy a live mouse trap are going to turn around and
drown the poor rodents.<br>
<br>
</font>
</div>]]></description></item><item><title>GridView-DetailsView Parent-Child</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=24</link><pubDate>Fri, 01 Aug 2008 17:50:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=24#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass01D48D07FF004C85932878B696722DB0>
<p>I've seen several master-detail examples using a GridView that controls a DetailsView but no parent-child examples that reverse their roles (i.e., an example using a DetailsView that contains and controls a GridView). I alluded to such a scenario in <a href="http://blogs.vertigo.com/personal/chris/Blog/archive/2007/06/15/gridview-objectdatasource-dataset-and-stored-procedures.aspx">a previous post</a>. Here, I'll walk through the steps to create such a display.</p>
<ol>
<li>Create the database and tables. If you already have one with a parent-child (i.e., one-to-many) relationship, you can skip this step. Also, if you're using SQL Server 2005 instead of its Express edition, skip to sub-step c. 
<ol style="list-style-type:lower-alpha">
<li>From the Project menu, select &quot;Add New Item…&quot;.</li>
<li>Select the Data category, and then select the SQL Server Database template and click &quot;Add&quot;. If it then prompts you to place it in the App_Data folder, click &quot;Yes&quot;.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/Add%20Database.png"><br></li>
<li>Create a two tables, one of which has a foreign key into the other. Here is the example I'll use.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/Database%20Diagram.png"><br></li>
<li>Add some data to the tables. I'll add two companies with two divisions each.</li></ol></li>
<li>Create a new Web form or use one you already have. I'll use Default.aspx. Open it and switch to the Design view.</li>
<li>Add a DetailsView to the design surface. You can find it in the Data section of the Toolbox.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/DetailsView.png"><br></li>
<li>From the &quot;Choose Data Source&quot; drop-down list, select &quot;&lt;New data source…&gt;&quot;. I'll select the Database data source for this walk-through.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/Choose%20Data%20Source%20Type.png"><br></li>
<li>Select the connection to your database from the drop-down list. If it's not there, click &quot;New Connection…&quot; to create a new one.</li>
<li>Click &quot;Next&quot; to save the connection string in Web.config.</li>
<li>In the &quot;Configure the Select Statement&quot; step, select the &quot;Companies&quot; table (or whichever table is the parent in your schema) and select &quot;*&quot; to see all columns in the DetailsView. Click &quot;Next&quot;.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/Configure%20the%20Select%20Statement.png"><br></li>
<li>Test the query if you like. Click &quot;Finish&quot;.</li>
<li>Click the Smart Tag symbol on the DetailsView control to open it and select &quot;Add New Field…&quot;.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/DetailsView%20-%20Tasks.png"><br></li>
<li>Select &quot;TemplateField&quot; from the &quot;Choose a field type&quot; drop-down list and enter some header text. I'll enter &quot;Divisions&quot; since that's the name of my child table. Click &quot;OK&quot;.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/DetailsView%20-%20Add%20Field.png"><br></li>
<li>Select &quot;Edit Templates&quot; from Smart Tag. The control enters &quot;Edit Template Mode&quot; and displays an empty item template for the Divisions field. Drag a GridView from the Data section of the Toolbox into the item template.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/DetailsView%20-%20Item%20Template.png"><br></li>
<li>Create a new data source as above (steps 4 through 8) for the GridView but select all columns from the Companies table (or whichever table is the parent in your schema) instead. <b style="color:#930">There is one issue to beware.</b> VS will name the new data source for the GridView the same as that for the DetailsView. (I previously used the default, SqlDataSource1.) This will cause a designer error. Be sure to use a different name for the new data source. I'll use what is supposed to be the default, SqlDataSource2.</li>
<li>If you run it now, you'll see one company but all divisions, not just those for that company.</li>
<li>In the &quot;Configure the Select Statement&quot; page of the &quot;Configure Data Source&quot; wizard (the page where you select &quot;*&quot;), click the &quot;WHERE…&quot; button.</li>
<li>In the &quot;Add WHERE Clause&quot; dialog, select &quot;CompanyId&quot; from the &quot;Column&quot; drop-down list and select &quot;Control&quot; from the &quot;Source&quot; drop-down list.</li>
<li>In the Parameter properties section, select DetailsView1 from the Control ID drop-down list. Click &quot;Add&quot; and then click &quot;OK&quot;.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/DetailsView%20-%20Add%20WHERE%20Clause.png"><br></li>
<li>Verify the SELECT statement. Mine is &quot;SELECT * FROM [Divisions] WHERE ([CompanyId] = @CompanyId)&quot;. Click &quot;Next&quot;.</li>
<li>Test the query if you like. Click &quot;Finish&quot;.</li>
<li>Press F5. Here's what it looks like in my browser.<br><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/GridView-DetailsView%20Parent-Child/View%20in%20Browser.png"><br></li></ol>
<p>I ran through the instructions of <a href="http://blogs.vertigo.com/personal/chris/Blog/archive/2007/06/15/gridview-objectdatasource-dataset-and-stored-procedures.aspx">my previous post</a> and had no problems with that combination of GridView, ObjectDataSource, DataSet, and stored procedures using Visual Studio 2008. It appears Microsoft fixed it since Orcas.</p></div>]]></description></item><item><title>Recover files from bad drive with FindNTFS</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=30</link><pubDate>Fri, 01 Aug 2008 08:25:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=30#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassD768B32B3A454ED9B0811E72D4E1A3DF><font face="Helvetica, Arial, sans-serif"><img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/wd-mybook.png" align=right height=163 hspace=10 vspace=10 width=158><strike>I
have two external Western Digital MyBook drives that are working
great</strike>… I had two external Western Digital <a href="http://en.wikipedia.org/wiki/Western_Digital_My_Book">MyBook</a>
drives die
recently, one around a week ago, and another around 2 months
ago. <br>
<br>
Both drives were not used very much (powered off most of
the time) and worked for over a year. There were no indications of
failure, I turned on the drive and the computer indicated the
drive could not be recognized and needed to be formatted.<br>
<br>
I tried a lot of programs to recover the files and the only one that
worked was <a href="http://www.partitionsupport.com/utilities.htm">FindNTFS</a>.
I was able to recover all of the files from the
drives with FindNTFS, you might try it if you are in a similar
situation.<br>
<br>
I did the following:<br>
</font>
<ul>
  <li><font face="Helvetica, Arial, sans-serif">Remove
the drive from the enclosure, which probably was not necessary.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Install
the drive in another enclosure, which was necessary since I removed it
in the first place.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Ran <b>findntfs
2 0 1 1</b>, that listed the files on the drive.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Ran <b>findntfs
2 0 1 1 copy</b>, that copied the files from the drive.</font></li>
</ul>
<font face="Helvetica, Arial, sans-serif">Note the files
are copied to the location of the FindNTFS executable, so make sure you
have room for all of the files. The number <b>2</b> above
is the drive number, </font><font face="Helvetica, Arial, sans-serif">you can see the FindNTFS
documentation (text file in the download) for the other settings. An
article at <a href="http://www.pcstats.com/articleview.cfm?articleid=1139&amp;page=6">pcstats.com</a> might
be useful.<br>
</font>
</div>]]></description></item><item><title>New Hard Rock Memorabilia Collection</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=17</link><pubDate>Mon, 28 Jul 2008 09:44:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=17#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[Just feeding the Google. Here are all 300 item links to the Hard Rock Memorabilia site. Bon appétit. 

Item 000001Item 000002Item 000003Item 000004Item 000005Item 000006Item 000007Item 000008Item 000009Item 000010

Item 000011Item 000012Item 000013Item 000014Item 000015Item 000016Item 000017Item 000018Item 000019Item 000020
Item 000021Item 000022Item 000023Item 000024Item 000025Item 000026Item 000027Item 000028Item 000029Item 000030
Item 000031Item 000032Item 000033Item 000034Item 000035Item 000036Item 000037Item 000038Item 000039Item 000040
Item 000042Item 000043Item 000044Item 000045Item 000046Item 000047Item 001102Item 001155Item 001169Item 001854
Item 005320Item 008532Item 008594Item 008631Item 008642Item 008643Item 009271Item 012204Item 012213Item 012215
Item 012217Item 012234Item 012246Item 012266Item 013332Item 016705Item 017628Item 021114Item 021353Item 021937
Item 021959Item 022079Item 022234Item 023304Item 023350Item 023792Item 024198Item 024532Item 024709Item 024746
Item 024816Item 024900Item 025384Item 025418Item 025683Item 025707Item 025746Item 026224Item 026229Item 026341
Item 026364Item 026423Item 027154Item 027218Item 027225Item 027299Item 027341Item 027353Item 027357Item 027534
Item 027744Item 033376Item 033391Item 033789Item 034030Item 034114Item 034116Item 034192Item 034522Item 035107
Item 035643Item 036539Item 036643Item 036650Item 036760Item 039089Item 039308Item 039317Item 039747Item 040144
Item 040163Item 040392Item 040437Item 040514Item 040849Item 040978Item 041130Item 041237Item 041315Item 041656
Item 041867Item 042285Item 042387Item 043074Item 043123Item 043273Item 044105Item 044178Item 044456Item 044506
Item 044581Item 044754Item 044791Item 045490Item 045844Item 046244Item 046554Item 047478Item 047568Item 047721
Item 047894Item 047898Item 048391Item 048396Item 048485Item 049946Item 050931Item 050935Item 050937Item 050938
Item 050939Item 050940Item 050941Item 050942Item 050943Item 050944Item 050945Item 050963Item 051029Item 051038
Item 051063Item 051827Item 052002Item 052067Item 052356Item 052386Item 052509Item 052607Item 052688Item 053124
Item 053130Item 053844Item 054570Item 054573Item 054575Item 054576Item 054588Item 054726Item 055040Item 055190
Item 055229Item 055231Item 055232Item 055233Item 055234Item 055235Item 055239Item 055341Item 056635Item 057213
Item 057765Item 057807Item 057815Item 058305Item 058423Item 058682Item 058877Item 059313Item 059395Item 059711
Item 061152Item 061218Item 061369Item 061380Item 061425Item 061786Item 061791Item 061853Item 062570Item 062575
Item 062597Item 063609Item 064267Item 064650Item 064673Item 064726Item 064772Item 065036Item 065041Item 065094
Item 065219Item 066289Item 066294Item 066553Item 066593Item 066794Item 067235Item 068117Item 068127Item 068310
Item 069412Item 069804Item 069867Item 069915Item 071269Item 071278Item 071401Item 071845Item 072730Item 074066
Item 075785Item 087424Item 087478Item 087570Item 087615Item 087739Item 087900Item 088098Item 088125Item 089144
Item 089749Item 090116Item 090181Item 090395Item 090723Item 090955Item 091264Item 091403Item 091812Item 091986
Item 092517Item 092553Item 092663Item 093350Item 093366Item 093367Item 093539Item 093574Item 093638Item 093845
Item 093912Item 094206Item 094489Item 094490Item 095201Item 095411Item 095605Item 095968Item 095989Item 096322
Item 097464Item 097971Item 100049Item 100089Item 100190Item 100277Item 100281Item 100286Item 100299Item 100388
(Burp.)]]></description></item><item><title>Albert and Einstein</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=29</link><pubDate>Mon, 28 Jul 2008 05:33:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=29#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass5C67D36DAC2D4736A9AA6555A976ED6D><font face="Helvetica, Arial, sans-serif">We got two
kittens that Kaitlyn and Makayla (kids) decided to name <b>Albert</b>
and <b>Einstein</b>. They are female cats, but I guess
they don’t mind. Albert is on the left, Einstein on the
right. <br>
<br>
<img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/kittens.jpg" height=300 width=425><br>
<br>
On a related topic, instead of playing <a href="http://en.wikipedia.org/wiki/Marco_Polo_(game)">Marco-Polo</a>
in the swimming pool, we have been playing <b>Albert-Einstein</b>,
<b>Carl-Sagan</b>, and <b>Bill-Nye</b>…
<b>Neil-deGrasse-Tyson</b> did not really fit, but we tried.</font>
</div>]]></description></item><item><title>Media Center Fix for Windows Vista</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=44</link><pubDate>Tue, 08 Jul 2008 09:03:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=44#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass3F2B740622C6499C85E11DD4D40DE16B>
<p>Using Media Center under the following conditions was resulting in stuttering video and audio, and the occasional green screen: </p>
<ul>
<li>Windows Vista Ultimate SP1, 64-bit </li>
<li>4 GB RAM </li>
<li>NVidia GeForce 8800 GTS </li>
<li>Hauppauge WinTV 1600 TV Tuner </li></ul>
<p>I've seen a lot of posts on message boards where people are experiencing similar issues, all with strange suggestions that don't seem to work. I accidentally discovered my own solution, which I hope helps anyone else with the same problem. </p>
<p>Here's what I did: </p>
<ol>
<li>Go to Hauppauge's website and download the <a href="http://www.hauppauge.com/pages/support/support_hvr1600.html">newest drivers</a> </li>
<li>Extract the contents of the zip file </li>
<li>Run hcwclear.exe, selecting the <em>Remove All WinTV Drivers and Applications (Total Removal)</em> and <em>Search All .INF Files for Conflicting Hardware</em> options </li>
<li>Reboot </li>
<li>When Windows discovers new hardware after rebooting, allow it to look for new drivers </li></ol>
<p>I have seen other instructions that indicate you should use the downloaded drivers, but in my case, the drivers available through Windows Update worked fine.</p></div>]]></description></item><item><title>Integrating the Silverlight SDK into Visual Studio’s MSDN Library</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=43</link><pubDate>Fri, 27 Jun 2008 08:48:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=43#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClassDE9BB7CB309742D785DE8E3A1174D5AA>
<p>If you use local MSDN rather than the internet-based version like I do <strong>and</strong> you are doing Silverlight work, here's how to integrate Silverlight's SDK into Visual Studio's local help. </p>
<ol>
<li>Open the Microsoft Visual Studio 2008 Documentation start menu item<br><br><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/062708_1545_Integrating1.png"><br></li>
<li>Go to the Index tab, and type in &quot;combined help&quot;, which should navigate you to the <em>combined Help collection [Visual Studio]</em>entry, and press enter<br><br><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/062708_1545_Integrating2.png"><br></li>
<li>Open the help topic opens, click on the last link named <em>Visual Studio Combined Help Collection Manager</em><br><br><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/062708_1545_Integrating3.png"><br></li>
<li>At this point, you should see a list similar to what you see below. Pick the SDKs you'd like to integrate, then press the <em>Update VSCC</em> button.<br><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/062708_1545_Integrating4.png"> </li></ol>
<p>Once you press the Update VSCC button, you'll be prompted to close the documentation and Visual Studio. The next time you open the documentation, it will spends <strong>several minutes</strong> integrating the SDK. Once the integration is complete, when you navigate to a class common to .NET and Silverlight, you'll be able to select which SDK you want to navigate to: </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/062708_1545_Integrating5.png"> </p>
<p>For Silverlight, you'll want to select the <strong><em>dv_silverltmref</em></strong> location. </p>
<p>Good luck!</p></div>]]></description></item><item><title>Thoughts on the Entity Framework Vote of No Confidence</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=12</link><pubDate>Mon, 23 Jun 2008 14:55:00 GMT</pubDate><slash:comments>7</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=12#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClass42C5B969F4534D82B82C1EAC89F441D3>
<p>I'm far from an expert on Microsoft's Entity Framework (EF), but I have dabbled a bit with betas 2 and 3. Recently, <a href="http://blogs.vertigo.com/personal/bellis/Blog/Lists/Posts/Post.aspx?ID=30">Brian Ellis</a>, a colleague of mine, summarized the points made in an <a href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/">open letter claiming a &quot;vote of no confidence&quot;</a> in the Entity Framework. I'm no ORM guru or EF junkie, but I know enough about EF to see that it has both potential and limitations. I'd like to share my thoughts on the letter. </p>
<p>To be fair, I've never used NHibernate (the Holy Grail), and work primarily with Microsoft technology. That doesn't make me an EF evangelist. I'm still quite skeptical, but interested in understanding the value of the technology. </p>
<p>Before getting into the issues mentioned in the open letter, I would like to add a few gripes of my own: </p>
<ul>
<li>The design surface is not feasible for maintaining hundreds of entities. </li>
<li>The mapping seems to be brittle when using the designer for custom entities, including the refresh from schema feature. </li>
<li>The designer forces the developer to refresh from schema in certain cases, when perhaps she doesn't want to. </li>
<li>Generated code in an entity data model does not represent self-referencing schema very well (for instance, an Employee that inherits from Person, which has a Manager property that also inherits from Person). Customizations required to work around the issue are hard to maintain. </li></ul>
<p>I'm sure the more I use it, the more gripes I'll have, but for now let's get to the gripes of the open letter. </p>
<p> </p>
<p><strong>INORDINATE FOCUS [ON] THE DATA ASPECT OF ENTITIES LEADS TO DEGRADED ENTITY ARCHITECTURES </strong></p>
<p>Regarding the point that entities are tied too closely to schema, I believe this is often true, but only because unmodified, generated code is the simplest and most common way to build an entity model—straight from schema. They don't have to be, however. From my understanding, a decent amount of flexibility is provided for structuring entities and their relationships, included multiple inheritance patterns, and the ability to group mapped columns into complex object properties. </p>
<p>(For instance, a Person table may contain several columns related to addresses. You could create a complex type called Address that a Person entity uses, and map the properties of the Address property to the columns in the Person table. No Address table is required in the data store, just proper mapping.) I'm sure, however, that many entity models would be very difficult, or impossible, to map using EF. </p>
<p>Regarding the point that entities are data-centric, rather than behavior-centric, I might not fully understand the complaint. The authors make no mention of the fact that the entities are partial classes with full exposure to the EF's data access gateway, allowing custom business and data access logic to be attached to each entity. (They do mention the partial class architecture in the &quot;persistence ignorant&quot; section, but only to complain of its &quot;awkwardness.&quot;) It seems to me that custom entities could be designed with behavior in mind. </p>
<p><strong>EXCESS CODE NEEDED TO DEAL WITH LACK OF LAZY LOADING </strong></p>
<p>EF supports deferred loading, but requires the developer to understand when any related entities (&quot;navigation properties&quot;) are loaded, rather than automatically fetching &amp; load-tracking when referenced. It's true, this causes the developer to ask IsLoaded() of an entity's navigation properties, and then conditionally Load(). You can also eagerly fetch navigation properties when fetching the parent by using the .Include() method, but this is pretty much the opposite of lazy loading. It sounds like the authors of the letter do not want developers to need to understand when or if a property has already been loaded. I don't really have an opinion on this since this requirement hasn't given me enough heartburn to gripe about it. </p>
<p><strong>SHARED, CANONICAL MODEL CONTRADICTS SOFTWARE BEST PRACTICES </strong></p>
<p>If I understand correctly, the authors of the letter are proponents of separate models per application tied to a single data store, rather than a single, canonical, model shared by multiple applications. This seems fully feasible with EF—there's no reason multiple models could not represent and access the same data store. Am I missing something? </p>
<p>Even better in certain cases, it seems possible with EF to place all core, sharable logic in a shared entity model, and have application-specific logic in each application that consumes the model. This architecture would probably break the partial class pattern of putting the logic directly in the entity, but if the logic is application-specific, I don't think it belongs there anyway. This could be handled with a more classically-tiered approach using service layers or business layers in consuming applications. </p>
<p><strong>LACK OF PERSISTENCE IGNORANCE CAUSES BUSINESS LOGIC TO BE HARDER TO READ, WRITE, AND MODIFY, CAUSING DEVELOPMENT AND MAINTENANCE COSTS TO INCREASE AT AN EXAGGERATED RATE </strong></p>
<p>I think this is a little misleading, because the entities themselves are persistence-ignorant, but obviously the mapping configuration cannot be. Perhaps I'm missing something, but that seems to be the nature of ORM. In order to connect an entity data model to two completely different data stores (in schema, technology, etc.), you would have to take great care in creating two separate mapping configurations to ensure they provide equivalent mapping. Even then, you are limited by the differences in what the two data stores support. For instance, you can't expect an XML file to support cascading deletes or other features that SQL Server provides. However, if we ignore the differences in the features of data store technologies and focus solely on mapping, I believe the EF supports persistence-ignorant consumption of entities, allowing for unit testing, data migration, etc. </p>
<p><strong>EXCESSIVE MERGE CONFLICTS WITH SOURCE CONTROL IN TEAM ENVIRONMENTS </strong></p>
<p>This wouldn't surprise me, but I have no experience with EF in source control. </p>
<p> </p>
<p>In summary, I feel like the open letter attempts to make some good points, but doesn't do much to back them up. It also seems that certain features of EF are glossed over, or perhaps EF is just not enough like NHibernate for those that wish it was. I'm not an EF evangelist, and I'm sure when it's finally released it will stir up a lot of complaints (by me, included), but this letter smells a bit like alt.net vs. MSFT to me. </p>
<p> </p>
<p> </p></div>]]></description></item><item><title>Photos, Iron Maiden</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=28</link><pubDate>Thu, 12 Jun 2008 09:43:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=28#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassEDA5F4CA95684CF693E9BAC186428679><font face="Helvetica, Arial, sans-serif">I saw Iron
Maiden recently, here are some <a href="http://www.flickr.com/photos/lostsprings/sets/72157605200240047/">photos</a>
if you are interested.<br>
<br>
<a href="http://www.flickr.com/photos/lostsprings/sets/72157605200240047/"><img alt=image src="http://farm3.static.flickr.com/2004/2513688771_a69e843219_m.jpg" border=0 height=240 width=183></a><br>
</font>
</div>]]></description></item><item><title>C++ Library v. .NET Framework</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=23</link><pubDate>Wed, 11 Jun 2008 22:31:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=23#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass56834674838345B981F32E6E674EF716>
<p>I am still a die-hard C++ programmer. I don't call myself an expert (<a href="http://www.merriam-webster.com/dictionary/journeyman">journeyman</a>, perhaps); it's a huge and complex language. Put another way, it gives you enough rope to shoot yourself in the foot. Nowadays, I program primarily in C#. For the longest time, I still did significant recreational programming in C++ because I liked the power of the language and the C++ standard library, most notably the <a href="http://en.wikipedia.org/wiki/Standard_Template_Library">STL</a>, which the .NET framework had not yet matched.</p>
<p>With .NET 2.0 and 3.x, that's changed. While I'm sure there are tasks more well suited for C and C++ (e.g. operating systems), I find myself doing much less of my recreational programming in C++. What really did it for me was the introduction of generics, introduced in .NET 2.0. Not so much that generic programming became possible, but rather the implementations of many of the same concepts found in the STL: containers, iterators, algorithms, and functors.</p>
<p>Iterators and functors previously existed in .NET in the forms of <a href="http://msdn.microsoft.com/en-us/library/system.collections.ienumerable.aspx">IEnumerable</a> and <a href="http://msdn.microsoft.com/en-us/library/system.delegate.aspx">delegates</a>, respectively. They're more powerful now with <a href="http://msdn.microsoft.com/en-us/library/9eekhta0.aspx">IEnumerable&lt;T&gt;</a> and <a href="http://msdn.microsoft.com/en-us/library/0yw3tz5k.aspx">anonymous methods</a>. Those are interesting but the most interesting to me are the containers. Here is a list of the STL containers and the .NET equivalents. I also listed the STL insert complexity.</p>
<table cellspacing=0 cellpadding=5 border=1>
<tbody>
<tr>
<th rowspan=2>Type</th>
<th rowspan=2>STL</th>
<th colspan=3>Insert complexity</th>
<th rowspan=2>.NET</th></tr>
<tr>
<th>at front</th>
<th>at back</th>
<th>in the middle</th></tr>
<tr>
<td rowspan=3>sequence containers </td>
<td><a href="http://en.wikipedia.org/wiki/Vector_%2528STL%2529">vector</a> </td>
<td align=middle>O(N)</td>
<td align=middle>O(1)</td>
<td align=middle>O(N)</td>
<td><a href="http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx">List</a></td></tr>
<tr>
<td><a href="http://en.wikipedia.org/wiki/Deque">deque</a> </td>
<td align=middle>O(1)</td>
<td align=middle>O(1)</td>
<td align=middle>O(N)</td>
<td><a href="http://msdn.microsoft.com/en-us/library/7977ey2c.aspx">Queue</a></td></tr>
<tr>
<td><a href="http://en.wikipedia.org/wiki/Doubly_linked_list">list</a> </td>
<td align=middle>O(1)</td>
<td align=middle>O(1)</td>
<td align=middle>O(1)</td>
<td><a href="http://msdn.microsoft.com/en-us/library/he2s3bh7.aspx">LinkedList</a></td></tr>
<tr>
<td rowspan=4>associative containers </td>
<td><a href="http://en.wikipedia.org/wiki/Set_%2528computer_science%2529">set</a></td>
<td align=middle colspan=3>O(log N)</td>
<td><a href="http://msdn.microsoft.com/en-us/library/bb359438.aspx">HashSet</a></td></tr>
<tr>
<td>multiset</td>
<td align=middle colspan=3>O(log N)</td>
<td>N/A<sup>1</sup></td></tr>
<tr>
<td><a href="http://en.wikipedia.org/wiki/Map_%2528C%252B%252B_container%2529">map</a></td>
<td align=middle colspan=3>O(log N)</td>
<td><a href="http://msdn.microsoft.com/en-us/library/xfhwa508.aspx">Dictionary</a></td></tr>
<tr>
<td>multimap</td>
<td align=middle colspan=3>O(log N)</td>
<td>N/A<sup>1</sup></td></tr></tbody></table>
<p style="font-size:smaller"><sup>1</sup> These are more difficult to construct since they allow duplicate keys. Perhaps use a Dictionary of Lists.</p>
<p>There are other containers but they're either more for special purposes (e.g. bitset and valarray) or not yet part of the standard (e.g. hash_set and unordered_map).</p>
<p>.NET 3.x, with LINQ and extension methods, gives us not only many of the functors but also something even more valuable: expressiveness and elegance. For instance, which is more readable? (These are adapted from <a href="http://aristeia.com/">Scott Meyers</a>' <a href="http://www.amazon.com/gp/product/0201749629?ie=UTF8&amp;tag=aristeia.com-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0201749629">Effective STL</a>, Item 47.)</p>
<h4>C++</h4>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas">vector&lt;<span style="color:#0000ff">int</span>&gt; v;<br><br><span style="color:#008000">// ... other statements here<br><br>// remove elements &lt; 100 except those preceding the last element &gt;= 2500<br></span>v.erase(<br>    remove_if(find_if(v.rbegin(), v.rend(), <br>        bind2nd(greater_equal&lt;<span style="color:#0000ff">int</span>&gt;(), <span style="color:#ff0000">2500</span>)).base(),<br>        v.end(), <br>        bind2nd(less&lt;<span style="color:#0000ff">int</span>&gt;(), <span style="color:#ff0000">100</span>)),<br>    v.end());</p></blockquote>
<h4>C#</h4>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas"><span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">int</span>&gt; v= <span style="color:#0000ff">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#0000ff">int</span>&gt;();<br><br><span style="color:#008000">// ... other statements here<br><br>// remove elements &lt; 100 except those preceding the last element &gt;= 2500<br></span>v = v.SkipWhile((i, n) =&gt; n &lt; <span style="color:#ff0000">100</span> &amp;&amp; i &gt;= v.Last(m =&gt; m &gt;= <span style="color:#ff0000">2500</span>)).ToList();</p></blockquote>
<p>I still like C++ and I understand the above statement and have written many like it (although I wasn't sure how to indent it since I prefer to break it up as he suggests in his book). I'm ignoring efficiency<sup>1</sup> and aliasing<sup>2</sup> here, but for readability, I side with C#.</p>
<p style="font-size:smaller"><sup>1</sup> The C++ code is likely to be more efficient, at least for primitive types such as int used here. For more complex classes with expensive copy constructors, the C# code is perhaps better since it deals with references, not values. C++ can certainly handle references (as pointers) but, in an unmanaged world, one must then contend with memory management.<br><sup>2</sup> The C++ code modifies the vector while the C# example creates a new list. That matters if other code has a reference to the original list. It's possible to construct a more complex C# expression or set of C# statements involving <a href="http://msdn.microsoft.com/en-us/library/wdka673a.aspx">RemoveAll</a> or <a href="http://msdn.microsoft.com/en-us/library/y33yd2b5.aspx">RemoveRange</a>.</p></div>]]></description></item><item><title>Detect Visual Studio Debugging</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=22</link><pubDate>Wed, 04 Jun 2008 20:29:00 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=22#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass79FC6236BEF140FE85D9783309B51843>
<p>If you have code that you want to run only while debugging in Visual Studio, you can detect it if you are running in its hosting process, which is enabled by default.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace"><span style="color:#0000ff">#if</span> DEBUG<br>    <span style="color:#0000ff">if</span>(<span style="color:#2b91af">AppDomain</span>.CurrentDomain.FriendlyName.EndsWith(<span style="color:#ff00ff">&quot;vshost.exe&quot;</span>))<br>    {<br>        <span style="color:#008000">// Perform whatever tasks depend on running inside the Visual<br></span>        <span style="color:#008000">// Studio debugger.<br></span>    }<br><span style="color:#0000ff">#endif<br></span></p></blockquote>
<p>While it does provide <a href="http://msdn.microsoft.com/en-us/library/ms242202.aspx">several features</a> not otherwise available, you might have a reason to <a href="http://msdn.microsoft.com/en-us/library/ms185330.aspx">disable it</a> (such as <a href="http://support.microsoft.com/kb/948764">a corrupted vshost.exe file</a>). To do so, uncheck the last box (shown checked here) on the Debug tab in the Project Properties window.</p><img alt="Project Properties - Debug" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/Detect%20Visual%20Studio%20Debugging.png"> </div>]]></description></item><item><title>Fun with GridSplitter</title><link>http://blogs.vertigo.com/personal/chrisv/Blog/Lists/Posts/Post.aspx?ID=5</link><pubDate>Wed, 04 Jun 2008 17:34:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/chrisv/Blog/Lists/Posts/Post.aspx?ID=5#Comments</comments><dc:creator>chrisv</dc:creator><description><![CDATA[<div class=ExternalClass5552A375B0FE4571B9508468D2626003>
<p>Another control I’ve been playing with is the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.gridsplitter.aspx">&lt;GridSplitter /&gt;</a>.  The grid splitter control allows a user to resize a column or row to their liking.</p>
<p>Below is a basic grid with two columns taking up the same amount of space. A gridsplitter is put on the right side of the first column to allow the user to resize it.</p><pre>   &lt;Grid&gt;
    &lt;Grid.RowDefinitions&gt;
      &lt;RowDefinition Height=&quot;*&quot;/&gt;
    &lt;/Grid.RowDefinitions&gt;
    &lt;Grid.ColumnDefinitions&gt;
      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;
      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;
    &lt;/Grid.ColumnDefinitions&gt;
    &lt;Rectangle Grid.Column=&quot;0&quot; Fill=&quot;Green&quot; /&gt;
    &lt;Rectangle Grid.Column=&quot;1&quot; Fill=&quot;Red&quot; /&gt;
    &lt;GridSplitter Grid.Column=&quot;0&quot; Width=&quot;5&quot; HorizontalAlignment=&quot;Right&quot; VerticalAlignment=&quot;Stretch&quot; Background=&quot;Black&quot; /&gt;
  &lt;/Grid&gt;</pre><br><a href="http://www.vigna.com/basicsplitter.html"><img alt="Click to go to a live demo." src="http://www.vigna.com/Images/basicsplitter.gif" border=0> </a><br><br>
<p>The gridsplitter control uses the HorizontalAlignment and VerticalAlignment properties to determine the movement direction. The <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.gridsplitter.aspx">MSDN article</a> has a nice table which describes the effect of the various property values:</p>
<table border=1>
<tbody>
<tr>
<td style="background-color:#c0c0c0" width=383>GridSplitter type</td>
<td style="background-color:#c0c0c0" width=215><a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.horizontalalignment.aspx">HorizontalAlignment</a> value</td>
<td style="background-color:#c0c0c0" width=215><a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.verticalalignment.aspx">VerticalAlignment</a> value</td></tr>
<tr>
<td>Resizes rows</td>
<td>Stretch</td>
<td>Top, Bottom, Center</td></tr>
<tr>
<td>Resizes columns</td>
<td>Left, Right, Center</td>
<td>Stretch </td></tr>
<tr>
<td width=383>If ActualHeight is greater than or equal to ActualWidth, this resizes the columns. If ActualHeight is less than ActualWidth, this resizes the rows.</td>
<td>Stretch</td>
<td>Stretch</td></tr></tbody></table><br><br>
<p>Here is a little more complex grid with three columns and two gridsplitters. Notice the gridsplitters are always put on the border of two columns. Splitters put on an outside border do nothing. </p><pre>   &lt;Grid&gt;
    &lt;Grid.RowDefinitions&gt;
      &lt;RowDefinition Height=&quot;*&quot;/&gt;
    &lt;/Grid.RowDefinitions&gt;
    &lt;Grid.ColumnDefinitions&gt;
      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;
      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;
      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;
    &lt;/Grid.ColumnDefinitions&gt;
    &lt;Rectangle Grid.Column=&quot;0&quot; Fill=&quot;Green&quot; /&gt;
    &lt;Rectangle Grid.Column=&quot;1&quot; Fill=&quot;White&quot; /&gt;
    &lt;Rectangle Grid.Column=&quot;2&quot; Fill=&quot;Red&quot; /&gt;
    &lt;GridSplitter Grid.Column=&quot;0&quot; Width=&quot;5&quot; HorizontalAlignment=&quot;Right&quot; VerticalAlignment=&quot;Stretch&quot; Background=&quot;Black&quot; /&gt;
    &lt;GridSplitter Grid.Column=&quot;2&quot; Width=&quot;5&quot; HorizontalAlignment=&quot;Left&quot; VerticalAlignment=&quot;Stretch&quot; Background=&quot;Black&quot; /&gt;
  &lt;/Grid&gt;</pre><br><a href="http://www.vigna.com/splitterout.html"><img alt="Click to go to a live demo." src="http://www.vigna.com/Images/splitterout.gif" border=0> </a><br><br>
<p>The gridsplitters can also be put on opposite side of the center column for nearly the same effect. There are two differences when used this way. First, the space taken by the gridsplitters are inside the center column and secondly, the gridsplitters fully overlap when move moved all the way over. </p><pre>   &lt;Grid&gt;
    &lt;Grid.RowDefinitions&gt;
      &lt;RowDefinition Height=&quot;*&quot;/&gt;
    &lt;/Grid.RowDefinitions&gt;
    &lt;Grid.ColumnDefinitions&gt;
      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;
      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;
      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;
    &lt;/Grid.ColumnDefinitions&gt;
    &lt;Rectangle Grid.Column=&quot;0&quot; Fill=&quot;Green&quot; /&gt;
    &lt;Rectangle Grid.Column=&quot;1&quot; Fill=&quot;White&quot; /&gt;
    &lt;Rectangle Grid.Column=&quot;2&quot; Fill=&quot;Red&quot; /&gt;
    &lt;GridSplitter Grid.Column=&quot;1&quot; Width=&quot;5&quot; HorizontalAlignment=&quot;Left&quot; VerticalAlignment=&quot;Stretch&quot; Background=&quot;Black&quot; /&gt;
    &lt;GridSplitter Grid.Column=&quot;1&quot; Width=&quot;5&quot; HorizontalAlignment=&quot;Right&quot; VerticalAlignment=&quot;Stretch&quot; Background=&quot;Black&quot; /&gt;
  &lt;/Grid&gt;</pre><br><a href="http://www.vigna.com/splitterin.html"><img alt="Click to go to a live demo." src="http://www.vigna.com/Images/splitterin.gif" border=0> </a><br><br>
<p>That is the basics of using gridsplitters. I’ll have some more advanced use of these controls in my next post.</p></div>]]></description></item><item><title>Vertigo TechEd 2008 Buzzage</title><link>http://blogs.vertigo.com/personal/blake/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Wed, 04 Jun 2008 11:53:24 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/blake/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>blake</dc:creator><description><![CDATA[<div class=ExternalClass76391B2BE9ED4685B33994D0AB3C97A5><p>This showed up in my vanity alerts yesterday. Bill Gates and Scott were quoted in the same article about TechEd North America.
</p><p><a href="http://www.crn.com/software/208401855">http://www.crn.com/software/208401855</a>
	</p><p>
 </p></div>]]></description></item><item><title>The nil attribute in XML-serialized nullable values</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=20</link><pubDate>Wed, 28 May 2008 19:57:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=20#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass30BA46BFBB3F44CEBCDC148ABE9EA5EA>
<p>If in a class you have a <a href="http://msdn.microsoft.com/en-us/library/system.valuetype.aspx">value type</a> property that is optional, it's common to specify it as <a href="http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx">nullable</a>. However, if you <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.aspx">serialize</a> a nullable value type property to XML, you'll get something like this if it's null.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Value</span><span style="color:#0000ff"> </span><span style="color:#ff0000">xsi:nil</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">true</span>&quot; <span style="color:#0000ff">/&gt;</span></p></blockquote>
<p>Or, if you <a href="http://blogs.vertigo.com/personal/chris/Blog/Lists/Posts/ViewPost.aspx?ID=21">turned off declaration of the XML schema instance namespace</a>, it will be even more verbose.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace"><span style="color:#0000ff">&lt;</span><span style="color:#a31515">Value</span><span style="color:#0000ff"> </span><span style="color:#ff0000">p2:nil</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">true</span>&quot;<span style="color:#0000ff"> </span><span style="color:#ff0000">xmlns:p2</span><span style="color:#0000ff">=</span>&quot;<span style="color:#0000ff">http://www.w3.org/2001/XMLSchema-instance</span>&quot;<span style="color:#0000ff"> /&gt;</span></p></blockquote>
<p>This might look strange but it will properly deserialize. Nonetheless, you might have a reason to have a nullable value type property serialize the way a class property does, which is to not appear in the XML output at all if it's null. Setting the IsNullable property of the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlelementattribute.aspx">XmlElement attribute</a> for such a property will have no effect. (Well, setting it to false will result in a run-time error.)</p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlelementattribute.isnullable.aspx">XmlElementAttribute.IsNullable Property</a> page at <a href="http://msdn.microsoft.com/">MSDN</a> has this to say.</p>
<blockquote dir=ltr style="margin-right:0px">
<p>You cannot apply the <strong>IsNullable</strong> property to a member typed as a value type because a value type cannot contain <strong>null</strong>. Additionally, you cannot set this property to <strong>false</strong> for nullable value types. When such types are <strong>null</strong>, they will be serialized by setting <strong>xsi:nil</strong> to <strong>true</strong>.</p></blockquote>
<p>One work-around is to declare another property that is a class type, such as string, and parse it in the nullable value property.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace">[<span style="color:#2b91af">XmlElement</span>(<span style="color:#ff00ff">&quot;Value&quot;</span>)]<br><span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> ValueString { <span style="color:#0000ff">get</span>; <span style="color:#0000ff">set</span>; }<br><br>[<span style="color:#2b91af">XmlIgnore</span>]<br><span style="color:#0000ff">public</span> <span style="color:#0000ff">int</span>? Value<br>{<br>    <span style="color:#0000ff">get</span> { <span style="color:#0000ff">return</span> <span style="color:#0000ff">int</span>.Parse(ValueString); }<br>    <span style="color:#0000ff">set</span> { ValueString= <span style="color:#0000ff">value</span>.ToString(); }<br>}</p></blockquote>
<p>Of course, you can go in the opposite direction as well.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace">[<span style="color:#2b91af">XmlElement</span>(<span style="color:#ff00ff">&quot;Value&quot;</span>)]<br><span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> ValueString<br>{<br>    <span style="color:#0000ff">get</span> { <span style="color:#0000ff">return</span> Value.HasValue ? Value.Value.ToString() : <span style="color:#0000ff">null</span>; }<br>    <span style="color:#0000ff">set</span><br>    {<br>        <span style="color:#0000ff">if</span>(<span style="color:#0000ff">value</span> != <span style="color:#0000ff">null</span>)<br>            Value= <span style="color:#0000ff">int</span>.Parse(<span style="color:#0000ff">value</span>);<br>        <span style="color:#0000ff">else</span><br>            Value= <span style="color:#0000ff">null</span>;<br>    }<br>}<br><br>[<span style="color:#2b91af">XmlIgnore</span>]<br><span style="color:#0000ff">public</span> <span style="color:#0000ff">int</span>? Value { <span style="color:#0000ff">get</span>; <span style="color:#0000ff">set</span>; }<br></p></blockquote></div>]]></description></item><item><title>Learning about Grid</title><link>http://blogs.vertigo.com/personal/chrisv/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Wed, 28 May 2008 16:56:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/chrisv/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>chrisv</dc:creator><description><![CDATA[<div class=ExternalClass2F83E7B0C6E74996BA7CC58FE6657E7B>
<p>I've been playing with XAML a little bit lately, both the Silverlight and WPF flavors, and thought I would discuss some of the things I learned about the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.grid.aspx">&lt;Grid /&gt;</a> control and a few of the concepts I had issues with. </p>
<p>The first concept I had to grasp was the fact that &lt;Grid /&gt; is a visual layout control. It has nothing to do with data. This reminds me of the good ol' days when I was allowed to use tables to layout my HTML pages. I actually had to convince myself this is a good thing. Microsoft designed it for layout so I should use it for layout. </p>
<p>When you start adding rows and columns to a test grid you will find that the first row or column is 0 not 1. From a layout standpoint the first row or column should be 1, but if you look from the development side the RowDefinitions and ColumnsDefinitions properties are collections where the first index is 0. Looks like designers will have to get used to 0 based indexing, but I'm a dev so it's fine by me. </p>
<p>There are three ways to size a row or column of a grid. </p>
<ol>
<li>Give a hard size. This can be data bound also, but it's basically giving a hard number. </li>
<li>&quot;Auto&quot;. The row or column takes on the size of its content. </li>
<li>&quot;N*&quot; (Star sizing). The new wonder of the development world. Takes up the space not used by the auto or hard sizing and splits it between all of the star sized rows or columns. </li></ol>
<p>Auto and hard sizing are easy concepts, but star sizing threw me for a loop for a bit. The way I understand star sizing comes down to being a number of units of remaining space. You just need to add up the number of stars to determine the number of units of remaining space.<br></p>
<p>For example, in the following grid the first row will take up a set size. Now for the remaining space there are 2 star rows so there are 2 units of remaining space. Therefore, the second and third rows will each take up half of the remaining space. </p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">&lt;</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">    &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;Auto&quot;/&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">    &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;*&quot;/&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">    &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;*&quot;/&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span></p>
<p>In this example there are 2 star rows but one uses 2 stars so there are 3 units of remaining space. So the first row takes up two thirds and second row gets one third of the remaining space. </p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">&lt;</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">    &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;2*&quot;/&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">    &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;*&quot;/&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span></p>
<p>Another example I've seen is below. It makes it a little clearer to the reader that each of the rows is going to take up 50% of the remaining space. </p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">&lt;</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">    &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;50*&quot;/&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">    &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;50*&quot;/&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span></p>
<p>Just remember star sizes use the remaining space so having a lot of auto or hard sized rows or columns can leave you with very little space to split up. </p>
<p> </p>
<p> </p>
<p>Here are a couple of notes and things I don't want to forget: </p>
<p>This will make a nice base which will resize itself whenever the user changes the window size: </p><pre><p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">&lt;</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">    &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:red"> Height</span><span style="color:blue">=&quot;*&quot;/&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;</span><span style="color:#a31515">Grid.ColumnDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">    &lt;</span><span style="color:#a31515">ColumnDefinition</span><span style="color:red"> Width</span><span style="color:blue">=&quot;*&quot;/&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">  &lt;/</span><span style="color:#a31515">Grid.ColumnDefinitions</span><span style="color:blue">&gt; </span></span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="color:#a31515"></span><span style="color:blue">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt;</span></span> </p></pre>
<p>To put a control in row 0  and column 1 from XAML use the following:</p><font color="#0000ff" size=2>
<p>&lt;</font><font color="#a31515" size=2>Rectangle</font><font color="#ff0000" size=2> </font><font color="#ff0000" size=2>Grid.Row</font><font color="#0000ff" size=2>=&quot;0&quot; <font color="#ff0000" size=2>Grid.Column</font><font color="#0000ff" size=2>=&quot;1&quot;</font> /&gt;</p></font>
<p>To put a control in row 0 and column 1 from code use the following: </p>
<p><span style="font-size:10pt;font-family:Courier New">myControl.SetValue(<span style="color:#2b91af">Grid</span>.RowProperty, 0);</span></p>
<p><span style="font-size:10pt;font-family:Courier New"><span style="font-size:10pt;font-family:Courier New">myControl.SetValue(<span style="color:#2b91af">Grid</span>.ColumnProperty, 1);</span> </span></p>
<p><span style="font-size:10pt;font-family:Courier New">myGrid.Children.Add(myControl)</span></p></div>]]></description></item><item><title>Toad home</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=27</link><pubDate>Fri, 23 May 2008 11:44:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=27#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass417502CB65E5401B9C38566C16334C9B><font face="Helvetica, Arial, sans-serif">I propagate a
lot of plants. Some toads have decided my seedling pots make nice
resting spots... I found 3 toads in separate pots.<br>
<br>
<img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/toad-pot.jpg" height=281 width=300></font>
</div>]]></description></item><item><title>Removing the XML schema and instance namespace declarations</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=21</link><pubDate>Wed, 21 May 2008 19:20:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=21#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass4ADEC627BC25479F8D2E0B7C3C23EA95>
<p>To remove the declarations of the XML schema (xsd) and schema instance (xsi) namespaces from the output file of XML-serialized objects, create an <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializernamespaces.aspx">XmlSerializerNamespaces</a> object and add an empty namespace to it.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace"><span style="color:#2b91af">XmlSerializerNamespaces</span> ns = <span style="color:#0000ff">new</span> <span style="color:#2b91af">XmlSerializerNamespaces</span>();<br>ns.Add(<span style="color:#ff00ff">&quot;&quot;</span>, <span style="color:#ff00ff">&quot;&quot;</span>); <span style="color:#008000">// Remove the unnecessary xmlns:xsi and xmlns:xsd namespaces.</span></p></blockquote>
<p>Use it in the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.serialize.aspx">XmlSerializer.Serialize</a> method invocation.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace">s.Serialize(writer, o, ns);</p></blockquote>
<p>Interestingly, the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializernamespaces.aspx">XmlSerializerNamespaces Class</a> page at MSDN has a note about this:</p>
<p style="margin-left:2em"><cite>The creation of an empty namespace and prefix pair is not supported. That is, you cannot create a pair using the following code:</cite></p>
<p>It refers to the Add invocation above.</p></div>]]></description></item><item><title>Call Silverlight from JavaScript, call JavaScript from Silverlight</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=26</link><pubDate>Thu, 15 May 2008 10:35:00 GMT</pubDate><slash:comments>8</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=26#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassBB841FEE6ABD41B9B5F532D1204AF939><font face="Helvetica, Arial, sans-serif">The following
demonstrates how to call JavaScript from Silverlight managed code, and
Silverlight managed code
from
JavaScript. Note this is using a beta
version of Silverlight which can (and probably will) change in the
future.<br>
<br>
The main points are...<br>
<br>
In the JavaScript code:<br>
</font>
<ul>
  <li><font face="Helvetica, Arial, sans-serif">Use <b>document.getElementById</b>
to get the Silverlight control.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Then
call Content.&lt;registered name&gt;.&lt;method
name&gt;. For example, <b>control.Content.Page.UpdateText(text)</b>.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Nothing
special for the functions that are called from Silverlight.<br>
    </font></li>
</ul>
<font face="Helvetica, Arial, sans-serif">In the
Silverlight code:<br>
</font>
<ul>
  <li><font face="Helvetica, Arial, sans-serif">Mark
the class with the <b>ScriptableType</b> attribute.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Call
    <b>HtmlPage.RegisterScriptableObject</b> in the
constructor.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Mark
any methods that will be called from JavaScript with <b>ScriptableMember</b>.</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Use <b>HtmlPage.Window.Invoke</b>
to call JavaScript functions.</font></li>
</ul>
<font face="Helvetica, Arial, sans-serif">Here are more
detailed steps to call JavaScript and Silverlight code.<br>
<br>
<small><b><big><big>Call Silverlight method
from
JavaScript</big></big></b></small><br>
<br>
1) Add XAML elements to the Silverlight control. This displays
the string passed in from JavaScript.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">&lt;</font><font color="#a31515">StackPanel</font><font color="#ff0000"> VerticalAlignment</font><font color="#0000ff">=&quot;Top&quot;</font><font color="#ff0000"> Orientation</font><font color="#0000ff">=&quot;Horizontal&quot;&gt;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#a31515">  </font><font color="#0000ff">&lt;</font><font color="#a31515">TextBox</font><font color="#ff0000"> x</font><font color="#0000ff">:</font><font color="#ff0000">Name</font><font color="#0000ff">=&quot;Result&quot;</font><font color="#ff0000"> HorizontalAlignment</font><font color="#0000ff">=&quot;Stretch&quot;</font><font color="#ff0000"> Width</font><font color="#0000ff">=&quot;200&quot;</font><font color="#ff0000"> Height</font><font color="#0000ff">=&quot;24&quot; /&gt;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#0000ff">&lt;/</font><font color="#a31515">StackPanel</font><font color="#0000ff">&gt;</font>
  </font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">2) Make the
object accessible to JavaScript by specifying the <b>ScriptableType</b>
attribute and calling <b>RegisterScriptableObject</b>.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><font color="#000000">[</font><font color="#2b91af">ScriptableType</font><font color="#000000">]</font></font><br>
  <font color="#999999" face="Helvetica, Arial, sans-serif">public partial class Page : UserControl</font><font color="#999999"><br>
  </font><font color="#999999" face="Helvetica, Arial, sans-serif">{</font><font color="#999999"><br>
  </font><font color="#999999" face="Helvetica, Arial, sans-serif">    public Page()</font><font color="#999999"><br>
  </font><font color="#999999" face="Helvetica, Arial, sans-serif">    {</font><font color="#999999"><br>
  </font><font color="#999999" face="Helvetica, Arial, sans-serif">        InitializeComponent();</font><font color="#999999"><br>
  <br>
  </font>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">        </font><font color="#008000">// make this object a scriptable object</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">        </font><font color="#2b91af">HtmlPage</font><font color="#000000">.RegisterScriptableObject(</font><font color="#a31515">&quot;Page&quot;</font><font color="#000000">, </font><font color="#0000ff">this</font><font color="#000000">);            </font></font><br>
  <font color="#999999" face="Helvetica, Arial, sans-serif">    }</font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">3) Add the
method that is
called from JavaScript and specify the <b>ScriptableMember</b>
attribute.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><font color="#008000">// called from javascript</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">[</font><font color="#2b91af">ScriptableMember</font><font color="#000000">]</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#0000ff">public</font><font color="#000000"> </font><font color="#0000ff">void</font><font color="#000000"> UpdateText(</font><font color="#0000ff">string</font><font color="#000000"> result)</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#0000ff">this</font><font color="#000000">.Result.Text = result;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">}</font></font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">
4) Add HTML elements to the web page.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><font color="#008000">&lt;!-- html area, click on the link to send data to
the Silverlight control --&gt;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#0000ff">&lt;</font><font color="#a31515">input</font><font color="#000000"> </font><font color="#ff0000">id</font><font color="#0000ff">=&quot;result&quot;</font><font color="#000000"> </font><font color="#ff0000">type</font><font color="#0000ff">=&quot;text&quot;</font><font color="#000000"> </font><font color="#ff0000">size</font><font color="#0000ff">=&quot;30&quot;</font><font color="#000000"> </font><font color="#0000ff">/&gt;</font><font color="#ff0000">&amp;nbsp;&amp;nbsp;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#0000ff">&lt;</font><font color="#a31515">a</font><font color="#000000"> </font><font color="#ff0000">href</font><font color="#0000ff">=&quot;javascript:updateSilverlight();&quot;&gt;</font><font color="#000000">Update Silverlight</font><font color="#0000ff">&lt;/</font><font color="#a31515">a</font><font color="#0000ff">&gt;</font></font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">
5) Update the ID for the Silverlight control. This is not necessary,
but you might want to use something besides the default <i>XAML1</i>.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">&lt;</font><font color="#a31515">asp</font><font color="#0000ff">:</font><font color="#a31515">Silverlight</font><font color="#000000"> </font><font color="#ff0000">ID</font><font color="#0000ff">=&quot;silverlightControl&quot; ...</font><font color="#000000"> </font><font color="#0000ff">/&gt;</font></font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">6)
Add the JavaScript function that
calls the Silverlight managed code method.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">function</font><font color="#000000"> updateSilverlight()</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// get data from html control</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#0000ff">var</font><font color="#000000"> text = document.getElementById(</font><font color="#a31515">&quot;result&quot;</font><font color="#000000">).value;</font></font><br>
  <br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// call silverlight control
method</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#0000ff">var</font><font color="#000000"> control = document.getElementById(</font><font color="#a31515">&quot;silverlightControl&quot;</font><font color="#000000">);</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    control.Content.Page.UpdateText(text);</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">}</font>
  </font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">Now you can run
the application. Enter some text in the HTML textbox
and press the <b>Update Silverlight</b> link. The
JavaScript function
<b>updateSilverlight</b> is executed which calls the
managed code <b>UpdateText</b>
method.<br>
<br>
<img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/silverlight-javascript-02.png" height=131 width=358><br>
<br>
<br>
<b><big>Call JavaScript function from Silverlight</big></b><br>
<br>
</font><font face="Helvetica, Arial, sans-serif">1)
Add the
JavaScript function that will be called.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><font color="#008000">// called from silverlight</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#008000"></font><font color="#0000ff">function</font><font color="#000000"> updateText(text)</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    document.getElementById(</font><font color="#a31515">&quot;result&quot;</font><font color="#000000">).value = text;</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">} </font></font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif"></font><font face="Helvetica, Arial, sans-serif">2) Add a button element
to the XAML.<br>
</font>
<blockquote><font color="#999999" face="Helvetica, Arial, sans-serif">&lt;StackPanel VerticalAlignment=&quot;Top&quot; Orientation=&quot;Horizontal&quot;&gt;</font><font color="#999999"><br>
  </font><font color="#999999" face="Helvetica, Arial, sans-serif">  &lt;TextBox x:Name=&quot;Result&quot; HorizontalAlignment=&quot;Stretch&quot; Width=&quot;200&quot; Height=&quot;24&quot; /&gt;</font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#a31515">  </font><font color="#0000ff">&lt;</font><font color="#a31515">Button</font><font color="#ff0000"> x</font><font color="#0000ff">:</font><font color="#ff0000">Name</font><font color="#0000ff">=&quot;CallJavaScript&quot;</font><font color="#ff0000"> Content</font><font color="#0000ff">=&quot;Update JavaScript&quot;</font><font color="#ff0000"> <br>
     Width</font><font color="#0000ff">=&quot;130&quot;</font><font color="#ff0000"> Height</font><font color="#0000ff">=&quot;24&quot;</font><font color="#ff0000"> Margin</font><font color="#0000ff">=&quot;10,0,0,0&quot;</font><font color="#ff0000"> Click</font><font color="#0000ff">=&quot;CallJavaScript_Click&quot; /&gt;</font></font><br>
  <font color="#999999" face="Helvetica, Arial, sans-serif">&lt;/StackPanel&gt;
  </font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">3) Implement the
click handler in the code-behind file.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><font color="#0000ff">private</font><font color="#000000"> </font><font color="#0000ff">void</font><font color="#000000"> CallJavaScript_Click(</font><font color="#0000ff">object</font><font color="#000000"> sender, </font><font color="#2b91af">RoutedEventArgs</font><font color="#000000"> e)</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">{</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#008000">// call the javascript function</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">    </font><font color="#2b91af">HtmlPage</font><font color="#000000">.Window.Invoke(</font><font color="#a31515">&quot;updateText&quot;</font><font color="#000000">, </font><font color="#0000ff">this</font><font color="#000000">.Result.Text);</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">}</font>
  </font><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">Now run the
application again. Enter some text in the Silverlight
textbox and click the <b>Update JavaScript</b> button. The
click handler is
executed which uses the <b>HtmlPage.Window.Inovke</b>
method to execute the
JavaScript <b>updateText </b>function.<br>
<br>
<img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/silverlight-javascript-01.png" height=131 width=358><br>
<br>
</font>
</div>]]></description></item><item><title>XML-serializing a derived collection</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=18</link><pubDate>Wed, 14 May 2008 17:27:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=18#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClassEB50D1ED6E824EDE9BF41E398969ADFB>
<p>A class derived from a collection class will XML-serialize only the collection, not any additional properties in your derived class.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace"><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">NamedNodeList</span> : <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Node</span>&gt;<br>{<br>    <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> Name { <span style="color:#0000ff">get</span>; <span style="color:#0000ff">set</span>; } <span style="color:#008000">// ignored during XML serialization<br></span>}</p></blockquote>
<p>The work-around is to use containment instead of derivation.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace"><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> <span style="color:#2b91af">NamedNodeList<br></span>{<br>    <span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> Name { <span style="color:#0000ff">get</span>; <span style="color:#0000ff">set</span>; }<br>    <span style="color:#0000ff">public</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Node</span>&gt; Nodes { <span style="color:#0000ff">get</span>; <span style="color:#0000ff">set</span>; }<br>}</p></blockquote>
<p>This works except you will get an additional wrapping element around the collection. To get rid of this wrapper, use the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlelementattribute.aspx">XmlElement</a> attribute on the collection property.</p>
<blockquote dir=ltr style="margin-right:0px">
<p style="font-family:Consolas, monospace">[<font color="#2b91af">XmlElement</font>]<br><font color="#0000ff">public</font> <font color="#2b91af">List</font>&lt;<font color="#2b91af">Node</font>&gt; Nodes { <font color="#0000ff">get</font>; <font color="#0000ff">set</font>; }</p></blockquote>
<p>In fact, applying the XmlElement attribute to any collection member in any context (not just the derivation context here) will give you a collection not surrounded by a containing element.</p></div>]]></description></item><item><title>Loading Resource Dictionaries from an External DLL</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=36</link><pubDate>Sun, 11 May 2008 18:25:37 GMT</pubDate><slash:comments>6</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=36#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass54FE08BD91834C9E830F7B4A324291CC><p><span style="color:green"></span></p> <p><span style="color:green"></span></p> <p>I had problems with the way skins were being referenced in <a href="http://code.google.com/p/wittytwitter/">Witty</a>. To solve it, I moved the skins into their own project and needed to load them dynamically. To reference the resources, I use the <a href="http://msdn.microsoft.com/en-us/library/aa970069.aspx">Pack URI scheme</a>.</p> <p>Typical you can load the skin resource dictionary with the following pack syntax.</p><pre class=code><span style="color:green">// Load the Resource Dictionary from an external referenced DLL
</span><span style="color:#2b91af">Uri </span>uri = <span style="color:blue">new </span><span style="color:#2b91af">Uri</span>(<span style="color:#a31515">&quot;pack://application:,,,/SkinResources;Component/RedSkin.xaml&quot;</span>);
<span style="color:#2b91af">Application</span>.Current.Resources.Source = uri;</pre><pre class=code>However, I had problems with the previous code in Witty and changed it to:</pre><pre class=code><span style="color:green">// Alternate way to load the resource dictionary from an external referenced DLL
</span><span style="color:#2b91af">Uri </span>resourceLocator = <span style="color:blue">new </span><span style="color:#2b91af">Uri</span>(<span style="color:#a31515">&quot;SkinResources;Component/GreenSkin.xaml&quot;</span>, <span style="color:#2b91af">UriKind</span>.RelativeOrAbsolute);
<span style="color:#2b91af">Application</span>.Current.Resources = <span style="color:#2b91af">Application</span>.LoadComponent(resourceLocator) <span style="color:blue">as </span><span style="color:#2b91af">ResourceDictionary</span>;</pre>
<p>Here's how to refer to the skin resource from XAML.</p><pre class=code><span style="color:blue">&lt;</span><span style="color:#a31515">Application.Resources</span><span style="color:blue">&gt;
  &lt;</span><span style="color:#a31515">ResourceDictionary </span><span style="color:red">Source</span><span style="color:blue">=&quot;pack://application:,,,/SkinResources;Component/BlueSkin.xaml&quot;/&gt;
&lt;/</span><span style="color:#a31515">Application.Resources</span><span style="color:blue">&gt;</span></pre>
<p>Here's simple solution demonstrating the code above:<br><a href="http://blogs.vertigosoftware.com/files/alan/encapsulateresources.zip">Encapsulate Resources source</p></div>]]></description></item><item><title>Vertigo’s Custom Gibson for Guitar Hero III</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=40</link><pubDate>Tue, 06 May 2008 09:06:09 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=40#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClassC5E4F6DBEAC44C10AA2E74DA1D693A5D><p>Check this out: <a href="http://scottstanfield.com/gibson/gibson.html">http://scottstanfield.com/gibson/gibson.html</a>
	</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/050608_1606_VertigosCus1.png" alt="">
	</p><p>This is a 195MB 8-bit TIFF (5433 x 12,474 pixel) uncompressed image, converted by Seadragon.<br>The image is a composite of 12 individual images, taken with the following equipment: Canon EOS 30D (50mm f/20, 1 sec, ISO 100)<br><a href="http://www.gitzo.com/Jahia/site/gitzo/pid/4765/cache/bypass?gitzoView=flatView&amp;curLevel=1CAT&amp;curFamilyId=NONE&amp;curMarketId=MARKET:MKT1&amp;actualPathCategoryKey=1CAT:AAA1:2CAT:BB59:3CAT:CC49:4CAT:D358&amp;productContainer_windowsize=10&amp;ctnscroll_productContainer=&amp;kindOfProductCollectionRequest=productDetail&amp;detailPid=5292">Gitzo GT1540 Traveler tripod</a> with <a href="http://www.reallyrightstuff.com/pano/07.html">Really Right Stuff Multipano Head</a>.<br>Images stitched together with <a href="http://www.ptgui.com">PTGui</a>.</p></div>]]></description></item><item><title>Vista Explorer Search Tips</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=42</link><pubDate>Tue, 29 Apr 2008 14:41:13 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=42#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass1CAAD57DCEA3477BB29A30F29E101275><p>Quite by accident, I discovered some advanced search options using the built-in search box in Windows Explorer.  It's the little box in the top right-hand corner of your Explorer windows:
</p><p><img src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/042908_2141_VistaExplor1.png" alt="">
	</p><p>If you search for something but name but can't find it, you get the option of using Advance Search:
</p><p><img src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/042908_2141_VistaExplor2.png" alt="">
	</p><p>Clicking the Advanced Search link shows quite a few search options that are hidden by default.
</p><p><img src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/042908_2141_VistaExplor3.png" alt="">
	</p><p>What I've managed to find today, quite by accident, is that you can specify most of that information from <em>within</em> the search box itself!  You just need to qualify the data your searching for with the right keyword.  Here are a few examples:
</p><ul><li>type: C#
</li><li>modified: &gt; 4/28/2008
</li><li>created: &gt;= 4/29/2008
</li></ul><p>Pretty cool, huh?</p></div>]]></description></item><item><title>Set cookies in Silverlight</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=25</link><pubDate>Fri, 25 Apr 2008 09:02:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=25#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass42E4C3156AC24961AF35863C490F1DC9><font face="Helvetica, Arial, sans-serif">Here is a simple
class that demostates how to set cookies from a
Silverlight application.<br>
</font>
<blockquote><font color="#0000ff" face="Helvetica, Arial, sans-serif">public</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">static</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">class</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#2b91af" face="Helvetica, Arial, sans-serif">Cookie</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">{</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    </font><font color="#008000" face="Helvetica, Arial, sans-serif">// set cookie without expiration</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">public</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">static</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">void</font><font color="#000000" face="Helvetica, Arial, sans-serif"> Set(</font><font color="#0000ff" face="Helvetica, Arial, sans-serif">string</font><font color="#000000" face="Helvetica, Arial, sans-serif"> name, </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">string</font><font color="#000000" face="Helvetica, Arial, sans-serif"> value)</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    {</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">        </font><font color="#2b91af" face="Helvetica, Arial, sans-serif">HtmlPage</font><font color="#000000" face="Helvetica, Arial, sans-serif">.Document.Cookies = </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">string</font><font color="#000000" face="Helvetica, Arial, sans-serif">.Format(</font><font color="#a31515" face="Helvetica, Arial, sans-serif">&quot;{0}={1};&quot;</font><font color="#000000" face="Helvetica, Arial, sans-serif">, name, value);</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    }</font><br>
  <br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    </font><font color="#008000" face="Helvetica, Arial, sans-serif">// set the cookie with expiration</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">public</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">static</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">void</font><font color="#000000" face="Helvetica, Arial, sans-serif"> Set(</font><font color="#0000ff" face="Helvetica, Arial, sans-serif">string</font><font color="#000000" face="Helvetica, Arial, sans-serif"> name, </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">string</font><font color="#000000" face="Helvetica, Arial, sans-serif"> value, </font><font color="#2b91af" face="Helvetica, Arial, sans-serif">DateTime</font><font color="#000000" face="Helvetica, Arial, sans-serif"> expires)</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    {</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">         </font><font color="#2b91af" face="Helvetica, Arial, sans-serif">HtmlPage</font><font color="#000000" face="Helvetica, Arial, sans-serif">.Document.Cookies = </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">string</font><font color="#000000" face="Helvetica, Arial, sans-serif">.Format(</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">            </font><font color="#a31515" face="Helvetica, Arial, sans-serif">&quot;{0}={1}; expires={2}, {3} {4} {5} {6}:{7:00}:00 UTC&quot;</font><font color="#000000" face="Helvetica, Arial, sans-serif">,</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">            name, value, expires.DayOfWeek.ToString(),</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">            expires.Day, expires.Month, expires.Year,</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">            expires.Hour, expires.Minute);</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    }</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    </font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    </font><font color="#008000" face="Helvetica, Arial, sans-serif">// see if the cookie exists</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">public</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">static</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">bool</font><font color="#000000" face="Helvetica, Arial, sans-serif"> Exists(</font><font color="#0000ff" face="Helvetica, Arial, sans-serif">string</font><font color="#000000" face="Helvetica, Arial, sans-serif"> name, </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">string</font><font color="#000000" face="Helvetica, Arial, sans-serif"> value)</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    {</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">        </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">return</font><font color="#000000" face="Helvetica, Arial, sans-serif"> </font><font color="#2b91af" face="Helvetica, Arial, sans-serif">HtmlPage</font><font color="#000000" face="Helvetica, Arial, sans-serif">.Document.Cookies.Contains(</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">            </font><font color="#0000ff" face="Helvetica, Arial, sans-serif">string</font><font color="#000000" face="Helvetica, Arial, sans-serif">.Format(</font><font color="#a31515" face="Helvetica, Arial, sans-serif">&quot;{0}={1}&quot;</font><font color="#000000" face="Helvetica, Arial, sans-serif">, name, value));</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">    }</font><br>
  <font color="#000000" face="Helvetica, Arial, sans-serif">}</font><big><font face="Helvetica, Arial, sans-serif">
  </font></big><br>
</blockquote>
<font face="Helvetica, Arial, sans-serif">Sample usage.<br>
</font>
<blockquote><font face="Helvetica, Arial, sans-serif"><font color="#008000">// set the cookie</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#2b91af">Cookie</font><font color="#000000">.Set(</font><font color="#a31515">&quot;SomeSetting&quot;</font><font color="#000000">, </font><font color="#a31515">&quot;True&quot;</font><font color="#000000">, </font><font color="#2b91af">DateTime</font><font color="#000000">.UtcNow.AddDays(</font><font color="#800000">7</font><font color="#000000">));</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#000000">            </font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#008000">// see if cookie is set</font></font><br>
  <font face="Helvetica, Arial, sans-serif"><font color="#0000ff">bool</font><font color="#000000"> result = </font><font color="#2b91af">Cookie</font><font color="#000000">.Exists(</font><font color="#a31515">&quot;SomeSetting&quot;</font><font color="#000000">, </font><font color="#a31515">&quot;True&quot;</font><font color="#000000">);</font></font><br>
</blockquote>
<br>
</div>]]></description></item><item><title>Saving Energy At The Office</title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=13</link><pubDate>Tue, 22 Apr 2008 13:35:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=13#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass977A4FDFBDA74749BB2956674EF15B2A><p>Today is Earth Day, and being someone who likes to offer solutions rather than simply complain I decided to do something to reduce my energy consumption at the office. I recently moved out of my cubicle and into an enclosed office, complete with obnoxious overhead fluorescent lights. I've never actually used those lights, preferring instead the look and homey feel of lamp lighting. None of my lamps uses high wattage bulbs, but I knew I could decrease my energy usage even further. So today I picked up a few high efficiency compact fluorescent bulbs – my total wattage in my office is now something around 57 watts - less energy usage than a single standard 60 watt bulb, but with far more light! And I chose blubs that offer more natural light closer to sunlight than standard bulbs with their typical warm yellow cast, so it's easier to read all those notes I took in the morning meeting. 
</p><p>Sidebar: Compact fluorescents are not perfect. They contain mercury and must be disposed of properly in hazardous waste sites. However, I'm confident that in time this issue will be resolved. 
</p><p>There are a few more things we can do in the office to reduce energy usage:
</p><ul><li>Turn off your monitor when not in use for a while (however, if color accuracy is important to your work then I don't recommend this since most monitors need to warm up to reach their best color accuracy, especially if you are careful to calibrate them). 
</li><li>Wear a sweater instead of having your own private space heater (just unplugged mine!).
</li><li>Bring your own lunch to the office or walk into town instead of driving elsewhere. 
</li><li>Unplug device chargers when not in use (these are often accused of &quot;ghost&quot; energy usage). 
</li></ul><p>Also, thanks to Petar's inspiring posts about slowing down on the road to decrease gas consumption. I've been doing that myself for the past week and a nice side effect has been that I arrive at my destinations more relaxed than in the past! </p></div>]]></description></item><item><title>Using SourceGear's DiffMerge as the merge tool in Microsoft Team System</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=33</link><pubDate>Wed, 09 Apr 2008 11:31:00 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=33#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass95A8CFD73DD24694B6333052464CE0E9>
<p>In an earlier <a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Post.aspx?ID=26">post</a>, I discussed using and configuring WinMerge as a compare tool in Team System. Here I discuss using SourceGear's DiffMerge as a custom merge tool.</p>
<p>It all started recently when I had a tricky merge to do in Team System, and I realized that I wanted a bit of their changes and a bit of mine—all from the same block of changes. The problem is that the default merge tool in Team System renders the text change blocks as huge buttons—given this, it's not possible to select a chunk of text from one of them. (Trying to select the text simply clicks the button that is displaying the text.) In addition, the default tool does not display differences within a line—instead, it only shows which lines have differences. This can be very annoying if you are doing a merge and there's a very long line that is highlighted as being different, as it knows which characters are different, but it won't show the specific differences.</p>
<p>Given this, I backed myself out of the tricky merge, and installed the latest version of <a href="http://www.sourcegear.com/diffmerge/downloads.html">Sourcegear's DiffMerge</a>. From some preliminary research, it seems to be the best free, three-way merge tool. </p>
<p>Things I really like about DiffMerge include:</p>
<ul>
<li>You can select text from any of the panes and patch it together in the merge result window as necessary 
<li>It displays differences within a line, which can be a huge time-saver! 
<li>It does true three-way merges (it uses the common ancestor of a file to determine what it can merge automatically) 
<li>It is completely free for commercial or personal usage</li></ul>
<p>The only thing that I don't really like about it is that it doesn't have the super-cool monitor-wide diff pane that WinMerge has—given this, I still use WinMerge as my compare tool, and I use DiffMerge as my merge tool. However, I can certainly understand this, as merging is quite different than comparing, and it wouldn't really make sense to have the wide pane at the bottom for merging.</p>
<p>Here's a screenshot of DiffMerge with some silly sample code:</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/DiffMerge_2.png"><img height=662 alt="Screenshot of DiffMerge window with sample files. Center file is the common ancestor." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/DiffMerge_thumb.png" width=968 border=0></a> </p>
<p>This is the merge view. The center file is always the ancestor—the file that existed before any of the current edits started. Note the highlighting of changes within lines. Also notice the tabs at the bottom—they change the middle file display from the original ancestor and the merge result, which can be quite useful.</p>
<p>You can simply select text from any window and paste it into the Merge Result window, as well as directly editing the text in the Merge Result window.</p>
<p>One trick with this tool is that the auto-merge is called &quot;merge to center&quot;; it's the toolbar button on the far right that shows two green arrows pointing into the middle. This is the three-way merge—it uses the information about the common ancestor to figure out which changes it should keep and which it should not. (Without a common ancestor, it's impossible for the tool to tell what it should do, which is to keep everybody's changes as long as they don't collide.) If the tool detects conflicting changes to the same text block, the auto-merge will not do anything with the conflicts. It will display a dialog like this in the sample case above where the namespace is a conflict, because two different people changed it from the base (ancestor) file:</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Mergeconflictsdialog_2.png"><img height=301 alt="Merge conflicts dialog showing what the tool did, and that one merge conflict will need to be manually resolved." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Mergeconflictsdialog_thumb.png" width=530 border=0></a> </p>
<p>Here's what the merge result looks like after auto-merging (note that the &quot;merge to center&quot; button is now grayed out):</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/postautomergeeditview_2.png"><img height=662 alt="Merge result after auto-merge: shows the center file modifications based on the auto-merge, and no changes to the conflict in the namespace" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/postautomergeeditview_thumb.png" width=968 border=0></a> </p>
<p>And here's the reference view showing the original ancestor file (bottom tab selection):</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/postautomergereferenceview_2.png"><img height=662 alt="Reference view after auto-merge: shows the original ancestor in the center window" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/postautomergereferenceview_thumb.png" width=968 border=0></a> </p>
<p>Tip: The documentation suggests that, if you are going to use the auto-merge, you should do it <strong>before </strong>you do any manual merging, so that the auto-merge doesn't reverse or modify what you've already done. In addition, you can only use the auto-merge once—after that, the button is disabled.</p>
<p> </p>
<p><strong>Configuration of DiffMerge for Team System Merges</strong></p>
<p>Once again, the web page with all the installation details for custom compare and merge tools is James Manning's <a href="http://blogs.msdn.com/jmanning/articles/535573.aspx">blog post</a>. Here is a walk-through for configuring DiffMerge as the merge tool.</p>
<p>First, in Visual Studio, click <strong>Tools</strong>, then <strong>Options</strong>. The options dialog appears—click the <strong>Source Control </strong>node, and then the <strong>Visual Studio Team Foundation Server </strong>subnode:</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config1_2.png"><img height=438 alt="Options dialog with Configure User Tools... button" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config1_thumb.png" width=757 border=0></a> </p>
<p>Click the <strong>Configure User Tools... </strong>button and the following dialog appears:</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config2_2.png"><img height=282 alt="Configure user tools dialog with only compare tool configured" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config2_thumb.png" width=476 border=0></a> </p>
<p>This list will be empty if you have the default tools configured. Here I have it already configured for WinMerge for the compare operation, but nothing for merge. Click <strong>Add... </strong>to add a new non-default tool. Here's the dialog when it first opens:</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config3_2.png"><img height=219 alt="Configure Tool dialog with defaults" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config3_thumb.png" width=417 border=0></a> </p>
<p>Enter the following data:</p>
<ul>
<li><strong>.* </strong>for the extension (this will use the merge tool for all extensions) 
<li><strong>Merge</strong> for the operation 
<li>Browse to the DiffMerge.exe file in C:\Program Files\SourceGear\DiffMerge for the Command 
<li>Enter the following DiffMerge command line arguments from James Manning's <a href="http://blogs.msdn.com/jmanning/articles/535573.aspx">incredibly useful post</a>: <strong>/title1=%6 /title2=%8 /title3=%7 /result=%4 %1 %3 %2 </strong></li></ul>
<p>It should look something like this when you are done:</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config4_2.png"><img height=219 alt="Configure Tool dialog with DiffMerge configured" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config4_thumb.png" width=417 border=0></a> </p>
<p>Next, click <strong>OK</strong>. You should now see your merge tool in the tool list:</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config5_2.png"><img height=282 alt="Configure User Tools dialog with both custom merge and custom compare tools configured" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/33/Config5_thumb.png" width=476 border=0></a> </p>
<p>Click <strong>OK</strong>, and then <strong>OK </strong>again to save the settings, and you should be all set!</p>
<p>Thanks to SourceGear for making this tool available to everyone for free! I think it's a winner!</p>
<p>PS: If you try using a custom compare/merge tool and don't like it, it's super easy to undo this process. To go back to the default tool, simply return to the Configure User Tools dialog, select the desired tool under file extensions, and click <strong>Remove</strong>. (If nothing is configured here, then it uses the default tools.)</p></div>]]></description></item><item><title>Scrum and feedback in process optimization</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=32</link><pubDate>Thu, 03 Apr 2008 11:11:40 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=32#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClassE67BB2EF1F7245428F8D8E93A08E1F8B><p>Scrum has a direct and timely feedback loop built in for optimizing the software development process—the retrospective. Here are some of my thoughts about feedback and optimization of process in software development.</p> <p><strong>Development in large organizations</strong></p> <p>Many large organizations tend to have significant amounts of process around their development efforts—so much that sometimes, the development efforts slow to a crawl. By process I mean various rules and procedures where forms need to be filled out, steps need to be taken, checklists need to be followed, approvals need to be obtained, emails need to be sent, people need to be informed, tests need to be performed, etc. Speaking with the developers in such situations often reveals a similar story—they spend much of their time following complex procedures that don't add directly to development productivity or quality. It's not unusual to hear stories where it takes ten hours to complete one hour's development work due to nine hours of process overhead or delays. For example, one client told us a true story in which removing a single misplaced hyphen from a web page cost the organization nearly $100,000. The cost included time to schedule resources, develop project plans, consider and analyze the impact, do a risk assessment, do the actual development (delete the hyphen in a text editor), and then test, retest, and deploy the solution to a variety of staging systems, and finally to the production system. Despite everyone agreeing that the hyphen was a mistake, it took much more time to complete the process required than to delete the comma.</p> <p><strong>How do things get this way? </strong></p> <p>I suspect that this is partially related to hierarchical management—as managers become more separated from the developers, less communication occurs. And, when mistakes are made (which is nearly inevitable due to the complexity of modern software), management's response is often to create a new procedure or process to try to prevent future problems. This is completely well-intentioned, but by adding a bit of process each time something goes wrong, eventually process itself becomes part of the problem. And if the issue was a rare issue, then the process may consume thousands of hours in subsequent years to attempt to prevent something that would likely not happen again even without the process.</p> <p><strong>How to avoid this?</strong></p> <p>I think one way to avoid this type of problem is by using Scrum. In Scrum, you develop in short iterations (sprints), and at the end of each iteration you have a retrospective. In the retrospective, the dev team reviews what they liked and didn't like, and creates improvements. Often these improvements involve new process  or changes to process. So why is this any better than what was described above? In Scrum there is <strong>feedback </strong>from the dev team.</p> <p><strong>The importance of feedback</strong></p> <p>From my experiences with Scrum, the retrospectives will push the team in one of two directions—if they are lacking in process, then the team will create new process to assist it. But if the team has too much process, the team will recognize this and remove some of the less-effective processes. It's the feedback from the dev team every sprint (ie, every month or so) that keeps things from getting too far from an optimum state.</p> <p>To make an analogy, the best way to drive a car down a freeway is to continually look out the windshield, see where you are, and based on that immediate, direct feedback, adjust course and speed. (This is analogous to the development team creating and removing process as they experience how everything is going.) On the other hand, imagine trying to drive a car blindfolded based on telephone instructions from someone who has driven down the same freeway a few years ago, and is watching your car from a nearby hill as you drive by. This is somewhat analogous to management creating process without being directly involved in the current design process. (I actually think this overstates the issues a bit, but it was the best analogy I could think of...) The feedback over the telephone <strong>may </strong>work, but the feedback is much less direct and timely than simply looking out the window and driving. To be effective, feedback needs to be timely and direct.</p> <p>Consider the following hypothetical plot of the amount of productivity of a team as a function of amount of process. Just to be clear, it is not based on any measurements of productivity or process—I just made it up. It is just a general guess of what this curve might look like:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/32/Processproductivityplot_6.png"><img height=538 alt="Hypothetical plot of productivity as a function of amount of process. On the left, too little process leads to low productivity due to chaos. At the right, too much process causes low productivity (due to not much work being done). In the middle is the optimal level of process. The productivity curve starts at zero, peaks at the optimal amount of process, and then declines in productivity with additional process." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/32/Processproductivityplot_thumb_2.png" width=664 border=0></a> </p> <p>The sketch attempts to communicate the following points:</p> <ul> <li>If you have too little process (the far left side of the curve), your overall productivity declines—things become chaotic and error-prone, and less useful work gets done (and sometimes the work that does get done causes a lot of damage!) In the extreme, with no process (no planning, no guidance, no direction, etc), you don't get anything useful done because the work being done isn't the <strong>right</strong> work, so productivity is zero.  <li>If you have too much process (the right side of the curve), your overall productivity declines—the team spends too much of its time doing process, which often does not add directly to productivity, especially beyond a certain point. In the extreme of infinite process, no real work is ever done, so productivity is zero.  <li>For a given combination of project, team, situation, etc, there is an optimum amount of process where productivity is at a maximum—add more and productivity declines, but remove process and productivity also declines.</li></ul> <p>Given these assumptions, how do you optimize the amount of process? Feedback. The development team needs to be told what the priorities of the organization are, and then the team needs to be given the freedom to control the amount of process it uses. Usually management—especially if they are significantly removed from the development process—does not have as good an understanding as the team of what will really be useful process and what simply impedes development without adding much value.</p> <p>To describe the feedback process in terms of the curve, when the team finds themselves in a chaotic and random environment, they will notice and, as part of the retrospective, create new process to assist in controlling the chaos. On the other hand, if the team notices that they are spending most of their time on process, they can remove the least-valuable of these processes and then see where they are. Eventually, after several sprints, the development team will hopefully be somewhere near the optimal point of the curve, and as the situation evolves from this point, they can continue to adjust to maintain the optimal position.</p> <p>Some people might argue that the development team inherently doesn't like process and therefore will remove it regardless of whether it is useful or not. (It's only management that doesn't mind processes and therefore has the will to add them, because they will not be directly affected by them.) However, I've seen the opposite in many cases—for example, early in my current project, testing was very chaotic, because we had not defined much process around it. The team did not like this—it was chaotic and stressful for them. In the retrospectives, the team brought up that testing was chaotic and stressful, and the improvement they arrived at was more process. In addition, they defined the process—and it worked incredibly well. The process has since been fine-tuned and adjusted many times during subsequent retrospectives.</p> <p>Will the team sometimes add too much process, or remove a valuable bit of process? Of course—but within a sprint or two, assuming there's a significant impact, they'll notice and correct. Constant correction via feedback is the key to optimizing the process. And Scrum includes the retrospective as a way of building feedback into the process at the most basic level.</p> <p>One additional point that may not be obvious—in some cases, maximum productivity may not be the goal. For some organizations, reliability and stability or something else may be more important than pure productivity, but this is basically just a redefinition of what productivity is. (For most organizations reliability and stability are important, but so is the rate at which new features are added, so the definition of productivity needs to take balancing these various priorities into account.) The bottom line is that these priorities need to be communicated clearly to the development team—they are the ones who are steering the car down the freeway.</p></div>]]></description></item><item><title>Adding IntelliSense to Custom .config Editing</title><link>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=7</link><pubDate>Wed, 02 Apr 2008 18:56:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=7#Comments</comments><dc:creator>davidb</dc:creator><description><![CDATA[<div class=ExternalClassA2FA38D3F92643319659924ED1B1D0FC>     A <a href="http://www.ondotnet.com/pub/a/dotnet/excerpt/aspdotnetian_6/index3.html?page=4">few</a> <a href="http://blog.devstone.com/aaron/archive/2004/09/10/272.aspx">people</a> have posted this already—though for older versions of VS—but the Visual Studio XML editor will add IntelliSense if it can associate the file you’re editing with an XML schema. How it does this varies with the Visual Studio version, and in VS 9.0 (2008), stems from a file, named catalog.xml, located in the configured Caching/Schemas directory—it seems you can actually have multiple sets of IntelliSense configurations. This can be set through the Tools/Options menu under Text Editor/XML/Miscellaneous: <br><br><img alt="The Visual Studio 2008 Caching-Schemas Configuration  " src="http://blogs.vertigo.com/personal/davidb/Blog/Lists/Photos/CachingSchemas.png"> <br>It defaults to <code>%VsInstallDir%\xml\Schemas</code>. Opening a Visual Studio command prompt and typing: <br>     <code>set VsInstallDir</code> <br>…should reveal the <code>%VsInstallDir%</code> that VS uses. <br>The catalog.xml file’s SchemaCatalog/Association elements match .XSD files with extensions. <br><br><img alt="Caching/Schemas catalog.xml" src="http://blogs.vertigo.com/personal/davidb/Blog/Lists/Photos/SchemasConfigFile.png"> <br>Note that multiple schemas can be associated with particular extensions—you don’t have to edit the default .XSD files. Once you’ve saved catalog.xml, opening a file with the specified extension should include IntelliSense, reflecting its associated schema: <br><br><img alt="Custom .config IntelliSense" src="http://blogs.vertigo.com/personal/davidb/Blog/Lists/Photos/CustomConfigIntelliSense.png"> <br><br>Additionally, Microsoft provides some custom attributes for your .XSD file, specifying in more detail how Visual Studio should treat elements: <br>     <a href="http://msdn2.microsoft.com/en-us/library/aa713989(VS.71).aspx">http://msdn2.microsoft.com/en-us/library/aa713989(VS.71).aspx</a> <br><code>vs</code> refers to the <code>http://schemas.microsoft.com/Visual-Studio-Intellisense</code> xml namespace. </div>]]></description></item><item><title>Retrospectives: a key part of the Scrum process</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=31</link><pubDate>Wed, 02 Apr 2008 17:32:24 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=31#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass9E86F79D2AD5434EB8FA319B0B664B92><p>The retrospective is a key and often overlooked part of the Scrum process. I believe one reason for the success of my Scrum team in the past few years is related to our consistency in doing retrospectives at the end of each sprint.</p> <p>I've seen other teams sometimes skip over retrospectives, for a variety of reasons:</p> <ul> <li>Retrospectives don't seem that important  <li>The team is too busy to take time to retrospect  <li>They believe that doing retrospectives won't improve anything</li></ul> <p>Having done a lot of retrospectives, from my experience, the retrospective serves a number of purposes:</p> <ul> <li>It provides a structured environment for the entire team to brainstorm ways to improve things  <li>It helps the team to bond—they have a time specifically to discuss their feelings and experiences, and to listen to each other  <li>It provides the team a sense of closure at the end of each iteration  <li>It allows team members to voice grievances and annoyances in a supportive environment  <li>Simply scheduling the time for the retrospective communicates to the team that their feelings and opinions are important and valued</li></ul> <p>The most obvious purpose of the retrospective is making improvements to the process. It may seem that making a few small process improvements each sprint won't really add up to much, but this has not been my experience. Although the individual improvements can seem very small, the cumulative effect can be quite surprising.</p> <p> </p> <p><strong>Thoughts and suggestions about retrospectives</strong></p> <p>(If you are unfamiliar with Scrum or the retrospective, I encourage you to read the excellent book <em>Agile Software Development with SCRUM </em>by Ken Schwaber and Mike Beedle. I strongly recommend this book—I think it is the best book I've seen about Scrum.)</p> <p>First of all, I always refer to it as a “retrospective”, not a “postmortem” or anything else. Postmortem has the smell of death around it—I can understand people not wanting to go talk about how the iteration (and/or team?) “died” over the last few weeks. This word also implies a sense of hopelessness—the iteration or the team is dead and cannot be resurrected—instead we’ll just talk about how it died. On the other hand, the word “retrospective” gives the process a more hopeful tone—that you will look back in order to learn something that can make the process more pleasant going forward.</p> <p>We start our retrospectives by making two lists on the whiteboard:</p> <ul> <li>What we liked in the previous iteration  <li>What we did not like in the previous iteration</li></ul> <p>We usually draw it with a plus sign at the top of the column for things we liked, and a minus sign at the top of the column for things we didn't like, for example:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/31/RetrospectiveLists_2.jpg"><img height=406 alt="Starting point for retrospective: a column for what we liked as a team (on the left with a plus sign), and a column for what we didn't like as a team (on the right with a minus sign)" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/31/RetrospectiveLists_thumb.jpg" width=418 border=0></a> </p> <p>Note that the second list is NOT defined as a list of mistakes that we made in the last iteration! This may be a subtle point, but it's important--not many people enjoy going to a meeting where they have to confess their mistakes over the past month. The list consists of things that we (members of the team)<strong> did not like</strong>. This <strong>can </strong>include mistakes we made, but the scope is much larger than that.</p> <p>Note that, as the ScrumMaster for the team, I try to encourage and write down items in both areas, without adding too many of my own, or doing any editing or censorship of items. For the most part I just write items down—I don’t want to hijack the meeting so that it ends up being all about me.</p> <p>In addition, I don't try to make the two lists “balance out” or be equal in some way—this is not a zero-sum game. If we had an unpleasant iteration, it’s likely that we'll have more items on the minus side than the plus side—and that’s fine! On the other hand, a really smooth iteration it may be the other way around, and that’s fine too.</p> <p>I do what I can to encourage everyone to be honest—for example, if there is an event I recall that people didn’t like but nobody is bringing up, I’ll ask about it. Honesty is important—the more honest everyone is, the better the whole thing works. Sometimes this means taking social risks—we’ve had several retrospectives with people getting frustrated or angry and saying things like “I didn’t like how Bob would criticize my code!” If people are feeling it, this is probably the best time to talk about it, and it certainly makes the process a lot more interesting! Not talking about it just means that it likely won't change. In my experience, most of these types of interpersonal team issues were greatly improved after being brought up in a retrospective, and this greatly added to the team moral and productivity.</p> <p>When we start running out of items, we prioritize the top few items that we didn't like. The prioritization is based on the importance of improvement in that area to us as a team. Usually the top priority items are the biggest pain points of the iteration for the team, and fairly easy to agree upon. Again, as ScrumMaster, I usually leave my own opinions out of the prioritization—I’ll sometimes add a bit, but I really don't want to control the prioritization.</p> <p>Finally, we take the top two or three priority items from the minus side, and brainstorm as a team how we could improve the situation going forward. In my experience it's important to not select <strong>more </strong>than 2 or 3 items to improve, because they tend to be too many and some get forgotten, which makes the whole process seem pointless and frustrating.</p> <p>It’s during the brainstorming about possible improvements where the real magic happens—the team is smarter as a whole than any individuals on the team. Issues that at first seem impossible to improve (items that you seem to just be stuck with) can often be improved in some way when the whole team focuses on them. Note that this means it often makes sense to spend some brainstorming improvements time on a painful item that everyone initially believes they cannot change. It is only in the brainstorming that the possibilities emerge. These improvements may not resolve it entirely but improve things incrementally—the tricky bit is that these possibilities can be difficult to see in advance. In my experience, the improvements sometimes involve more communication with someone (the product owner, users, someone on the team, etc), more training, new procedures, different tools, or a technical task for the next iteration to improve something. But there are no limits to the types of improvements you can brainstorm into existence.</p> <p>And, as I said above, it’s important to follow through with the improvements—otherwise it undercuts the whole process.</p> <p>In summary, if you are using Scrum but skipping retrospectives, I encourage you to try doing retrospectives seriously and consistently! From my experience, it may improve your team’s productivity and moral.</p></div>]]></description></item><item><title>TimeZoneInfo : Another reason to love .NET 3.5</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=41</link><pubDate>Tue, 01 Apr 2008 15:01:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=41#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass1B6082BDCE7B4F99A6D225A61EF0FD31>
<p>One of the new classes in .NET 3.5 is <a href="http://msdn2.microsoft.com/en-us/library/system.timezoneinfo.aspx">TimeZoneInfo</a>. MSDN's vague and all-encompassing description states &quot;<em>Represents any time zone in the world.</em>&quot; Scrolling further down, you'll find a list of actual things that TimeZoneInfo can do: </p>
<ul>
<li>Retrieving a time zone that is already defined by the operating system. </li>
<li>Enumerating the time zones that are available on a system. </li>
<li>Converting times between different time zones. </li>
<li>Creating a new time zone that is not already defined by the operating system. </li>
<li>Serializing a time zone for later retrieval. </li></ul>
<p>Personally, I'm using TimeZoneInfo for all of my DateTime conversions to support different time zones. Performing the conversion is as easy as calling <a href="http://msdn2.microsoft.com/en-us/library/system.timezoneinfo.converttimebysystemtimezoneid.aspx">ConvertTimeBySystemTimeZoneId</a>. Here are a few examples: </p>
<p><nobr><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">DateTime</span> pstDateTime = <span style="color:#2b91af">TimeZoneInfo</span>.ConvertTimeBySystemTimeZoneId(utcDateTime, <span style="color:#2b91af">TimeZoneInfo</span>.Utc.Id, <span style="color:#a31515">&quot;Pacific Standard Time&quot;</span>); </span></nobr></p>
<p></p>
<p><nobr><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">DateTime</span> utcDateTime = <span style="color:#2b91af">TimeZoneInfo</span>.ConvertTimeBySystemTimeZoneId(pstDateTime, <span style="color:#a31515">&quot;Pacific Standard Time&quot;</span>, <span style="color:#2b91af">TimeZoneInfo</span>.Utc.Id); </span></nobr>
<p></p>
<p>TimeZoneInfo supports daylight savings time (DST), and makes supporting time zones much easier than rolling your own solution.</p></div>]]></description></item><item><title>Excel and CSV Reference</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=40</link><pubDate>Fri, 28 Mar 2008 15:03:00 GMT</pubDate><slash:comments>5</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=40#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClassE96F6A40885F46CF87FB0DA25B592FE5>
<p>I've been doing a lot of work with CSV and Excel imports recently. There are a lot of poorly documented or disparate pieces of information that are required to interface with a CSV or Excel data source, so I'm recording it here. </p>
<h3>Formatting Overview </h3>
<p>There are a few formatting rules that you need to consider when working with CSV files. </p>
<ul>
<li>Double-quotes are escaped with two double-quotes: &quot; becomes &quot;&quot; </li>
<li>Fields with reserved characters are escaped with double-quotes; <em>this includes carriage-return and new-line characters</em> </li></ul>
<h3>Using a StreamReader is probably a no-no </h3>
<p>For simple files, using a StreamReader will work fine. However, if you have any fields that contain carriage-returns or line-feeds, ReadLine() won't get you the full set of data for a single record. I suppose that you could try and read subsequent lines until you read the expected number of fields, but that brings up the next problem: <em>commas</em>. Fields can contain commas, so calling Split() with a comma as the parameter can produce unexpected results. </p>
<p>As an aside, a StreamReader won't work for native Excel files, so you would be stuck with a hybrid approach. So what do you do? Use OLE DB. </p>
<h3>System.Data.OleDb to the rescue </h3>
<p>There are OLE DB providers for CSV, Excel 97-2003, and Excel 2007. The CSV and Excel 97-2003 drivers seem to be available with either Windows, the Microsoft Data Access Components, or the .NET Framework. The Excel 2007 drivers are part of the <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=7554f536-8c28-4598-9b72-ef94e038c891">2007 Office System Driver: Data Connectivity Components</a>, a separate download. </p>
<p>Each file format requires a slightly different connection string, as shown below. </p>
<div style="margin-left:30pt">
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:99px">
<col style="width:499px"></colgroup>
<tbody valign=top>
<tr>
<td style="padding-right:7px;padding-left:7px">
<p><font size=1>CSV</font></p></td>
<td style="padding-right:7px;padding-left:7px">
<p><span style="font-size:10pt;color:#a31515;font-family:Consolas">Provider=Microsoft.Jet.OLEDB.4.0;<br>Data Source={0};<br>Extended Properties=&quot;text;HDR=Yes;FMT=Delimited;&quot;;</span></p></td></tr>
<tr>
<td style="padding-right:7px;padding-left:7px">
<p><font size=1>Excel 97-2003</font></p></td>
<td style="padding-right:7px;padding-left:7px">
<p><span style="font-size:10pt;color:#a31515;font-family:Consolas">Provider=Microsoft.Jet.OLEDB.4.0;<br>Data Source={0};<br>Extended Properties=&quot;Excel 8.0;HDR=Yes;IMEX=1;&quot;;</span></p></td></tr>
<tr>
<td style="padding-right:7px;padding-left:7px">
<p><font size=1>Excel 2007</font></p></td>
<td style="padding-right:7px;padding-left:7px">
<p><span style="font-size:10pt;color:#a31515;font-family:Consolas">Provider=Microsoft.ACE.OLEDB.12.0;<br></span><span style="font-size:10pt;color:#a31515;font-family:Consolas">Data Source={0};<br></span><span style="font-size:10pt;color:#a31515;font-family:Consolas">Extended Properties=&quot;Excel 12.0;HDR=Yes;IMEX=1;&quot;;</span></p></td></tr></tbody></table></div>
<p><em><strong>Note:</strong> The data source for CSV is the directory where the file can be found, not the full path to the file. </em></p>
<p>HDR=Yes is required if the first line/row in the file has column names, aka, header row. I recommend that you use header rows whenever possible so you're not depending on the column ordering. </p>
<p>IMEX=1 indicates that columns may have mixed data. This is important in situations where a column may contain both text and numerical data. Without IMEX=1, mixed columns default to decimal, and string values are read as null values. By default, the OLE DB provider only reads the first 8 rows to determine a column's data type when IMEX=1 was specified. To increase the number of rows examined, change the TypeGuessRows value in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Access Connectivity Engine\Engines\Excel sections in your registry. Changing the value to 0 will force all columns to be read before the column type will be determined. </p>
<p>The easiest way to determine which connection string to use is to initialize a new <a href="http://msdn2.microsoft.com/en-us/library/system.io.fileinfo.aspx">System.IO.FileInfo</a> instance with the name of the file you're working with, and use its Extension property. </p>
<h3>Querying for data </h3>
<p>With CSV, you query against files, not tables. With Excel (any version), you query against sheets, not tables. However, either format works with SQL queries. </p>
<p>The easiest way to translate the file or sheet name into a table name is to use call <a href="http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbconnection.getoledbschematable(VS.71).aspx">OleDbConnection.GetOleDbSchemaTable</a>. GetOleDbSchemaTable returns a DataTable with schema information for the OLEDB data source. </p>
<p style="margin-left:36pt"><pre><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">DataTable</span> schemaDataTable = connection.GetOleDbSchemaTable(<span style="color:#2b91af">OleDbSchemaGuid</span>.Tables, <span style="color:blue">null</span>);<br><span style="color:blue">foreach</span> (<span style="color:#2b91af">DataRow</span> dataRow <span style="color:blue">in</span> schemaDataTable.Rows)<br>{<br>    <span style="color:blue">string</span> tableName = (<span style="color:blue">string</span>) dataRow[<span style="color:#a31515">&quot;TABLE_NAME&quot;</span>];<br>    <span style="color:green">// Do something important here</span><br>}</span></pre>
<p></p>
<p></p>
<p>The other important thing to consider is that the names of columns, files, and sheets can contain spaces. When you build your queries, it's a good idea to escape everything with brackets. </p>
<p><nobr><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">string</span> commandText = <span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;SELECT [First Name], [Last Name], [E-Mail Address] FROM [{0}]&quot;</span>, tableName);</span></nobr></p>
<p></p>
<h3>Example </h3>
<p>If a header row is present, you can call <a href="http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbdatareader.getordinal(vs.71).aspx">GetOrdinal</a> to determine the index of a column by its name. Here is a helper method, GetDataReaderString, to read the column value as a string. </p>
<p><pre><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">private</span> <span style="color:blue">string</span> GetDataReaderString(<span style="color:#2b91af">IDataReader</span> dataReader, <span style="color:blue">int</span> ordinal)<br>{<br>    <span style="color:blue">if</span> (dataReader.IsDBNull(ordinal))<br>    {<br>        <span style="color:blue">return</span> <span style="color:blue">null</span>;<br>    }<br>    <span style="color:blue">else<br></span>    {<br>        <span style="color:blue">return</span> dataReader.GetValue(ordinal).ToString();<br>    }<br>} </span></pre>
<p></p>
<p></p>
<p>Here's an example that reads a file with a header row.<span style="font-size:10pt;font-family:Consolas"> </span></p>
<p><pre><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> (<span style="color:#2b91af">OleDbConnection</span> connection = <span style="color:blue">new</span> <span style="color:#2b91af">OleDbConnection</span>(connectionString))<br>{<br>    connection.Open();<br></span><span style="font-size:10pt;font-family:Consolas">    <br>    <span style="color:#2b91af">DataTable</span> schemaDataTable = connection.GetOleDbSchemaTable(<span style="color:#2b91af">OleDbSchemaGuid</span>.Tables, <span style="color:blue">null</span>);<br>    <span style="color:blue">foreach</span> (<span style="color:#2b91af">DataRow</span> dataRow <span style="color:blue">in</span> schemaDataTable.Rows)<br>    {<br>        <span style="color:blue">string</span> tableName = (<span style="color:blue">string</span>) dataRow[<span style="color:#a31515">&quot;TABLE_NAME&quot;</span>]; </span><p></p>
<p><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">if</span> ((extension == <span style="color:#a31515">&quot;.csv&quot;</span> &amp;&amp; tableName.Contains(<span style="color:#a31515">&quot;YourFileNameWithoutExtension&quot;</span>)) || extension == <span style="color:#a31515">&quot;.xls&quot;</span> || extension == <span style="color:#a31515">&quot;.xlsx&quot;</span>)<br>        {<br>            <span style="color:green">// Build the command text</span><br>            <span style="color:blue">string</span> commandText = <span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;SELECT [First Name], [Last Name], [E-Mail Address] FROM [{0}]&quot;</span>, tableName); </span></p>
<p><span style="font-size:10pt;font-family:Consolas">            <span style="color:green">// Issue the command and process the results</span><br>            <span style="color:blue">using</span> (<span style="color:#2b91af">OleDbCommand</span> command = <span style="color:blue">new</span> <span style="color:#2b91af">OleDbCommand</span>(commandText, connection))<br>            {<br>                <span style="color:blue">using</span> (<span style="color:#2b91af">OleDbDataReader</span> dataReader = command.ExecuteReader())<br>                {<br>                    <span style="color:blue">int</span> firstNameOrdinal = dataReader.GetOrdinal(<span style="color:#a31515">&quot;First Name&quot;</span>);<br>                    <span style="color:blue">int</span> lastNameOrdinal = dataReader.GetOrdinal(<span style="color:#a31515">&quot;Last Name&quot;</span>);<br>                    <span style="color:blue">int</span> emailOrdinal = dataReader.GetOrdinal(<span style="color:#a31515">&quot;E-Mail Address&quot;</span>); </span></p>
<p><span style="font-size:10pt;font-family:Consolas">                    <span style="color:blue">while</span> (dataReader.Read())<br>                    {<br>                        <span style="color:blue">string</span> firstName = GetDataReaderString(dataReader, firstNameOrdinal);<br>                        <span style="color:blue">string</span> lastName = GetDataReaderString(dataReader, lastNameOrdinal);<br>                        <span style="color:blue">string</span> email = GetDataReaderString(dataReader, emailOrdinal); </span></p>
<p><span style="font-size:10pt;font-family:Consolas">                        <span style="color:green">// Do something important here</span><br>                    }<br>                }<br>            } </span></p>
<p><span style="font-size:10pt;font-family:Consolas">            <span style="color:green">// Only process the first sheet of an Excel 97-2003 or Excel 2007 file; or, only process the CSV that was uploaded by the member</span><br>            <span style="color:blue">break</span>;<br>        }<br>    }<br>} </span></p></pre>
<p></p>
<p>Hope this helps!</p></div>]]></description></item><item><title>.NET Runtime Optimization error on SQL Server 2005</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=39</link><pubDate>Thu, 27 Mar 2008 11:42:20 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=39#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass3B81CE1E5C4E4039B2DF62D45BA240B9><p>If you're getting an error similar to the following in your Event Log, I've found a solution that may work for you.
</p><blockquote><p>NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Failed to compile: Microsoft.ReportingServices.QueryDesigners, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91.
</p></blockquote><p>In my case, re-installing SQL Server 2005 SP2 didn't work.  Neither did rebooting.  The only thing that seemed to correct the problem was to install the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=8a166cac-758d-45c8-b637-dd7726e61367&amp;DisplayLang=en">Microsoft Report Viewer Redistributable 2005</a>.  I'm not really sure why that would be required on a server, but things don't always make sense.</p></div>]]></description></item><item><title>Yet Another Reason Why Physical Security is Paramount</title><link>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Wed, 19 Mar 2008 16:50:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>davidb</dc:creator><description><![CDATA[<div class=ExternalClassE609384879664C609672F7462CCF9AC9>
<div>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3>I got wind of this from Bruce Schneier’s </font><a href="http://schneier.com/blog/"><font face=Calibri color="#0000ff" size=3>Schneier on Security</font></a><font size=3><font face=Calibri> blog.</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face=Calibri size=3>I’m primarily a PC user, and while I have machines with Firewire interfaces, I don’t have any devices that make use of them—I have lots of USB whatnots, though.<span>  </span>According </font><a href="http://en.wikipedia.org/wiki/Fire_wire"><font face=Calibri color="#0000ff" size=3>Wikipedia's Firewire entry</font></a><font face=Calibri size=3> one of the standard’s advantages over USB is that it has more capable <span> </span>interface hardware which can take the transfer management load off the CPU—perhaps SCSI vs. IDE is an apt analogy?<span>  </span>I didn’t know is that these capabilities extend to </font><a href="http://en.wikipedia.org/wiki/Direct_memory_access"><font face=Calibri color="#0000ff" size=3>DMA</font></a><font size=3><font face=Calibri>.<span>  </span></font></font><a href="http://www.darkreading.com/document.asp?doc_id=147713&amp;f_src=drweekly"><font face=Calibri color="#0000ff" size=3>This darkReading article</font></a><font size=3><font face=Calibri> sites an attack based on this feature, a Firewire device disabling a Windows machine’s password protection—Linux and OS X can be vulnerable as well.</font></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri></font></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font size=3><font face=Calibri>The Wikipedia article reports that secure sites will either use machines that assign Firewire a virtual memory space (Power Mac G5's, Sun workstations), disable the <a href="http://en.wikipedia.org/wiki/OHCI">hardware mapping</a> between Firewire and memory, or not use Firewire<span>  </span>at all.</font></font></p></div></div>]]></description></item><item><title>40 – My Life in Silverlight 2</title><link>http://blogs.vertigo.com/personal/Paul/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Thu, 13 Mar 2008 14:32:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/Paul/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>Paul</dc:creator><description><![CDATA[<div class=ExternalClass66F0BF9191FA4011A17A5167D1BF6721>
<p>What do you get when you mix memories and feelings from your life with Silverlight 2?  … a personalized data visualization experiment that you can learn from. &quot;40 – My Life in Silverlight 2&quot; is a unique memory map of my first 40 years. It's difficult to capture in words what the application is, so the easiest thing to do is to watch the <a href="http://www.vertigo.com/downloads/40/40.wmv">2 and a half minute video</a> that I created for it. For those of you with more time on your hands and who want a bit more detail, continue reading! </p>
<p>When celebrating my 40<sup>th</sup> birthday late last year I was reminiscing with my family about the things that have happened to me, the people I've met, etc. I wanted to capture that moment of remembering, of feeling. Each time I thought of something that had happened in my past I felt something. Some memories made me happy … others made me sad. It felt real. It felt authentic. It felt like me. </p>
<p>A couple of months later I found myself needing/wanting to learn Silverlight 2. <a href="http://www.vertigo.com/" target="_blank">My company</a> has been doing a lot of Silverlight work lately and I always learn better when I have something to work on. And the only time I really find the time to work on something outside of work is when I'm interested in it. These things came together in the &quot;40&quot; application. </p>
<p><img alt="Linear Timeline" src="http://blogs.vertigo.com/personal/paul/Blog/Lists/Photos/LinearTimeline.jpg"> </p>
<p>Each circle represents a specific memory … when I met my wife, when we got our new puppy, when I went to London, etc. For each memory I keep track of the basics: title, story (more detail of the memory), month, year, etc. I don't keep track of a day because, frankly, for most of my memories I don't remember exact dates. Perhaps that's part of turning 40. <span style="font-family:Wingdings">J</span> </p>
<p><img alt="The Memory Class Definition" src="http://blogs.vertigo.com/personal/paul/Blog/Lists/Photos/MemoryClass.jpg"> </p>
<p>I do keep track of one more thing for each memory … how I feel about the memory now when I think of it. I also keep track of how <em>strong</em> the feeling is. I think this is one of the unique parts of the application and makes the visualizations more compelling. I like to think it adds some depth to the data. In the timeline visualization above, each the color of each memory represents the feeling (happy, sad, or neutral). The size of the circle shows how strong the feeling is; the larger the circle, the stronger the feeling. </p>
<p><img alt="Circular Timeline" src="http://blogs.vertigo.com/personal/paul/Blog/Lists/Photos/CircularTimeline.jpg"> </p>
<p>The circular timeline shows the same data but in a different way. The center of the circle represents the year I was born and the outside is today. Going around the circle are the months of the year … 12 at the top, then 3, 6, 9, etc … like a clock. Because of that, I was able to loosely associate each quadrant with a season (winter, spring, summer, and fall). It's this circular view that surprised me the most. Once I added the memories to the application, I found that I tend to have a lot of memories that occurred during the summer. Learning more about myself was one of my goals in building the application. </p>
<p>Before this app my experience with XAML was with WPF. I was fortunate enough to do some development on the <a href="http://www.vertigo.com/familyshow" target="_blank">Family.Show</a> application that Vertigo built. WPF is so feature rich that I was reluctant to use Silverlight at first. After building 40, I'm impressed. While the features in Silverlight 2 are a subset of what is in WPF, it's a pretty nice subset … built-in controls, styles, data binding, etc. </p>
<p><img alt="Detail Window" src="http://blogs.vertigo.com/personal/paul/Blog/Lists/Photos/DetailWindow.jpg"> </p>
<p>The part I wasn't sure about was creating the visual representation of each memory. Creating visual elements dynamically in WPF is easy, but doing the same in Silverlight 1.0 wasn't so great. I wasn't a fan of creating large strings of XAML in Javascript. In Silverlight 2 I create the ellipse objects that represent the memories in C# when I load the form. To display them, I animate the opacity of each one. I created a storyboard in XAML and then use that same storyboard to animate each ellipse sequentially. I could have dynamically created a storyboard for each ellipse but because I wanted the animations to run sequentially, one storyboard was enough. In the storyboard completed event, I start the animation for the next ellipse. Memories fade in one at a time, just like they happened in my life. </p>
<p>I just started reading Ben Fry's new book, &quot;<a href="http://www.amazon.com/Visualizing-Data-Ben-Fry/dp/0596514557/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1205386328&amp;sr=8-1" target="_blank">Visualizing Data.</a>&quot; In it he talks about the seven stages to visualizing data: acquire, parse, filter, mine, represent, refine and interact. While the stages themselves are new to me, I realize that I went through a similar process in building 40. The refine stage really stands out to me. It was a very iterative process, adjusting and tweaking how I represent each memory, the timelines themselves, etc. At one point I also showed how well I remembered something by adjusting the opacity of the ellipse. In the end it seemed like this was just too much to take in and I thought it detracted from the display so I made the opacity of each ellipse the same. </p>
<p>While my data set was small and at first glance appears to be without much depth, I believe the personal nature of it provided depth. The visualizations are meaningful to me because the memories are mine. Applications I've built in the past are not usually for me. 40 is an application for me. I built it so I could learn about technology and learn more about myself. Once I finished it, I discovered something else. I wanted to share this personal map of my life with others. If you've watched the video and read this post, thank you. Creating 40 was a lot of fun. It looks like I have another memory to add to my timeline! </p>
<p> </p></div>]]></description></item><item><title>Vertigo Cheat Sheet for C#</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=39</link><pubDate>Wed, 12 Mar 2008 20:44:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=39#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass8038FFE9A3B844DF884553061AC29DB8>
<p>We fit every new feature of C# 3.0 in one printed, compliable page of text. </p>
<p><strong>Download </strong></p>
<ul>
<li><a href="http://blogs.vertigo.com/personal/scott/Blog/Blog%20Files/OnePager/Vertigo%27s%20One-Page%20of%20Everything.xps">XPS</a> </li>
<li><a href="http://blogs.vertigo.com/personal/scott/Blog/Blog%20Files/OnePager/Vertigo%27s%20One-Page%20of%20Everything.pdf">PDF</a> </li>
<li><a href="http://blogs.vertigo.com/personal/scott/Blog/Blog%20Files/OnePager/Vertigo%27s%20One-Page%20of%20Everything.doc">Word 2007</a>     </li></ul>
<p><strong>New Features </strong></p>
<ul>
<li>Auto-Implemented Properties </li>
<li>Extension Methods (EM) </li>
<li>Object Initializers </li>
<li>Collection Initializer and List Generic </li>
<li>Implicitly Typed Local Variable (var) </li>
<li>Lambda Expression (LE) </li>
<li>LINQ (uses LE, and EM) </li>
<li>Anonymous Type (AT)</li></ul></div>]]></description></item><item><title>How to filter Collections on the fly, using LINQ </title><link>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=9</link><pubDate>Tue, 04 Mar 2008 17:32:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=9#Comments</comments><dc:creator>jeffv</dc:creator><description><![CDATA[<div class=ExternalClass752440E462944817BBE03E5E4FE59C29>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>Back in February a fellow Vertigo employee, Alan, blogged about “<a href="http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=32">WPF: How to filter ListBox items on the fly</a>”, which got me thinking about how could I do the same thing with LINQ.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>Additionally, as I rarely have the luxury to be working with ObjectDataProviders, SqlDataProviders, DataSets, and such, a solution that worked with collections of Business Objects, which typically don’t have a “Filter” method, would be very useful.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Cambria color="#4f81bd" size=4>LINQ + Collections.Generic</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri>So with LINQ working with the generic collections, implementing a filter becomes very easy.<span>  </span></font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>In the below code I filter a List&lt;&gt; of <span style="color:#1f497d">NameEntry </span>objects<span style="color:#1f497d"> </span>for ListBox(lstNames) based on the value entered into a TextBox(txtFilter).<span>  </span><span style="color:#1f497d">NameEntry</span> has several properties, but we’re only interested in <span style="color:#1f497d">Name </span>for now.</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt;text-indent:0.5in;line-height:normal"><span style="font-size:10pt;color:#2b91af;font-family:'Courier New'">List</span><span style="font-size:10pt;font-family:'Courier New'">&lt;<span style="color:#2b91af">NameEntry</span>&gt; nameList = <span style="color:#2b91af">NameEntry</span>.GetTestDataList();</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>      </span><span style="background:yellow;color:blue">var</span><span style="background:yellow"> filteredList = <span style="color:blue">from</span> item <span style="color:blue">in</span> nameList</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;background:yellow;font-family:'Courier New'"><span>      </span><span>    </span><span style="color:blue">where</span> item.Name.ToLower().Contains(txtFilter.Text.ToLowerInvariant())</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;background:yellow;font-family:'Courier New'"><span>      </span><span>    </span><span style="color:blue">select</span> item;</span><span style="font-size:10pt;font-family:'Courier New'"></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>      </span>lstNames.DataSource = filteredList;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>      </span>lstNames.DataValueField = <span style="color:#a31515">&quot;Name&quot;</span>;</span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span style="font-size:10pt;line-height:115%;font-family:'Courier New'"><span>      </span>lstNames.DataBind();</span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>The highlighted code is all you need to accomplish this simple filter.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>Alternatively, you could replace the entire LINQ statement with a call to an extension method that LINQ adds to Generic Collections called Where&lt;&gt;(), like so:</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt 0.5in"><span style="font-size:10pt;background:yellow;color:blue;line-height:115%;font-family:'Courier New'">var</span><span style="font-size:10pt;background:yellow;line-height:115%;font-family:'Courier New'"> filteredList = nameList.Where(item =&gt;<br><span>      </span>item.Name.ToLowerInvariant().Contains(txtFilter.Text));</span><span style="font-size:10pt;line-height:115%;font-family:'Courier New'"></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>Which has even fewer characters of code; although for those unaccustomed to lambdas it can be harder to read. </font></p>
<div>3/24/08 - Corrected sample to use ToLowerInvariant()</div></div>]]></description></item><item><title>LINQ and n-tier architecture: choices, choices, choices...</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=30</link><pubDate>Tue, 04 Mar 2008 16:30:47 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=30#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClassB2BCCB0893D44BEC81C6951506766F80><p>One question when architecting an n-tier application using LINQ to SQL or LINQ to Entities is how far to commit to using LINQ. In other words, how deeply should you let the database LINQ technologies permeate the layers of the application. I've seen two general approaches:</p> <ol> <li>Commit fully to LINQ, and have the entire application use the objects that are being tracked for changes by the DataContext or ObjectContext. If you're using stateful model objects with stateless layers, this conceptually looks something like this:  <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/30/Layerdiagrampngforfullcommitment_2.png"><img border=0 alt="N-tier application with LINQ objects used in all layers" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/30/Layerdiagrampngforfullcommitment_thumb.png" width=646 height=219></a> </p> <li>Commit partially to LINQ, and have the business and presentation layers of the application use non-tracked objects. Confine LINQ to SQL or LINQ to Entities to the data access layer (DAL) only. This means you have two sets of objects: one for the data access layer, and another set for the other layers:  <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/30/Layerdiagrampngforpartialcommitment_2.png"><img border=0 alt="N-tier application using LINQ objects in the data access layer, and another set of objects in the other layers" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/30/Layerdiagrampngforpartialcommitment_thumb.png" width=658 height=223></a> </p></li></ol> <p>There are several reasons to commit fully (option 1 above):</p> <ul> <li>You get a lot in return: objects are automatically tracked by the context for changes, and then all changes can be saved with only a single method call.  <li>The context automatically ensures that you don't accidentally load two instances of the same object. (If you do, it quietly hands you another reference to the original object in memory.)  <li>This is also less code than option 2, as you only have one set of stateful objects, and you don't need to write code to go back and forth between the LINQ and non-LINQ objects.</li></ul> <p>Some reasons to not commit fully to LINQ (option 2 above) include:</p> <ul> <li>It makes it much easier to remove LINQ later--it's confined to the DAL, and there are no LINQ dependencies in the business or presentation layers.  <li>Committing fully to LINQ (option 1) makes the n-tier architecture a bit less clean--for example, any lazy loading that happens in the business logic can be considered data access logic that has escaped from the DAL. By confining LINQ objects to the data access layer (option 2), there won't be any LINQ objects to cause lazy loading in the business layer or presentation layer.  <li>If you are using LINQ to SQL, then it allows the business and presentation layers to use objects that are not identical in structure to the database tables. (This is more of a reason to use LINQ to Entities than to not commit fully to LINQ.)  <li>Due to the way LINQ to SQL is designed, it can be difficult to use in an n-tier architecture. For example, it's not currently possible to set the DataLoadOptions after the DataContext has been used to return data. One possibility is to forgo using DataLoadOptions entirely, but it depends on the application if that's a viable option. Another option is to organize the DataLoadOptions by page, and set the DataLoadOptions specific to a given page in the OnInit event handler of the page. However, these are a bit strange.</li></ul> <p>Choices, choices--what to do? Here are my thoughts/guidelines:</p> <ul> <li>If the application is fairly complex, tend toward option #1 (commit fully to LINQ to SQL/LINQ to Entities). By complex, I mean that you have object graphs with collections and/or many objects. In this case, the object change tracking from LINQ is great when you are adding, removing, and altering objects, and saves a huge amount of effort--enough to make it easily worth committing to LINQ fully.  <li>On the other hand, if you generally are working with a single object or a very few objects at a time in the code, object change tracking is much less valuable--you <strong>know </strong>which objects you've changed in this type of code. In this case, option #2 becomes less unattractive.  <li>Generally, tend toward LINQ to Entities (and the Entity Framework) rather than LINQ to SQL. There are many benefits to LINQ to Entities over LINQ to SQL, including the fact that it fits into an n-tier architecture more easily.</li></ul> <p>Personally, I like option #1--you get a lot of benefit from going &quot;all in&quot; with LINQ. And I enthusiastically suggest using LINQ to Entities rather than LINQ to SQL--you get a lot more flexibility.</p> <p>Note that, if you are converting an existing application to use LINQ, it might make sense to restrict the LINQ objects to the data access layer if it simplifies the conversion. (This will of course vary depending on the existing application's architecture.)</p></div>]]></description></item><item><title>Customizing a Windows Service during installation</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=38</link><pubDate>Fri, 29 Feb 2008 10:56:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=38#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass0C248FF5066246AFA2B30BF1EDF3AA2F>
<p>Recently, I needed to add the ability install multiple instances of a Windows Service we've been developing on a single server. After some initial research (read:Google), I was able to get it working. The basic steps are as follows: </p>
<ol>
<li>Override Installer.Install </li>
<li>Read the InstallContext for specified parameters </li>
<li>Update your service installer with any parameters you found </li>
<li>Call base.Install </li></ol>
<p><strong>Note:</strong> If you modify the ServiceInstaller.ServiceName property during Install, you will need to also modify it during Uninstall. </p>
<p>Here's some simple code to illustrate how to support customizations during installation. </p>
<p><pre><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System;<br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.ComponentModel; <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.Configuration.Install; <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.ServiceProcess; </span><p></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">namespace</span> MyApplication.WindowsServices <br></span><span style="font-size:10pt;font-family:Consolas">{ <br></span><span style="font-size:10pt;font-family:Consolas">    [<span style="color:#2b91af">RunInstaller</span>(<span style="color:blue">true</span>)] <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">partial</span> <span style="color:blue">class</span> <span style="color:#2b91af">MyServiceInstaller</span> : <span style="color:#2b91af">Installer <br></span></span><span style="font-size:10pt;font-family:Consolas">    { <br></span><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">private</span> <span style="color:#2b91af">ServiceProcessInstaller</span> processInstaller; <br></span><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">private</span> <span style="color:#2b91af">ServiceInstaller</span> serviceInstaller; </span><span style="font-size:10pt;font-family:Consolas">         </span></p>
<p><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> MyServiceInstaller() <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            InitializeComponent(); </span><span style="font-size:10pt;font-family:Consolas">             </span></p>
<p><span style="font-size:10pt;font-family:Consolas">            processInstaller = <span style="color:blue">new</span> <span style="color:#2b91af">ServiceProcessInstaller</span>(); <br></span><span style="font-size:10pt;font-family:Consolas">            processInstaller.Account = <span style="color:#2b91af">ServiceAccount</span>.User; <br></span><span style="font-size:10pt;font-family:Consolas">            Installers.Add(processInstaller); </span><span style="font-size:10pt;font-family:Consolas">             </span></p>
<p><span style="font-size:10pt;font-family:Consolas">            serviceInstaller = <span style="color:blue">new</span> <span style="color:#2b91af">ServiceInstaller</span>(); <br></span><span style="font-size:10pt;font-family:Consolas">            serviceInstaller.Description = <span style="color:#a31515">&quot;Provides functionality for doing something special.&quot;</span>; <br></span><span style="font-size:10pt;font-family:Consolas">            serviceInstaller.ServiceName = <span style="color:#a31515">&quot;My Services (Default)&quot;</span>; <br></span><span style="font-size:10pt;font-family:Consolas">            serviceInstaller.StartType = <span style="color:#2b91af">ServiceStartMode</span>.Automatic; <br></span><span style="font-size:10pt;font-family:Consolas">            Installers.Add(serviceInstaller); <br></span><span style="font-size:10pt;font-family:Consolas">        } </span></p>
<p><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">override</span> <span style="color:blue">void</span> Install(System.Collections.<span style="color:#2b91af">IDictionary</span> stateSaver) <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">if</span> (Context.Parameters.ContainsKey(<span style="color:#a31515">&quot;InstanceName&quot;</span>)) <br></span><span style="font-size:10pt;font-family:Consolas">            { <br></span><span style="font-size:10pt;font-family:Consolas">                <span style="color:blue">string</span> instanceName = Context.Parameters[<span style="color:#a31515">&quot;InstanceName&quot;</span>]; <br></span><span style="font-size:10pt;font-family:Consolas">                serviceInstaller.ServiceName = <span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;My Services ({0})&quot;</span>, instanceName); <br></span><span style="font-size:10pt;font-family:Consolas">            } </span><span style="font-size:10pt;font-family:Consolas">             </span></p>
<p><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">base</span>.Install(stateSaver); <br></span><span style="font-size:10pt;font-family:Consolas">        } </span></p>
<p><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">override</span> <span style="color:blue">void</span> Uninstall(System.Collections.<span style="color:#2b91af">IDictionary</span> savedState) <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">if</span> (Context.Parameters.ContainsKey(<span style="color:#a31515">&quot;InstanceName&quot;</span>)) <br></span><span style="font-size:10pt;font-family:Consolas">            { <br></span><span style="font-size:10pt;font-family:Consolas">                <span style="color:blue">string</span> instanceName = Context.Parameters[<span style="color:#a31515">&quot;InstanceName&quot;</span>]; <br></span><span style="font-size:10pt;font-family:Consolas">                serviceInstaller.ServiceName = <span style="color:#2b91af">String</span>.Format(<span style="color:#a31515">&quot;My Services ({0})&quot;</span>, instanceName); <br></span><span style="font-size:10pt;font-family:Consolas">            } </span></p>
<p><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">base</span>.Uninstall(savedState); <br></span><span style="font-size:10pt;font-family:Consolas">        } <br></span><span style="font-size:10pt;font-family:Consolas">    } <br></span><span style="font-size:10pt;font-family:Consolas">} </span></p></pre>
<p></p>
<p>Notice that if nothing is specified when invoking InstallUtil.exe, the installer won't fail. To actually install, type the following command in the directory where your service executable is located: </p>
<p><span style="font-family:Consolas">    <span style="font-size:10pt">InstallUtil /InstanceName=Production MyService.exe </span></span></p>
<p>To uninstall, make sure you specify the InstanceName parameter, or it won't find anything to uninstall. </p>
<p>    <span style="font-size:10pt;font-family:Consolas">InstallUtil /u /InstanceName=Production MyService.exe </span></p>
<p>Pretty easy, huh?</p></div>]]></description></item><item><title>Coming up for air</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=37</link><pubDate>Thu, 21 Feb 2008 15:38:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=37#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass61A5563B47EE49B182ECB54D9A959940>
<p><span style="font-size:10pt;font-family:Trebuchet MS">I've been pretty heads down for the last month or so, working on an application that fills a very interesting niche. Even though the project isn't done, there are a few things that I've been able to come away with. </span></p>
<p><span style="font-size:10pt;font-family:Trebuchet MS"><strong>LINQ is a huge productivity boost</strong></span><br>LINQ has saved quite a bit of development time over the last few weeks. Between the quick code generation (I used SqlMetal.exe to create the initial model, which I've modified since then) and compile time checking, I've really been able to cut down on the number of data-access errors that I always encounter during development. Having my queries defined right where I use them has made refactoring a breeze. Additionally, by calling DataContext.SubmitChanges() once all my modifications are complete, I get free transactional support. </p>
<p>Once I get a little more time and figure out an example data model to use, I'm planning on blogging about some of the neat things I've been able to do that you don't get to see in a typical keynote. Most of the examples and demos I've seen only really show how to perform simple reads—I'd like to take things a step further and show more complicated operations like grouping, inserts, updates, and deletes. </p>
<p><span style="font-size:10pt;font-family:Trebuchet MS"><strong>SCRUM is fantastic for managing projects<br></strong>In the past, I've been on projects that either used SCRUM incorrectly (read: only parts of SCRUM were used) or used SCRUM to internally manage work that was externally managed using a waterfall based approach. Having &quot;loosed the chains&quot; has really opened my eyes as to how SCRUM serves the development team AND the client. The ability to keep the work in sprints down to a manageable level, providing working code every few weeks, and adjusting priorities over the lifetime of a project have been very helpful. Another big bonus is being able to see the short-term progress in addition to the long-term progress. It's great motivation to see the backlog get shorter every sprint, and to see the spring burn-down moving along every day; it's also nice to be able to share that information with our clients, their confidence in us to increase continually. </span></p>
<p><span style="font-size:10pt;font-family:Trebuchet MS"><strong>Working at Vertigo is liberating</strong><br>I've worked at handful of companies over the years that have really stifled my creativity, usually through process or the slow adoption of technology. It's so much fun to work at a place where you can build an application using the newest tools and modern methodologies. I've been at Vertigo for almost 2 years now, and it's been a great ride so far. <a href="http://www.vertigo.com/Jobs.aspx">Wanna join me?</a> </span></p></div>]]></description></item><item><title>How to fix "cannot locate resource window1.xaml"</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=33</link><pubDate>Tue, 05 Feb 2008 10:25:47 GMT</pubDate><slash:comments>84</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=33#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClassCBCF30A739154775B02190E1F66AD22C><p>Sometimes when you download WPF demo source code off the net and try to build it, you'll get the error &quot;cannot locate resource window1.xaml&quot;.  You can also get this error when converting a VS2005 project to a VS2008 project. Several people have asked me about this issue, which can be easily remedied by:</p> <ol> <li>Right-clicking on the Solution or project file in Visual Studio and selecting &quot;Clean&quot;</li> <li>Or, add a space in App.xaml which will cause Visual Studio to clean and rebuild the whole project.</li></ol> <p>Hope this helps,</p> <p>Alan</p></div>]]></description></item><item><title>WPF: How to filter ListBox items on the fly</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=32</link><pubDate>Mon, 04 Feb 2008 16:38:39 GMT</pubDate><slash:comments>35</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=32#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClassAC97626D60654EAFA84E66C0C996EAA8><p>Here's a simple example that I created to show how to make a ListBox control that has many items more manageable. As you type into the filter TextBox, the ListBox will only show the items that matches the filter.  You can give the sample a try by clicking the XBAP link below.</p> <p><a title="http://blogs.vertigosoftware.com/Files/Alan/FilteredListBox/FilteredListBox.xbap" href="http://blogs.vertigosoftware.com/Files/Alan/FilteredListBox/FilteredListBox.xbap">http://blogs.vertigosoftware.com/Files/Alan/FilteredListBox/FilteredListBox.xbap</a></p> <p><a href="http://blogs.vertigosoftware.com/Files/Alan/FilteredListBox/FilteredListBox.xbap"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=546 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/32/image_3.png" width=473 border=0></a> </p> <p>The magic happens in code by retrieving the default view for the ListBox's ItemsSource and applying a filter against it.</p> <p><font face=Monospace size=-1><font color=blue>private</font><font color=black> </font><font color=blue>void</font><font color=black> FilterTextBox_TextChanged(</font><font color=blue>object</font><font color=black> sender, </font><font color="#2b91af">TextChangedEventArgs</font><font color=black> e)<br>{<br>    </font><font color=green>//Use collection view to filter the listbox<br></font><font color=black>    </font><font color="#2b91af">ObjectDataProvider</font><font color=black> peopleDS = (</font><font color="#2b91af">ObjectDataProvider</font><font color=black>)</font><font color=blue>this</font><font color=black>.Resources[</font><font color="#a31515">&quot;PeopleDS&quot;</font><font color=black>];<br>    </font><font color="#2b91af">ICollectionView</font><font color=black> collectionView = </font><font color="#2b91af">CollectionViewSource</font><font color=black>.GetDefaultView(peopleDS.ObjectInstance);<br>    collectionView.Filter = </font><font color=blue>new</font><font color=black> </font><font color="#2b91af">Predicate</font><font color=black>&lt;</font><font color=blue>object</font><font color=black>&gt;(NameFilter);<br>}<br><br></font><font color=blue>public</font><font color=black> </font><font color=blue>bool</font><font color=black> NameFilter(</font><font color=blue>object</font><font color=black> item)<br>{<br>    </font><font color="#2b91af">Person</font><font color=black> person = item </font><font color=blue>as</font><font color=black> </font><font color="#2b91af">Person</font><font color=black>;<br>    </font><font color=blue>return</font><font color=black> (person.DisplayName.ToLower().Contains(FilterTextBox.Text.ToLower()));<br>}</font> </font></p> <p>Here is the full source code:</p> <p><a title="http://blogs.vertigosoftware.com/Files/Alan/src/filteredlistbox.zip" href="http://blogs.vertigosoftware.com/Files/Alan/src/filteredlistbox.zip">http://blogs.vertigosoftware.com/Files/Alan/src/filteredlistbox.zip</a></p></div>]]></description></item><item><title>My WPF Bootcamp Presentation</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=31</link><pubDate>Tue, 29 Jan 2008 17:12:17 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=31#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClassD68632FE27984F89BF1A944361AA6E37><p><img style="border-right:0px;border-top:0px;margin:0px 0px 5px 10px;border-left:0px;border-bottom:0px" height=244 alt="WPF in Style" src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/31/image_3.png" width=324 align=right border=0> Last week, I gave a presentation at the Microsoft's WPF Bootcamp in Redmond. My presentation, titled &quot;WPF in Style&quot;, covered styling, templates, and User Experience in WPF. I describe my role as a Creative Developer at Vertigo and how we went about coming up with the design for <a href="http://www.vertigo.com/familyshow.aspx">Family.Show</a>. I gave quick demos using Blend to set brushes and resources. I used that demo to build up to my approaches on styling a button control and building an app that supports skinning.  I also talked a little bit about <a href="http://code.google.com/p/wittytwitter/">Witty</a>, my WPF twitter client.</p> <p>It was one of the rare times that I spoke to a crowd of attendees, but it seem to have went well even with my nervousness. I got the chance to meet and hang out with some really cool people in the WPF world, including <a href="http://joshsmithonwpf.wordpress.com/">Josh Smith</a>, <a href="http://rhizohm.net/irhetoric/">Karsten Januszewski</a>, and <a href="http://blogs.msdn.com/jaimer/">Jaime Rodriquez</a>.  I also took the opportunity to meet many of the attendees and share my experiences on being a creative developer and building real-world WPF applications. It's great to see the enthusiasms around WPF!</p> <p>The WPF Bootcamp was fun. It was good hear how Family.Show helped people with understanding the potentials of WPF as well as pushing WPF as a technology to use in their projects.</p> <p>You can get my slides from Karsten's blog: </p> <p><a title="http://rhizohm.net/irhetoric/blog/37/default.aspx" href="http://rhizohm.net/irhetoric/blog/37/default.aspx">http://rhizohm.net/irhetoric/blog/37/default.aspx</a></p></div>]]></description></item><item><title>Set default browser for Visual Studio projects</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=24</link><pubDate>Wed, 23 Jan 2008 06:53:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=24#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassEEA3496C6B4045B298D121315337BC9B><body>
<font face="Helvetica, Arial, sans-serif">I started
working on a web (Silverlight) project after years of creating desktop
applications, so this might be common knowledge... I use Firefox as my
browser but I want to use Internet Explorer when testing / debugging
the web project I'm working on. You can do this by:<br>
</font>
<ul>
  <li><font face="Helvetica, Arial, sans-serif">In
the Visual Studio project, right click on a web page (an .aspx file).</font></li>
  <li><font face="Helvetica, Arial, sans-serif">Select
    <b>Browse With...</b></font></li>
  <li><font face="Helvetica, Arial, sans-serif">Set
Internet Explorer as the default.</font></li>
</ul>
<blockquote><font face="Helvetica, Arial, sans-serif"><img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/vs-browse-with.png" height=235 width=503><br>
  </font></blockquote>
<font face="Helvetica, Arial, sans-serif">Now Firefox is
still my default browser, but Internet Explorer is the default browser
within Visual Studio.<br>
</font>
</div>]]></description></item><item><title>TeraCopy, file transfer utility for Vista</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=23</link><pubDate>Wed, 23 Jan 2008 06:30:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=23#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClass488945BB83F24147802E7E133B73D8BC><font face="Helvetica, Arial, sans-serif">I have had
various problems copying files from network and external drives with
Vista, I don't recall the exact problem, but the file transfer would
fail for one reason or another. I have been using a free utility called
<a href="http://www.codesector.com/teracopy.php">TeraCopy</a>
which has solved the problem, I can copy large files from one system to
another... pretty much like I could with XP.<br>
</font>
</div>]]></description></item><item><title>CreateTV, PBS how-to programs</title><link>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=22</link><pubDate>Tue, 22 Jan 2008 09:18:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Ralph/Blog/Lists/Posts/Post.aspx?ID=22#Comments</comments><dc:creator>Ralph</dc:creator><description><![CDATA[<div class=ExternalClassCEFB888B70AD49CD9AC59AFE9D5A0131><font face="Helvetica, Arial, sans-serif"><a href="http://www.createtv.com"><img alt=image src="http://blogs.vertigo.com/personal/ralph/Blog/Lists/Photos/create.png" align=right border=0 height=84 hspace=10 vspace=0 width=120></a>For the <del>many</del>, <del>several</del>,
<del>couple</del>, the other
person, that gets TV from an
over-the-air antenna, you might check your other PBS digital channels.
The <a href="http://www.klru.org">Austin PBS channel</a>
started broadcasting <a href="http://www.createtv.com">CreateTV</a>
on their second
digital signal 18.2. CreateTV is a collection of how-to PBS
programs. I find some useful, but it would be great if they also
broadcast a science-nature-history channel, with programs such as <a href="http://www.pbs.org/wgbh/nova">Nova</a>, <a href="http://www.pbs.org/wnet/nature">Nature</a>, and <a href="http://www.pbs.org/wgbh/amex">American Experience</a>.
<br>
<br>
CreateTV might be available on cable and satellite, I would check but I
need to climb on the roof and readjust the antenna.</font>
</div>]]></description></item><item><title>ION TTUSB</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=17</link><pubDate>Wed, 16 Jan 2008 16:51:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=17#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass82AF19B384794539BAC8706FF3605F8F>
<p>About a year ago I received an <a href="http://www.ion-audio.com/">ION</a> <a href="http://www.ion-audio.com/ionttusb">TTUSB</a>. It's a turntable that accepts 33's and 45's and has a USB output. I finally got around to using it last month to create some CDs for my mom from some old albums she has. My experience was good but the main problem I had along the way to a completely working system was configuring the audio properties on my computer. Initially, I was getting only mono recording. Here are the steps I took to get stereo.</p>
<p>First follow the directions to set up the turntable. This is mostly about attaching the belt and balancing the counterweight.</p>
<p>After plugging in the USB cable, you will see some notification bubbles about installing the hardware. When it is complete, you might need to change some of the audio properties. In the control panel, open &quot;Sounds and Audio Devices&quot;. Click the &quot;Audio&quot; tab and inspect the &quot;Default device&quot; in the &quot;Sound playback&quot; section. If it says &quot;USB Audio CODEC&quot;, change it to whatever other device you have that supports audio output.</p>
<p><img alt="Select an output-capable device for sound play-back." src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/011708_0032_IONTTUSB1.png"> </p>
<p>If you have a microphone, click the &quot;Voice&quot; tab and inspect the &quot;Default device&quot; in the &quot;Voice recording&quot; section. Again, if it says &quot;USB Audio CODEC&quot;, change it to whatever other device you have that supports your microphone.</p>
<p>If you're using <a href="http://audacity.sourceforge.net/download/">Audacity</a>, select &quot;Preferences…&quot; from the &quot;Edit&quot; menu. Inspect the devices and change the number of channels to 2 (Stereo). You might want to check the &quot;Software Playthrough&quot; check box so you can hear the music as it is recorded.</p>
<p><img alt="Select 2 channels for recording." src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/011708_0032_IONTTUSB2.png"> </p>
<p>Something else I did since I have a small system drive and a large data drive is change the temporary directory to my data drive. I clicked the &quot;Choose…&quot; button and selected my &quot;E:\tmp&quot; directory. It automatically appended &quot;audacity_temp&quot;.</p>
<p><img alt="Select a temporary file location on a large drive." src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/011708_0032_IONTTUSB3.png"> </p>
<p>Doing so will require restarting Audacity.</p>
<p>On <a href="http://www.ion-audio.com/">ION</a>'s <a href="http://www.ion-audio.com/ionttusb">TTUSB</a> page, you can download Audacity, the <a href="http://audacity.sourceforge.net/help/faq?s=install&amp;item=lame-mp3">LAME MP3 encoder</a> it requires if you want to create MP3 files, as well as the software and user guides.</p>
<p>One problem I experience is the occasional dropping of the input signal. If it gets too low, Audacity stops recording. I didn't see anything about it on the <a href="http://forums.ion-audio.com/forumdisplay.php?f=3">ION USB Turntables forum</a>, but I think it's an Audacity bug. I looked at Windows Task Manager and I noticed multiple instances of Audacity running. My work-around for this problem is to stop all such instances using the &quot;End Process&quot; button in Windows Task Manager.</p>
<p>A problem some people listed on the forum was with clipping. There's a gain control on the bottom next to the cables. Turn it down to fix the problem.</p>
<p>Another problem was an entire lack of input. Downloading an <a href="http://www.download.com/USB-Audio-ASIO-Driver/3000-2120_4-10561691.html">audio driver</a> fixed the problem for some.</p></div>]]></description></item><item><title>Summary of Job's 2008 MacWorld keynote</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=38</link><pubDate>Tue, 15 Jan 2008 10:53:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=38#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass0E193ADF7B0B423F905102C480806A3B>
<div>
<div class=Section1>
<p class=MsoNormal>This morning was Steve Job’s MacWorld keynote here in San Francisco. Here’s a summary of what took place. </p>
<p class=MsoNormal> </p>
<p class=MsoNormal><span style="font-size:14pt">Summary of MacWorld Keynote</span></p>
<p class=MsoNormal><b></b> </p>
<p class=MsoNormal><b>Time Capsule</b></p>
<p class=MsoNormal>- $500 wireless hub with 1TB drive for Time Machine backups of untethered laptops. Ships Feb.</p>
<p class=MsoNormal> </p>
<p class=MsoNormal><b>Leopard</b></p>
<p class=MsoNormal>- 5M copies sold in first 3 months.</p>
<p class=MsoNormal>- 20% of all Mac users have upgraded</p>
<p class=MsoNormal> </p>
<p class=MsoNormal><b>iPhone</b></p>
<p class=MsoNormal>- 20,000 sold each day. 4M sold in 200 days.</p>
<p class=MsoNormal>- New software: maps with triangulated location, SMS multiple people, custom home screen</p>
<p class=MsoNormal>- Software available today</p>
<p class=MsoNormal>- SDK in Feb.</p>
<p class=MsoNormal>- 19.5% of US SmartPhone market (2nd behind RIM)</p>
<p class=MsoNormal>- Lyrics for songs!</p>
<p class=MsoNormal> </p>
<p class=MsoNormal><b>iTunes</b></p>
<p class=MsoNormal>- 4B songs sold.</p>
<p class=MsoNormal>- 125M TV shows. 7M movies.</p>
<p class=MsoNormal>- 20M songs sold on Christmas day.</p>
<p class=MsoNormal>- Movie rentals. Every major studio.</p>
<p class=MsoNormal> </p>
<p class=MsoNormal><b>Apple TV Take 2</b></p>
<p class=MsoNormal>- HD rentals for $5</p>
<p class=MsoNormal>- Previews, Flickr and .Mac Photos</p>
<p class=MsoNormal>- Free update to existing Apple TV ($229 price)</p>
<p class=MsoNormal>- Digital copies on all Fox DVDs!</p>
<p class=MsoNormal> </p>
<p class=MsoNormal><b>MacBook Air</b> - &quot;World's Thinnest Notebook&quot;</p>
<p class=MsoNormal>- 0.16&quot; to 0.76&quot;. </p>
<p class=MsoNormal>- Fits in an envelope</p>
<p class=MsoNormal>- Multi-touch pad; Surface PC ships</p>
<p class=MsoNormal>- 80GB HD, 64GB SSD &quot;they're pricy but fast&quot;</p>
<p class=MsoNormal>- 1.8 GHz, Intel Core 2 Duo; 802.11N, 2GB, 5 hr battery</p>
<p class=MsoNormal>- 60% smaller, thick as a nickle, wide as a dime</p>
<p class=MsoNormal>- $1800 base price</p>
<p class=MsoNormal>- Fully recyclable aluminum case, first fully mercury and lead free display, </p>
<p class=MsoNormal>  circuit boards are BFR free, retail packaging are 56% less volume than MacBook.</p>
<p class=MsoNormal> </p>
<p class=MsoNormal><b>Summary of Apple in the first 2 weeks of 2008:</b></p>
<p class=MsoNormal>- New 8-core Mac Pro, new MacBook Air laptop, Time Capsule 802.11N + 1TB, iPhone and Apple TV software updates, iTune movie rentals</p>
<p class=MsoNormal> </p>
<p class=MsoNormal>Guests on stage: CEO of Intel, CEO of Fox, Randy Newman (groan)</p>
<p class=MsoNormal> </p></div></div></div>]]></description></item><item><title>DataContext and Properties?  NO!</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=36</link><pubDate>Tue, 08 Jan 2008 13:17:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=36#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass69B04A6DB0C146558D8016B6FC013E72>
<p>I was experimenting with the preview release of the new MVC framework yesterday. I was also using LINQ to perform my data access, and had some trouble when attempting to assign an anonymous type to the ViewData in the controller. As it turns out, you <em>can</em> assign anonymous types to ViewData, but you have to use reflection to access the properties, which stinks. Anyway, the error I kept getting was: </p>
<p style="margin-left:36pt">Value cannot be null.<br>Parameter name: source </p>
<p>Petar came over, and we were able to determine that the problem was with my DataContext class. Here's the definition, which I was using to access a local AdventureWorks database. </p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">class</span> <span style="color:#2b91af">AdventureWorks</span> : <span style="color:#2b91af">DataContext <br></span></span><span style="font-size:10pt;font-family:Consolas">    { <br></span><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> AdventureWorks(<span style="color:blue">string</span> connectionString) <br></span><span style="font-size:10pt;font-family:Consolas">            : <span style="color:blue">base</span>(connectionString) <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">        } </span></p>
<p><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:#2b91af">Table</span>&lt;<span style="color:#2b91af">Contact</span>&gt; Contacts { <span style="color:blue">get</span>; <span style="color:blue">set</span>;} <br></span><span style="font-size:10pt;font-family:Consolas">    } </span></p>
<p>What's weird was just changing the signature of the Contacts property to a public field worked! </p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:#2b91af">Table</span>&lt;<span style="color:#2b91af">Contact</span>&gt; Contacts;</span> </p>
<p>I opened Reflector and started digging around, only to find that the private method InitTables on the DataContext class only accesses fields, not properties. Best practices always state that fields should be exposed as properties, and at this point, it's just second nature to me to create a property instead of a public field. However, this &quot;requirement&quot; violates that recommendation, and I can't think of a reason why. Petar did suggest that there are hooks that can provide enough information about commands issued against a table, but it still seems a little weird.</p></div>]]></description></item><item><title>Alerting</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=35</link><pubDate>Tue, 08 Jan 2008 11:12:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=35#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass76B203D02178454F8970F2B8792F8235>
<p><span style="color:#4f81bd"><strong><em><font size=2>Introduction </font></em></strong></span></p>
<p>I'd like to introduce you to a new approach (pattern?) to widget communication within a dashboard style application. The basic idea is that a variable number of widgets are bound to a backend data source; each widget should be independent from the other widgets, but there needs to be a way for one widget to notify other widgets when something has changed. </p>
<p>Each widget is implemented as a web user control (ascx) whose contents are wrapped in an UpdatePanel for AJAX support. Since each user control is created dynamically, using delegates and events becomes difficult since event registration is not persisted in ViewState between post backs. That means that each event and its handler(s) would have to be re-wired on each user request. Additionally, the hosting page would have to have advanced knowledge of each control and what events it exposes, which leads to a tightly-coupled design. What we'd like is an approach where the widgets don't know about each other, where the widget container doesn't know about what the widgets can do, but where it's possible for widgets to send messages to each other. </p>
<p>Instead of using events, a different approach could be used involving interfaces to implement a dynamic publisher-subscriber alternative to events; I'll use the term &quot;Alert&quot; instead of &quot;Event&quot; to describe the messages that are passed. Alerts differ from events in that rather than registering for event notifications before the event occurs, the publishing component looks through the entire audience of possible subscribers and identifies the interested ones and calls them directly. The thought here is that classes can implement specific interfaces to identify their desire and capability to receive certain alerts. As long as there is a means to traverse the relevant objects in some sort of hierarchy, we can inspect each object to see if it should be alerted. All of this is a little abstract, so let's take a look at some code to see how this could work. </p>
<p><span style="color:#4f81bd"><strong><font size=2><em>Implementation </em></font></strong></span></p>
<p>The first thing that will be required is to create a new class that represents the arguments for an alert. </p><pre><p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System; </span><p></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">namespace</span> Vertigo.AlertingExample <br></span><span style="font-size:10pt;font-family:Consolas">{ <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">class</span> <span style="color:#2b91af">AlertArgs <br></span></span><span style="font-size:10pt;font-family:Consolas">    { <br></span><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">readonly</span> <span style="color:#2b91af">AlertArgs</span> Empty; </span><span style="font-size:10pt;font-family:Consolas">         </span></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> AlertArgs() <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">        } </span></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">static</span> AlertArgs() <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            Empty = <span style="color:blue">new</span> <span style="color:#2b91af">AlertArgs</span>(); <br></span><span style="font-size:10pt;font-family:Consolas">        } <br></span><span style="font-size:10pt;font-family:Consolas">    } <br></span><span style="font-size:10pt;font-family:Consolas">} </span></p>
</pre>
<p></p>
<p>Next, the interface used to identify a class as being interested in a particular type of alert is required. Implementing this interface is analogous to creating an event handler in a class. With generics, we can create a special interface that is extensible and will allow for custom typing to uniquely identify each variation of alert. </p><pre><p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System; </span><p></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">namespace</span> Vertigo.AlertingExample <br></span><span style="font-size:10pt;font-family:Consolas">{ <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">interface</span> <span style="color:#2b91af">IAlertable</span>&lt;T&gt; <span style="color:blue">where</span> T : <span style="color:#2b91af">AlertArgs <br></span></span><span style="font-size:10pt;font-family:Consolas">    { <br></span><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">void</span> Alert(<span style="color:blue">object</span> sender, T args); <br></span><span style="font-size:10pt;font-family:Consolas">    } <br></span><span style="font-size:10pt;font-family:Consolas">} </span></p>
</pre>
<p></p>
<p>Different subclasses of the <span style="font-size:10pt;color:#2b91af;font-family:Consolas">AlertArgs</span> class can now be defined and used in conjunction with the <span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">IAlertable</span>&lt;T&gt;</span> interface to uniquely identify subscribers based on the alerts they are interested in. </p>
<p>Now that we have a way to define subscribers, we need a way to create and send alerts. Since <span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">IAlertable</span>&lt;T&gt;</span> is based on subclasses of the <span style="font-size:10pt;color:#2b91af;font-family:Consolas">AlertArgs</span> class, we'll just create a class that inherits from <span style="font-size:10pt;color:#2b91af;font-family:Consolas">AlertArgs</span>. To keep the usage simple, our base alerting <span style="font-size:10pt;color:#2b91af;font-family:Consolas">AlertArgs</span> class will also provide methods to send alerts. </p><pre><p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System; <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.Web; <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.Web.UI; <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.Web.UI.WebControls; </span><p></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">namespace</span> Vertigo.AlertingExample <br></span><span style="font-size:10pt;font-family:Consolas">{ <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">class</span> <span style="color:#2b91af">BroadcastingAlertArgs</span>&lt;T&gt; : <span style="color:#2b91af">AlertArgs</span> <span style="color:blue">where</span> T : <span style="color:#2b91af">AlertArgs <br></span></span><span style="font-size:10pt;font-family:Consolas">    { <br></span><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">virtual</span> <span style="color:blue">void</span> Broadcast(<span style="color:blue">object</span> sender, <span style="color:#2b91af">Page</span> page) <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            Broadcast(sender, page.Controls); <br></span><span style="font-size:10pt;font-family:Consolas">        } </span></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">virtual</span> <span style="color:blue">void</span> Broadcast(<span style="color:blue">object</span> sender, <span style="color:#2b91af">Control</span> control) <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            Broadcast(sender, control.Controls); <br></span><span style="font-size:10pt;font-family:Consolas">        } </span></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">protected</span> <span style="color:blue">virtual</span> <span style="color:blue">void</span> Broadcast(<span style="color:blue">object</span> sender, <span style="color:#2b91af">ControlCollection</span> controls) <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">foreach</span> (<span style="color:#2b91af">Control</span> control <span style="color:blue">in</span> controls) <br></span><span style="font-size:10pt;font-family:Consolas">            { <br></span><span style="font-size:10pt;font-family:Consolas">                <span style="color:#2b91af">IAlertable</span>&lt;T&gt; alertableControl = control <span style="color:blue">as</span> <span style="color:#2b91af">IAlertable</span>&lt;T&gt;; <br></span><span style="font-size:10pt;font-family:Consolas">                <span style="color:blue">if</span> (alertableControl != <span style="color:blue">null</span> &amp;&amp; alertableControl != sender) <br></span><span style="font-size:10pt;font-family:Consolas">                { <br></span><span style="font-size:10pt;font-family:Consolas">                    alertableControl.Alert(sender, <span style="color:blue">this</span> <span style="color:blue">as</span> T); <br></span><span style="font-size:10pt;font-family:Consolas">                } </span></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas">                Broadcast(sender, control.Controls); <br></span><span style="font-size:10pt;font-family:Consolas">            } <br></span><span style="font-size:10pt;font-family:Consolas">        } <br></span><span style="font-size:10pt;font-family:Consolas">    } <br></span><span style="font-size:10pt;font-family:Consolas">} </span></p>
</pre>
<p></p>
<p>Since the alerting is occurring between user controls, we can use recursion to &quot;walk the tree&quot; of a control or page's control hierarchy, as seen in the <span style="font-size:10pt;font-family:Consolas">Broadcast</span> method. The concrete implementation of the Broadcast method iterates over each of the control's child controls, looking for any matches on the <span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">IAlertable</span>&lt;T&gt;</span> interface. If a match is found, its <span style="font-size:10pt;font-family:Consolas">Alert</span> method is called, passing in both the sender as well as the <span style="font-size:10pt;color:#2b91af;font-family:Consolas">AlertArgs</span> instance cast to the appropriate type. In other words, find any matching alert receivers and alert them. </p>
<p>Note that the class inherits from <span style="font-size:10pt;color:#2b91af;font-family:Consolas">AlertArgs</span> and has its type parameter <em>T</em> restricted to <span style="font-size:10pt;color:#2b91af;font-family:Consolas">AlertArgs</span>. </p>
<p><span style="color:#4f81bd"><strong><em><font size=2>Example </font></em></strong></span></p>
<p>Now that the plumbing is in place, here's an example implementation. </p><pre><p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System; </span><p></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">namespace</span> Vertigo.AlertingExample <br></span><span style="font-size:10pt;font-family:Consolas">{ <br></span><span style="font-size:10pt;font-family:Consolas">    [<span style="color:#2b91af">Serializable</span>] <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">class</span> <span style="color:#2b91af">ExampleAlertArgs</span> : <span style="color:#2b91af">BroadcastingAlertArgs</span>&lt;<span style="color:#2b91af">ExampleAlertArgs</span>&gt; <br></span><span style="font-size:10pt;font-family:Consolas">    { <br></span><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">protected string</span> message; </span></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> ExampleAlertArgs(<span style="color:blue">string</span><span style="color:#2b91af"> </span>message) <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">this</span>.message = message; <br></span><span style="font-size:10pt;font-family:Consolas">        } </span></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">virtual string</span> Message <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">get</span> { <span style="color:blue">return</span> message; } <br></span><span style="font-size:10pt;font-family:Consolas">        } <br></span><span style="font-size:10pt;font-family:Consolas">    } <br></span><span style="font-size:10pt;font-family:Consolas">} </span></p>
</pre>
<p></p>
<p>The <span style="font-size:10pt;color:#2b91af;font-family:Consolas">ExapmleAlertArgs</span> class inherits from <span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">BroadcastingAlertArgs</span>&lt;T&gt;</span> (and restricts its type parameter to <span style="font-size:10pt;color:#2b91af;font-family:Consolas">ExampleAlertArgs</span>) to provide specific alerting. </p>
<p>Note that the signature for this class is very strange! The type being declared is also used as the template type for the class it derives from. Strangely, however, this works just the way we want it to. </p>
<p>Now that we have our custom <span style="font-size:10pt;color:#2b91af;font-family:Consolas">BroadcastingAlertArgs</span> class, we can start broadcasting. </p><pre><p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">protected</span> <span style="color:blue">void</span> exampleButton_OnClick(<span style="color:blue">object</span> sender, <span style="color:#2b91af">AlertArgs</span> e) <br></span><span style="font-size:10pt;font-family:Consolas">{ <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:green">// Let all the other controls know that this control changed <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:#2b91af">ExampleAlertArgs</span> args = <span style="color:blue">new</span> <span style="color:#2b91af">ExampleAlertArgs</span>(<span style="color:#943634">&quot;Test&quot;</span>); <br></span><span style="font-size:10pt;font-family:Consolas">    args.Broadcast(<span style="color:blue">this</span>, Page); <br></span><span style="font-size:10pt;font-family:Consolas">} </span></p></pre><pre></pre>
<p></p>
<p>All that's required is that we instantiate the <span style="font-size:10pt;color:#2b91af;font-family:Consolas">ExampleAlertArgs</span> class and call its <span style="font-size:10pt;font-family:Consolas">Broadcast</span> method. So now we have the alert defined and being broadcast, but no sinks. Creating a control that receives alerts only requires that a subscribing class implement the <span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">IAlertable</span>&lt;T&gt;</span> interface. </p><pre><p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System; <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.Web.UI.WebControls; </span></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> Vertigo.AlertingExample; </span><p></p>
<p style="margin-left:36pt"><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">namespace</span> Vertigo.AlertingExample.Controls </span><span style="font-size:10pt;font-family:Consolas"><br>{ <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">partial</span> <span style="color:blue">class</span> <span style="color:#2b91af">ExampleControl</span> : <span style="color:#2b91af">UserControl</span>, <span style="color:#2b91af">IAlertable</span>&lt;<span style="color:#2b91af">ExampleAlertArgs</span>&gt; <br></span><span style="font-size:10pt;font-family:Consolas">    { <br></span><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">void</span> Alert(<span style="color:blue">object</span> sender, <span style="color:#2b91af">ExampleAlertArgs</span> args) <br></span><span style="font-size:10pt;font-family:Consolas">        { <br></span><span style="font-size:10pt;font-family:Consolas">            <span style="color:green">// Do something useful here <br></span></span><span style="font-size:10pt;font-family:Consolas">        } <br></span><span style="font-size:10pt;font-family:Consolas">    } <br></span><span style="font-size:10pt;font-family:Consolas">} </span></p>
</pre>
<p></p>
<p><span style="color:#4f81bd"><strong><em><font size=2>Summary </font></em></strong></span></p>
<p>Using alerting provides a loosely-coupled approach to eventing. Since neither the broadcaster nor the alert receiver know anything about the other, new sinks can be added simply by placing them on the page with the right signature. More alerts can be defined and broadcast without affecting any pre-existing code and two controls can send alerts to each other without introducing any circular dependencies or load order issues. Also, with both the alerting and alertable controls wrapped in UpdatePanels, the screen content will be changed without visible refreshes occurring in the browser. </p></div>]]></description></item><item><title>Approximating a Sine Wave with a Cubic Bézier Curve</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=16</link><pubDate>Mon, 07 Jan 2008 16:44:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=16#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClassE60602199AF84B36817EE593FE432518>
<p>The standard cubic Bézier curve is given by</p>
<p>P(t) = (1–t)<sup>3</sup>P<sub>0</sub> + 3(1–t)<sup>2</sup>tP<sub>1</sub> + 3(1–t)t<sup>2</sup>P<sub>2</sub> + t<sup>3</sup>P<sub>3</sub></p>
<p>To find an approximation of the sine curve given by y = sin(<sup><span style="font-family:Serif">π</span>x</sup>/<sub>2</sub>) over the interval [0, 1], set P<sub>0</sub> to (0, 0) and P<sub>3</sub> to (1, 1). Here are a few methods that give P<sub>1</sub> and P<sub>2</sub>.</p>
<h4>Linear Interpolation</h4>
<p>In the interval from P<sub>0</sub> to P<sub>3</sub>, choose two equally spaced points, Q<sub>1</sub> = P(<sup>1</sup>/<sub>3</sub>) and Q<sub>2</sub> = P(<sup>2</sup>/<sub>3</sub>). Expanding P(t) for Q<sub>1</sub> and Q<sub>2</sub> gives</p>
<p>Q<sub>1</sub> = <sup>8</sup>/<sub>27</sub>P<sub>0</sub> + <sup>4</sup>/<sub>9</sub>P<sub>1</sub> + <sup>2</sup>/<sub>9</sub>P<sub>2</sub> + <sup>1</sup>/<sub>27</sub>P<sub>3</sub><br>Q<sub>2</sub> = <sup>1</sup>/<sub>27</sub>P<sub>0</sub> + <sup>2</sup>/<sub>9</sub>P<sub>1</sub> + <sup>4</sup>/<sub>9</sub>P<sub>2</sub> + <sup>8</sup>/<sub>27</sub>P<sub>3</sub></p>
<p>Since P<sub>0</sub> and P<sub>3</sub> are known, this gives a linear system of two equations with two unknowns. Solving for P<sub>1</sub> and P<sub>2</sub> gives</p>
<p>P<sub>1</sub> = <sup>–5</sup>/<sub>6</sub>P<sub>0</sub> + 3Q<sub>1</sub> – <sup>3</sup>/<sub>2</sub>Q<sub>2</sub> + <sup>1</sup>/<sub>3</sub>P<sub>3</sub><br>P<sub>2</sub> = <sup>1</sup>/<sub>3</sub>P<sub>0</sub> – <sup>3</sup>/<sub>2</sub>Q<sub>1</sub> + 3Q<sub>2</sub> – <sup>5</sup>/<sub>6</sub>P<sub>3</sub></p>
<p>Choosing Q<sub>1</sub> = (<sup>1</sup>/<sub>3</sub>, <sup>1</sup>/<sub>2</sub>) and Q<sub>2</sub> = (<sup>2</sup>/<sub>3</sub>, <sup>√3</sup>/<sub>2</sub>) gives</p>
<p>P<sub>1</sub> = (<sup>1</sup>/<sub>3</sub>, <sup>11</sup>/<sub>6</sub> – <sup>3√3</sup>/<sub>4</sub>)<br>P<sub>2</sub> = (<sup>2</sup>/<sub>3</sub>, <sup>3√3</sup>/<sub>2</sub> – <sup>19</sup>/<sub>12</sub>)</p>
<p>However, this doesn't have the correct slopes at the end points. This means joining the various reflections of the curve to produce a complete sine wave will give sharp corners. This happened because of the assumption t = P<sub>x</sub>(t) at t = <sup>1</sup>/<sub>3</sub> and t = <sup>2</sup>/<sub>3</sub>. In fact, t is rarely equal to P<sub>x</sub>(t), such as at the end points in this case and in the trivial unity linear case. It's possible to choose different points for Q<sub>1</sub> and Q<sub>2</sub> or different values for t<sub>1</sub> and t<sub>2</sub>, but applying the correct constraints to do so for interpolation to yield the correct slopes is unwieldy.</p>
<h4>Curve Derivative</h4>
<p>To overcome the slope problem, ensure the slopes of the vectors at the end points of the derivative of P(t) match the values of the derivative of the sine curve.</p>
<p>P′(t) = –3(1–t)<sup>2</sup>P<sub>0</sub> + (3–9t)(1–t)P<sub>1</sub> + 3t(2–3t)P<sub>2</sub> + 3t<sup>2</sup>P<sub>3</sub><br>y′ = <sup><span style="font-family:Serif">π</span></sup>/<sub>2</sub>cos(<sup><span style="font-family:Serif">π</span>x</sup>/<sub>2</sub>)</p>
<p>Setting x = 0 gives y′ = <sup><span style="font-family:Serif">π</span></sup>/<sub>2</sub> and setting x = 1 gives y′ = 0. Determining appropriate values for P′(t), which gives vectors, requires more than knowing slopes, which are scalars. Fortunately, P′(t) also describes the arc velocity, <sup>dS</sup>/<sub>dt</sub>. Assuming dx = dt, <sup>dx</sup>/<sub>dt</sub> = 1 and <sup>dy</sup>/<sub>dt</sub> = y′. Since <sup>dS</sup>/<sub>dt</sub> = (<sup>dx</sup>/<sub>dt</sub>, <sup>dy</sup>/<sub>dt</sub>), P′(0) = (1, <sup><span style="font-family:Serif">π</span></sup>/<sub>2</sub>) and P′(1) = (1, 0). Finally, since P′(0) = –3P<sub>0</sub> + 3P<sub>1</sub> and P′(1) = –3P<sub>2</sub> + 3P<sub>3</sub>, this gives</p>
<p>P<sub>1</sub> = (<sup>1</sup>/<sub>3</sub>, <sup><span style="font-family:Serif">π</span></sup>/<sub>6</sub>)<br>P<sub>2</sub> = (<sup>2</sup>/<sub>3</sub>, 1)</p>
<h4>Simple Cubic</h4>
<p>Another solution is to use a simple cubic, f(x) = ax<sup>3</sup> + bx<sup>2</sup> + cx + d, and choose its coefficients such that it meets our criteria. Starting with P<sub>0</sub> = (0, 0) and P<sub>3</sub> = (1, 1) gives d = 0 and a + b + c = 1. So the slopes will provide for a smooth piece-wise sine wave, choose appropriate values for its derivative</p>
<p>f′(x) = 3ax<sup>2</sup> + 2bx + c</p>
<p>Choosing f′(0) = <sup><span style="font-family:Serif">π</span></sup>/<sub>2</sub> and f′(1) = 0 gives c = <sup><span style="font-family:Serif">π</span></sup>/<sub>2</sub> and 3a + 2b = <sup>–<span style="font-family:Serif">π</span></sup>/<sub>2</sub>. Combining these with a + b + c = 1 gives</p>
<p>a = <sup><span style="font-family:Serif">π</span></sup>/<sub>2</sub> – 2<br>b = 3 – <span style="font-family:Serif">π</span><br>c = <sup><span style="font-family:Serif">π</span></sup>/<sub>2</sub><br>d = 0</p>
<p>The next step is to convert the simple cubic equation into the Bézier equation. Let t = x and use a linear transform, given by the following matrix, to convert from the simple cubic basis, (t<sup>3</sup>, t<sup>2</sup>, t, 1), to the cubic Bézier basis, (–t<sup>3</sup>+3t<sup>2</sup>–3t+1, 3t<sup>3</sup>–6t<sup>2</sup>+3t, –3t<sup>3</sup>+3t<sup>2</sup>, t<sup>3</sup>).</p>
<div>
<table style="border-collapse:collapse;text-align:center" cellpadding=2 border=0>
<tbody valign=top>
<tr>
<td style="border-top:black 0.5pt solid;border-left:black 0.5pt solid;width:6%">  </td>
<td style="width:22%">0 </td>
<td style="width:22%">0 </td>
<td style="width:22%">0 </td>
<td style="width:22%">1 </td>
<td style="border-right:black 0.5pt solid;border-top:black 0.5pt solid;width:6%">  </td></tr>
<tr>
<td style="border-left:black 0.5pt solid">  </td>
<td>0 </td>
<td>0 </td>
<td><sup>1</sup>/<sub>3</sub> </td>
<td>1 </td>
<td style="border-right:black 0.5pt solid">  </td></tr>
<tr>
<td style="border-left:black 0.5pt solid">  </td>
<td>0 </td>
<td><sup>1</sup>/<sub>3</sub> </td>
<td><sup>2</sup>/<sub>3</sub> </td>
<td>1 </td>
<td style="border-right:black 0.5pt solid">  </td></tr>
<tr>
<td style="border-left:black 0.5pt solid;border-bottom:black 0.5pt solid">  </td>
<td>1 </td>
<td>1 </td>
<td>1 </td>
<td>1 </td>
<td style="border-right:black 0.5pt solid;border-bottom:black 0.5pt solid">  </td></tr></tbody></table></div>
<p>Applying the above matrix to the above coefficients gives (0, <sup><span style="font-family:Serif">π</span></sup>/<sub>6</sub>, 1, 1) for the y components of P(t), P<sub>y</sub>(t). Applying it to (0, 0, 1, 0) gives (0, <sup>1</sup>/<sub>3</sub>, <sup>2</sup>/<sub>3</sub>, 1) for the x components of P(t), P<sub>x</sub>(t). Extracting the second and third elements of these results for the control points gives</p>
<p>P<sub>1</sub> = (<sup>1</sup>/<sub>3</sub>, <sup><span style="font-family:Serif">π</span></sup>/<sub>6</sub>)<br>P<sub>2</sub> = (<sup>2</sup>/<sub>3</sub>, 1)</p>
<p>This is the same result derived in the previous section. This is not surprising since the constraints are the same.</p>
<h4>Links</h4>
<p><a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve">Wikipedia – Bézier Curve</a><br><a href="http://www.cocoadev.com/index.pl?search=DrawingArbitaryCurvesFromPoints">Drawing Arbitary Curves From Points</a> – derivation of linear interpolation<br><a href="http://mrl.nyu.edu/~perlin/courses/fall2007/splines1.html">NYU course – Introduction to splines</a> – introduces the Bézier matrix<br><a href="http://en.wikipedia.org/wiki/Invertible_matrix">Wikipedia – Invertible matrix</a></p></div>]]></description></item><item><title>Spin Buffers for Message Passing</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=13</link><pubDate>Fri, 04 Jan 2008 13:11:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=13#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass63445079DAC641FA874A59DA579C2A97>
<p>There is a post on <a href="http://www.ddj.com/">Dr. Dobb's</a> about a message passing mechanism called <a href="http://www.ddj.com/architect/199902669">Spin Buffers</a>. The author of the article starts with a discussion of the canonical message passing <a href="http://en.wikipedia.org/wiki/Producer-consumer_problem">producer-consumer problem</a> and how the message buffer requires synchronization to prevent race conditions. He then says spin buffers don't need synchronization or low-level atomic operations.</p>
<p>Before presenting spin buffers, he discusses a common solution to the producer-consumer problem, <a href="http://en.wikipedia.org/wiki/Circular_buffer">ring buffers</a>. His implementation includes a buffer size to resolve the ambiguity of the read and write pointers referencing the same location. Of course, access to multiple variables by multiple threads requires synchronization. This can cause contention and blocking between threads, reducing performance.</p>
<p>Finally, he discusses his implementation of spin buffers, describing them as &quot;three internal ordered buffers&quot; referenced by two pointers, one for the reader and one for the writer.</p>
<p><img alt="I think the 0, 1, 2 labels are backwards." src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/010308_2242_SpinBuffers1.png"></p>
<p>He then describes the put and get methods.</p>
<p>Put</p>
<ol>
<li>Put the item into the write buffer.</li>
<li>If the next buffer is free, make the free buffer become the write buffer, and the current write buffer becomes free.</li></ol>
<p>Get</p>
<ol>
<li>Read the item from the read buffer.</li>
<li>If the current read buffer is empty and the next buffer is free, make the next buffer the read buffer, and the current read buffer becomes free.</li></ol>
<p>He also discusses some of the caveats to using spin buffers as well as a performance comparison of ring buffers, a concurrent linked queue, and his spin buffers. The results he presents show spin buffers have a significant margin.</p>
<p>While his algorithm is perhaps correct in certain cases, there are cases where it definitely is not. For instance, if the compiler optimizer decides to reorder the code, it will fail. Even if the compiler doesn't, the processor might, especially on newer processors that use <a href="http://en.wikipedia.org/wiki/Release_consistency">release consistency</a> (e.g. Itanium). (See <a href="http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=14">my previous post on consistency models</a>.)</p>
<p>Also, the ring buffer implementation he chose isn't very good for multi-threading. A better variant is to not use a buffer size and instead assume equal pointers means the buffer is empty. Such an implementation can be lock-free (but not synchronization-free), although it does mean leaving one entry in the buffer unused. This isn't a problem unless you're in an extremely tight memory environment (e.g. <a href="http://en.wikipedia.org/wiki/Sinclair_ZX81">Sinclair ZX81</a>).</p>
<p>The article refers to a paper about concurrent queue algorithms (<a href="http://www.cs.rochester.edu/u/michael/PODC96.html">abstract</a>, <a href="http://www.research.ibm.com/people/m/michael/podc-1996.pdf">paper</a>, <a href="http://www.cs.rochester.edu/u/michael/pseudocode/PODC96-pc.html">pseudo-code</a>) which are the basis for Java's <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html">ConcurrentLinkedQueue</a> class. There is <a href="ftp://ftp.cs.rochester.edu/pub/packages/sched_conscious_synch/concurrent_queues/">source code</a>, but it's in uncommented C and MIPS assembly. Nonetheless, the paper has a thorough discussion of the testing environment and methodology. In comparison, the spin buffer article author's tests are overly simplistic, largely invalidating his results.</p>
<p>You can download <a href="ftp://66.77.27.238/sourcecode/ddj/2007/0707.zip">the source code for the issue</a>, but the enclosed Zip file which contains the test code for this article, spin.zip, appears to be corrupt or at least incomplete. It doesn't really matter since the author's own implementation of spin buffers is incorrect. I verified this by trying to perform my own tests. It fails in exactly the way revealed <a href="http://michael.procter.org.uk/2007/08/02/spin-buffers/">here</a> where there is additional discussion about better solutions, ring buffers among them.</p></div>]]></description></item><item><title>Consistency Models</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=14</link><pubDate>Thu, 03 Jan 2008 18:04:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=14#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClassA0874BC727754244AC1669B619E7CE80>
<p>While working on <a href="http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=13">my subsequent post about message passing</a>, I realized I was creating a great deal of background information. So, rather than having that post be about two subjects, I decided to split it and discuss here the background information, <a href="http://en.wikipedia.org/wiki/Consistency_model">consistency models</a>.</p>
<p>I will discuss only two of them here, <a href="http://en.wikipedia.org/wiki/Sequential_consistency">sequential consistency</a>, adhered to by all older processor architectures, and <a href="http://en.wikipedia.org/wiki/Release_consistency">release consistency</a>, adhered to by some newer processor architectures (e.g. Itanium), because these two appear in most discussions. (I wasn't able to find a definitive list of which architectures supported which consistency models.) You can read about all of them in more depth <a href="http://cs.gmu.edu/cne/modules/dsm/green/memcohe.html">here</a>.</p>
<p>Consistency isn't so much a processor concept as a distributed system (or, more specifically, distributed shared memory) concept. Nonetheless, it is the processors and the bus architectures in which they appear that constitute the hardware implementation of the nodes in a distributed system. A processor that supports such relaxed consistency models makes it easier to design architectures and write software to take advantage of them.</p>
<p>Sequential consistency is the &quot;common sense&quot; consistency. That is, if one thread of execution writes to location X and then location Y, all observers of those locations will see such changes to those locations in the same order. It certainly suits programmers (i.e., humans) to view the machine's behavior in this way. It seems downright strange to expect it to happen any other way.</p>
<p>However, it's not very efficient from the machine's point of view. For instance, it's likely to be more efficient for a processor to flush its cache in order of increasing address to take advantage of the burst modes of modern memory. In this case, if location X appears &quot;higher&quot; in memory than location Y, observers of these locations can easily see them in the &quot;wrong&quot; order. Such behaviors that arise due to the hardware designer's desire to improve performance are why there are different consistency models.</p>
<p>Although release consistency allows such out-of-order behavior, it does have rules that bound this behavior so programmers can understand what is happening and write programs that are correct without sacrificing too much performance. While there are places you can read about release consistency (such as <a href="http://www.cs.rochester.edu/research/cashmere/SC95/intro.html">here</a>), there aren't that many places that boil it down to simple rules a programmer can follow to know when to worry about it. I prefer <a href="http://groups.google.com/group/comp.programming.threads/browse_thread/thread/3e274ea5f41411bf/31e08ebddf3ab092%2331e08ebddf3ab092">Scott Meyer's take</a> on it (emphasis mine).</p>
<ul>
<li>When you want to read the value of a variable giving you permission to access shared state, label the read as an <strong>acquire</strong>.</li>
<li>When you are done accessing shared state, label the write of the permission variable as a <strong>release</strong>.</li></ul>
<p>(An &quot;acquire&quot; is the complementary operation of a &quot;release&quot;, from which this consistency model gets its name. See the second paragraph of <a href="http://www.cs.rochester.edu/research/cashmere/SC95/intro.html">the introduction</a> of the aforementioned paper.) These are the very situations in which you actually care about the order of access: shared state used by multiple threads of execution. When one thread is modifying shared state, you want to know no other thread is modifying the same state until the first one is done. For instance, if two threads attempt to increment a variable at the same time, one of the increments is lost.</p>
<p>Consider the simple C# statement ++x. It certainly looks atomic; it's only three characters! However, at the machine code level, it becomes essentially three statements.</p>
<ol>
<li>Read the value of x.</li>
<li>Increment it.</li>
<li>Write the value of x.</li></ol>
<p>Even if there's a single machine instruction to increment a memory location, the bus sees two actions, one to read a value from an address (the value of x before the processor increments it) and another to write a value to that address (the value of x after the processor increments it). It's entirely possible for another thread on another processor to pre-empt the first one's bus accesses between the read and the write and perform the same read and write. And, if the increment is not a single machine instruction, it can be another thread on a uniprocessor machine. This is why one must acquire a lock before modifying x.</p>
<p>However, locks in high-level languages are a kernel-level concept, which means they're implemented in as system library calls, while acquire and release are machine-level concepts, which means they're often implemented as special versions of the processor's load and store operations.</p>
<p>While the increment example requires a lock, there are several other important problems whose solutions don't. One such problem is the <a href="http://en.wikipedia.org/wiki/Producer-consumer_problem">producer-consumer problem</a>, in which one thread &quot;produces&quot; items of work while another &quot;consumes&quot; them. A common solution to this problem is the <a href="http://en.wikipedia.org/wiki/Circular_buffer">ring buffer</a>. Depending on the implementation, this solution requires no locks or special instructions so long as the compiler optimizer doesn't reorder the code, there is only one producer and one consumer, and the machine on which it runs uses sequential consistency.</p>
<p>On a machine that uses release consistency, it's possible for the consumer to read invalid data from the buffer even with the other two aforementioned restrictions. This can happen because the processor flushed its cache containing the producer's writes in the &quot;wrong&quot; order, allowing the consumer to read an updated &quot;ready&quot; flag before reading updated buffer data. This is a situation in which one must be aware of &quot;acquire-release&quot; semantics.</p>
<p>The .NET framework provides <a href="http://msdn2.microsoft.com/en-us/library/bkb1k2x8.aspx">Thread</a> class methods that express such semantics. These methods have been available since version 1.1.</p>
<p><a href="http://msdn2.microsoft.com/en-us/library/system.threading.thread.volatileread.aspx">Thread.VolatileRead</a> says it &quot;obtains the very latest value written to a memory location by any processor.&quot; While that's true, there's more to it than that. It ensures the current thread does not read writes to any locations performed by other threads after this location.</p>
<p><a href="http://msdn2.microsoft.com/en-us/library/system.threading.thread.volatilewrite.aspx">Thread.VolatileWrite</a> says it &quot;ensures that a value written to a memory location is immediately visible to all processors.&quot; Again, there's more to it than that. It ensures the current thread's writes to any locations occur before this one.</p>
<p><a href="http://msdn2.microsoft.com/en-us/library/system.threading.thread.memorybarrier.aspx">Thread.MemoryBarrier</a> does it both ways: &quot;The processor executing the current thread cannot reorder instructions in such a way that memory accesses prior to the call to MemoryBarrier execute after memory accesses that follow the call to MemoryBarrier.&quot;</p>
<p>C# has the volatile keyword that ensures all reads of variables with which it appears are volatile reads and all writes to such variables are volatile writes. There is an excellent discussion of exactly these issues in <a href="http://www.ddj.com/windows/184405316">the Dr. Dobb's article on memory consistency and .NET</a>.</p></div>]]></description></item><item><title>Using invalid addresses to avoid accidental emailing, a.k.a. "the Outlook oops!"</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=29</link><pubDate>Tue, 18 Dec 2007 14:35:55 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=29#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass36DD93BED7E54FA69A5C98A92B613EB9><p>I use Microsoft Office Outlook 2007 as my email client program. As part of my project management duties, I send a lot of emails. For the most part I really like Outlook, but I have had one issue: occasionally I have sent emails accidentally while I was still in the process of composing them.</p> <p>The keyboard shortcut for sending an email is Alt-S:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/29/OutlookEmailWindow.png"><img height=552 alt="Outlook email window (Alt-S is the shortcut for Send)" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/29/OutlookEmailWindow_thumb.png" width=860 border=0></a></p> <p>Part of the problem is that the keyboard shortcut for snoozing a reminder is also Alt-S:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/29/Outlookreminderdialog_2.png"><img height=344 alt="Outlook reminder dialog (Alt-S is the shortcut for Snooze)" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/29/Outlookreminderdialog_thumb.png" width=448 border=0></a> </p> <p>Other ways of accidentally sending emails are:</p> <ul> <li>Saving an email is Ctrl-S--accidentally pressing Alt rather than Ctrl will send it</li> <li>Ctrl-Enter can send the email (if it's configured that way)</li> <li>Clicking <strong>Send </strong>on the wrong email window</li> <li>Other random mistakes</li></ul> <p>Several years ago I was rushing to finish an email to a client in the minutes before a conference call with them, and the reminder for the meeting popped up. I instinctively pressed Alt-S to snooze it, but as it was popping up, I had been Alt-tabbing between applications, and my email message window ended up with the focus. The email window immediately vanished--it took me a second to realize I'd <strong>just sent my incomplete email</strong>. Fortunately, I reviewed the email and it actually made sense and was reasonably complete.</p> <p>After this, I thought a bit about how to avoid this in the future. A solution I came up with is to enter something into the To or CC line of the email that Outlook can determine <strong>isn't a valid email address</strong>. Since Outlook can figure out it isn't a valid email address, it will refuse to send. At my company, I use &quot;xxx&quot; as the invalid address:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/29/Outlookemailwithxxx_4.png"><img height=483 alt="Incomplete email with the &quot;xxx&quot; invalid address" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/29/Outlookemailwithxxx_thumb_1.png" width=783 border=0></a> </p> <p>If I accidentally press Alt-S (or click <strong>Send </strong>for that matter) the email is not sent, and I get the Check Names dialog instead:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/29/Outlookchecknamesnoxxx_2.png"><img height=319 alt="Outlook Check Names dialog: &quot;Microsoft Office Outlook does not recognize 'xxx'.&quot;" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/29/Outlookchecknamesnoxxx_thumb.png" width=412 border=0></a> </p> <p>This is my emailing safety net--I can have a number of emails I'm in the process of composing, and I'm not at risk of accidentally sending any of them. This has saved me from &quot;premature emailing&quot; several times.</p> <p>Note that this only works if the invalid address is not a valid email, and not something that Outlook is able to auto-complete into a valid email! For example, if I just used a single &quot;x&quot;, we have an email list at my company that starts with an x, and Outlook will automatically complete it and send it. To test an invalid address, open a blank email, type in the invalid address, and click <strong>Check Names</strong>. If it resolves, it's not usable for blocking. If you get the Check Names dialog above, it works.</p> <p>Once you are ready to send the email, just delete the invalid address and press Alt-S.</p> <p>The only trick to this is to get into the habit of adding the &quot;xxx&quot; to the email when you start composing it.</p></div>]]></description></item><item><title>Slide.Show: My Silverlight 1.0 lb. baby</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=14</link><pubDate>Mon, 17 Dec 2007 13:23:00 GMT</pubDate><slash:comments>7</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=14#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
My last blog post was about my new baby, Daniel, born in August. At 10 lbs. he was one BIG baby!
 
My most recent birth was to Slide.Show, another rather large baby of mine. After nearly two months of long hours and a few weekends, our team proudly released/launched/birthed Slide.Show on CodePlex as an open source Silverlight 1.0 control for publishing highly-customizable photo slideshows on the Web. It's now part of the .Show family of products recently released by Vertigo, which includes Family.Show and Video.Show, equally cool and impressive projects that you should check out, too.
 
Slide.Show been getting quite a bit of attention lately, especially after Nikhil Kothari blogged about it. In just one week after our 1.1 release, we've had over 500 downloads and quite a warm reception. That brings us to nearly 1000 total downloads in under a month, and puts us in the top 50 projects at CodePlex (out of 3000+ total projects), and #1 and #3 in the "slideshow" and "Silverlight" categories, respectively!
 
My team poured its heart and soul into this little baby, trying to make it as extensible and customizable as possible. I just can't wait to see how the open source and design communities foster it and help it grow...
 


 Technorati Profile]]></description></item><item><title>Vista on a MacBook Pro: Perspective from a Windows Developer</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=37</link><pubDate>Mon, 10 Dec 2007 15:12:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=37#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass18E08965ACAD419CA2F762F6935AE1AE>
<p><span style="color:#1f497d">&quot;Perspective, do you have any of that tonight?&quot; – Antono Ego, <em>Ratatouille. </em></span></p>
<p><span style="color:#1f497d">Sure the MacBook Pro runs Vista faster than any other laptop (watch <a href="http://www.apple.com/getamac/"></span>Misprint<span style="color:#1f497d"></a> or read the <a href="http://www.pcworld.com/article/id,136649-page,3-c,notebooks/article.html"></span>PC World<span style="color:#1f497d"> article)</a>. But after spending about 20 hours using it this weekend to work on a Visual Studio 2008 demo, allow me to share some perspective. For those of you barely containing your contempt for Apple, the gripes should satisfy your rage for another month.<em> </em></span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/121007_2312_VistaonaMac1.jpg"><span style="color:#1f497d"> </span></p>
<p><span style="color:#1f497d">But for others, like my friend <a href="http://geekswithblogs.net/jalexander/Default.aspx"></span>John Alexander<span style="color:#1f497d"></a> who are seriously contemplating a new laptop, there are serious choices to make (mostly between Apple, Dell and Lenovo). Of course, he's concerned about giving in to the dark side (dark, as in Job's <a href="http://www.vgcats.com/comics/?strip_id=186"></span>black mock turtleneck<span style="color:#1f497d"></a>) while still properly <a href="http://theregion.com/"></span>representin'<span style="color:#1f497d"></a>. If you grew up programming in Windows and are agonizing over the same decision, here's some perspective from me. </span></p>
<p><span style="color:#1f497d">First, let's start with a little quiz. Are you: </span></p>
<ul>
<li><span style="color:#1f497d">Curious about how the other (better dressed) half lives? </span></li>
<li><span style="color:#1f497d">Using an iPod and couldn't care less about the Zune? </span></li>
<li><span style="color:#1f497d">Living within 30 minutes of an Apple Store? </span></li>
<li><span style="color:#1f497d">Spending a lot of leisure time lounging at the local Starbucks? </span></li></ul>
<p><span style="color:#1f497d">If you answered yes<strong> </strong>to these questions, the scales tip in favor of a <strong>MacBook</strong>. </span></p>
<p><span style="color:#1f497d">Quiz 2, do you: </span></p>
<ul>
<li><span style="color:#1f497d">Spend most 80% of your time in Visual Studio? </span></li>
<li><span style="color:#1f497d">Plan on blowing away the Leopard partition to maximize space for Vista? </span></li>
<li><span style="color:#1f497d">PWNWTFBBQ in video games? </span></li></ul>
<p><span style="color:#1f497d">Then yes, go with a <strong>Dell or Thinkpad T60</strong> with a decent (i.e., non-integrated Intel) video card. </span></p>
<p><span style="color:#1f497d">For me, my personal life (pictures, movies, music and casual browsing) centers on the MacBook running Lepoard OS X. Professional (CEO and general development) stuff is done on a Dell Precision desktop (quad-core) and the MacBook Pro in Vista. I also have a Thinkpad X60 for the Tablet functions and when I need a really tiny footprint. </span></p>
<p><span style="color:#1f497d">But what good is a laptop if it's powered off? </span></p>
<p><span style="font-size:14pt;color:#1f497d"><strong>Boot Time </strong></span></p>
<p><span style="color:#1f497d">The Mac wins on <strong>boot time alone</strong>. Given a choice between grabbing my Thinkpad X60 or the MacBook, Apple wins simply for the fact that the damn thing boots, sleeps and shuts down obediently and quickly. </span></p>
<p><span style="color:#1f497d">Vista power-up to desktop takes 50 seconds to the login screen, then another 30 seconds to a usable desktop after logging in. That's 1:20 seconds versus just 50 seconds to the desktop in Leopard. Granted, I don't actually log in, but the ability to press the power button then come back less than a minute later and start working is sweet. </span></p>
<p><span style="color:#1f497d">Power down is a different story. Just 12 seconds for Leopard versus 35 seconds for Vista. </span></p>
<p><span style="color:#1f497d">But here's the thing: I rarely power-up or power-down OS X. I just shut the lid and <strong>sleep</strong> works. Always. Maybe Vista SP1 will fix this, but it doesn't work enough now for me to fully trust it. Then there's the scenario where you shut down Vista, close the screen, it goes to <strong>sleep</strong> instead. So when you reopen the lid, it faithfully resumes the shut down process. ARGH! </span></p>
<p><span style="color:#1f497d">Now, I have purchased over a hundred IBM (Lenovo) Thinkpads for my company over the past 5 years. Our current <em>de facto</em> box is the Thinkpad T60, a very fine machine. I still pine for my Thinkpad T60, which I passed on to one of our developers. </span></p>
<p><span style="color:#1f497d">Here's a short list of pros and cons for Windows developers contemplating running Vista through Boot Camp: </span></p>
<p><span style="font-size:14pt;color:#1f497d"><strong>Cons </strong></span></p>
<ol>
<li><span style="color:#1f497d">The MacBook Pro can get quite <strong>hot </strong>in Vista. I should've measured it, but couldn't find my <a href="http://www.thermoworks.com/products/ir/irfs.html"></span>gauge<span style="color:#1f497d"></a>. Only matters when employed in literal laptop-mode and easily remedied by a pillow or heat-shield. If you need to type for long periods of time, it will be uncomfortable. The power management works much much better in OS X; barely warmer than a kitten. </span></li>
<li><span style="color:#1f497d">The <strong>keyboard layout</strong> is just enough different from Windows to constantly irritate you. For instance, the lower-left keys on the keyboard are <strong>fn, ctrl, alt/option, apple/clover</strong>. Windows is typically <strong>ctrl, windows, alt</strong>. Now the <strong>apple/clover</strong> key doubles as your <strong>windows</strong> key (what the heck is that clover thing?), so that's cool. But notice the difference in order. And the extra <strong>fn </strong>hanging on like an appendix doesn't help. The &quot;extra&quot; features totally work (volume, screen brightness, keyboard backlighting, eject). But the lack of a dedicated page up/down, insert, delete will drive you <strong>nuts </strong>while programming.   </span></li>
<li><span style="color:#1f497d">Touch pad is, well, touchy. You even glance at it while typing and your mouse cursor will scurry away. I'm constantly, accidently hitting it. Again, works great in OS X. </span></li>
<li><span style="color:#1f497d">The leading edge is barely beveled which irritates my wrists. </span></li>
<li><span style="color:#1f497d">Also, right-click is two fingers on pad plus a button click. Compare this to simply tapping the pad with two fingers in OS X. </span></li></ol>
<p> </p>
<p style="margin-left:18pt"><span style="color:#1f497d">Note:  all of the above is remedied by an external (Windows) keyboard, mouse (Logitech G9) and monitor. </span></p>
<p><span style="font-size:14pt;color:#1f497d"><strong>Pros </strong></span></p>
<ol>
<li><span style="color:#1f497d">It runs OS X. </span></li>
<li><span style="color:#1f497d">Fit and finish is unsurpassed. </span></li>
<li><span style="color:#1f497d">Possibly the only laptop with <strong>Firewire</strong> <strong>800</strong>, handy for this 10GB 1080p videos you're trying to edit in Sony Vegas. </span></li>
<li><span style="color:#1f497d">Incredibly bright LED-backlit screen. Eye-searing. </span></li>
<li><span style="color:#1f497d">Parallels allows you to run your Boot Camp native Vista partition from within Mac OS X. Great for the blow-your-mind Silverlight demos (dev in Vista, then apple-tab back to OS X to test in Safari). </span></li>
<li>
<div><span style="color:#1f497d">Front-loading DVD drives give me a slight thrill. </span></div>
<p><span style="color:#1f497d">And finally, </span></p></li>
<li><span style="color:#1f497d">I'll never get tired of attaching the magnetic charger. </span></li></ol>
<p> </p></div></a>]]></description></item><item><title>Uninstalling MSDN Library for Visual Studio 2008</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=10</link><pubDate>Fri, 07 Dec 2007 16:30:27 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=10#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClass46E5C51DBB154EF18B8D0C9CCA8CEFAE><p>I'm in the process of installing the RTM version of Visual Studio 2008, and needed to uninstall a RC version in order to do so. There are some good blog posts out there outlining the steps required to make this work. (I believe <a href="http://weblogs.asp.net/jgalloway/archive/2007/11/28/ten-tips-for-a-happy-upgrade-to-visual-studio-2008-release.aspx">Jon Galloway's</a> is the most thorough.)
</p><p>Unfortunately, however, I was not able to complete even the very first step, which was to uninstall the MSDN Library for Visual Studio 2008. Each time I attempted to uninstall it, I would get the following error: &quot;A problem has been encountered while loading the setup components. Canceling setup.&quot;
</p><p><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/120807_0030_Uninstallin1.png" alt="">
	</p><p>I found the answer to my struggles in <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2439086&amp;SiteID=1">this blog post</a>. He says to use <a href="http://www.ccleaner.com/download">CCleaner</a> to launch the MSDN uninstaller. As he claims, it &quot;works like a charm.&quot;
</p><p><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/120807_0030_Uninstallin2.png" alt=""></p></div>]]></description></item><item><title>Disabling the Shutdown Event Tracker</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=34</link><pubDate>Wed, 05 Dec 2007 10:18:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=34#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass9811AB6789904FDBBC2C768653E45C1F>
<p>If you're like me, you get annoyed every time you try to shut down or restart Windows Server 2003. It displays a dialog box that requires input before you can actually shut down or restart. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/120507_1817_Disablingth1.png"> </p>
<p>The purpose of this dialog is to create events in the Event Log so that you can track why your server has gone offline. However, for most developers, we couldn't care less, and our comments turn out to be something like &quot;asdf&quot;. If you want to get rid of this dialog box, just follow these steps: </p>
<ol>
<li>Open the Microsoft Management Console (I just press the WindowsKey+R to get the run dialog box and type in &quot;MMC&quot;)<br><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/120507_1817_Disablingth2.png"><br></li>
<li>The MMC will open, but with no add-ins loaded. You need to load the Group Policy Editor by selecting &quot;Add/Remove Snap-In&quot; from the File menu<br><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/120507_1817_Disablingth3.png"><br></li>
<li>Find the &quot;Group Policy Editor&quot; in the list and press Add, followed by Finish on the subsequent dialog box, and finally OK on the Add/Remove Snap-Ins dialog<br><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/120507_1817_Disablingth4.png"><br></li>
<li>Navigate down to Local Computer Policy &gt; Computer Configuration &gt; Administrative Templates &gt; System, and double-click the &quot;Display Shutdown Event Tracker&quot; setting in the right pane<br><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/120507_1817_Disablingth5.png"><br></li>
<li>Select the &quot;Disabled&quot; option and press OK<br><img alt="" src="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Photos/120507_1817_Disablingth6.png"> </li></ol>
<p>That's it! Now you can shut down or restart your server without having to put a reason in.</p></div>]]></description></item><item><title>Cool Silverlight Stuff from Vertigo</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=28</link><pubDate>Tue, 04 Dec 2007 17:50:00 GMT</pubDate><slash:comments>6</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=28#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass80F832722D7F458FBBF77409B49770C6><p>If you missed it, Vertigo released two cool new samples last week for Microsoft.</p> <h3>Slide.Show</h3> <p>First up we have <a href="http://www.vertigo.com/SlideShow.aspx">Slide.Show</a>. Use this sample to show off your photos. I think that Silverlight is a great way to display interactive slide shows. I even submitted some photos to the Slide.Show project to include it in the sample. </p> <p>The slide show page on Vertigo has a pre-configured running live demo. Definitely check it out.  Look for more info on how to use it and other documentation to come on the sample <a href="http://www.codeplex.com/SlideShow">codeplex project site</a>.</p> <p>I gave <a href="http://blogs.vertigosoftware.com/files/alan/slideshow/default.htm">Slide.Show a test run</a> and configured it to access my <a href="http://www.flickr.com/photos/a7an/">Flickr feed</a>.  </p> <p><a href="http://blogs.vertigosoftware.com/files/alan/slideshow/default.htm"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=352 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/28/image_12.png" width=520 border=0></a></p> <p> </p> <h3>Video.Show</h3> <p>An update to <a href="http://www.vertigo.com/VideoShow.aspx">Video.Show</a> is out. Video.Show is great if you want to have a solid base for building your own video community using .NET technologies.  On top of Silverlight, this sample uses several other great technologies like the AJAX Control Toolkit, Expression Encoder, Linq, Silverlight Streaming Service, and more.</p> <p>New to this version, there is also a live site to play with.</p> <p><a title="http://aftereight.vertigo.com/" href="http://aftereight.vertigo.com/">http://aftereight.vertigo.com/</a></p> <p><a href="http://www.vertigo.com/VideoShow.aspx"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=480 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/28/image_15.png" width=533 border=0></a></p></div>]]></description></item><item><title>Configuration of IE Trusted Sites in Windows Vista</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=28</link><pubDate>Tue, 04 Dec 2007 14:23:18 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=28#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass8CE767E80FFB4231A8D301FF29DAA311><p>In my work, I commonly use an internal SharePoint web site that is exposed to the internet. This site uses Windows Integrated authentication, which is really handy, as it means I generally don't need to type my user name and password repeatedly, which is great!</p> <p>When I switched to Vista, I noticed that I always had to type my username and password--I'm guessing that this has to do with the fact that I access the SharePoint site using its external URL, so IE can't tell that it's really an internal site. (I had also had to do some configuration on Windows XP to get that working correctly.) One way to solve this is to add the site to the list of IE trusted sites, and tell IE to automatically send your user name and password. In case you're having the same issue, here are the steps to configure a trusted site to automatically authenticate.</p> <p>First, navigate to the site you wish to trust. Next, open the Internet Options dialog in Internet Explorer (click <strong>Tools</strong>, then click <strong>Internet Options</strong>.)</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfigOptions_2.png"><img height=523 alt="Internet Options dialog from IE 7" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfigOptions_thumb.png" width=423 border=0></a> </p> <p>Click <strong>Security </strong>to display the security tab, and then click the <strong>Trusted sites </strong>zone:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfigSecurity_2.png"><img height=523 alt="Security tab of Internet Options dialog, with the Trusted sites zone selected" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfigSecurity_thumb.png" width=423 border=0></a> </p> <p>Next click the <strong>Sites </strong>button to display the Trusted sites dialog:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfigTrustedsite_2.png"><img height=346 alt="Trusted sites dialog" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfigTrustedsite_thumb.png" width=394 border=0></a> </p> <p>(Note that you had to navigate to the site you want to trust first.) Click <strong>Add </strong>to add the site, and make sure that the checkbox to require server verification is checked. Click <strong>Close</strong>.</p> <p>At this point, you've added the trusted site, but it will likely still require you to enter your credentials on each visit. To change this, click the <strong>Custom level... </strong>button on the Security tab to configure the security settings for the trusted sites zone:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEconfigtrustedsiteszoneconfig_2.png"><img height=483 alt="Security Settings - Trusted Sites Zone dialog" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEconfigtrustedsiteszoneconfig_thumb.png" width=427 border=0></a></p> <p>Now scroll down to the bottom of the settings list, and change the setting for <strong>User Authentication </strong>to <strong>Automatic login with current user name and password:</strong></p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfiguserauth_2.png"><img height=483 alt="Security Settings - Trusted Sites Zone dialog with User Authentication set to &quot;Automatic logon with current user name and password&quot;" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfiguserauth_thumb.png" width=427 border=0></a></p> <p>Now click <strong>OK</strong>, and then <strong>OK </strong>to save the settings.</p> <p>Interestingly, when I tried this, I had one issue--I could not navigate to my trusted site reliably. Often the browser would seem to get stuck while downloading the content, and IE would just &quot;sit and spin&quot;. (Occasionally it seemed to work okay--it was just really slow in those cases.) Someone suggested that I try deleting my browsing history (I used the <strong>Delete all... </strong>option) and that worked! For some reason, having old cached data confused IE--not quite sure why, but it works fine now!</p> <p>In a partially related note, the IE 7 authentication dialog in Vista can be a bit tricky:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfigauthenticationdialog_2.png"><img height=293 alt="Connect to... dialog from IE, with ineffective &quot;Remember my password&quot; checkbox" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/28/IEConfigauthenticationdialog_thumb.png" width=336 border=0></a> </p> <p>There's a <strong>Remember my password </strong>checkbox in the dialog, but <em>it doesn't appear to do anything</em>. If you check it and then enter your user name and password, the next time you visit the site, it will just ask again. This is <a href="http://www.winsupersite.com/reviews/winvista_07.asp">Paul Thurrott's favorite IE inconsistency</a> (search for &quot;remember my&quot; on the linked page.) According to Paul, Microsoft says that this is by design. Perhaps that's true, but if so, I really don't understand why they left the checkbox there--it seems like some sort of strange UI decoy.</p></div>]]></description></item><item><title>Web pages cannot be accessed from another machine</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=9</link><pubDate>Tue, 04 Dec 2007 13:17:22 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=9#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClassFF7E2F4E8066413F8FD2C2A4F1562E3F><p>I recently discovered that web sites hosted on my dev box (Vista Enterprise, IIS 7.0) could not be accessed from any external machine. I'm not exactly sure when or how it happened, but it used to work, and then at some point it stopped working. My suspicion is that perhaps installing Orcas (Visual Studio 2008) Beta 2 had caused a setting to change, but that's just a guess.
</p><p>After poking around IIS, directory security settings and Windows Firewall, I found the setting that had been mysteriously flipped. If you run into this issue, you might give this a shot.
</p><ol><li>Open <strong>Windows Firewall with Advanced Security</strong>
		</li><li>Select &quot;Inbound Rules&quot;
</li><li>Find &quot;World Wide Web Services HTTP Traffic In&quot;
</li><li>If Enabled = No, change it to Enabled = Yes.
</li></ol><p><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/120407_2117_Webpagescan1.png" alt="">
	</p></div>]]></description></item><item><title>Silverlight 1.0: A Dynamic Control (Part I)</title><link>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=14</link><pubDate>Tue, 04 Dec 2007 09:15:35 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=14#Comments</comments><dc:creator>mmoser</dc:creator><description><![CDATA[<div class=ExternalClassD4251C44D50445588FABE16D960221D7><p>If you're trying to create a control in Silverlight 1.0, Tim Heuer's blog entry <a href="http://www.timheuer.com/blog/archive/2007/08/19/implement-user-control-in-silverlight-user-controls.aspx">Implementing Silverlight Controls in 1.0</a> is a must and will give a great guide to how my control is laid out.   </p> <p>Below I have an example of a SL 1.0 control in the very early stages of development.  </p> <p>I decided to start writing what I call the &quot;wheel&quot; control.  My vision of this control was to replace the GridView's &quot;next page&quot; approach to page navigation with the wheel's &quot;grab and spin&quot; approach.  As my colleague Boon said, while first explaining the idea on the whiteboard, &quot;it's like the wheel on the Price is Right&quot;.</p> <p><img height=331 src="http://farm1.static.flickr.com/200/478737543_ec95f1553e.jpg?v=0" width=500 border=0></p> <p>Ok, it's actually more like the wheel on the iPhone's Timer, however in it's current version it's not as pretty or sophisticated.</p> <p><strong>Apple's version:</strong></p> <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/14/image_6.png"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=179 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/14/image_thumb_2.png" width=244 border=0></a> </p> <p><strong>My version 1 control:</strong></p> <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/SilverlightWheel/Default.html"><font size=2>Here</font></a> is a page containing many instances of the control with different settings.</p> <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/14/image_4.png"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=143 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/14/image_thumb_1.png" width=75 border=0></a> </p> <p><strong>The control can be configured with:</strong></p> <ol> <li>NumberOfRows</li> <li>Width</li> <li>ItemHeight</li> <li>Speed</li> <li>CanvasLeft</li> <li>CanvasTop</li></ol> <p><strong>What I like and don't like:</strong></p> <p>I like how the instance management of the control is done.  I think this represents the best way to create a true control in SL 1.0.  Remember the test of a true control is to have many instances on the page with different settings, like I have done <a href="http://blogs.vertigo.com/personal/mmoser/Blog/SilverlightWheel/Default.html">here</a>.</p> <p>I like that you can configure the control with speed and number of items and eventually I can make this much more sophisticated.  I find a lot of SL examples are not configurable and reusable controls.</p> <p>What I don't like is how I have generated Dynamic XAML.  I don't like concatenating SQL and I don't like concatenating XAML.  The XAML should be static and declarative.  This can be accomplished by a better breakdown of control granularity and composition.  I will show this technique in Part II of this post.</p> <p><strong>What is the control composed of?</strong></p> <ol> <li>The wheel shaped canvas  <li>The two lists (SideA and SideB)  <ol> <li>Side A  <li>Side B</li></ol> <li>The animations  <ol> <li>Spin Side A  <li>Spin Side B</li></ol></li></ol> <p>The main canvas has a Canvas.Clip with a RectangleGeometry and the appropriate RadiusX and RadiusY are given to give a sense of the wheel's curve.</p> <p>The two lists are simply a series of canvases stacked one on top if the other.  For this version they have some hard coded text to show movement.</p> <p>There are two animations and the control knows which list is currently visible.  When the user clicks the wheel, the visible list slides down and the other list slides in view from top to bottom at the same rate the other list slides out of view.  Giving the effect of a spin.</p> <p><strong>The control's source.</strong></p> <p>The source can be downloaded <a href="http://blogs.vertigo.com/personal/mmoser/Blog/SilverlightWheel/Vertigo.Silverlight.Controls.Wheel.zip">here</a>.</p> <p>The control currently supports the following:</p> <ul> <li>Two &quot;sides&quot; of data  <li>Click to spin  <ul> <li>Toggle of sides  <ul> <li>Side A -&gt; B  <li>Side B -&gt; A</li></ul></li></ul> <li>Settings  <ul> <li>Number of rows  <li>Height of rows  <li>Speed of spin  <li>Width  <li>Position on canvas</li></ul></li></ul> <p>Future features:</p> <ul> <li>Selected Item Support  <li>Data bound (AJAX)  <ul> <li>Read ahead to cover for asynchronous nature of AJAX calls.</li></ul> <li>Spin both directions  <ul> <li>Based on mouse movement</li></ul> <li>Spin stops based on data set EOF and BOF  <li>Acceleration of spin based mouse movement  <li>Events</li></ul></div>]]></description></item><item><title>Linq and Extension Methods</title><link>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=13</link><pubDate>Mon, 03 Dec 2007 13:51:10 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=13#Comments</comments><dc:creator>mmoser</dc:creator><description><![CDATA[<div class=ExternalClass1F695F0E05514DF38C20295D408DEC45><p>I am working on making <a href="http://www.vertigo.com/videoshow.aspx">Video.Show</a> a more traditional 3-Tier app.  The architectural approach I am using looks like:</p> <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/13/image_2.png"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=98 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/13/image_thumb.png" width=244 border=0></a> </p> <p><em>*Please note the goal of this project is to keep the application simple and approachable.  This is not a recommendation of an architecture that meets every software project.  This approach meets the goals of this project.</em></p> <p>The data layer does not return Linq objects to the other tiers, only model objects are passed between tiers.  So in this type of architecture, you will need mappers, to translate the data objects to your model objects.  Since I want to keep my app simple.  I have decided to take advantage of <a href="http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx">extension methods</a>, to keep the project and and syntax clean.</p> <p>So my data object may have a method that looks like this:</p> <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/13/image_6.png"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=76 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/13/image_thumb_2.png" width=244 border=0></a> </p> <p>Notice the &quot;ToModel()&quot; method.  The Linq object that's returned from the query does not by default have this method.  I have mappers for each type I want to convert to my model objects.  That class looks like:</p> <p>  <a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/13/image_8.png"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=58 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/13/image_thumb_3.png" width=244 border=0></a> </p> <p><em>*Note:  The Mapper class needs to be in the same namespace as the Linq object.</em></p></div>]]></description></item><item><title>Moving to CodePlex</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=33</link><pubDate>Fri, 30 Nov 2007 15:16:47 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=33#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClassFAC0DA8609514AB1A2495B3B836C5A1F><p>I've decided to take my two active open source projects and move them to CodePlex.  There are a few reasons, which I'd like to outline here:</p> <ul> <li>I can use the Team System client within Visual Studio 2005/2008 for source control</li> <li>I'm familiar with Team System, and will be able to branch code and check bug fixes in against certain branches</li> <li>I can re-license the code under a less restrictive license (MS-PL in this case)</li> <li>I'm able to get a better URL for my Data Tier Generator - woohoo</li></ul> <p>Some people will probably think to themselves that I should just learn CVS or subversion and stay with SourceForge, but I've never really like their UI, and I couldn't care less about learning a new source control system if I don't have to.  I'm working on these projects for fun, and I don't consider learning a new source control system fun.  ;)</p> <p>As for the licensing, I felt like the LGPL was too restrictive.  I wanted to make sure that my code could be used in commercial products without the requirement that derivative works were also open-sourced, which would be undesirable for a large number of businesses.  The new license I've gone with is the MS-PL license, which basically allows anyone to use or modify my code however they see fit, but they can't sue me if something doesn't work right or as expected.</p> <p>Here are the new URLs for my Data Tier Generator and SharpCore framework:</p> <p><a title="http://www.codeplex.com/DataTierGenerator" href="http://www.codeplex.com/DataTierGenerator">http://www.codeplex.com/DataTierGenerator</a></p> <p><a title="http://www.codeplex.com/DataTierGenerator" href="http://www.codeplex.com/SharpCore">http://www.codeplex.com/SharpCore</a></p> <p>If you haven't checked them out before, please give them a download and let me know what you think.  While my Data Tier Generator is far more popular than SharpCore, I definitely enjoy SharpCore more and it gets more of my attention these days, especially with LINQ available to the masses.</p></div>]]></description></item><item><title>Keeping XAML Clean</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=27</link><pubDate>Fri, 30 Nov 2007 12:00:16 GMT</pubDate><slash:comments>14</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=27#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClassC85273A62E5F4B49B72C2F78CE72C23D><p>One of the early goals we had we <a href="http://www.vertigo.com/familyshow.aspx">Family.Show</a> was to make the XAML files easy to read and understandable. I want to share the list of some of the little things that we did to keep our XAML clean.  I will be using the <a href="http://www.codeplex.com/familyshow/SourceControl/FileView.aspx?itemId=182531&amp;changeSetId=12528">MainWindow.xaml</a> page as an example.</p> <h3>Clean &lt;Window&gt; Tag</h3> <p>We placed the xmlns (xml namespace references) attributes first and in separate lines. Like the &quot;using&quot; section in .cs files, this keeps them organized.</p> <blockquote> <div style="font-size:10pt;font-family:monospace;background-color:white"><span style="color:blue">&lt;</span><span style="color:#a31515">Window<br></span><span style="color:black"></span><span style="color:red">xmlns</span><span style="color:blue">=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;<br></span><span style="color:black"></span><span style="color:red">xmlns</span><span style="color:blue">:</span><span style="color:red">x</span><span style="color:blue">=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;<br></span><span style="color:black"></span><span style="color:red">xmlns</span><span style="color:blue">:</span><span style="color:red">d</span><span style="color:blue">=&quot;http://schemas.microsoft.com/expression/blend/2006&quot;<br></span><span style="color:black"></span><span style="color:red">xmlns</span><span style="color:blue">:</span><span style="color:red">mc</span><span style="color:blue">=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;<br></span><span style="color:black"></span><span style="color:red">xmlns</span><span style="color:blue">:</span><span style="color:red">Microsoft.FamilyShowLib</span><span style="color:blue">=&quot;clr-namespace:Microsoft.FamilyShowLib;assembly=FamilyShowLib&quot;<br></span><span style="color:black"></span><span style="color:red">xmlns</span><span style="color:blue">:</span><span style="color:red">local</span><span style="color:blue">=&quot;clr-namespace:Microsoft.FamilyShow&quot;<br></span><span style="color:black"></span><span style="color:red">x</span><span style="color:blue">:</span><span style="color:red">Class</span><span style="color:blue">=&quot;Microsoft.FamilyShow.MainWindow&quot;<br></span><span style="color:black"></span><span style="color:red">Title</span><span style="color:blue">=&quot;Family.Show&quot;</span><span style="color:red"> Height</span><span style="color:blue">=&quot;728&quot;</span><span style="color:red"> Width</span><span style="color:blue">=&quot;960&quot;<br></span><span style="color:black"></span><span style="color:red">Background</span><span style="color:blue">=&quot;{</span><span style="color:#a31515">DynamicResource</span><span style="color:red"> MainBackgroundBrush</span><span style="color:blue">}&quot;<br></span><span style="color:black"></span><span style="color:red">ResizeMode</span><span style="color:blue">=&quot;CanResizeWithGrip&quot;&gt;</span> </div></blockquote> <h3>Extensive Comments</h3> <p>Almost every code section will have a corresponding comment above it.  We did this for two reasons. Visual Studio display comments as green text, which makes it really easy to scan the XAML for the tag that we want to modify.  People new to the code will have an easier time understanding the XAML structure from looking the comments instead of the XAML tags.</p> <h3>x:Name</h3> <p>Although we will not reference all of the controls in our code behind, we would still name all of our controls.  We always use x:Name instead of the Name attribute for consistency as not all controls support the Name property. We keep the x:Name as the first attribute again for consistency.</p> <p>The naming help describes their function and why the control is there.  This is especially helpful when it comes to picking the right controls to style in Expression Blend using the Objects and Timeline panel with the Property panel.</p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=429 alt=image src="http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Attachments/27/image_3.png" width=258 border=0> </p> <h3>Use User Controls</h3> <p>User Controls are not only great for code-reuse; They are a great organization tool. With User Controls, we abstracted functionality into their own XAML file.  It's like refactoring code into methods. </p> <div style="font-size:10pt;font-family:monospace;background-color:white"><span style="color:#a31515">      </span><span style="color:green">&lt;!-- New User Control --&gt;<br></span><span style="color:#a31515">      </span><span style="color:blue">&lt;</span><span style="color:#a31515">local</span><span style="color:blue">:</span><span style="color:#a31515">NewUserControl</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;NewUserControl&quot;</span><span style="color:red"> ...</span><span style="color:blue"> /&gt;<br><br></span><span style="color:#a31515">      </span><span style="color:green">&lt;!-- Welcome User Control --&gt;<br></span><span style="color:#a31515">      </span><span style="color:blue">&lt;</span><span style="color:#a31515">local</span><span style="color:blue">:</span><span style="color:#a31515">Welcome</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;WelcomeUserControl&quot; ...</span><span style="color:blue"> /&gt;<br><br></span><span style="color:#a31515">      </span><span style="color:green">&lt;!-- Person Info Control --&gt;<br></span><span style="color:#a31515">      </span><span style="color:blue">&lt;</span><span style="color:#a31515">local</span><span style="color:blue">:</span><span style="color:#a31515">PersonInfo</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;PersonInfoControl&quot;</span><span style="color:red"> ...</span><span style="color:blue"> /&gt;<br><br></span><span style="color:#a31515">      </span><span style="color:green">&lt;!-- Family Data Control --&gt;<br></span><span style="color:#a31515">      </span><span style="color:blue">&lt;</span><span style="color:#a31515">local</span><span style="color:blue">:</span><span style="color:#a31515">FamilyData</span><span style="color:red"> x</span><span style="color:blue">:</span><span style="color:red">Name</span><span style="color:blue">=&quot;FamilyDataControl&quot;</span><span style="color:red"> ..</span><span style="color:blue"> /&gt;<br></span></div> <h3>Resource Dictionaries</h3> <p>We kept brushes, styles, and templates in separate resource dictionary files.  Think of it as using a separate cascading style sheet in HTML. The look and feel is separated from the content.  We could've done a little better by removing all inline styling in Family.Show.</p> <p>By using Resource Dictionaries we were also able to implement the Skinning functionality by simply replacing the Resource Dictionary in code.</p> <h3>Structured indents and spacing</h3> <p>Like HTML and code, indents and spacing are a great way to keep XAML clean.  The auto-format feature in Visual Studio really helps with this.</p> <h3>Well, that about sums it up</h3> <p>Hope this helps,</p> <p>Alan</p></div>]]></description></item><item><title>Spell Checking in WPF</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=26</link><pubDate>Wed, 28 Nov 2007 17:53:59 GMT</pubDate><slash:comments>14</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=26#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass865EEA656FC34CAE819DADDA8FC8668F><p></p> <p>Witty is one of the few Twitter clients that has a built-in spell checker. How hard was it to implement? What if I told you that in WPF, spell-checking is just a checkbox?</p> <p> <a href="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/26/image_11.png"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=212 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/26/image_thumb_4.png" width=373 border=0></a> </p> <p><a href="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/26/image_13.png"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=136 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/26/image_thumb_5.png" width=244 border=0></a> </p> <p>Here's the Xaml.</p> <p>&lt;TextBox x:Name=&quot;TweetTextBox&quot; <strong>SpellCheck.IsEnabled=&quot;True&quot;</strong> /&gt;</p></div>]]></description></item><item><title>Displaying your family tree from Geni.com in Family.Show</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=25</link><pubDate>Wed, 28 Nov 2007 15:08:29 GMT</pubDate><slash:comments>28</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=25#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClassE13A1EF0E9D3409EB7CDFAF83B0C0AE3><p><a href="http://www.geni.com/">Geni.com</a> is a great way to build your family tree collaboratively with other family members. Since both Geni.com and <a href="http://www.vertigo.com/familyshow.aspx">Family.Show</a> support the <a href="http://en.wikipedia.org/wiki/GEDCOM">Gedcom</a> 5.5 format, we can easily take the family trees built on Geni.com and display it in Family.Show. This post will show you how.</p> <h3>Here's How</h3> <ol> <li>Build your family tree with Geni.com, get other family members to help</li> <li>Use the Geni.com export feature and download your family Gedcom file.</li> <ol> <li>Goto the <a href="http://wiki.geni.com/index.php/GEDCOM#GEDCOM_Export">GEDCOM export wiki</a>.</li> <li>Click on Gedcom 5.5, the gedcom file will be sent to your email in a zip file.</li></ol> <li>Expand the zip file</li> <li>Run Family.Show</li> <li>Click on &quot;Import...&quot; on the Welcome Screen</li> <li>Browse to the expanded zip folder and select &quot;export-geni.ged&quot; file.</li> <li>Click open and voila</li></ol> <p></p> <h3>Why would you want to import to Family.Show?</h3> <h4>Find out additional information about your family</h4> <p>With the family statistics feature of Family.Show, you can gain new insight about your family that you can't get with on Geni.com.</p> <p>For example, take a look at the last names <a href="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Post.aspx?ID=18">Tag Cloud</a> for the <a href="http://blogs.vertigo.com/personal/liam/blog/Lists/Posts/Post.aspx?ID=4">House of Black from Harry Potter</a>.  I can quickly glimpse that ere are a few Burkes, Crouch, and Longbottom in the tree. I didn't know that the Black family also have a Weasley and a Potter as in-laws in there tree!  If the tree also included the Potters and Weaslys, we could've probably browsed the tree until we reached Harry or Ron.</p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=153 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/25/image_9.png" width=243 border=0> </p> <p>The Age Distribution is another high level report that can be useful.  You can quickly find the age range for the living members of a particular family.</p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=171 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/25/image_12.png" width=244 border=0> </p> <h4>Different visualization of the family tree</h4> <p>Geni.com is great for it's viral/social way of building family trees. It however presents family trees in a standard flat view.  Family.Show takes a different approach in visualizing the family tree.  The tree shape and size changes based on the selected person in the tree. Viewing a tree from your grandfather's perspective is very different from viewing it from your perspective. In a way, you're navigating the family tree instead of simply viewing it. Try clicking around the provided sample trees to test it out.</p> <p><em>Bellatrix Black's Tree</em></p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=407 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/25/image_3.png" width=448 border=0> </p> <p><em>Here is the same tree from Cygnus Black's perspective</em></p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=421 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/25/image_6.png" width=513 border=0> </p> <h4>A different way to view a person.</h4> <p>With the Photo and Stories feature, Family.Show provide a different perspective on a person.</p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=480 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/25/image_15.png" width=627 border=0></p></div>]]></description></item><item><title>What's New in WPF 3.5?</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=24</link><pubDate>Tue, 27 Nov 2007 14:11:50 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=24#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass2045B123F23B41B0A9598C800E0BB0A9><p>If you're like me, you're interested in what's new for WPF in the .NET 3.5 Framework after installing VS2008. Luckily there's already many resources available all about. By far the most comprehensive information is on MSDN at the <a href="http://msdn2.microsoft.com/en-us/library/bb613588(VS.90).aspx">What's New in Windows Presentation Foundation Version 3.5</a> article.</p> <p>There's also a great video about it by <a href="http://channel9.msdn.com/ShowPost.aspx?PostID=359713">Kevin Moore on Channel 9</a> that goes in depth about it.</p> <p>Other links:</p> <p><a href="http://blogs.msdn.com/tims/archive/2007/07/27/what-s-new-in-wpf-3-5-here-s-fifteen-cool-features.aspx">Tim Sneath: What's New in WPF 3.5? Here's Fifteen Cool Features...</a></p> <p><a href="http://blogs.msdn.com/wpfsdk/archive/2007/07/26/what-s-new-in-wpf-in-the-net-fx-3-5-beta-2-release.aspx">SDKTeam: What's New in WPF in the .NET FX 3.5 Beta 2 Release</a></p></div>]]></description></item><item><title>WPF Resource Organization: Organized As Separate Files By Type vs Single File?</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=23</link><pubDate>Mon, 26 Nov 2007 14:38:11 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=23#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass97DAEAA8F700463FB184EEDCD9C7550B><p>In the process of developing <a href="http://www.codeplex.com/familyshow">Family.Show</a>, I noticed that we were starting to create lots of XAML resources such as brushes, styles, and data templates. My thinking at the time was to separate the resources into separate files organized by functional type to make them easier to find.  For example, all SolidColorBrushes and LinearGradientBrushes would go into BrushResources.xaml. To use the resources as a group, we simply use the WPF <a href="http://msdn2.microsoft.com/en-us/library/aa350178.aspx">Merged Resource Dictionaries</a> feature. (At the time, Paul Stovell also recommended separating resources into the own files. <a title="http://paulstovell.net/blog/index.php/xaml-and-wpf-coding-guidelines/" href="http://paulstovell.net/blog/index.php/xaml-and-wpf-coding-guidelines/">http://paulstovell.net/blog/index.php/xaml-and-wpf-coding-guidelines/</a>)</p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=144 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/23/image_3.png" width=197 border=0> </p> <p>Separating the resources made a lot of sense from a developer perspective. It keep any particular resource dictionary small and simple. By using the solution explorer in Visual Studio, I can quickly find and edit the resources that I want.  </p> <h3>Separate Files Added Complexity To Skinning</h3> <p>I started running into issues when we adding the skinning feature to Family.Show. For the new Silver skin, we needed to replicate the the same resource dictionary files for each skin.  This added complexity as the number of files was doubled. In Visual Studio, it was still clear and easy to find resources as they are organized by folder.</p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=382 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/23/image_6.png" width=230 border=0> </p> <p><strong>The problem was that many of the skin changes were typical easier to modify in Expression Blend using the Resources panel</strong>. However, Blend displays the resources like the screenshot below.  This made it really difficult to find the right resource for the right skin to change it.</p> <p> <img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=471 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/23/image_12.png" width=272 border=0> </p> <p>Another problem was that any change made to the skin would take awhile to be displayed in the Blend designer, slowing down the skinning process.</p> <h3>Single Resource Dictionary for Skin</h3> <p>In developing <a href="http://code.google.com/p/wittytwitter/">Witty</a>, I went a different route with resource organization by keeping all resources in a single file, in a similar fashion as cascading style sheets mostly being single files. This really simplified the resources. In addition any resource changes were quickly displayed in the designer. Although the number of resources in Witty is smaller, I think Blend is just more performant with less Merged Dictionaries.</p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=167 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/23/image_15.png" width=271 border=0> </p> <h3></h3> <p>Based on my WPF project experiences, I would advocate placing resource dictionaries into a single resource dictionary, especially if skinning is involved.</p> <p>What do you think? Should XAML resources be organized into separate files or a main single file? I would love to hear your thoughts on this.</p></div>]]></description></item><item><title>Witty: Creating a .Net Twitter API</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=22</link><pubDate>Wed, 21 Nov 2007 16:22:29 GMT</pubDate><slash:comments>19</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=22#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClassD41175B7EE78411490936C7C68CBCD05><p>In the process of writing <a href="http://code.google.com/p/wittytwitter/">Witty</a>, I created my own .Net wrapper class library for the <a href="http://groups.google.com/group/twitter-development-talk/web/api-documentation">Twitter API</a>. I wanted to share my experience created this class library, which I named TwitterLib.</p> <p>I had two goals in mind when writing TwitterLib.</p> <ol> <li>Make the code simple, easy to understand, and easy to use  <li>Make use of <a href="http://msdn2.microsoft.com/en-us/library/ms743695.aspx">PropertyChange Notification</a> and <a href="http://msdn2.microsoft.com/en-us/library/ms748365.aspx">ObservableCollection</a></li></ol> <h3>First attempt using XSD</h3> <p>The Twitter API can present data as XML or JSON. I'm more familiar on working with XML in .NET than JSON, so I picked the XML format. </p> <p>In my first crack at it, I use the XSD tool to create the Twitter .NET classes from the <a href="http://twitter.com/statuses/public_timeline.xml">XML output</a>.  I used the Visual Studio Command Prompt with the command &quot;xsd <a title="http://twitter.com/statuses/public_timeline.xml" href="http://twitter.com/statuses/public_timeline.xml">http://twitter.com/statuses/public_timeline.xml</a>&quot;. This generated an public_timeline.xsd file. Next, I used the xsd command again &quot;xsd public_timeline.xsd /c&quot; to create the 3 twitter classes: statuses, statusesStatus, and statusesStatusUser. I</p> <p>While functional, I ran into a few issues with the auto-generated classes. I didn't like the names given for the classes.  In addition, the classes were littered with XML related attributes that made the code seem messy.  I changed the classes to implement INotifyPropertyChanged, when the twitter API had a change, I had to re-generate the classes losing changes that I made.  I went the partial class route for each of the classes but I think that added unnecessary complexity.  I wanted to abstract the classes more from the XML sent from Twitter. In the end, I started from scratch.</p> <h3>My Twitter .NET Classes</h3> <p>I created three main classes: Tweet, User, and DirectMessage.</p> <ul> <li><strong>Tweet</strong>: Represents the status post for a Twitter User.  <li><strong>User</strong>: A Twitter User  <li><strong>DirectMessage</strong>: Represents a message sent to a User</li></ul> <p>These classes implement the <a href="http://msdn2.microsoft.com/en-us/library/ms743695.aspx">INotifyPropertyChanged</a> Interface, so that any property change will get propagated to the controls bound to the property.  I also created collection classes for these classes that inherit from <a href="http://msdn2.microsoft.com/en-us/library/ms748365.aspx">ObservableCollection</a>. WPF binding rely heavily on these two features so it was important for my classes to have them.  For example, whenever the the Witty client is refreshed, I update the RelativeTime; the TextBlock bounded to display this property will show the new time.</p> <p>I created a TwitterNet class to simplify web requests to the TwitterAPI for populating the aforementioned classes. TwitterNet acts as the main wrapper for interacting with the Twitter API. </p> <p>For example, to get the friends timeline for an authenticated user:</p> <blockquote> <div style="font-size:10pt;font-family:monospace;background-color:white"><span style="color:#2b91af">TwitterNet</span><span style="color:black"> twitter = </span><span style="color:blue">new</span><span style="color:black"> </span><span style="color:#2b91af">TwitterNet</span><span style="color:black">(username, password);<br></span><span style="color:#2b91af">TweetCollection</span><span style="color:black"> tweets = twitter.GetFriendsTimeline();</span></div></blockquote> <p>Behind the scenes, TwitterNet does the heavy lifting of creating the web requests as well as parsing the html. All timeline requests route to a private method call RetrieveTimeline.  Here's a snippet at the meat of the RetrieveTimeline method. You can see the full code for <a href="http://wittytwitter.googlecode.com/svn/trunk/Witty/TwitterLib/TwitterNet.cs">TwitterLib on the Witty Source page</a>. </p> <div style="font-size:10pt;font-family:monospace;background-color:white">    <span style="color:green">// Get the Web Response  <br></span><span style="color:black">    </span><span style="color:blue">using</span><span style="color:black"> (</span><span style="color:#2b91af">HttpWebResponse</span><span style="color:black"> response = request.GetResponse() </span><span style="color:blue">as</span><span style="color:black"> </span><span style="color:#2b91af">HttpWebResponse</span><span style="color:black">)<br>    {<br>        </span><span style="color:green">// Get the response stream  <br></span><span style="color:black">        </span><span style="color:#2b91af">StreamReader</span><span style="color:black"> reader = </span><span style="color:blue">new</span><span style="color:black"> </span><span style="color:#2b91af">StreamReader</span><span style="color:black">(response.GetResponseStream());<br><br>        </span><span style="color:green">// Load the response data into a XmlDocument  <br></span><span style="color:black">        </span><span style="color:#2b91af">XmlDocument</span><span style="color:black"> doc = </span><span style="color:blue">new</span><span style="color:black"> </span><span style="color:#2b91af">XmlDocument</span><span style="color:black">();<br>        doc.Load(reader);<br><br>        </span><span style="color:green">// Get statuses with XPath  <br></span><span style="color:black">        </span><span style="color:#2b91af">XmlNodeList</span><span style="color:black"> nodes = doc.SelectNodes(</span><span style="color:#a31515">&quot;/statuses/status&quot;</span><span style="color:black">);<br><br>        </span><span style="color:blue">foreach</span><span style="color:black"> (</span><span style="color:#2b91af">XmlNode</span><span style="color:black"> node </span><span style="color:blue">in</span><span style="color:black"> nodes)<br>        {<br>            </span><span style="color:#2b91af">Tweet</span><span style="color:black"> tweet = </span><span style="color:blue">new</span><span style="color:black"> </span><span style="color:#2b91af">Tweet</span><span style="color:black">();<br>            tweet.Id = </span><span style="color:blue">double</span><span style="color:black">.Parse(node.SelectSingleNode(</span><span style="color:#a31515">&quot;id&quot;</span><span style="color:black">).InnerText);<br>            tweet.Text = </span><span style="color:#2b91af">HttpUtility</span><span style="color:black">.HtmlDecode(node.SelectSingleNode(</span><span style="color:#a31515">&quot;text&quot;</span><span style="color:black">).InnerText);<br>            </span><span style="color:blue">string</span><span style="color:black"> source = </span><span style="color:#2b91af">HttpUtility</span><span style="color:black">.HtmlDecode(node.SelectSingleNode(</span><span style="color:#a31515">&quot;source&quot;</span><span style="color:black">).InnerText);<br>            </span><span style="color:blue">if</span><span style="color:black"> (!</span><span style="color:blue">string</span><span style="color:black">.IsNullOrEmpty(source))<br>                tweet.Source = </span><span style="color:#2b91af">Regex</span><span style="color:black">.Replace(source, </span><span style="color:#a31515">@&quot;&lt;(.|\n)*?&gt;&quot;</span><span style="color:black">, </span><span style="color:blue">string</span><span style="color:black">.Empty);<br><br>            </span><span style="color:blue">string</span><span style="color:black"> dateString = node.SelectSingleNode(</span><span style="color:#a31515">&quot;created_at&quot;</span><span style="color:black">).InnerText;<br>            </span><span style="color:blue">if</span><span style="color:black"> (!</span><span style="color:blue">string</span><span style="color:black">.IsNullOrEmpty(dateString))<br>            {<br>                tweet.DateCreated = </span><span style="color:#2b91af">DateTime</span><span style="color:black">.ParseExact(<br>                    dateString,<br>                    twitterCreatedAtDateFormat,<br>                    </span><span style="color:#2b91af">CultureInfo</span><span style="color:black">.CurrentCulture, </span><span style="color:#2b91af">DateTimeStyles</span><span style="color:black">.AllowWhiteSpaces);<br>            }<br><br>            </span><span style="color:#2b91af">User</span><span style="color:black"> user = </span><span style="color:blue">new</span><span style="color:black"> </span><span style="color:#2b91af">User</span><span style="color:black">();<br>            </span><span style="color:#2b91af">XmlNode</span><span style="color:black"> userNode = node.SelectSingleNode(</span><span style="color:#a31515">&quot;user&quot;</span><span style="color:black">);<br>            user.Name = userNode.SelectSingleNode(</span><span style="color:#a31515">&quot;name&quot;</span><span style="color:black">).InnerText;<br>            user.ScreenName = userNode.SelectSingleNode(</span><span style="color:#a31515">&quot;screen_name&quot;</span><span style="color:black">).InnerText;<br>            user.ImageUrl = userNode.SelectSingleNode(</span><span style="color:#a31515">&quot;profile_image_url&quot;</span><span style="color:black">).InnerText;<br>            user.SiteUrl = userNode.SelectSingleNode(</span><span style="color:#a31515">&quot;url&quot;</span><span style="color:black">).InnerText;<br>            user.Location = userNode.SelectSingleNode(</span><span style="color:#a31515">&quot;location&quot;</span><span style="color:black">).InnerText;<br>            user.Description = userNode.SelectSingleNode(</span><span style="color:#a31515">&quot;description&quot;</span><span style="color:black">).InnerText;<br><br>            tweet.User = user;<br><br>            tweets.Add(tweet);<br>        }<br><br>        tweets.SaveToDisk();<br>    }</span> </div> <p>A few additional classes were created to round out TwitterLib.</p> <ul> <li><strong>StringHelper</strong>: String related static methods, such as extracting hyperlinks  <li><strong>TinyUrlHelper</strong> (added by <a href="http://twitter.com/lazycoder">lazycoder</a>): Wrapper for interacting with TinyUrl API  <li><strong>Timeline</strong>: Enumeration of available Twitter timelines  <li><strong>RateLimitException</strong>: Custom Exception when the 70/hour rate limit for authenticated Twitter API calls have been hit.</li></ul> <p>Here's the class diagram for TwitterLib. </p> <p><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=768 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/22/image_5.png" width=644 border=0> </p> <p>With the TwitterLib in place, I turned my attention to the UI and created the main WPF app. The TwitterLib made it easy to interact with calls to Twitter as well as bind my controls and DataTemplates to twitter objects. Look for a post about the it sometime soon.</p> <p>You can use the TwitterLib if you want to make your own WPF twitter client or Twitter visualization.  You can get the source for TwitterLib as well as Witty on the <a href="http://code.google.com/p/wittytwitter/source">Witty Google Code project page</a>.</p> <h4>Related Posts:</h4> <p><a href="http://blogs.msdn.com/karstenj/archive/2007/06/08/creating-a-net-twitter-api-in-4-5-seconds.aspx#comments">Creating a .NET Twitter API in 4.5 seconds - by Karsten Januszewski</a></p> <p><a href="http://blog.wekeroad.com/2007/06/14/silverlight-creating-a-twitter-client-part-1/">Silverlight: Creating a Twitter Client Part 1 - by Rob Conery</a></p></div>]]></description></item><item><title>Using TortoiseSVN with Codeplex projects</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=21</link><pubDate>Mon, 19 Nov 2007 10:21:54 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=21#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass0A06A0DB52A644D5AFB88691E13D5FC6><p>In this post, I want to show how to work with projects on <a href="http://www.codeplex.com/">Codeplex</a> using the <a href="http://tortoisesvn.tigris.org/">TortoiseSVN</a> client with <a href="http://www.codeplex.com/SvnBridge">SvnBridge</a>.</p> <p>Usually at Vertigo, we use Team System for our projects unless requested otherwise by the clients. In a recent project that I worked on, we were requested to use SVN so that the clients developers can work concurrently on other parts of the project. Although it isn't my first time using SVN, it was my first time using it exclusively for an extensive period of time.  After using SVN for awhile now, I'm starting to prefer it over Team System source control.  </p> <p>Some projects by Vertigo, such as <a href="http://www.codeplex.com/familyshow">Family.Show</a> and <a href="http://www.codeplex.com/videoshow">Video.Show</a>, are hosted as sample reference applications on Codeplex with utilizes a Team System based source control.  Now that I'm more comfortable with SVN, I want to use TortoiseSVN instead of Team System when making modifications to these projects.  I will be using the <a href="http://www.codeplex.com/familyshow">Family.Show project</a> as an example.</p> <ol> <li>Download and Install <a href="http://tortoisesvn.net/downloads">TortoiseSVN</a>  <li>Download and run <a href="http://www.codeplex.com/SvnBridge/Release/ProjectReleases.aspx?ReleaseId=7805">SvnBridge.exe</a>  (I use the default port: 8081)  <li>Go to the Source Code tab for the project<br> <img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=41 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/21/image_6.png" width=240 border=0>  <li>Copy the Server URL (e.g. <a href="https://tfs04.codeplex.com">https://tfs04.codeplex.com</a>) and paste it into the SvnBridge Window under Team Foundation Server  <li>Click the Ok button  <li>Create a new folder locally for the project.  <li>Right-click the newly created folder and select &quot;SVN Checkout...&quot; <br><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=414 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/21/image_18.png" width=545 border=0>  <li>Enter http://localhost:8081/&lt;projectname&gt; (e.g. <a title="http://localhost:8081/familyshow" href="http://localhost:8081/familyshow">http://localhost:8081/familyshow</a>) for URL of repository. <br><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=350 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/21/image_19.png" width=494 border=0>  <li>Click OK. <br><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=416 alt=image src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Attachments/21/image_20.png" width=594 border=0> </li></ol> <p>Now that you have the project locally. You can make edits and check them in directly if you are a member of the project. Otherwise you can make check-ins as patches.</p> <p>Good luck,</p> <p>Alan</p></div>]]></description></item><item><title>The ASP.NET 2.0 Anthology: 101 Essential Tips, Tricks and Hacks </title><link>http://blogs.vertigo.com/personal/blake/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Thu, 15 Nov 2007 11:01:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/blake/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>blake</dc:creator><description><![CDATA[<div class=ExternalClass158E742502EE40A9A8C9F652CD90E3BF><p>Vertigo's own, <a href="http://www.codinghorror.com/blog/">Jeff Atwood</a> and <a href="http://weblogs.asp.net/jgalloway/default.aspx">Jon Galloway</a> (credit given alphabetically for fairness) spent about 5 months of their lives putting this <a href="http://www.amazon.com/exec/obidos/ASIN/098028581X/codinghorror-20">handy book</a> together with <a href="http://odetocode.com/Blogs">Scott Allen</a> and <a href="http://www.sitepoint.com/blogs/category/net/">Wyatt Barnett</a>.
</p><p>Obviously Jon and Jeff aren't exactly strangers. Heck, Jeff spends his days just across the hall from me. You can imagine my shame when I realized I had missed mentioning the blessed birth of their book.
</p><p>Sometimes we overlook the ones we love. If you buy it, I'll feel better.
</p><p><a href="http://www.amazon.com/exec/obidos/ASIN/098028581X/codinghorror-20"><img src="http://blogs.vertigo.com/personal/blake/Blog/Lists/Photos/111507_1901_TheASPNET201.png" alt="" border=0></a>
	</p></div>]]></description></item><item><title>Implementing Transaction Support Cont'd</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=32</link><pubDate>Mon, 12 Nov 2007 10:02:07 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=32#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass22CEA0E9CCBF437CB91FEA6024B1A017><p>In <a href="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=31">last week's post</a> about transactions, I provided an initial implementation that is transaction aware, but couldn't close the SqlConnection that was in use.  I'm going to outline here what the final solution looks like.</p> <p>First, most of the functionality was refactored in a few reusable functions, leaving the data access code looking like this instead:</p> <pre><p><font face=Consolas size=2><font color="#0000ff">public static void </font>ExecuteNonQuery(<font color="#0000ff">string</font> connectionStringName, <font color="#008080">CommandType</font> commandType, <font color="#0000ff">string</font> commandText, <font color="#0000ff">params</font> <font color="#008080">SqlParameter</font>[] <font color="#000000">parameters</font>)<br>{<br>    <font color="#0000ff">if</font> (<font color="#008080">Transaction</font>.Current == <font color="#0000ff">null</font>)<br>    {<br>        <font color="#0000ff">string</font> connectionString = <font color="#008080">ConfigurationManager</font>.ConnectionStrings[connectionStringName].ConnectionString;<br>        <font color="#0000ff">using</font> (<font color="#008080">SqlConnection</font> connection = <font color="#0000ff">new</font> <font color="#008080">SqlConnection</font>(connectionString))<br>        {<br>            <font color="#0000ff">using</font> (<font color="#008080">SqlCommand</font> command = CreateCommand(connection, commandType, commandText, parameters))<br>            {<br>                command.ExecuteNonQuery();<br>            }<br>        }<br>    }<br>    <font color="#0000ff">else</font><br>    {<br>        <font color="#008080">SqlConnection</font> connection = GetTransactionSqlConnection(connectionStringName);<br>        <font color="#0000ff">using</font> (<font color="#008080">SqlCommand</font> command = CreateCommand(connection, commandType, commandText, parameters))<br>        {<br>            command.ExecuteNonQuery();<br>        }<br>    }<br>}</font></pre>
<p></p>
<p>The new function, GetTransactionSqlConnection, is responsible for checking to see if a shared connection should be used. <pre><p><font face=Consolas size=2><font color="#0000ff">private static </font><font color="#008080">SqlConnection</font> GetTransactionSqlConnection(<font color="#0000ff">string</font> connectionStringName)<br>{<br>    <font color="#008080">LocalDataStoreSlot</font> connectionDictionarySlot = <font color="#008080">Thread</font>.GetNamedDataSlot(<font color="#800000">&quot;ConnectionDictionary&quot;</font>);<br>    <font color="#008080">Dictionary</font>&lt;<font color="#0000ff">string</font>, <font color="#008080">SqlConnection</font>&gt; connectionDictionary = (<font color="#008080">Dictionary</font>&lt;<font color="#0000ff">string</font>, <font color="#008080">SqlConnection</font>&gt;) <font color="#008080">Thread</font>.GetData(connectionDictionarySlot); </font></p><p>
</p><p><font face=Consolas size=2>    <font color="#0000ff">if</font> (connectionDictionary == <font color="#0000ff">null</font>)<br>    {<br>        connectionDictionary = new <font color="#008080">Dictionary</font>&lt;<font color="#0000ff">string</font>, <font color="#008080">SqlConnection</font>&gt;();<br>        <font color="#008080">Thread</font>.SetData(connectionDictionarySlot, connectionDictionary);<br>    }</font></p>
<p><font face=Consolas size=2>    <font color="#008080">SqlConnection</font> connection = <font color="#0000ff">null</font>;</font></p><p><font face=Consolas size=2><br>    <font color="#0000ff">if</font> (connectionDictionary.ContainsKey(connectionStringName))<br>    {<br>        connection = connectionDictionary[connectionStringName];<br>    }<br>    <font color="#0000ff">else</font><br>    {<br>        <font color="#0000ff">string</font> connectionString = <font color="#008080">ConfigurationManager</font>.ConnectionStrings[connectionStringName].ConnectionString;<br>        connection = <font color="#0000ff">new</font> <font color="#008080">SqlConnection</font>(connectionString);<br>        connectionDictionary.Add(connectionStringName, connection); </font></p>
<p><font face=Consolas size=2>        <font color="#008080">Transaction</font>.Current.TransactionCompleted += <font color="#0000ff">new</font> <font color="#008080">TransactionCompletedEventHandler</font>(Current_TransactionCompleted);<br>    }</font></p><p><font face=Consolas size=2><br>    <font color="#0000ff">return</font> connection;<br>}</font></p></pre>
<p>Instead of trying to store a single connection, a Dictionary is used instead so that multi-connection transactions can be supported.  Also, notice that the TransactionCompleted event is wired up; that's how we'll close the close the connection. <pre><p><font face=Consolas size=2><font color="#0000ff">private static void </font>Current_TransactionCompleted(<font color="#0000ff">object</font> sender, <font color="#008080">TransactionEventArgs</font> e)<br>{<br>    <font color="#008080">LocalDataStoreSlot</font> connectionDictionarySlot = <font color="#008080">Thread</font>.GetNamedDataSlot(<font color="#800000">&quot;ConnectionDictionary&quot;</font>);<br>    <font color="#008080">Dictionary</font>&lt;<font color="#0000ff">string</font>, <font color="#008080">SqlConnection</font>&gt; connectionDictionary = (<font color="#008080">Dictionary</font>&lt;<font color="#0000ff">string</font>, <font color="#008080">SqlConnection</font>&gt;) <font color="#008080">Thread</font>.GetData(connectionDictionarySlot);<br>    if (connectionDictionary != <font color="#0000ff">null</font>)<br>    {<br>        <font color="#0000ff">foreach</font> (<font color="#008080">SqlConnection</font> connection <font color="#0000ff">in</font> connectionDictionary.Values)<br>        {<br>            <font color="#0000ff">if</font> (connection != <font color="#0000ff">null </font>&amp;&amp; connection.State != <font color="#008080">ConnectionState</font>.Closed)<br>            {<br>                connection.Close();<br>            }<br>        }</font></p><p><font face=Consolas size=2><br>        connectionDictionary.Clear();<br>    }</font></p><p><font face=Consolas size=2><br>    <font color="#008080">Thread</font>.FreeNamedDataSlot(<font color="#800000">&quot;ConnectionDictionary&quot;</font>);<br>}</font></p></pre>
<p>You can find the full implementation in my <a href="http://sourceforge.net/projects/sharpcore">SharpCore</a> project on SourceForge if you're interested.</p></div>]]></description></item><item><title>Upgrading LINQ Beta 2 Code</title><link>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=15</link><pubDate>Sat, 10 Nov 2007 17:42:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=15#Comments</comments><dc:creator>Michael</dc:creator><description><![CDATA[<div class=ExternalClass4CCEBAF3ECC5489E87AAD2CED272416B>
<ol>
<li>
<div><span style="font-size:12pt"><span style="color:#1f497d">Change the <span style="font-family:Consolas">Add(), AddAll(), Remove(),</span> and <span style="font-family:Consolas">RemoveAll()</span> methods. Please see <a href="http://blogs.vertigo.com/personal/petar/Blog/Lists/Posts/Post.aspx?ID=3">Petar's blog post</a> for more info.<a href="http://blogs.vertigo.com/personal/petar/Blog/Lists/Posts/Post.aspx?ID=3"></span></span></div>
<p><br><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID%3d2060651%26SiteID%3d1" target="_blank"><span style="font-size:12pt;color:blue;text-decoration:underline">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2060651&amp;SiteID=1</span></a><span style="font-size:12pt"> </span></p>
<p>   </p></li></ol></div>
<div style="margin-left:36pt">
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:157px">
<col style="width:192px"></colgroup>
<tbody valign=top>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;border-left:#b3cc82 1pt solid;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt"><strong>Previous Method</strong></span></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;border-left:medium none;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt"><strong>Renamed Method</strong></span></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;border-left:#b3cc82 1pt solid;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt;font-family:Consolas">Add()</span></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;border-left:medium none;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt;font-family:Consolas">InsertOnSubmit()</span></p></td></tr>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;border-left:#b3cc82 1pt solid;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt;font-family:Consolas">AddAll()</span></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;border-left:medium none;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt;font-family:Consolas">InsertAllOnSubmit()</span></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;border-left:#b3cc82 1pt solid;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt;font-family:Consolas">Remove()</span></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;border-left:medium none;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt;font-family:Consolas">DeleteOnSubmit()</span></p></td></tr>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;border-left:#b3cc82 1pt solid;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt;font-family:Consolas">RemoveAll()</span></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;border-left:medium none;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-size:12pt;font-family:Consolas">DeleteAllOnSubmit()</span></p></td></tr></tbody></table></div>
<p style="margin-left:36pt">   </p>
<p style="margin-left:36pt">   </p>
<p style="margin-left:36pt"><span style="font-size:12pt"><span style="color:#1f497d"><span style="font-family:Consolas">2.</span><span style="font-family:Times New Roman">  </span>Update the LINQ to SQL .dbml files encoding to utf-8:</span> </span></p>
<blockquote dir=ltr style="margin-right:0px">
<p style="margin-left:36pt"><span style="font-size:12pt"><span style="color:#1f497d;font-family:Consolas">&lt;?xml version=&quot;1.0&quot; encoding=&quot;<span style="background-color:yellow">utf-16</span>&quot;?&gt; </span></span></p></blockquote>
<p style="margin-left:36pt">   </p>
<p style="margin-left:72pt"><span style="font-size:12pt"><span style="color:#1f497d">- to -</span> </span></p>
<p style="margin-left:36pt">   </p>
<blockquote dir=ltr style="margin-right:0px">
<p style="margin-left:36pt"><span style="font-size:12pt"><span style="color:#1f497d;font-family:Consolas">&lt;?xml version=&quot;1.0&quot; encoding=&quot;<span style="background-color:yellow">utf-8</span>&quot;?&gt;</span> </span></p></blockquote>
<p style="margin-left:36pt">   </p>
<p style="margin-left:36pt"><span style="font-size:12pt"><span style="color:#1f497d"><span style="font-family:Consolas">3.</span><span style="font-family:Times New Roman">  </span>Web.Config changes:</span> </span></p>
<p>   </p>
<blockquote dir=ltr style="margin-right:0px">
<blockquote dir=ltr style="margin-right:0px">
<p><span style="font-size:12pt"><span style="color:blue;font-family:Consolas">&lt;</span><span style="color:#a31515;font-family:Consolas">add</span><span style="color:blue;font-family:Consolas"> </span><span style="color:red;font-family:Consolas">assembly</span><span style="color:blue;font-family:Consolas">=</span><span style="font-family:Consolas">&quot;<span style="color:blue">System.Data.DataSetExtensions, <br>Version=2.0.0.0, Culture=neutral, <br>PublicKeyToken=B77A5C561934E089</span>&quot;<span style="color:blue">/&gt;</span></span> </span></p></blockquote></blockquote>
<p style="margin-left:36pt">   </p>
<p style="margin-left:72pt"><span style="font-size:12pt"><span style="color:#1f497d">- to -</span> </span></p>
<p style="margin-left:36pt">   </p>
<blockquote dir=ltr style="margin-right:0px">
<blockquote dir=ltr style="margin-right:0px">
<p><span style="font-size:12pt"><span style="color:blue;font-family:Consolas">&lt;</span><span style="color:#a31515;font-family:Consolas">add</span><span style="color:blue;font-family:Consolas"> </span><span style="color:red;font-family:Consolas">assembly</span><span style="color:blue;font-family:Consolas">=</span><span style="font-family:Consolas">&quot;<span style="color:blue">System.Data.DataSetExtensions, <br>Version=3.5.0.0, Culture=neutral, <br>PublicKeyToken=B77A5C561934E089</span>&quot;<span style="color:blue">/&gt;</span></span> </span></p></blockquote></blockquote>]]></description></item><item><title>Restarting a Sound in Silverlight 1.0</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=12</link><pubDate>Fri, 09 Nov 2007 16:28:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=12#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass13C5DD3847FC43019006F3755D66DC34>
<p>More than one person has experienced this problem and asked me about it. My solution is simple.</p>
<p style="font-family:monospace"><font color="#0000ff">function</font> restartSound(mediaElement)<br>{<br>    mediaElement.source= mediaElement.source;<br>    mediaElement.autoPlay= <font color="#0000ff">true</font>;<br>}</p></div>]]></description></item><item><title>Implementing Transactions the better way</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=31</link><pubDate>Fri, 09 Nov 2007 14:48:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=31#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass16C39C82E4D64A10BC937C764FA5A37A>
<p>In a <a href="http://blogs.vertigosoftware.com/aanttila/archive/2006/07/19/Implementing_a_Custom_Transaction_Manager.aspx">previous entry</a>, I discussed writing two different custom transaction managers, local and distributed.  The thing that always bothered me about my own implementation was 1) it was my own implementation and 2) You have to choose up front which transaction you should support.</p>
<p>I've been doing some maintenance on my <a href="http://sourceforge.net/projects/csharpdatatier">Data Tier Generator</a> project lately, and I decided to revisit how transactions are supported.  Version 2.0 of the .NET Framework introduced a new assembly and namespace, System.Transactions.  At the time, I couldn't think of a way to leverage the built-in support, but I think I've got it straightened out now.</p>
<p>Using a combination of System.Transactions and System.Threading, I've devised a new method for supporting transactions in my SqlClientUtility class that is part of <a href="http://sourceforge.net/projects/sharpcore">SharpCore</a>.  The Transaction class exposes a property called Current, which can be used to determine if the current code is running in the context of a transaction.  Using the Transaction.Current property in conjunction with thread local storage, I've managed to use the built-in transaction support rather than my own.  Here's the basic approach I've taken:</p><pre><font face=Consolas size=2><font color="#0000ff">if</font> (<font color="#008080">Transaction</font>.Current == <font color="#0000ff">null</font>)<br>{<br>    <font color="#0000ff">string</font> connectionString = <font color="#008080">ConfigurationManager</font>.ConnectionStrings[connectionStringName].ConnectionString;<br><font color="#008000">    // TODO: Execute the SqlCommand</font></font><font face=Consolas size=2><br>}<br><font color="#0000ff">else</font><br>{<br>    <font color="#008080">LocalDataStoreSlot</font> connectionStringNameSlot = <font color="#008080">Thread</font>.GetNamedDataSlot(<font color="#800000">&quot;ConnectionStringName:&quot;</font> + connectionStringName);<br>    <font color="#008080">LocalDataStoreSlot</font> connectionSlot = <font color="#008080">Thread</font>.GetNamedDataSlot(<font color="#800000">&quot;SqlConnection:&quot;</font> + connectionStringName);<br>    <font color="#008080">SqlConnection</font> connection = <font color="#0000ff">null</font>; </font><p></p>
<p><font face=Consolas size=2>    <font color="#0000ff">string</font> data = (<font color="#0000ff">string</font>) <font color="#008080">Thread</font>.GetData(connectionStringNameSlot); </font>
<p><font face=Consolas size=2>    <font color="#0000ff">if</font> (data == <font color="#0000ff">null</font>)<br>    {<br>        <font color="#0000ff">string</font> connectionString = <font color="#008080">ConfigurationManager</font>.ConnectionStrings[connectionStringName].ConnectionString;<br>        connection = <font color="#0000ff">new</font> <font color="#008080">SqlConnection</font>(connectionString); </font>
<p><font face=Consolas size=2>        <font color="#008080">Thread</font>.SetData(connectionStringNameSlot, connectionStringName);<br>        <font color="#008080">Thread</font>.SetData(connectionSlot, connection);<br>    }<br>    <font color="#0000ff">else</font><br>    {<br>        connection = (<font color="#008080">SqlConnection</font>) <font color="#008080">Thread</font>.GetData(connectionSlot);<br>    }</font></p><p><font face=Consolas size=2><br><br><br><br><font color="#008000">    // TODO: Execute the SqlCommand</font><br></font><font face=Consolas size=2>}</font></p></pre>
<p><font face=Verdana>You could quite easily substitute a different object or set of data for a SqlConnection. And the best thing about this approach is that if the method that calls this code is in a local transaction, it will automatically be promoted to a distributed transaction if required.</font></p>
<p>Now the only thing I have to do is figure out how to close my connection when I'm done with it...</p></div>]]></description></item><item><title>Microsoft Line of Code Counter</title><link>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=14</link><pubDate>Thu, 08 Nov 2007 14:58:02 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=14#Comments</comments><dc:creator>Michael</dc:creator><description><![CDATA[<div class=ExternalClassBFB054310A404D66BA79BD9EFF7B6237><p>Microsoft has released a nice line of code counter application. The application is available for download <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5af387c5-55c7-4bb1-97cd-e3f742de99da&amp;DisplayLang=en">here</a>.
</p><p>When you start the app for the first time, it shows a blank list of counter tasks:
</p><p><img src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/110807_2257_MicrosoftLi1.png" alt="">
	</p><p>The first step to using the application is to create a New Counter Task which can pull code from source control or examine files on disk:
</p><p><img src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/110807_2257_MicrosoftLi2.png" alt="">
	</p><p>Once that it is finished, you can hit the play button to run the code count:
</p><p><img src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/110807_2257_MicrosoftLi3.png" alt="">
	</p><p>Once the Counter Engine finishes processing, the Result dialog is shown with a nice Task Summary:
</p><p><img src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/110807_2257_MicrosoftLi4.png" alt="">
	</p><p>Clicking on the View Report button generates a nice summary of the code count:
</p><p><img src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/110807_2257_MicrosoftLi5.png" alt=""></p></div>]]></description></item><item><title>Sonicare Battery Recycling Challenge</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=27</link><pubDate>Wed, 31 Oct 2007 11:56:54 GMT</pubDate><slash:comments>6</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=27#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass2C5FDE618CE14761BC4169BB0732EC94><p>I recently was doing some cleaning-up around the house, and needed to get rid of an old Sonicare electric toothbrush that had provided many years of distinguished service. As it has rechargeable batteries with hazardous materials, you should certainly not simply throw it away.</p> <p>After looking on the web, the manufacturer described what sounded like a very simple process. Here's the (somewhat optimistic) quote from their <a href="http://www.sonicare.com/owners/advance_manual/manual_recycling.asp">website</a>:</p> <p><em>If you wish to personally recycle your Sonicare toothbrush handle at the end of its life, insert a flat-head screwdriver in a slot between the 2 halves of the handle at the threaded end, and then break apart the 2 halves. Remove the batteries from the inside of the handle and dispose of them properly in accordance with your local recycling program.</em></p> <p>It sounded quite easy and a bit fun, so I decided to do it myself. The plastic in the handle was very old and brittle--after doing some prying, it started to break off in little bits, rather than splitting the entire handle in half. As more bits came off, it became harder and harder to find anywhere to pry it apart.</p> <p>After about twenty minutes of prying, all the plastic I could pry apart had come off in bits, and I had no way to make progress with more prying. Feeling a tad frustrated and misled, I decided to get a mallet and some safety glasses and give it a good wacking so see if that would &quot;free it up&quot;.</p> <p>After several solid hits, the handle did indeed come apart in half, but at this point it became clear that the batteries were <strong>epoxied in place</strong>--it was not a simple matter of &quot;removing the batteries&quot; as the manufacturer had described. After a bit of snipping of leads to remove a circuit board that was in the way, I figured that I'd had enough success with the mallet that I should continue using it as my &quot;precision instrument of choice&quot;. Within a few minutes, I had smashed the circuit boards and most of the case. Unfortunately, I had also demonstrated that the epoxy was pretty strong stuff--I had smashed nearly everything else, but a small amount of the plastic case was still firmly epoxied to the batteries. Here are a few photos I took:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/27/EndView_2.jpg"><img height=289 alt="Top view of batteries and a bit of the case" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/27/TopView_thumb_1.jpg" width=346 border=0></a>   </p> <p><img height=338 alt="Side view of case with batteries beneath. The green stuff between the case and batteries is the epoxy." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/27/EndView_thumb.jpg" width=279 border=0>         <a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/27/TopView2_2.jpg"><img height=303 alt="Another view of the batteries, with the case on the right. The green between is the epoxy." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/27/TopView2_thumb.jpg" width=200 border=0></a>   </p> <p>As you can see, very little of the case remained, but it was firmly attached to the batteries. (The green stuff between the batteries and the case is the wonder epoxy.) Note that the repeated blows from the mallet had also destroyed part of the battery casing.</p> <p>At this point, I &quot;declared&quot; victory and decided that this entire chunk was good enough to recycle. And I had indeed had some fun. But in general, unless you're up for a bit of a challenge, I'd encourage you to take Phillips up on their offer and have them recycle it for you. And be sure to wear safety glasses if you do it yourself and end up resorting to the mallet!</p></div>]]></description></item><item><title>Using WinMerge with Microsoft Team System</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=26</link><pubDate>Wed, 31 Oct 2007 11:21:54 GMT</pubDate><slash:comments>4</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=26#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass6FA35E9FEF3E49C880AF05F9B8368B75><p>I like Microsoft's Team System for source control--I especially love the shelving functionality, that has gotten my agile team out of some complex little workflow tangles. However, I'm not such a fan of some of the client-side tools.</p> <p>One of my least favorite tools in Team System is the diff tool. The things I really dislike about it are:</p> <ul> <li>It won't show me the specific differences in a long line--it simply highlights the entire line. This is surprisingly annoying for long lines of code where you know something is different because the line is highlighted (and therefore the <strong>tool</strong> knows what the difference is but won't tell me!) Given this, you have little choice but to visually scan each version of the line character by character to try to notice differences--<strong>and </strong>hope you don't miss anything! Forgive me, but isn't this what the diff tool was supposed to do?! <li>You cannot change the font size. Given that the split-pane display effectively divides the monitor into two halves, I'd really like to use a smaller font size to allow more text to be visible in the panes, but this isn't possible, which is a surprising limitation.</li></ul> <p>Here's a sample screenshot of the diff tool from Team System exhibiting these issues:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffTSdiff_2.png"><img height=730 alt="Standard diff tool from Team System, with large font and no diffs inside a line" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffTSdiff_thumb.png" width=960 border=0></a> </p> <p>Note that on line 307, it's not immediately clear what has changed in the method signature: partially because only the line is highlighted, and partially because the font is so large that the whole line cannot be seen without horizontal scrolling.</p> <p>Given these issues, I looked into other diff tools. To its credit, Team System is fully extensible in terms of merge and diff tools. James Manning of Microsoft has a <a href="http://blogs.msdn.com/jmanning/articles/535573.aspx">great post</a> describing how to configure Team System with a different merge or diff tool. Another nice touch is that you can independently configure the diff and merge tools--I haven't found a better merge tool yet, but I do like <a href="http://winmerge.org/">WinMerge</a> better for diff. (One of my criteria is perhaps a bit unfair, but I wanted something that was no cost to use.) Since I diff much more frequently than merging, a better diff tool is a clear win for me.</p> <p>Specifically, the things I like about WinMerge are:</p> <ul> <li>It highlights the differences <strong>within </strong>the line rather than the whole line--this makes looking at diffs much easier, because the tool is actually doing much more of the work. <li>It has a cool &quot;Diff Pane&quot; at the bottom of the window that displays a full-width version of the currently selected difference block--again, this makes things so much faster than having to horizontally scroll back and forth for each change.  <li>I can change the font to something a bit smaller to fit more code on the monitor (it's the little things sometimes!)</li></ul> <p> Here is the same diff as above in WinMerge:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/WinMergescreenshotcleanedited_2.png"><img height=691 alt="WinMerge diff tool, with smaller font, diffs within a line, and handy full-window-width Diff Pane" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/WinMergescreenshotcleanedited_thumb.png" width=928 border=0></a> </p> <p>Note that the Diff Pane at the bottom allows you to see the currently highlighted difference at the full window width--I cannot say how useful this is in everyday work. In addition, notice that the coloring in the Diff Pane makes it very clear that the only part of the line that changed was the method visibility (private changed to public.) Again, this makes it much less likely that you miss some other change, and it saves a lot of mental work to manually diff the characters yourself.</p> <p><strong></strong> </p> <p><strong>Configuration</strong></p> <p>So how do you configure it? It's fairly well explained in the blog post above, but here are some screenshots of how I set mine up. In Visual Studio 2005, first click <strong>Tools</strong>, then <strong>Options </strong>to bring up the Options dialog:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigbutton_2.png"><img height=438 alt="Visual Studio 2005 Options dialog, showing Source Control: Visual Studio Team Foundation Server property page" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigbutton_thumb.png" width=757 border=0></a> </p> <p>On the tree control on the left, expand <strong>Source Control</strong>, and then click <strong>Visual Studio Team Foundation Server</strong>. Click <strong>Configure User Tools...</strong> to display the Configure User Tools dialog:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigdialog_2.png"><img height=282 alt="Configure User Tools dialog without any rows (default setting to use Team System diff and merge tools)" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigdialog_thumb.png" width=476 border=0></a> </p> <p>As the Team System tools are the default, nothing is shown in this dialog. Click <strong>Add... </strong>to display the Configure Tool dialog to add a custom tool mapping:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigureTooldialogempty_2.png"><img height=219 alt="Configure Tool dialog (initial unpopulated state)" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigureTooldialogempty_thumb.png" width=417 border=0></a> </p> <p>Fill this out for WinMerge according to the post above. It should look something like this when complete:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigdialogforWinMerge_2.png"><img height=219 alt="Configure Tool dialog populated with WinMerge configuration" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigdialogforWinMerge_thumb.png" width=417 border=0></a> </p> <p>Click <strong>OK</strong>, and the Configure User Tools dialog will now show that WinMerge is configured for Comparison (diffs):</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigdialogforWinMergerow_2.png"><img height=282 alt="Configure User Tools dialog with WinMerge configured to diff" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/26/MergeDiffToolsConfigdialogforWinMergerow_thumb.png" width=476 border=0></a> </p> <p>Click <strong>OK</strong>, and then <strong>OK </strong>to complete the setup.</p> <p>Note that the blog post above includes a long list of both merge and diff tools--you may want to do a bit of experimenting to see what works best. Note that a certain amount of caution should be exercised, especially with the merge tool, as an unfamiliar merge tool could be used incorrectly and create a lot of chaos!</p></div>]]></description></item><item><title>The WebBrowser control with a custom User-Agent</title><link>http://blogs.vertigo.com/personal/chrisv/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Wed, 31 Oct 2007 10:16:00 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/chrisv/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>chrisv</dc:creator><description><![CDATA[<div class=ExternalClass05A354F1A74041249C629E9637159C11>
<div>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri>We are using a WebBrowser control in a project I am working on and needed to use a custom User-Agent.<span>  </span>Searching the Internet only produced a way to change the User-Agent on a single request not for every request the WebBrowser control makes.<span>  </span></font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>It seems that the WebBrowser control only has one method to access headers, the WebBrowser.Navigate() method.<span>  </span>The code below intercepts all navigation request from the WebBrowser control and calls the WebBrowser.Navigate() method using a custom User-Agent.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;color:blue;font-family:'Courier New'">public</span><span style="font-size:10pt;font-family:'Courier New'"> <span style="color:blue">partial</span> <span style="color:blue">class</span> <span style="color:#2b91af">Form1</span> : <span style="color:#2b91af">Form</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'">{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span><span style="color:blue">bool</span> isUserAgentSet = <span style="color:blue">false</span>;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span><span style="color:blue">public</span> Form1()</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>        </span>InitializeComponent();</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span><span style="color:blue">private</span> <span style="color:blue">void</span> Form1_Load(<span style="color:blue">object</span> sender, <span style="color:#2b91af">EventArgs</span> e)</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>        </span><span style="color:blue">this</span>.webBrowser.Navigate(<span style="color:blue">“Http://someurl.com”</span>);</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span><span style="color:blue">private</span> <span style="color:blue">void</span> webBrowser_Navigating(<span style="color:blue">object</span> sender, <span style="color:#2b91af">WebBrowserNavigatingEventArgs</span> e)</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>        </span><span style="color:green">//Check if the custom user agent is set</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>        </span><span style="color:blue">if</span> (!isUserAgentSet)</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>        </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>            </span><span style="color:green">//cancel the current request</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>            </span>e.Cancel = <span style="color:blue">true</span>;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>            </span><span style="color:blue">this</span>.isUserAgentSet = <span style="color:blue">true</span>;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>            </span><span style="color:green">//Navigate to the desired location using the custom user agent</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>            </span><span style="color:blue">this</span>.webBrowser.Navigate(e.Url, e.TargetFrameName, <span style="color:blue">null</span>, <span style="color:#a31515">&quot;User-Agent: CustomUserAgent\r\n&quot;</span>);</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>        </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span><span style="color:blue">private</span> <span style="color:blue">void</span> webBrowser_DocumentCompleted(<span style="color:blue">object</span> sender, <span style="color:#2b91af">WebBrowserDocumentCompletedEventArgs</span> e)</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span>{</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>        </span><span style="color:green">//reset isUserAgentSet to prepare for the next navigate command</span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>        </span><span style="color:blue">this</span>.isUserAgentSet = <span style="color:blue">false</span>;</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"><span>    </span>}</span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span style="font-size:10pt;line-height:115%;font-family:'Courier New'">}</span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span style="font-size:10pt;line-height:115%;font-family:'Courier New'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>This code currently only works for GET requests.<span>  </span>I am working on a POST solution and will blog that code as soon as it is done.</font></p></div></div>]]></description></item><item><title>Remote Deployment of 2005 Database Projects</title><link>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=12</link><pubDate>Tue, 30 Oct 2007 09:44:48 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=12#Comments</comments><dc:creator>mmoser</dc:creator><description><![CDATA[<div class=ExternalClassED35DA5AC6B14840ABA26AB455158FC1><p> </p> <p>I like to use the 2005 Database Project when developing applications.  </p> <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/12/image_2.png"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=174 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/12/image_thumb.png" width=244 border=0></a> </p> <p><em>*note which database project type I selected, there is a difference.</em></p> <p>It's great for shops with localized development environments, which include a local database.  Once you are ready to deploy the database to QA, Staging, Production or any server other then local, you will quickly find that the IDE does not support this.</p> <p>The build process will generate a .sql file in the configured location.</p> <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/12/image_4.png"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=127 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/12/image_thumb_1.png" width=244 border=0></a> </p> <p>Take this file and place it on the target server.  You can then use the sqlcmd utility to execute the file.  You may wonder why you can't just run the sql manually.  The Database Project uses some syntax and features that require this type of execution.  I won't go into detail in this post, however here is an example of some of the syntax.</p> <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/12/image_6.png"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=92 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/12/image_thumb_2.png" width=244 border=0></a> </p> <p>Now go to the local server and run the sqlcmd utility for the file:</p> <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/12/image_8.png"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=154 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/12/image_thumb_3.png" width=244 border=0></a></p></div>]]></description></item><item><title>C# 3.0 Language Enhancements</title><link>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=13</link><pubDate>Tue, 23 Oct 2007 23:42:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=13#Comments</comments><dc:creator>Michael</dc:creator><description><![CDATA[<div class=ExternalClassFB89DFCC1CF74DF1BC5E50DDF4780DD2>
<div>
<table style="border-collapse:collapse" border=0>
<colgroup><font size=2>
<col style="width:57px">
<col style="width:581px"></font></colgroup>
<tbody valign=top>
<tr>
<td style="padding-right:7px;padding-left:7px;padding-bottom:1px;padding-top:1px" valign=center>
<p><font size=2><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/102407_0642_C30Language1.png"></font></p></td>
<td style="padding-right:7px;padding-left:7px;padding-bottom:1px;padding-top:1px" valign=center>
<p><font size=2>While attending TechEd 2007 in Orlando, FL I attended a great session on the new language features in C# 3.0. While I was in college (at </font><a href="http://www.hmc.edu/" target="_blank"><font size=2>Harvey Mudd College</font></a><font size=2>), I took a course on Programming Languages and study such languages as Scheme, Lisp, and Standard ML. It is great to see advancements in commercial programming languages that Academia has had for years. You can check out the official C# 3.0 at the </font><a href="http://msdn2.microsoft.com/en-us/vcsharp/aa336745.aspx" target="_blank"><font size=2>MSDN Visual C# Developer Center</font></a><font size=2>.</font></p></td></tr>
<tr>
<td style="padding-right:7px;padding-left:7px;padding-bottom:1px;padding-top:1px" valign=center>
<p>  </p></td>
<td style="padding-right:7px;padding-left:7px;padding-bottom:1px;padding-top:1px" valign=center>
<p>  </p></td></tr></tbody></table></div>
<p>For all of the code snippets below I am using Visual Studio 2008. I started by creating a new C# Console Application and then I added a new class named Customers. Here is a recap of the new language enhancements: </p>
<p><span style="font-size:14pt"><strong>1. Auto-Implemented Properties</strong></span> </p>
<p>It is always tedious to provide the getter and setters for properties. Visual Studio 2005 made life a bit easier with the Refactor -&gt; Encapsulate Field feature, but it was still a lot of work to clean up the code to get everything organized nicely. </p>
<p>Auto-Implemented Properties allows you to define public data type and the compiler will take care of automatically generate a Public read/write property.</p>
<div>
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:272px">
<col style="width:304px"></colgroup>
<tbody valign=top>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 2.0</strong></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:medium none;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 3.0</strong></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:blue">private</span> <span style="color:blue">int</span>? _customerId = <span style="color:blue">null</span>; </span></p>
<p>   </p>
<p><span style="font-family:Consolas"><span style="color:blue">public</span> <span style="color:blue">int</span>? CustomerId </span></p>
<p><span style="font-family:Consolas">{ </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">get</span> { <span style="color:blue">return</span> _customerId; } </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">set</span> { _customerId = <span style="color:blue">value</span>; } </span></p>
<p><span style="font-family:Consolas">} </span></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:medium none;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:blue">public</span> <span style="color:blue">int</span>? CustomerId { <span style="color:blue">get</span>; <span style="color:blue">set</span>; }</span></p></td></tr></tbody></table></div>
<p>   </p>
<p>If you compare the IL that is generated using ildasm.exe, you can see how the property is managed </p>
<p><strong>Standard Property (backed by a defined private data member) </strong></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/102407_0641_C30Language2.png"> </p>
<p><strong>Auto-Implemented Property </strong></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/102407_0641_C30Language3.png"> </p>
<p>   </p>
<p><span style="font-size:14pt"><strong>2. Object-Initializers</strong> </span></p>
<p>Often we need to set a bunch of properties once we new up an object from our class definition. In C# 3.0, we no longer have to use the object name dot notation to initialize the Properties. Instead we can use curly braces after the instantiation as shown below: </p>
<div>
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:256px">
<col style="width:248px"></colgroup>
<tbody valign=top>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 2.0</strong></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:medium none;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 3.0</strong></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:#2b91af">Customers</span> c = <span style="color:blue">new</span> <span style="color:#2b91af">Customers</span>(); </span></p>
<p><span style="font-family:Consolas">c.CustomerId = 1; </span></p>
<p><span style="font-family:Consolas">c.Name = <span style="color:#a31515">&quot;Mike Hanley&quot;</span>;</span> </p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:medium none;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:#2b91af">Customers</span> c = <span style="color:blue">new</span> <span style="color:#2b91af">Customers</span>() </span></p>
<p><span style="font-family:Consolas">{ </span></p>
<p><span style="font-family:Consolas">CustomerId = 1, </span></p>
<p><span style="font-family:Consolas">Name = <span style="color:#a31515">&quot;Mike Hanley&quot;</span> </span></p>
<p><span style="font-family:Consolas">}; </span></p></td></tr></tbody></table></div>
<p>   </p>
<p>   </p>
<p><span style="font-size:14pt"><strong>3. Collection-Initializers</strong> </span></p>
<p>As mentioned in the Object-Initializers enhancement above, the same is also true for Collections. </p>
<div>
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:232px">
<col style="width:232px"></colgroup>
<tbody valign=top>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 2.0</strong></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:medium none;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 3.0</strong></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Customers</span>&gt; customers = </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Customers</span>&gt;(); </span></p>
<p>   </p>
<p><span style="font-family:Consolas">customers.Add(c1); </span></p>
<p><span style="font-family:Consolas">customers.Add(c2); </span></p>
<p><span style="font-family:Consolas">customers.Add(c3); </span></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:medium none;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Customers</span>&gt; customers = </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Customers</span>&gt;() </span></p>
<p><span style="font-family:Consolas">{ </span></p>
<p><span style="font-family:Consolas">c1, c2, c3 </span></p>
<p><span style="font-family:Consolas">};</span></p></td></tr></tbody></table></div>
<p>   </p>
<p>What is also nice is that Visual Studio 2008 provides full Intelli-Sense support as well. </p>
<p>   </p>
<p><span style="font-size:14pt"><strong>4. local variable type reference (<span style="color:blue;font-family:Consolas">var</span>)</strong> </span></p>
<p>The <span style="color:blue;font-family:Consolas"><strong>var</strong></span> keyword is one of the coolest new features in C# 3.0 and enables very elegant code. The compiler is able to determine the intended by evaluating the right hand side of the expression. </p>
<div>
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:232px">
<col style="width:320px"></colgroup>
<tbody valign=top>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 2.0</strong></p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:medium none;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 3.0</strong></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Customers</span>&gt; customers = </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Customers</span>&gt;();</span> </p></td>
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:medium none;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:blue">var</span> customers = <span style="color:blue">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Customers</span>&gt;();</span></p></td></tr></tbody></table></div>
<p>   </p>
<p>In the example above, the compile is able to determine that the <span style="font-family:Consolas">customers</span> data member is a <span style="font-family:Consolas"><strong><span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">T</span>&gt;</strong></span> where <span style="color:#2b91af;font-family:Consolas"><strong>T</strong></span> is of type <span style="color:#2b91af;font-family:Consolas"><strong>Customers</strong></span>. The scope of the <span style="color:blue;font-family:Consolas"><strong>var</strong></span> keyword is limited to a method. This ensures that the compiler can still ensure type safety. If it was allowed as a parameter in a method, there would be no way to determine what the type is at compile time. </p>
<p>   </p>
<p><span style="font-size:14pt"><strong>5. Query Expressions (LINQ)</strong> </span></p>
<p>Query Expressions build upon the <span style="color:blue;font-family:Consolas"><strong>var</strong></span> keyword and Microsoft has provided a whole query framework named Language Integrated Query or LINQ. Query Expressions provide a convenient way to data projection and transformations in code. </p>
<div>
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:264px"></colgroup>
<tbody valign=top>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 3.0</strong></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:blue">var</span> query = <span style="color:blue">from</span> c <span style="color:blue">in</span> customers </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">where</span> c.Name == <span style="color:#a31515">&quot;Mike Hanley&quot; </span></span></p>
<p><span style="font-family:Consolas"><span style="color:blue">select</span> c;</span> </p></td></tr></tbody></table></div>
<p>   </p>
<p>If you have ever used T-SQL, the syntax will look very familiar with one notable exception: the placement of the select clause. The <span style="color:blue;font-family:Consolas"><strong>from</strong></span> clause needs to be first in order to determine the type and to enable scenarios like Intelli-Sense support in Visual Studio 2008. </p>
<p>Let's consider the following code to print out a list of customers </p>
<div>
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:578px"></colgroup>
<tbody valign=top>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 3.0</strong></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:blue">var </span>c1 = <span style="color:blue">new</span> <span style="color:#2b91af">Customers</span>() { CustomerId = 1, Name = <span style="color:#a31515">&quot;Mike Hanley&quot;</span> }; </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">var</span><span style="color:#2b91af"> </span>c2 = <span style="color:blue">new</span> <span style="color:#2b91af">Customers</span>() { CustomerId = 2, Name = <span style="color:#a31515">&quot;Kevin Hanley&quot;</span> }; </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">var</span><span style="color:#2b91af"> </span>c3 = <span style="color:blue">new</span> <span style="color:#2b91af">Customers</span>() { CustomerId = 3, Name = <span style="color:#a31515">&quot;Scott Stanfield&quot;</span> }; </span></p>
<p>   </p>
<p><span style="font-family:Consolas"><span style="color:blue">var</span><span style="color:#2b91af"> </span>customers = <span style="color:blue">new</span> <span style="color:#2b91af">List</span>&lt;<span style="color:#2b91af">Customers</span>&gt;() { c1, c2, c3 }; </span></p>
<p>   </p>
<p><span style="font-family:Consolas"><span style="color:blue">var</span> query = <span style="color:blue">from</span> c <span style="color:blue">in</span> customers </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">where</span> c.CustomerId &gt; 0 </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">select</span> c; </span></p>
<p>   </p>
<p><span style="font-family:Consolas"><span style="color:blue">foreach</span> (<span style="color:#2b91af">Customers</span> c <span style="color:blue">in</span> query) </span></p>
<p><span style="font-family:Consolas">{ </span></p>
<p><span style="font-family:Consolas"><span style="color:#2b91af">Console</span>.WriteLine(c.Name); </span></p>
<p><span style="font-family:Consolas">} </span></p></td></tr></tbody></table></div>
<p>   </p>
<p>The output of the code above will print out the names of the customers in the order in which they were added to the Customers list. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/102407_0641_C30Language4.png"> </p>
<p>Now let's add an <strong><span style="color:blue;font-family:Consolas">orderby</span> </strong>clause to transform the data: </p>
<div>
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:264px"></colgroup>
<tbody valign=top>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 3.0</strong></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="font-family:Consolas"><span style="color:blue">var</span> query = <span style="color:blue">from</span> c <span style="color:blue">in</span> customers </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">where</span> c.CustomerId &gt; 0 </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">orderby</span> c.Name.Split(<span style="color:#a31515">' '</span>)[0] </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">select</span> c; </span></p></td></tr></tbody></table></div>
<p>   </p>
<p>Now the customers are sorted by first name: </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/102407_0641_C30Language5.png"> </p>
<p>   </p>
<p><span style="font-size:14pt"><strong>6. Anonymous Types</strong> </span></p>
<p>It is possible to create a new instance of an object without specifying the class that should be used to create the type. </p>
<div>
<table style="border-collapse:collapse" border=0>
<colgroup>
<col style="width:578px"></colgroup>
<tbody valign=top>
<tr style="background:#e6eed5">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:#b3cc82 1pt solid;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><strong>C# 3.0</strong></p></td></tr>
<tr style="background:#cdddac">
<td style="border-right:#b3cc82 1pt solid;padding-right:7px;border-top:medium none;padding-left:7px;padding-bottom:1px;border-left:#b3cc82 1pt solid;padding-top:1px;border-bottom:#b3cc82 1pt solid" valign=center>
<p><span style="color:green;font-family:Consolas">// strongly typed Customer </span></p>
<p><span style="font-family:Consolas"><span style="color:#2b91af">Customer</span> c1 = <span style="color:blue">new</span> <span style="color:#2b91af">Customer</span>() { CustomerId = 1, Name = <span style="color:#a31515">&quot;Mike Hanley&quot;</span> }; </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">var</span> c2 = <span style="color:blue">new</span> <span style="color:#2b91af">Customer</span>() { CustomerId = 2, Name = <span style="color:#a31515">&quot;Kevin Hanley&quot;</span> }; </span></p>
<p>   </p>
<p><span style="color:green;font-family:Consolas">// anonymous type </span></p>
<p><span style="font-family:Consolas"><span style="color:blue">var</span> c3 = <span style="color:blue">new</span> { CustomerId = 1, Name = <span style="color:#a31515">&quot;Mike Hanley&quot;</span> }; </span></p></td></tr></tbody></table></div>
<p>   </p>
<p>   </p>
<p><span style="font-size:14pt"><strong>7. Lamda Expressions</strong> </span></p>
<p>A Lamda Expression appears to be the evolution of the Anonymous Delegate feature that was implemented in C# 2.0. In C# 3.0, a Lamda Expression provides an easier way to write an anonymous method. A Lamda Expression has its roots deep in Programming Language theory—it appears very similar to the functor construct in <a href="http://en.wikipedia.org/wiki/Standard_ML">Standard ML</a>. It is essentially a way to store a function like a piece of data. Data members can then be applied to the Lamda Expression to produce a result. Lamda Expressions are strongly typed. They derive their type inference based on their usage.</p></div>]]></description></item><item><title>Web Browsers: Who Decides What You Use?</title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=12</link><pubDate>Tue, 16 Oct 2007 17:19:07 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=12#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass118CA38B14784770997501C5CDB75FDC><p>Over the weekend I was taking care of some items on my to-do list that were accomplished online. These days I use Apple's Safari browser because it renders fast and the &quot;chrome&quot; is minimal, and it allows me to synch my bookmarks across multiple computers and the iPhone using .Mac. However, I could not complete a couple of items because the web sites required me to use, separately, Firefox and Internet Explorer. Before Safari I used Firefox, so I had that one laying around, but it's been a long time since I've used Internet Explorer, and in fact it is no longer available for the Mac. 
</p><p>In my opinion, the user should choose the browser they use; this choice should not be made by a web site. Every web site should adapt, and at Vertigo we know that this can be done. Sure, it takes a little extra work (sometimes, only an hour or two), but once you get to know the unique browser quirks it becomes fairly routine. 
</p><p>Imagine if you had to use separate cell phones every time you wanted to call a friend who is on a different network. This would be unacceptable, and having to use three separate web browsers to browse the Internet is similarly inefficient. 
</p><p>So, pick your browser and stand up for your choice!  </p></div>]]></description></item><item><title>FlipTile3D with Twitter friends list</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=20</link><pubDate>Fri, 12 Oct 2007 18:22:34 GMT</pubDate><slash:comments>37</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=20#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass3A7A8EBF15414AE2AA0AC1FFBCE11872><p>One of the best presentation that I attended at Mix07 was <a href="http://sessions.visitmix.com/default.asp?event=1011&amp;session=2011&amp;pid=XD009&amp;disc=&amp;id=1598&amp;year=2007&amp;search=XD009">Kevin Moore's talk</a> on his <a href="http://wpf.netfx3.com/files/folders/controls/entry10297.aspx">WPF Bag-O-Tricks</a>.  I was especially blown away by the new FlipTile3D control.  Last night I spent some time combining it with the user icons from my Twitter friends list.  The end result is pretty cool.</p> <p><a title="http://blogs.vertigosoftware.com/files/alan/wittyfliptile3d.htm" href="http://blogs.vertigosoftware.com/files/alan/wittyfliptile3d.htm">http://blogs.vertigosoftware.com/files/alan/wittyfliptile3d.htm</a></p></div>]]></description></item><item><title>Witty: A WPF Twitter Client</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=19</link><pubDate>Thu, 11 Oct 2007 17:08:56 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=19#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass0D47F411D797419DB93ED9E604CAA0C1><div class=ExternalClass5BCC7E8472D148EAB319540E8D740B59> <p>UPDATE: released this as open source at <a title="http://code.google.com/p/wittytwitter/" href="http://code.google.com/p/wittytwitter/">http://code.google.com/p/wittytwitter/</a></p> <p>I had some free time recently and decided to improve my original <a href="http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=6">WPF Twitter client</a>.  This time, I wanted to focus on the UI perspective instead of the backend.  With that in mind, I re-skinned it as Witty.  <a href="http://code.google.com/p/wittytwitter/">Check it out</a> and tell me what you think.  It's still definitely a work in progress, but should provide the basics for interacting with Twitter.</p> <p><a href="http://code.google.com/p/wittytwitter/"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=482 alt="Witty 0.1.1" src="http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Attachments/19/Witty%200.1.1_1.png" width=357 border=0></a> </p></div></div>]]></description></item><item><title>Double-Click the New York Times</title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=11</link><pubDate>Thu, 11 Oct 2007 09:49:14 GMT</pubDate><slash:comments>4</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=11#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass511B44A92BC241EEA497F72FBF292C73><p>I accidentally learned that if you double click a word in a <a href="http://nytimes.com/">New York Times</a> article it brings up a small, separate window with Reference Search results that uses an Answers.com engine to provide definitions of the term from several sources. 
</p><p>I double clicked a word to copy it, but got the pop-up instead. While some may find the reference search useful I'd prefer to stick to the common usage of the double click over text since that is something I often do. On the other hand, the New York Times is a great educational resource and this feature plays right into that.  Right clicking is rarely used on the Web, but that would be a better way to access this feature. Double click to highlight the word, then right click to access a link to the Reference Search. This implementation accommodates both the reference search link and my need to copy a work on a web page. Simply add it to the browser's own right click menu under a web page-specific action subgroup. </p></div>]]></description></item><item><title>Firefox + Noscript = no silverlight</title><link>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=8</link><pubDate>Wed, 10 Oct 2007 10:39:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=8#Comments</comments><dc:creator>jeffv</dc:creator><description><![CDATA[<div class=ExternalClass625880F91F70456AA63267B6545D4018>
<div>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri>One of the things I like about the Firefox browser is the add-on “Noscript” which allows you to selectively choose which sites to allow javascript on.<span>  </span></font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>But I ran into a problem viewing pages with Microsoft’s new Silverlight content.<span>  </span><br>As in it doesn’t work… at least with NoScript with its default settings.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>But don’t worry, there is a solution, and it’s an easy one.<span>  </span>One of the options for the NoScript, is “Forbid Microsoft <span> </span>Silverlight”, which by default is forbidding silverlight.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>There are two ways to access NoScript options.</font></p>
<p class=MsoListParagraphCxSpFirst style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>1&gt;</font><span style="font:7pt 'Times New Roman'">     </span></span></span><font face=Calibri size=3>Use the menu: <u>T</u>ools&gt;<u>A</u>dd ons<br>find the NoScript entry and click <u>O</u>ptions</font></p>
<p class=MsoListParagraphCxSpFirst style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><font face=Calibri size=3><img alt="Add-on options screen shot" src="http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Photos/_w/noscriptSilverlight1_png.jpg"><br></p></font><span><font face=Calibri size=3></font></span>
<p class=MsoListParagraphCxSpLast style="margin:0in 0in 10pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>2&gt;</font><span style="font:7pt 'Times New Roman'">     </span></span></span><span><font face=Calibri size=3>Use the context menu on NoScript’s icon on the status bar</font></span></p>
<p class=MsoListParagraphCxSpLast style="margin:0in 0in 10pt 0.5in;text-indent:-0.25in"><span><font face=Calibri size=3><img alt="Contest menu screen shot" src="http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Photos/_w/noscriptSilverlight2_png.jpg"><br></p></font></span>
<p class=MsoNormal style="margin:0in 0in 10pt 0.25in"><font face=Calibri size=3>Once in the NoScript Options panel, go to the Plugins tab<br></font><span><font face=Calibri size=3></font></span><br><font face=Calibri size=3>Just uncheck “Forbid Microsoft Silverlight” and you are good to go!</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt 0.25in"><img alt="Options dialog screen shot" src="http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Photos/_w/noscriptSilverlight3_png.jpg"></p>
<p class=MsoNormal style="margin:0in 0in 10pt 0.25in"><font face=Calibri size=3>Now if someone could tell me how to keep this dialog from coming up every 45 seconds when viewing non-interactive Silverlight animations:</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt 0.25in"><img alt="Unresponsive screen shot" src="http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Photos/_w/noscriptSilverlight4_png.jpg"></p>
<p class=MsoNormal style="margin:0in 0in 10pt 0.25in"><span></span></p></div></div>]]></description></item><item><title>app_offline.htm</title><link>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Thu, 04 Oct 2007 16:02:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>kenm</dc:creator><description><![CDATA[<div class=ExternalClassE8DE5AA21FA84FD39F6DAD9A296BC2CE><p>Recently I came across a useful little feature of ASP.NET 2.0 that allows you to easily take a web site offline without writing any custom code, fiddling with app pools or cracking open IIS Manager. If you simply drop a file called app_offline.htm into the root of the web site then ASP.NET will immediately stop the web application and unload the app domain. Any subsequent HTTP requests to the web site will merely serve up whatever is in the app_offline.htm file. 
</p>
<p>Note that you can't have any server-side logic in app_offline.htm since it is merely static. However, it provides a nice, clean way to take the site down for maintenance or any other reason. I'm using it to deploy new versions of the web app I'm working on. I drop in app_offline.htm to take the site down, delete all the old files, stage up all the new files and then simply delete app_offline.htm to bring the site back to life again.</p></div>]]></description></item><item><title>CoolCommands</title><link>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=5</link><pubDate>Thu, 04 Oct 2007 15:48:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=5#Comments</comments><dc:creator>kenm</dc:creator><description><![CDATA[<div class=ExternalClass5754DCCD90B04A1DB381555BC088CC6F><p>Having really gotten used to the Ctrl-mouse wheel functionality in Word and Firefox to easily change the font size, I was a little disappointed to see that Visual Studio 2005 doesn't support it. When projecting Visual Studio on my laptop it's annoying having to go into Tool-&gt;Options-&gt;Fonts and Colors and manually change the font to a specific size, then do it again when you realize that the new size isn't quite big enough for everyone to see. Luckily I found <a target="_blank" href="http://weblogs.asp.net/gmilano/archive/2006/05/10/446010.aspx">CoolCommands</a> which is a little group of utilities – one of which is Wheel Font Sizing, exactly what I need. Written by Gaston Milano, CoolCommands also includes a quick Demo Font option which really jacks up the font size for presentations in bigger rooms. Thanks Gaston!</p></div>]]></description></item><item><title>Vista and Crystal Reports Server</title><link>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Mon, 01 Oct 2007 10:50:38 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>mmoser</dc:creator><description><![CDATA[<div class=ExternalClassADBC0B269C794095B41337FB569C0822><p>It seems that <a href="http://msdn2.microsoft.com/en-us/library/ms691272.aspx">NTLMSSP</a> is <a href="http://msdn2.microsoft.com/en-us/library/aa480152.aspx#appcomp_topic16">no longer supported</a> on Windows Vista or Server 2008.  I realized this while installing a copy of Crystal Report Server on my Vista workstation when none of the services would start.  <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/6/clip_image002_2.jpg"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=108 alt="clip_image002" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/6/clip_image002_thumb.jpg" width=244 border=0></a>  <p>If you look at the service’s dependencies (from Crystal’s utility) you will see:  <p><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/6/clip_image004_2.jpg"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=239 alt="clip_image004" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/6/clip_image004_thumb.jpg" width=244 border=0></a>  <p><a href="http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&amp;docType=kc&amp;externalId=xir2ppreleasenotesenpdf&amp;sliceId=&amp;dialogID=8264670&amp;stateId=1 0 8266173">Here</a> (pages 16-17) is a listing of the workarounds and known issues with BusinessObjects Enterprise XI R2 on Windows Vista:  <p>To get the services to start, you: <i>“</i><i>To use the Central Configuration Manager’s &quot;Browse for computer&quot;</i> <i>functionality on a Windows Vista-based operating system, you must turn</i> <i>on &quot;Network Discovery&quot;. To access this setting, navigate to the Control</i> <i>Panel, select </i><b><i>Network and Internet</i></b><i>, and then </i><b><i>Network and Sharing</i></b> <b><i>Center.”</i></b>  <p>However it sounds as though the server components are not supported on Vista: <i>“</i><i>For Business Objects purposes, Windows Vista is considered a client</i> <i>operating system, and, therefore, will only support client tools; such as</i> <i>Crystal Reports, rich and client applications. Windows Vista will not</i> <i>support BusinessObjects Enterprise XI or XIR2 server components or</i> <i>deployments.”</i></p></div>]]></description></item><item><title>Data Dictionary Creator and Database Projects</title><link>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=5</link><pubDate>Fri, 28 Sep 2007 14:00:16 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=5#Comments</comments><dc:creator>mmoser</dc:creator><description><![CDATA[<div class=ExternalClass51D8FBBE51BF41D2B88033F90E2E63C4><p>&quot;<a href="http://www.codeplex.com/datadictionary">Data Dictionary Creator (DDC)</a> is a simple application which helps you document SQL Server databases. It stores all the information in Extended Properties, so it's easier to keep the documentation in sync with the database as it changes.”</p> <p>When it comes to documenting database schema, I like this tool. Trying to manage the extended properties from Management Studio is more cumbersome. It’s especially nice if you are using a Database Project to manage your database development and schema version, since it will manage the extended properties as well (they are just more schema!). Did I mention its open source too! Let’s run through a quick example.</p> <p>-Open Visual Studio 2005 <br> -Create a new project using <b>SQL Server 2005 Wizard</b> template <br>-Name it <b>SampleDatabase</b> <br><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/image_4.png"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=174 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/image_thumb_1.png" width=244 border=0></a> <br>-Follow the steps in the <b>New Database Project Wizard</b>, using default settings and <b>Import Database Schema</b> for the database you wish to manage. I have created a database on my local server called Sample, so I created a <b>New Connection</b> to that database and clicked <b>Finish</b>. <br><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/clip_image002_2.jpg"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=188 alt="clip_image002" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/clip_image002_thumb.jpg" width=244 border=0></a> <br>-Now run <a href="http://www.codeplex.com/datadictionary">DDC</a> <br>-Fill out your proper connection string and <b>Connect</b> <br><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/clip_image004_2.jpg"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=178 alt="clip_image004" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/clip_image004_thumb.jpg" width=244 border=0></a><br>-Once you have connected and see the green message, go to <b>Document Database</b> <br>-Select the table you are interested in documenting, I have selected the Customer table. <br><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/clip_image006_2.jpg"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=178 alt="clip_image006" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/clip_image006_thumb.jpg" width=244 border=0></a> <br>-Now that we have done some documentation, let see it integrate into our Database Projects. <br>-Go back to your project in Visual Studio 2005 <br>-From the main menu, go to <b>Data</b>-&gt;<b>Schema Compare</b>-&gt;<b>New Schema Comparison</b> <br>-Select your database, and click <b>OK</b> <br><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/clip_image008_2.jpg"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=109 alt="clip_image008" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/clip_image008_thumb.jpg" width=244 border=0></a> <br>-You can see below that the changes are seen and can be reverse integrated back into our Database Project and naturally back into your source control.<br><a href="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/image_6.png"><img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=196 alt=image src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Attachments/5/image_thumb_2.png" width=244 border=0></a></p></div>]]></description></item><item><title>Music Downloads From Amazon.com</title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=10</link><pubDate>Thu, 27 Sep 2007 16:11:10 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=10#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass8FDC49DED36443F4914E5334C0DA7373><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/092707_2310_MusicDownlo1.jpg" alt="">
	</p><p><a href="http://amazon.com/exec/obidos/tg/browse/-/163856011/ref=amb_link_5542752_1/104-3376711-6100747?pf_rd_m=ATVPDKIKX0DER&amp;pf_rd_s=center-1&amp;pf_rd_r=04GN6NQV33ZWCHEVDCNF&amp;pf_rd_t=101&amp;pf_rd_p=312014401&amp;pf_rd_i=507846">Amazon.com</a> has quietly started to offer (in beta) music downloads. You can download single songs or entire albums. Downloading an entire album requires a simple desktop download application.  The songs can be used with any audio player and blessedly do not come with any DRM restrictions (from the Universal catalog). So far there does not appear to be a wide selection of music available for download, but if the concept sticks this will surely grow rapidly. The downside to their audio files is that they are 256k MP3s. I'm still waiting for lossless downloads!
</p><p>The interesting thing is that, depending on what the (<a href="http://www.nytimes.com/2007/09/02/magazine/02rubin.t.html?_r=2&amp;ref=magazine&amp;oref=slogin&amp;oref=slogin">dying</a>) music companies decide to do, this could become a viable alternative to iTunes. Apple still corners the market on music (and video) downloads and any side players are left with crumbs, but it's only a matter of time before iTunes has some real competition. And I think Amazon.com has the scale, the reach and the technology (and probably the ambition) to accomplish that goal. The media conglomerates appear to be getting frustrated with Apple's monopolistic control of the media download business and they are surely shopping around for alternatives. However, Apple plays along with the industries insistence on DRM while so far Amazon.com's MP3 store is totally DRM free. 
</p><p>iTunes will reign king for the near future, but the ground is surely shifting under their feet.</p></div>]]></description></item><item><title>Digital SLR cameras and Sensor Dust: A Quick Summary</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=25</link><pubDate>Thu, 27 Sep 2007 13:50:17 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=25#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass96C096F1889742BA89E5D31AED19181F><p><strong>What's the issue?</strong>  <p>Digital SLR cameras allow many advantages over less sophisticated cameras--they allow different lenses to be used, they are much faster, work much better in low light, and offer much more control over the details of photography. However, as the lenses are removable, dust can get inside the camera and get onto the sensor, causing spots to appear on the images under certain conditions.  <p>First of all, this issue only affects you if you shoot with small aperture (ie, large f number)—smaller than f/9 or f/11 or so. At larger apertures (like f/3 or so), the aperture is large enough that light is entering at a wide enough range of angles that it can go around the dust on the sensor and not leave a clear mark. Only at small apertures does the light become collimated enough that it casts a clear shadow on the sensor.  <p><strong>Do I have an issue?</strong>  <p>If you want to see if you have a dust issue, set for the smallest aperture you can (likely f/22), and take a picture of the blue sky or white paper. Likely take a couple of pictures—if you use white paper, you might not want to focus. Look at the images at 100% on the computer--if you have sensor dust, you will see dots or specks in the image from the sensor dust. Use auto-levels in Photoshop to make the spots more visible if necessary.  <p><strong>How to prevent it?</strong>  <p>Limit lens changes, especially in dusty conditions. (Apparently it's dustier outside than inside usually.) Get a good-quality hand-blower, and blow out the sensor chamber and the lens end each lens change. Keep everything clean.  <p>Note that the cameras themselves create dust internally when the shutter operates and the mirror moves. Unfortunately, my understanding is that the sensor develops a static electrical charge during operation, so any dust in the sensor chamber will quickly be sucked onto the sensor.  <p>In addition, it really isn’t an issue if you shoot with large apertures. I rarely (if ever) shoot with small apertures—usually the smallest I go is around f/6 or so.  <p>I've heard that cameras usually come from the factory with a dusty sensor.  <p><strong>How to clean the sensor?</strong>  <p>There are a bunch of ways to do this:  <ul> <li>Blow off the sensor with a hand blower: there should be instructions for this in the camera manual. You need to activate a special mode where the sensor is exposed, and then blow dust off it with the hand blower. Don’t use compressed air from a can—it’s too strong and can contain chemical residue. This is the only officially approved Canon way to clean the sensor yourself. When I do it, I usually orient the camera facing downwards so that gravity is on my side in helping to get the dust out of the chamber, rather than just moving it around in the chamber. One warning: don’t expose the sensor to strong light (aka sunlight) when it’s in cleaning mode—it will be damaged.  <li>Send it in for cleaning by the manufacturer: this costs $25 to $100, can take many weeks, and sometimes the camera is returned with the same number of dust spots, just with them moved around. My understanding is that Canon uses a Kimwipe (a special lint-free tissue) and alchohol and wipes off the sensor.  <li>Buy sensor cleaning supplies and use them to clean your sensor yourself. This is a bit expensive, and a bit risky—all sorts of bad things can happen to your sensor. See <a href="http://www.visibledust.com/">http://www.visibledust.com/</a> for some examples of products. You can either clean dry or wet—dry is supposed to be a bit safer, but apparently some dirt only comes off with wet.  <li>Use a certain type of Scotch tape to clean the sensor—apparently you stick the tape to the sensor and peel it off. Some people swear by this approach, but I thought it was a joke when I first heard it.  <li>There are also other ways, many of them risky.</li></ul> <p>Note also that many of the newest DSLR cameras have self-cleaning modes which are very helpful but apparently may not completely eliminate the need for sensor cleaning.  <p><strong>What did I do?</strong>  <p>I try to not change lens often, shoot with large aperture, and mainly not worry about it too much. You can always PhotoShop the dirt out of photos, but it’s time consuming.  <p>If you’re interested in more general details, I’d suggest you do an online search for something like &quot;sensor dust&quot; or &quot;sensor cleaning&quot; and see what you find. But I warn you, there’s lot of conflicting and frightening information out there—it can become a bit of a perverse hobby if you aren’t careful!  </div>]]></description></item><item><title>Amusing Outlook 2007 Message</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=24</link><pubDate>Thu, 27 Sep 2007 12:06:31 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=24#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClassE3240651C22A4CC19639E3A97A6A01C5><p>I got this message the other day when trying to dismiss an Outlook calendar reminder:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/24/AmusingOutlookMessage_2.png"><img height=109 alt="Outlook dialog: &quot;Cannot turn off the reminder. You may be reminded again. Could not open the item. Try again.&quot;" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/24/AmusingOutlookMessage_thumb.png" width=540 border=0></a> </p> <p>I'm not sure quite what I find funny about this, but here are some reasons:</p> <ul> <li>The four sentences are very short and staccato.</li> <li>It has an almost desperate quality--especially the &quot;You may be reminded again&quot; part. (Oh goodness--not only did it not work, but I <em>might actually be <strong>reminded again</strong>!</em>)</li> <li>It adds &quot;Could not open the item.&quot; which must be something it needs to do internally before it can turn off the reminder, but conveys no useful information to me as a user.</li> <li>I like that after all this, it hopefully adds &quot;Try again.&quot;</li></ul> <p>Just to be clear, I've written (and continue to write) my fair share of wacky dialog messages. I usually end up writing something like this when I'm almost positive that it will never actually happen, and therefore don't need to spend a lot of time polishing the content. Writing this type of failure message can be a bit difficult and time consuming to do well. However, when one of these pops up, it's pretty amusing!</p></div>]]></description></item><item><title>Recurring meeting maintenance issue in Outlook 2007 and workaround</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=23</link><pubDate>Thu, 27 Sep 2007 11:35:52 GMT</pubDate><slash:comments>15</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=23#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass6B83275333864926B93717FC9383D9ED><p>As part of my job, I schedule and maintain a lot of recurring meetings. For example, my team meets every morning to have a 10-minute daily standup to ensure that the team knows what's going on and what it needs to do.</p> <p>In Outlook 2007, I find I can usually edit a single occurrence of a recurring meeting fine, but sometimes when I then try to edit a second occurrence of the same meeting, the following message appears:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/23/OutlookMessage_2.png"><img height=109 alt="Outlook dialog: &quot;Changes to the meeting cannot be saved. The meeting has been updated by another person. Close and reopen the meeting, and then make your updates.&quot; (Only button option is OK.)" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/23/OutlookMessage_thumb.png" width=788 border=0></a> </p> <p>Unfortunately, following the instructions to close and reopen the meeting never works for me. In addition, it's <strong>me </strong>who has updated the meeting--not another person.</p> <p>What <strong>does </strong>work when I get this message is to close and reopen <strong>Outlook</strong>--this solves the problem every single time I've experienced it. I think the issue itself may be related to having a room resource scheduled for the recurring meeting, but the issue still doesn't seem entirely repeatable.</p></div>]]></description></item><item><title>Comparing the performance of various ways of getting an integer back from SQL Server</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=22</link><pubDate>Thu, 27 Sep 2007 10:26:34 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=22#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClassA8BEE0B7A8D14105B9559BEAB4F65285><p>Recently, I was talking with a developer who had structured their code in an unusual way; he had used SQL Server output parameters in a stored procedure to return row counts. The T-SQL code was a bit like this:</p> <p>create proc CountTallies @ItemId int, @TallyCount int output as  <p>select @TallyCount = count(*)<br>from Items<br>where ItemId = @ItemId;  <p>go  <p>This seemed a bit unusual (as well as a bit awkward in the C# code to create the output parameter and then read from it), so I asked him why they did this. He replied that, in his experience, output parameters were much faster than returning a result by simply selecting it; it was a performance optimization.</p> <p>I had never heard that output parameters were faster than traditional resultsets, so I decided to do a bit of testing to see if I was missing something.</p> <p>I wrote the following two stored procedures for the test; both add 5 to an integer (to keep the performance of the procedures reasonably repeatable and fast). The first returns the value by selecting it, and the second returns the result in an output parameter:</p> <p>create procedure dbo.NoOutputParam @InputValue int as  <p>select @InputValue + 5;  <p>go  <p>create procedure dbo.OutputParam @InputValue int, @OutputValue int output as  <p>set @OutputValue = @InputValue + 5;  <p>go  <p>Here's the C# code to call the two routines 10,000 times each in a couple of different ways:  <div style="font-size:10pt;background:white;color:black;font-family:consolas"><pre style="margin:0px"><span style="color:blue">using</span> System;</pre><pre style="margin:0px"><span style="color:blue">using</span> System.Data;</pre><pre style="margin:0px"><span style="color:blue">using</span> System.Data.SqlClient;</pre><pre style="margin:0px"> </pre><pre style="margin:0px"><span style="color:blue">namespace</span> TestOutputParamPerf</pre><pre style="margin:0px">{</pre><pre style="margin:0px">    <span style="color:blue">class</span> <span style="color:#2b91af">Program</span></pre><pre style="margin:0px">    {</pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">const</span> <span style="color:blue">string</span> CONN_STRING = <span style="color:#a31515">&quot;Server=(local);Database=OutputParamTest;Trusted_Connection=Yes;&quot;</span>;</pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">const</span> <span style="color:blue">int</span> LOOPS = 10000;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Entry point--runs tests, displays results, and waits...</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;param name=&quot;args&quot;&gt;&lt;/param&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">static</span> <span style="color:blue">void</span> Main(<span style="color:blue">string</span>[] args)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            RunTimeTrials();</pre><pre style="margin:0px">            RunTimeTrials();</pre><pre style="margin:0px">            RunTimeTrials();</pre><pre style="margin:0px">            RunTimeTrials();</pre><pre style="margin:0px">            RunTimeTrials();</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:#2b91af">Console</span>.Write(<span style="color:#a31515">&quot;\r\n\r\nDone. Press any key to exit...&quot;</span>);</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:#2b91af">Console</span>.ReadKey();</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Runs each test once and displays results</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">static</span> <span style="color:blue">void</span> RunTimeTrials()</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:#2b91af">DateTime</span> start;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            start = <span style="color:#2b91af">DateTime</span>.Now;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:blue">for</span> (<span style="color:blue">int</span> i = 0; i &lt; LOOPS; i++)</pre><pre style="margin:0px">                CallDataSetMethod(i);</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:#2b91af">Console</span>.WriteLine(<span style="color:#a31515">&quot;DataSet time:\t\t&quot;</span> + (<span style="color:#2b91af">DateTime</span>.Now - start).ToString());</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            start = <span style="color:#2b91af">DateTime</span>.Now;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:blue">for</span> (<span style="color:blue">int</span> i = 0; i &lt; LOOPS; i++)</pre><pre style="margin:0px">                CallOutputParamMethod(i);</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:#2b91af">Console</span>.WriteLine(<span style="color:#a31515">&quot;Output parameter time:\t&quot;</span> + (<span style="color:#2b91af">DateTime</span>.Now - start).ToString());</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            start = <span style="color:#2b91af">DateTime</span>.Now;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:blue">for</span> (<span style="color:blue">int</span> i = 0; i &lt; LOOPS; i++)</pre><pre style="margin:0px">                CallSqlDataReaderMethod(i);</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:#2b91af">Console</span>.WriteLine(<span style="color:#a31515">&quot;SqlDataReader time:\t&quot;</span> + (<span style="color:#2b91af">DateTime</span>.Now - start).ToString());</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            start = <span style="color:#2b91af">DateTime</span>.Now;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:blue">for</span> (<span style="color:blue">int</span> i = 0; i &lt; LOOPS; i++)</pre><pre style="margin:0px">                CallExecuteScalarMethod(i);</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:#2b91af">Console</span>.WriteLine(<span style="color:#a31515">&quot;ExecuteScalar time:\t&quot;</span> + (<span style="color:#2b91af">DateTime</span>.Now - start).ToString());</pre><pre style="margin:0px"> </pre><pre style="margin:0px">            <span style="color:#2b91af">Console</span>.WriteLine(<span style="color:#a31515">&quot;\r\n&quot;</span>);</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Calls a stored procedure and gets output using an output parameter</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;param name=&quot;inputValue&quot;&gt;</span><span style="color:green">Integer input value</span><span style="color:gray">&lt;/param&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;returns&gt;</span><span style="color:green">The input value plus five, returned by output parameter</span><span style="color:gray">&lt;/returns&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">static</span> <span style="color:blue">int</span> CallOutputParamMethod(<span style="color:blue">int</span> inputValue)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">using</span> (<span style="color:#2b91af">SqlConnection</span> conn = <span style="color:blue">new</span> <span style="color:#2b91af">SqlConnection</span>(CONN_STRING))</pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                <span style="color:#2b91af">SqlCommand</span> cmd = <span style="color:blue">new</span> <span style="color:#2b91af">SqlCommand</span>();</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                cmd.Connection = conn;</pre><pre style="margin:0px">                cmd.CommandType = <span style="color:#2b91af">CommandType</span>.StoredProcedure;</pre><pre style="margin:0px">                cmd.CommandText = <span style="color:#a31515">&quot;dbo.OutputParam&quot;</span>;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                cmd.Parameters.Add(<span style="color:blue">new</span> <span style="color:#2b91af">SqlParameter</span>(<span style="color:#a31515">&quot;@InputValue&quot;</span>, inputValue));</pre><pre style="margin:0px">                <span style="color:#2b91af">SqlParameter</span> outputParam = <span style="color:blue">new</span> <span style="color:#2b91af">SqlParameter</span>(<span style="color:#a31515">&quot;@outputValue&quot;</span>, <span style="color:#2b91af">SqlDbType</span>.Int);</pre><pre style="margin:0px">                outputParam.Direction = <span style="color:#2b91af">ParameterDirection</span>.Output;</pre><pre style="margin:0px">                cmd.Parameters.Add(outputParam);</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                conn.Open();</pre><pre style="margin:0px">                cmd.ExecuteNonQuery();</pre><pre style="margin:0px">                conn.Close();</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                <span style="color:blue">return</span> (<span style="color:blue">int</span>)cmd.Parameters[1].Value;</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Calls a stored procedure and gets the output using ExecuteScalar</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;param name=&quot;inputValue&quot;&gt;</span><span style="color:green">Input integer</span><span style="color:gray">&lt;/param&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;returns&gt;</span><span style="color:green">Input value plus five, returned by ExecuteScalar</span><span style="color:gray">&lt;/returns&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">static</span> <span style="color:blue">int</span> CallExecuteScalarMethod(<span style="color:blue">int</span> inputValue)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">using</span> (<span style="color:#2b91af">SqlConnection</span> conn = <span style="color:blue">new</span> <span style="color:#2b91af">SqlConnection</span>(CONN_STRING))</pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                <span style="color:#2b91af">SqlCommand</span> cmd = <span style="color:blue">new</span> <span style="color:#2b91af">SqlCommand</span>();</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                cmd.Connection = conn;</pre><pre style="margin:0px">                cmd.CommandType = <span style="color:#2b91af">CommandType</span>.StoredProcedure;</pre><pre style="margin:0px">                cmd.CommandText = <span style="color:#a31515">&quot;dbo.NoOutputParam&quot;</span>;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                cmd.Parameters.Add(<span style="color:blue">new</span> <span style="color:#2b91af">SqlParameter</span>(<span style="color:#a31515">&quot;@InputValue&quot;</span>, inputValue));</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                conn.Open();</pre><pre style="margin:0px">                <span style="color:blue">int</span> outputValue = (<span style="color:blue">int</span>)cmd.ExecuteScalar();</pre><pre style="margin:0px">                conn.Close();</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                <span style="color:blue">return</span> outputValue;</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Calls a stored procedure and gets the output using a SqlDataReader</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;param name=&quot;inputValue&quot;&gt;</span><span style="color:green">Input integer value</span><span style="color:gray">&lt;/param&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;returns&gt;</span><span style="color:green">Input value plus five, returned by SqlDataReader</span><span style="color:gray">&lt;/returns&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">static</span> <span style="color:blue">int</span> CallSqlDataReaderMethod(<span style="color:blue">int</span> inputValue)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">using</span> (<span style="color:#2b91af">SqlConnection</span> conn = <span style="color:blue">new</span> <span style="color:#2b91af">SqlConnection</span>(CONN_STRING))</pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                <span style="color:#2b91af">SqlCommand</span> cmd = <span style="color:blue">new</span> <span style="color:#2b91af">SqlCommand</span>();</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                cmd.Connection = conn;</pre><pre style="margin:0px">                cmd.CommandType = <span style="color:#2b91af">CommandType</span>.StoredProcedure;</pre><pre style="margin:0px">                cmd.CommandText = <span style="color:#a31515">&quot;dbo.NoOutputParam&quot;</span>;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                cmd.Parameters.Add(<span style="color:blue">new</span> <span style="color:#2b91af">SqlParameter</span>(<span style="color:#a31515">&quot;@InputValue&quot;</span>, inputValue));</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                conn.Open();</pre><pre style="margin:0px">                <span style="color:#2b91af">SqlDataReader</span> reader = cmd.ExecuteReader();</pre><pre style="margin:0px">                reader.Read();</pre><pre style="margin:0px">                <span style="color:blue">int</span> outputValue = reader.GetInt32(0);</pre><pre style="margin:0px">                reader.Close();</pre><pre style="margin:0px">                conn.Close();</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                <span style="color:blue">return</span> outputValue;</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Calls a stored procedure and gets the output using a DataSet</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;param name=&quot;inputValue&quot;&gt;</span><span style="color:green">Input integer value</span><span style="color:gray">&lt;/param&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;returns&gt;</span><span style="color:green">Input value plus five, returned via a DataSet</span><span style="color:gray">&lt;/returns&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">static</span> <span style="color:blue">int</span> CallDataSetMethod(<span style="color:blue">int</span> inputValue)</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">using</span> (<span style="color:#2b91af">SqlConnection</span> conn = <span style="color:blue">new</span> <span style="color:#2b91af">SqlConnection</span>(CONN_STRING))</pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                <span style="color:#2b91af">SqlCommand</span> cmd = <span style="color:blue">new</span> <span style="color:#2b91af">SqlCommand</span>();</pre><pre style="margin:0px">                cmd.Connection = conn;</pre><pre style="margin:0px">                cmd.CommandType = <span style="color:#2b91af">CommandType</span>.StoredProcedure;</pre><pre style="margin:0px">                cmd.CommandText = <span style="color:#a31515">&quot;dbo.NoOutputParam&quot;</span>;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                cmd.Parameters.Add(<span style="color:blue">new</span> <span style="color:#2b91af">SqlParameter</span>(<span style="color:#a31515">&quot;@InputValue&quot;</span>, inputValue));</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                <span style="color:#2b91af">SqlDataAdapter</span> adapter = <span style="color:blue">new</span> <span style="color:#2b91af">SqlDataAdapter</span>();</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                conn.Open();</pre><pre style="margin:0px">                adapter.SelectCommand = cmd;</pre><pre style="margin:0px">                <span style="color:#2b91af">DataSet</span> dataSet = <span style="color:blue">new</span> <span style="color:#2b91af">DataSet</span>(<span style="color:#a31515">&quot;Result&quot;</span>);</pre><pre style="margin:0px">                adapter.Fill(dataSet);</pre><pre style="margin:0px">                conn.Close();</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                <span style="color:blue">return</span> (<span style="color:blue">int</span>)dataSet.Tables[0].Rows[0][0];</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">        }</pre><pre style="margin:0px">    }</pre><pre style="margin:0px">}</pre><pre style="margin:0px"> </pre></div>
<p>The code above runs the following four cases:</p>
<ul>
<li>Using a DataSet to get the resultset from dbo.NoOutputParam. 
<li>Using the output parameter to get the result from dbo.OutputParam. 
<li>Using ExecuteReader to get a SqlDataReader to read the result from dbo.NoOutputParam. 
<li>Using ExecuteScalar to get the result from dbo.NoOutputParam.</li></ul>
<p>Here are the results for a few sample runs:</p>
<p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/22/Outputparameterperformanceconsoleapp_4.png"><img height=340 alt="Console application showing multiple test results. DataSet executed in roughly 3.4 seconds. Output parameter, SqlDataReader, and ExecuteScalar all show execution times of roughly 3.1 seconds." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/22/Outputparameterperformanceconsoleapp_thumb_1.png" width=677 border=0></a> </p>
<p>In short, the DataSet (not surprisingly) is the slowest (but not by too much), and the others are roughly the same. Generally it seems like the output parameter is a bit slower than the ExecuteScalar, but it's only about 1%. Not too surprisingly, the SqlDataReader and ExecuteScalar are about the same speed--likely ExecuteScalar is simply using a SqlDataReader internally, in which case they are running very similar code.</p>
<p>Given this, I'd recommend against using SQL output parameters for returning general scalars unless it makes the code easier to read or structure in some way. There are several reasons for this:</p>
<ul>
<li>There's no performance reason to do it--if anything, the ExecuteScalar method is about 1% faster 
<li>The C# code to call the stored procedure and retrieve the parameter value is a bit more involved than the ExecuteScalar code 
<li>It's more difficult to test the stored procedure itself in SQL Server Management Studio--in addition to calling the procedure, you also need to declare the variable, and then select the variable contents</li></ul></div>]]></description></item><item><title>“Show Checkboxes” feature in NUnit</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=8</link><pubDate>Wed, 26 Sep 2007 12:26:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=8#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClass0CD6221BAC0A4C81A515C71B47B3622F>
<p>Lately, I've been using a nice feature in NUnit that not everyone knows about – &quot;Show Checkboxes.&quot; Why? <strong><em>Because checkboxes are good.</em></strong> When given the option, we should always… show them. </p>
<p>&quot;How can I show these checkboxes?&quot; you ask. &quot;I like checkboxes as much as the next guy. I want to show them!&quot; </p>
<p>The answer is simple. Navigate, using the <strong>View</strong> menu, to <strong>Tree--&gt;Show Checkboxes</strong>. Like this: </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/092607_1925_ShowCheckbo1.gif"> </p>
<p>Now I know you're wondering…&quot;What do these checkboxes actually do?&quot; Allow me to explain. </p>
<p>These <em>checkboxes</em> that you are given the opportunity to <em>show</em> provide the ability to <strong>select multiple unit tests at a time</strong>, regardless of whether or not they are within the same node. (A node represents a test assembly, a class within an assembly, or a single test within a class.) </p>
<p>The default user interface allows you to select only one node at a time. All tests within that node are run. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/092607_1925_ShowCheckbo2.gif"> </p>
<p>The &quot;Show Checkboxes&quot; mode allows you to, not only show the checkboxes, but to use them to <strong>select multiple individual tests or nodes</strong>. This is very useful when you have a large number of tests and only need to run a select few. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/092607_1925_ShowCheckbo3.gif"> </p>
<p>For the sake of full disclosure, this feature is a bit buggy. If you show the checkboxes, use them to select some tests, then go back to the default mode, <strong>the checkboxes will still be checked</strong>, they just won't be shown<strong>. </strong>In other words, the tests will still be selected and only those tests will get run. Maybe that's why it's called &quot;Show Checkboxes&quot; – the multi-select feature is still in use, you just can no longer see it unless you show them. </p>
<p>Even worse, if you then go back to &quot;Show Checkboxes&quot; mode, the previously-selected tests will not appear to be checked, but NUnit only runs those tests as if they were still selected. Once you're in this state, you might just want to close and reopen NUnit, because it gets very confused about what's checked and what's not. </p>
<p>For the love of humanity, please, just <em>show the checkboxes</em> and leave them shown! Despite the bugs, I find this feature very useful. </p>
<p> </p>
<p><span style="font-size:9pt">(The version of nUnit referenced in this blog post is 2.4.3) </span></p></div>]]></description></item><item><title>Call for help: Video on x64 Media Center</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=30</link><pubDate>Fri, 21 Sep 2007 13:44:43 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=30#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass053F0AA0B2634B2F85167F790F207EF5><p>I recently built a <a href="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=28">new PC</a>.  This week, I ordered and installed a <a href="http://www.hauppauge.com/pages/products/data_hvr1600.html">Hauppauge WinTV-HVR-1600</a> so I could watch and record TV.  After getting everything installed and configured, I ran across my first 64-bit problem.</p> <p>According to all the information I can find online, Media Center runs in 64-bit mode on 64-bit Vista (which makes sense), but the 64-bit version of Media Center won't recognize or use 32-bit encoders/decoders.  That means that the default and horribly slow Microsoft software decoder is used instead.  I can't find ANY 64-bit MPEG-2 decoders that will correct my problem.  The end result is trying to watch choppy TV that often defaults to a green screen rather than the broadcast video.</p> <p>If anyone has any information as to what software I can buy/download to correct this, I'd really appreciate it.  It also seems that <a href="http://www.google.com/search?q=&quot;media+center&quot;+&quot;green+screen&quot;&amp;rls=com.microsoft:*&amp;ie=UTF-8&amp;oe=UTF-8&amp;startIndex=&amp;startPage=1">I'm not the only person with this issue</a>, but no one has an answer.<strong>  Does anyone out there know how to watch TV using the 64-bit version of Media Center?</strong></p></div>]]></description></item><item><title>aspnet_regsql.exe and "Cannot create trigger" Errors</title><link>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=5</link><pubDate>Thu, 20 Sep 2007 21:19:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=5#Comments</comments><dc:creator>davidb</dc:creator><description><![CDATA[<div class=ExternalClass98E36359B8774101A5EF73607F461A8D>
<div><font face=Calibri size=3>
<p class=MsoNormal style="margin:0in 0in 10pt;text-indent:0.5in">There doesn’t seem to be a whole lot about it online, but out of the box, ASP.NET’s <a href="http://msdn2.microsoft.com/en-us/library/ms229862(VS.80).aspx">included tool</a> for enabling <a href="http://msdn2.microsoft.com/en-us/library/system.web.caching.sqlcachedependency(VS.80).aspx">Polling-Based SQL Cache Dependencies</a> doesn’t work with SQL 2005’s schema names.<span>  </span>However, a few manually steps can get them to interoperate.<span class=Code><span style="font-size:9pt;line-height:115%"></span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;text-indent:0.5in">The problem is that a stored procedure that <span class=Code><span style="line-height:115%;font-family:'Calibri','sans-serif'">aspnet_regsql.exe</span></span> calls, <span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">AspNet_SqlCacheRegisterTableStoredProcedure</font></span></span> always precedes its trigger names with a <span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">dbo.</font></span></span>, and SQL 2005 believes that to be a schema name.<span>  </span>To enable SQL Cache Dependencies on a table, you can either add an <span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">INSERT</font></span></span>, <span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">UPDATE</font></span></span>, <span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">DELETE</font></span></span> trigger that calls <span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">AspNet_SqlCacheUpdateChangeIdStoredProcedure </font></span></span><span> </span><span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">N’</font></span></span><i>TableName</i><span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">’ </font></span></span>yourself:</p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">CREATE TRIGGER [dbo.</font></span></span><i>SchemaName</i><span class=Code><span style="font-size:9pt"><font face="Courier New">.</font></span></span><i>TableName</i><span class=Code><span style="font-size:9pt"><font face="Courier New">_AspNet_SqlCacheNotification_Trigger] ON [</font></span></span><i>SchemaName</i><span class=Code><span style="font-size:9pt"><font face="Courier New">].[</font></span></span><i>TableName</i><span class=Code><span style="font-size:9pt"><font face="Courier New">]</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">FOR INSERT, UPDATE, DELETE AS </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">BEGIN</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">SET NOCOUNT ON</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">EXEC dbo.AspNet_SqlCacheUpdateChangeIdStoredProcedure N'</font></span></span><i>SchemaName</i><span class=Code><span style="font-size:9pt"><font face="Courier New">.</font></span></span><i>TableName</i><span class=Code><span style="font-size:9pt"><font face="Courier New">'</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">END</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt">…or hack <span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">AspNet_SqlCacheRegisterTableStoredProcedure</font></span></span>, changing:</p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-family:'Calibri','sans-serif'">SET @fullTriggerName = 'dbo.[' + @triggerName + ']'</span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span class=Code><span style="line-height:115%;font-family:'Calibri','sans-serif'">…to:</span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-family:'Calibri','sans-serif'">SET @fullTriggerName = '[dbo.' + @triggerName + ']'</span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span class=Code><span style="line-height:115%;font-family:'Calibri','sans-serif'">…and then running aspnet_regsql.exe the normal way:</span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">aspnet_regsql -U </font></span></span><i>User</i><span class=Code><span style="font-size:9pt"><font face="Courier New"> -S </font></span></span><i>Server</i><span class=Code><span style="font-size:9pt"><font face="Courier New"> -d </font></span></span><i>Database</i><span class=Code><span style="font-size:9pt"><font face="Courier New"> -et -t </font></span></span><i>SchemaName</i><span class=Code><span style="font-size:9pt"><font face="Courier New">.</font></span></span><i>TableName</i><span class=Code><span style="font-size:9pt"></span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span class=Code><span style="line-height:115%;font-family:'Calibri','sans-serif'">In either case, be sure to confirm that ASP.NET recognizes your table as enabled for SQL cache dependencies:</span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">aspnet_regsql -U </font></span></span><i>User</i><span class=Code><span style="font-size:9pt"><font face="Courier New"> -S </font></span></span><i>Server</i><span class=Code><span style="font-size:9pt"><font face="Courier New"> -d </font></span></span><i>Database</i><span class=Code><span style="font-size:9pt"><font face="Courier New"> –lt</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span class=Code><span style="line-height:115%;font-family:'Calibri','sans-serif'">Note that even if you modify </span></span><span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">AspNet_SqlCacheUnRegisterTableStoredProcedure</font></span></span><span class=Code><span style="line-height:115%;font-family:'Calibri','sans-serif'"> in a similar way, running:</span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">aspnet_regsql -U </font></span></span><i>User</i><span class=Code><span style="font-size:9pt"><font face="Courier New"> -S </font></span></span><i>Server</i><span class=Code><span style="font-size:9pt"><font face="Courier New"> -d </font></span></span><i>Database</i><span class=Code><span style="font-size:9pt"><font face="Courier New"> -dt -t </font></span></span><i>SchemaName</i><span class=Code><span style="font-size:9pt"><font face="Courier New">.</font></span></span><i>TableName</i></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span class=Code><span style="line-height:115%;font-family:'Calibri','sans-serif'">…won’t delete the table’s trigger—however, it will get rid of the associated </span></span><span class=Code><span style="font-size:9pt;line-height:115%"><font face="Courier New">AspNet_SqlCacheTablesForChangeNotification</font></span></span><span class=Code><span style="line-height:115%;font-family:'Calibri','sans-serif'"> row.<span>  </span>Keeping in mind that the trigger inherits its table’s schema name, dropping it manually only requires:</span></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New">DROP TRIGGER [</font></span></span><span class=Code><i><span style="font-family:'Calibri','sans-serif'">SchemaName</span></i></span><span class=Code><span style="font-size:9pt"><font face="Courier New">]. [dbo.</font></span></span><i>SchemaName</i><span class=Code><span style="font-size:9pt"><font face="Courier New">.</font></span></span><i>TableName</i><font face="Courier New"><span class=Code><span style="font-size:9pt">_AspNet_SqlCacheNotification_Trigger]</span></span><span class=Code><span style="font-family:'Calibri','sans-serif'"></span></span></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt;line-height:normal"><span class=Code><span style="font-size:9pt"><font face="Courier New"></font></span></span> </p>
<p class=MsoNormal style="margin:0in 0in 10pt;text-indent:0.5in"></font></p></div></div>]]></description></item><item><title>iPhoney iPhone Simulator </title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=9</link><pubDate>Thu, 13 Sep 2007 14:29:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=9#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass7E93DCD4151E48A4BE8E52E168161644>
<p> </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/091307_2128_1.png"> </p>
<p>An iPhone simulator has been released and it's called <a href="http://www.marketcircle.com/iphoney/">iPhoney</a>. Designers can use it to view their web sites as they would appear in the iPhone Safari browser, including the rotation feature. </p>
<p>Even if you are not concerned about optimizing your web sites for the iPhone it is still an interesting exercise to see how they would look. Over the next few years more and more people will be viewing web content through small portable devices. Becoming aware of how a site degrades through smaller screen resolutions will be important. Browsing the web through a traditional cell phone was, is and always will be a painful experience. But the iPhone has set a new standard and new expectations. It remains to be seen whether the concept of the iPhone will become as prevalent as the iPod, but the genie is out of the bottle and web browsing through portable devices is finally here in a viable form. It will gain traction quickly. </p>
<p>I am curious to watch how iPhone-like devices impact how people browse the Internet. Small screens and temporary circumstances, like waiting at a bus stop, will lead to impatience. Just get me what I want and fast! The same will apply to the ever increasing in-car navigation systems that while not used to browse the Internet are still used in a similar fashion – to find the right information fast in a dynamic environment. </p>
<p>Interesting times! </p></div>]]></description></item><item><title>Programming Bias</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=29</link><pubDate>Thu, 13 Sep 2007 12:23:14 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=29#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClassD7D7A213A6904F3B98398A012D9239A6><p>In a great article on lifehack.org called &quot;<a href="http://www.lifehack.org/articles/lifehack/7-stupid-thinking-errors-you-probably-make.html">7 Stupid Thinking Errors You Probably Make</a>&quot;, the section involving Confirmation Bias pointed out an interesting logic problem:</p> <blockquote> <p>Consider a study conducted by Peter Cathcart Wason. In the study, Wason showed participants a triplet of numbers (2, 4, 6) and asked them to guess the rule for which the pattern followed. From that, participants could offer test triplets to see if their rule held. <p>From this starting point, most participants picked specific rules such as “goes up by 2“ or “1x, 2x, 3x.” By only guessing triplets that fit their rule, they didn’t realize the actual rule was “any three ascending numbers.” A simple test triplet of “3, 15, 317“ would have invalidated their theories.</p></blockquote> <p>While the article doesn't make any mention of it, my guess is that most people who answered this question wrong did so because they've seen similar problems before, and attempted to solve this one based on past experience.  It's possible that in some situations, like this one, that <em>our experience can actually impair our ability to solved the problem correctly</em>. <p>Have you ever started down the path of solving a problem using the &quot;normal&quot; solution, only to find it doesn't work and you should have seen it coming?  I know I have.  It's one of the reasons I like to work with people smarter than me, and why I try to involve people when troubleshooting.  Often times, a fresh perspective is what is required because it's easy to get mired down in assumptions and familiarity.  Some times, it's just because you're on autopilot, solving a problem without really thinking about it because you have 5 other problems to solver after the current one. <p>One of the great things about working at Vertigo is that there are quite a few smart and friendly people here who love solving hard problems and helping each other out.  Another great thing is that in my time here, there hasn't been a single incident in which ego has gotten in the way.  If your job isn't providing that type of work environment, maybe it's time to <a href="http://www.vertigo.com/Jobs.aspx">make a switch</a>?</p></div>]]></description></item><item><title>Crystal Reports and .Net (My First Day)</title><link>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Tue, 11 Sep 2007 14:39:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>mmoser</dc:creator><description><![CDATA[<div class=ExternalClassF88E298BF62B479D91CEFCFAABDD2376>
<p><span style="font-size:10pt;font-family:Verdana">I have never worked with Crystal Reports and plan to explore the product from a .Net development perspective. Below is a quote from Crystal Reports .Net Developer Documentation: </span></p>
<blockquote><span style="font-size:10pt;font-family:Verdana"><em>&quot;You can host your report in either a Web or Windows application with one of the Crystal Reports viewer controls, or use the extensive API to interact with the report programmatically at runtime.&quot; </em></span></blockquote>
<p><span style="font-size:10pt;font-family:Verdana">I plan to focus not on the creation of reports, but the consumption of existing reports defined within Crystal and attempt to expose and interact with them from a .Net Platform. </span></p>
<div style="margin-left:36pt"><span style="font-size:10pt;font-family:Verdana">Create a simple report in Crystal Reports. </span><br><span style="font-size:10pt;font-family:Verdana">Expose the report with an interactive control from ASP.Net. </span><br><span style="font-size:10pt;font-family:Verdana">Stream a PDF version of the report from an ASP.Net using the Crystal API </span></div><br><span style="font-size:10pt;font-family:Verdana">Before we get started, my environment is: </span><br><br>
<div style="margin-left:36pt"><span style="font-size:10pt;font-family:Verdana"></span><span style="font-size:8pt;font-family:Verdana">Windows Vista (IIS 7) </span><br><span style="font-size:8pt;font-family:Verdana">Visual Studio 2005 Team Suite </span><br><span style="font-size:8pt;font-family:Verdana">SQL Server 2005 </span><br><span style="font-size:8pt;font-family:Verdana">Crystal Reports XI R2 </span></div>
<div style="margin-left:36pt"><span style="font-size:8pt;font-family:Verdana"></span><br> </div>
<p><span style="font-size:10pt;font-family:Verdana"><strong>Create a simple report in Crystal Reports </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">We first need a report to work with. So let's create a very simple report. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Open Crystal Reports </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Go to <strong>File</strong>-&gt;<strong>New</strong>-&gt;<strong>Standard Report</strong> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">In the Standard Report Creation Wizard window, select <strong>Create New Connection</strong>-&gt;<strong>OLE DB (ADO)</strong> </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo1.png"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">In the OLE DB (ADO) window, select <strong>SQL Native Client </strong>provider. </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo2.png"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Click <strong>Next </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Server for this example is &quot;<strong>.</strong>&quot; Which represents the my local Sql Server 2005 instance, you should fill out your specific server information and credentials. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Select the <strong>Adventure Works</strong> database. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Select <strong>Integrated Security</strong> if it applies. </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo3.png"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Click <strong>Next</strong> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Select <strong>Current Connections</strong>-&gt;<strong>Adventure Works</strong>-&gt;<strong>Human Resources</strong>-&gt;<strong>Tables</strong>-&gt;<strong>Employee </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Click the <strong>Right</strong> <strong>Arrow Button </strong>to add to Selected Tables </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo4.png"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Click <strong>Next </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Add some fields for the report </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo5.png"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Click <strong>Next </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Don't add anything for <strong>Grouping</strong>, just click <strong>Next </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Don't add anything for <strong>Record Selection</strong>, just click <strong>Next </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Let's add a little color, select <strong>Block (Blue) </strong></span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo6.png"><span style="font-size:10pt;font-family:Verdana"><strong> </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Click <strong>Finish </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">You should now see the below screen </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo7.png"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Go to <strong>File</strong>-&gt;<strong>Save</strong> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">I saved the report to <strong>c:\reports\SampleReport.rpt</strong>, select your location and remember for later use. </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo8.png"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Click <strong>Save </strong></span></p>
<p> </p>
<p><span style="font-size:10pt;font-family:Verdana"><strong>Make this report available on an ASP.Net site </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Now that we have a sample report, we need to get it to the users of our ASP.Net web application. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Open <strong>Visual Studio 2005 </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Create a new <strong>ASP.Net Web Application </strong></span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo9.png"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana"><em>*I have decided to do this in C#, but of course either language will work. </em></span></p>
<p><span style="font-size:10pt;font-family:Verdana">In your Toolbox, you of you have Crystal Reports Developer Edition installed, you should see tools for Crystal Reports </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo10.jpg"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Select the <strong>Design</strong> view for <strong>Default.asp </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Drag and Drop the <strong>CrystalReportViewer </strong>to the design surface </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo11.png"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Uncheck <strong>Enable Toolbar </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Uncheck <strong>Enable Group Tree </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">In the <strong>Choose Report Source</strong> drop down, select <strong>new report source</strong> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Leave the name as <strong>CrystalReportSource1</strong> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">For the <strong>CrystalReportSource </strong>select <strong>Browse </strong></span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo12.png"><span style="font-size:10pt;font-family:Verdana"><strong> </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Navigate to the report we created earlier (c:\reports\SampleReport.rpt) and click <strong>Open </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">You should now see your report in the design surface. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Run the web site by clicking the green <strong>Start Debugging</strong> button. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">And there is your report! </span></p>
<p> <span style="font-size:10pt;font-family:Verdana"><em>Note: This blog entry is not diving deep into the CrystalReportViewer control, this is just an example to get you started. </em></span></p>
<p> </p>
<p><span style="font-size:10pt;font-family:Verdana"><strong>Stream a PDF version of the report from an ASP.Net site using the Crystal API </strong></span></p>
<p><span style="font-size:10pt;font-family:Verdana">Now that we have successfully used the built-in control, let's try using the .Net API provided by Crystal Reports. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">First let's add a new Web Form called <strong>PDFReport.aspx</strong>. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">*Add a Reference to <strong>CrystalDecisions.CrystalReports.Engine</strong> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">*Add a Reference to <strong>CrystalDecisions.CrystalReports.Shared</strong> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Add the code below to our code behind for <strong>PDFReport.aspx.cs </strong></span></p>
<p> </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/mmoser/Blog/Lists/Photos/091107_2136_CrystalRepo13.jpg"><span style="font-size:10pt;font-family:Verdana"> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">The <strong>ReportDocument</strong> is the key to working with the report. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Right Click on PDFReport.aspx and <strong>Set as Start Page</strong> </span></p>
<p><span style="font-size:10pt;font-family:Verdana">Run the web site by clicking the green <strong>Start Debugging</strong> button. </span></p>
<p><span style="font-size:10pt;font-family:Verdana">You should see your report embedded in the browser window! </span></p>
<p><span style="font-size:10pt;font-family:Verdana">If you want, you can set the third parameter on ExportToHttpResponse to make the report open as an attachment, which gives the user the ability to <strong>Open </strong>or <strong>Save </strong>the report. </span></p>
<p> </p>
<p><span style="font-size:8pt;font-family:Verdana"><em>*note that you may have two options. I am using .Net 2.0 so I will choose the one with <strong>&quot;dotnet2&quot;</strong> in the path. </em></span></p>
<p> </p>
<p><span style="font-size:10pt;font-family:Verdana"><strong>Conclusion </strong></span></p>
<p> </p>
<p><span style="font-size:10pt;font-family:Verdana">After only a few hours of working with Crystal Reports, it is clear that it is a robust and enterprise solution for report development and delivery with good integration into a .Net development environment. This post is a simple Hello World and the world is huge! </span></p>
<p> </p>
<p><span style="font-size:10pt;font-family:Verdana"><strong>Additional Comments </strong></span></p>
<p> </p>
<p><span style="font-size:10pt;font-family:Verdana">As doing this novice research, I noticed a lot of people complaining about a &quot;Logon Failed Error&quot; and I ran across a blog that describes how to fix it on Code Project, this may save someone a lot of research time. </span></p>
<p><a href="http://www.codeproject.com/aspnet/crCode.asp"><span style="font-size:10pt;font-family:Verdana">http://www.codeproject.com/aspnet/crCode.asp</span></a><span style="font-size:10pt;font-family:Verdana"> </span></p></div>]]></description></item><item><title>Better Than a Shot of Whisky: Public Speaking Tips</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=34</link><pubDate>Mon, 10 Sep 2007 09:06:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=34#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass2868C06158A84F4484207FA913F18C89>
<div>The top fifteen random tips that help me in my public speaking:</div>
<div> </div>
<div>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>1.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><span><font size=3><font face=Calibri>Know your content better than anyone else in the audience. Or convince yourself that you do.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>2.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><span><font size=3><font face=Calibri>Toss slides that are essentially placeholder reminders to <i>you</i>. You’ll only say 50% of what you intended to anyway.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>3.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><span><font size=3><font face=Calibri>Pictures and diagrams speak mountains over bullet lists of text. Our brains process speech and images simultaneous. But speech and lots of words splayed on a screen is annoying.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>4.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><span><font size=3><font face=Calibri>Talk to your audience, not your slides. Try to hold eye contact longer than 3 seconds; it’s tough, but sincere. And you’ll win some allies.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>5.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><span><font size=3><font face=Calibri>Be honest. </font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>6.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><span><font size=3><font face=Calibri>Intent is more important than technique. If it’s your new to speaking, <i>tell them</i>. They’ll figure you out eventually. See bullet above.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>7.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><span><font size=3><font face=Calibri>Demos work great, if well rehearsed. Master the keyboard shortcuts; reaching for the mouse under pressure sucks.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>8.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><span><font size=3><font face=Calibri>Vista screen shots sing with the right capture program. Get Windows Clippings.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>9.</font><span style="font:7pt 'Times New Roman'">       </span></span></span><span><font size=3><font face=Calibri>Open with a story (not a joke) about the impact of the particular technology to you personally, for better or worse. Making an emotional connection early invests them in the outcome. </font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>10.</font><span style="font:7pt 'Times New Roman'">   </span></span></span><span><font size=3><font face=Calibri>Respect the fact these people chose to spend time with you over Halo 3, Entourage or time with their family.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>11.</font><span style="font:7pt 'Times New Roman'">   </span></span></span><span><font size=3><font face=Calibri>Finish early; no one complains if they get out of school a little early.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>12.</font><span style="font:7pt 'Times New Roman'">   </span></span></span><span><font size=3><font face=Calibri>Don’t use Arial or Times Roman, for the love of Pete. Most people won’t notice, but I will.</font></font></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><font size=3><font face=Calibri><span><font size=3><font face=Calibri></font></font></span></font></font></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3><span><span><font face=Calibri size=3>13.</font><span style="font:7pt 'Times New Roman'">   </span></span></span><span><font size=3><font face=Calibri>Before your talk to a group you don't know, chat with one or two folks up front. Get their names and involve them during the presentation. I've asked people to keep an eye on the time, kill the lights and make sure people don't trip on the power cord. This is your temporary posse; they'll cover for you.</font></font></span></font></span></span></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3><span></span></font></span></span> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span><span><font face=Calibri size=3>14.</font><span style="font:7pt 'Times New Roman'">   </span></span></span><font size=3><span><font face=Calibri>If it’s a small audience, give them a page of notes with the good bits distilled down (links, screenshots, steps, stuff to install).Then make that one pager your one slide </font></span><span style="font-family:Wingdings"><span>J</span></span><span><font face=Calibri>.</font></span></font></p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><font face=Calibri size=3><span></span></font> </p>
<p class=MsoListParagraph style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><font face=Calibri size=3><span><span><span><font face=Calibri size=3>15.</font><span style="font:7pt 'Times New Roman'">  </span></span></span><font size=3><span><font face=Calibri>Speel check your work. </font></span></font></span></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span><font face=Calibri size=3></font></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span><font size=3><font face=Calibri>Good link:</font></font></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span><a href="http://www.edwardtufte.com/tufte/powerpoint"><font face=Calibri size=3>http://www.edwardtufte.com/tufte/powerpoint</font></a></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span><font face=Calibri size=3></font></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span><font size=3><font face=Calibri>About the Vista fonts:</font></font></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span><a href="http://www.poynter.org/column.asp?id=47&amp;aid=78683"><font face=Calibri size=3>http://www.poynter.org/column.asp?id=47&amp;aid=78683</font></a></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span><font face=Calibri size=3></font></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span><font size=3><font face=Calibri>Kenny Kerr’s Window Clippings </font></font></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><span><a href="http://www.windowclippings.com/"><font face=Calibri size=3>http://www.windowclippings.com/</font></a></span></p></div></div>]]></description></item><item><title>ASP.NET CheckBox Control UI Affordance</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=21</link><pubDate>Tue, 04 Sep 2007 17:18:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=21#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass150301AF70A24152A45436A637AD8161><div class=ExternalClass73DE7A1ADA4A4B8880210B2330F47778> <p>In a Windows application (a well-written one at least), it's possible to click on the label next to the actual checkbox to toggle the checkbox's state. </p> <p>One of my pet peeves on the web is checkbox controls where clicking the label does nothing--you need to click the actual little checkbox box itself. This is annoying because the &quot;little box&quot; is <strong>little</strong>--it's a small target for the mouse, and requires an extra bit of concentration to target. On the other hand, the box plus the label is usually a much easier target.</p> <p>In the old days when I was writing ASP applications, I would use the &lt;label&gt; tag for checkbox labels. This tag supports the &quot;for&quot; attribute, which allows you to specify the id of the control that the label is &quot;for&quot; (associated with). Here's the HTML markup for the checkbox and the label:</p> <p>&lt;input id=&quot;SampleCheckBox&quot; type=&quot;checkbox&quot; name=&quot;SampleCheckBox&quot; /&gt;<br>&lt;label for=&quot;SampleCheckBox&quot;&gt;Check me&lt;/label&gt;</p> <p>which renders like this:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/21/Checkbox.png"><img alt="Image of checkbox control with text &quot;Check me&quot;" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/21/Checkbox_thumb.png" border=0></a> </p> <p>The label allows users to click on either the little box or the label. The nice thing about this is that &lt;label&gt; is standard HTML 4, and requires no Javascript.</p> <p>One of the really nice things about ASP.NET is that it supports this automatically. The following ASP.NET markup renders using the &lt;label&gt; tag.</p> <p>&lt;asp:CheckBox ID=&quot;SampleCheckBox&quot; Text=&quot;Check me&quot; RunAt=&quot;Server&quot; /&gt;</p> <p>This way you don't need to do anything special to get this nice little touch! I think most users, whether they consciously notice it or not, will at least subliminally appreciate this.</p> <p>Note that it is possible to accidentally subvert this--I've seen developers who were unaware of the &lt;label&gt; rendering write ASP.NET markup like this, thinking it will render the same way:</p> <p>&lt;asp:CheckBox ID=&quot;SampleCheckBox&quot; Text=&quot;&quot; RunAt=&quot;Server&quot; /&gt;Check me</p> <p>Of course, this renders without the ability to click on the &quot;Check me&quot; text.</p></div></div>]]></description></item><item><title>Escape from the Windows Accessibility Mode</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=20</link><pubDate>Tue, 04 Sep 2007 13:27:49 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=20#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass80DEE4ADEAB84EAAA8C03C9437B02DFF><p>Occasionally when using Windows (often for some reason when using Remote Desktop), I press some key sequence or combination that gets me into some sort of sticky-key Accessibility mode. The symptom of this &quot;mode&quot; (which may actually be a bug) is that <strong>key strokes are interpreted as if the Windows Logo button is being held down</strong>. (It's almost like the Windows key is stuck down, but it's not a hardware issue.) For example, pressing the E key brings up the Windows Explorer (Windows - E is the shortcut for this), and pressing the F key brings up the Find feature (Windows - F is the shortcut for find.)</p> <p>This is a nasty trap--once you have activated this mode, there's no obvious way to get out of it. Certain things become impossible to type. And it's not even clear what's happening--some letters work fine, while other keys do very surprising things. Additionally, there's a slight delay when the strange things happen (like Windows Explorer opening), so sometimes it's not even clear that it was the E key that caused it to open, making it much harder to figure out why all these windows are opening by themselves.</p> <p>I have no idea what key-combination or sequence activates this mode, or if it is a bug or a feature. However, after talking with a coworker (Steven Tapping), I have an escape plan: Windows - U.</p> <p>Windows - U is the shortcut to bring up the Accessibility Center. Here's what it looks like in Windows XP:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/20/Accessibility%20Center_1.png"><img alt="Utility Manager screenshot" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/20/Accessibility%20Center_thumb_1.png" border=0></a> </p> <p>Once it opens, you can simply close it (I click <strong>Cancel </strong>in Windows XP). For some reason this resolves the issue. I have no idea why this fixes it. I've seen this in Windows XP, and I believe I've also seen it in Windows Vista.</p> <p>If you have any information on why this happens or why this works, I'd be curious.</p> <p>PS: Many thanks to my enterprising co-worker Steven Tapping for figuring out this &quot;escape&quot; plan!</p></div>]]></description></item><item><title>New PC!</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=28</link><pubDate>Mon, 20 Aug 2007 09:30:26 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=28#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass54F8F3F92F78458398DA444085166095><p>Based on several of <a href="http://www.codinghorror.com/blog/">Jeff</a>'s recent articles, I decided to sell all my PCs, buy a bunch of parts, and build my own.  Here's what I wound up ordering:</p> <ul> <li><a href="http://www.newegg.com/product/product.asp?item=N82E16811156063">RAIDMAX Smilodon</a></li> <li><a href="http://www.newegg.com/product/product.asp?item=N82E16813188019">eVGA 680i SLI motherboard</a></li> <li><a href="http://www.newegg.com/product/product.asp?item=N82E16814130038">eVGA GeForce 8800 GTS 320MB</a></li> <li><a href="http://www.newegg.com/product/product.asp?item=N82E16820146677">mushkin RAM</a> (2 x 1 GB x 2 for 4 GB total)</li> <li><a href="http://www.newegg.com/product/product.asp?item=N82E16822136012">Western Digital 10,000 RPM hard drive</a></li> <li><a href="http://www.newegg.com/product/product.asp?item=N82E16827106072">LITE-ON 20x DVD burner</a></li> <li><a href="http://www.newegg.com/product/product.asp?item=N82E16835185038">Scythe &quot;Ninja&quot; heat sink</a></li> <li><a href="http://www.newegg.com/product/product.asp?item=N82E16817139001">Corsair 520 watt power supply</a></li> <li><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16819115017">Intel Quad-Core 2.4Ghz</a></li></ul> <p>I wound up ordering a 24&quot; LCD from Dell to go with it all, since they had one of the best prices around.  Lastly, I got myself a copy of Windows Vista Ultimate, <em>64-bit</em>!  The reason for 64-bit is because of the limits to addressable memory with a 32-bit operating system.  32-bit Windows wouldn't use all 4GB of RAM, and the video card memory is part of the addressable memory, so the more video memory I got, the less system RAM I would have.</p> <p>After getting everything put together, I ran the Vista Experience test, and got a score of 5.4.  Every category was a 5.9 except the memory, and I'm sure with a little overclocking, I could increase my score, but I don't really see the point.</p> <p>As for 64-bit Windows, every application I use runs fine, and I mean everything.  I'm a gamer and every game I've tried runs great.  I'm getting 60 FPS consistently in World of Warcraft*, running at 1920x1200.</p> <p>The total cost was around $2,500 including the operating system.  If I had ordered the same configuration from a PC manufacturer, it would have cost over $1,000 more.  The hardest part was getting everything together.  That Ninja heatsink was extremely large, and barley fit in the case!</p> <p>* Yes, I started playing World of Warcraft again, mainly because I missed playing with the guys here at Vertigo, and all those single-player games just aren't as much fun as they used to be before MMOs.</p></div>]]></description></item><item><title>Mocking HttpContext for Unit Testing</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=27</link><pubDate>Mon, 13 Aug 2007 09:31:00 GMT</pubDate><slash:comments>5</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=27#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass7000646BC62E4001ADBD6999034E1843>
<p>One of the recent challenges we were dealing with on the project I'm currently on involved added unit tests to code that was written several years ago and has been modified consistently since then. The biggest problem we found was that the MiddleTier had references to System.Web because several methods took an HttpContext or HttpApplication instance. Some methods simply referenced the static HttpContext.Current property. </p>
<p>Due to the current implementation of the ASP.NET object model, it's not a simple task to instantiate a new HttpApplication or HttpContext and set the properties you require. One of the other guys had spent a day or two on the problem, and was expressing his frustration to me. I recommended using reflection to see if that would get him anywhere, and since he wasn't real familiar with it, we took a few hours and wrote the following code at my desk: </p><pre><p><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">Assembly</span> assembly = <span style="color:#2b91af">Assembly</span>.GetAssembly(<span style="color:blue">typeof</span>(HttpApplication)); <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">Type</span> type = assembly.GetType(<span style="color:#a31515">&quot;System.Web.HttpApplicationFactory&quot;</span>, <span style="color:blue">true</span>); </span><span style="font-size:10pt;font-family:Consolas">             </span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">PropertyInfo</span> propertyInfo = type.GetProperty(<span style="color:#a31515">&quot;ApplicationState&quot;</span>, <span style="color:#2b91af">BindingFlags</span>.NonPublic | <span style="color:#2b91af">BindingFlags</span>.Static); <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">object</span> applicationState = propertyInfo.GetValue(<span style="color:blue">null</span>, <span style="color:blue">new</span> <span style="color:blue">object</span>[0]); </span><span style="font-size:10pt;font-family:Consolas">         </span></p>
<p><span style="font-size:10pt;font-family:Consolas">type.TypeInitializer.Invoke(<span style="color:blue">null</span>, <span style="color:blue">new</span> <span style="color:blue">object</span>[0]); </span><span style="font-size:10pt;font-family:Consolas">             </span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">ConstructorInfo</span> constructorInfo = type.GetConstructor(<span style="color:#2b91af">BindingFlags</span>.NonPublic | <span style="color:#2b91af">BindingFlags</span>.Instance, <span style="color:#2b91af">Type</span>.DefaultBinder, <span style="color:#2b91af">Type</span>.EmptyTypes, <span style="color:blue">new</span> <span style="color:#2b91af">ParameterModifier</span>[0]); <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">object</span> applicationFactory = constructorInfo.Invoke(<span style="color:blue">new</span> <span style="color:blue">object</span>[0]); </span><span style="font-size:10pt;font-family:Consolas">             </span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">FieldInfo</span> fieldInfo = type.GetField(<span style="color:#a31515">&quot;_theApplicationType&quot;</span>, <span style="color:#2b91af">BindingFlags</span>.NonPublic | <span style="color:#2b91af">BindingFlags</span>.Instance); <br></span><span style="font-size:10pt;font-family:Consolas">fieldInfo.SetValue(applicationFactory, <span style="color:blue">typeof</span>(HttpApplication)); </span></p>
<p><span style="font-size:10pt;font-family:Consolas">fieldInfo = type.GetField(<span style="color:#a31515">&quot;_state&quot;</span>, <span style="color:#2b91af">BindingFlags</span>.NonPublic | <span style="color:#2b91af">BindingFlags</span>.Instance); <br></span><span style="font-size:10pt;font-family:Consolas">fieldInfo.SetValue(applicationFactory, applicationState); </span><span style="font-size:10pt;font-family:Consolas">             </span></p>
<p><span style="font-size:10pt;font-family:Consolas">fieldInfo = type.GetField(<span style="color:#a31515">&quot;_theApplicationFactory&quot;</span>, <span style="color:#2b91af">BindingFlags</span>.NonPublic | <span style="color:#2b91af">BindingFlags</span>.Static); <br></span><span style="font-size:10pt;font-family:Consolas">fieldInfo.SetValue(<span style="color:blue">null</span>, applicationFactory); </span><span style="font-size:10pt;font-family:Consolas">             </span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> (<span style="color:#2b91af">StringWriter</span> stringWriter = <span style="color:blue">new</span> <span style="color:#2b91af">StringWriter</span>()) <br></span><span style="font-size:10pt;font-family:Consolas">{ <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:#2b91af">AppDomain</span>.CurrentDomain.SetData(<span style="color:#a31515">&quot;.appPath&quot;</span>, <span style="color:#2b91af">Environment</span>.GetEnvironmentVariable(<span style="color:#a31515">&quot;TEMP&quot;</span>)); <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:#2b91af">AppDomain</span>.CurrentDomain.SetData(<span style="color:#a31515">&quot;.appVPath&quot;</span>, <span style="color:#a31515">&quot;/&quot;</span>); </span><span style="font-size:10pt;font-family:Consolas">                 </span></p>
<p><span style="font-size:10pt;font-family:Consolas">    SimpleWorkerRequest request = <span style="color:blue">new</span> SimpleWorkerRequest(<span style="color:#2b91af">String</span>.Empty, <span style="color:#2b91af">String</span>.Empty, stringWriter); <br></span><span style="font-size:10pt;font-family:Consolas">    HttpContext context = <span style="color:blue">new</span> HttpContext(request); </span><span style="font-size:10pt;font-family:Consolas">                 </span></p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:#2b91af">Type</span>[] types = <span style="color:blue">new</span> <span style="color:#2b91af">Type</span>[] { <span style="color:blue">typeof</span>(HttpContext) }; <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:#2b91af">MethodInfo</span> methodInfo = type.GetMethod(<span style="color:#a31515">&quot;GetNormalApplicationInstance&quot;</span>, <span style="color:#2b91af">BindingFlags</span>.NonPublic | <span style="color:#2b91af">BindingFlags</span>.Instance, <span style="color:#2b91af">Type</span>.DefaultBinder, types, <span style="color:blue">new</span> <span style="color:#2b91af">ParameterModifier</span>[0]); </span><span style="font-size:10pt;font-family:Consolas">                 </span></p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">object</span>[] parameters = <span style="color:blue">new</span> <span style="color:blue">object</span>[] { context }; <br></span><span style="font-size:10pt;font-family:Consolas">    context.ApplicationInstance = (HttpApplication) methodInfo.Invoke(applicationFactory, parameters); </span><span style="font-size:10pt;font-family:Consolas">                 </span></p>
<p><span style="font-size:10pt;font-family:Consolas">    HttpContext.Current = context; <br></span><span style="font-size:10pt;font-family:Consolas">} </span></p>
<p><span style="font-size:10pt;font-family:Consolas">HttpContext.Current.Application.Add(<span style="color:#a31515">&quot;FirstName&quot;</span>, <span style="color:#a31515">&quot;Adrian&quot;</span>); <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">Console</span>.WriteLine(<span style="color:#a31515">&quot;FirstName: {0}&quot;</span>, HttpContext.Current.Application[<span style="color:#a31515">&quot;FirstName&quot;</span>]); </span></p>
</pre>
<p>The above code creates an HttpApplicationFactory, sets 2 required environment variables, and calls the application factory's GetNormalApplicationInstance method to create an HttpApplication. Once the application has been created, it is assigned to a new HttpContext's ApplicationInstance property. The last 2 lines are there to verify that the data put into the current HttpContext can be read back. </p>
<p>Most of this code wouldn't be possible without <a href="http://www.aisto.com/roeder/dotnet/">Reflector</a>, which helped us quite a bit. </p>
<p><em>I'd also like to point out that running the above code probably requires the FullTrust permission, and I wouldn't recommend running it in a production environment with rigorous testing and performance tweaking.</em> For us, we just needed this functionality for unit testing, nothing more.</p></div>]]></description></item><item><title>It’s a boy!</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=12</link><pubDate>Sun, 12 Aug 2007 17:38:00 GMT</pubDate><slash:comments>8</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=12#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
We just had another son. His name is Daniel David Allan, 9 lbs. 0 ounces, born Friday, August 10th at 12:17 PM. So far all we can tell about him is that he likes to sleep in during the weekends and he seems to have chronic hiccups. We're so happy to have another healthy baby boy! Welcome Daniel! 
 
 ]]></description></item><item><title>Visual Studio debugger quits debugging ASP.NET page after 90 seconds</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=7</link><pubDate>Fri, 10 Aug 2007 14:50:38 GMT</pubDate><slash:comments>7</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=7#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClass18B57A3958B94FBD8599F4F61004807B><p>I recently upgraded to Vista and am now developing ASP.NET pages running on IIS 7. One frustrating change I noticed is that every time I'm stepping through code-behind, the debugger stops after about 90 seconds and detaches from the process. This doesn't give me much time to drill down the endless hierarchy in my Locals window! (How many times can you click plus signs next to &quot;base&quot; object nodes? Separate issue.)
</p><p>I thought maybe I could just train myself to click faster, but failed. I tried and tried, but just couldn't click fast enough. Instead, I was forced to figure out the issue. It turns out, IIS 7 pings the worker process at regular intervals to determine if it's still attached. The default is 90 seconds. I'm not exactly sure why this would force the process to <strong><em>detach</em></strong>, but, at least for me, mysteriously, it does.
</p><p>Here's how you turn off that brutal pinging, or extend the brutal pinging interval:
</p><p>1) Open IIS Manager
</p><p><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/081007_2148_VisualStudi1.gif" alt="">
	</p><p>This is IIS Manager. It is very wide.
</p><p>
 </p><p>2) Click the &quot;View Application Pools&quot; link on the right.
</p><p><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/081007_2148_VisualStudi2.gif" alt="">
	</p><p>
 </p><p>3) Select your application pool and click the &quot;Advanced Settings…&quot; link.
</p><p><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/081007_2148_VisualStudi3.gif" alt="">
	</p><p>
 </p><p>4) Either a) set the &quot;Ping Enabled&quot; property to False, or b) set the &quot;Ping Maximum Response Time (seconds)&quot; to a large number.
</p><p><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/081007_2148_VisualStudi4.gif" alt="">
	</p><p>
 </p><p>There you go. Now you'll have more than 90 seconds to find that bug!
</p></div>]]></description></item><item><title>Amusing message from mixing WinZip and Vista</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=19</link><pubDate>Tue, 31 Jul 2007 13:08:04 GMT</pubDate><slash:comments>6</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=19#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClassB3809D87505A46238E5C7192BD33765A><p>I attempted to use Windows Vista to extract a large zip file created by WinZip. The zipped file was approximately 1 GB in size, and the original file was approximately 4.4 GB.</p> <p>I had plenty of free space on my main drive (approximately 23 GB), but I got the following message from Vista:</p> <p> <a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/19/Additional%205.99%20PB%20needed%20message.png"><img height=261 alt="Copy folder dialog: &quot;There is not enough space on the Desktop. You need an additional 5.99 PB to copy these files.&quot; Try Again or Cancel." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/19/Additional%205.99%20PB%20needed%20message_thumb.png" width=448 border=0></a> </p> <p>Note that, according to the message, I need <strong>5.99 PB (petabytes) </strong>for the file. A petabyte is roughly a million gigabytes. Since the file is only 4.4 GB unzipped, this message is off by a factor larger than one million. Usually the unzipping feature in Vista works fine for me; I'm thinking that this is likely caused by some sort of interaction issue between Vista and WinZip.</p> <p>Since I did need to extract the file, I tried rebooting Vista, but I got the same message repeatedly, regardless of where I tried to unzip it:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/19/Additional%205.99%20PB%20needed%20message%20diff%20drive.png"><img height=261 alt="Copy folder dialog: &quot;There is not enough space on DATAPART1. You need an additional 5.99 PB to copy these files.&quot; Try Again or Cancel." src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/19/Additional%205.99%20PB%20needed%20message%20diff%20drive_thumb.png" width=448 border=0></a> </p> <p>In the end, I downloaded and installed <a href="http://www.7-zip.org/">7-Zip</a> to extract the file, which worked fine.</p></div>]]></description></item><item><title>Experimental science at work: HVAC Testing!</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=18</link><pubDate>Thu, 26 Jul 2007 11:06:20 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=18#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClassC0FFD42A7D3A40B083FE065814325199><p>Recently, the meeting room I use for monthly design meetings with my client was getting really warm once we closed the door. This seems like a nearly ubiquitous issue: HVAC (Heating, Ventilation, and Air Conditioning) systems seem to often have issues where they tend to be too hot, too cold, too breezy, or just too complicated to configure. Our system at least looks a bit complicated, with a maze of ducts and vents between rooms:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/18/IMG_6650.jpg"><img alt="Photo of several interconnected ducts and vents" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/18/IMG_6650_thumb.jpg" border=0></a> </p> <p>Once the doors to the meeting room were closed, the room temperature increased from about 72° F to 78° F or more within about an hour. Not only was it uncomfortable, it was also difficult to be insightful or productive (or even coherent) when considering intricate design issues.</p> <p>During several monthly meetings, I asked the operations department for assistance with the temperature. The first time they had a repair team come, and they found a broken freeze sensor--it was repaired several days later. At the following meeting, another issue was discovered and repaired. After this, the president of our company suggested that it might be better for me to do some testing <strong>before </strong>the client arrived. She added that it seemed like the room heated up once the doors were closed and airflow through the doors was blocked. I had been thinking that the room heated due to the number of people and computers we had. If it was true that the people were not the main factor, it was a great idea to do some testing ahead of time.</p> <p>I'm an experimental physicist by education. Therefore, a few days later, I set out to do an experiment with the temperature of the room. I first closed all the doors, noted the temperature, and turned on the lights to simulate the heat of a group of meeting attendees.</p> <p>When I came back half an hour later, all the doors were open. This room is a common shortcut in our office traffic pattern, and obviously people were smart enough to notice that the room was empty.</p> <p>So the next step was to put up some signs--but I wasn't quite sure what to write on the signs. I felt a bit silly saying I was doing some sort of HVAC testing, but I couldn't think of another term for it, so I just went with it:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/18/IMG_6640.jpg"><img alt="Photo of a sign on a door: Please do not open door! (HVAC Testing in Progress) Keith Craig" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/18/IMG_6640_thumb.jpg" border=0></a> </p> <p>I put those signs up (on all five doors to the room!) and closed the doors again. After an hour, the temperature in the room was already up to 78 degrees F. I was surprised by how fast it went up even without people!</p> <p>I let the operations folks know what I had found, and they looked into it. They found that the thermostat we had been told controlled the room did not--actually a thermostat in a coworker's office controlled it, despite the fact that his office is fairly small and quite far from the meeting room. They also found that a damper was stuck closed--they fixed this also.</p> <p>Interestingly enough, the signs generated a lot of interest and discussion. Most people were quite interested in what type of &quot;HVAC testing&quot; I was doing. There was some question whether it was research about how the system worked or how to improve it. I explained that it was just a simple test to verify if the system was actually working, and to get it fixed if necessary.</p> <p>After this round of repairs, it was time to do another experiment. (This time I knew enough to put up the signs at the start.) Happily, even after several hours, the temperature had not changed more than 0.3°. (It started at 71.9°, and rose to 72.2°.)</p> <p>At this point, I'm hoping that it's really fixed, but we'll see. Things can always break--which will mean more HVAC testing!</p></div>]]></description></item><item><title>LINQ to SQL and the "Request-scoped DataContext" Pattern--generalized to support both WinForms and ASP.NET</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=17</link><pubDate>Thu, 26 Jul 2007 10:46:00 GMT</pubDate><slash:comments>8</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=17#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClassCF1175E5CB3844A29325ECD2F292C1EC><div class=ExternalClassF7D9F4FD26B149C4A98331A1E769C975> <div class=ExternalClass15FD665E665A40DF9E4E410D42E1B3DF> <p></p> <p>A few weeks ago I <a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Post.aspx?ID=11">posted</a> about an architectural pattern for using LINQ to SQL. In the meantime, partially based on some feedback, I've been thinking about how best to use this pattern in both a web app and a Windows Forms app. (Or, for that matter, anything that isn't an ASP.NET app--a WPF or a console app, for example.) </p> <p>I also have a personal interest in this: I'm working on a project where a custom ASP.NET app shares a data layer and business layer are with a WinForm utility. The same business and data access logic is run from either ASP.NET or a WinForm. Since the original version I posted relied on HttpContext.Current.Items, it would only work in an ASP.NET app, and would fail when used in a WinForm or other non-web app.</p> <p>Before I discuss the changes, I want to talk a bit more about the pattern and related architecture from last time.</p> <p><strong></strong> </p> <p><strong>Background</strong></p> <p>The idea for my last <a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Post.aspx?ID=11">post</a> was borrowed from the book <em>Hibernate in Acti</em><em>on</em>. It increases the scope of the DataContext in LINQ to SQL to that of an ASP.NET request, by using a LinqUtil class that automatically manages the DataContext. This simplifies much of the handling of the DataContext, and seemed to be the smoothest way to integrate LINQ to SQL into a layered architecture. Here's a picture of how I think of the layer interactions in this model:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/17/Linq%20Architecture%201.1.png"><img alt="Relationship between the layers" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/17/Linq%20Architecture%201.1_thumb.png" border=0></a></p> <p>As described in the previous post, the DataContext is implicitly created at the first request, and persists until the response is generated.</p> <p>Since I wrote this, I've talked with some people about it, and some interesting points came up.</p> <p>Some people were concerned that the presentation layer communicated directly with the data access layer. The main concern here was that if the DAL changed, then you'd need to modify both the presentation layer and the BLL. This is true, but I don't see this as a serious problem--if the DAL changes significantly, then it's going to be a lot of work to find and fix all the issues, and it's likely not that much more work to have the changes spread across two layers. And this type of change is relatively rare.</p> <p>The main strength I see of this architecture is that it allows a single representation of the objects for all layers. The business objects are stateful and have associated logic, but the DAL can return and save them in that format. </p> <p>A common architecture in .NET is to have the BLL reference the DAL, in which case the DAL cannot reference the BLL (it would be a circular reference). This means that either:</p> <ul> <li>You need to have all communication with the DAL go through primitive variables rather than objects, because the DAL doesn't know about the objects. (So, for example, instead of passing the DAL a &quot;person&quot; object to save, you need to pass the first name, last name, telephone number, and any other &quot;person&quot; fields as separate strings or other primitive types.) Needless to say, this is a bit painful, and it becomes even more difficult and unpleasant with LINQ to SQL, as you may end up losing all the information about object graphs and collection properties and such.  <li>You need to create another layer (sometimes called a &quot;model&quot; layer) that spans the whole application. These objects have no logic, but simply act as data transfer objects from the DAL to the BLL and to the presentation layer. This is okay, but it means more classes, layers, and complexity. In addition, it means that you cannot use many of the common object-oriented techniques and patterns, as these are not &quot;objects&quot; in the classical sense--they have data but no logic.</li></ul> <p>These seem to me to be more painful issues than having the presentation reference both the BLL and the DAL. Again, it's a relatively unlikely event to completely replace the DAL.</p> <p>In addition, the question came up of merging the DAL and BLL for simplicity. If you did this, you would likely have a set of static &quot;finder&quot; methods that would be used to find data in the database and return it, alongside instance methods to do business logic on the objects. Both of these would reside in partial classes that are compiled together with the LINQ designer-generated partial classes. I think this is possible, but I'm not certain I like the idea of merging the layers like this for the following reasons:</p> <ul> <li>It makes it more difficult to draw a clear separation between business logic and data access logic when both types of methods are mixed together in the same file.  <li>It makes it necessary to expose the BiddingDataContext property of the LinqUtil class to the business logic (because it's in the same class as the data access logic), which makes the separation of these even more difficult to maintain. On the other hand, if they are in two different assemblies, the LinqUtil can be placed in the DAL assembly, and the BiddingDataContext can be given internal scope, meaning that only the DAL assembly can access it.  <li>It would likely make substituting the DAL difficult for unit testing, because the methods are static and are mixed in with the business logic. (Otherwise, you could implement an interface for the DAL, and then swap the database DAL or the testing DAL using configuration.)</li></ul> <p>To me, the separation of data access logic and business logic is important because they are separate concerns--thinking of both at the same time tends to make it harder to understand the code. However, I'm not convinced on this point, and it might work out fine to merge the two.</p> <p> </p> <p><strong>Changes to LinqUtil class to support non-ASP.NET technologies</strong></p> <p>The main change I made to the LinqUtil class to support WinForms and other non-ASP.NET technologies was to add switching code to the InternalDataContext property:</p> <div style="font-size:10pt;background:white;color:black;font-family:consolas"><pre style="margin:0px"><span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px"><span style="color:gray">///</span><span style="color:green"> Private property to store the DataContext in the HttpContext.Current.Items or thread local storage</span></pre><pre style="margin:0px"><span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px"><span style="color:blue">private</span> <span style="color:blue">static</span> BiddingDbDataContext InternalDataContext</pre><pre style="margin:0px">{</pre><pre style="margin:0px">    <span style="color:blue">get</span></pre><pre style="margin:0px">    {</pre><pre style="margin:0px">        <span style="color:blue">if</span> (HttpContext.Current == <span style="color:blue">null</span>)</pre><pre style="margin:0px">            <span style="color:blue">return</span> _context;</pre><pre style="margin:0px">        <span style="color:blue">else</span></pre><pre style="margin:0px">            <span style="color:blue">return</span> (BiddingDbDataContext)HttpContext.Current.Items[DATACONTEXT_ITEMS_KEY];</pre><pre style="margin:0px">    }</pre><pre style="margin:0px">    <span style="color:blue">set</span></pre><pre style="margin:0px">    {</pre><pre style="margin:0px">      <span style="color:blue">if</span> (HttpContext.Current == <span style="color:blue">null</span>)</pre><pre style="margin:0px">            _context = <span style="color:blue">value</span>;</pre><pre style="margin:0px">        <span style="color:blue">else</span></pre><pre style="margin:0px">            HttpContext.Current.Items[DATACONTEXT_ITEMS_KEY] = <span style="color:blue">value</span>;</pre><pre style="margin:0px">    }</pre><pre style="margin:0px">}<br></pre></div>
<p> </p>
<p>This code checks if the HttpContext.Current is null--if it is, then it's certainly not running in ASP.NET, and it uses a newly added ThreadStatic field _context to store the DataContext on the thread. Otherwise, it is running in ASP.NET, and it uses the HttpContext.Current.Items collection.</p>
<p>Here's the definition of the _context field:</p>
<div style="font-size:10pt;background:white;color:black;font-family:consolas"><pre style="margin:0px"><pre style="margin:0px">[<span style="color:#2b91af">ThreadStatic</span>]</pre><pre style="margin:0px"><span style="color:blue">private</span> <span style="color:blue">static</span> BiddingDbDataContext _context;</pre></pre></div>
<p> </p>
<p>The [ThreadStatic] attribute makes the field local to a thread, exactly what is desired in a WinForm or other non-ASP.NET application. However, because ASP.NET can switch threads during heavy utilization in a single web request, this isn't completely safe to use in ASP.NET, whereas the HttpContext.Current.Items is. (For more on the risks, see Scott Hanselman's <a href="http://www.hanselman.com/blog/ATaleOfTwoTechniquesTheThreadStaticAttributeAndSystemWebHttpContextCurrentItems.aspx">post</a> on the subject.)</p>
<p>Here's the complete LinqUtil class for reference:</p>
<div style="font-size:10pt;background:white;color:black;font-family:consolas"><pre style="margin:0px"><span style="color:blue">using</span> System;</pre><pre style="margin:0px"><span style="color:blue">using</span> System.Collections.Generic;</pre><pre style="margin:0px"><span style="color:blue">using</span> System.Linq;</pre><pre style="margin:0px"><span style="color:blue">using</span> System.Data.Linq;</pre><pre style="margin:0px"><span style="color:blue">using</span> System.Reflection;</pre><pre style="margin:0px"><span style="color:blue">using</span> System.Threading;</pre><pre style="margin:0px"><span style="color:blue">using</span> System.Web;</pre><pre style="margin:0px"> </pre><pre style="margin:0px"><span style="color:blue">namespace</span> DAL</pre><pre style="margin:0px">{</pre><pre style="margin:0px">    <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">    <span style="color:gray">///</span><span style="color:green"> Simple class to implement request-scoped DataContext pattern for LINQ to SQL.</span></pre><pre style="margin:0px">    <span style="color:gray">///</span><span style="color:green"> </span></pre><pre style="margin:0px">    <span style="color:gray">///</span><span style="color:green"> Note: users must change &quot;BiddingDbDataContext&quot; to their own strongly-typed DataContext.</span></pre><pre style="margin:0px">    <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">    <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">class</span> <span style="color:#2b91af">LinqUtil</span></pre><pre style="margin:0px">    {</pre><pre style="margin:0px"><span style="color:blue">        #region</span> Privates</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Dictionary key for the DataContext in HttpContext.Current.Items</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">const</span> <span style="color:blue">string</span> DATACONTEXT_ITEMS_KEY = <span style="color:#a31515">&quot;LinqUtilDataContextKey&quot;</span>;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        [<span style="color:#2b91af">ThreadStatic</span>]</pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">static</span> BiddingDbDataContext _context;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Private property to store the DataContext in the HttpContext.Current.Items or thread local storage</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">private</span> <span style="color:blue">static</span> BiddingDbDataContext InternalDataContext</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">get</span></pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                <span style="color:blue">if</span> (HttpContext.Current == <span style="color:blue">null</span>)</pre><pre style="margin:0px">                    <span style="color:blue">return</span> _context;</pre><pre style="margin:0px">                <span style="color:blue">else</span></pre><pre style="margin:0px">                    <span style="color:blue">return</span> (BiddingDbDataContext)HttpContext.Current.Items[DATACONTEXT_ITEMS_KEY];</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">            <span style="color:blue">set</span></pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                <span style="color:blue">if</span> (HttpContext.Current == <span style="color:blue">null</span>)</pre><pre style="margin:0px">                    _context = <span style="color:blue">value</span>;</pre><pre style="margin:0px">                <span style="color:blue">else</span></pre><pre style="margin:0px">                    HttpContext.Current.Items[DATACONTEXT_ITEMS_KEY] = <span style="color:blue">value</span>;</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px"><span style="color:blue">        #endregion</span></pre><pre style="margin:0px"> </pre><pre style="margin:0px"><span style="color:blue">        #region</span> Public and Protected Properties and Methods</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Returns the current DataContext. If none configured yet, then creates a new one and returns it. Internal access</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> so that only the DAL layer can access.</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;returns&gt;</span><span style="color:green">A reference to a DataContext</span><span style="color:gray">&lt;/returns&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">internal</span> <span style="color:blue">static</span> BiddingDbDataContext Db</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">get</span></pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                <span style="color:green">// If the context is missing, create a new one</span></pre><pre style="margin:0px">                <span style="color:blue">if</span> (InternalDataContext == <span style="color:blue">null</span>)</pre><pre style="margin:0px">                {</pre><pre style="margin:0px">                    <span style="color:green">// Note: in a real app, this should get the connection string from secure storage and pass it to the context constructor.</span></pre><pre style="margin:0px">                    <span style="color:green">// However, it doesn't work because you cannot pass in parameters to new(). It's messy, but you can use reflection to solve this.</span></pre><pre style="margin:0px">                    <span style="color:blue">string</span> connectionString = <span style="color:#a31515">@&quot;Data Source=(local)\sqlexpress;Initial Catalog=BiddingDb;Integrated Security=True;Pooling=False&quot;</span>;</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                    InternalDataContext = <span style="color:blue">new</span> BiddingDbDataContext(connectionString);</pre><pre style="margin:0px">                }</pre><pre style="margin:0px"> </pre><pre style="margin:0px">                <span style="color:blue">return</span> InternalDataContext;</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Saves all changes on the current DataContext. Public scope to allow calling from upper tiers of application.</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">void</span> SubmitChanges()</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            Db.SubmitChanges();</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;summary&gt;</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> Cleanup the context (dispose the context and set it to null). Public scope allows calling from upper tiers.</span></pre><pre style="margin:0px">        <span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;</span></pre><pre style="margin:0px">        <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">void</span> CleanUp()</pre><pre style="margin:0px">        {</pre><pre style="margin:0px">            <span style="color:blue">if</span> (InternalDataContext != <span style="color:blue">null</span>)</pre><pre style="margin:0px">            {</pre><pre style="margin:0px">                InternalDataContext.Dispose();</pre><pre style="margin:0px">                InternalDataContext = <span style="color:blue">null</span>;</pre><pre style="margin:0px">            }</pre><pre style="margin:0px">        }</pre><pre style="margin:0px"> </pre><pre style="margin:0px"><span style="color:blue">        #endregion</span></pre><pre style="margin:0px">    }</pre><pre style="margin:0px">}</pre><pre style="margin:0px"> </pre></div></div></div></div>]]></description></item><item><title>Buttons are bad?</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=26</link><pubDate>Thu, 26 Jul 2007 09:30:47 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=26#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass8877094CE4004D609B972075E37D01E4><p>The Wall Street Journal has an article titled <a href="http://online.wsj.com/article/SB118532502435077009.html?mod=hpp_us_editors_picks">Hide the Button: Steve Jobs Has His Finger on It</a>.  It's basically about Steve Jobs and his dislike of buttons (even on shirts) because they're &quot;blemishes&quot;.  It's assumed that he wears all those black mock turtlenecks because they're closer to perfection.  Riiiiight.</p> <p>It seems to me that he's taking the idea a little far far.  I prefer shirts with zippers to buttons, but buttons don't offend me or make me roll my eyes.  Besides, if he's so put out by clothing with buttons, <em><strong>why does he still wear blue jeans?</strong></em></p></div>]]></description></item><item><title>Using RAISERROR in a TRY-CATCH block</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=11</link><pubDate>Tue, 24 Jul 2007 15:24:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=11#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass432A66E5D7D446919D8F27935B6A75FE>As Adrian pointed out in <a href="http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=25">his recent post</a>, it is not a straightforward task to get all of the error information back to the middle tier from a stored procedure using <span style="font-size:10pt;font-family:Consolas">RAISERROR</span>. The <span style="font-size:10pt;font-family:Consolas">RAISERROR</span> statement provides three user-settable parameters: message, severity, and state. Since SQL Server associates particular semantics with the severity, use one or both of the other two to provide the middle tier with specific information. Here are a couple of possibilities.<br>
<ol>
<li>Provide a custom message by constructing an easily parsed string in the stored procedure.<br><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">SET</span> @ErrorMessage = ERROR_MESSAGE()</span><br><span style="font-size:10pt;font-family:Consolas">        + N<span style="color:fuchsia">':'</span> + <span style="color:blue">CAST</span>(ERROR_NUMBER()<span style="color:blue"> AS nvarchar</span>)</span><br><span style="font-size:10pt;font-family:Consolas">        + N<span style="color:fuchsia">','</span> + <span style="color:blue">CAST</span>(ERROR_LINE()<span style="color:blue"> AS nvarchar</span>)</span><br><span style="font-size:10pt;font-family:Consolas">        + N<span style="color:fuchsia">','</span> + ERROR_PROCEDURE()</span><br><br>Parse it in the middle tier.<br><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">catch</span>(<span style="color:#2b91af">SqlException</span> sqlex)</span><br><span style="font-size:10pt;font-family:Consolas">    {</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">string</span> message= sqlex.Message;</span><br><span style="font-size:10pt;font-family:Consolas">        message= message.Substring(message.LastIndexOf(<span style="color:fuchsia">':'</span>) + <span style="color:red">1</span>);</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">string</span>[] parts= message.Split(<span style="color:fuchsia">','</span>);</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">switch</span>(<span style="color:blue">int</span>.Parse(parts[<span style="color:red">0</span>]))</span><br><span style="font-size:10pt;font-family:Consolas">        {</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">case</span> <span style="color:red">544</span>: <span style="color:green">// Cannot insert explicit value for identity column....</span></span><br><span style="font-size:10pt;font-family:Consolas">           <span style="color:blue">break</span>;</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">case</span> <span style="color:red">8134</span>: <span style="color:green">// Divide by zero error encountered.</span></span><br><span style="font-size:10pt;font-family:Consolas">           <span style="color:blue">break</span>;</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">case</span> <span style="color:red">1105</span>: <span style="color:green">// Could not allocate space....</span></span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">switch</span>(sqlex.State)</span><br><span style="font-size:10pt;font-family:Consolas">            {</span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">case</span> <span style="color:red">2</span>: <span style="color:green">// data segment full</span></span><br><span style="font-size:10pt;font-family:Consolas">               <span style="color:blue">break</span>;</span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">case</span> <span style="color:red">3</span>: <span style="color:green">// log segment full</span></span><br><span style="font-size:10pt;font-family:Consolas">               <span style="color:blue">break</span>; </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">default</span>:</span><br><span style="font-size:10pt;font-family:Consolas">               <span style="color:blue">break</span>;</span><br><span style="font-size:10pt;font-family:Consolas">            }</span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">break</span>; </span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">default</span>:</span><br><span style="font-size:10pt;font-family:Consolas">           <span style="color:blue">break</span>;</span><br><span style="font-size:10pt;font-family:Consolas">        }</span><br><span style="font-size:10pt;font-family:Consolas">    }</span><br></li>
<li>Provide a custom state by using a <span style="font-size:10pt;font-family:Consolas">CASE</span> expression in the stored procedure.<br><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">SET</span> @ErrorState = <span style="color:blue">CASE</span> ERROR_NUMBER() <span style="color:blue">WHEN</span> <span style="color:red">544</span> <span style="color:blue">THEN</span> <span style="color:red">1</span> <span style="color:blue">WHEN</span> <span style="color:red">8134</span> <span style="color:blue">THEN</span> <span style="color:red">2</span> <span style="color:blue">ELSE</span> <span style="color:red">99</span> <span style="color:blue">END</span></span><br><br>If you need to differentiate states for a single error (as option #1 does), add that to the <span style="font-size:10pt;font-family:Consolas">CASE</span> expression.<br><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">SET</span> @ErrorState = <span style="color:blue">CASE</span> ERROR_NUMBER()</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">WHEN</span> <span style="color:red">544</span> <span style="color:blue">THEN</span> <span style="color:red">1</span> <span style="color:green">-- Cannot insert explicit value for identity column....</span></span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">WHEN</span> <span style="color:red">8134</span> <span style="color:blue">THEN</span> <span style="color:red">2</span> <span style="color:green">-- Divide by zero error encountered.</span></span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">WHEN</span> <span style="color:red">1105</span> <span style="color:blue">THEN CASE</span> ERROR_STATE() <span style="color:green">-- Could not allocate space....</span></span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">WHEN</span> <span style="color:red">2</span> <span style="color:blue">THEN</span> <span style="color:red">3</span> <span style="color:green">-- data segment full</span></span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">WHEN</span> <span style="color:red">3</span> <span style="color:blue">THEN</span> <span style="color:red">4</span> <span style="color:green">-- log segment full</span></span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">ELSE</span> <span style="color:red">5</span> <span style="color:blue">END</span></span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">ELSE</span> <span style="color:red">99</span> <span style="color:blue">END</span></span><br><br>The middle tier can use the state value to decide what to do.<br><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">catch</span>(<span style="color:#2b91af">SqlException</span> sqlex)</span><br><span style="font-size:10pt;font-family:Consolas">    {</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">switch</span>(sqlex.State)</span><br><span style="font-size:10pt;font-family:Consolas">        {</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">case</span> <span style="color:red">1</span>: <span style="color:green">// Cannot insert explicit value for identity column....</span></span><br><span style="font-size:10pt;font-family:Consolas">           <span style="color:blue">break</span>;</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">case</span> <span style="color:red">2</span>: <span style="color:green">// Divide by zero error encountered.</span></span><br><span style="font-size:10pt;font-family:Consolas">           <span style="color:blue">break</span>;</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">case</span> <span style="color:red">3</span>: <span style="color:green">// Could not allocate space (data segment full)....</span></span><br><span style="font-size:10pt;font-family:Consolas">           <span style="color:blue">break</span>;</span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">case</span> <span style="color:red">4</span>: <span style="color:green">// Could not allocate space (log segment full)....</span></span><br><span style="font-size:10pt;font-family:Consolas">           <span style="color:blue">break</span>;</span> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">default</span>:</span><br><span style="font-size:10pt;font-family:Consolas">           <span style="color:blue">break</span>;</span><br><span style="font-size:10pt;font-family:Consolas">        }</span><br><span style="font-size:10pt;font-family:Consolas">    }</span></li></ol>There are <a href="http://msdn2.microsoft.com/en-us/library/ms179296.aspx">several good guidelines and suggestions</a> about using <a href="http://msdn2.microsoft.com/en-us/library/ms175976.aspx">the TRY-CATCH construct</a> in SQL Server in <a href="http://msdn2.microsoft.com/en-us/library/ms130214.aspx">Books Online</a>.</div>]]></description></item><item><title>Missing menu options in Visual Studio 2005?</title><link>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=16</link><pubDate>Fri, 20 Jul 2007 16:34:35 GMT</pubDate><slash:comments>32</slash:comments><comments>http://blogs.vertigo.com/personal/KeithC/Blog/Lists/Posts/Post.aspx?ID=16#Comments</comments><dc:creator>KeithC</dc:creator><description><![CDATA[<div class=ExternalClass769EB4497A1E427CA6223407B377C0D6><p>We recently upgraded to Windows Vista, using a new standardized image containing a standard set of developer tools. When I started Visual Studio the first time, I just accepted the default options. I noticed today that the <strong>Exceptions...</strong> option was missing from the <strong>Debug </strong>menu:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Debug%20menu%20without%20Exceptions%20option.png"><img alt="Debug menu without Exceptions option" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Debug%20menu%20without%20Exceptions%20option_thumb.png" border=0></a> </p> <p>Initially, I found this to be a bit of a mystery. How could an important menu item like that just not be there? Was it some sort of configuration issue? After looking into this a bit, I found a <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1766443&amp;SiteID=1">post</a> that explained that this is usually due to Visual Studio profile issues. Using the information in this post, I was able to get the option back, as follows.</p> <p>The issue is that the default profile I selected when I first started Visual Studio is different than the standard C# profile. Some non-C# profiles hide more advanced menu options to make Visual Studio appear simpler. In order to get the menu items back, I needed to change profiles.</p> <p>In Visual Studio, first click <strong>Tools</strong>, then click <strong>Import and Export Settings... </strong>as shown below:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Tools%20Import%20and%20Export%20Settings%20option.png"><img height=517 alt="Tools Import and Export Settings option" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Tools%20Import%20and%20Export%20Settings%20option_thumb.png" width=301 border=0></a> </p> <p>In the Import and Export Settings Wizard, click <strong>Import selected environment settings</strong>, and click <strong>Next&gt;</strong>:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard.png"><img alt="Import and Export settings wizard" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard_thumb.png" border=0></a></p> <p>Next, tell it to save your existing settings, and click <strong>Next &gt;</strong>:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard%20step%202.png"><img height=586 alt="Import and Export settings wizard step 2" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard%20step%202_thumb.png" width=659 border=0></a> </p> <p>Now tell it to import the <strong>Visual</strong> <strong>C# Development Settings (</strong>the post I found mentioned that everything is available in that settings configuration) and click <strong>Next &gt;</strong>:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard%20step%203%20-%20choose%20new%20settings.png"><img height=590 alt="Import and Export settings wizard step 3 - choose new settings" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard%20step%203%20-%20choose%20new%20settings_thumb.png" width=653 border=0></a></p> <p>The last step is to choose the settings to import--I took the defaults here, as compromising my environment, computer, or data didn't sound like good options: </p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard%20step%204%20-%20choose%20settings%20to%20import.png"><img alt="Import and Export settings wizard step 4 - choose settings to import" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard%20step%204%20-%20choose%20settings%20to%20import_thumb.png" border=0></a> </p> <p>This completed successfully:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard%20step%205%20--%20complete.png"><img height=588 alt="Import and Export settings wizard step 5 -- complete" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Import%20and%20Export%20settings%20wizard%20step%205%20--%20complete_thumb.png" width=656 border=0></a></p> <p>And now, the <strong>Debug </strong>menu contains the <strong>Exceptions... </strong>menu item, as well as a few other additional items:</p> <p><a href="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Debug%20menu%20WITH%20Exceptions%20option.png"><img alt="Debug menu WITH Exceptions option" src="http://blogs.vertigo.com/personal/keithc/Blog/Lists/Posts/Attachments/16/Debug%20menu%20WITH%20Exceptions%20option_thumb.png" border=0></a></p> <p>Note that now all the fonts and other customized settings are all back to the default values, so I need to update these by hand. I could have selected only some of the items in the Visual C# Development Profile to import, but I frankly don't know what some of the items mean, so I'd rather just rebuild my settings around the C# profile.</p> <p>Going forward, I've exported a copy of my settings, so that I can easily get back to a known good configuration.</p></div>]]></description></item><item><title>A WPF Screen Saver Library</title><link>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Thu, 19 Jul 2007 20:05:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>davidb</dc:creator><description><![CDATA[<div class=ExternalClassA67CF8311A15415DA4B12B140E31E3A0>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri><img src="http://blogs.vertigo.com/personal/davidb/Blog/Lists/Photos/ScreenSaverProperties.png"></font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri>While Visual Studio 2005 includes a starter project for writing managed screen savers, it [the screen saver] doesn’t support display in the Screen Saver Settings dialog’s preview window, and isn’t built around WPF.<span>  </span>As an exercise for learning WPF and WPF 3D—but also because I have a thing for screensavers—I put together a WPF-based library for this.</font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri>The WPF screen saver library contains much of its functionality in a </font></font><span class=CodeChar><span style="font-size:10pt;line-height:115%"><font face="Lucida Sans Typewriter">System.Windows.Window</font></span></span><font face=Calibri size=3> child class.<span>  </span>This provides a message loop to drive execution.<span>  </span>In full-screen mode, it closes when the user presses a key or makes a significant mouse movement, and in preview mode, when its parent window is no longer displayed.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>The API is fairly simple:</font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter">// Create a window, specifying a System.Windows.Media.Visual, parent window </font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter">// handle, and priority.<span>  </span>For full-screen, the parent handle should be IntPtr.</font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter">// Zero.<span>  </span>An UpdateScreenSaverStateHandler delegate can also be supplied, in </font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter">// case the visual's state needs updating--otherwise, it should be null.<span>  </span>In </font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter">// preview mode, the window will check that its parent is still displayed by a </font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter">// frequency, based on the specified priority.</font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font face="Lucida Sans Typewriter" size=2></font> </p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter">ScreenSaverWindow window = </font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter"><span>    </span>new ScreenSaverWindow(</font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter"><span>        </span>someVisual,</font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter"><span>        </span>new UpdateScreenSaverStateHandler(someVisual.UpdateVisual),</font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter"><span>        </span>somePriority,</font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter"><span>        </span>parentHandle);</font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font face="Lucida Sans Typewriter" size=2></font> </p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter">// Use that as the application's main window.</font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font face="Lucida Sans Typewriter" size=2></font> </p>
<p class=Code style="margin:0in 0in 10pt"><font size=2><font face="Lucida Sans Typewriter">Application application = new Application();</font></font></p>
<p class=Code style="margin:0in 0in 10pt"><font face="Lucida Sans Typewriter" size=2>application.Run(window);</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 10pt"><b><font size=3><font face=Calibri>Known Issues:</font></font></b></p>
<p class=MsoListParagraphCxSpFirst style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span style="font-family:Symbol"><span><font size=3>·</font><span style="font:7pt 'Times New Roman'">         </span></span></span><span class=CodeChar><span style="font-size:10pt;line-height:115%"><font face="Lucida Sans Typewriter">ScreenSaverWindow</font></span></span><font face=Calibri size=3> can't actually display on the desktop root.<span>  </span>Rather, it maximizes, using </font><span class=CodeChar><span style="font-size:10pt;line-height:115%"><font face="Lucida Sans Typewriter">WindowStyle.None</font></span></span><font face=Calibri size=3>.<span>  </span>Whether this will span multi-screen displays depends on how the OS is set to handle maximizing.</font></p>
<p class=MsoListParagraphCxSpMiddle style="margin:0in 0in 0pt 0.5in;text-indent:-0.25in"><span style="font-family:Symbol"><span><font size=3>·</font><span style="font:7pt 'Times New Roman'">         </span></span></span><font face=Calibri size=3>The screen saver originally stored its settings in user/assembly Isolated Storage.<span>  </span>However, when run due to inactivity under Vista—it worked fine under Server 2003 and in preview mode—it couldn’t read the settings file.<span>  </span>Currently, the program saves to the user’s home path, but the Isolated Storage problem needs to be addressed.</font></p>
<p class=MsoListParagraphCxSpLast style="margin:0in 0in 10pt 0.5in;text-indent:-0.25in"><span style="font-family:Symbol"><span><font size=3>·</font><span style="font:7pt 'Times New Roman'">         </span></span></span><font face=Calibri size=3>Like some—many?—WPF apps, the example implementation takes a bit longer to load than one might like.<span>  </span>NGen helps, but doesn’t recognize the </font><span class=CodeChar><span style="font-size:10pt;line-height:115%"><font face="Lucida Sans Typewriter">.scr</font></span></span><font face=Calibri size=3> file as an executable.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>Source and binaries are available <a href="http://blogs.vertigo.com/personal/davidb/Blog/Blog%20Files/WPFLavaLite.zip">here</a>.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>The example implementation is a port of xscreensaver’s Lava Lite.<span>  </span>The original source is available at </font><a href="http://www.jwz.org/xscreensaver/"><font face=Calibri color="#0000ff" size=3>http://www.jwz.org/xscreensaver/</font></a><font face=Calibri size=3>.<span>  </span>Xscreensaver is Copyright (c) 2002-2004 Jamie Zawinski </font><a href="mailto:jwz@jwz.org"><font face=Calibri color="#0000ff" size=3>jwz@jwz.org</font></a><font face=Calibri size=3>.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>The code for displaying in a preview window is based on Microsoft’s </font><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=f0288df5-01d8-4246-b755-5237e08b0016&amp;displaylang=en"><font face=Calibri size=3>Create a Screensaver with GDI+</font></a><font face=Calibri size=3> Code Sample.</font></p>
<div>Edit: Fixed the Download Link</div></div>]]></description></item><item><title>Visual Studio Macros (C# Developers)</title><link>http://blogs.vertigo.com/personal/jimbg/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Tue, 17 Jul 2007 19:22:00 GMT</pubDate><slash:comments>6</slash:comments><comments>http://blogs.vertigo.com/personal/jimbg/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>jimbg</dc:creator><description><![CDATA[<div class=ExternalClass59454C0A6D684A5F9961AEA24F81D3A9>
<div>
<div class=ExternalClassA684EAEAA7CD42CE835DDACA13280282>
<div>How many times have you defined a block of code, such as an if statement?  You begin the statement, followed by the conditions &quot;if ([condition(s)])&quot;.  You then follow a pattern similar to the following: </div>
<ul>
<li>Press Enter to advance a line</li>
<li>Start the block with a left brace ({)</li>
<li>Press Enter to advance a line</li>
<li>End the block with a right brace (})</li>
<li>Press Up so you're behind the left brace</li>
<li>Press Enter to add a line between the braces</li></ul>
<p>I quickly grew tired of repeating that bulleted list every time I wanted to define a block of code (classes, properties, methods, if statements, switch statements, using statements, etc.).  I found a fast, and relatively easy way to automate this task for me: Visual Studio Macros.  (Note: the reason for the &quot;relatively&quot; part is due to the VB.NET language requirement for macros)</p>
<p>This is the code I wrote to define a block for me:</p>
<div style="font-size:8pt;background:white;color:black;font-family:Courier New">
<p style="margin:0px"><span style="color:blue">Sub</span> AutoBrace()</p>
<p style="margin:0px">    <span style="color:blue">Dim</span> sel <span style="color:blue">As</span> EnvDTE.TextSelection</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    sel = DTE.ActiveWindow.Selection</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    DTE.UndoContext.Open(<span style="color:#a31515">&quot;Auto Brace&quot;</span>)</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">Try</span></p>
<p style="margin:0px">        sel.EndOfLine()</p>
<p style="margin:0px">        sel.NewLine()</p>
<p style="margin:0px">        sel.Unindent()</p>
<p style="margin:0px">        sel.Text = <span style="color:#a31515">&quot;{&quot;</span></p>
<p style="margin:0px">        sel.EndOfLine()</p>
<p style="margin:0px">        sel.NewLine()</p>
<p style="margin:0px">        sel.Unindent()</p>
<p style="margin:0px">        sel.Text = <span style="color:#a31515">&quot;}&quot;</span></p>
<p style="margin:0px">        sel.LineUp()</p>
<p style="margin:0px">        sel.EndOfLine()</p>
<p style="margin:0px">        sel.NewLine()</p>
<p style="margin:0px">    <span style="color:blue">Finally</span></p>
<p style="margin:0px">        DTE.UndoContext.Close()</p>
<p style="margin:0px">    <span style="color:blue">End</span> <span style="color:blue">Try</span></p>
<p style="margin:0px"><span style="color:blue">End</span> <span style="color:blue">Sub</span></p></div>
<p>Since my attempt to automate block definition turned out so well, I decided to take a stab at automating another repetative task I routinely performed: region directives.</p>
<p>In general, I like to use region directives around methods, properties, etc. for outlining.  Again, I figured that there had to be a way to automate this.  This macro proved to be quite a bit tougher than the last one, but I was able to automate the task.</p>
<div style="font-size:8pt;background:white;color:black;font-family:Courier New">
<p style="margin:0px"><span style="color:blue">#region</span> SomeMethod</p>
<p style="margin:0px"><span style="color:blue">public</span> <span style="color:blue">void</span> SomeMethod()</p>
<p style="margin:0px">{</p>
<p style="margin:0px">    ...</p>
<p style="margin:0px">}</p>
<p style="margin:0px"><span style="color:blue">#endregion</span></p></div>
<p>This is the macro that I wrote to handle generation of region directives around the code element that the cursor was within.  Basically, it finds the inner-most code element that the cursor is in, locates the start and end points, and wraps them in a #region directive.</p>
<div style="font-size:8pt;background:white;color:black;font-family:Courier New">
<p style="margin:0px"><span style="color:blue">Sub</span> AutoRegion()</p>
<p style="margin:0px">    <span style="color:blue">Dim</span> sel <span style="color:blue">As</span> EnvDTE.TextSelection</p>
<p style="margin:0px">    <span style="color:blue">Dim</span> selPoint <span style="color:blue">As</span> EnvDTE.EditPoint</p>
<p style="margin:0px">    <span style="color:blue">Dim</span> editPoint <span style="color:blue">As</span> EnvDTE.EditPoint</p>
<p style="margin:0px">    <span style="color:blue">Dim</span> elem <span style="color:blue">As</span> EnvDTE.CodeElement</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    sel = DTE.ActiveWindow.Selection</p>
<p style="margin:0px">    selPoint = sel.ActivePoint.CreateEditPoint</p>
<p style="margin:0px">    editPoint = sel.ActivePoint.CreateEditPoint</p>
<p style="margin:0px">    elem = GetCurrentCodeElement(editPoint)</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    DTE.UndoContext.Open(<span style="color:#a31515">&quot;Auto Region&quot;</span>)</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">Try</span></p>
<p style="margin:0px">        editPoint.MoveToPoint(elem.GetStartPoint(vsCMPart.vsCMPartWholeWithAttributes))</p>
<p style="margin:0px">        editPoint.LineUp()</p>
<p style="margin:0px"> </p>
<p style="margin:0px">        <span style="color:blue">Do</span> <span style="color:blue">While</span> IsCommentLine(editPoint, <span style="color:#a31515">&quot;///&quot;</span>)</p>
<p style="margin:0px">            editPoint.LineUp()</p>
<p style="margin:0px">        <span style="color:blue">Loop</span></p>
<p style="margin:0px"> </p>
<p style="margin:0px">        editPoint.EndOfLine()</p>
<p style="margin:0px">        sel.MoveToPoint(editPoint, <span style="color:blue">False</span>)</p>
<p style="margin:0px">        sel.NewLine()</p>
<p style="margin:0px">        sel.Text = <span style="color:#a31515">&quot;#region &quot;</span> + elem.Name</p>
<p style="margin:0px">        editPoint.MoveToPoint(selPoint)</p>
<p style="margin:0px">        editPoint.MoveToPoint(elem.GetEndPoint(vsCMPart.vsCMPartWholeWithAttributes))</p>
<p style="margin:0px">        sel.MoveToPoint(editPoint, <span style="color:blue">False</span>)</p>
<p style="margin:0px">        sel.NewLine()</p>
<p style="margin:0px">        sel.Text = <span style="color:#a31515">&quot;#endregion&quot;</span></p>
<p style="margin:0px">        sel.MoveToPoint(selPoint)</p>
<p style="margin:0px">    <span style="color:blue">Finally</span></p>
<p style="margin:0px">        DTE.UndoContext.Close()</p>
<p style="margin:0px">    <span style="color:blue">End</span> <span style="color:blue">Try</span></p>
<p style="margin:0px"><span style="color:blue">End</span> <span style="color:blue">Sub</span></p></div>
<p>The first issue I ran into was how to find the inner-most element at the cursor location.  The best method of doing this, at the time, was to step through a list of possible elements, returning the first that didn't throw an exception (dirty, I know, but I already felt a little dirty working in VB.NET anyway).</p>
<div style="font-size:8pt;background:white;color:black;font-family:Courier New">
<p style="margin:0px"><span style="color:blue">Private</span> <span style="color:blue">Function</span> GetCurrentCodeElement(<span style="color:blue">ByVal</span> editPoint <span style="color:blue">As</span> EnvDTE.EditPoint) <span style="color:blue">As</span> EnvDTE.CodeElement</p>
<p style="margin:0px">    <span style="color:blue">Dim</span> elem <span style="color:blue">As</span> EnvDTE.CodeElement</p>
<p style="margin:0px">    <span style="color:blue">Dim</span> types <span style="color:blue">As</span> vsCMElement() = _</p>
<p style="margin:0px">        {vsCMElement.vsCMElementProperty, _</p>
<p style="margin:0px">        vsCMElement.vsCMElementFunction, _</p>
<p style="margin:0px">        vsCMElement.vsCMElementEnum, _</p>
<p style="margin:0px">        vsCMElement.vsCMElementInterface, _</p>
<p style="margin:0px">        vsCMElement.vsCMElementStruct, _</p>
<p style="margin:0px">        vsCMElement.vsCMElementClass}</p>
<p style="margin:0px">    <span style="color:blue">Dim</span> type <span style="color:blue">As</span> vsCMElement</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">For</span> <span style="color:blue">Each</span> type <span style="color:blue">In</span> types</p>
<p style="margin:0px">        elem = GetCodeElement(editPoint, type)</p>
<p style="margin:0px">        <span style="color:blue">If</span> <span style="color:blue">Not</span> elem <span style="color:blue">Is</span> <span style="color:blue">Nothing</span> <span style="color:blue">Then</span></p>
<p style="margin:0px">            <span style="color:blue">Exit</span> <span style="color:blue">For</span></p>
<p style="margin:0px">        <span style="color:blue">End</span> <span style="color:blue">If</span></p>
<p style="margin:0px">    <span style="color:blue">Next</span></p>
<p style="margin:0px"> </p>
<p style="margin:0px">    GetCurrentCodeElement = elem</p>
<p style="margin:0px"><span style="color:blue">End</span> <span style="color:blue">Function</span></p>
<p style="margin:0px"> </p>
<p style="margin:0px"><span style="color:blue">Private</span> <span style="color:blue">Function</span> GetCodeElement(<span style="color:blue">ByVal</span> editPoint <span style="color:blue">As</span> EnvDTE.EditPoint, <span style="color:blue">ByVal</span> type <span style="color:blue">As</span> vsCMElement) <span style="color:blue">As</span> EnvDTE.CodeElement</p>
<p style="margin:0px">    <span style="color:blue">Dim</span> elem <span style="color:blue">As</span> EnvDTE.CodeElement</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">Try</span></p>
<p style="margin:0px">        elem = editPoint.CodeElement(type)</p>
<p style="margin:0px">    <span style="color:blue">Catch</span> ex <span style="color:blue">As</span> Exception</p>
<p style="margin:0px">        elem = <span style="color:blue">Nothing</span></p>
<p style="margin:0px">    <span style="color:blue">End</span> <span style="color:blue">Try</span></p>
<p style="margin:0px"> </p>
<p style="margin:0px">    GetCodeElement = elem</p>
<p style="margin:0px"><span style="color:blue">End</span> <span style="color:blue">Function</span></p></div>
<p>I also wanted the macro to be able to handle XML comment tags for the target code element as well.</p>
<div style="font-size:8pt;background:white;color:black;font-family:Courier New">
<p style="margin:0px"><span style="color:blue">Private</span> <span style="color:blue">Function</span> IsCommentLine(<span style="color:blue">ByVal</span> editPoint <span style="color:blue">As</span> EnvDTE.EditPoint, <span style="color:blue">ByVal</span> linePrefix <span style="color:blue">As</span> <span style="color:blue">String</span>) <span style="color:blue">As</span> <span style="color:blue">Boolean</span></p>
<p style="margin:0px">    <span style="color:blue">Dim</span> lineText <span style="color:blue">As</span> <span style="color:blue">String</span></p>
<p style="margin:0px">    <span style="color:blue">Dim</span> prefixText <span style="color:blue">As</span> <span style="color:blue">String</span></p>
<p style="margin:0px"> </p>
<p style="margin:0px">    EditPoint.StartOfLine()</p>
<p style="margin:0px">    lineText = EditPoint.GetText(EditPoint.LineLength).Trim</p>
<p style="margin:0px">    prefixText = linePrefix.Trim</p>
<p style="margin:0px"> </p>
<p style="margin:0px">    <span style="color:blue">If</span> lineText.Equals(prefixText) <span style="color:blue">Or</span> lineText.StartsWith(prefixText) <span style="color:blue">Then</span></p>
<p style="margin:0px">        IsCommentLine = <span style="color:blue">True</span></p>
<p style="margin:0px">    <span style="color:blue">Else</span></p>
<p style="margin:0px">        IsCommentLine = <span style="color:blue">False</span></p>
<p style="margin:0px">    <span style="color:blue">End</span> <span style="color:blue">If</span></p>
<p style="margin:0px"><span style="color:blue">End</span> <span style="color:blue">Function</span></p></div>
<p>I have attached a zip containing the source file <a href="http://blogs.vertigo.com/personal/jimbg/Blog/BlogDocs/User.zip">here</a>.  Happy automating!</p>
<p>* edited to correct spelling mistake (consicions -&gt; conditions)</p></div></div></div>]]></description></item><item><title>T-SQL Try Catch Problems</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=25</link><pubDate>Tue, 17 Jul 2007 18:53:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=25#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClassE23E58BEA31C43DA882F410AF5B1380A>
<p>SQL Server 2005 introduced a new way of error handling, using try catch blocks similar to what you'll find in Java, C#, or VB.NET. </p>
<p>Here is a template I've been using on the project that I'm currently on to support transactions: </p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">CREATE</span> <span style="color:blue">PROCEDURE</span> dbo<span style="color:gray">.</span>usp_Procedure_Name <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:green">-- parameter list <br></span></span><span style="font-size:10pt;color:blue;font-family:Consolas">AS </span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">SET</span> <span style="color:blue">NOCOUNT</span> <span style="color:blue">ON </span></span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">BEGIN</span> <span style="color:blue">TRY <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">BEGIN</span> <span style="color:blue">TRANSACTION </span></span><span style="font-size:10pt;font-family:Consolas">     </span></p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:green">-- SQL statements </span></span></p>
<p><span style="font-size:10pt;font-family:Consolas"></span></p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">COMMIT</span> <span style="color:blue">TRANSACTION <br></span></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">END</span> <span style="color:blue">TRY <br></span></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">BEGIN</span> <span style="color:blue">CATCH <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">ROLLBACK</span> <span style="color:blue">TRANSACTION </span></span><span style="font-size:10pt;font-family:Consolas">     </span></p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">DECLARE</span> @ErrorMessage <span style="color:blue">nvarchar</span><span style="color:gray">(</span>4000<span style="color:gray">) <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">DECLARE</span> @ErrorSeverity <span style="color:blue">int <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">DECLARE</span> @ErrorState <span style="color:blue">int <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">DECLARE</span> @ErrorNumber <span style="color:blue">int <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">DECLARE</span> @ErrorLine <span style="color:blue">int </span></span><span style="font-size:10pt;font-family:Consolas">     </span></p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">SET</span> @ErrorMessage <span style="color:gray">=</span> <span style="color:fuchsia">ERROR_MESSAGE</span><span style="color:gray">()</span> <span style="color:gray">+</span> <span style="color:red">' Error Number: %d Error Line: %d' <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">SET</span> @ErrorSeverity <span style="color:gray">=</span> <span style="color:fuchsia">ERROR_SEVERITY</span><span style="color:gray">() <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">SET</span> @ErrorState <span style="color:gray">=</span> <span style="color:fuchsia">ERROR_STATE</span><span style="color:gray">() <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">SET</span> @ErrorNumber <span style="color:gray">=</span> <span style="color:fuchsia">ERROR_NUMBER</span><span style="color:gray">() <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">SET</span> @ErrorLine <span style="color:gray">=</span> <span style="color:fuchsia">ERROR_LINE</span><span style="color:gray">() </span></span><span style="font-size:10pt;font-family:Consolas">     </span></p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">RAISERROR</span><span style="color:gray">(</span>@ErrorMessage<span style="color:gray">,</span> @ErrorSeverity<span style="color:gray">,</span> @ErrorState<span style="color:gray">,</span> @ErrorNumber<span style="color:gray">,</span> @ErrorLine<span style="color:gray">) <br></span></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">END</span> <span style="color:blue">CATCH <br></span></span><span style="font-size:10pt;font-family:Consolas">GO </span></p>
<p>Basically, a new transaction is started, one or more commands are issued and the transaction is committed if there are no errors. If an error does occur, the transaction is rolled back, and a new error is raised. </p>
<p>The problem I have discovered with this approach is that the RaiseError T-SQL function doesn't support specifying which error should be rethrown, and defaults to 50000. In the following example, the code will be checking for an error code of 547, but will get 50000 instead. This means that the function will return false, even though a foreign key constraint exception occurred. </p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">bool</span> IsForeignKeyContraintException(<span style="color:#2b91af">Exception</span> e)<br>{ <br></span><span style="font-size:10pt;font-family:Consolas">    SqlException sqlex = e <span style="color:blue">as</span> SqlException; <br>    </span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">if</span> (sqlex != <span style="color:blue">null</span> &amp;&amp; sqlex.Number == 547)<br>    { <br>    </span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">return</span> <span style="color:blue">true</span>; <br></span><span style="font-size:10pt;font-family:Consolas">    } </span></p>
<p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">return</span> <span style="color:blue">false</span>; <br></span><span style="font-size:10pt;font-family:Consolas">} </span></p>
<p>The only way to report the error is to use the following method instead, which uses GOTO statements. </p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">CREATE</span> <span style="color:blue">PROCEDURE</span> dbo<span style="color:gray">.</span>usp_Procedure_Name <br></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:green">-- parameter list <br></span></span><span style="font-size:10pt;color:blue;font-family:Consolas">AS </span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">SET</span> <span style="color:blue">NOCOUNT</span> <span style="color:blue">ON </span></span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">BEGIN</span> <span style="color:blue">TRANSACTION </span></span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">DECLARE</span> @Error <span style="color:blue">int </span></span></p>
<p><span style="font-size:10pt;color:green;font-family:Consolas">-- SQL Statement </span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">SET</span> @Error <span style="color:gray">=</span> <span style="color:fuchsia">@@ERROR <br></span></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">IF</span> <span style="color:gray">(</span>@Error <span style="color:gray">&lt;&gt;</span> 0<span style="color:gray">) <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">GOTO</span> ERROR_HANDLER </span></p>
<p><span style="font-size:10pt;color:green;font-family:Consolas">-- Next SQL Statement </span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">SET</span> @Error <span style="color:gray">=</span> <span style="color:fuchsia">@@ERROR <br></span></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">IF</span> <span style="color:gray">(</span>@Error <span style="color:gray">&lt;&gt;</span> 0<span style="color:gray">) <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">GOTO</span> ERROR_HANDLER </span></p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">COMMIT</span> <span style="color:blue">TRANSACTION <br></span></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">GOTO</span> END_RESULT </span></p>
<p><span style="font-size:10pt;font-family:Consolas">ERROR_HANDLER<span style="color:gray">: <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">ROLLBACK</span> <span style="color:blue">TRANSACTION </span></span></p>
<p><span style="font-size:10pt;font-family:Consolas">END_RESULT<span style="color:gray">: <br></span></span><span style="font-size:10pt;font-family:Consolas">    <span style="color:green">-- Do nothing <br></span></span><span style="font-size:10pt;font-family:Consolas">GO </span></p>
<p>This method reports the correct error number, but isn't nearly as readable. So from what I can tell, the new try…catch functionality isn't very helpful when trying to write conditional code based on the number of the error. I haven't had a chance to check out SQL Server 2008 yet, but hopefully , they decided to add support for rethrowing errors you've encountered. </p>
<p>Has anyone else seen this behavior and found a better way to deal with it?</p></div>]]></description></item><item><title>Getting a labeled set of files from Team System</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Mon, 16 Jul 2007 15:44:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClass0D671F1E60374D5F9AE53E029E49F86E>
<p>One of the great things about developing business software is that no matter how many features you build into an application, you can always think up more. In the project I'm on, we release new features to the client about once a month. This is fun! The client continually gets to request new features, and according to priority, we get to build them. It does, however, require frequent deployment, and it's important to take a snapshot of the source code each time you deploy in case a patch is required. </p>
<p>Team System allows you to take a snapshot of a set of files by applying a &quot;label.&quot; This snapshot can then be retrieved at a later date, modified, and re-deployed if necessary. To apply a label to a set of files:</p>
<ul>
<li>Open Source Control Explorer.</li>
<li>Browse to the folder containing the files, right click, and choose <strong>Apply Label</strong>.</li>
<li>With &quot;All files (*.*)&quot; selected in the <strong>Items of type</strong> dropdown, all of the files in the source control folder will be included in the snapshot. (In my version, this is the only option.) </li></ul>
<p>Creating the labeled set is pretty straightforward, but I've found retrieving the set to be a bit buggy if not done a certain way. I had never encountered any problems until switching to Windows Vista. </p>
<p>One error I've encountered when getting a labeled set is <em>&quot;Some:\FilePath\ToSomeFile.cs</em>: Cannot create a file when that file already exists.&quot; </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/071607_2243_Gettingalab1.gif"> </p>
<p><font color="#0000ff">[The following section was edited on 8/23/2007]</font></p>
<p>This issue seems to be a bug in the Visual Studio IDE. When you have the solution open and attempt to get a specific version, sometimes one or more (seemingly random) files can't be written to disk for some reason. It does, however, <strong>delete </strong>the culprit file from your file system. If you were forcing the get, you'll get the error message above. Otherwise, VS will quietly delete the file without telling you.</p>
<p>Even worse, once the file is deleted from your file system, Team System still thinks you have it, so future attempts to get the file will not fetch it. Without forcing the retrieval of the specific missing file, your solution is hosed.</p>
<p>I've found the following steps work when retrieving a labeled set of files. </p>
<ol>
<li><strong>Close your solution</strong></li>
<li>Open <strong>Source Control Explorer </strong>(aka Team Explorer) and browse to the root of the labeled location.</li>
<li>In the Version--&gt;Type dropdown, select &quot;<strong>Label</strong>.&quot; </li>
<li>
<div>You'll probably need to find the label, so </div></li>
<ul>
<li>Click the &quot;...&quot; button. </li>
<li>In the Find Label dialog, click &quot;Find&quot; after entering the appropriate search criteria. </li>
<li>Select the appropriate label from the Results list. </li>
<li>Click &quot;Close.&quot; (I think &quot;OK&quot; would have been more intuitive.) </li></ul>
<li>To make sure I get everything, I check the &quot;Overwrite writeable files that are not checked out&quot; and &quot;Force get of file versions already in workspace&quot; checkboxes. </li>
<li>Click &quot;<strong>Get</strong>.&quot; </li></ol>
<p>Visual Studio will now show a progress bar while it retrieves the files. When finished, you will have the snapshot source code on your local file system. </p>
<p><font color="#0000ff">[/end edited section]</font></p>
<p> </p></div>]]></description></item><item><title>return jedi;</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=24</link><pubDate>Mon, 02 Jul 2007 12:37:08 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=24#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass10533BAB56D840ADAE3FF4E66A14F2F4><p>I have a friend from India that has been living in the US for several years now, but has never seen any of the Star Wars films before.  I finally convinced him to come over and watch them at my apartment, at a rate of about one a week.  While watching Return of the Jedi last night, he asked me a question too funny to keep to myself.</p> <p>In the scene where Luke and Darth Vader enter the Emperor's throne room on the second Death Star, my friend turns to me and asks, &quot;<strong>How is Luke going to fight the emperor without his wand?</strong>&quot;.  The &quot;wand&quot; he was referring to was Luke's lightsaber that was confiscated from him when he turned himself in.  I started laughing of course, and then said the first thing that came to mind: &quot;Hey, this isn't Harry Potter you know!&quot;.</p> <p>Hope you get a good laugh out of this like I did.</p></div>]]></description></item><item><title>Dual-Monitor Wallpaper for Vista</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=10</link><pubDate>Wed, 27 Jun 2007 13:40:26 GMT</pubDate><slash:comments>4</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=10#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[My company, Vertigo, recently provided its engineers with brand new Vista development machines with some pretty impressive specs (thanks guys!!). And last year it was dual flat-panel monitors for everyone. When combined, it's a pretty sweet arrangement – just ask my colleague, Jeff Atwood, a huge fan of the multi-monitor setup (and UltraMon). He's got three!
Anyways, props to another colleague of mine, Daryll Herberger, for inspiring me and showing me how to create cool wallpaper for my dual-monitor setup, shown below.

	Yar! Perhaps this is common knowledge already, but here's how I did it:
Create or download cool artwork
Resize the image (e.g. in Paint) so the width of the image is double the resolution of a single monitor (e.g. if your resolution is 1280 x 1024, then resize it to 2560 x 1024 pixels)
In Vista, open the Control Panel, then click Change desktop background
		Browse to the image, select it as your background, click the Tile option, then click OK. Yar!
]]></description></item><item><title>this.IsParent = true;</title><link>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=23</link><pubDate>Mon, 25 Jun 2007 10:19:21 GMT</pubDate><slash:comments>5</slash:comments><comments>http://blogs.vertigo.com/personal/aanttila/Blog/Lists/Posts/Post.aspx?ID=23#Comments</comments><dc:creator>aanttila</dc:creator><description><![CDATA[<div class=ExternalClass934019CEC09C421FBD20B8673C230862><p>After nearly three years of trying, we found out Saturday morning that my wife (Kristi) is pregnant!  We have several months to go before we find out if it's a boy or a girl, but we don't really care which way it goes; we're just glad we're going to have a baby.</p> <p>I hope I'm up to the task ahead, and that I'll be able to deal with all of the diaper changing that's coming my way!</p></div>]]></description></item><item><title>Animating a GridLength</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=7</link><pubDate>Tue, 19 Jun 2007 17:15:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=7#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass92998C0E6E83413BA0FEDB7430C0E7ED>
<p>WPF provides several classes for animating many different types (e.g. <span style="font-family:Consolas">ColorAnimation</span> and <span style="font-family:Consolas">Rotation3DAnimation</span>) but none for animating a <span style="font-family:Consolas">GridLength</span> structure. I wanted such a class recently to create an animated navigation panel. There are a few <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=231925&amp;SiteId=1">MSDN</a> <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=344685&amp;SiteId=1">forum</a> <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1201785&amp;SiteId=1">posts</a> asking for much the same functionality and providing some solutions, much like what I present here. Mine differs in that I followed <a href="http://msdn2.microsoft.com/en-us/library/aa970564.aspx">the recommended approach</a> to creating such a class by spreading its functionality across two classes, <span style="font-family:Consolas">GridLengthAnimationBase</span> and <span style="font-family:Consolas">GridLengthAnimation</span>, the latter inheriting the former. This split facilitates creating additional derivations, such as <span style="font-family:Consolas">GridLengthAnimationUsingKeyFrames</span>. </p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">abstract</span> <span style="color:blue">class</span> <span style="color:#2b91af">GridLengthAnimationBase</span> : <span style="color:#2b91af">AnimationTimeline </span></span><br><span style="font-size:10pt;font-family:Consolas">    { </span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">override</span> <span style="color:blue">sealed</span> <span style="color:blue">object</span> GetCurrentValue(<span style="color:blue">object</span> defaultOriginValue, <span style="color:blue">object</span> defaultDestinationValue, <span style="color:#2b91af">AnimationClock</span> animationClock) </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">if</span>(!(defaultOriginValue <span style="color:blue">is</span> <span style="color:#2b91af">GridLength</span>)) </span><br><span style="font-size:10pt;font-family:Consolas">                <span style="color:blue">throw</span> <span style="color:blue">new</span> <span style="color:#2b91af">ArgumentException</span>(<span style="color:fuchsia">&quot;Parameter must be a GridLength.&quot;</span>, <span style="color:fuchsia">&quot;defaultOriginValue&quot;</span>); </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">if</span>(!(defaultDestinationValue <span style="color:blue">is</span> <span style="color:#2b91af">GridLength</span>)) </span><br><span style="font-size:10pt;font-family:Consolas">                <span style="color:blue">throw</span> <span style="color:blue">new</span> <span style="color:#2b91af">ArgumentException</span>(<span style="color:fuchsia">&quot;Parameter must be a GridLength.&quot;</span>, <span style="color:fuchsia">&quot;defaultDestinationValue&quot;</span>); </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">return</span> GetCurrentValueCore((<span style="color:#2b91af">GridLength</span>)defaultOriginValue, (<span style="color:#2b91af">GridLength</span>)defaultDestinationValue, animationClock); </span><br><span style="font-size:10pt;font-family:Consolas">        } </span><br> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">protected</span> <span style="color:blue">abstract</span> <span style="color:#2b91af">GridLength</span> GetCurrentValueCore(<span style="color:#2b91af">GridLength</span> defaultOriginValue, <span style="color:#2b91af">GridLength</span> defaultDestinationValue, <span style="color:#2b91af">AnimationClock</span> animationClock); </span><br> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">override</span> <span style="color:blue">sealed</span> <span style="color:#2b91af">Type</span> TargetPropertyType </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">get</span> { <span style="color:blue">return</span> <span style="color:blue">typeof</span>(<span style="color:#2b91af">GridLength</span>); } </span><br><span style="font-size:10pt;font-family:Consolas">        } </span><br><span style="font-size:10pt;font-family:Consolas">    } </span><br> <br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">class</span> <span style="color:#2b91af">GridLengthAnimation</span> : <span style="color:#2b91af">GridLengthAnimationBase </span></span><br><span style="font-size:10pt;font-family:Consolas">    { </span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">readonly</span> <span style="color:#2b91af">DependencyProperty</span> ByProperty= <span style="color:#2b91af">DependencyProperty</span>.Register(<span style="color:fuchsia">&quot;By&quot;</span>, </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">typeof</span>(<span style="color:blue">double</span>?), <span style="color:blue">typeof</span>(<span style="color:#2b91af">GridLengthAnimation</span>)); </span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">readonly</span> <span style="color:#2b91af">DependencyProperty</span> FromProperty= <span style="color:#2b91af">DependencyProperty</span>.Register(<span style="color:fuchsia">&quot;From&quot;</span>, </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">typeof</span>(<span style="color:blue">double</span>?), <span style="color:blue">typeof</span>(<span style="color:#2b91af">GridLengthAnimation</span>)); </span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">static</span> <span style="color:blue">readonly</span> <span style="color:#2b91af">DependencyProperty</span> ToProperty= <span style="color:#2b91af">DependencyProperty</span>.Register(<span style="color:fuchsia">&quot;To&quot;</span>, </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">typeof</span>(<span style="color:blue">double</span>?), <span style="color:blue">typeof</span>(<span style="color:#2b91af">GridLengthAnimation</span>)); </span><br> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">protected</span> <span style="color:blue">override</span> <span style="color:#2b91af">Freezable</span> CreateInstanceCore() </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">return</span> <span style="color:blue">new</span> <span style="color:#2b91af">GridLengthAnimation</span>(); </span><br><span style="font-size:10pt;font-family:Consolas">        } </span><br> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">protected</span> <span style="color:blue">override</span> <span style="color:#2b91af">GridLength</span> GetCurrentValueCore(<span style="color:#2b91af">GridLength</span> defaultOriginValue, <span style="color:#2b91af">GridLength</span> defaultDestinationValue, <span style="color:#2b91af">AnimationClock</span> animationClock) </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">double</span> fromValue= From.HasValue ? From.Value : defaultOriginValue.Value, toValue; </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">if</span>(To.HasValue) </span><br><span style="font-size:10pt;font-family:Consolas">                toValue= To.Value; </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">else</span> <span style="color:blue">if</span>(By.HasValue) </span><br><span style="font-size:10pt;font-family:Consolas">                toValue= fromValue + By.Value; </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">else </span></span><br><span style="font-size:10pt;font-family:Consolas">                <span style="color:blue">throw</span> <span style="color:blue">new</span> <span style="color:#2b91af">ApplicationException</span>(<span style="color:fuchsia">&quot;Specify either To or By in a GridLengthAnimation.&quot;</span>); </span><br><font style="background-color:whitesmoke"><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">return</span> <span style="color:blue">new</span> <span style="color:#2b91af">GridLength</span>(fromValue + animationClock.CurrentProgress.Value * (toValue - fromValue), <span style="color:#2b91af">GridUnitType</span>.Star); </span><br></font><span style="font-size:10pt;font-family:Consolas">        } </span><br> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">double</span>? By </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">get</span> { <span style="color:blue">return</span> (<span style="color:blue">double</span>?)<span style="color:blue">this</span>.GetValue(ByProperty); } </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">set</span> { <span style="color:blue">this</span>.SetValue(ByProperty, <span style="color:blue">value</span>); } </span><br><span style="font-size:10pt;font-family:Consolas">        } </span><br> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">double</span>? From </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">get</span> { <span style="color:blue">return</span> (<span style="color:blue">double</span>?)<span style="color:blue">this</span>.GetValue(FromProperty); } </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">set</span> { <span style="color:blue">this</span>.SetValue(FromProperty, <span style="color:blue">value</span>); } </span><br><span style="font-size:10pt;font-family:Consolas">        } </span><br> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> <span style="color:blue">double</span>? To </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">get</span> { <span style="color:blue">return</span> (<span style="color:blue">double</span>?)<span style="color:blue">this</span>.GetValue(ToProperty); } </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">set</span> { <span style="color:blue">this</span>.SetValue(ToProperty, <span style="color:blue">value</span>); } </span><br><span style="font-size:10pt;font-family:Consolas">        } </span><br><span style="font-size:10pt;font-family:Consolas">    } </span><br>
<p> </p>
<p>Note that my implementation assumes &quot;Star&quot; sizing (highlighted above) which is why the dependency properties are of type <span style="font-family:Consolas">Nullable&lt;double&gt;</span> instead of type <span style="font-family:Consolas">GridLength</span>. It is possible to modify it to support Pixel sizing as well but such an implementation must guard against animating between incompatible <span style="font-family:Consolas">GridLength</span> instances, such as from a Pixel-sized <span style="font-family:Consolas">GridLength</span> to a Star-sized <span style="font-family:Consolas">GridLength</span>. Besides, I didn't need any more than this for my animated navigation panel user control, shown here. </p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">    &lt;</span><span style="color:#a31515">Grid</span><span style="color:blue"> </span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">LayoutRoot</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:blue"> </span><span style="color:red">Height</span><span style="color:blue">=</span>&quot;<span style="color:blue">21.96</span>&quot;<span style="color:blue"> /&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:blue"> </span><span style="color:red">Height</span><span style="color:blue">=</span>&quot;<span style="color:blue">0*</span>&quot;<span style="color:blue"> /&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:blue"> </span><span style="color:red">Height</span><span style="color:blue">=</span>&quot;<span style="color:blue">21.96</span>&quot;<span style="color:blue"> /&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:blue"> </span><span style="color:red">Height</span><span style="color:blue">=</span>&quot;<span style="color:blue">*</span>&quot;<span style="color:blue"> /&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:blue"> </span><span style="color:red">Height</span><span style="color:blue">=</span>&quot;<span style="color:blue">21.96</span>&quot;<span style="color:blue"> /&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">RowDefinition</span><span style="color:blue"> </span><span style="color:red">Height</span><span style="color:blue">=</span>&quot;<span style="color:blue">0*</span>&quot;<span style="color:blue"> /&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;/</span><span style="color:#a31515">Grid.RowDefinitions</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">Button</span><span style="color:blue"> </span><span style="color:red">Content</span><span style="color:blue">=</span>&quot;<span style="color:blue">Button 1</span>&quot;<span style="color:blue"> </span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">button1</span>&quot;<span style="color:blue"> </span><span style="color:red">Click</span><span style="color:blue">=</span>&quot;<span style="color:blue">button_Click</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">Grid</span><span style="color:blue"> </span><span style="color:red">Grid.Row</span><span style="color:blue">=</span>&quot;<span style="color:blue">1</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">TextBlock</span><span style="color:blue"> </span><span style="color:red">Text</span><span style="color:blue">=</span>&quot;<span style="color:blue">Content 1</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">Button</span><span style="color:blue"> </span><span style="color:red">Content</span><span style="color:blue">=</span>&quot;<span style="color:blue">Button 2</span>&quot;<span style="color:blue"> </span><span style="color:red">Grid.Row</span><span style="color:blue">=</span>&quot;<span style="color:blue">2</span>&quot;<span style="color:blue"> </span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">button2</span>&quot;<span style="color:blue"> </span><span style="color:red">Click</span><span style="color:blue">=</span>&quot;<span style="color:blue">button_Click</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">Grid</span><span style="color:blue"> </span><span style="color:red">Grid.Row</span><span style="color:blue">=</span>&quot;<span style="color:blue">3</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">TextBlock</span><span style="color:blue"> </span><span style="color:red">Text</span><span style="color:blue">=</span>&quot;<span style="color:blue">Content 2</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">Button</span><span style="color:blue"> </span><span style="color:red">Content</span><span style="color:blue">=</span>&quot;<span style="color:blue">Button 3</span>&quot;<span style="color:blue"> </span><span style="color:red">Grid.Row</span><span style="color:blue">=</span>&quot;<span style="color:blue">4</span>&quot;<span style="color:blue"> </span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">button3</span>&quot;<span style="color:blue"> </span><span style="color:red">Click</span><span style="color:blue">=</span>&quot;<span style="color:blue">button_Click</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">Grid</span><span style="color:blue"> </span><span style="color:red">Grid.Row</span><span style="color:blue">=</span>&quot;<span style="color:blue">5</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">TextBlock</span><span style="color:blue"> </span><span style="color:red">Text</span><span style="color:blue">=</span>&quot;<span style="color:blue">Content 3</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">    &lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt; </span></span><br> <br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">public</span> <span style="color:blue">partial</span> <span style="color:blue">class</span> <span style="color:#2b91af">NavigationPanel </span></span><br><span style="font-size:10pt;font-family:Consolas">    { </span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">public</span> NavigationPanel() </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">this</span>.InitializeComponent(); </span><br><span style="font-size:10pt;font-family:Consolas">        } </span><br> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">private</span> <span style="color:blue">void</span> ExpandRow(<span style="color:blue">int</span> rowIndex) </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:#2b91af">RowDefinitionCollection</span> rowDefs= LayoutRoot.RowDefinitions; </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">for</span>(<span style="color:blue">int</span> i= <span style="color:red">1</span>; i &lt; rowDefs.Count; i += <span style="color:red">2</span>) </span><br><span style="font-size:10pt;font-family:Consolas">            { </span><br><span style="font-size:10pt;font-family:Consolas">                <span style="color:blue">if</span>((rowDefs[i].Height.Value == <span style="color:red">0</span>) == (i == rowIndex)) </span><br><span style="font-size:10pt;font-family:Consolas">                { </span><br><span style="font-size:10pt;font-family:Consolas">                    <span style="color:#2b91af">GridLengthAnimation</span> gla= <span style="color:blue">new</span> <span style="color:#2b91af">GridLengthAnimation</span>(); </span><br><span style="font-size:10pt;font-family:Consolas">                    gla.To= i == rowIndex ? <span style="color:red">1</span> : <span style="color:red">0</span>; </span><br><span style="font-size:10pt;font-family:Consolas">                    gla.Duration= <span style="color:blue">new</span> <span style="color:#2b91af">Duration</span>(<span style="color:#2b91af">TimeSpan</span>.FromSeconds(<span style="color:red">.125</span>)); </span><br><span style="font-size:10pt;font-family:Consolas">                    rowDefs[i].BeginAnimation(<span style="color:#2b91af">RowDefinition</span>.HeightProperty, gla); </span><br><span style="font-size:10pt;font-family:Consolas">                } </span><br><span style="font-size:10pt;font-family:Consolas">            } </span><br><span style="font-size:10pt;font-family:Consolas">        } </span><br> <br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">private</span> <span style="color:blue">void</span> button_Click(<span style="color:blue">object</span> sender, <span style="color:#2b91af">RoutedEventArgs</span> e) </span><br><span style="font-size:10pt;font-family:Consolas">        { </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:#2b91af">DependencyObject</span> dob= (<span style="color:#2b91af">DependencyObject</span>)sender; </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">int</span> rowIndex= (<span style="color:blue">int</span>)dob.GetValue(<span style="color:#2b91af">Grid</span>.RowProperty); </span><br><span style="font-size:10pt;font-family:Consolas">            <span style="color:blue">this</span>.ExpandRow(rowIndex + <span style="color:red">1</span>); </span><br><span style="font-size:10pt;font-family:Consolas">        } </span><br><span style="font-size:10pt;font-family:Consolas">    } </span><br>
<p> </p>
<p>It turns out I never needed this code but I provide it now for your edification.</p></div>]]></description></item><item><title>GridView, ObjectDataSource, DataSet, and Stored Procedures</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Fri, 15 Jun 2007 16:42:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass5DC49156C6AE48AB9683E377462FF7AC>
<p>I was planning to post about using a <span style="font-family:Consolas">GridView</span> inside of a <span style="font-family:Consolas">DetailsView</span> to show how to expose a one-to-many relationship when I ran into a problem with the default behavior of a <span style="font-family:Consolas">GridView</span>, an <span style="font-family:Consolas">ObjectDataSource</span>, and a <span style="font-family:Consolas">DataSet</span> that uses stored procedures, all generated by wizards. This problem has existed since VS.NET 2005 was first released and you can find it <a href="http://www.google.com/search?q=non-generic+method+'Update'+that+has+parameters">all over the Web</a>. I'll defer my original subject to a subsequent post and talk more about this problem and some ways to work around it. </p>
<p>Here is a list of directions to reproduce the problem. I kept it short since many other sites do it more extensively.</p>
<ol>
<li>Using VS.NET or VWD, create a new Web site. Add a database to the project. Add a single table to that database such as the <span style="font-family:Consolas">People</span> table shown here, but any table with a few columns and an identity primary key will do fine. Add a few rows of data to the table.<br><img alt="Create a site with a database containing one table." src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/061507_0025_GridViewand1.png"></li>
<li>Add a <span style="font-family:Consolas">DataSet</span> to the site and configure it to create new stored procedures. Query for all columns in the table created in step 1 as shown here.<br><img alt="Create a DataSet that uses stored procedures to query for all columns." src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/061507_0025_GridViewObj1.png"></li>
<li>Open Default.aspx and add a <span style="font-family:Consolas">GridView</span> to it. Configure it with a new <span style="font-family:Consolas">ObjectDataSource</span> that uses the <span style="font-family:Consolas">DataSet</span> created in step 2. Select &quot;Enable Editing&quot; as shown here.<br><img alt="Create an editable GridView bound to an ObjectDataSource that uses the DataSet." src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/061507_0025_GridViewObj2.png"></li>
<li>Run the application. When the grid appears, click &quot;Edit&quot; in any row. Then, click &quot;Update&quot;. You'll see the same error everyone else is seeing similar to that shown here.<br><img alt="Kaboom!" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/061507_0025_GridViewObj3.png"></li></ol>
<p>What can you do about it? Here are all of the ways I found on the Web to work around the problem.</p>
<ul>
<li><a href="http://weblogs.asp.net/bradygaster/archive/2006/09/26/How-to-Bloody-Your-Forehead.aspx">Allow editing the primary key column in the <span style="font-family:Consolas">GridView</span></a>. This is probably the quickest way to get your application to work but is also the most dangerous. This is not a viable work-around unless you're creating a tool for a DBA to make trouble for himself. </li>
<li><a href="http://forums.asp.net/t/969187.aspx">Change the <span style="font-family:Consolas">OldValuesParameterFormatString</span> property of the <span style="font-family:Consolas">ObjectDataSource</span> to &quot;<span style="font-family:Consolas">{0}</span>&quot;</a>. This is not a reliable work-around because people have reported three possible outcomes depending on your situation: it might work, it might not crash but also not update, or it might crash in the same way. Also, it will not work if you decide to change the <span style="font-family:Consolas">ConflictDetection</span> property of the <span style="font-family:Consolas">ObjectDataSource</span> to <span style="font-family:Consolas">CompareAllValues</span> because of the way the wizard-generated code uses the names generated from this property to reference the original values to implement optimistic concurrency.</li>
<li><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=522822&amp;SiteID=1">Change the primary key column in the <span style="font-family:Consolas">GridView</span> into a template column and change its binding from Eval to <span style="font-family:Consolas">Bind</span></a>. <span style="font-family:Consolas">Eval</span> is one-way while <span style="font-family:Consolas">Bind</span> is two-way. This requires you use template columns and display the primary key. </li>
<li><a href="http://geekswithblogs.net/mnf/archive/2006/09/01/89957.aspx">Change the <span style="font-family:Consolas">Update</span> method of the <span style="font-family:Consolas">DataSet</span></a>. This requires changing the underlying stored procedures generated by the wizard and regenerating the <span style="font-family:Consolas">DataSet</span>. </li></ul>
<p>I also created a couple of my own. </p>
<ul>
<li>In any template column, add a hidden input configured to run as a server control and bind its value to the primary key as shown here. It works if you're already using at least one template column and don't mind exposing the primary key in HTML. Normally, the primary key is kept in view state, which is encrypted by default.<br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">input</span> <span style="color:red">id</span><span style="color:blue">=&quot;PersonId&quot;</span> <span style="color:red">runat</span><span style="color:blue">=&quot;server&quot;</span> <span style="color:red">type</span><span style="color:blue">=&quot;hidden&quot;</span> <span style="color:red">value</span><span style="color:blue">='</span><span style="background-color:yellow">&lt;%</span># Bind(&quot;PersonId&quot;) <span style="background-color:yellow">%&gt;</span><span style="color:blue">'</span> <span style="color:blue">/&gt;</span></span> </li>
<li>Handle the <span style="font-family:Consolas">RowUpdating</span> event of the <span style="font-family:Consolas">GridView</span> and add the following line of code to the handler. This has the advantage of not exposing the primary key in the HTML but the disadvantage of requiring you write code.<br><span style="font-size:10pt;font-family:Consolas">e.NewValues[<span style="color:fuchsia">&quot;PersonId&quot;</span>]= e.OldValues[<span style="color:fuchsia">&quot;PersonId&quot;</span>]= e.Keys[<span style="color:fuchsia">&quot;PersonId&quot;</span>];</span> </li></ul>
<p><a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=111156">One Microsoft feedback page</a> says this issue is &quot;by design&quot; while <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=260674">another</a> admits it's a problem and says &quot;the fix will be available in the next VS release&quot;. Unfortunately, as of Orcas Beta 1, it still fails in the same way.</p></div>]]></description></item><item><title>Don’t be fooled by the JIT debugger error message.</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=11</link><pubDate>Tue, 12 Jun 2007 12:55:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=11#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClassAA1769CC1C0542EC99CD71F24096083F>(Reposted due to unbearable number of spam comments.)

<div class=ExternalClass8A63DF7CD5264A41A28DC54BFEEE5F55>
<p>The other day I came across the following weird error after changing one line of code in an ASP.NET 2.0 web app: </p>
<p>&quot;JIT Debugging failed with the following error: Access is denied.&quot; </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/error.jpg"></p>
<p>So I did what the message said to do… I checked the documentation for &quot;Just-in-time debugging, errors,&quot; specifically an error that mentions &quot;Access is denied.&quot; Not surprisingly, the docs kindly informed me that the user account the app ran under did not have permission to access the JIT Debugger. </p>
<p>Hmm. Just like the error message says, right? </p>
<p>I found this a bit fishy. I was able to access and debug other pages in the web app. I tried stepping through my code and found that the source of the problem was an infinite recursion which caused a <strong>stack overflow exception</strong>. For some reason VS2005 wasn't able to report this error. </p></div></div>]]></description></item><item><title>Rewards </title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=7</link><pubDate>Thu, 07 Jun 2007 16:14:25 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=7#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass645872A0696E43E1BC411C39A95B8688><p>Havin some fun at the Ronda celebration. 
</p><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/060707_2314_Rewards1.png" alt="">
	</p><p>Yeah, the movie kinda sucked. But who cares. 
</p><p>Ronda, we'll miss you…
</p><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/060707_2314_Rewards2.png" alt=""></p></div>]]></description></item><item><title>2012 London Olympics Logo: Not Going Down Memory Lane </title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Thu, 07 Jun 2007 15:49:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass19719EBE42E041BC9279F6A8352DCA14><p>The other day I learned that the design of the 2012 London Olympics logo was causing quite a stir in that great city. In fact, riots were threatening to erupt over it! With eye for images more than words I was curious to see it for myself. As someone trained in graphic design and having spent time in Europe I can tell you that, in general, the Europeans are pretty design savvy. Did you know that one of the best known styles of design was named after a small European country? 
</p><p>Logos are challenging to design. In one single image you are representing an entire organization and everything it is about. That's a tall order! Corporate logos are often less inspiring – their primary goal is to simply be immediately recognizable (and inoffensive). Even when used outside of its normal context you can surely recognize who this logo script belongs to:
</p><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/060707_2249_2012LondonO1.png" alt="">
	</p><p> But a logo for the Olympics should do more. It should inspire you to want to go. It should represent the unique host city or location. It should be universal in its appeal. You should see it all over everything for the next 4.5 years and not get tired of it. Does this logo do these things for you?
</p><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/060707_2249_2012LondonO2.jpg" alt="">
	</p><p>If the logo did not have those Olympic rings (required, I'm sure, of any Olympic logo) would you have any idea what it was for? Without those rings the logo would fall completely flat. It would recede from memory in approximately 23 seconds. 
</p><p>One of those near-rioters in London asked, &quot;If this was seen to be the best option just how bad could the failed logos be?&quot; Surely, the Olympic committee with never show us now!
</p><p>All I can say is, WTF? </p></div>]]></description></item><item><title>Building a WPF Tag Cloud</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=18</link><pubDate>Tue, 05 Jun 2007 14:50:14 GMT</pubDate><slash:comments>40</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=18#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClassCFE5F14F45EA40698F08816926A63A35><p><span style="font-family:Trebuchet MS;font-size:10pt">I just did some recent exploration in creating a <a href="http://en.wikipedia.org/wiki/Tagcloud"><span style="color:#669966;text-decoration:underline">tag cloud</span></a> with WPF. In particular, I wanted to be able to create a tag cloud of the lastnames for a collection of people. I came up with a solution that I'm happy with and would like to share. 
</span></p><p><span style="font-family:Trebuchet MS;font-size:10pt">You can see a screenshot of the prototype below.  The left Listbox is bounded to the collection of people and the right list is the tag cloud.  The size of the tags is based on the number of people with that lastname. Names can be added manually or updated in the top section. There is a Churn button to auto populate the people collection.
</span></p><p><a href="http://blogs.vertigosoftware.com/files/alan/WPFTagCloud.zip"><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/060507_2150_BuildingaWP1.png" alt="" border=0></a><span style="font-family:Trebuchet MS;font-size:10pt">
		</span></p><h2>Code
</h2><p><span style="font-family:Trebuchet MS;font-size:10pt">Surprisingly I was able to build the tag cloud with very little code.  Instead of generating the tag cloud on the fly each time or cached like most web-based solution, I wanted the tag cloud to be dynamic as new items are added and changed.  I also didn't want to roll my own class that keep tracks of the lastnames.  So I relied heavily on the built-in functionality and power of WPF and the .NET 3.0 Framework to accomplish this.
</span></p><h2>Tags and ListCollectionView
</h2><p><span style="font-family:Trebuchet MS;font-size:10pt">To get the list of tags, I created a ListCollectionView on the people collection and grouped it by added a GroupDescription on the &quot;Lastname&quot; property.  The PeopleTagCloud ListBox is bounded to the groups for that ListCollectionView.
</span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:green">// ListCollectionView is used for sorting and grouping
</span></span></p><p><span style="font-family:Consolas;font-size:10pt">    lcv = <span style="color:blue">new</span>
			<span style="color:#2b91af">ListCollectionView</span>(people);
</span></p><p>
 </p><p><span style="font-family:Consolas;font-size:10pt">    ...
</span></p><p>
 </p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:green">// Group the list by lastname, the tag cloud is based on the group Name and ItemCount
</span></span></p><p><span style="font-family:Consolas;font-size:10pt">    lcv.GroupDescriptions.Add(<span style="color:blue">new</span>
			<span style="color:#2b91af">PropertyGroupDescription</span>(<span style="color:#a31515">&quot;Lastname&quot;</span>));
</span></p><p><span style="font-family:Consolas;font-size:10pt">    PeopleTagCloud.ItemsSource = lcv.Groups;</span><span style="font-family:Trebuchet MS;font-size:10pt">
		</span></p><h2>Displaying the Tags
</h2><p><span style="font-family:Trebuchet MS;font-size:10pt">The PeopleTagCloud is just a Listbox that has a style to make it layout the items like a tag cloud. The trick is to replace the ItemsHost which originally is a StackPanel with a WrapPanel.  <a href="http://thewpfblog.com/?p=52">Lee Brimelow wrote</a> about this awhile back.
</span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Style</span><span style="color:blue">
			</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">TagsListBox</span>&quot;<span style="color:blue">
			</span><span style="color:red">TargetType</span><span style="color:blue">=</span>&quot;<span style="color:blue">{x:Type ListBox}</span>&quot;<span style="color:blue">&gt;
</span></span></p><p><span style="color:blue;font-family:Consolas;font-size:10pt">    …
</span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">      &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue">
			</span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">Template</span>&quot;<span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">        &lt;</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">          &lt;</span><span style="color:#a31515">ControlTemplate</span><span style="color:blue">
			</span><span style="color:red">TargetType</span><span style="color:blue">=</span>&quot;<span style="color:blue">{x:Type ListBox}</span>&quot;<span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">            &lt;</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">              &lt;</span><span style="color:#a31515">Border</span><span style="color:blue">
			</span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">Border</span>&quot;<span style="color:blue">
			</span><span style="color:red">BorderBrush</span><span style="color:blue">=</span>&quot;<span style="color:blue">{TemplateBinding BorderBrush}</span>&quot;<span style="color:blue">
			</span><span style="color:red">BorderThickness</span><span style="color:blue">=</span>&quot;<span style="color:blue">{TemplateBinding BorderThickness}</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">              &lt;</span><span style="color:#a31515">ScrollViewer</span><span style="color:blue">
			</span><span style="color:red">Margin</span><span style="color:blue">=</span>&quot;<span style="color:blue">1</span>&quot;<span style="color:blue">
			</span><span style="color:red">Style</span><span style="color:blue">=</span>&quot;<span style="color:blue">{DynamicResource SimpleScrollViewer}</span>&quot;<span style="color:blue">
			</span><span style="color:red">Focusable</span><span style="color:blue">=</span>&quot;<span style="color:blue">false</span>&quot;<span style="color:blue">
			</span><span style="color:red">Background</span><span style="color:blue">=</span>&quot;<span style="color:blue">{TemplateBinding Background}</span>&quot;<span style="color:blue">&gt;
</span></span></p><p>
 </p><p><span style="font-family:Consolas;font-size:10pt"><strong><span style="color:blue">                &lt;!--</span><span style="color:green"> Replaced the default StackPanel ItemsHost with a WrapPanel to get the TagCloud layout</span><span style="color:blue">--&gt;
</span></strong></span></p><p><span style="font-family:Consolas;font-size:10pt"><strong><span style="color:blue">                &lt;</span><span style="color:#a31515">WrapPanel</span><span style="color:blue">
				</span><span style="color:red">Margin</span><span style="color:blue">=</span>&quot;<span style="color:blue">2</span>&quot;<span style="color:blue">
				</span><span style="color:red">IsItemsHost</span><span style="color:blue">=</span>&quot;<span style="color:blue">true</span>&quot;<span style="color:blue">/&gt;
</span></strong></span></p><p>
 </p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">              &lt;/</span><span style="color:#a31515">ScrollViewer</span><span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">            &lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">          &lt;/</span><span style="color:#a31515">ControlTemplate</span><span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">        &lt;/</span><span style="color:#a31515">Setter.Value</span><span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">      &lt;/</span><span style="color:#a31515">Setter</span><span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    &lt;/</span><span style="color:#a31515">Style</span><span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Trebuchet MS;font-size:10pt">Recall that in the previous section the PeopleTagCloud is bounded to the groups of lastnames.  With that binding, I can simply create a DataTemplate to display the individual tags.  
</span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">DataTemplate</span><span style="color:blue">
			</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">TagCloudTemplate</span>&quot;<span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">      &lt;</span><span style="color:#a31515">TextBlock</span><span style="color:blue">
			</span><span style="color:red">Padding</span><span style="color:blue">=</span>&quot;<span style="color:blue">0,0,10,0</span>&quot;
</span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">
			</span><span style="color:red">FontSize</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Path=ItemCount, Converter={StaticResource CountToFontSizeConverter}}</span>&quot;<span style="color:blue">
			</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">
			</span><span style="color:red">Text</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Path=Name, Mode=Default}</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    &lt;/</span><span style="color:#a31515">DataTemplate</span><span style="color:blue">&gt;
</span></span></p><p><span style="font-family:Trebuchet MS;font-size:10pt">The text is bounded to the Name property and the FontSize is bounded to the ItemCount.  
</span></p><h2>CountToFontSizeConverter
</h2><p><span style="font-family:Trebuchet MS;font-size:10pt">To get the ItemCount to be a FontSize, I needed to create a value converter. The Convert method itself isn't that great but works. I'm sure someone can devise a better algorithm for the sizes.
</span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">class</span>
			<span style="color:#2b91af">CountToFontSizeConverter</span> : <span style="color:#2b91af">IValueConverter
</span></span></p><p><span style="font-family:Consolas;font-size:10pt">    {
</span></p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">        #region</span> IValueConverter Members
</span></p><p>
 </p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">public</span>
			<span style="color:blue">object</span> Convert(<span style="color:blue">object</span> value, <span style="color:#2b91af">Type</span> targetType, <span style="color:blue">object</span> parameter, System.Globalization.<span style="color:#2b91af">CultureInfo</span> culture)
</span></p><p><span style="font-family:Consolas;font-size:10pt">        {
</span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">const</span>
			<span style="color:blue">int</span> minFontSize = 6;
</span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">const</span>
			<span style="color:blue">int</span> maxFontSize = 38;
</span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">const</span>
			<span style="color:blue">int</span> increment = 3;
</span></p><p>            
 </p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">int</span> count = (<span style="color:blue">int</span>)value;
</span></p><p>
 </p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">return</span> ((minFontSize + count + increment) &lt; maxFontSize) ? (minFontSize + count + increment) : maxFontSize;
</span></p><p><span style="font-family:Consolas;font-size:10pt">        }
</span></p><p><span style="font-family:Consolas;font-size:10pt">…
</span></p><h2>ObservableCollection and INotifyPropertyChanged
</h2><p><span style="font-family:Trebuchet MS;font-size:10pt">How does the PeopleTagCloud know that it's being updated?  That's the beauty of inheriting from the ObservableCollection class. No extra code necessary in the presentation layer.
</span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">class</span>
			<span style="color:#2b91af">People</span> : <span style="color:#2b91af">ObservableCollection</span>&lt;<span style="color:#2b91af">Person</span>&gt; { }</span><span style="font-family:Trebuchet MS;font-size:10pt">
		</span></p><p><span style="font-family:Trebuchet MS;font-size:10pt">To get the PeopleTagCloud to update when the lastname is modified is a bit trickier.  I presumed that I can simply implement INotifyPropertyChanged. 
</span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">class</span>
			<span style="color:#2b91af">Person</span> : <span style="color:#2b91af">INotifyPropertyChanged</span></span><span style="font-family:Trebuchet MS;font-size:10pt">
		</span></p><p><span style="font-family:Trebuchet MS;font-size:10pt">This typically just works as you can see the effect on the PeopleListBox when the names are changed.  However, the ListViewCollection groups and ItemCount were not updated.  I needed to programmatically call the Refresh() method when the lastname is changed.
</span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">private</span>
			<span style="color:blue">void</span> TextBox_TextChanged(<span style="color:blue">object</span> sender, <span style="color:#2b91af">TextChangedEventArgs</span> e)
</span></p><p><span style="font-family:Consolas;font-size:10pt">        {
</span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:green">// Tell the ListCollectionView to update itself so that the groups and itemcount are updated
</span></span></p><p><span style="font-family:Consolas;font-size:10pt">
			<span style="color:blue">if</span> (lcv != <span style="color:blue">null</span>)
</span></p><p><span style="font-family:Consolas;font-size:10pt">                lcv.Refresh();
</span></p><p><span style="font-family:Consolas;font-size:10pt">        }
</span></p><p>
 </p><p><span style="font-family:Trebuchet MS;font-size:10pt">Because of this, there is slight performance on updating the tag cloud when the names are modified.  A possible solution might be to refresh after losing focus instead of TextChanged to lessen the cost of refreshing the groups.  Let me know if I'm missing something here.
</span></p><h2>Auto-Populating the Data
</h2><p><span style="font-family:Trebuchet MS;font-size:10pt">I just re-used the churning code by Kevin Moore in his <a href="http://work.j832.com/2007/05/kevins-bag-o-tricks-mix07-edition.html"></span>bag of tricks<span style="font-family:Trebuchet MS;font-size:10pt">. It uses a background thread to add the people.  The names are from the list of common names on <a href="http://names.mongabay.com/most_common_surnames.htm">names.mongabay.com</a>.
</span></p><h2>Source
</h2><p>You can download the source <a href="http://blogs.vertigosoftware.com/files/alan/WPFTagCloud.zip">here</a>.</p></div>]]></description></item><item><title>Routed Event Triggers in Silverlight 1.0 Beta</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=5</link><pubDate>Mon, 04 Jun 2007 17:29:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=5#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClassA5CF6D8873884DEDB542EF75F00128F8>
<p class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014>How do you handle a button click as the routed event in an event trigger in Silverlight 1.0 Beta? You don't, according to the <a href="http://msdn2.microsoft.com/en-us/library/bb190669.aspx">RoutedEvent Property</a> documentation. The only event supported in event triggers is the <span style="font-family:Consolas">Loaded</span> event. I can write the following XAML. </p>
<div class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">Canvas.Triggers</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">    &lt;</span><span style="color:#a31515">EventTrigger</span><span style="color:blue"> </span><span style="color:red">RoutedEvent</span><span style="color:blue">=</span>&quot;<span style="color:blue">Canvas.MouseLeftButtonDown</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">BeginStoryboard</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">                &lt;</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:blue"> </span><span style="color:red">BeginTime</span><span style="color:blue">=</span>&quot;<span style="color:blue">00:00:00</span>&quot;<span style="color:blue"> </span><span style="color:red">Storyboard.TargetName</span><span style="color:blue">=</span>&quot;<span style="color:blue">createdBy</span>&quot;<span style="color:blue"> </span><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=</span>&quot;<span style="color:blue">(UIElement.Opacity)</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">                    &lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:blue"> </span><span style="color:red">KeyTime</span><span style="color:blue">=</span>&quot;<span style="color:blue">00:00:00</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">0</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">                    &lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:blue"> </span><span style="color:red">KeyTime</span><span style="color:blue">=</span>&quot;<span style="color:blue">00:00:01.25</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">0.3</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">                    &lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:blue"> </span><span style="color:red">KeyTime</span><span style="color:blue">=</span>&quot;<span style="color:blue">00:00:01.90</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">0.75</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">                &lt;/</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">            &lt;/</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">        &lt;/</span><span style="color:#a31515">BeginStoryboard</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">    &lt;/</span><span style="color:#a31515">EventTrigger</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">Canvas.Triggers</span><span style="color:blue">&gt; </span></span><br></div>
<p class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014> </p>
<p class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014>But, I can't use it in Silverlight 1.0 Beta. Loading the page containing the control that hosts this XAML produces an error like this one. </p>
<p class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014><img alt="ParserError: Attribute Canvas.MouseLeftButtonDown value is out of range." src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/060507_0029_RoutedEvent1.png"> </p>
<p class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014>The work-around is to move this into a resource block and invoke it programmatically, like so. </p>
<div class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:#a31515">Canvas.Resources</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">    &lt;</span><span style="color:#a31515">Storyboard</span><span style="color:blue"> </span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">fadeInStoryboard</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:blue"> </span><span style="color:red">BeginTime</span><span style="color:blue">=</span>&quot;<span style="color:blue">00:00:00</span>&quot;<span style="color:blue"> </span><span style="color:red">Storyboard.TargetName</span><span style="color:blue">=</span>&quot;<span style="color:blue">createdBy</span>&quot;<span style="color:blue"> </span><span style="color:red">Storyboard.TargetProperty</span><span style="color:blue">=</span>&quot;<span style="color:blue">(UIElement.Opacity)</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:blue"> </span><span style="color:red">KeyTime</span><span style="color:blue">=</span>&quot;<span style="color:blue">00:00:00</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">0</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:blue"> </span><span style="color:red">KeyTime</span><span style="color:blue">=</span>&quot;<span style="color:blue">00:00:01.25</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">0.3</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">SplineDoubleKeyFrame</span><span style="color:blue"> </span><span style="color:red">KeyTime</span><span style="color:blue">=</span>&quot;<span style="color:blue">00:00:01.90</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">0.75</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">        &lt;/</span><span style="color:#a31515">DoubleAnimationUsingKeyFrames</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">    &lt;/</span><span style="color:#a31515">Storyboard</span><span style="color:blue">&gt; </span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">&lt;/</span><span style="color:#a31515">Canvas.Resources</span><span style="color:blue">&gt; </span></span></div>
<div class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014><span style="font-size:8pt;font-family:Consolas"><span style="color:blue"></span></span><br><span style="font-size:8pt;font-family:Consolas"><span style="color:blue">function</span> onMouseLeftButtonDown(sender, eventArgs) </span><br><span style="font-size:8pt;font-family:Consolas">{ </span><br><span style="font-size:8pt;font-family:Consolas">    <span style="color:blue">var</span> fadeInStoryboard= sender.findName(<span style="color:fuchsia">&quot;fadeInStoryboard&quot;</span>); </span><br><span style="font-size:8pt;font-family:Consolas">    fadeInStoryboard.begin(); </span><br><span style="font-size:8pt;font-family:Consolas">} </span><br></div>
<p class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014> </p>
<p class=ExternalClass5BBA9EAE31D74FE1B3B1F62955243014>Silverlight 1.1 has better support for XAML-based behaviors but is currently in Alpha.</p></div>]]></description></item><item><title>Commands in WPF</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=17</link><pubDate>Thu, 31 May 2007 11:23:26 GMT</pubDate><slash:comments>4</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=17#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass0D2713F0EB8B44818AD764FDD39CA2E0><p>I gave a short internal presentation @Vertigo last week about Commands in WPF. There's lot of information already on the web about this subject so I won't re-hash it here but instead link to the info instead.</p> <p><a href="http://www.samspublishing.com/articles/article.asp?p=688529&amp;seqNum=4&amp;rl=1">Adam Nathan’s sample chapter on Important New Concepts in WPF: Commands</a><b></b> <p><a href="http://www.microsoft.com/belux/msdn/nl/community/columns/jdruyts/wpf_commandpattern.mspx">MSDN article: The Command Pattern In WPF</a> <p><a href="http://nayyeri.net/archive/2007/05/15/how-to-add-commands-to-custom-wpf-control.aspx">Keyvan Nayyeri: How to Add Commands to Custom WPF Control</a> <p><a href="http://www.interact-sw.co.uk/iangblog/2005/05/19/avaloncommands">Ian Griffiths: Avalon Input, Commands, and Handlers</a> <p><a href="http://en.wikipedia.org/wiki/Command_pattern">Wikipedia: Command Pattern</a> <p><a href="http://msdn2.microsoft.com/en-us/library/ms752308.aspx#Four_main_Concepts">MSDN Library: Commanding Overview</a> <p><a href="http://msdn2.microsoft.com/en-us/library/ms752308.aspx#Four_main_Concepts">MSDN Library: CommandBinding Class</a> <p><a href="http://blogs.vertigo.com/personal/AlanL/Blog/default.aspx">MSDN Library: Input and Commands How-to Topics</a> <p><a href="http://msdn2.microsoft.com/en-us/library/system.windows.documents.editingcommands.aspx">MSDN Library: EditingCommands Class</a> <p><a href="http://msdn2.microsoft.com/en-us/library/system.windows.input.mediacommands.aspx">MSDN Library: MediaCommands Class</a> <p><a href="http://msdn2.microsoft.com/en-us/library/system.windows.input.applicationcommands.aspx">MSDN Library: ApplicationCommands Class</a> <p><a href="http://msdn2.microsoft.com/en-us/library/system.windows.input.navigationcommands.aspx">MSDN Library: NavigationCommands Class</a> <p><a href="http://msdn2.microsoft.com/en-us/library/system.windows.input.componentcommands.aspx">MSDN Library: ComponentCommands Class</a> <p>Also buried in the WPF SDK samples, there's a nice sample on RichTextBox editing which I've extended.  You can find it here: <a href="http://blogs.vertigosoftware.com/files/alan/richtexteditor.zip">RichTextEditor.zip</a></p> <p><a href="http://blogs.vertigosoftware.com/files/alan/richtexteditor.zip"><img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height=512 alt=image src="http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Attachments/17/image_thumb_1.png" width=672 border=0></a></p></div>]]></description></item><item><title>So you would like to have Vertigo build you a demo application? Well… </title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=5</link><pubDate>Wed, 23 May 2007 13:17:46 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=5#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass69E0C5CD87E5448E9D3B473E726E415D><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/052307_2017_Soyouwouldl1.png" alt="">
	</p><p>At <a href="http://www.vertigo.com">Vertigo</a>, we are often called on by clients to design and build demo applications (or web sites) that are used to present a product concept (or code sample) to an audience.  These demos are a lot of fun because they are generally not too tied to real-world limitations and we are encouraged to come up with very interesting, innovative concepts. To make sure you end up with exactly the kind of demo application that you need here are some recommendations to follow. After all, you probably have an audience to sway in your direction! 
</p><ul><li><strong>Know your goals
</strong></li></ul><p>What are the goals of your demo? What are you trying to accomplish? Would you like to get customer buy-in, get a project funded, or simply explore potential concepts? Clearly defining your goals can help you keep the discussions focused on delivering exactly what you need. It's easy to diverge into discussions outside the realm of the demo goals or be too concerned with designing the entire application (rather than a slice of it). While many good ideas come up during these discussion it's important to &quot;parking lot&quot; them for later use.<em>
		</em> For the demo application, stay focused on your more immediate needs. 
</p><ul><li><strong>Know your audience
</strong></li></ul><p>Who is the primary audience for the demo? Is it management or a technical audience with a lot of domain expertise? Are there political considerations? Do you need buy-in from other groups within your organization? The demo application should be designed to persuade your primary audience that it is a good concept. Naturally, there will be other audiences for the demo application, but in nearly every case there is one primary audience and that's the one that matters. 
</p><ul><li><strong>Pick the right format
</strong></li></ul><p>There are two key formats for demo applications – scenario-based and showcase. Scenario-based demos walk a sample user through one or more highly-scripted scenarios. These are often useful for customer buy-in because the audience can relate to the tasks and scenario flow. It demonstrates how the demo application can meet their needs. Showcase demos highlight an overall application concept or its unique features. These can be more free-form allowing for a less scripted experience, and are often used to get management or project funders excited about the overall concept. Of course, these two formats can be combined. Also, consider whether you need more depth – focusing on deep slices of specific functionality - or breadth – showcasing the global application concept with less detail. 
</p><ul><li><strong>Define the level of interactivity
</strong></li></ul><p>How much interactivity do you want the audience to have with the demo application? It can be as simple as a scripted walk through of static HTML screens or as complex as a fully interactive experience using a database for dynamic data storage and retrieval, with a lot of the application features &quot;wired up&quot; so the audience can get a real feel for the final product. A more interactive experience can be very compelling, but it requires more design time and more time to implement. 
</p><ul><li><strong>Understand that you don't have to get it perfectly right
</strong></li></ul><p>While a small percentage of demo applications need to be spot-on with the design and functionality, most don't. This is because you are presenting a product concept and not a product spec. While you could spend a lot of time discussing and tweaking content and functionality to make them perfect, it's more important to stay focused on an overall compelling concept (and your deadline!). Down the road when you design and implement the final product you can be diligent and thorough in your efforts. Today, just persuade your demo audience
</p><p><strong>The key is to stay on course with your demo application.</strong> It is only a small piece of the final, fully-implemented product. Plan your demo carefully and it will serve you well (and hopefully help get that big project funded!).   
</p><p>By the way, that screenshot above is from <a href="http://www.vertigo.com/familyshow.aspx">Family.Show</a>, a <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation">WPF</a> demo application that Vertigo design and built for <a href="http://www.microsoft.com/en/us/default.aspx">Microsoft</a>. This was a demo that was so successful both as a design effort and code sample that it just keeps going and going. Vertigo is <em>still</em> building on this &quot;demo&quot; application making it better and better. <a href="http://www.vertigo.com/familyshow.aspx">Try it</a> – it's fun! </p></div>]]></description></item><item><title>WPF Skinning Xbap</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=16</link><pubDate>Fri, 18 May 2007 14:50:50 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=16#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass166D3C73149443F88960AF5851ABAC84><p>Here is an Xbap version of my skinnable clock:
</p><p><a href="http://www.vertigo.com/downloads/wpfskinning/wpfskinningxbap.xbap">http://www.vertigo.com/downloads/wpfskinning/wpfskinningxbap.xbap</a>
	</p><p><a href="http://www.vertigo.com/downloads/wpfskinning/wpfskinningxbap.xbap"><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051807_2150_WPFSkinning1.png" alt="" border=0></a></p></div>]]></description></item><item><title>Skinning a WPF Application</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=15</link><pubDate>Thu, 17 May 2007 14:40:47 GMT</pubDate><slash:comments>10</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=15#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClassA29FA6397F38409295349437097A54AD><p>Yesterday, I wrote about the differences between <a href="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Post.aspx?ID=14">theming and skinning in WPF</a>. Today, I want to show how I plan to implement skinning a WPF application. 
</p><p>The general idea for skinning is to replace the application resource dictionary, which contains the styles, brushes, and templates, based on the user's input. In this case, the user can select a skin from a combo box. I will be using <a href="http://www.charlespetzold.com/blog/2006/04/070132.html">Petzold's excellent XAML Clock</a> to demonstrate. 
</p><p>Here is a screenshot of my skinnable XAML Clock. 
</p><p><a href="http://www.vertigo.com/downloads/wpfskinning/wpfskinningxbap.xbap"><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051707_2140_SkinningaWP1.png" alt="" border=0></a>
	</p><p>Here it is again with the Dark skin applied. I included four generic skins in this sample. 
</p><p><a href="http://www.vertigo.com/downloads/wpfskinning/wpfskinningxbap.xbap"><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051707_2140_SkinningaWP2.png" alt="" border=0></a>
	</p><p>In order to change the clock hands and tick marks, I apply the stroke and fill properties to dynamic resources. Here's the XAML for the Hour hand. Note that the Fill and Stroke properties are set to dynamic resources. 
</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;</span><span style="color:#a31515">Path</span><span style="color:blue">
			</span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">HourHandPath</span>&quot;<span style="color:blue">
			</span><span style="color:red">Data</span><span style="color:blue">=</span>&quot;<span style="color:blue">M 0 15 L 10 0, 0 -60, -10 0 Z</span>&quot; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    </span><span style="color:red">Fill</span><strong><span style="color:blue">=</span>&quot;<span style="color:blue">{DynamicResource HourHandFillBrush}</span>&quot;<span style="color:blue">
				</span><span style="color:red">Stroke</span><span style="color:blue">=</span>&quot;<span style="color:blue">{DynamicResource ClockHandsBrush}</span>&quot;</strong><span style="color:blue">&gt; </span></span>
	</p><p><span style="color:blue;font-family:Consolas;font-size:10pt">… </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;/</span><span style="color:#a31515">Path</span><span style="color:blue">&gt;</span></span>
	</p><p>These resources are declared inside of a Resource Dictionary: 
</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;</span><span style="color:#a31515">ResourceDictionary </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    </span><span style="color:red">xmlns</span><span style="color:blue">=</span>&quot;<span style="color:blue">http://schemas.microsoft.com/winfx/2006/xaml/presentation</span>&quot; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    </span><span style="color:red">xmlns:x</span><span style="color:blue">=</span>&quot;<span style="color:blue">http://schemas.microsoft.com/winfx/2006/xaml</span>&quot;<span style="color:blue">&gt; </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;</span><span style="color:#a31515">SolidColorBrush</span><span style="color:blue">
			</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">MainWindowBackgroundBrush</span>&quot;<span style="color:blue">
			</span><span style="color:red">Color</span><span style="color:blue">=</span>&quot;<span style="color:blue">#FFFFFFFF</span>&quot;<span style="color:blue">/&gt; </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><strong><span style="color:blue">&lt;</span><span style="color:#a31515">SolidColorBrush</span><span style="color:blue">
				</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">ClockHandsBrush</span>&quot;<span style="color:blue">
				</span><span style="color:red">Color</span><span style="color:blue">=</span>&quot;<span style="color:blue">#FF000000</span>&quot;<span style="color:blue">/&gt; </span></strong></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;</span><span style="color:#a31515">SolidColorBrush</span><span style="color:blue">
			</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">TicksStrokeBrush</span>&quot;<span style="color:blue">
			</span><span style="color:red">Color</span><span style="color:blue">=</span>&quot;<span style="color:blue">#FF000000</span>&quot;<span style="color:blue">/&gt; </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><strong><span style="color:blue">&lt;</span><span style="color:#a31515">SolidColorBrush</span><span style="color:blue">
				</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">HourHandFillBrush</span>&quot;<span style="color:blue">
				</span><span style="color:red">Color</span><span style="color:blue">=</span>&quot;<span style="color:blue">#FFA0A0A0</span>&quot;<span style="color:blue">/&gt; </span></strong></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;</span><span style="color:#a31515">SolidColorBrush</span><span style="color:blue">
			</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">MinuteHandFillBrush</span>&quot;<span style="color:blue">
			</span><span style="color:red">Color</span><span style="color:blue">=</span>&quot;<span style="color:blue">#FFE3E3E3</span>&quot;<span style="color:blue">/&gt; </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;</span><span style="color:#a31515">SolidColorBrush</span><span style="color:blue">
			</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">TextForegroundBrush</span>&quot;<span style="color:blue">
			</span><span style="color:red">Color</span><span style="color:blue">=</span>&quot;<span style="color:blue">#FF000000</span>&quot;<span style="color:blue">/&gt; </span></span>
	</p><p> 
 </p><p><span style="color:blue;font-family:Consolas;font-size:10pt">… </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;/</span><span style="color:#a31515">ResourceDictionary</span><span style="color:blue">&gt;</span></span>
	</p><p>The resource dictionary is then merged to be use by the application in App.xaml as follow: 
</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;</span><span style="color:#a31515">Application </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    </span><span style="color:red">xmlns</span><span style="color:blue">=</span>&quot;<span style="color:blue">http://schemas.microsoft.com/winfx/2006/xaml/presentation</span>&quot; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    </span><span style="color:red">xmlns:x</span><span style="color:blue">=</span>&quot;<span style="color:blue">http://schemas.microsoft.com/winfx/2006/xaml</span>&quot; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    </span><span style="color:red">x:Class</span><span style="color:blue">=</span>&quot;<span style="color:blue">WPFSkinning.App</span>&quot; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    </span><span style="color:red">StartupUri</span><span style="color:blue">=</span>&quot;<span style="color:blue">Window1.xaml</span>&quot;<span style="color:blue">&gt; </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Application.Resources</span><span style="color:blue">&gt; </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">        &lt;!--</span><span style="color:green"> Resources scoped at the Application level should be defined here. </span><span style="color:blue">--&gt; </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><strong><span style="color:blue">        &lt;</span><span style="color:#a31515">ResourceDictionary</span><span style="color:blue">&gt; </span></strong></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><strong><span style="color:blue">            &lt;</span><span style="color:#a31515">ResourceDictionary.MergedDictionaries</span><span style="color:blue">&gt; </span></strong></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><strong><span style="color:blue">                &lt;</span><span style="color:#a31515">ResourceDictionary</span><span style="color:blue">
				</span><span style="color:red">Source</span><span style="color:blue">=</span>&quot;<span style="color:blue">Skins\Default\DefaultResources.xaml</span>&quot;<span style="color:blue">/&gt; </span></strong></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><strong><span style="color:blue">            &lt;/</span><span style="color:#a31515">ResourceDictionary.MergedDictionaries</span><span style="color:blue">&gt; </span></strong></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><strong><span style="color:blue">        &lt;/</span><span style="color:#a31515">ResourceDictionary</span><span style="color:blue">&gt; </span></strong></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">    &lt;/</span><span style="color:#a31515">Application.Resources</span><span style="color:blue">&gt; </span></span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">&lt;/</span><span style="color:#a31515">Application</span><span style="color:blue">&gt;</span></span>
	</p><p>I organized each of the skin resources into their own resource dictionaries in separate folders. 
</p><p><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051707_2140_SkinningaWP3.png" alt="">
	</p><p>To change the skin based on the combo box, I have an event handler for the selection changed event. The skins are loaded with Application.LoadComponent which makes them objects. The application resources are then changed to the new resource dictionary for the corresponding skin. 
</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">private</span>
			<span style="color:blue">void</span> SkinsComboBox_SelectionChanged(<span style="color:blue">object</span> sender, <span style="color:#2b91af">SelectionChangedEventArgs</span> e) </span>
	</p><p><span style="font-family:Consolas;font-size:10pt">{ </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:#2b91af">ResourceDictionary</span> rd; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">switch</span> ((<span style="color:#2b91af">Skin</span>)((<span style="color:#2b91af">ComboBox</span>)sender).SelectedItem) </span>
	</p><p><span style="font-family:Consolas;font-size:10pt">{ </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">case</span>
			<span style="color:#2b91af">Skin</span>.Dark: </span>
	</p><p><span style="font-family:Consolas;font-size:10pt">rd = <span style="color:#2b91af">Application</span>.LoadComponent(<span style="color:blue">new</span>
			<span style="color:#2b91af">Uri</span>(<span style="color:#a31515">@&quot;Skins/Dark/DarkResources.xaml&quot;</span>, <span style="color:#2b91af">UriKind</span>.Relative)) <span style="color:blue">as</span>
			<span style="color:#2b91af">ResourceDictionary</span>; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">break</span>; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">case</span>
			<span style="color:#2b91af">Skin</span>.Triangle: </span>
	</p><p><span style="font-family:Consolas;font-size:10pt">rd = <span style="color:#2b91af">Application</span>.LoadComponent(<span style="color:blue">new</span>
			<span style="color:#2b91af">Uri</span>(<span style="color:#a31515">@&quot;Skins/Triangle/TriangleResources.xaml&quot;</span>, <span style="color:#2b91af">UriKind</span>.Relative)) <span style="color:blue">as</span>
			<span style="color:#2b91af">ResourceDictionary</span>; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">break</span>; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">case</span>
			<span style="color:#2b91af">Skin</span>.Blue: </span>
	</p><p><span style="font-family:Consolas;font-size:10pt">rd = <span style="color:#2b91af">Application</span>.LoadComponent(<span style="color:blue">new</span>
			<span style="color:#2b91af">Uri</span>(<span style="color:#a31515">@&quot;Skins/Blue/BlueResources.xaml&quot;</span>, <span style="color:#2b91af">UriKind</span>.Relative)) <span style="color:blue">as</span>
			<span style="color:#2b91af">ResourceDictionary</span>; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">break</span>; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">default</span>: </span>
	</p><p><span style="font-family:Consolas;font-size:10pt">rd = <span style="color:#2b91af">Application</span>.LoadComponent(<span style="color:blue">new</span>
			<span style="color:#2b91af">Uri</span>(<span style="color:#a31515">@&quot;Skins/Default/DefaultResources.xaml&quot;</span>, <span style="color:#2b91af">UriKind</span>.Relative)) <span style="color:blue">as</span>
			<span style="color:#2b91af">ResourceDictionary</span>; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:blue">break</span>; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt">} </span>
	</p><p><span style="font-family:Consolas;font-size:10pt"><span style="color:#2b91af">Application</span>.Current.Resources = rd; </span>
	</p><p><span style="font-family:Consolas;font-size:10pt">} </span>
	</p><p>You can try the XBAP here: <a href="http://www.vertigo.com/downloads/wpfskinning/wpfskinningxbap.xbap">WPF Skinnable Clock XBAP</a>
	</p><p>You can download the source here: <a href="http://blogs.vertigosoftware.com/files/alan/wpfskinning.zip">WPF Skinning</a></p></div>]]></description></item><item><title>The carbon cost of doing business</title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Thu, 17 May 2007 14:17:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass20039672D4E840C0895B7133FABCE3A4><p>Let's face it. As far as we've come with telecommuting and teleconferencing the face-to-face meeting is still an important part of doing business. Early in an engagement it builds trust - as time goes on it builds relationships. But the face-to-face meeting has a cost. This cost is not only in a travel expense to the client or vendor, but also in the environmental impact of travel. When the business is done locally the cost is low. But when air travel is required the environmental cost becomes very high.  
</p><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/051707_2116_Thecarbonco1.png" alt="">
	</p><p>I recently flew back and forth in one day from Oakland, CA to Seattle, WA for a 2 hour client presentation. The presentation was critical to maintain the successful trajectory of the project and having the entire team in the room was the most effective way to accomplish this. Only when in the same room can you truly gauge a client's response to your work through body language and have the frank discussions that being in person enables. I don't know an equally effective, environmentally zero-impact way around this. Though most of our meetings are by phone, the important ones simply work better in person. 
</p><p>Using the carbon calculator on the <a href="http://www.climatecrisis.net/takeaction/carboncalculator/">Inconvenient Truth</a> web site I calculated that the carbon cost of my round trip to Seattle was .20 tons.  Making several of these trips a year – which I do – causes my overall yearly carbon cost to skyrocket above the average for the US (I was surprised and sadly disappointed that I, a mid-grade environmentalist, was playing an above average role in global warming). To make up for the business air travel carbon cost I'd essentially have to bike to work and live in a tent. 
</p><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/051707_2116_Thecarbonco2.png" alt="">
	</p><p>There is another unsightly and equally dangerous impact from air travel. Have you ever looked up at the deep blue sky on a beautiful, clear day only to see a criss-cross pattern of <a href="http://www.flickr.com/photos/tags/jettrails/">jettrails</a>? Just think of the wonderful view you would have were it not for those man-made clouds. And, in fact, they are man-made clouds because after enough of them appear in the atmosphere they impact the weather. The jettrails also contribute to <a href="http://en.wikipedia.org/wiki/Global_dimming">global dimming</a>. Global dimming is caused by black carbon particles in the atmosphere blocking radiation from the sun. This causes a cooling effect in the atmosphere that contrasts with the warmth-trapping effect of the causes of global warming. The deep concern is that global dimming is masking the true impact of global warming. Some say that if we are successful at clearing the air of carbon pollution (and we are making progress in doing that) more radiation will enter the atmosphere, become trapped by the causes of global warming, and cause it to spike. 
</p><p>The global economy is here to stay and with it the carbon cost of doing business. Even though we can take steps to improve the environment by choosing to eat locally, it's a far greater challenge to only do business locally. That can be done if you are a masseuse, but far more challenging if you are a <a href="http://www.vertigo.com/">custom software firm</a> with clients around the country.  
</p><p>So, I don't have a good answer yet, and in the meantime business goes on.  But for my son and generations down the line I will keep working on lowering the carbon cost of doing business. </p></div>]]></description></item><item><title>WPF Theming vs Skinning</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=14</link><pubDate>Wed, 16 May 2007 14:34:17 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=14#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass8E9D00FF81464D1481236BA894884781><p><img align=right src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051607_2134_WPFThemingv1.png" alt=""><span style="font-family:Trebuchet MS;font-size:10pt">Coming from an ASP.NET background, theming meant the ability to customize the look and feel of a site.  Skinning is the process of applying a particular &quot;skin&quot;, a collection of styles including changes to layout to the site.  However, this is not the case in WPF.
</span></p><p><span style="font-family:Trebuchet MS;font-size:10pt">In WPF, a theming and skinning takes on slight variations to their meanings. <strong> Theming refers to controlling the look and consistency of an application UI to match the operating system.</strong>  For example, a WPF application can be themed for the Windows Aero theme or the Windows Classic Theme.  <strong>Skinning refers to changing the application's appearance.</strong>  In other words, applying or letting the user pick a skin to change the look and feel of the application.
</span></p><p><a href="http://notstatic.com/archives/10"><span style="color:#669966;font-family:Trebuchet MS;font-size:10pt;text-decoration:underline">Robby Ingrebertsen</span></a><span style="font-family:Trebuchet MS;font-size:10pt">, while working on the WPF team, simplifies it as follows:
</span></p><blockquote><p><em>Around here, we generally say that &quot;theming&quot; refers to the system theme and &quot;skinning&quot; refers to changes to a specific app. This has helped to clarify our internal communication.
</em></p></blockquote><p><span style="font-family:Trebuchet MS;font-size:10pt">This distinction is important as we are working on expanding Family.Show to support skinning.  Look for more to come.</span></p></div>]]></description></item><item><title>Windows Vista Sidebar and Gadgets</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=13</link><pubDate>Wed, 16 May 2007 13:54:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=13#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass47EEBCA7050142378B444437FE34EA59>
<p><img alt="" src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051607_2054_WindowsVist1.png"> </p>
<p>I've been using Windows Vista for awhile now and the Sidebar is one of my favorite features.  I continually want to know the status of my system as well as other information that I find useful.  The Gadgets gives me this information at a glance. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051607_2054_WindowsVist2.png" align=left>Since the Sidebar and gadget is always there on the desktop, I want them to be informative but not distracting.  I customized the opacity of all the gadgets in my Sidebar to 40%. If I want to focus on a gadget I just hover my mouse over it. </p>
<p>Here are some of the Sidebar Gadgets that I use. </p>
<h1>Multi Meter </h1>
<p><a href="http://gallery.live.com/liveItemDetail.aspx?li=f5b13626-b266-4334-b2e5-157bd66ca5af&amp;bt=1&amp;pl=1">Multi Meter</a> displays CPU and RAM usage in an aesthetic way with percentages and bar graphs.  The bar graphs are color coded for additional information.  This gadget, like all the gadgets by SFKilla from the Hobby Lounge, even supports multiple skins.  Double-clicking on this gadget will quickly bring up the Task manager.  I often check this gadget when Vista is being unresponsive. </p>
<p> </p>
<h1>CPU Utilization </h1>
<p>Like Multi Meter and as it name implies, the <a href="http://gallery.live.com/liveItemDetail.aspx?li=08318f8d-c4f7-431e-8631-d5121d62926c&amp;bt=1&amp;pl=1">CPU Utilization</a> gadget displays CPU usage but presented in typical linegraph form as displayed in the Task Manager. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051607_2054_WindowsVist3.png"> </p>
<h1>Ping Gadget </h1>
<p>Latency is important is important to me.  The <a href="http://gallery.live.com/liveItemDetail.aspx?li=9bf4a2ae-7103-463e-956d-0f83206cd6bf&amp;bt=1">Ping gadget</a> will graph the ping query to a specified site.  I can also tell if my internet is down or not from this gadget.  I use to open a command prompt and leave it open with the &quot;ping -t www.google.com&quot;.  This gadget replaces doing just that. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051607_2054_WindowsVist4.png"> </p>
<h1>Weather and Slide Show Gadgets </h1>
<p>The Weather and Slideshow gadgets are the only gadgets that ships with Vista that I use.  </p>
<p>The Weather gadget is appealing to look it.  I can immediate tell if it's sunny, cloudy, or raining outside based on the gadgets background while I'm stuck inside the office.  Knowing the local temperature is also useful. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051607_2054_WindowsVist5.png"> </p>
<p>The Slide Show gadget is pleasing to look at.  I point it to my collection of wallpaper photos.  It's great for a minor distraction and often times inspiring to look at. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051607_2054_WindowsVist6.png"> </p>
<h1>Traffic by Live Search Maps </h1>
<p><a href="http://gallery.live.com/liveItemDetail.aspx?li=d5ad423c-05bd-4de4-8803-b05ecc339397&amp;l=1">Traffic by Live Search Maps</a> is useful right before heading home from work.  My commute takes me by the MacArthur Maze in Oakland.  I use this gadget to gauge how long my commute will be. On days where I see long stretches of red, I stay a little later at work to be more productive so that the traffic can clear up. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/051607_2054_WindowsVist7.png"> </p>
<p>     </p>
<p>    </p></div>]]></description></item><item><title>Running Vista on a MacBook Pro</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=33</link><pubDate>Mon, 14 May 2007 14:41:00 GMT</pubDate><slash:comments>9</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=33#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass79DB01CC9E7E4B0DAA53BE76AE8E308A>
<div>
<div class=Section1>
<p class=MsoNormal>So I broke down and joined the hip world with a purchase of $2500 MacBook Pro last week. </p>
<p class=MsoNormal>I could justify all the iPods. And the 23” flat screen. But making the full jump into Mac OS X was hard. I felt like I was cheating.</p>
<p class=MsoNormal>But I am running Vista on it, but not in dual-boot mode: I run Vista in a virtual machine. </p>
<p class=MsoNormal><img id="Picture_x0020_0" height=886 alt=mac-osx-vista-fullscreen.jpg src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Posts/Attachments/33/image001.jpg" width=1417></p>
<p class=MsoNormal>Imagine this: last week I did a 2 hour WPF, Atlas and Silverlight presentation for the San Luis Obispo .NET Users Group. I ran Vista insidea <a href="http://www.parallels.com/">Parallels</a> virtual machine. At the end, I set a breakpoint in the Silverlight app, alt-tabbed back to Mac OS X and hit the page from Safari. People flipped out.</p>
<p class=MsoNormal>Impressions of the Mac universe so far:</p>
<blockquote dir=ltr style="margin-right:0px">
<p class=MsoListParagraph style="text-indent:-0.25in"><span>1.<span style="font:7pt 'Times New Roman'">       </span></span>Mac OS X takes 20 seconds to cold boot. And shutdown takes about 2 seconds. Recover from sleep is instantaneous.</p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>2.<span style="font:7pt 'Times New Roman'">       </span></span>Stuff just works. Like my Sprint cell modem and mouse drivers. </p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>3.<span style="font:7pt 'Times New Roman'">       </span></span>Installing (and uninstalling) software is really easy. </p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>4.<span style="font:7pt 'Times New Roman'">       </span></span>They have too many funky keys: fn, ctrl, alt/option, apple and clover key. Way too many.</p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>5.<span style="font:7pt 'Times New Roman'">       </span></span>Vertical scrolling with two fingers is fantastic.</p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>6.<span style="font:7pt 'Times New Roman'">       </span></span>The hardware is, well, beautiful. I can’t stop stroking the aluminum case.</p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>7.<span style="font:7pt 'Times New Roman'">       </span></span>The magnetic power catch is the first thing I show. Then <a href="http://www.apple.com/imac/isight.html">PhotoBooth</a>. </p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>8.<span style="font:7pt 'Times New Roman'">       </span></span>I hate not having the right mouse button. </p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>9.<span style="font:7pt 'Times New Roman'">       </span></span>The magnifying dock thing is cute for about half a day, then you turn it off.</p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>10.<span style="font:7pt 'Times New Roman'">   </span></span>Front-loading DVDs. Why do we still have stupid trays?</p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>11.<span style="font:7pt 'Times New Roman'">   </span></span>And why don’t we have Firewire 800 in the PC world? Good luck finding that support. </p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>12.<span style="font:7pt 'Times New Roman'">   </span></span>Plugging in an external video projector just works. Amazing. </p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>13.<span style="font:7pt 'Times New Roman'">   </span></span>I really dislike the Apple startup sound. I don’t think you can turn it off. Microsoft has the big edge here on Vista sounds.</p></blockquote></div></div></div>]]></description></item><item><title>Worthless pie charts</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=32</link><pubDate>Fri, 11 May 2007 14:49:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=32#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClassFB3D0581401444ACA105E3E1C73FD028>
<div>
<div class=Section1>
<p class=MsoNormal>Not sure exactly where I came across these, but they’re worth keeping:</p>
<p class=MsoNormal> </p>
<p class=MsoNormal> </p>
<p class=MsoNormal><img id="Picture_x0020_8" height=183 alt="http://my/personal/scott/Blog/Lists/Posts/Attachments/32/image003.png" src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Posts/Attachments/32/image003.png" width=250></p>
<p class=MsoNormal> </p>
<p class=MsoNormal> </p>
<p class=MsoNormal><span style="color:#1f497d"></span> </p>
<p class=MsoNormal><img id="Picture_x005f_x005f_x005f_x0020_3" height=304 src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Posts/Attachments/32/image001.png" width=750><span style="color:#1f497d"></span></p>
<p class=MsoNormal><span style="color:#1f497d"></span> </p>
<p class=MsoNormal><span style="color:#1f497d"></span> </p>
<p class=MsoNormal><span style="color:#1f497d"></span> </p>
<p class=MsoNormal><span style="color:#1f497d"></span> </p>
<p class=MsoNormal><img id="Picture_x005f_x005f_x005f_x0020_1" height=365 src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Posts/Attachments/32/image004.png" width=492><span style="font-size:12pt;font-family:'Times New Roman','serif'"> </span></p></div></div></div>]]></description></item><item><title>1 text box > 2 text boxes</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=31</link><pubDate>Fri, 11 May 2007 14:44:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=31#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClassA9C081601E1D4C06945CC293593A066B>
<div>
<div class=Section1>
<p class=MsoNormal>The two great mapping sites are <a href="http://www.google.com/maps">www.google.com/maps</a> and <a href="http://local.live.com/">http://local.live.com</a>. </p>
<p class=MsoNormal> </p>
<p class=MsoNormal>The first 5 seconds people interact with these sites focus on the text boxes at the top of the page. While Microsoft needs <b>two text boxes</b> to perform an address vs. business search, <b>Google can do it in one</b>. They simply put the business logic on the server side rather than <a href="http://tinyurl.com/2yfe9j">require the end user to think</a> (Steve Krug’s must-read book for developers):</p>
<p class=MsoNormal> </p>
<p class=MsoNormal> </p>
<p class=MsoNormal><a href="http://www.amazon.com/gp/product/images/0321344758/sr=8-1/qid=1178917145/ref=dp_image_0/002-6012845-8055224?ie=UTF8&amp;n=283155&amp;s=books&amp;qid=1178917145&amp;sr=8-1"><span style="color:windowtext;text-decoration:none"><img id=prodImage height=240 alt="Don't Make Me Think: A Common Sense Approach to Web Usability (2nd Edition)" src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Posts/Attachments/31/image003.jpg" width=240 border=0></span></a></p>
<p class=MsoNormal> </p>
<p class=MsoNormal><b>Google: one box.</b></p>
<p class=MsoNormal><img id="Picture_x0020_1" height=98 alt="http://my/personal/scott/Blog/Lists/Posts/Attachments/31/image001.png" src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Posts/Attachments/31/image001.png" width=680 border=0></p>
<p class=MsoNormal> </p>
<p class=MsoNormal> </p>
<p class=MsoNormal>When local.live.com originally launched, I thought it was broken. I kept putting my address in the first box. And I know (usually) what I’m doing. I wasn’t the only one: several other talented engineers here did the same thing.</p>
<p class=MsoNormal> </p>
<p class=MsoNormal><b>Microsoft: two boxes.</b></p>
<p class=MsoNormal> </p>
<p class=MsoNormal><img id="Picture_x0020_2" height=275 alt="http://my/personal/scott/Blog/Lists/Posts/Attachments/31/image002.png" src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Posts/Attachments/31/image002.png" width=839 border=0></p>
<p class=MsoNormal> </p>
<p class=MsoNormal> </p>
<p class=MsoNormal> </p>
<p class=MsoNormal> </p>
<p class=MsoNormal>When we learned it was <i>our </i>mistake, we felt stupid. And web sites that make you feel stupid are not likely to be visited again.</p>
<p class=MsoNormal> </p>
<p class=MsoNormal>I’d be interested in a little web usability shoot-out between these two sites. </p>
<p class=MsoNormal> </p>
<p class=MsoNormal>Lessons learned:</p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>1.<span style="font:7pt 'Times New Roman'">       </span></span>Default (first box) should be <b>address</b>. My guess is most people use a map to find something based on an address.</p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>2.<span style="font:7pt 'Times New Roman'">       </span></span>People don’t read the web, they scan. And they certainly don’t read textbox watermarks.</p>
<p class=MsoListParagraph style="text-indent:-0.25in"><span>3.<span style="font:7pt 'Times New Roman'">       </span></span>Simple is better.</p>
<p class=MsoNormal> </p>
<p class=MsoNormal>BTW, I know google “hides” the second text box with the “find businesses” tab, but the first mode works with a business search anyway.</p>
<p class=MsoNormal> </p>
<p class=MsoNormal>Props to Microsoft though: the bird’s eye view is amazing. Far better than Satellite IMO.</p>
<p class=MsoNormal> </p>
<p class=MsoNormal><br><br></p>
<p class=MsoNormal> </p></div></div></div>]]></description></item><item><title>WPF Feedback from Family.Show</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=12</link><pubDate>Wed, 09 May 2007 13:59:30 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=12#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass3B7E78A5B5DD4ED7A6425C5E976A2D48><p>A month or so before releasing Family.Show, Scott Stanfield (Vertigo's CEO) asked the team what are our top 5 favorite WPF features. We gathered our feedback and sent them to him in a single email which ended up on the <a href="http://www.vertigo.com/familyshow.aspx">Family.Show page</a> on Vertigo.com. Here is my WPF feedback verbatim from the email. You can read the <a href="http://www.vertigo.com/downloads/familyshow/TeamFeedback.xps">full XPS document</a> for the rest of the team's feedback including our Design Director's point of view. 
</p><p> <strong>From Alan
</strong></p><p>
 </p><p style="margin-left:18pt"><span style="color:#1f497d"><strong>Databinding in WPF
</strong></span></p><p style="margin-left:36pt"><span style="color:#1f497d">Almost every object in WPF supports databinding.  Binding object opens a channel of communication between the binding source and target.
</span></p><p style="margin-left:36pt">
 </p><p style="margin-left:36pt"><span style="color:#1f497d"><span style="text-decoration:underline">Binding set in Xaml</span>:
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">&lt;</span><span style="color:#a31515">TextBox</span><span style="color:blue">
			</span><span style="color:red">Text</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Path=FirstName}</span>&quot; <span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">FirstNameTextBox</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:36pt">
 </p><p style="margin-left:36pt"><span style="color:#1f497d;text-decoration:underline">Binding set in code</span><span style="color:blue;font-family:Consolas;font-size:10pt">:
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:#2b91af">Binding</span> bind = <span style="color:blue">new</span>
			<span style="color:#2b91af">Binding</span>();
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">bind.Source = Person;
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">bind.Path = <span style="color:#a31515">&quot;FirstName&quot;</span>;
</span></p><p><span style="font-family:Consolas;font-size:9pt">FirstNameTextBox.SetBinding(<span style="color:#2b91af">TextBlock</span>.TextProperty, bind);
</span></p><p style="margin-left:72pt">
 </p><p style="margin-left:72pt">
 </p><ol style="margin-left:72pt"><li><div><span style="color:#1f497d"><em>Change Notification with <span style="font-family:Consolas;font-size:10pt">INotifyPropertyChanged</span> and <span style="font-family:Consolas;font-size:10pt">ObservableCollection</span>
					</em></span></div><p><span style="color:#1f497d">When a dependency property is changed, any binding target can be notified to be updated.
</span></p><p>
 </p></li></ol><p><span style="font-family:Consolas;font-size:9pt">              <span style="color:blue">public</span>
			<span style="color:blue">class</span>
			<span style="color:#2b91af">Person</span> : <span style="color:#2b91af">INotifyPropertyChanged</span>
		</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">…
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">        <span style="color:blue">public</span>
			<span style="color:blue">string</span> FirstName
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">        {
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">            <span style="color:blue">get</span> { <span style="color:blue">return</span> firstName; }
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">            <span style="color:blue">set
</span></span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">            {
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">                firstName = <span style="color:blue">value</span>;
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">                OnPropertyChanged(<span style="color:#a31515">&quot;FirstName&quot;</span>);
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">                OnPropertyChanged(<span style="color:#a31515">&quot;Name&quot;</span>);
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">                OnPropertyChanged(<span style="color:#a31515">&quot;FullName&quot;</span>);
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">            }
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt"> }
</span></p><p style="margin-left:72pt">
 </p><p style="margin-left:72pt"><span style="color:#1f497d">Notice that the person class implements the INotifyPropertyChanged interface.  In addition, the setter for Firstname fires the OnPropertyChanged event for the Firstname, Name, and FullName properties.  With this syntax, any target that is bound to Firstname will be updated.
</span></p><p style="margin-left:72pt">
 </p><ol style="margin-left:72pt"><li><div><span style="color:#1f497d"><em>DataContext allows for sharing a data source
</em></span></div><p>
 </p><p><span style="color:#1f497d">In the example below, the DataContext is set for the MainGrid control.  The containing ListBox and the Textboxes use the explicit DataContext set on the MainGrid control.
</span></p><p>
 </p><p style="margin-left:13pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">  &lt;</span><span style="color:#a31515">Grid</span><span style="color:blue">
					</span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">MainGrid</span>&quot;<span style="color:blue">
					</span><span style="color:red">DataContext</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Mode=Default, Source={StaticResource Simpsons}, XPath=/People/Person}</span>&quot;<span style="color:blue">&gt;
</span></span></p><p style="margin-left:13pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">&lt;</span><span style="color:#a31515">ListBox</span><span style="color:blue">
					</span><span style="color:red">Width</span><span style="color:blue">=</span>&quot;<span style="color:blue">224</span>&quot;<span style="color:blue">
					</span><span style="color:red">ItemsSource</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Mode=OneWay}</span>&quot;<span style="color:blue">
					</span><span style="color:red">IsSynchronizedWithCurrentItem</span><span style="color:blue">=</span>&quot;<span style="color:blue">True</span>&quot;<span style="color:blue">     </span><span style="color:red">ItemTemplate</span><span style="color:blue">=</span>&quot;<span style="color:blue">{DynamicResource PersonTemplate}</span>&quot;<span style="color:blue">/&gt;
</span></span></p></li></ol><p><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">StackPanel</span><span style="color:blue">
			</span><span style="color:red">Margin</span><span style="color:blue">=</span>&quot;<span style="color:blue">261,22,31,71</span>&quot;<span style="color:blue">&gt;
</span></span></p><p style="margin-left:54pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">      &lt;</span><span style="color:#a31515">TextBox</span><span style="color:blue">
			</span><span style="color:red">Text</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding XPath=FirstName}</span>&quot;<span style="color:blue">
			</span><span style="color:red">TextWrapping</span><span style="color:blue">=</span>&quot;<span style="color:blue">Wrap</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:54pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">      &lt;</span><span style="color:#a31515">TextBox</span><span style="color:blue">
			</span><span style="color:red">Text</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding XPath=LastName}</span>&quot;<span style="color:blue">
			</span><span style="color:red">TextWrapping</span><span style="color:blue">=</span>&quot;<span style="color:blue">Wrap</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:54pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">      &lt;</span><span style="color:#a31515">TextBox</span><span style="color:blue">
			</span><span style="color:red">Text</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding XPath=Gender}</span>&quot;<span style="color:blue">
			</span><span style="color:red">TextWrapping</span><span style="color:blue">=</span>&quot;<span style="color:blue">Wrap</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:54pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;/</span><span style="color:#a31515">StackPanel</span><span style="color:blue">&gt;
</span></span></p><p style="margin-left:18pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">&lt;/</span><span style="color:#a31515">Grid</span><span style="color:blue">&gt;
</span></span></p><p style="margin-left:36pt">
 </p><ol style="margin-left:72pt"><li><span style="color:#1f497d"><em>TwoWay Binding.
</em></span></li></ol><p>
 </p><p style="margin-left:36pt"><span style="color:#1f497d">A change to the source or target updates the other.  This feature simplifies view versus edit mode.
</span></p><p style="margin-left:72pt">
 </p><p style="margin-left:18pt"><span style="color:#1f497d"><strong>XAML: eXtensible Application Markup Language
</strong></span></p><ol style="margin-left:72pt"><li><span style="color:#1f497d">Declarative
</span></li><li><span style="color:#1f497d">Clean separation of UI and logic
</span></li></ol><p>
 </p><p style="margin-left:18pt"><span style="color:#1f497d"><strong>Resources and styles
</strong></span></p><ol style="margin-left:72pt"><li><span style="color:#1f497d">WPF Styles is similar to CSS
</span></li><li><span style="color:#1f497d">Clean way to separate UI properties from the element.
</span></li></ol><p>
 </p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">         &lt;!--</span><span style="color:green"> This is a color setting for text </span><span style="color:blue">--&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">  &lt;</span><span style="color:#a31515">SolidColorBrush</span><span style="color:blue">
			</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">FontColor</span>&quot;<span style="color:blue">
			</span><span style="color:red">Color</span><span style="color:blue">=</span>&quot;<span style="color:blue">#FFE6E6E6</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:36pt">
 </p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">  &lt;!--</span><span style="color:green"> This is the default style for all labels </span><span style="color:blue">--&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">  &lt;</span><span style="color:#a31515">Style</span><span style="color:blue">
			</span><span style="color:red">TargetType</span><span style="color:blue">=</span>&quot;<span style="color:blue">{x:Type Label}</span>&quot;<span style="color:blue">&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue">
			</span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">Foreground</span>&quot;<span style="color:blue">
			</span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">{DynamicResource FontColor}</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue">
			</span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">FontWeight</span>&quot;<span style="color:blue">
			</span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">Normal</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue">
			</span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">Padding</span>&quot;<span style="color:blue">
			</span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">{DynamicResource LabelPadding}</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue">
			</span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">FontFamily</span>&quot;<span style="color:blue">
			</span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">Calibri</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue">
			</span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">FontSize</span>&quot;<span style="color:blue">
			</span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">13</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-size:9pt"><span style="color:blue;font-family:Consolas">  &lt;/</span><span style="color:#a31515;font-family:Consolas">Style</span><span style="color:blue;font-family:Consolas">&gt;</span><span style="color:#1f497d">
			</span></span></p><p style="margin-left:72pt">
 </p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">  &lt;!--</span><span style="color:green"> This is the style for borders </span><span style="color:blue">--&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">  &lt;</span><span style="color:#a31515">Style</span><span style="color:blue">
			</span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">BorderStyle</span>&quot;<span style="color:blue">
			</span><span style="color:red">TargetType</span><span style="color:blue">=</span>&quot;<span style="color:blue">{x:Type Border}</span>&quot;<span style="color:blue">&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue">
			</span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">BorderThickness</span>&quot;<span style="color:blue">
			</span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">{DynamicResource BorderThickness}</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue">
			</span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">BorderBrush</span>&quot;<span style="color:blue">
			</span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">{DynamicResource BorderBrush}</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">    &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue">
			</span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">CornerRadius</span>&quot;<span style="color:blue">
			</span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">10,10,10,10</span>&quot;<span style="color:blue">/&gt;
</span></span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">  &lt;/</span><span style="color:#a31515">Style</span><span style="color:blue">&gt;
</span></span></p><p style="margin-left:72pt">
 </p><p style="margin-left:72pt"><span style="color:blue;font-family:Consolas;font-size:9pt">…
</span></p><p style="margin-left:72pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">&lt;</span><span style="color:#a31515">Border</span><span style="color:blue">
			</span><span style="color:red">Style</span><span style="color:blue">=</span>&quot;<span style="color:blue">{DynamicResource BorderStyle}</span>&quot;<span style="color:blue"> /&gt;
</span></span></p><p style="margin-left:36pt">
 </p><ol style="margin-left:72pt"><li><span style="color:#1f497d">Resource Dictionary
</span></li></ol><p>
 </p><p style="margin-left:36pt">
 </p><p style="margin-left:18pt"><span style="color:#1f497d"><strong>Control Templates
</strong></span></p><p style="margin-left:36pt"><span style="color:#1f497d">Allows the designer to completely customize the look of built-in controls without relying on creating custom controls.
</span></p><p style="margin-left:36pt">
 </p><p style="margin-left:36pt"><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/050907_2059_WPFFeedback1.png" alt="">
	</p><p>
 </p><p style="margin-left:18pt"><span style="color:#1f497d"><strong>Share properties for the entire application
</strong></span></p><p style="margin-left:36pt"><span style="color:#1f497d">We went back and forth on how to go about global properties.  In the end we used public static property located in App.xaml.cs
</span></p><p>
 </p><p><span style="font-family:Consolas;font-size:9pt">       <span style="color:blue">public</span>
			<span style="color:blue">partial</span>
			<span style="color:blue">class</span>
			<span style="color:#2b91af">App</span> : System.Windows.<span style="color:#2b91af">Application
</span></span></p><p style="margin-left:36pt"><span style="font-size:9pt"><span style="font-family:Consolas">{</span><span style="color:#1f497d">
			</span></span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">        <span style="color:green">// The main list of family members that is shared for the entire application
</span></span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">        <span style="color:blue">public</span>
			<span style="color:blue">static</span>
			<span style="color:#2b91af">PeopleCollection</span> FamilyCollection = <span style="color:blue">new</span>
			<span style="color:#2b91af">PeopleCollection</span>();
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:blue">public</span>
			<span style="color:blue">static</span>
			<span style="color:#2b91af">People</span> Family = FamilyCollection.People;
</span></p><p style="margin-left:72pt"><span style="color:blue;font-family:Consolas;font-size:9pt">…
</span></p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt">}
</span></p><p style="margin-left:36pt">
 </p><p style="margin-left:36pt"><span style="font-family:Consolas;font-size:9pt"><span style="color:#2b91af">People</span> family = <span style="color:#2b91af">App</span>.Family;
</span></p><p style="margin-left:36pt">
 </p><p style="margin-left:18pt"><span style="color:#1f497d"><strong>Set the Binding Default Value
</strong></span></p><p style="margin-left:36pt"><span style="color:#1f497d">Setting the Binding Default Value allows you better control of layout as you get a representation of the bounded data in Blend Design view.  In the screenshot below, &quot;Current Person&quot;, &quot;full name&quot;, &quot;Date of Birth&quot;, and &quot;Place of Birth&quot; are all bounded values which have the binding default value set.
</span></p><p style="margin-left:36pt">
 </p><p style="margin-left:36pt"><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/050907_2059_WPFFeedback2.png" alt=""><span style="color:#1f497d"><strong>
			</strong></span></p><p style="margin-left:36pt">
 </p><p style="margin-left:36pt"><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/050907_2059_WPFFeedback3.png" alt=""><span style="color:#1f497d"><strong>
			</strong></span></p><p style="margin-left:36pt">
 </p><p style="margin-left:36pt">
 </p><p style="margin-left:18pt"><span style="color:#1f497d"><strong>Serialization can get difficult due to circular references.
</strong></span></p><p style="margin-left:36pt"><span style="color:#1f497d">See People.Load():
</span></p><p style="margin-left:36pt">
 </p><p><span style="font-family:Consolas"><span style="font-size:10pt">                  </span><span style="color:green;font-size:9pt">// To avoid circular references when serializing family data to xml, only the person Id
</span></span></p><p><span style="font-family:Consolas;font-size:9pt">                    <span style="color:green">// is seralized to express relationships. When family data is loaded, the correct
</span></span></p><p><span style="font-family:Consolas;font-size:9pt">                    <span style="color:green">// person object is found using the person Id and assigned to the appropriate relationship.
</span></span></p><p><span style="font-family:Consolas;font-size:9pt">                    <span style="color:blue">foreach</span> (<span style="color:#2b91af">Person</span> p <span style="color:blue">in</span>
			<span style="color:blue">this</span>.People)
</span></p><p><span style="font-family:Consolas;font-size:9pt">                    {
</span></p><p><span style="font-family:Consolas;font-size:9pt">                        <span style="color:blue">foreach</span> (<span style="color:#2b91af">Relationship</span> r <span style="color:blue">in</span> p.Relationships)
</span></p><p><span style="font-family:Consolas;font-size:9pt">                        {
</span></p><p><span style="font-family:Consolas;font-size:9pt">                            r.RelationTo = <span style="color:blue">this</span>.People.Find(r.PersonId);
</span></p><p><span style="font-family:Consolas;font-size:9pt">                        }
</span></p><p><span style="font-size:9pt"><span style="font-family:Consolas">                    }</span><span style="color:#1f497d"><strong>
				</strong></span></span></p><p>
 </p><p style="margin-left:18pt"><span style="color:#1f497d"><strong>Path to the Mydocuments
</strong></span></p><p style="margin-left:36pt"><span style="color:#1f497d">See the ApplicationFolderPath property in People.cs.
</span></p><p style="margin-left:36pt">
 </p><p style="margin-left:36pt"><span style="font-size:9pt"><span style="color:#2b91af;font-family:Consolas">Environment</span><span style="font-family:Consolas">.GetFolderPath(<span style="color:#2b91af">Environment</span>.<span style="color:#2b91af">SpecialFolder</span>.MyDocuments)</span><span style="color:#1f497d"><strong>
				</strong></span></span></p></div>]]></description></item><item><title>Running another app from a Vista Gadget</title><link>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=7</link><pubDate>Wed, 09 May 2007 11:41:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=7#Comments</comments><dc:creator>jeffv</dc:creator><description><![CDATA[<div class=ExternalClassEE0490508047448C8A35FEF5FF38C5CE>
<div>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri>When executing an application from inside a Vista Gadget you have at least two ways to go.<span>  </span></font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>One, is to use the System.Shell.execute.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>The other is two get an instance of a <span style="color:#595959">WScript.Shell, </span>and call it’s run method.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>Using System.Shell.execute seems the cleaner of the two approaches, and seems to the be advised way to go, but it is convenient to use WScript’s run when you need to process a command line with environment variables.</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>In this example both calls will try to start the same cassini server:</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri><span>                </span>var executable = &quot;C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\webdev.webserver.exe&quot;;</font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri><span>                </span>var executableWithEnvironment = &quot;%WINDIR%\\Microsoft.NET\\Framework\\v2.0.50727\\webdev.webserver.exe&quot;;</font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri><span>                </span>var params = <span>     </span>&quot;/port:80 /path:\&quot;/*path to webpage*/”</font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri><span>                </span>System.Shell.execute(executable,<span>          </span>params);<span>              </span></font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri><span>                </span>var shell = new ActiveXObject('WScript.shell');</font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><font size=3><font face=Calibri><span>                </span>shell.run(executableWithEnvironment +&quot; &quot;+params);</font></font></p></div></div>]]></description></item><item><title>‘alert’ calls in a Vista Gadget’s Javascript</title><link>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Wed, 09 May 2007 11:40:00 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>jeffv</dc:creator><description><![CDATA[<div class=ExternalClass0E4538F6E0284DBC836A017B32C7E601>
<div>
<div style="border-right:medium none;padding-right:0in;border-top:medium none;padding-left:0in;padding-bottom:4pt;border-left:medium none;padding-top:0in;border-bottom:#4f81bd 1pt solid;mso-element:para-border-div"></div>
<p class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri size=3>One of the first things I noticed while writing my first Vista Gadget, was the lack of support of “alert” in the javascript.<span>  </span>After digging around online I found this easy substitute, using a WScript.Shell object in the javascript:</font></p>
<p class=MsoNormal style="margin:0in 0in 10pt;text-indent:0.5in"><font size=3><font face=Calibri><span style="color:#548dd4">var</span> shell = <span style="color:#548dd4">new</span> ActiveXObject(&quot;<span style="color:#595959">WScript.Shell</span>&quot;);</font></font></p>
<p class=MsoNormal style="margin:0in 0in 10pt;text-indent:0.5in"><font face=Calibri size=3>shell.Popup(“<span style="color:#595959">Hello World</span>”);</font></p></div></div>]]></description></item><item><title>Family.Show: A WPF End-To-End Sample around Genealogy</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=11</link><pubDate>Tue, 08 May 2007 15:04:22 GMT</pubDate><slash:comments>25</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=11#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass61F5894ADB5B4650B24932C389BC908B><p><img align=left src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/050807_2204_FamilyShowA1.png" alt=""><span style="font-family:Trebuchet MS;font-size:10pt">For the last couple of months I've been working on <strong>Family.Show</strong>.  Family.Show is a WPF application intended as a reference sample for other developers to understand, learn from, and use in their own WPF projects.  More information about the app is available on the <a href="http://www.vertigo.com/familyshow.aspx"><span style="color:#669966;text-decoration:underline">Family.Show page at Vertigo.com</span></a>.  The installation, available via ClickOnce, and the full source code is also available on that page.  <a href="http://blogs.msdn.com/tims/archive/2007/04/27/our-first-wpf-end-to-end-reference-sample-family-show.aspx"><span style="color:#669966;text-decoration:underline">Tim Sneath has a great post</span></a> introduces and summarizes Family.Show really well.
</span></p><p><span style="font-family:Trebuchet MS;font-size:10pt">Besides being a WPF reference sample for Developers to learn and build on, Family.Show needed to be realistic and interesting. Initial there were several ideas floating around, including DVD Library Manager, Recipe Manager, and Family Tree. I believe we, as a team, chose to build a genealogy application because we felt it was the most compelling scenario for using WPF.  As a genealogy application, we wanted to make it it really usable and something that genealogy users can benefit from.
</span></p><p><span style="font-family:Trebuchet MS;font-size:10pt">If you're curious, you can watch a <a href="http://s3.amazonaws.com/vertigo/FamilyShowOverview-broadband.wmv"><span style="color:#669966;text-decoration:underline">five minute video of Family.Show in action</span></a> presented by Vertigo's CEO, Scott Stanfield.  You can also watch <a href="http://sessions.visitmix.com/default.asp?event=1011&amp;session=2011&amp;pid=XD010&amp;disc=&amp;id=1577&amp;year=2007&amp;search=XD010"><span style="color:#669966;text-decoration:underline">his full session about Family.Show at MIX07</span></a>.  Please feel free to run the application and download the source code.  Let us know what you think.
</span></p><p><span style="font-family:Trebuchet MS;font-size:10pt">
		</span> </p></div>]]></description></item><item><title>Image Resizer for Vista (PowerToy replacement)</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=10</link><pubDate>Mon, 07 May 2007 14:25:55 GMT</pubDate><slash:comments>39</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=10#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass6819157B866A418C9A4AC93B9F182598><p>Windows XP has an excellent utility for quickly resizing a batch of images made by Microsoft called<a href="http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx"> Image Resizer Powertoy</a>. It's a cinch to install and adds a context menu option to resize images by simply right-clicking in Windows Explorer. However, this PowerToy only works on Windows XP. 
</p><p>Fortunately there's a great replacement for image resizing on Windows Vista made by VSO Software called <a href="http://www.vso-software.fr/products/image_resizer/">VSO Image Resizer</a>. It works almost exactly like the Image Resizer PowerToy. Select one or more images in Windows Explorer and right-click. A simple UI is shown to set a few options before resizing. The default options should work fine for most people. There are also advance options for renaming, image optimization, etc. 
</p><p><a href="http://www.vso-software.fr/products/image_resizer/"><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/050707_2125_ImageResize1.png" alt="" border=0></a>
	</p><p>Update: <a href="http://blogs.vertigo.com/personal/jatwood/Blog/Lists/Posts/Post.aspx?ID=20">Jeff Atwood posted an alternative way for image resizing</a> using the built-in Email image resize feature part of Vista. </p></div>]]></description></item><item><title>Silverlight Fix for IE7</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=9</link><pubDate>Sat, 05 May 2007 00:33:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=9#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
I just returned from an exciting Mix '07 conference in Las Vegas – the most exciting news being the announcements of Microsoft Silverlight 1.0 Beta and 1.1 Alpha. I was all pumped up to play with Silverlight, but whenever I tried viewing the online samples, it simply wouldn't work in IE7 on my Vista machine. I installed the latest runtime several times, read and re-read the installation instructions, ensured that I removed the early beta versions from my machine, but no matter what I tried, I kept seeing the "Get Microsoft Silverlight" image. 
 
In frustration, I tried the page in Firefox and to my great surprise…it worked! Hmm. 
Eventually, I happened upon the following steps which fixed my IE7 problem: 

Scan through your installed applications in the Control Panel. Uninstall previous versions of Silverlight and install the latest version if necessary. 
From the Start menu, click All Programs, click Accessories, right-click Command Prompt, then click Run as administrator 
In the console window, change the current directory to the Silverlight installation folder by executing the following command: cd C:\Program Files\Microsoft Silverlight 
Register npctrl.dll in the Silverlight folder by executing the following command: regsvr32 npctrl.dll 
Refreshing IE7 now shows my beloved Silverlight application! 
 ]]></description></item><item><title>Running the Visual Studio's webserver without Visual Studio</title><link>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=5</link><pubDate>Tue, 01 May 2007 18:05:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=5#Comments</comments><dc:creator>jeffv</dc:creator><description><![CDATA[<div class=ExternalClassD326E5F77B39479CB7B33F97712ED710>
<div>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8.5pt;color:black;font-family:'Verdana','sans-serif'">Sometimes you just want to run a ASP.NET webpage locally, but really don't need Visual Studio also running.  Like for a functional review or just to run a finished web app. <span> </span>On those occasions just run the &quot;WebDev.Webserver&quot; on its own.</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8.5pt;color:black;font-family:'Verdana','sans-serif'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><b><span style="font-size:10pt;color:black;font-family:'Verdana','sans-serif'">Where is WebDev.Webserver.exe?</span></b><span style="font-size:8.5pt;color:black;font-family:'Verdana','sans-serif'"></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8.5pt;color:black;font-family:'Verdana','sans-serif'">In the <span> </span>.Net framework 2.0 directory.<span>  </span>Usually located here:</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8.5pt;color:black;font-family:'Verdana','sans-serif'"><span> </span>%WINDIR%\\Microsoft.NET\\Framework\\v2.#.#####</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8.5pt;color:black;font-family:'Verdana','sans-serif'">Note: the “#”s represent the version number, and should not be used in the path literally.</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8.5pt;color:black;font-family:'Verdana','sans-serif'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><b><span style="font-size:10pt;color:black;font-family:'Verdana','sans-serif'">How to use it.</span></b></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8pt;color:black;font-family:'Verdana','sans-serif'">WebDev.Webserver.exe takes three parameters: the port, the path to the webpage source and optionally the virtual path.</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8pt;color:black;font-family:'Verdana','sans-serif'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8pt;color:black;font-family:'Verdana','sans-serif'">WebDev.WebServer /port:&lt;port number&gt; /path:&lt;physical path&gt; [/vpath:&lt;virtual path&gt;]</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8pt;color:black;font-family:'Verdana','sans-serif'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8pt;color:black;font-family:'Verdana','sans-serif'">This can be used from command prompt, but a convenient alternative is to simply create a short cut.  </span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8pt;color:black;font-family:'Verdana','sans-serif'"></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8pt;color:black;font-family:'Verdana','sans-serif'">When running from a command prompt prefixing your command line with &quot;start /b&quot; will allow the command prompt to return while the sever is running.</span></p>
<p class=MsoNormal style="margin:0in 0in 0pt;vertical-align:top;line-height:normal"><span style="font-size:8pt;color:black;font-family:'Verdana','sans-serif'"></span> </p></div>
<div> </div>
<div> </div></div>]]></description></item><item><title>Calendar Content Types in SharePoint 2007</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=8</link><pubDate>Wed, 25 Apr 2007 12:59:00 GMT</pubDate><slash:comments>17</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=8#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
For a non-profit parenting organization like PRAM, the calendar means everything. They have monthly board meetings, weekly playgroup schedules, classes, workshops, holiday parties, and other programs going on all the time. The Calendar List in SharePoint 2007 is the perfect solution since it allows for both one-time and recurring events, just like Outlook. However, meetings, playgroups, and programs each have different attributes (or columns). For example, playgroups need to track the playgroup leader and the leader's contact information, while classes need to track information about the teacher, fees, and discounts, none of which is provided by default in the list. 
So, how can I set up my calendar lists to support multiple types of events? I could add a superset of columns to the default list, but then I would have to think about the non-applicable columns every time I added/edited an event. Alternatively, I could create a different list for each type of event, but then users would have to check each calendar to make sure they weren't double-booking a location, or scheduling two important events at the same time. 
The obvious answer is to use a single calendar list, and use the built-in content type functionality in SharePoint 2007, which allows you to support multiple types in a list. I could go on forever about it, but you can read more about content types here. In PRAM, here's what all this looks like: 
 
This is exactly what we want, three different content types in one calendar: Event, Playgroup, and Program. Users can store all of their data in one calendar and just add different views for different visualizations of the data. For example, I added an All Programs view that has a filter on the Program content type.
But wait, there's a catch! Although content types are supported in calendar lists, in order to be useful, they should inherit the built-in Event content type. This allows them to support recurrence and other nice features of events. Unfortunately, SharePoint hides the Event content type in a special content type group named "_Hidden". As you might have correctly guessed, you can't inherit from hidden content types because you can't see/access them via the SharePoint interface by default. 
To get around this limitation, follow these steps: 

Make a backup of this folder: [Drive]:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\ctypes\ 
In the ctypeswss.xml file, find the section beginning with <ContentType ID="0x0102" Name="$Resources:Event"… 
Change Group="_Hidden" to Group="$Resources:List_Content_Types" 
Execute the following commands:[Drive]:\>stsadm -o deactivatefeature -filename "ctypes\feature.xml" -url http://[Application][Drive]:\>stsadm -o activatefeature -filename "ctypes\feature.xml" -url http://[Application] 
This un-hides the Event content type and places it in the List Content Types group under your Site Content Type Gallery. Now you are free to use the Event content type as a parent for your new content types! Once you are done, you can re-hide the Event content type by replacing the ctypes folder with the backup from Step 1, or by following the above steps again, but swapping the two groups in Step 3. Good luck!]]></description></item><item><title>Prefer descriptive code (e.g. XAML) to procedural code (e.g. C#)</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Wed, 18 Apr 2007 17:18:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClass2317ABD9E203425A8B3AC3848682E466>
<p>While on a recent project, I was tasked with creating an element that displays a rectangle whose width is equal to a percentage and a label that describes the percentage. Also, if the percentage is within certain ranges, the color is different. In this case, there are three ranges. </p>
<table style="font-size:smaller" cellspacing=0 cellpadding=3>
<tbody>
<tr>
<th align=left>Range</th>
<th align=left>Color</th>
<th align=left>Description</th></tr>
<tr>
<td>0 – 74</td>
<td>red</td>
<td>low</td></tr>
<tr>
<td>75 – 84</td>
<td>yellow</td>
<td>medium</td></tr>
<tr>
<td>85 – 100</td>
<td>green</td>
<td>high</td></tr></tbody></table><br>
<p>Creating the rectangle and label in XAML is easy, as is setting the width and description with bindings. </p><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">    &lt;</span><span style="color:#a31515">Rectangle</span><span style="color:blue"> </span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">bar</span>&quot;<span style="color:blue"> </span><span style="color:red">Width</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Percentage}</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Courier New"><span style="color:blue">    &lt;</span><span style="color:#a31515">TextBlock</span><span style="color:blue"> </span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">label</span>&quot;<span style="color:blue"> </span><span style="color:red">Text</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Description}</span>&quot;<span style="color:blue">/&gt; </span></span><br><br>
<p>The interesting part of the task is how best to set its color. Six lines of code come immediately to mind. </p><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">if</span>(percentage &lt; <span style="color:red">75</span>) </span><br><span style="font-size:10pt;font-family:Consolas">        bar.Fill= <span style="color:#2b91af">Brushes</span>.Red; </span><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">else</span> <span style="color:blue">if</span>(percentage &lt; <span style="color:red">85</span>) </span><br><span style="font-size:10pt;font-family:Consolas">        bar.Fill= <span style="color:#2b91af">Brushes</span>.Yellow; </span><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">else </span></span><br><span style="font-size:10pt;font-family:Consolas">        bar.Fill= <span style="color:#2b91af">Brushes</span>.Green; </span><br>
<p> </p>
<p>The difficulty here is not in creating this code (which takes less than a minute to type) but in placing and invoking it. One possibility is to create a <span style="font-family:Consolas">Rectangle.SizeChanged</span> event handler for the <span style="font-family:Consolas">bar</span> object and put this code in it. It's straightforward and is easy to package in a user control. </p>
<p>I don't like it. My WPF mantra is &quot;don't write code&quot;. Plus, I already wrote almost the same code to determine the <span style="font-family:Consolas">Description</span> property. Here's another way to accomplish the same result but without any procedural code. </p>
<p>Somewhere in the Resources section, add this. </p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">    &lt;</span><span style="color:#a31515">Style</span><span style="color:blue"> </span><span style="color:red">x:Key</span><span style="color:blue">=</span>&quot;<span style="color:blue">PercentageStyle</span>&quot;<span style="color:blue"> </span><span style="color:red">TargetType</span><span style="color:blue">=</span>&quot;<span style="color:blue">{x:Type Rectangle}</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue"> </span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">Fill</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">Green</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;</span><span style="color:#a31515">Style.Triggers</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">DataTrigger</span><span style="color:blue"> </span><span style="color:red">Binding</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Description}</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">Low</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">                &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue"> </span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">Fill</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">Red</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;/</span><span style="color:#a31515">DataTrigger</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;</span><span style="color:#a31515">DataTrigger</span><span style="color:blue"> </span><span style="color:red">Binding</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Description}</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">Medium</span>&quot;<span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">                &lt;</span><span style="color:#a31515">Setter</span><span style="color:blue"> </span><span style="color:red">Property</span><span style="color:blue">=</span>&quot;<span style="color:blue">Fill</span>&quot;<span style="color:blue"> </span><span style="color:red">Value</span><span style="color:blue">=</span>&quot;<span style="color:blue">Yellow</span>&quot;<span style="color:blue">/&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">            &lt;/</span><span style="color:#a31515">DataTrigger</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">        &lt;/</span><span style="color:#a31515">Style.Triggers</span><span style="color:blue">&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">    &lt;/</span><span style="color:#a31515">Style</span><span style="color:blue">&gt; </span></span><br>
<p> </p>
<p>Then, use this style in the <span style="font-family:Consolas">bar</span> element, like so. </p>
<p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">    &lt;</span><span style="color:#a31515">Rectangle</span><span style="color:blue"> </span><span style="color:red">x:Name</span><span style="color:blue">=</span>&quot;<span style="color:blue">bar</span>&quot;<span style="color:blue"> </span><span style="color:red">Width</span><span style="color:blue">=</span>&quot;<span style="color:blue">{Binding Percentage}</span>&quot;<span style="color:blue"> </span><span style="color:red">Style</span><span style="color:blue">=</span>&quot;<span style="color:blue">{StaticResource PercentageStyle}</span>&quot;<span style="color:blue">/&gt; </span></span></p>
<p> </p>
<p>Without addressing the obvious localization issues, I managed to leverage the range discrimination code by binding to the <span style="font-family:Consolas">Description</span> property.</p></div>]]></description></item><item><title>Vertigo Software stops by Microsoft to talk about Genealogy and WPF</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=9</link><pubDate>Tue, 17 Apr 2007 12:04:49 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=9#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClass21C8C06604F745D3B7E65CD2B13B02C1><p><a href="http://blogs.vertigo.com/personal/Scott/Blog/default.aspx">Scott Stanfield</a>, our CEO, stopped by Microsoft recently to talk about Vertigo and an exciting new WPF Genealogy application that we've been working on.  The video is up at on10.net.
</p><p><a href="http://on10.net/Blogs/tina/vertigo-software-stops-by-microsoft/"><h1><span style="color:blue;font-family:Cambria;font-size:12pt;text-decoration:underline">Vertigo Software stops by Microsoft</span></h1></a><h1><span style="font-family:Cambria;font-size:12pt">
			</span></h1></p><p><a href="http://on10.net/Blogs/tina/vertigo-software-stops-by-microsoft/"><img src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/041707_1904_VertigoSoft1.png" alt="" border=0></a>
	</p><p> It is exciting for me specifically as I was on the team with another developer and designer working on this application.  Be sure to check back around the Mix timeframe to hear more.
</p></div>]]></description></item><item><title>Vista: Always running an app as Admin</title><link>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Thu, 12 Apr 2007 09:45:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>jeffv</dc:creator><description><![CDATA[<div class=ExternalClassE1E03A29925940CFB1FD5706DCD482BF>
<div><font color="#333333" size=2>For applications that do not fully function under Vista without running as Admin, here's a short-cut that lets you do so by just running the app.</font></div>
<h2 style="margin:10pt 0in 0pt"><font face=Cambria color="#4f81bd" size=4>Setting an application to always run in Admin Mode</font></h2>
<ul>
<li>
<div class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri color="#333333" size=3>Bring up the property box for the application by selecting the app, clicking the right mouse button and selecting “Properties”: </font></div></li></ul>
<p class=MsoNormal style="margin:0in 0in 10pt"><img alt=StartBar src="http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Photos/StartBarProp.jpg"></p>
<p class=MsoNormal style="margin:0in 0in 10pt;text-align:center" align=center><span><font face=Calibri size=3></font></span></p>
<ul>
<li>
<div class=MsoNormal style="margin:0in 0in 10pt"><font face=Calibri color="#333333" size=3>Then go to the “Compatibility” tab and check the box for “run this program<span>  </span>as administrator”(highlighted), which is at the bottom in the “Privilege” section. </font></div></li></ul>
<p class=MsoNormal style="margin:0in 0in 10pt"><img alt="File Properties" src="http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Photos/RunAsAdminPropBox.jpg"></p>
<p class=MsoNormal style="margin:0in 0in 10pt;text-align:center" align=center><span><font face=Calibri size=3></font></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span><font face=Calibri color="#000080" size=3>Use of the run as admin should probably be used sparingly, for apps like &quot;SQL Server Management Studio&quot; and &quot;MS Expression Blend&quot;, which otherwise lack key functionality.</font></span></p>
<p class=MsoNormal style="margin:0in 0in 10pt"><span><font face=Calibri size=3></font></span> </p>
<p class=MsoNormal style="margin:0in 0in 10pt;text-align:center" align=center><font face=Calibri size=3></font> </p></div>]]></description></item><item><title>Top 5 Meaningless IT Words</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=30</link><pubDate>Wed, 11 Apr 2007 09:22:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=30#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClassDEE3075A331B4503A3E9F2D7A3872F7B><div>There's probably more, but these just came up on a call:</div>
<div> </div>
<div>1. Solution</div>
<div>2. Enterprise</div>
<div>3. Security</div>
<div>4. Leverage</div>
<div>5. Bug</div>
<div>5. Feature (tied)</div>
<div> </div>
<div>And I have to quote my friend:</div>
<div> </div>
<div>
<p class=MsoPlainText style="margin:0in 0in 0pt"><font size=3><font face=Consolas>&quot;We don't sell solutions, we create solutions&quot;.</font></font></p>
<p class=MsoPlainText style="margin:0in 0in 0pt"><span style="color:black"><font size=3><font face=Consolas>- B. Kreha</font></font></span></p></div></div>]]></description></item><item><title>WPF Twitter Application</title><link>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Tue, 03 Apr 2007 18:11:00 GMT</pubDate><slash:comments>14</slash:comments><comments>http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>AlanL</dc:creator><description><![CDATA[<div class=ExternalClassF8BFEDD03A8B4713A0A5A31F39886514><div class=ExternalClass614157A06A6B40C3A6017E1E9A5EA40A> <p>UPDATE #2: re-worked this app as <a href="http://blogs.vertigo.com/personal/AlanL/Blog/Lists/Posts/Post.aspx?ID=19">Witty</a>.</p> <p>UPDATE: <span style="font-size:8pt;font-family:verdana"><span style="color:#4c4c4c">I added the source to CodePlex. <a href="http://www.codeplex.com/WPFTwitter"></span>http://www.codeplex.com/WPFTwitter<span style="color:#4c4c4c"> </span></span></p> <p>Here's a fun little <a href="http://www.twitter.com/">Twitter</a> WPF client application that I've been creating in my spare time. When I get a chance I'm going to blog more about it. In the meantime take a sneak peak. It's still very beta. Let me know if you run into any issues by posting comments to this blog post. Requires .NET 3.0 Framework. Also I've only tested this on Windows Vista. </p> <p><a href="http://www.vertigo.com/downloads/wpftwitter/publish.htm"><img alt="" src="http://blogs.vertigo.com/personal/alanl/Blog/Lists/Photos/040407_0111_WPFTwitterA1.png" border=0></a> </p> <p>ClickOnce Installation Url (Works out of the Box with IE.  For Firefox, use the <a href="https://addons.mozilla.org/en-US/firefox/addon/1608">FFClickOnce </a>plugin) </p> <p><a href="http://www.vertigo.com/downloads/wpftwitter/publish.htm">http://www.vertigo.com/downloads/wpftwitter/publish.htm</a> </p> <p>   </p> <p>If you don't know about Twitter, you can read one of the following articles about the service. </p> <p><a href="http://www.time.com/time/business/article/0,8599,1603637,00.html">http://www.time.com/time/business/article/0,8599,1603637,00.html</a> </p> <p><a href="http://www.msnbc.msn.com/id/17888481/site/newsweek/">http://www.msnbc.msn.com/id/17888481/site/newsweek/</a> </p> <p><a href="http://sfgate.com/cgi-bin/article.cgi?f=/c/a/2007/03/19/BUG31OM9RN18.DTL">http://sfgate.com/cgi-bin/article.cgi?f=/c/a/2007/03/19/BUG31OM9RN18.DTL</a> </p> <p>   </p> <p>Also check out GoogleMaps+Twitter mashup <a href="http://twittervision.com/">http://twittervision.com/</a> </p> <p>   </p> <p>  </p></div></div>]]></description></item><item><title>Backlog of Stuff I Owe Everyone</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=29</link><pubDate>Tue, 03 Apr 2007 17:19:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=29#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClassFF8E1E7243E54036BFC731601D5BDADA><div>Got tired of procrastining my back-log of blog work, so I'm putting it one big to-do list. </div>
<div> </div>
<div>1. Family Explorer. Our WPF sample app will be baked and finished next week. I have emails from a few people who are helping us beta test; that'll go out later this week. You may have seen me demo this at at VSLive on 3/26 or at the Redmond WPF Bootcamp 3/28. </div>
<div> </div>
<div>2. ASP.NET AJAX Code. From my 3/23 SDWest presentation. As soon as I figure out how to upload files to my Sharepoint 2007 Blog, it's coming you way. See, I can do hard stuff, but not the easy stuff.</div>
<div> </div>
<div>3. Grand Tour of ASP.NET 2.0. Same deal. For now, you can find the video and code at <a href="http://www.asp.net">www.asp.net</a>. In the videos area, look for the #9 in the &quot;How Do I&quot; ASP.NET section. I did all of those, but #9 is the best overall tour of ASP.NET 2.0.</div>
<div> </div>
<div>4. HD Video Workflow. I gotta put this up too. I'm into the Panasonic HVX-200 HD camera (<a href="http://www.dvxuser.com">www.dvxuser.com</a>). Simply put, it's changing film and video. All digital workflow with the nifty P2 cards. Film, pop out the PC Card from the camera, stick it in your Windows XP laptop (no Vista drivers yet), drag-and-drop the file into Sony Vegas 7 and you're set. You still need the Raylight ($199) plug-in since Sony will never support the Panasonic world, but it's painless. Also, the HDRack product from Serious Magic (just bought by Adobe) is nice, but not totally necessary. </div>
<div> </div>
<div>5. How To Pack. Another on my long list of need-to-do blog posts. Summer of 2006 I spent a week figuring out how to pack for a 2 1/2 week trip to London, Bath and Paris in a 9kg bag. No checked luggage. My wife did the same. Buy the Air Boss from <a href="http://www.redoxx.com">www.redoxx.com</a>, wash your clothes in the sink and take just 1 pair of shoes. Turns out you can buy more shoes in Europe if you need to--who knew?</div>
<div> </div>
<div> </div></div>]]></description></item><item><title>Viewing videos at 1.5 speed with WMP 11 and Vista</title><link>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Mon, 02 Apr 2007 18:33:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>jeffv</dc:creator><description><![CDATA[<div class=ExternalClassCE37427430A2434F906298186EBEDDC5>
<div>When watching instructional videos on Windows Media Player, it can be useful to play them at the &quot;faster&quot; setting, where you can still understand what's being said, but can absorb more content in less time.  </div>
<div> </div>
<div>To quickly switch to the faster play mode with Windows Media Player 11 on Vista, you can either:</div>
<ul>
<li>right click on the play/pause button and select &quot;<strong>Fast Playback</strong>&quot; </li>
<li>or press &quot;<strong>Ctrl+Shift+G</strong>&quot;.  </li></ul>
<div><img alt="" src="http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Photos/1_5speed.jpg"></div>
<div> </div>
<div> </div>
<div>To resume normal play, either use the same context menu and select &quot;<strong>Normal Playback</strong>&quot; , or press &quot;<strong>Ctrl+Shift+N</strong>&quot;. </div>
<div> </div>
<div> </div>
<div> </div></div>]]></description></item><item><title>Sample WPF/e sites</title><link>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Thu, 29 Mar 2007 17:30:15 GMT</pubDate><slash:comments>8</slash:comments><comments>http://blogs.vertigo.com/personal/timlee/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>timlee</dc:creator><description><![CDATA[<div class=ExternalClass4C276F3870CE4C71ABA115039D7A0D4A><p>In case you didn't know, WPF/e is hot… it's HOT!  At least it's supposed to be sometime soon.  However, before attending VSLive! this week, I was wondering, has anyone actually tried using it?  I had seen the <a href="http://ttpdownload.bl.uk/browserapp.xbap">British Library's &quot;Turn the Pages&quot; app</a> a while back <em>(which is really cool!)</em>, and a colleague of mine (James) presented to the company a sample application he built.  Other than that, I hadn't seen much WPF/e in action.
</p><p>At VSLive! I got to see some cool WPF/e samples.  This inspired me to dig around for some more.  Those of you already curious about WPF/e may have already seen some of these, but for those who haven't, have a look and imagine the capabilities.
</p><ol><li><a href="http://www.vista.si">Here's a really cool Vista simulation.</a>  Imagine trying to do this with HTML tags. (Or not.)
</li><li>As I mentioned, the <a href="http://ttpdownload.bl.uk/browserapp.xbap">British Library's &quot;Turn the Pages&quot; app</a> is very cool.  Unlike the other examples I mention, this one is a XAML Browser Application (XBAP), and requires installation of the .NET Framework 3.0.
</li><li>A colleague of mine (Alan) informed us of the <a href="http://channel9.msdn.com/playground/wpfe/PageTurn/default.html">Page Turn</a> sample a while back.
</li><li>Here's a cool <a href="http://channel9.msdn.com/playground/wpfe/rvbplayer/">WPF/e video player</a>, also thanks to Alan.
</li><li>The <a href="http://www.nikhilk.net/Prototypes/PhotoViewer/">WPF/E flickr Photo Viewer</a> is not bad.  I typed in &quot;vacation&quot; and it scrolled pretty pictures.
</li><li>The rest of the samples below are in the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=515684FD-C8A0-4588-88C5-54CE224925E7&amp;displaylang=en">February 2007 CTP Sample Pack download</a>.
</li></ol><p><strong>Grand piano</strong>. Use keyboard keys Z, X, C, V, etc. for white keys and the next row up for black keys. This was all done with WPF/e controls, such as rectangles, etc.  i.e., nothing was &quot;painted.&quot;
</p><p><a href="http://www.microsoft.com/downloads/details.aspx?familyid=515684FD-C8A0-4588-88C5-54CE224925E7&amp;displaylang=en"><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/033007_0030_SampleWPFes1.png" alt="" border=0></a>
	</p><p>
 </p><p><strong>Sprawl game.</strong> Much like the Shockwave games we've come to appreciate:
</p><p><a href="http://www.microsoft.com/downloads/details.aspx?familyid=515684FD-C8A0-4588-88C5-54CE224925E7&amp;displaylang=en"><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/033007_0030_SampleWPFes2.png" alt="" border=0></a>
	</p><p>
 </p><p><strong>Sleek video player.  </strong>WPF/e comes with a built-in media player (not reliant on Windows Media Player or QuickTime).  This is an improvement to the default one that comes with WPF/e, and has a full screen mode:
</p><p><a href="http://www.microsoft.com/downloads/details.aspx?familyid=515684FD-C8A0-4588-88C5-54CE224925E7&amp;displaylang=en"><img src="http://blogs.vertigo.com/personal/timlee/Blog/Lists/Photos/033007_0030_SampleWPFes3.png" alt="" border=0></a>
	</p><p>
 </p><p>The other samples in the CTP each demonstrate a few key concepts at a time, and are also worth taking a look at.
</p><p>To run a page using WPF/e, you'll need a compatible browser (IE 6 or 7, Firefox 1.5 or 2) and operating system (Apple Mac OS X, Windows Vista, Windows XP SP2), and you need to install WPF/e.  However, in true Macromedia-Flash-like fashion, all you need to do is browse to a page that uses WPF/e and you'll get a link to download the required version.
</p><p>
 </p><p><span style="color:white">WPFE
</span></p><p>
 </p></div>]]></description></item><item><title>Nondestructive Image Editing  </title><link>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Tue, 27 Mar 2007 11:49:26 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>andrewt</dc:creator><description><![CDATA[<div class=ExternalClass321471A34E744FB7918DB6DFBAA7AFF1><p>As a user experience designer with Vertigo I'm always on the lookout for what's new in the field, particularly ways to streamline the user experience and enable the users to focus on their work or play and not on the software. As a designer I can appreciate these things on a theoretical level, but there is no substitute for being an actual user to discover and appreciate an application's virtues (or feel the pain in some cases). 
</p><p>
 </p><p>Several months ago I purchased my first &quot;real&quot; camera, a <a href="http://www.usa.canon.com/consumer/controller?act=ModelDetailAct&amp;fcategoryid=139&amp;modelid=12929">Canon 30D</a> digital SLR. I love it! The higher-end digital cameras can take photos in either JPEG or <a href="http://www.luminous-landscape.com/tutorials/understanding-series/u-raw-files.shtml">RAW</a> file formats. The RAW format is fairly new and designed to meet the needs of demanding professional photographers who want to maximize the quality of their digital photos. You can think of the RAW file as a digital &quot;negative&quot; where as much data is captured unedited and uncompressed. Once downloaded to a computer the RAW files are then converted for use in any photo processing tool that can process the RAW format. 
</p><p>
 </p><p>It was when I was researching RAW-enabled photo processing tools that I learned of a terrific improvement in the user experience of these applications – <strong>nondestructive image editing</strong>. It's been a long time since I was an <a href="http://www.adobe.com/products/photoshop/photoshop/">Adobe Photoshop</a> power user, but I can recall more than a few painful experiences of accidentally editing an image and not being able to undo the changes. Sure, there were tools that came along that allowed the user to backtrack through steps or create adjustment layers, but the user had to find these tools and keep track of them. The user still had to think about it and still had to be careful. 
</p><p>
 </p><p>Today, I use <a href="http://www.apple.com/aperture/">Apple Aperture</a> for image editing and it is based on the nondestructive image editing concept. With nondestructive image editing the original RAW file (or any other file format) is never touched. And the best part is that I don't have to think about this – there is no setting to find and it is not possible to accidentally lose the original image. Each adjustment is an addition to the file layered on top of the original image. The adjustments are non-liner and they can be undone simply by clicking a checkbox. 
</p><p>
 </p><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/032707_1848_Nondestruct1.jpg" alt="">
	</p><p>
 </p><p>Also, it's easy to create new versions of an adjusted image to continue working with separately. Finally, the adjustments are automatically saved. Without the risk of losing the original photo I am free to focus on the creative and technical aspects of photography and not on managing the software. 
</p><p>
 </p><p>As an example, in cropping a photo, once I press the return key the application updates the view to the cropped image. However, if I decide to change the crop all I do is select the tool again and the original, un-cropped image comes back into full view with the current crop setting layered over it. 
</p><p>
 </p><p><img src="http://blogs.vertigo.com/personal/andrewt/Blog/Lists/Photos/032707_1848_Nondestruct2.jpg" alt="">
	</p><p>
 </p><p>I can then re-crop, go back to the original, un-cropped image, or even come back 6 months later and crop it again. I could even create a fully tweaked black &amp; white version of a color photo without fear of losing the original. Like a safe sandbox, I am free to experiment because I never have to worry about losing the original image. As a user this is an extremely easy experience.<strong>
		</strong>As a designer I think it's a fantastic model for ease of use because it minimizes risk and encourages experimentation. 
</p><p>
 </p><p>Adobe has a similar product called <a href="http://www.adobe.com/products/photoshoplightroom/">Lightroom</a>. </p></div>]]></description></item><item><title>Workaround For Delayed Timer Jobs Due to DST in SharePoint 2007</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=7</link><pubDate>Fri, 16 Mar 2007 10:14:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=7#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
Wow, this is my third blog post in two days, but when you are developing custom SharePoint 2007 solutions, there's often a lot to blog about.
 
Our team was experiencing problems after the daylight savings (DST) changeover this week. We noticed content deployment and solution deployment timer jobs were running one hour later than expected. The job status in Central Administration would say "Retracting..." or "Deploying..." and they would appear to hang for an hour before running. Because we are implementing a very custom solution, we sometimes have to deploy our solutions several times per day and it was holding us up.
 
I finally hit upon the right google search terms ("timer jobs") and found this new KB article from Microsoft:
 
http://support.microsoft.com/kb/932563
 
Apparently, this is a big problem down under because all the workarounds in the article pertain to Australia, New Zealand, and Singapore. If you are anywhere else, then you need to derive your own workaround.
 
For us, since Vertigo is based in California (our time zone should be Pacific Daylight Time), our workaround was to set our development and server machines' time zones to Alaskan Daylight Time. Suddenly, our timer jobs started running again immediately.
 
Now we just need to remember to set our time zones back again on November 4th when daylights savings ends, or until Microsoft releases a fix. I'm not holding my breath yet. And if anyone has a superior fix or workaround, please let me know.
 
UPDATE: This workaround only fixed half of my problem. The solution deployment jobs are running as expected on my development machine, however, the same problem returned for the content deployment jobs even though the server was also set to Alaskan Daylight Time. We opened a support issue with Microsoft and they are preparing a hotfix.]]></description></item><item><title>This Ain’t No Ordinary MomNPopShop.com! (Part 1)</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=6</link><pubDate>Thu, 15 Mar 2007 23:32:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=6#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
As Jeff Atwood, my colleague here at Vertigo and author of the immensely popular blog, Coding Horror, would say, "If you didn't blog about it, then it didn't happen". So, I've decided to take the first step toward writing a step-by-step guide entitled "How I Built the World's Most Expensive Mom 'n' Pop Shop Web Site Using SharePoint 2007". Welcome to Part 1 of my guide!
To be clear, by "expensive site" I don't actually mean that it's costing someone a lot of money to build the site, nor that I'm getting rich by building it. And by "mom 'n' pop shop", I mean that it's definitely not a Fortune 500 company with millions to spend implementing a custom SharePoint solution. In fact, the site is for a local non-profit parenting organization and I volunteered to build it for free. It probably would have been really expensive due to the technical challenges presented, but because Vertigo has been kind enough to host the site for free, provide me with the necessary resources, and allow me extra time at work to learn and implement the site using SharePoint 2007, the only thing that it really cost was a few weekends and my marriage (just kidding). Seriously, here are a few reasons why I think this site is unique and pretty cool:

It uses custom ASP.NET 2.0 pages for the public front-end (anonymous access)
It uses SharePoint 2007 for content management and as an administrative back-end (members-only access)
It leverages nifty features new in SharePoint 2007 such as custom membership providers, forms authentication, KPIs, etc.
Essentially, I created an ASP.NET 2.0 site using Visual Studio 2005 with the custom look and feel that I wanted (including master pages, css, images, and JavaScript), uploaded it to a document library in an out-of-the-box SharePoint 2007 site, tweaked the Web.config file to allow code to be executed from my custom pages, enabled anonymous access and forms authentication in all the right places, and communicated back-and-forth with my SharePoint lists using the SharePoint API.
Here's what the site currently looks like. It's still under construction, but it has a Membership Registration Wizard that allows an anonymous user to create a user account, submit their membership information from a custom form to a SharePoint 2007 list, and pay for their membership online via PayPal. Then, administrative users can sign in to view the membership list in SharePoint, activate members, verify payments, manage groups and permissions, etc.
The home page – a custom ASP.NET 2.0 page stored in a SharePoint 2007 document library with anonymous access enabled

Step 1 of the wizard – user account sign-up for forms authentication

Step 2 of the wizard – data submitted from the form is saved to a SharePoint 2007 list

The administration home page – a standard SharePoint 2007 page restricted to site administrators

The membership list – stores data submitted anonymously through the wizard

As I see it, there are four ways that you can leverage SharePoint 2007 for your own expensive MomNPopShop.com site:

As an out-of-the box SharePoint 2007 site. This is the 99% case for SharePoint sites currently out there. This is just a standard site created by SharePoint Central Administration using the out-of-the-box master pages and themes. It has all the cool functionality afforded by SharePoint, but your site will look like a million other sites already out there (not to mention that it will also look like a corporate intranet…blech!).
As a fully customized SharePoint 2007 site with custom master pages and themes. This is the ultimate level of SharePoint integration, but it takes a lot of trial, error, blood, sweat, and tears to successfully create a custom master page and/or theme for SharePoint that looks nice and works in all situations, for all pages, all browsers, etc. You will definitely spend a lot of time buried in thousands of lines of css and the word "placeholder" will eventually make you queasy.
As a custom ASP.NET 2.0 site that communicates with a separate SharePoint 2007 site via its built-in Web services. This allows you to communicate with SharePoint lists without sacrificing your custom look and feel. Unfortunately, you won't be sharing the same HTTP context, so it won't be easy for users to switch back and forth between sites easily. 
My suggestion – as custom ASP.NET 2.0 pages stored within a SharePoint 2007 site that communicate back and forth via the SharePoint API. My custom pages share the same IIS configuration, same Web.config file, and the same HTTP context as SharePoint. The only limitation is that my custom master pages do not support Web Part Zones yet, although they could if I took the right bits and pieces from the out-of-the-box master pages.
Stay tuned for Part 2 of this guide where I'll begin describing my experiences and the steps to build your own SharePoint-hosted MomNPopShop.com site!]]></description></item><item><title>A New Perspective on Table vs. Table-less Layouts </title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=5</link><pubDate>Thu, 15 Mar 2007 16:38:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=5#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
I just got out of an architecture review meeting which concluded with a mildly heated debate over table vs. table-less layouts. We had all felt the pain of a complex layout with deeply nested tables drowning in CSS classes, and we all basically agreed that a table-less layout with correct semantic mark-up and thoughtful CSS should be a goal in future projects. The argument was over how to achieve a very specific, simple effect with a completely table-less layout. The problem seems trivial at first glance, but is really quite difficult to solve without a table (maybe I'll pose the problem in a follow-up post).
My argument was that sometimes it's better to take a hybrid approach when it comes to complex layouts, using the correct semantic mark-up where possible with an occasional TABLE tag when it solves the problem easily. To me, the pain of making something simple look exactly the same in all major browsers (yes, that includes Safari) is not worth the extra 4 hours to figure out the perfect mark-up and CSS when a simple table will do the trick in 30 seconds.
Anyways, after the meeting, I had a quick follow-up chat with one of my colleagues who gave me a new perspective on the debate, one which I like very much:
Don't sacrifice the correct semantic markup just to make your site look precisely the same in 100% of the browsers. Target the standards and put the onus on the browser-makers to fix their browsers to be standards-compliant. These sites are usually cleaner, always more accessible, and usually have better content anyway because they aren't relying on fluff, whiz-bang graphics, and complex layouts with layers upon layers of nested tables. Eventually, the browsers will all come around.
Examples:

Use an H1 tag and style it to be your logo (using CSS background-image in favor of an IMG tag)
Use UL and LI tags and style them to look like your navigational menus (in favor of a complex assortment of TABLE and IMG tags)
Use DIV tags and style them as the various sections of the page (also in favor of TABLE tags)
Use P tags, DIV tags, and SPAN tags (using CSS fonts and margins in favor of FONT tags, BR tags, and spacer GIFs)
Strip out the CSS just for fun. Your pages will look straight out of 1994, but should still be readable and logically organized. Think Craigslist.
Don't worry that your search textbox and its adjacent submit button aren't vertically-aligned in the middle on Safari. Worry about the semantics, baby! Content is king!
Don't get me wrong. If you can't sleep at night because your flashy new site doesn't look perfect in Safari, then a hybrid approach with an occasional TABLE tag in your layout will save you a lot of time and should not be easily dismissed. However, if you can manage to shift your perspective slightly, commit yourself to using the correct semantic mark-up all the time and stop worrying about your site looking perfect everywhere, then that will save you even more time!]]></description></item><item><title>Stop the Dancing!</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=26</link><pubDate>Tue, 13 Mar 2007 21:12:50 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=26#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass0D64FA67F6C24F988B75850872119A0A><p>Have you seen those <strong>damn dancing shadow </strong>ads? I have a permanent associate between some horrible Texas line-dancing and mortgage refinancing. 
</p><p>It's enough to make me switch to Firefox for the ad-busting plugins. Unfortunately they're plaguing MSNBC.com, one of my favorite sites. A Microsoft site too, something presumably respectable. People say you're judged by the company you keep. The veracity of this news site…well...I know it's an ad-supported Internet now. I can accept that gracefully. But can at least the Microsoft properties stay above, say, the level of the ads in those free single magazines you find in the subways? 
</p><p> <span style="color:#e36c0a">[Missing link! Note, I took a screenshot, and didn't upload it correctly. And now I can't get MSNBC.com to serve up the same ad. Which is a good thing, I suppose]
</span></p><p> Apparently I'm not the only one trying to <span style="text-decoration:line-through">gouge my eyes out</span> scroll away quickly when I see them. This guy is blocking everything from ad.doubleclick.net. <a href="http://www.cadenhead.org/workbench/news/3085/cant-stop-dance-edit-your-hosts-file">http://www.cadenhead.org/workbench/news/3085/cant-stop-dance-edit-your-hosts-file</a>
	</p><p>The worst of all, them dancin' cowboys. Figures someone on the Internet has <strong>saved </strong>all of these. 
</p><p><a href="http://adverlicio.us/lowermybills_com_dancing_cowboys_728x90">http://adverlicio.us/lowermybills_com_dancing_cowboys_728x90</a>
	</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/031407_0412_StoptheDanc1.png" alt="">
	</p></div>]]></description></item><item><title>Email Signature Style Guidelines (Part 1)</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=25</link><pubDate>Fri, 09 Mar 2007 15:43:56 GMT</pubDate><slash:comments>10</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=25#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClassEBA52231FDCE4E7FB118DB102DFB4463><p>Mike and Paul at Vertigo worked on building an Outlook signature generator program for our company. It's a cool click-once .NET app that everyone runs to generate a consistent email signature. 
</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030907_2343_EmailSignat1.png" alt="">
	</p><p>
 </p><p>Now, in Outlook, new messages automatically look like this:
</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030907_2343_EmailSignat2.png" alt="">
	</p><p>
 </p><p>And when I <strong>reply </strong>to a message, Outlook sticks in a shorter one:
</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030907_2343_EmailSignat3.png" alt="">
	</p><p>
 </p><p>It's actually quite a bit of work to craft an email signature that conveys the right information, in a small space, with strange email limitations all the while carrying a corporate branding standard. When we changed ours to coincide with our new logo, colors, URL (simply vertigo.com) and 10 year anniversary, we rolled out our click-once app and everyone was on board that day.
</p><p>Now that I've spent time thinking about email signatures, I tend to notice them a lot more.
</p><p>Take a case three days ago. I received an email from a friend with a long signature that prompted me to type up thoughts on the subject. Peter's sig was a whopping <strong>820 pixels</strong> tall (show below at 50% with two others for comparison). It included three bitmaps, an advertisement, a yellow gradient stationary and a virus scan &quot;receipt&quot;. 
</p><p>
 </p><div><table style="border-collapse:collapse" border=0><colgroup><col style="width:250px"><col style="width:204px"><col style="width:156px"></colgroup><tbody valign=top><tr style="background:#f2730a"><td style="padding-left:7px;padding-right:7px;border-bottom:solid white 1.5pt"><p><span style="color:white"><strong>Peter's at 820 pixels</strong></span></p></td><td style="padding-left:7px;padding-right:7px;border-bottom:solid white 1.5pt"><p><span style="color:white"><strong>Andrew's at 340</strong></span></p></td><td style="padding-left:7px;padding-right:7px;border-bottom:solid white 1.5pt"><p><span style="color:white"><strong>Mine at 79</strong></span></p></td></tr><tr><td style="padding-left:7px;padding-right:7px"> </td><td style="padding-left:7px;padding-right:7px"> </td><td style="padding-left:7px;padding-right:7px"> </td></tr><tr><td style="padding-left:7px;padding-right:7px"><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030907_2343_EmailSignat4.png" alt=""></p></td><td style="padding-left:7px;padding-right:7px"><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030907_2343_EmailSignat5.png" alt=""></p></td><td style="padding-left:7px;padding-right:7px"><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030907_2343_EmailSignat6.png" alt=""></p></td></tr></tbody></table></div><p>
 </p><p>Now Peter's a good guy. Plus he lives in Brussels which gets a big gold star in my book (read: <a href="http://www.orval.be/an/products/brewery/brewery3.html">Orval</a>). And his new signature is now a modest 181 pixels (again at 50%):
</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030907_2343_EmailSignat7.png" alt="">
	</p><p>I started thinking: what's the point of an email signature? Why do we create these? I think for several reasons:
</p><ul><li>It's our virtual business card
</li><li>We learned the &quot;signature block&quot; from typing lessons 
</li><li>Makes our email look &quot;professional&quot;
</li><li>Carries our corporate brand
</li></ul><p>Frankly, without one, the recipient only has the From: to figure out who wrote it, and that's not always reliable. 
</p><p>I've researched about fifty different signature blocks from a sample of Microsoft Regional Directors. These are technical folks, so they know how to use color, hyperlinks, and images in email. Plus they hail from all over the world, so I got a good sampling of what a globalized signature might look like. 
</p><p>Signatures tend to be composed of items from four categories:
</p><div><table style="border-collapse:collapse" border=0><colgroup><col style="width:166px"><col style="width:159px"><col style="width:154px"><col style="width:160px"></colgroup><tbody valign=top><tr><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:solid black 0.5pt;border-left:solid black 0.5pt;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p><strong>Beginning</strong> </p></td><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:solid black 0.5pt;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p><strong>Core</strong> </p></td><td style="padding-left:7px;padding-right:7px;border-top:solid black 0.5pt;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p><strong>Monikers</strong> </p></td><td style="padding-left:7px;padding-right:7px;border-top:solid black 0.5pt;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p><strong>Ending</strong> </p></td></tr><tr><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:solid black 0.5pt;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Separator (dashes, lines)</p></td><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Name </p></td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Phone (desk, mobile, fax)  </p></td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Quote</p></td></tr><tr><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:solid black 0.5pt;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Valediction or Closing </p></td><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Job Title </p></td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Web (blog, company)</p></td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Advertisement</p></td></tr><tr><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:solid black 0.5pt;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"> </td><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Company </p></td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Postal address</p></td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Legal disclaimer</p></td></tr><tr><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:solid black 0.5pt;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"> </td><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Personal honors </p></td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>IM (MSN, Yahoo, etc.)</p></td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Virus scanned note</p></td></tr><tr><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:solid black 0.5pt;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"> </td><td colspan=2 style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"> </td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"><p>Skype or other callto: </p></td><td style="padding-left:7px;padding-right:7px;border-top:none;border-left:none;border-bottom:solid black 0.5pt;border-right:solid black 0.5pt"> </td></tr></tbody></table></div><p>
 </p><p>I've come to realize that a good email signature is one that balances the need to convey the right, useful information to the recipient along with the appropriate design. In other words, it's a balance between <strong>usability</strong> and <strong>design</strong>.
</p><p>With the right guidelines and Outlook's automatic signature capabilities, you're good to go. I have some thoughts in rough format, but I thought I'd get this blog posted quickly. 
</p><p>I'll follow up with Part 2 next week with some specific guidance and examples.
</p></div>]]></description></item><item><title>Behind the Scenes: ASP.NET 2.0 “How Do I” Videos</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=24</link><pubDate>Wed, 07 Mar 2007 17:16:44 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=24#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass0B6B7439241E42B4B0AF4C58F6B3B26C><p><span style="color:#e36c0a">[Migrated from original blog post dated 2006-02-27.]
</span></p><p><strong>2.5 hours of new ASP.NET 2.0 Video Content</strong>
	</p><p>Over the course of the past few months, my team and I worked to develop and film 2.5 hours worth of content on ASP.NET 2.0 and Visual Web Developer. The idea was to build a series of short, ~12 min. videos, to introduce ASP.NET 1.x developers and people new to the platform, to the power and new features of ASP.NET 2.0. Internally, we called this the Hilo project, as we name all our projects after U.S. cities.
</p><p>They are currently the featured news at <a href="http://www.asp.net/">www.asp.net</a>. The permanent home looks like <a href="http://msdn.microsoft.com/asp.net/learning/learn/newtodevelopment/default.aspx">http://msdn.microsoft.com/asp.net/learning/learn/newtodevelopment/default.aspx</a> under the ASP.NET HOW DO I banner. It doesn't look like the source code has been posted, so I'll add it here in another blog entry (once I figure out how).
</p><p>A few questions were asked on ScottGu's blog <a href="http://weblogs.asp.net/scottgu/archive/2006/02/26/439088.aspx">http://weblogs.asp.net/scottgu/archive/2006/02/26/439088.aspx</a>. I'll consolidate the answers that I can give at my blog.
</p><p><strong>What Did We Use For Production and Filming?</strong>
	</p><p>We used Microsoft Virtual PC to host a clean dev environment with nothing but Visual Web Developer and SQL Express installed. For one video that used SqlCommand caching, we had to use SQL Server 2005 developer on a different box. If the star of the video is Virtual PC, Camtasia is the cinematographer, with both running simultaneously on a dual-core AMD 64-bit 4GB RAM box with 1900x1200 real estate. This lets me crop exactly a 1024x768 image of Virtual PC, with plenty of room for notes and Camtasia.
</p><p>We use two approaches for the audio. Sometimes we record with a high-quality Plantronics USB head-set mic, properly placed, for a clean digital signal. 
</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030807_0116_BehindtheSc1.jpg" alt="">
	</p><p><span style="font-family:Tahoma;font-size:10pt">Or we use a Neumann KM 184 cardioid microphone on a shock mount, fed to a Mackie mixer for pre-amp and outboard compression in our dedicated audio room. All depends on my mood.</span>
	</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030807_0116_BehindtheSc2.jpg" alt="">
	</p><p><span style="font-family:Tahoma;font-size:10pt">We do some pre-processing on the Audio using Sony WaveHammer to remove pops and clicks. Then we bring in the audio / video tracks into Sony Vegas 6, in my opinion, <strong>the best NLE for the money out there. </strong>Plus it's written in .NET and uses its own private instance of SQL Server, which is karmic goodness.</span>
	</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030807_0116_BehindtheSc3.jpg" alt="">
	</p><p><span style="font-family:Tahoma;font-size:10pt">Once we finish editing in Vegas, we render out for WMV 9 Screen (~300kbps) and Audio 9 (fairly high resolution--audio is an extremely important part of the experience). I could post the exact details in another blog if I get comments.</span>
	</p><p><span style="font-family:Tahoma"><strong>Why Tables instead of DIV/CSS for Layout in ASP.NET 2.0?</strong></span>
	</p><p><span style="font-family:Tahoma;font-size:10pt">Only a small portion of the development and design world has clued into using tables and 1x1 pixel clear GIFs is a bad idea for layout. Once you master a few hacks to work around browser compatibility (See some of my CSS links at <a href="http://del.icio.us/seesharp">http://del.icio.us/seesharp</a>), building a really clean masterpage with DIV tags is straight-forward. And fun too--swapping in different themes based on CSS is trivial. And the code looks really really clean. </span>
	</p><p><span style="font-family:Tahoma;font-size:10pt">My <strong>Introducing </strong>video takes the DIV/CSS approach. I was very happy with the results. The <strong>Masterpages </strong>video (and maybe a few others) uses the Table approach. We had to cover the new Table dialog (not bad) and some of the interactive table design features. Just learn how to use both then drop tables in favor of float:left!</span>
	</p><p><span style="font-family:Tahoma"><strong>Reference Materials</strong></span>
	</p><p><span style="font-family:Tahoma;font-size:10pt">I only used 3 reference materials myself for these videos:</span>
	</p><ul><li><span style="font-family:Tahoma;font-size:10pt">The first is Scott Guthrie's incredible 1.5 hour one-take video tour of everything. I shameless stole some ideas and even did my own high-level transcription of the video. If you're looking for more than the 2.5 hours that I did, check out his video. I have no idea where it is.</span>
		</li><li><span style="font-family:Tahoma;font-size:10pt">Homer, Sussman and Howard's ASP.NET 2.0 (Beta) <a href="http://www.amazon.com/gp/product/0321257278/sr=8-2/qid=1141071706/ref=sr_1_2/103-5628641-3827064?_encoding=UTF8">book</a>. It's the best I had at the time. I'd love to see their final copy.</span>
		</li><li><span style="font-family:Tahoma;font-size:10pt">The ASP.NET team released some <a href="http://msdn.microsoft.com/asp.net/reference/design/templates/default.aspx">visual templates</a>. The templates are pretty good, but the readme file that comes with them is awesome. I learned some good tricks in there. Very worthwhile reading--something you'd probably pass up (who reads README.html anymore?)</span>
		</li></ul><p>
 </p></div>]]></description></item><item><title>Stupid Mouse Tricks (Part 1)</title><link>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=22</link><pubDate>Fri, 02 Mar 2007 11:23:53 GMT</pubDate><slash:comments>3</slash:comments><comments>http://blogs.vertigo.com/personal/Scott/Blog/Lists/Posts/Post.aspx?ID=22#Comments</comments><dc:creator>Scott</dc:creator><description><![CDATA[<div class=ExternalClass8BB28E75796A49A5BFA1C39511A62A98><p>Like the middle child, the middle mouse button doesn't get much love. I think that's because most people think it's <strong>just a wheel. </strong>It's only employed to scroll windows up and down. But it can do so much more. Look at all the parts in Figure 3; there's something hidden in there designed to change your browsing life.
</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030207_1923_StupidMouse1.png" alt="">
	</p><p>Try opening a hyperlink in a new window. Go ahead and try it now. I'll provide a sample link <a href="http://r33b.net/">here</a> so you don't even need to leave this page (you might want to turn your speakers down first).  Your experience probably looks like the one below.
</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030207_1923_StupidMouse2.png" alt="">
	</p><p>Did you RIGHT-CLICK, move approximately 20 pixels south, and then LEFT-CLICK on the second item, &quot;Open in New Tab&quot;? This gymnastic feat requires clicking <strong>two different</strong> hardware buttons and the precise navigation through a small space. Do this all day and it's like giving yourself a drunk-driving test every 5 minutes. 
</p><p>You can accomplish the <strong>same thing </strong>with a single click of the MIDDLE-BUTTON. That's it. The new page is opened in the background on a new tab.
</p><p>And, to continue the middle-mouse click goodness, you can <strong>close </strong>the new tab by clicking on it with the middle mouse button. Goodness! 
</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030207_1923_StupidMouse3.png" alt="">
	</p><p>Since the new tabs don't get focus, this becomes a great research tool. Fire up your favorite search engine, middle-click a bunch of promising links, then CONTROL-TAB you're way through them. You did know about that, right?
</p><p>The wheel/button duality was made possible by U.S. Patent number <a href="http://www.google.com/patents?vid=USPAT5912661&amp;id=jb4WAAAAEBAJ&amp;dq=5,912,661">5,912,661</a>, filed way back in 1997. That's 10 years ago! Today, I found <span style="text-decoration:line-through">two</span>
		<span style="text-decoration:line-through">three</span> four of my compadres blissfully unaware of this time saving device.
</p><p><img src="http://blogs.vertigo.com/personal/scott/Blog/Lists/Photos/030207_1923_StupidMouse4.png" alt="">
	</p><p>The microswitch (#51 and 52) makes this work. Thank you Kabir Siddiqui!
</p><p>
 </p><p>
 </p></div>]]></description></item><item><title>SOA ESB Notes</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Tue, 27 Feb 2007 16:18:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClassA308CDD6C44C4FFB82B1B8FD9133CCA8>
<p>Here are a few notes for Jay's presentation today on ESB. There is a great deal of confusion surrounding ESB, even to the point of not having a common definition for the term. The recent <a href="http://geekswithblogs.net/bloesgen/archive/2006/11/03/96062.aspx">Microsoft presentation on ESB</a> has this definition to offer. I believe it does a pretty good job of capturing the salient points. An ESB is all of the following. </p>
<ul>
<li>Message broker (routing) </li>
<li>Message transformation </li>
<li>Message validation </li>
<li>Adaptation </li>
<li>Service orchestration </li></ul>
<p>It is a building block of a service-oriented infrastructure, which also includes the following. </p>
<ul>
<li>Registration and discovery </li>
<li>Management and tracking </li>
<li>Security </li>
<li>Exception handling </li></ul>
<p>There is an <a href="http://weblog.infoworld.com/realworldsoa/archives/2007/02/understanding_s.html">InfoWorld article</a> that seems to share this view and provides more detail.</p></div>]]></description></item><item><title>PC-lint Bug of the Month</title><link>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Mon, 26 Feb 2007 14:40:00 GMT</pubDate><slash:comments>2</slash:comments><comments>http://blogs.vertigo.com/personal/Chris/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>Chris</dc:creator><description><![CDATA[<div class=ExternalClassFE1BAC90CF0147DEA64C20463163D8FB>
<p><a href="http://gimpel.com/html/pcl.htm">PC-lint</a> is a static analysis tool for C and C++ that's been around for 20 years. <a href="http://gimpel.com/">Gimpel Software</a>, the makers of PC-lint, has advertised it with a small C program that has a bug. I like to solve them before checking the site to verify my solution. Here is <a href="http://gimpel.com/html/bugs/bug774.htm">bug #774</a> from the December issue of <a href="http://ddj.com/">Dr. Dobb's Journal</a>. If you use Visual C++ to compile it, it won't catch the error, even if you enable all warnings. Jeff, who pestered me to make this post, managed to solve it even though it's unmanaged code. </p><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">#include</span> <span style="color:fuchsia">&lt;stdio.h&gt; </span></span><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">char</span> Cheryl[] = <span style="color:fuchsia">&quot;gbgbbgbbgggb&quot;</span>; </span><br><br><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">int</span> main() </span><br><span style="font-size:10pt;font-family:Consolas">{ </span><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">char</span> *p; </span><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">int</span> naughty = <span style="color:red">0</span>; </span><br><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">for</span>( p = Cheryl; *p; p++ ) </span><br><span style="font-size:10pt;font-family:Consolas">    { </span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">int</span> previous = <span style="color:fuchsia">'g'</span>; <span style="color:green">/* previous behavior was 'g' */ </span></span><br><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">if</span>( *p == <span style="color:fuchsia">'b'</span> &amp;&amp; previous == <span style="color:fuchsia">'b'</span> ) naughty++; </span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">else</span> <span style="color:blue">if</span>( *p == <span style="color:fuchsia">'b'</span> ) previous = <span style="color:fuchsia">'b'</span>; </span><br><span style="font-size:10pt;font-family:Consolas">        <span style="color:blue">else</span> previous = <span style="color:fuchsia">'g'</span>; </span><br><span style="font-size:10pt;font-family:Consolas">    } </span><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">if</span>( naughty ) printf( <span style="color:fuchsia">&quot;Cheryl has been naughty\n&quot;</span> ); </span><br><span style="font-size:10pt;font-family:Consolas">    <span style="color:blue">return</span> <span style="color:red">0</span>; </span><br><span style="font-size:10pt;font-family:Consolas">}</span> 
<p><img alt="" src="http://blogs.vertigo.com/personal/chris/Blog/Lists/Photos/022607_2240_PClintBugof1.gif"></p></div>]]></description></item><item><title>Printing to XPS from WPF</title><link>http://blogs.vertigo.com/personal/Paul/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Thu, 22 Feb 2007 17:45:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Paul/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>Paul</dc:creator><description><![CDATA[<div class=ExternalClass5D5ED3D489A4417294BD4248DA13F3E9>
<p>Now that I'm running Vista, XPS documents are becoming more and more compelling. You can create and view XPS documents in Vista without installing any additional software. Not that I'm against the PDF format, but installing and using the Adobe Acrobat Reader drives me crazy. With PDFs it seems like I'm either waiting for the Reader to start or trying to find some free PDF creator I can use. I already have my issues with the Reader. I don't necessarily want to pay for additional Acrobat software. </p>
<p>If you're working with WPF, one of the great things about it is just how easy it is to create XPS files. Using the XPSDocument object all you need to do is to provide either a DrawingVisual object or a UIElement object. Since controls eventually derive from UIElement (via FrameworkElement), printing to XPS is pretty easy. </p>
<p>Here's what you need: </p>
<p><span style="font-size:10pt;color:green;font-family:Consolas">// For XPS Output <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.IO;<br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.IO.Packaging; <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">using</span> System.Windows.Xps;<br><span style="color:blue">using</span> System.Windows.Xps.Packaging; </span></p>
<p><span style="font-size:10pt;font-family:Consolas">………… </span></p>
<p><span style="font-size:10pt;color:green;font-family:Consolas">// Create the XPS document from the window's main container </span><span style="font-size:10pt;color:green;font-family:Consolas">(in this case, a grid) <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">Package</span> package = <span style="color:#2b91af">Package</span>.Open(<span style="color:#a31515">&quot;Output.xps&quot;</span>, <span style="color:#2b91af">FileMode</span>.Create); <br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">XpsDocument</span> xpsDoc = <span style="color:blue">new</span> <span style="color:#2b91af">XpsDocument</span>(package);<br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:#2b91af">XpsDocumentWriter</span> xpsWriter = <span style="color:#2b91af">XpsDocument</span>.CreateXpsDocumentWriter(xpsDoc); </span></p>
<p><span style="font-size:10pt;font-family:Consolas">xpsWriter.Write(mainContainer); <br></span><span style="font-size:10pt;font-family:Consolas">xpsDoc.Close(); <br></span><span style="font-size:10pt;font-family:Consolas">package.Close();</span><span style="font-size:9pt"> </span></p>
<p>You also need references to System.Printing and ReachFramework, but those are included for you when you create a new WPF application using Visual Studio. </p>
<p>To get the results you want, remember to provide the <em>correct</em> UIElement to the Write method. Consider the following test application:<br><br><img alt="" src="http://blogs.vertigo.com/personal/paul/Blog/Lists/Photos/022307_0145_PrintingtoX1.png"> </p>
<p>When the application runs it displays a nice little card-thingee and then outputs it to an XPS file. When I specify the main container element (whose parent is the Window), the XPS file looks like this: </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/paul/Blog/Lists/Photos/022307_0145_PrintingtoX2.png"> </p>
<p>If I specify an element contained in the main container element I lose the border and drop shadow. This all makes sense because I'm not specifying the right element to start with. </p>
<p><img alt="" src="http://blogs.vertigo.com/personal/paul/Blog/Lists/Photos/022307_0145_PrintingtoX3.png"> </p>
<p>It's not rocket science, but it does mean that when you're working with a more complex application you may need to give a little thought to exactly what you'd like to output to XPS. </p>
<p>Feng Yuan has a more detailed post on this topic <a href="http://blogs.msdn.com/fyuan/archive/2005/09/12/463887.aspx">here</a>. </p>
<p> </p></div>]]></description></item><item><title>Adding Code-Behind to Custom Pages in SharePoint 2007</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Wed, 21 Feb 2007 17:05:00 GMT</pubDate><slash:comments>11</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
In my last post, I described how to add code blocks to your custom SharePoint 2007 pages. In this post, I will describe a similar technique that allows you to use the ASP.NET 2.0 code-behind model for your pages. Apparently, this was easier to achieve in SharePoint 2003, and I have seen quite a few posts out there from frustrated people who haven't been able to get this working in SharePoint 2007. 
First, I created a minimal test page in Visual Studio 2005. Here's the contents of Test.aspx:
<%@ Page Language="C#" CodeFile="Test.aspx.cs" Inherits="SPCodeBehind.Test" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
      <head runat="server">
            <title>SharePoint 2007 Code-Behind Test Page</title>
      </head>
      <body>
            <form id="form1" runat="server">
                  <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
            </form>
      </body>
</html>

And here's the contents of Test.aspx.cs: 
using System;
using System.Web.UI;
 
namespace SPCodeBehind
{
      public partial class Test : Page
      {
            protected void Button1_Click(object sender, EventArgs e)
            {
                  Button1.Text = DateTime.Now.ToString();
            }
      }
}
 
It's just a simple page with a button that changes its label when clicked. It looks like this: 
 
 
Next, I used the Publish Web Site feature in Visual Studio 2005 to prepare my code for deployment to my SharePoint site. First, I generated a strong-name key pair file: 
C:\Program Files\Microsoft Visual Studio 8\VC>sn -k "C:\Users\WillA\Desktop\SPCodeBehind.snk" 
Then, I published the code to a folder on my local machine (using my key file): 
 
 
Next, I created a new test.aspx page in my SharePoint site using SharePoint Designer, and then pasted the contents of my published page into the new page: 
 
Next, I ran the page in my SharePoint site. I knew it would fail since I hadn't told SharePoint where my code-behind DLL was yet. Here's the error message: 
An error occurred during the processing of /Test.aspx. Could not load the assembly 'App_Web_7kov8md2'. Make sure that it is compiled before accessing the page. 
Next, I copied the DLL into the bin folder of my SharePoint site and retried the page. Again, an error! 
The base type 'SPCodeBehind.Test' is not allowed for this page. The type is not registered as safe. 
Next, I modified the web.config file of my SharePoint site to include the following line: 
<SafeControl Assembly="App_Web_7kov8md2" Namespace="SPCodeBehind" TypeName="*" Safe="True" /> 
Another error, but this one looks familiar – it's the same error I got when I tried to add a code block to my page in my last blog post! 
An error occurred during the processing of /Test.aspx. The event handler 'OnClick' is not allowed in this page. 
Finally, I modified the web.config file one last time: 
<PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" /> 
Success! J 
Please note that I used namespaces, strong-named assemblies, and checked the AllowPartiallyTrustedCallerAttribute option when publishing my initial code. I'm not 100% positive yet if all of these are required to get this working, but it's what I ended up with after much trial and error. Please let me know if you have additional information, or find a better way to do any of this. Good luck!]]></description></item><item><title>Adding Server-Side Code Blocks to Custom Pages in SharePoint 2007</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Mon, 12 Feb 2007 13:33:00 GMT</pubDate><slash:comments>6</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
Turns out you can add server-side code blocks to pages in your SharePoint 2007 sites. This is especially useful if you are creating custom pages which may or may not have the standard SharePoint look and feel. For example, say you want to use forms authentication and you want to add your own custom sign in/create account page. You will need server-side event handlers, right? You could use the code-behind model and deploy the generated DLL to the appropriate folder(s), but that's more complex than what I'm suggesting. 
To demonstrate, add a new page to your site using SharePoint Designer. Here's a minimal example: 
 
If you save and navigate to the page in your browser, you will get an error message saying "An error occurred during the processing of /example.aspx. Code blocks are not allowed in this file." To enable code blocks, you need to modify the web.config file for your site as follows: 
<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">   <PageParserPaths>      <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />   </PageParserPaths></SafeMode>
You should enable this with caution (especially when using * for your VirtualPath). Anyone who can upload pages to your site can now also execute their own server-side code.]]></description></item><item><title>On Duff’s Device</title><link>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Thu, 08 Feb 2007 18:18:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/davidb/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>davidb</dc:creator><description><![CDATA[<div class=ExternalClassA0B58F4522AA4F95997957D17EB8E9ED>
<p class=MsoNormal style="margin:0in 0in 0pt;text-indent:0.5in"><font face="Times New Roman" size=3>Duff’s device is a really neat construct for unrolling loops of indeterminate size.<span>  </span>It was invented by Tom Duff during the early eighties (</font><a href="http://www.lysator.liu.se/c/duffs-device.html"><font face="Times New Roman" size=3>Duff's account</font></a><font face="Times New Roman" size=3>) as a highly efficient way of copying memory, but can be used for other things too.</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt;text-indent:0.5in"><font face="Times New Roman" size=3>Basically, it repeats the processing code in batches—of 8, usually—and iterates over that <i>total actions</i> / <i>batch size</i> times.<span>  </span>It consumes that quotient’s remainder with a switch statement’s fall through.<span>  </span>Here’s that in C:</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">/* </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>* Divide by 8, rounding up.<span>  </span>The switch will take care of</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>* the addition iteration.<span>  </span>Count is the total number of </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>* iterations.<span>  </span>It’s assumed to be greater than 0.</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>*/</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">int n = (count + 7) / 8;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"></font></span></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">while (--n &gt; 0) {</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">}</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"></font></span></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">/*</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>* Many compilers will use a jump table instead of a series of if </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>* statements if the case values are contiguous--the cases’ code </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>* will be contiguous and in order, to make fall through</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>* automatic.</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>*/</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">switch (count % 8) {</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 0:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 7:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 6:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 5:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 4:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 3:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 2:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 1:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">}</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>What makes the Duff’s device interesting is that it combines the loop and switch by exploiting C’s allowing </font><span class=Code><span style="font-size:10pt"><font face="Courier New">do</font></span></span><font face="Times New Roman" size=3>/</font><span class=Code><span style="font-size:10pt"><font face="Courier New">while</font></span></span><font face="Times New Roman" size=3>‘s to span cases:</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">/* </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"> * The following is based on FOLDOC’s Duff’s device </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>* implementation: http://foldoc.org/?Duff%27s+device</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span> </span>* As before, count is assumed to be greater than 0.</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"> */</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">int n = (count + 7) / 8;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"></font></span></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">/* The mod is only performed during the first iteration. */</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">switch (count % 8) {</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 0: </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>do {</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 7:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 6:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 5:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 4:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 3:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 2:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 1:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>} while (--n &gt; 0);</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">}</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>While C# doesn’t allow </font><span class=Code><span style="font-size:10pt"><font face="Courier New">do</font></span></span><font face="Times New Roman" size=3>/</font><span class=Code><span style="font-size:10pt"><font face="Courier New">while</font></span></span><font face="Times New Roman" size=3> loops to span cases, it lets you use </font><span class=Code><span style="font-size:10pt"><font face="Courier New">goto</font></span></span><font face="Times New Roman" size=3> to navigate from one case to another—it forces you to do this if you want to fall through from a case that has at least one statement—so Duff’s device can also be implemented in managed code too:</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">// Count must be greater than 0.</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">int n = (count + 7) / 8;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"></font></span></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">switch (count % 8)</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">{</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 0:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>goto case 7;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 7:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>goto case 6;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 6:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>goto case 5;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 5:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>goto case 4;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 4:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>goto case 3;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 3:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>goto case 2;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 2:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>goto case 1;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">case 1:</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span><i>Action</i></font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"></font></span></span> </p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>// This differs from the other implementations’ conditional </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>// because in C#, == 0 and != 0 are faster than &gt; 0, &lt; 0, &gt;= </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>// 0, and &lt;= 0 (they're handled like Booleans).</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>if (--n != 0)</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>{</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>        </span>goto case 0;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>}</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>break;</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">}</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt;text-indent:0.5in"><font face="Times New Roman" size=3>Is Duff’s device still relevant in an object-oriented world?<span>  </span>If you have a task, comprised of quick, repeated actions—that aren’t already bottlenecked by database, disk, or network access—unrolling might help.<span>  </span>And given that the C# compiler doesn’t seem to unroll loops automatically, you’ll need to implement it yourself.<span>  </span>At least Duff’s device can provide a standard pattern for this.</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt;text-indent:0.5in"><font face="Times New Roman" size=3>For the heck of it, here’s a comparison between a loop and Duff’s device with the construct’s original purpose, copying memory.<span>  </span>Note that this is just for illustrative purposes as </font><span class=Code><span style="font-size:10pt"><font face="Courier New">Array.Copy</font></span></span><font face="Times New Roman" size=3> generally performs better.<span>  </span>Here’s the loop:</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">// destinationStartIndex - the first index in the destination </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">// array that should receive elements from the source array.</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">// sourceStartIndex – the first index in the source array that </font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">// should be copied to the destination array.</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">while (count-- != 0)</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">{</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>    </span>destination[destinationStartIndex++] =</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New"><span>        </span>source[sourceStartIndex++];</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt 0.5in"><span class=Code><span style="font-size:10pt"><font face="Courier New">}</font></span></span></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>Here’s how a Duff’s device performs.</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>Time [in ms.] to copy all indexes of an int32 array, 1000 iterations:</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<div>
<table class=MsoNormalTable style="margin:auto auto auto 5.4pt;width:400.6pt;border-collapse:collapse" cellspacing=0 cellpadding=0 width=534 border=0>
<tbody>
<tr style="height:12.75pt">
<td style="border-right:#c1ccd9;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:400.6pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=534 colspan=8>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:center" align=center><b><span style="font-size:10pt;font-family:Arial">Array size</span></b></p></td></tr>
<tr style="height:12.75pt">
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;background:silver;padding-bottom:0in;border-left:windowtext 1pt solid;width:59pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt" valign=bottom nowrap width=79>
<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:Arial"></span> </p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;background:silver;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt" nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt"><b><span style="font-size:10pt;font-family:Arial">4k</span></b></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;background:silver;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt" nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt"><b><span style="font-size:10pt;font-family:Arial">8k</span></b></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;background:silver;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt" nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt"><b><span style="font-size:10pt;font-family:Arial">16k</span></b></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;background:silver;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt" nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt"><b><span style="font-size:10pt;font-family:Arial">32k</span></b></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;background:silver;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt" nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt"><b><span style="font-size:10pt;font-family:Arial">64k</span></b></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;background:silver;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt" nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt"><b><span style="font-size:10pt;font-family:Arial">128k</span></b></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;background:silver;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt" nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt"><b><span style="font-size:10pt;font-family:Arial">256k</span></b></p></td></tr>
<tr style="height:12.75pt">
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:windowtext 1pt solid;width:59pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" nowrap width=79>
<p class=MsoNormal style="margin:0in 0in 0pt"><b><span style="font-size:10pt;font-family:Arial">Loop</span></b><b><span style="font-size:10pt;font-family:Arial"></span></b></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">43</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">86</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">172</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">345</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">698</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">2684</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">6076</span></p></td></tr>
<tr style="height:12.75pt">
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:windowtext 1pt solid;width:59pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" nowrap width=79>
<p class=MsoNormal style="margin:0in 0in 0pt"><b><span style="font-size:10pt;font-family:Arial">Duff's device</span></b></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">28</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">55</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">109</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">217</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">465</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">2304</span></p></td>
<td style="border-right:windowtext 1pt solid;padding-right:5.4pt;border-top:#c1ccd9;padding-left:5.4pt;padding-bottom:0in;border-left:#c1ccd9;width:48.8pt;padding-top:0in;border-bottom:windowtext 1pt solid;height:12.75pt;background-color:transparent" valign=bottom nowrap width=65>
<p class=MsoNormal style="margin:0in 0in 0pt;text-align:right" align=right><span style="font-size:10pt;font-family:Arial">6066</span></p></td></tr></tbody></table></div>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>As one might expect, Duff’s device copy performs better until memory access becomes a bottleneck—which is below 256k on my laptop, and your results will certainly vary.</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>Source, binaries, and annotated CIL asm are available at:</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3><a href="http://blogs.vertigosoftware.com/files/DuffDeviceTest.zip">http://blogs.vertigosoftware.com/files/DuffDeviceTest.zip</a></font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>Next up (hopefully), using a slightly modified Duff’s device as a [fake] threading mechanism.</font></p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3></font> </p>
<p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>For more information on Duff’s device, please check:</font></p>
<ul>
<li>
<div class=MsoNormal style="margin:0in 0in 0pt"><a href="http://en.wikipedia.org/wiki/Duff's_device"><font face="Times New Roman" size=3>http://en.wikipedia.org/wiki/Duff%27s_device</font></a><font face="Times New Roman" size=3> </font></div></li>
<li>
<div class=MsoNormal style="margin:0in 0in 0pt"><a href="http://www.lysator.liu.se/c/duffs-device.html"><font face="Times New Roman" size=3>http://www.lysator.liu.se/c/duffs-device.html</font></a><font face="Times New Roman" size=3> </font></div></li></ul></div>]]></description></item><item><title>XPath Tutorial</title><link>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Mon, 29 Jan 2007 17:34:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/kenm/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>kenm</dc:creator><description><![CDATA[<div class=ExternalClassC5E55A35C2ED4F4BB5C6FCDB9CEC1720>I don't use XPath nearly enough to remember all the syntax. So on those occasions when I need to use it I always refer to this online <a href="http://www.zvon.org/xxl/XPathTutorial/General/examples.html" target="_blank">XPath Tutorial</a> for a refresher.</div>]]></description></item><item><title>Do Not Cross the Streams</title><link>http://blogs.vertigo.com/personal/markm/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Mon, 29 Jan 2007 11:57:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/markm/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>markm</dc:creator><description><![CDATA[<div class=ExternalClassD57E6EC4D60744D2B412995EFD947F59><p>Network Outage - 01/28/2007 - 6:30pm
</p><p> <img src="http://blogs.vertigo.com/personal/markm/Blog/Lists/Photos/012907_1957_DoNotCrosst1.gif" alt="">
	</p><p>Thinking we were getting attacked from the internet we began a wild search to find out what was the issue.  We started with the Domain Controllers and found inconsistent errors when running dcdiags.  After checking out the VOIP network and found that to be running well.  We turned are attentions to the network switches.  Turning off each one and then back on in order we found the switch that was causing the issue.  Using the network monitoring tool, we removed each network connection from the switch until we found the port that was causing are issue.  We then tracced the network cable to the office location and found out that a network cable was patched between our 2 networks causing a fountain of denial attacks on the network.  So remember do not cross the streams.
</p><p><img src="http://blogs.vertigo.com/personal/markm/Blog/Lists/Photos/012907_1957_DoNotCrosst2.jpg" alt="">
	</p></div>]]></description></item><item><title>Download ASP.NET AJAX v1.0!</title><link>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=2</link><pubDate>Tue, 23 Jan 2007 16:30:00 GMT</pubDate><slash:comments>0</slash:comments><comments>http://blogs.vertigo.com/personal/willa/Blog/Lists/Posts/Post.aspx?ID=2#Comments</comments><dc:creator>willa</dc:creator><description><![CDATA[
After much anticipation, ASP.NET AJAX v1.0 is finally available for public download. As far as I know, this is new as of today (previously, only the RC was available from ajax.asp.net).
 
TIP: Watch the ASP.NET AJAX Extensions: Installation and Setup video. It gives a quick overview of the various downloads available in v1.0 and answers the fundamental question: How do I get everything installed correctly in my toolbox?]]></description></item><item><title>SharePoint 2007 Search Never Stops Crawling</title><link>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=4</link><pubDate>Tue, 23 Jan 2007 13:29:00 GMT</pubDate><slash:comments>16</slash:comments><comments>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=4#Comments</comments><dc:creator>Michael</dc:creator><description><![CDATA[<div class=ExternalClass85C97825E7BF4F86A0725FA8302E13CD>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7>We recently deployed Microsoft SharePoint Office Server 2007 (MOSS) and ran into an issue with the <strong>Office SharePoint Search Service</strong>. The Search service was stuck in the &quot;Crawling Full&quot; state. After about 1 week of troubleshooting with Microsoft Product Support, we have resolved our problem. In a nutshell, our Database Maintenance plan included a task to rebuild indexes which had a side effect of removing the ability to allow duplicate keys in the index which SharePoint Search requires. The lesson I learned here is to not include any index maintenance as part of your database back strategy for SharePoint 2007. For more details and how to fix the problem, please read on. </p>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7><span style="font-size:14pt"><strong>Problem </strong></span></p>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7>The problem appeared when we first noticed that our default Content Source for SharePoint Search was stuck in the &quot;Crawling Full&quot; state. During normal operation, once a crawl is complete, the status should change back to Idle. </p>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/012307_2129_SharePoint21.png"> </p>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7>The problem occurred because our Database Maintenance plan included a Rebuild Index Task that did not preserve the duplicate keys in the index when it was being rebuilt: </p>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/012307_2129_SharePoint22.png"> </p>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7><span style="font-size:14pt"><strong>Fix </strong></span></p>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7>To fix the issue, we had to recreate the 2 indexes that were impacted. One is in the Shared Services Search database and the other is in the WSS 3.0 Search database. <span style="color:#c0504d"><strong>Please exercise caution when making these changes and make sure to have database backups before your start</strong></span>. </p>
<ol>
<li>
<div>Shared Services Search Database<br>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7>In the SharedServices Search Database, you must ensure that the <strong>IX_MSSAnchorPendingChangeLog</strong> index in the <strong>MSSAnchorPendingChangeLog</strong> table ignores duplicate values: </p>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7 style="margin-left:36pt"><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/012307_2129_SharePoint23.png"> </p>
<p class=ExternalClassDF887F9F0A954BB3B2980401D80574B7 style="margin-left:36pt">If this is not enabled, you can follow the steps below to allow duplicate keys: </p>
<div class=ExternalClassDF887F9F0A954BB3B2980401D80574B7>
<ol style="margin-left:72pt">
<li>
<div>In SQL Server Management Studio, navigate to the SSP Search database -&gt; dbo.MSSAnchorPendingChangeLog -&gt; IX_MSSAnchorPendingChangeLog<strong> </strong>index: </div>
<p><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/012307_2129_SharePoint24.png"> </p></li>
<li>Script out the index </li>
<li>Delete the index </li>
<li>
<div>Modify the SQL to set <span style="font-size:10pt;font-family:Consolas">IGNORE_DUP_KEY = ON</span>. Here is what our index script looked like (you will need to modify this script to use the appropriate database): </div>
<p><span style="font-size:10pt;color:green;font-family:Consolas">-- TODO: change this to match the name of your SharedServices Search DB!<br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">USE</span> [SharedServices_Search_DB]<br>G</span><span style="font-size:10pt;font-family:Consolas">O <br><br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">CREATE</span> <span style="color:blue">UNIQUE</span> <span style="color:blue">CLUSTERED</span> <span style="color:blue">INDEX</span> [IX_MSSAnchorPendingChangeLog] <span style="color:blue">ON</span> [dbo]<span style="color:gray">.</span>[MSSAnchorPendingChangeLog] <br></span><span style="font-size:10pt;color:gray;font-family:Consolas">( <br></span><span style="font-size:10pt;font-family:Consolas">    [CrawlId] <span style="color:blue">ASC</span><span style="color:gray">, <br></span></span><span style="font-size:10pt;font-family:Consolas">    [TargetDocId] <span style="color:blue">ASC <br></span></span><span style="font-size:10pt;font-family:Consolas"><span style="color:gray">)</span><span style="color:blue">WITH</span> <span style="color:gray">(</span>PAD_INDEX <span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">,</span> SORT_IN_TEMPDB <span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">,</span> DROP_EXISTING <span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">,</span> <span style="background-color:yellow">IGNORE_DUP_KEY <span style="color:gray">=</span> <span style="color:blue">ON</span></span><span style="color:gray">,</span> ONLINE <span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">)</span> <span style="color:blue">ON</span> [PRIMARY]</span> </p></li></ol></div></div></li>
<li>
<div>WSS 3.0 Search Database</div>
<p>In the WWS 3.0 Search Database, you must do the same as the SSP Search database and ensure that the <strong>IX_MSSAnchorPendingChangeLog</strong> index in the <strong>MSSAnchorPendingChangeLog</strong> table ignores duplicate values. If this is not enabled, you can follow the steps below: </p>
<ol>
<li>
<div>In SQL Server Management Studio, navigate to the WSS 3.0 Search database -&gt; dbo.MSSAnchorPendingChangeLog -&gt; IX_MSSAnchorPendingChangeLog<strong> </strong>index: </div>
<p><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/012307_2129_SharePoint25.png"> </p></li>
<li>Script out the index </li>
<li>Delete the index </li>
<li>
<div>Modify the SQL to set <span style="font-size:10pt;font-family:Consolas">IGNORE_DUP_KEY = ON</span>. Here is what our index script looked like: </div>
<p><span style="font-size:10pt;color:green;font-family:Consolas">-- TODO: change this to match the name of your WSS Search Database Search DB!</span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">USE</span> [WSS_Search_MOSSWEB01] <br></span><span style="font-size:10pt;font-family:Consolas">GO <br><br></span><span style="font-size:10pt;font-family:Consolas"><span style="color:blue">CREATE</span> <span style="color:blue">UNIQUE</span> <span style="color:blue">CLUSTERED</span> <span style="color:blue">INDEX</span> [IX_MSSAnchorPendingChangeLog] <span style="color:blue">ON</span> [dbo]<span style="color:gray">.</span>[MSSAnchorPendingChangeLog] <br></span><span style="font-size:10pt;color:gray;font-family:Consolas">( <br></span><span style="font-size:10pt;font-family:Consolas">    [CrawlId] <span style="color:blue">ASC</span><span style="color:gray">, <br></span></span><span style="font-size:10pt;font-family:Consolas">    [TargetDocId] <span style="color:blue">ASC <br></span></span><span style="font-size:10pt;font-family:Consolas"><span style="color:gray">)</span><span style="color:blue">WITH</span> <span style="color:gray">(</span>PAD_INDEX <span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">,</span> SORT_IN_TEMPDB <span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">,</span> DROP_EXISTING <span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">,</span> <span style="background-color:yellow">IGNORE_DUP_KEY <span style="color:gray">=</span> <span style="color:blue">ON</span></span><span style="color:gray">,</span> ONLINE <span style="color:gray">=</span> <span style="color:blue">OFF</span><span style="color:gray">)</span> <span style="color:blue">ON</span> [PRIMARY]</span> </p></li></ol></li>
<li>The final step, to ensure a clean Shared Services database, we created a new Shared Services Provider and removed the old one. We also removed the offending database maitenance plans.</li></ol></div>]]></description></item><item><title>DCOM Error with SharePoint 2007/WSS 3.0 Service Account </title><link>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=3</link><pubDate>Tue, 23 Jan 2007 13:24:00 GMT</pubDate><slash:comments>1</slash:comments><comments>http://blogs.vertigo.com/personal/Michael/Blog/Lists/Posts/Post.aspx?ID=3#Comments</comments><dc:creator>Michael</dc:creator><description><![CDATA[<div class=ExternalClass2A95007621704FDC89104E33DFC4BFD6>
<p>If you running SharePoint 2007 or WSS 3.0 with a Domain Service Account, and you run into a DCOM Error in the System Log with an Event ID of 10016 and an error description of: </p>
<p><span style="font-family:Consolas">The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {61738644-F196-11D0-9953-00C04FD919C1} to the user VERTIGO\mossservice SID (removed). This security permission can be modified using the Component Services administrative tool. </span></p>
<p><img alt="" src="http://blogs.vertigo.com/personal/michael/Blog/Lists/Photos/012307_2124_DCOMErrorwi1.png"> </p>
<p>You can fix this by following the steps below: </p>
<ol>
<li>Click Start, click Run, type dcomcnfg in the Open box, and then click OK. </li>
<li>Expand Component Services, expand Computers, expand My Computer, and then click DCOM Config. </li>
<li>Right-click IIS WAMREG admin Service, and then click Properties. </li>
<li>Click the Security tab. </li>
<li>Under Launch and Activation Permissions, click Edit. </li>
<li>In the Launch Permission dialog box, click Add. </li>
<li>In the Select Users, Computers, or Groups dialog box, type the domain user account that you specified as the Windows SharePoint Services 3.0 service account, click Check Names, and then click OK. </li>
<li>In the Permissions for UserName list, click to select the Allow check box that is next to Local Activation, and then click OK two times. </li></ol>
<p>The source for the fix came from Microsoft KB article <strong>920783</strong>: </p>
<p><strong>Event ID 10017 error messages are logged in the System log after you install Windows SharePoint Services 3.0<br></strong><a href="http://support.microsoft.com/kb/920783">http://support.microsoft.com/kb/920783</a><a href="http://support.microsoft.com/kb/920783 The only difference is the event ID."> </a></p>
<p>The only difference is the Event ID.<a href="http://support.microsoft.com/kb/920783 The only difference is the event ID."></p></div></a>]]></description></item></channel></rss>
