<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Development</title>
        <link>http://geekswithblogs.net/kobush/category/1584.aspx</link>
        <description>Development</description>
        <language>pl-PL</language>
        <copyright>Szymon Kobalczyk</copyright>
        <managingEditor>skobalczyk@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Multi-touch in WPF4.0 Beta2</title>
            <link>http://geekswithblogs.net/kobush/archive/2009/10/28/135767.aspx</link>
            <description>&lt;p&gt;Now that .NET Framework 4.0 Beta 2 is out let’s look again what is available for building multi-touch application in WPF. In Beta 1 we got only a preview of manipulation and inertia components. With Beta 2 we finally get access to whole touch input system, and it looks very close to what was shown on PDC last year. Here is an &lt;a href="http://msdn.microsoft.com/en-us/library/bb613588(VS.100).aspx#touch_and_manipulation"&gt;overview from MSDN&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Elements in WPF now accept touch input. The &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement(VS.100).aspx"&gt;UIElement&lt;/a&gt;, and &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement3d(VS.100).aspx"&gt;UIElement3D&lt;/a&gt;, and &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.contentelement(VS.100).aspx"&gt;ContentElement&lt;/a&gt; classes expose events that occur when a user touches an element on a touch-enabled screen. The following events are defined on &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement(VS.100).aspx"&gt;UIElement&lt;/a&gt; and respond to touch input. Note that these events are also defined on &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement3d(VS.100).aspx"&gt;UIElement3D&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.contentelement(VS.100).aspx"&gt;ContentElement&lt;/a&gt;.&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewtouchdown(VS.100).aspx"&gt;PreviewTouchDown&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchdown(VS.100).aspx"&gt;TouchDown&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewtouchmove(VS.100).aspx"&gt;PreviewTouchMove&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchmove(VS.100).aspx"&gt;TouchMove&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.previewtouchup(VS.100).aspx"&gt;PreviewTouchUp&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchup(VS.100).aspx"&gt;TouchUp&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.gottouchcapture(VS.100).aspx"&gt;GotTouchCapture&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.losttouchcapture(VS.100).aspx"&gt;LostTouchCapture&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchenter(VS.100).aspx"&gt;TouchEnter&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.touchleave(VS.100).aspx"&gt;TouchLeave&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;In addition to the touch events, the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement(VS.100).aspx"&gt;UIElement&lt;/a&gt; supports manipulation. A manipulation is interpreted to scale, rotate, or translate the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement(VS.100).aspx"&gt;UIElement&lt;/a&gt;. For example, a photo viewing application might allow users to move, zoom, resize, and rotate a photo by touching the computer screen over the photo. The following events have been added to &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement(VS.100).aspx"&gt;UIElement&lt;/a&gt;:&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarted(VS.100).aspx"&gt;ManipulationStarted&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationdelta(VS.100).aspx"&gt;ManipulationDelta&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationinertiastarting(VS.100).aspx"&gt;ManipulationInertiaStarting&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationcompleted(VS.100).aspx"&gt;ManipulationCompleted&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationboundaryfeedback(VS.100).aspx"&gt;ManipulationBoundaryFeedback&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;To enable manipulation, set the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.ismanipulationenabled(VS.100).aspx"&gt;IsManipulationEnabled&lt;/a&gt; to true. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This is exactly what we were waiting for. I started playing with this new API and I will try to share some samples soon. But here is one problem I run into already. When I tried to use touch in ordinary WPF application, I noticed that all Buttons have a weird behavior, so that when I touched the Button it didn’t go into a pressed state immediately (I’m testing this on HP TouchSmart). Instead it only fires the Click event when I lift the finger. Testing it more I noticed that on any UIElement it won’t fire the MouseDown event until I lift the finger or slide it quite a bit. &lt;/p&gt;  &lt;p&gt;To help me diagnose this issue I created a simple test application shown here:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="multitouchtest" border="0" alt="multitouchtest" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/7a3994036819_639C/multitouchtest_3.png" width="800" height="380" /&gt; &lt;/p&gt;  &lt;p&gt;From left to right I have gray rectangles that react to input events from mouse, stylus and touch. Each rectangle will change color to orange when mouse or stylus is over, and to green when is pressed. In addition, on press I capture the appropriate device and during capture the border changes color to red. &lt;/p&gt;  &lt;p&gt;This test confirms that when I use touch panel then the xxxDown events don’t arrive immediately regardless of the device used. I spent quite a while trying to figure it out and trying various settings in both the Touch and Pen Control Panel and the &lt;a href="http://www.nextwindow.com/assets/files/nwtouch28_inst.exe"&gt;NextWindow’s USB Config utility&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Finally I noticed that somehow this works perfectly fine when I use manipulations. From this I quickly found that this problem goes away when you set &lt;strong&gt;IsManipulationEnabled&lt;/strong&gt; property on the element. Turns out that the side effect of setting this property to true is also changing the stylus properties to disable PressAndHold and Flicks gestures on the element. This explains this problem because stylus engine has to postpone these events trying to interpret the gestures. You can see the difference by selecting the appropriate checkbox on the window.&lt;/p&gt;  &lt;p&gt;However although now we get the xxxDown events immediately (which will be very useful for manipulations) this doesn’t fix the problem with Button pressed state. You will notice that MouseDown event is still deferred regardless of the IsManipulationEnabled settings. I believe that in this case this might be caused by input logic in Windows itself. In fact the only way I could affect this was to force the touch panel to report input as mouse events (using NextWindow’s USB Config tool).&lt;/p&gt;  &lt;p&gt;In the end I believe the proper fix for this would require extending all WPF built-in controls so that they understand the touch events and react accordingly. At the same time some controls might get some multi-touch specific behaviors as well. For example it was &lt;a href="http://weblogs.asp.net/scottgu/archive/2009/10/26/wpf-4-vs-2010-and-net-4-0-series.aspx"&gt;already announced&lt;/a&gt; that ScrollViewer will be enhanced to support multi-touch panning. In case of Button it was mentioned several times, that when simultaneous touches occur the correct behavior should be to fire the Click event only after the last touch is lifted. I hope that we get some of these enhancements in the RTM timeframe. &lt;/p&gt;  &lt;p&gt;You can download the sample code here.&lt;/p&gt; &lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="http://cid-4c7ec0c2176a0b0d.skydrive.live.com/embedicon.aspx/Blog/MultiTouchTest.zip" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=135767"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=135767" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/135767.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2009/10/28/135767.aspx</guid>
            <pubDate>Wed, 28 Oct 2009 08:02:44 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/135767.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2009/10/28/135767.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/135767.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/135767.aspx</trackback:ping>
        </item>
        <item>
            <title>More fun with robots</title>
            <link>http://geekswithblogs.net/kobush/archive/2009/07/06/133277.aspx</link>
            <description>&lt;p&gt;Last Friday I’ve received new Futaba S3001 servos. Turns out they are more easier to modify to Hitec’s, and at the same seem more reliable. I’ve simply followed this &lt;a href="http://www.instructables.com/id/Modify_a_Futaba_S3001_servo_for_continuous_rotatio/" target="_blank"&gt;Instructable&lt;/a&gt;, and you can also find some &lt;a href="http://cid-4c7ec0c2176a0b0d.skydrive.live.com/browse.aspx/Robots" target="_blank"&gt;additional photos in my gallery&lt;/a&gt;. What most important the servos are also easier to calibrate, so now my SERB will actually stop in place when I want it. &lt;/p&gt;  &lt;p&gt;Below is a short video of the completed SERB robot where it just runs in random directions:&lt;/p&gt; &lt;object width="610" height="458"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5470356&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=01AAEA&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=5470356&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=01AAEA&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="610" height="458"&gt;&lt;/embed&gt;&lt;/object&gt;  &lt;p&gt;This weekend I’ve also started looking at &lt;a href="http://www.microsoft.com/robotics/" target="_blank"&gt;Microsoft Robotics Development Studio 2008&lt;/a&gt;. This environment promises easy entry level to robotics. However this is true only when you have a compatible robotics platform (like Lego Mindstorms NXT, fishertechnik, iRobot and few others). There are pretty good tutorials on how to control these robots both from C# and from VPL. However before I can apply them to my SERB robot, first I need to implement the hardware interface and generic services to control the robot. Not much information on this and closest what I found so for is the &lt;a href="http://msdn.microsoft.com/en-us/library/bb483043.aspx" target="_blank"&gt;Robotics Tutorial 6 – Remotely Connected Robots&lt;/a&gt;. It would be cool to get more detailed example on writing such services, but fortunately source code of services for other robots is included. In particular I’m trying to understand the code for iRobot and &lt;a href="http://vexmsrs.codeplex.com/" target="_blank"&gt;this additional service for VEX Robotics&lt;/a&gt;. If you know of any other good examples or tutorials please let me know. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133277"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133277" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/133277.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2009/07/06/133277.aspx</guid>
            <pubDate>Mon, 06 Jul 2009 09:27:46 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/133277.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2009/07/06/133277.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/133277.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/133277.aspx</trackback:ping>
        </item>
        <item>
            <title>Emulating multi-touch device for Windows 7</title>
            <link>http://geekswithblogs.net/kobush/archive/2009/03/10/129993.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/EmulatingmultitouchdeviceforWindows7_11B10/P1100794.jpg"&gt;&lt;img title="4Developers" style="BORDER-TOP-WIDTH: 0px; DISPLAY: inline; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN: 0px 0px 10px 10px; BORDER-RIGHT-WIDTH: 0px" height="324" alt="4Developers" width="233" align="right" border="0" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/EmulatingmultitouchdeviceforWindows7_11B10/P1100794_thumb.jpg" /&gt;&lt;/a&gt;Short while after I wrote about &lt;a target="_blank" href="http://geekswithblogs.net/kobush/archive/2009/02/13/129377.aspx"&gt;resources for multi-touch on Windows 7&lt;/a&gt; Daniel D left a comment that got me very excited:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;MultiTouchVista now has a driver that emulates multitouch hardware for Windows 7&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I got to try it out myself! Bit later I got everything up and running and I’m happy to report that it’s all true: &lt;strong&gt;you can now effectively emulate multi-touch devices under Windows 7&lt;/strong&gt;. You can see it yourself on &lt;a target="_blank" href="http://www.youtube.com/watch?v=C_-vxp1K-1Q"&gt;this video&lt;/a&gt;. In fact it works so well that I was able to demonstrate it last Saturday at &lt;a target="_blank" href="http://4developers.org.pl/"&gt;4Developers&lt;/a&gt; conference. &lt;/p&gt;
&lt;p&gt;That being said, the process to get it running involves few steps so I thought it would help to have a walkthrough to follow for anyone who would like to try it. So here it goes.&lt;/p&gt;
&lt;h2&gt;Hardware&lt;/h2&gt;
&lt;p&gt;Of course you need a PC. Note that computer vision puts CPU to heavy use, and I was able to get barely 15 FPS on my laptop with 1.6Ghz, and thus the interaction wasn’t very smooth. In fact Windows 7 specification requires multi-touch devices to report at least 50hz per finger. &lt;/p&gt;
&lt;p&gt;The software that we are going to use allows to work with number of protocols. One option is to simply connect multiple USB mice to emulate multi-touch. But it is much more fun to build your own surface-like table. For start you can built a &lt;a target="_blank" href="http://ssandler.wordpress.com/mtmini/"&gt;MTmini table designed by Seth Sanders&lt;/a&gt; – it takes about 20 minutes to build and all you will need is:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Webcam &lt;/strong&gt;– people try different kinds of webcams for this, but I think even something simple with decent video should work. I have great results using &lt;a target="_blank" href="http://www.logitech.com/index.cfm/webcam_communications/webcams/devices/3056&amp;amp;cl=US,EN"&gt;Logitech QuickCam Pro 9000&lt;/a&gt; because it has excellent video quality in 640x480 and most important you can set the focus and other parameters manually. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Tracing paper &lt;/strong&gt;– it’s purpose is to diffuse the light coming to the camera so only objects very close to the surface (i.e. your fingers) look sharp. Initially I used just ordinary printer paper, but tracing paper gives more even image. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Photo frame &lt;/strong&gt;– no, I’m not talking about any fancy LCD frames. It’s just plain wood frame (word of advice: bad things will happen if you try to repurpose frame from your wedding photo). Frame I use has A4 paper format (210mm × 297mm) and fits nicely on top of the carton box from the packs of A4 office paper. &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Cardboard box&lt;/strong&gt;, &lt;strong&gt;duck tape&lt;/strong&gt;, and &lt;strong&gt;scissors&lt;/strong&gt;. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When you have all the materials here is what you do:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Put the camera at the bottom of the box facing up, and glue it with the duck tape. You might need to cut out the hole for the camera’s USB cord. &lt;/li&gt;
    &lt;li&gt;Remove the back board from the photo frame and put only the tracing paper on the glass. &lt;/li&gt;
    &lt;li&gt;Put the frame on top of the box. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can also &lt;a target="_blank" href="http://www.youtube.com/watch?v=pQpr3W-YmcQ&amp;amp;eurl"&gt;watch this video&lt;/a&gt; for step by step instructions.&lt;/p&gt;
&lt;p&gt;Here is my completed setup:&lt;/p&gt;
&lt;p&gt;&lt;img title="My MTmini setup" style="BORDER-TOP-WIDTH: 0px; DISPLAY: inline; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="324" alt="My MTmini setup" width="429" border="0" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/EmulatingmultitouchdeviceforWindows7_11B10/P1100787_2.jpg" /&gt; &lt;/p&gt;
&lt;h2&gt;Software&lt;/h2&gt;
&lt;p&gt;Obviously you need to have Windows 7 Beta installed. So hopefully you was able to download it while it lasted. &lt;/p&gt;
&lt;p&gt;Next thing to download and configure is &lt;strong&gt;tBeta&lt;/strong&gt;. Here is description of it from &lt;a target="_blank" href="http://tbeta.nuigroup.com/"&gt;official website&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Beta, &lt;strong&gt;tbeta&lt;/strong&gt; for short, is a &lt;strong&gt;open source/cross-platform solution &lt;/strong&gt;for &lt;strong&gt;computer vision&lt;/strong&gt; and &lt;strong&gt;multi-touch sensing. &lt;/strong&gt;It takes an video input stream and outputs tracking data (e.g. coordinates and blob size) and touch events (e.g. finger down, moved and released) that are used in building multi-touch applications. tbeta can interface with various web cameras and video devices as well as connect to various TUIO/OSC enabled applications and supports many multi-touch lighting techniques including: FTIR, DI, DSI, and LLP with expansion planned for the future (custom modules/filters).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Download the software from the above website and unzip to folder you choose. Before you run it you might want to change configuration to use higher resolution if your webcam supports it. Go to &lt;strong&gt;\tbeta\data&lt;/strong&gt; folder and open &lt;strong&gt;config.xml&lt;/strong&gt; file. Specify the correct values for  WIDTH and HEIGHT in CAMERA_0 node.&lt;/p&gt;
&lt;p&gt;One more thing I did to get more predictable results was to turn off all automatic adjustments in camera software. For Logitech QuickCam this includes switching to manual focus, and turning off Automatic settings for RightLight, exposure and gain. We are not going to move the camera around or dramatically change the lightning conditions so it will be best to make all settings constant. &lt;/p&gt;
&lt;p&gt;When you run tbeta.exe you should see something like this:&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://tbeta.nuigroup.com/"&gt;&lt;img title="tBeta" style="BORDER-TOP-WIDTH: 0px; DISPLAY: inline; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="445" alt="tBeta" width="644" border="0" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/EmulatingmultitouchdeviceforWindows7_11B10/image_3.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The tricky part is &lt;strong&gt;calibration&lt;/strong&gt;, which means adjusting the sliders for all filters at the bottom so that you get best recognition accuracy. Unfortunately I don’t know any rules that would help you with this. You would have to play with the settings a bit to get a feeling how it works. If you make it right you should see an outline and unique id associated with each of your fingers as seen on the above screenshot. When all works well you can minimize this window (press spacebar) so it won’t consume CPU for rendering.&lt;/p&gt;
&lt;p&gt;The last piece of this puzzle is &lt;a target="_blank" href="http://multitouchvista.codeplex.com/"&gt;MultiTouchVista&lt;/a&gt; project that I mentioned in previous post as well. This framework, which actively developed by &lt;strong&gt;Daniel D &lt;/strong&gt;himself (aka &lt;strong&gt;nesher)&lt;/strong&gt;, adds support of multi-touch to the current version of WPF. But for purpose of this article the important thing is the recently added Windows 7 multi-touch driver. It’s not even officially released yet, so you would need to go directly to Source Code tab and download latest bits (I run it on changeset 18685). &lt;/p&gt;
&lt;p&gt;You can &lt;a target="_blank" href="http://www.youtube.com/watch?v=_maaH1gecxw&amp;amp;feature=related"&gt;follow instruction in this video&lt;/a&gt; on how to install the driver and run the services. Here is a short summary of the same:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Compile all projects for MultiTouchVista. Follow instructions on &lt;a target="_blank" href="http://multitouchvista.codeplex.com/Wiki/View.aspx?title=How%20to%20compile"&gt;this page&lt;/a&gt;. &lt;/li&gt;
    &lt;li&gt;From Windows Explorer go to &lt;strong&gt;MultiTouchVista\Main Source&lt;/strong&gt; folder, and while holding down Shift right click on &lt;strong&gt;Multitouch.Diver&lt;/strong&gt; folder and select “Open Command Window Here”. &lt;/li&gt;
    &lt;li&gt;In this window type: &lt;strong&gt;install driver.cmd,&lt;/strong&gt; press Enter and ignore all warnings about not certified drivers. &lt;/li&gt;
    &lt;li&gt;Open Device Manager and confirm that new driver called “Universal Software HID device” is installed under “Human Interface Devices”. Video suggests to disable and then enable the driver to ensure it is working correctly. &lt;/li&gt;
    &lt;li&gt;To verify the driver is installed you can open “Pen and Touch” applet from Control Panel. It should now contain the Panning tab. &lt;/li&gt;
    &lt;li&gt;Back in Explorer go to &lt;strong&gt;MultiTouchVista\Main Source\Output&lt;/strong&gt; folder and run  &lt;strong&gt;Multitouch.Service.Consol.exe&lt;/strong&gt;. By default it loads the MultipleMiceInputProvider so if you should see red dots indicating “virtual cursor” for each USB mouse you have attached. But to use your MTmini table you would need to change configuration so it connects to tBeta through TUIO interface. &lt;/li&gt;
    &lt;li&gt;From &lt;strong&gt;MultiTouchVista\Main Source\Output&lt;/strong&gt; run Multitouch.Configuration.WPF.exe. From list of Available devices select Tuio and click the arrow button in middle to make it Active device. Then click “Restart service” button to apply the new configuration. &lt;/li&gt;
    &lt;li&gt;Finally go to &lt;strong&gt;MultiTouchVista\Main Source\Multitouch.Driver.Console\bin\debug &lt;/strong&gt;and run &lt;strong&gt;Multitouch.Driver.Console.exe&lt;/strong&gt;. &lt;/li&gt;
    &lt;li&gt;Now if you put finger on surface, you should see the input messages coming to the console window. And of course now you should be read to use it as input device for Windows. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Try it on several touch enable applications that I listed in my last post (XPS Viewer and Paint are great for quick demo). You can also find some C++/C# examples on &lt;a target="_blank" href="http://code.msdn.microsoft.com/WindowsTouch"&gt;MSDN Code Galery&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Great thanks for &lt;strong&gt;Daniel D&lt;/strong&gt; for leaving this inspiring comment, and even bigger compliments for developing such great library. Please don’t hesitate to let me know if I can help with anything. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129993"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129993" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/129993.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2009/03/10/129993.aspx</guid>
            <pubDate>Wed, 11 Mar 2009 03:35:19 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/129993.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2009/03/10/129993.aspx#feedback</comments>
            <slash:comments>8</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/129993.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/129993.aspx</trackback:ping>
        </item>
        <item>
            <title>Resources for Multi-touch in Windows 7</title>
            <link>http://geekswithblogs.net/kobush/archive/2009/02/13/129377.aspx</link>
            <description>&lt;p&gt;Last couple of months I’ve been working on very cool project that utilizes new multi-touch features in Windows 7. Although I can’t talk yet about our product, I thought it would be good to start sharing my experience with multi-touch programming. I’ll begin with some general resources to get you started.&lt;/p&gt;
&lt;h3&gt;Prerequisites&lt;/h3&gt;
&lt;p&gt;Of course first thing you need is a multi-touch capable hardware. As far as I know currently there are only three devices available on the market. Those lucky to be at PDC could see that most demos were run on &lt;a target="_blank" href="http://www.hp.com/united-states/campaigns/touchsmart/"&gt;HP TouchSmart All-in-One PC&lt;/a&gt;, or &lt;a target="_blank" href="http://www.dell.com/tablet?s=biz&amp;amp;cs=555"&gt;Dell Letitude XT&lt;/a&gt; tablet. Later in December HP released &lt;a target="_blank" href="http://www.hp.com/united-states/campaigns/touchsmart/notebook/buy.html"&gt;TouchSmart tx2z tablet&lt;/a&gt;, and this week Dell announced specs on &lt;a target="_blank" href="http://www.engadget.com/2009/02/10/dell-latitude-xt2-multi-touch-tablet-with-11-hour-battery-now-of/"&gt;Letitude XT2&lt;/a&gt;. For my work I use HP TouchSmart IQ504 PC. &lt;/p&gt;
&lt;p&gt;The good news is that we have already seen some announcements from other manufacturers, and can expect number of devices to increase closer to Windows 7 release date. &lt;/p&gt;
&lt;p&gt;In terms of touch-screen technology both tablets use the same DuoSense capacitive digitizer from &lt;a target="_blank" href="http://www.n-trig.com/"&gt;N-Trig&lt;/a&gt;, while HP All-in-one PC uses optical overlay developed by &lt;a target="_blank" href="http://www.nextwindow.com/"&gt;NextWindow&lt;/a&gt;. The main difference is that NextWindow device supports only two touch points, while N-Trig’s can recognize more contacts.&lt;/p&gt;
&lt;p&gt;Unfortunately multi-touch works only with dedicated hardware, so you can’t use other digitizers (like Wacom’s), touchpads or TabletPCs. Also there is no way to emulate multi-touch on Windows 7, for example by attaching multiple mice, although this is supported on Surface SDK emulator as &lt;a target="_blank" href="http://channel9.msdn.com/pdc2008/TL49/"&gt;demonstrated by Scott Hanselman&lt;/a&gt; (see around 14:30). &lt;/p&gt;
&lt;h3&gt;Software&lt;/h3&gt;
&lt;p&gt;In terms of software you need two things: Windows 7 and proper multi-touch driver for your device. Currently I run on Windows 7 Beta 1 (build 7000 for x86), and when I did clean install today most of the drivers are now available through Windows Update. The only driver I had to install manually was for &lt;a target="_blank" href="http://www.ralinktech.com.tw/data/drivers/IS_AP_STA_RT2860_D-1.2.1.0_VA-2.1.2.0_RU-2.1.9.0_VA-2.2.4.0_AU_2.0.9.0_VA-2.0.9.0_111108_1.0.6.0_Free.exe"&gt;Ralink WLAN adapter&lt;/a&gt;. However the TouchSmart version I have doesn’t have TV tuner, so if yours does you might need to install some additional software. Fortunately &lt;a target="_blank" href="http://www.brockett.net/?p=637"&gt;Kurt Brockett published detailed guide&lt;/a&gt; how to setup Windows 7 on HP TouchSmart. &lt;/p&gt;
&lt;p&gt;If by any chance the multi-touch drivers won’t install for you automatically, you can download them directly from NextWindow’s or N-trig’s websites:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a target="_blank" href="http://www.nextwindow.com/windriver/index.html"&gt;NextWindow’s Multi-Touch Screen Driver&lt;/a&gt; (Current version is 1.0.3.8 – the same as on Windows Update) &lt;/li&gt;
    &lt;li&gt;&lt;a target="_blank" href="http://www.n-trig.com/Content.aspx?Page=Multi_Touch"&gt;N-trig’s Multi-Touch download for Win7&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To verify all works fine open any page in IE8 and you should be able to use two fingers for zooming. &lt;/p&gt;
&lt;p&gt;Here are some other areas in Windows 7 that were enhanced with multi-touch features:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Panning with inertia is enabled “everywhere” where scrollbars exist. &lt;/li&gt;
    &lt;li&gt;Paint
    &lt;ul&gt;
        &lt;li&gt;Choose a brush from the “brush gallery” and you can then multi touch finger paint. &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Games
    &lt;ul&gt;
        &lt;li&gt;Hearts/Solitaire have been optimized for touch &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Shell
    &lt;ul&gt;
        &lt;li&gt;Windows Snapping (Aero Snap) with Touch &lt;/li&gt;
        &lt;li&gt;Aero Peek with Touch &lt;/li&gt;
        &lt;li&gt;Taskbar Jump Lists with Increased spacing &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Windows Media Player &lt;/li&gt;
    &lt;li&gt;Windows Photo Viewer
    &lt;ul&gt;
        &lt;li&gt;Zoom, Rotate, Panning and Flicks &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;XPS Viewer
    &lt;ul&gt;
        &lt;li&gt;Gestures (Zoom, Two-Finger Tap, Panning) &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Media Center
    &lt;ul&gt;
        &lt;li&gt;Direct Panning in most Scrollable Views and Menus &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Touch Keyboard / TIP
    &lt;ul&gt;
        &lt;li&gt;Multi-touch touch keyboard &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Internet Explorer 8
    &lt;ul&gt;
        &lt;li&gt;Panning &lt;/li&gt;
        &lt;li&gt;Drag Menu (Address Bar) with Increased Spacing &lt;/li&gt;
        &lt;li&gt;Increased Spacing for Favorites with Touch &lt;/li&gt;
        &lt;li&gt;Gesture (Zoom, Panning, Flicks back and forth) &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Windows Live Photo Gallery
    &lt;ul&gt;
        &lt;li&gt;Gesture support in the Viewer &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can also download IdentityMine’s Air Hockey game from: &lt;a href="http://www.identitymine.com/airhockey"&gt;www.identitymine.com/airhockey&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Tip: If you are using touch on regular basis touch it is a good idea to increase the size of Windows UI (fonts, icons, etc.) by changing your display settings to Medium (125%). This will make Windows much more “touchable”. &lt;/p&gt;
&lt;h3&gt;Multi-touch Programming&lt;/h3&gt;
Most of what we know so far about multi-touch API’s introduced in Windows 7 and WPF 4.0 comes from &lt;a target="_blank" href="http://channel9.msdn.com/pdc2008/PC03/"&gt;PDC session&lt;/a&gt; by Reed Townsend and Anson Tsao.
&lt;p&gt;There are also two later sessions from WinHEC 2008: &lt;a title="Multi-Touch in Windows 7 Overview" href="http://download.microsoft.com/download/F/A/7/FA70E919-8F82-4C4E-8D02-97DB3CF79AD5/MBL-T527_Yang_Taiwan.pdf"&gt;Multi-Touch in Windows 7 Overview&lt;/a&gt; covers some basics and repeats information from PDC, while &lt;a href="http://download.microsoft.com/download/F/A/7/FA70E919-8F82-4C4E-8D02-97DB3CF79AD5/MBL-T803_Yang_Taiwan.pdf"&gt;Multi-Touch Driver Development and Logo Compliance&lt;/a&gt; is more toward hardware developers. &lt;/p&gt;
&lt;p&gt;Recently published &lt;a target="_blank" href="http://www.microsoft.com/downloadS/details.aspx?familyid=A91DC12A-FC94-4027-B67E-46BAB7C5226C&amp;amp;displaylang=en"&gt;Windows 7 SDK Beta&lt;/a&gt; includes header files for WM_TOUCH, WM_GESTURE messages, and related functions and structures. It also includes some documentation and samples on this (also &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/dd317323(VS.85).aspx"&gt;available on MSDN&lt;/a&gt;). &lt;/p&gt;
&lt;p&gt;When you have all of above installed, you can try some code samples from &lt;a target="_blank" href="http://code.msdn.microsoft.com/WindowsTouch"&gt;hands on labs from PDC&lt;/a&gt; available on MSDN Code Gallery. These samples are both in C++ and C#. But to get it working in WPF you will need some more advanced framework in place, and I suggest you first take a look at the &lt;a target="_blank" href="http://www.codeplex.com/MultiTouchVista"&gt;Multi-touch Vista&lt;/a&gt; project on CodePlex. You can take a look at &lt;a target="_blank" href="http://www.generoso.info/miria/miria-project.html"&gt;MIRIA SDK&lt;/a&gt; that adds multi-touch support to Silverlight apps. Finally, for those of you that already work with TUIO libraries (like &lt;a target="_blank" href="http://www.nuigroup.com/touchlib/"&gt;Touchlib&lt;/a&gt;) here is an applet to &lt;a target="_blank" href="http://nuigroup.com/forums/viewthread/4087/"&gt;translate WM_TOUCH to TUIO messages&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;More information in multi-touch and related technology can be found in the great &lt;a href="http://nuigroup.com/forums/"&gt;NUI Group Forum&lt;/a&gt;. You can also find all information how to build multi-touch device yourself. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I hope that this information will get you started, and I will try to publish more information on multi-touch programming in C# in next few days. If you have any questions or suggestions please leave a comment.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129377"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129377" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/129377.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2009/02/13/129377.aspx</guid>
            <pubDate>Fri, 13 Feb 2009 14:19:14 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/129377.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2009/02/13/129377.aspx#feedback</comments>
            <slash:comments>11</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/129377.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/129377.aspx</trackback:ping>
        </item>
        <item>
            <title>What to do if your MS SQL Server 2005 eats 100% CPU at idle</title>
            <link>http://geekswithblogs.net/kobush/archive/2008/09/16/125204.aspx</link>
            <description>&lt;p&gt;Some time ago I got very strange situation on my development SQL Server 2005. Immediately after starting the process it went up to 100% CPU and stayed there for hours. There were no external connections, and I couldn't figure out what was causing this so I asked for help our best SQL geek &lt;a href="http://zine.net.pl/blogs/sqlgeek/" target="_blank"&gt;Paweł Potasiński&lt;/a&gt;. With his help we were able to figure out that this was caused by service broker running on one of the databases although we didn't find the root cause for this. &lt;/p&gt;&lt;p&gt;Fast forward few months, and last week I got into the same trouble after upgrading the database. Of course I didn't recall how exactly we fixed it last time. So today I had to gave up and ask for Paweł's help again. I wrote this post mostly because I don't want to bother him again on this. &lt;/p&gt;&lt;p&gt;So first you use this to see which databases have service broker enabled:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: green"&gt;sys.databases &lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;is_broker_enabled &lt;span style="color: gray"&gt;= &lt;/span&gt;1&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Then you can use ALTER TABLE ... SET DISABLE_BROKER but this would only work
&lt;p&gt;when database is not locked. Therefore the best way to do this is like this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;ALTER &lt;/span&gt;DATABASE &lt;span style="color: gray"&gt;... &lt;/span&gt;SET &lt;span style="color: blue"&gt;SINGLE_USER WITH &lt;/span&gt;ROLLLBACK IMMEDIATE
GO
&lt;span style="color: blue"&gt;ALTER &lt;/span&gt;DATABASE &lt;span style="color: gray"&gt;... &lt;/span&gt;SET &lt;span style="color: blue"&gt;DISABLE_BROKER
&lt;/span&gt;GO
&lt;span style="color: blue"&gt;ALTER &lt;/span&gt;DATABASE &lt;span style="color: gray"&gt;... &lt;/span&gt;SET &lt;span style="color: blue"&gt;MULTI_USER
&lt;/span&gt;GO&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Note that this will kick off all users connected to this database. &lt;/p&gt;
&lt;p&gt;Thanks for help Paweł - I owe you one more time :-)&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125204"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125204" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/125204.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2008/09/16/125204.aspx</guid>
            <pubDate>Wed, 17 Sep 2008 01:21:36 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/125204.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2008/09/16/125204.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/125204.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/125204.aspx</trackback:ping>
        </item>
        <item>
            <title>Getting started with Managed Extensibility Framework</title>
            <link>http://geekswithblogs.net/kobush/archive/2008/09/08/125007.aspx</link>
            <description>&lt;p&gt;Last Friday Managed Extensibility Framework Preview 2 (MEF) was published on CodePlex. MEF is a new library in .NET that will simplify adding extension points to your applications. It enables discovery, loading and composition of the extensible components. You can now download the source code, samples and find more information on the project site: &lt;a title="http://www.codeplex.com/MEF" href="http://www.codeplex.com/MEF"&gt;http://www.codeplex.com/MEF&lt;/a&gt;&lt;/p&gt; &lt;p&gt;I was playing with the bits over the weekend and chatted with &lt;a href="http://blogs.msdn.com/gblock" target="_blank"&gt;Glenn Block&lt;/a&gt; (Program Manager on the .NET FX team that does MEF), who explained to me what MEF can do for us. I thought it would be beneficial to share this information, so I created a sample to demonstrate how MEF can be hosted in your application. Please note that this covers only a single scenario where I found MEF might be useful, but MEF probably can do much more for you. &lt;/p&gt; &lt;p&gt;Before we go any further you might want to download the sample project, so you can browse the source code while I walk through it: &lt;/p&gt; &lt;p&gt;&lt;a href="https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=KobushCode&amp;amp;ReleaseId=1510" target="_blank"&gt;&lt;strong&gt;Download MefNavigationWindow project&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; &lt;h1&gt;Sample scenario&lt;/h1&gt; &lt;p&gt;So here is my sample scenario: Let's say you are building a Windows Forms application where you want to add browser like navigation capabilities. This means that your window contains a placeholder where you can load other "pages" be specifying only the page name. Sounds familiar? Yes, WPF supports this out of the box with then NavigationWindow and Pages. So in short we would like to build a NavigationWindow for Windows Forms. &lt;/p&gt; &lt;p&gt;Let's assume that our pages would be simply UserControls. Actually it is quite easy to load user control dynamically - you simply instantiate the control's type and add it to parent's Controls collection. The real problem here is how to map page name (string) to it's type. &lt;/p&gt; &lt;p&gt;For example we could create a section in app.config file that lists all available views and map their names to the corresponding types. This could look similar to this:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;pageMappings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;page &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Page1&lt;/span&gt;" &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;MefNavigationWindow.Page1&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;page &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Page2&lt;/span&gt;" &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;MefNavigationWindow.Page2&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;page &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Page3&lt;/span&gt;" &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;MefNavigationWindow.Page3&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;pageMappings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Then our NavigationWindow would load these mappings and construct the pages using reflection. But I can see two potential problems here. &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In case of a client applications the configuration file is easily available to users to mess with, and doing so it would likely break the application. 
&lt;/li&gt;&lt;li&gt;Because the definition of class and mapping are kept in two separate places developers can easily forget to update the mappings when adding new pages to our solutions. &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Therefore a better solution could be to create a custom attribute that is used to assign page name to a given user control:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;PageMetadata&lt;/span&gt;(PageName = &lt;span style="color: #a31515"&gt;"Page1"&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Page1 &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;UserControl
&lt;/span&gt;{
    &lt;span style="color: gray"&gt;//&lt;/span&gt;&lt;span style="color: green"&gt;...
&lt;/span&gt;}
&lt;/pre&gt;
&lt;p&gt;Then we can scan the current assembly for all types that have this attribute (using reflection), construct a dictionary of all pages, and when requested create instances of a specified page (with reflection again).&lt;/p&gt;
&lt;p&gt;But guess what... MEF already does all this for us with much less code. Let me show you how.&lt;/p&gt;
&lt;h1&gt;Exports&lt;/h1&gt;
&lt;p&gt;First let's look at the PageMetadataAttribute:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;MetadataAttribute&lt;/span&gt;]
&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PageMetadataAttribute &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;Attribute
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;public string &lt;/span&gt;PageName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
}&lt;/pre&gt;
&lt;p&gt;Very simple. Only odd thing is that this attribute itself need to be tagged with MetadataAttribute so MEF knows to expose it as metadata in the parts catalog (and we will use it in just a moment). Now we can use it on any UserControl to assign the page name, but we need to use it together with the &lt;strong&gt;Export &lt;/strong&gt;attribute. Type discovery in MEF is based on attributes and &lt;strong&gt;Export &lt;/strong&gt;indicates that the attributed class should be exported as &lt;strong&gt;ComposablePart &lt;/strong&gt;and specifies the contract it implements (it is Page in our case):&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;Export&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Page"&lt;/span&gt;)]
[&lt;span style="color: #2b91af"&gt;PageMetadata&lt;/span&gt;(PageName = &lt;span style="color: #a31515"&gt;"Page1"&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Page1 &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;UserControl
&lt;/span&gt;{
    &lt;span style="color: green"&gt;// ...
&lt;/span&gt;}&lt;/pre&gt;
&lt;p&gt;Notice that in MEF contract is specified as string. There is additional overload on the Export attribute that consumes a Type, but internally it would be converted to a fully qualified name of that tape. On the side note, even when you use a typed contract the attributed class doesn't really need to implement it - the contract type is used only as a key in the container. &lt;/p&gt;
&lt;h1&gt;CompositionContainer and Catalogs&lt;/h1&gt;
&lt;p&gt;Now we can start implementing our &lt;strong&gt;NavigationWindow &lt;/strong&gt;and first thing to do is to configure the &lt;strong&gt;CompositionContainer&lt;/strong&gt;:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;InitializeCompositionContainer()
{
    &lt;span style="color: blue"&gt;var &lt;/span&gt;catalog = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;AttributedAssemblyPartCatalog&lt;/span&gt;(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;NavigationWindow&lt;/span&gt;).Assembly);
    &lt;span style="color: blue"&gt;var &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CompositionContainer&lt;/span&gt;(catalog.CreateResolver());

    container.AddPart(&lt;span style="color: blue"&gt;this&lt;/span&gt;);
    container.Compose();

    _container = container;
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Because we want MEF to discover all the pages in the current assembly we use the &lt;strong&gt;AttributedAssemblyPartCatalog&lt;/strong&gt; that will search for all types that were attributed as exports. Catalogs are responsible for creating a &lt;strong&gt;Resolver &lt;/strong&gt;that is then passed to the &lt;strong&gt;CompositionContainer &lt;/strong&gt;so it can query for available &lt;strong&gt;ComposableParts &lt;/strong&gt;(you can learn about the other two types of catalogs from the &lt;a href="http://www.codeplex.com/MEF/Wiki/View.aspx?title=Guide&amp;amp;referringTitle=Home" target="_blank"&gt;programming guide&lt;/a&gt;). Next we also register the &lt;strong&gt;NavigationWindow &lt;/strong&gt;itself as a &lt;strong&gt;ComposablePart &lt;/strong&gt;in the container. After doing so we need to call the &lt;strong&gt;Compose &lt;/strong&gt;method to resolve dependencies (note that you don't need to call Compose to user parts exposed from catalogs). But for this to work properly we need to add Export attribute on NavigationWindow too:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;Export&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"NavigationWindow"&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;NavigationWindow &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;UserControl&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;h1&gt;Imports&lt;/h1&gt;
&lt;p&gt;Ok, it's about time to talk about the dependencies, aka imports. For the NavigationWindow this will be the list of all available page types and we can get this by declaring following collection:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;Import&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Page"&lt;/span&gt;)]
&lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ExportCollection&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;UserControl&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;IPageMetadata&lt;/span&gt;&amp;gt; _pages;
&lt;/pre&gt;
&lt;p&gt;The &lt;strong&gt;Import &lt;/strong&gt;attribute indicates that container should resolve this dependency for us by assigning a collection of all exports with Page contract (this happens when you call container's Compose method). It will also expose the PageMetadataAttribute through IPageMetada interface:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IPageMetadata
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;string &lt;/span&gt;PageName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
}&lt;/pre&gt;
&lt;p&gt;Notice that we didn't implement this interface earlier on the attribute itself. At runtime MEF will be able to create dynamic proxy to it with a magic thing called duck typing. Isn't that cool!&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;_pages&lt;/strong&gt; field is private and normally it wouldn't be resolved, but we can ask MEF to handle it by adding the assembly level &lt;strong&gt;AllowNonPublicComposition&lt;/strong&gt; attribute (add it to AssemblyInfo).&lt;/p&gt;
&lt;p&gt;Now we are ready to implement the &lt;strong&gt;GoTo &lt;/strong&gt;method that will do the navigation:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;GoTo(&lt;span style="color: blue"&gt;string &lt;/span&gt;pageName)
{
    &lt;span style="color: blue"&gt;var &lt;/span&gt;newPage = _pages.SingleOrDefault(e =&amp;gt; e.MetadataView.PageName == pageName);

    Controls.Clear();

    &lt;span style="color: blue"&gt;if &lt;/span&gt;(newPage != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: blue"&gt;var &lt;/span&gt;control = newPage.GetExportedObject();
        control.Dock = &lt;span style="color: #2b91af"&gt;DockStyle&lt;/span&gt;.Fill;
        Controls.Add(control);
    }
}&lt;/pre&gt;
&lt;p&gt;In the first line it will search the &lt;strong&gt;_pages &lt;/strong&gt;collection for one with specified page name (MetadataView property implements our IPageMetada interface). Later when the page was found we request the instance of UserControl with call to GetExportedObject(). I told you this would be easy!&lt;/p&gt;
&lt;p&gt;Now we can put the NavigationWindow on any Form and call &lt;font face="Courier New"&gt;navigationWindow1.GoTo(&lt;span style="color: #a31515"&gt;"Page1"&lt;/span&gt;)&lt;/font&gt; to get this:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/cc26d6de43d2_908F/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/cc26d6de43d2_908F/image_thumb.png" width="240" border="0" /&gt;&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;I assume that we would like to navigate from one page to another by clicking the link. Therefore the page needs to know the NavigationWindow it is hosted in – in other words it has a dependency on the NavigationWindow.&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;Import&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"NavigationWindow"&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;NavigationWindow &lt;/span&gt;NavigationWindow { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }

&lt;span style="color: blue"&gt;private void &lt;/span&gt;linkLabel1_LinkClicked(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;LinkLabelLinkClickedEventArgs &lt;/span&gt;e)
{
    NavigationWindow.GoTo(&lt;span style="color: #a31515"&gt;"Page2"&lt;/span&gt;);
}&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;This is why earlier we registered the NavigationWindow itself as a ComposablePart, so now we can import it from any other part. This would get us to the second window:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/cc26d6de43d2_908F/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/cc26d6de43d2_908F/image_thumb_1.png" width="240" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h1&gt;Object lifetime&lt;/h1&gt;
&lt;p&gt;To make this exercise more interesting here we have a TextBox and we want to pass its value to the third window. But first let's talk briefly about part's lifetime. By default all the exported parts are treated as singletons. For us this means that there would be only a single instance ever created of each page (as soon as you call &lt;strong&gt;Export.GetExportedObject &lt;/strong&gt;method). Of course this is not always the desired scenario, and you can change this behavior using the &lt;strong&gt;CreationPolicy&lt;/strong&gt; property of the &lt;strong&gt;CompositionOptions&lt;/strong&gt; attribute. Here is Page1 revisited:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;CompositionOptions&lt;/span&gt;(CreationPolicy = &lt;span style="color: #2b91af"&gt;CreationPolicy&lt;/span&gt;.Factory)]
[&lt;span style="color: #2b91af"&gt;Export&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Page"&lt;/span&gt;)]
[&lt;span style="color: #2b91af"&gt;PageMetadata&lt;/span&gt;(PageName = &lt;span style="color: #a31515"&gt;"Page1"&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Page1 &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;UserControl&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;The &lt;strong&gt;CreationPolicy &lt;/strong&gt;enumeration has only two values: Singleton (default), and Factory. &lt;/p&gt;
&lt;p&gt;Looking back to our scenario we want to make the second page a singleton so it can be accessed from the third page. To access it would also need to get a reference to the Container – and again we do this by adding another dependency in Page3:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;Import&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Container"&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CompositionContainer &lt;/span&gt;Container { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Now, this dependency won't be available just yet. As we've seen before the container was created by the NavigationWindow. We could register it manually as we did with the NavigationWindow, but I would like to show you one more capability that MEF has – you can declare Exports not only on types but also on the class members:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;Export&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Container"&lt;/span&gt;)]
&lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CompositionContainer &lt;/span&gt;_container;
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;So when we add this field to NavigationWindow we now not only export the NavigationWindow itself but also the value in the it's &lt;strong&gt;_container&lt;/strong&gt; field. I can imagine that this capability would be handy if you need to export one of the built-in system types or type from a third-party library when you can't add the Export attribute directly on the given type.&lt;/p&gt;
&lt;p&gt;Finally here is the code from Page3 to get the reference to previous page and read the value entered in the TextBox:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;PageLoaded(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
{
    &lt;span style="color: blue"&gt;var &lt;/span&gt;page = Container.GetExports&amp;lt;&lt;span style="color: #2b91af"&gt;IAskNamePage&lt;/span&gt;&amp;gt;(p =&amp;gt; p.ContractName == &lt;span style="color: #a31515"&gt;"Page" &lt;/span&gt;&amp;amp;&amp;amp; &lt;span style="color: blue"&gt;string&lt;/span&gt;.Equals(p.Metadata[&lt;span style="color: #a31515"&gt;"PageName"&lt;/span&gt;], &lt;span style="color: #a31515"&gt;"Page2"&lt;/span&gt;)).Single();
    nameLabel.Text = &lt;span style="color: #a31515"&gt;"Helo " &lt;/span&gt;+ page.GetExportedObject().FullName;
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;This time we used one of container's GetExports methods to query for a page (ComposablePart with contract "Page") and with page name of "Page2" (through Metadata dictionary). The query capability on metadata is one of the big things in MEF and it allows you to get detailed information about available parts even before you instantiate them. I've also added IAskNamePage interface so we can get the text entered on Page2:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IAskNamePage
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;string &lt;/span&gt;FullName { &lt;span style="color: blue"&gt;get&lt;/span&gt;;  }
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;It simply returns the text from TextBox:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public string &lt;/span&gt;FullName
{
    &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;textBox1.Text; }
}&lt;/pre&gt;
&lt;p&gt;Here is the last page:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/cc26d6de43d2_908F/image_8.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/cc26d6de43d2_908F/image_thumb_3.png" width="240" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h1&gt;Summary&lt;/h1&gt;
&lt;p&gt;I hope that this example gives you some idea where MEF fits and will help you get started. Let me know if you have any questions about this. For more advanced scenario check out the three samples that shipped with the current drop on CodePlex:&lt;/p&gt;
&lt;li&gt;&lt;a href="http://www.codeplex.com/#MEFlook"&gt;MEFlook&lt;/a&gt; - Outlook like client 
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.codeplex.com/#MEFTris"&gt;MEFTris&lt;/a&gt; - Tetris like game with shapes as plug-ins 
&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.codeplex.com/#Explorer"&gt;Extensible File Explorer&lt;/a&gt; - File explorer with extensible views, favorite file viewers and shell services &lt;/li&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125007"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125007" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/125007.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2008/09/08/125007.aspx</guid>
            <pubDate>Mon, 08 Sep 2008 18:38:46 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/125007.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2008/09/08/125007.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/125007.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/125007.aspx</trackback:ping>
        </item>
        <item>
            <title>Two cool Microsoft Surface apps from InterKnowlogy</title>
            <link>http://geekswithblogs.net/kobush/archive/2008/08/29/124783.aspx</link>
            <description>&lt;p&gt;InterKnowlogy is always on the cutting edge of the Microsoft Platform so its not surprise that we were among first to build applications in WPF, Silverlight and now on &lt;a href="http://www.microsoft.com/surface" target="_blank"&gt;Microsoft Surface&lt;/a&gt; (a touch screen computer embedded in a coffee table). I'm excited to show you two applications that we released recently.&lt;/p&gt; &lt;h1&gt;VitruView&lt;/h1&gt; &lt;p&gt;VirtuView is a collaborative environment for viewing and annotating patient's examination results on anatomic 3D models. This application is evolution of our earlier &lt;a href="http://www.interknowlogy.com/lab/Pages/Angiographer.aspx" target="_blank"&gt;Angiographer&lt;/a&gt; that we build for &lt;a href="http://intermountainhealthcare.org/xp/public/" target="_blank"&gt;InterMountain Healthcare&lt;/a&gt; together with our partner &lt;a href="http://www.zygote.com/" target="_blank"&gt;Zygote&lt;/a&gt; (world's leader in 3D human anatomy models and textures). VirtuView lets users zoom and rotate the 3D heart models with your hands. You can use your fingers to draw arteries, place Stents and add annotations. And because this is multitouch you can use more than one finger or many people can work at once. This application is done in WPF and uses &lt;a href="http://www.healthvault.com/" target="_blank"&gt;Microsoft HealthVault&lt;/a&gt; to securely store patient's data. &lt;/p&gt; &lt;p&gt;Check out this video demonstration from Tim Huckaby and Kevin Kennedy:&lt;/p&gt; &lt;p&gt;&lt;iframe style="width: 500px; height: 375px" src="http://silverlight.services.live.com/invoke/67733/VitruView/iframe.html" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Update: &lt;/strong&gt;Here you can watch another video with Tim and Dr. Peter Kuhn from &lt;a href="http://blogs.msdn.com/healthblog/archive/2008/08/27/microsoft-hug-wish-you-were-here-day-2.aspx" target="_blank"&gt;Health User Group Conference&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;h1&gt;History at your fingertips&lt;/h1&gt; &lt;p&gt;This amazing application was built in conjunction with Microsoft and the Library of Congress. It chronicles the history of the republican and democratic national conventions in interactive Surface experience. The application is featured LIVE on Surface units at both upcoming conventions, and it was shown on the ABC National News this week and you can watch it on the &lt;a href="http://abcnews.go.com/Video/playerIndex?id=5660365" target="_blank"&gt;ABCnews.com website&lt;/a&gt; (move forward to approximately 01:18). &lt;/p&gt; &lt;p&gt;Here is a more technical demonstration from Rodney Guzman:&lt;/p&gt;&lt;iframe style="width: 500px; height: 375px" src="http://silverlight.services.live.com/invoke/67733/History%20At%20Your%20Fingertips_2/iframe.html" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt; &lt;p&gt; &lt;/p&gt; &lt;h1&gt;What about me?&lt;/h1&gt; &lt;p&gt;Meanwhile I've been working with great team at &lt;a href="http://www.coloniallife.com/" target="_blank"&gt;Colonial Life &amp;amp; Accident Insurance Company&lt;/a&gt; that built the Harmony solution. We helped them built a WPF offline version of the Web based Harmony self-enrollment system that will be used by insurance agents. You can find more details in this &lt;a href="http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=4000002535" target="_blank"&gt;Microsoft case study&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=124783"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=124783" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/124783.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2008/08/29/124783.aspx</guid>
            <pubDate>Fri, 29 Aug 2008 13:41:02 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/124783.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2008/08/29/124783.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/124783.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/124783.aspx</trackback:ping>
        </item>
        <item>
            <title>How I won the Lab49 WPF in Finance Innovation Contest?</title>
            <link>http://geekswithblogs.net/kobush/archive/2008/03/17/120601.aspx</link>
            <description>&lt;p&gt;&lt;img style="margin: 0px 0px 5px 5px" src="http://www.lab49.com/files/logos/wpf_logo_blue3.gif" align="right" /&gt;Honestly, I still don't know how I did it. The LAB49 &lt;a href="http://wpfcontest.lab49.com/"&gt;WPF in Finance Innovation Contest&lt;/a&gt; was announced back in December and I think I first read about it on &lt;a href="http://blogs.msdn.com/tims/archive/2007/12/04/wpf-and-silverlight-contest-season-is-here.aspx"&gt;Tim Sneath blog&lt;/a&gt;. With &lt;a href="http://wpfcontest.lab49.com/prizes.aspx"&gt;all the cool prizes&lt;/a&gt; I was very inclined to participate, but it quickly turned out that its available only to US citizens. However that changed in the first week of February, so I started considering it again, but still didn't had any clue what to do. You see the goal of this contest was to create a WPF application that visualizes a set of provided financial data in some interesting way. While the first part was easy (writing the app in WPF) the hardest part was to figure out what to do with the data. Only after "last call to action" email from Daniel Chait I decided its about time to start coding.&lt;/p&gt; &lt;p&gt;Because I started working late on this project, initially I wanted to create only a charting control capable of displaying the line and candlestick plot of stock prices. But after the contest deadline was extended I started thinking of a better way to visualize the stock prices for a given day – something that goes beyond a simple listbox or a datagrid. The next option I considered was to create a heatmap – i.e. use color gradients to denote the change in stock prices relative to the previous day. But in all samples I’ve seen these symbols were placed on a regular grid and the placement didn’t correspond in any particular way with the data. I started thinking about how to sort the symbols so that those that experienced similar data change would be close to each other, and those with different data change remain further apart. This finally led me to the idea of applying &lt;a href="http://www.red3d.com/cwr/boids/"&gt;Craig Reynolds’ flocking algorithm&lt;/a&gt; to perform this clustering.  &lt;/p&gt;&lt;p&gt;Here is a screenshot from my final entry called &lt;strong&gt;Stock Information Boids&lt;/strong&gt;:  &lt;/p&gt;&lt;p align="center"&gt; &lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/HowIwontheLab49WPFinFinanceInnovationCon_11EC2/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="480" alt="Stock Information Boids WPF Application" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/HowIwontheLab49WPFinFinanceInnovationCon_11EC2/image_thumb_1.png" width="591" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Also you can already download the source code for this application from &lt;a href="http://code.msdn.microsoft.com/KobushCode/Release/ProjectReleases.aspx?ReleaseId=667"&gt;my resource page at MSDN Code Gallery&lt;/a&gt;. Make sure to read the user guide that describes how the algorithm works and how to use the application.  &lt;/p&gt;&lt;p&gt;Turns out that for some reason the judges liked my solution, because last week at the closing keynote of 2008 &lt;a href="http://www.financialdevelopers.com"&gt;Microsoft Financial Services Developer Conference&lt;/a&gt; in New York, &lt;a href="http://blog.lab49.com/archives/1888"&gt;Daniel Chait announced&lt;/a&gt; that I won &lt;a href="http://blog.lab49.com/archives/1884"&gt;the grand prize in the contest&lt;/a&gt;!  &lt;/p&gt;&lt;p&gt;The two finalist were &lt;strong&gt;Jacob Carpenter&lt;/strong&gt; and &lt;strong&gt;Jobi K Joy&lt;/strong&gt;, while the honorable mention went to &lt;strong&gt;Paul Hounshell&lt;/strong&gt;. Congratulations guys, great work! You can download their very cool applications from here: &lt;/p&gt; &lt;p&gt;&lt;iframe style="border-right: #dde5e9 1px solid; padding-right: 0px; border-top: #dde5e9 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 3px; border-left: #dde5e9 1px solid; width: 240px; padding-top: 0px; border-bottom: #dde5e9 1px solid; height: 66px; background-color: #ffffff" marginwidth="0" marginheight="0" src="http://cid-5b79e3a01fce9e08.skydrive.live.com/embedrowdetail.aspx/2008%20WPF%20in%20Finance%20Innovation%20Contest" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt; &lt;p&gt;In following weeks I will try to share some details on my implementations (in particular about the Timeline and Flock controls). I was already told that &lt;a href="http://jobijoy.blogspot.com/"&gt;Jobi K Joy&lt;/a&gt; and &lt;a href="http://jacobcarpenter.wordpress.com/"&gt;Jacob Carpenter&lt;/a&gt; plan to do the same, so make sure to subscribe to their blogs too.  &lt;/p&gt;&lt;p&gt;I would like to thank &lt;a href="http://wpfcontest.lab49.com/judges.aspx"&gt;the judges&lt;/a&gt; for selecting my entry. And last but not least, big kisses for my wife Joanna for letting me work on the project all nights and weekends considering her present condition (L)&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120601"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120601" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/120601.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2008/03/17/120601.aspx</guid>
            <pubDate>Tue, 18 Mar 2008 02:39:06 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/120601.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2008/03/17/120601.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/120601.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/120601.aspx</trackback:ping>
        </item>
        <item>
            <title>Moving my code samples to MSDN Code Gallery</title>
            <link>http://geekswithblogs.net/kobush/archive/2008/02/19/119752.aspx</link>
            <description>&lt;p&gt;When I started blogging here on GeeksWithBlogs it turned out that if want to publish any code samples I have to find yet another place to host the source code. I didn't own any web servers that I could use for this, so I started looking how other bloggers do this, and came across &lt;a href="http://www.projectdistributor.net/" target="_blank"&gt;ProjectDistributor.net&lt;/a&gt;. It did exactly what I was looking for:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;ProjectDistributor is a web application for distributing small pieces of software - such as tools, components, widgets and controls. Users create groups to store projects against and visitors can login to download those projects or to leave feedback about bugs or to request new features. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Although it's quite simple and didn't offer many features it did a decent job hosting my samples. The projects can be grouped by author and category. &lt;/p&gt;  &lt;p&gt;However recently I got several comments that the download links don't work, and the site was down for some time (now it's up again). To fix this I decided to move my files to &lt;a href="skydrive.live.com" target="_blank"&gt;Windows Live SkyDrive&lt;/a&gt;. It's a generic service for hosting any files on internet. When you sign up you get 1GB of free space. The UI is very simple: you can create folders, setup the permissions (private, shared or public) and you then quickly upload your files. &lt;/p&gt;  &lt;p&gt;The nice addition is that when you publish a file on SkyDrive, it creates a nicely formatted HTML snippets that you can embed in your page (there is even a &lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=27545581-4b54-4f6d-9007-ed3b168dab43&amp;amp;pl=8&amp;amp;bt=9" target="_blank"&gt;Windows Live Writer plugin&lt;/a&gt; that helps you with this):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/MovingmysamplestoMSDNCodeGallery_12403/image_2.png" target="_blank"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="500" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/MovingmysamplestoMSDNCodeGallery_12403/image_thumb.png" width="567" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;These nice emblems is the only thing I really miss abut SkyDrive. They were just easier to find on the page then a simple download link.&lt;/p&gt;  &lt;p&gt;But as I said, SkyDrive is a generic service not really targeted to host programming samples. You don't get any ways to categorize, tag or search the projects. You don't even get the number of downloads or any other statistics. In addition some of my friends reported that they get redirected to Sign In page for Windows Live whenever they open my blog.&lt;/p&gt;  &lt;p&gt;That's why when I heard about CodePlex's younger brother – &lt;a href="http://code.msdn.microsoft.com/" target="_blank"&gt;MSDN Code Gallery&lt;/a&gt; on recent &lt;a href="http://www.dotnetrocks.com/default.aspx?showNum=316" target="_blank"&gt;.NET Rocks! interview with Matthew Manela&lt;/a&gt; I decided to give it a try and this weekend I moved all my samples there:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/MovingmysamplestoMSDNCodeGallery_12403/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="386" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/MovingmysamplestoMSDNCodeGallery_12403/image_thumb_1.png" width="660" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Here is the link to my resources page: &lt;a title="http://code.msdn.microsoft.com/KobushCode" href="http://code.msdn.microsoft.com/KobushCode"&gt;http://code.msdn.microsoft.com/KobushCode&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;My experience so far was very positive. It's basically a CodePlex (even shares the same codebase from what I heard) but without the TFS integration - so you don't get version control or project management features. But when you create a resource page you still get:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Home page &lt;/strong&gt;that you can edit with wiki syntax and supports comments. You can also create subpages to publish your articles or documentation. You can also &lt;strong&gt;tag&lt;/strong&gt; your project so it would be easier to find for others. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Rleases tab &lt;/strong&gt;where you publish your source code, binaries or stand alone documentation (and it has a downloads counter). &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Discussions forum &lt;/strong&gt;that your readers can use to publish questions or comments. &lt;/li&gt;    &lt;li&gt;You can even run an &lt;strong&gt;Issue Tracker &lt;/strong&gt;to record bugs or feature requests if you need to (it's optional and you can turn it on in the Resource Page Settings). &lt;/li&gt;    &lt;li&gt;If you find someone to help you out with the project you can manage your team on the &lt;strong&gt;People tab&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;License tab &lt;/strong&gt;shows the terms and conditions the user needs to agree when downloading your code. Note that currently it's the &lt;a href="http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx" target="_blank"&gt;Microsoft Public License (Ms-PL)&lt;/a&gt; and you cannot change it (you can do this on CodePlex though). It's a basic "use it how you want - no guarantee" type of license, and personally I don't have any objections to it but you need to judge it for yourself. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Also note that while I decided to publish all my samples on a single resources page, nothing prevents you from creating more than one. You can then link them together using &lt;strong&gt;Related Resource Pages&lt;/strong&gt; sections. &lt;/p&gt;  &lt;p&gt;For me the site offers all I really need to host my code samples. But if your project eventually grows and you need more features you can move it to &lt;a href="http://www.codeplex.com/" target="_blank"&gt;CodePlex&lt;/a&gt; (I wonder if there will be any migration path for doing this). Also note that in many aspects it replaces now retired GotDotNet site and some popular samples &lt;a href="http://code.msdn.microsoft.com/GotDotNet.aspx" target="_blank"&gt;were migrated from it&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Probably most bloggers that write about programming face the same problem that I had, and MSDN Code Gallery does a good job solving it. So if you are looking for a place to put your samples I strongly recommend to give it a try. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119752"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119752" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/119752.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2008/02/19/119752.aspx</guid>
            <pubDate>Tue, 19 Feb 2008 13:14:13 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/119752.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2008/02/19/119752.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/119752.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/119752.aspx</trackback:ping>
        </item>
        <item>
            <title>Introducing WikiSpider</title>
            <link>http://geekswithblogs.net/kobush/archive/2008/01/30/119101.aspx</link>
            <description>&lt;p&gt;About two weeks ago &lt;a href="http://www.microsoft.com/poland/developer/kontakt/dbiesiada.mspx"&gt;Daniel Biesiada&lt;/a&gt; (who is ISV DE here in Poland) announced on his blog a little &lt;a href="http://blogs.msdn.com/danieb/archive/2008/01/13/pl-geek-w-spos-b-na-nud-w-tym-konkurs.aspx"&gt;programming contest&lt;/a&gt;. The goal was to build a .NET application that would check if the the theory of &lt;a href="http://en.wikipedia.org/wiki/Six_degrees_of_separation"&gt;Six Degrees of separation&lt;/a&gt; applies to two given topics in Wikipedia. In order words to find a path from the source page to destination with no more then six links. At the time I had not much else to do (apart from setting up website for the &lt;a href="http://www.c2c2008.pl/"&gt;C2C Conference&lt;/a&gt;, helping out with the &lt;a href="http://poland.silverlightchallenge.eu/"&gt;European Silverlight Challenge&lt;/a&gt;, and preparing for the WPF Beta Exam) so I decided to give it a try. &lt;/p&gt; &lt;p&gt;Fast forward two weeks and I present you my WikiSpider:&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="534" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/e10a9ad47337_11C9E/image_3.png" width="600" border="0" /&gt; &lt;/p&gt; &lt;p&gt;As usual building this took me much more time than I initially anticipated (including few sleepless nights). And still I didn't make it before the deadline, so this even didn't count as a contest entry anymore (sigh!). However this was mainly because my personal goal was to throw in there every new piece of .NET 3.5 I could find fit - and most of them I never used before. &lt;/p&gt; &lt;p&gt;Here are some key technologies I managed to put into this:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;The UI is done in &lt;strong&gt;WPF&lt;/strong&gt; (and this was the only thing here I knew a bit about). However I borrowed the graph control from the excellent &lt;a href="http://j832.com/BagOTricks/"&gt;Kevin's WPF Bag-o-Tricks&lt;/a&gt;.  &lt;/li&gt;&lt;li&gt;The caching is done using &lt;strong&gt;SQL Server Express&lt;/strong&gt;. Initially I wanted to do this using &lt;strong&gt;SQL Compact &lt;/strong&gt;but I run into performance issues and had to switch to full SQL in order to run the queries in profiler. But since this was fixed (with big help from &lt;a href="http://zine.net.pl/blogs/sqlgeek/"&gt;Paweł Potasiński&lt;/a&gt;) I could try with SQL Compact again.  &lt;/li&gt;&lt;li&gt;Of course data-access is done using &lt;strong&gt;LINQ to SQL&lt;/strong&gt;. And of course this was the main source of my problems, as it was first time I've done anything in it, and so far I only read the &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/08/27/linq-to-sql-part-8-executing-custom-sql-expressions.aspx"&gt;Scott Gu's tutorials&lt;/a&gt;. Still, I'm already in love with it.  &lt;/li&gt;&lt;li&gt;Speaking of LINQ. Initially we were screen scrapping the HTML pages to get all the links.  But turns out that Wikipedia has a little known about &lt;a href="http://en.wikipedia.org/w/query.php"&gt;Query API&lt;/a&gt; that enables to get the page content in XML. So the obvious move was to rewrite this part with &lt;strong&gt;LINQ to XML&lt;/strong&gt;.  &lt;/li&gt;&lt;li&gt;The path-finding algorithm was borrowed from &lt;a href="http://blogs.msdn.com/ericlippert/archive/2007/10/10/path-finding-using-a-in-c-3-0-part-four.aspx"&gt;Eric Lippert&lt;/a&gt;. The nice thing about it is that it uses lots of &lt;strong&gt;C# 3.0 language features&lt;/strong&gt;, so it is a great resource to learn from. The new C# syntax is so addictive that I already miss it in my other project.  &lt;/li&gt;&lt;li&gt;Finally, I wanted to publish the app with ClickOnce but run out of time. So maybe later. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I learned many interesting things and tried out some new stuff that I wanted to check out anyway. I will try to share my discoveries in the next few days, but in the meantime feel free to download and take a look at may code (I know it's not prettiest piece of code you've seen but I was in a rush to finish this on time):&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;a title="SixDegreesOfWikipedia 1.0" href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=KobushCode&amp;amp;DownloadId=686"&gt;Download the source code&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Here you can also download the entries from other participants: &lt;a href="http://www.dbiesiada.com/projects/WikiPathFinding/wikiContest_LukaszSowa.zip"&gt;Łukasz Sowa&lt;/a&gt;, &lt;a href="http://www.dbiesiada.com/projects/WikiPathFinding/wikiContest_MaciejRutkowski.zip"&gt;Maciej Rutkowski&lt;/a&gt;, and &lt;a href="http://www.dbiesiada.com/projects/WikiPathFinding/WikiContest_ArkadiuszBenedykt.zip"&gt;Arkadiusz Benedykt&lt;/a&gt;. Congratulations to all of you!&lt;/p&gt; &lt;h3&gt;Installation&lt;/h3&gt; &lt;ol&gt; &lt;li&gt;Download the code from the above link and extract it.  &lt;/li&gt;&lt;li&gt;The application uses local SQL database for caching and unfortunately you need to create it yourself (now you know why I wanted to use SQL Compact). Simply launch SSMS and create empty database called WikiCache.  &lt;/li&gt;&lt;li&gt;Run the &lt;strong&gt;Create_WikiCacheDB.sql&lt;/strong&gt; script from the &lt;strong&gt;data &lt;/strong&gt;folder to create the database schema.  &lt;/li&gt;&lt;li&gt;By default the app is configured to look for the &lt;strong&gt;WikiCache &lt;/strong&gt;database on the local &lt;strong&gt;SQLEXPRESS &lt;/strong&gt;instance. If you installed it somewhere else update the connection string in &lt;strong&gt;app.config &lt;/strong&gt;accordingly.  &lt;/li&gt;&lt;li&gt;Run the &lt;strong&gt;build.bat &lt;/strong&gt;or open solution in Visual Studio 2008 and run from there.&lt;/li&gt;&lt;/ol&gt; &lt;h3&gt;Usage&lt;/h3&gt; &lt;ol&gt; &lt;li&gt;Enter the name of the Wikipedia page in the address bar at the top and press the Go! button. The entered topic and the pages it links to will be displayed as graph.  &lt;/li&gt;&lt;li&gt;Clicking on any topic will make it currently selected (put it in the center of the graph).  &lt;/li&gt;&lt;li&gt;Right-click on any topic to open the context menu. Select "&lt;em&gt;Open in browser&lt;/em&gt;" to.... load the page in browser.  &lt;/li&gt;&lt;li&gt;Select "&lt;em&gt;Set as source&lt;/em&gt;" or "&lt;em&gt;Set as destination&lt;/em&gt;" to put the topic name in appropriate field on the sidebar &lt;br /&gt;[Note: &lt;em&gt;Currently it's the only way to show the sidebar&lt;/em&gt;]  &lt;/li&gt;&lt;li&gt;You can also enter the source/destination topics manually.  &lt;/li&gt;&lt;li&gt;When both are set click on the &lt;em&gt;Start &lt;/em&gt;button to begin searching for the path. Few statistics are displayed on the bottom of the sidebar.  &lt;/li&gt;&lt;li&gt;During the search you can still use the graph or navigate to other pages (thanks to the BackgroundWorker magic).  &lt;/li&gt;&lt;li&gt;When path is found it is displayed on the sidebar, and you can click on each topic to center it on graph. &lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Have fun! &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119101"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119101" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/119101.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2008/01/30/119101.aspx</guid>
            <pubDate>Thu, 31 Jan 2008 04:22:47 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/119101.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2008/01/30/119101.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/119101.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/119101.aspx</trackback:ping>
        </item>
    </channel>
</rss>