<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Andrew Oakley's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/atoakley/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/atoakley/feed.xml</link>
    <description>Anything .NET related.</description>
    <lastBuildDate>Tue, 16 Apr 2019 04:42:31 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Just Released - Building an On-Demand Video Service with Microsoft Azure Media Services</title>
      <link>https://docs.microsoft.com/archive/blogs/atoakley/just-released-building-an-on-demand-video-service-with-microsoft-azure-media-services</link>
      <pubDate>Wed, 07 May 2014 09:53:23 GMT</pubDate>
      <dc:creator><![CDATA[Drew Oakley]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/atoakley/2014/05/07/just-released-building-an-on-demand-video-service-with-microsoft-azure-media-services/</guid>
      <description><![CDATA[Microsoft Azure Media Services allows you to build media distribution solutions that can upload,...]]></description>
      <content:encoded><![CDATA[<p>Microsoft Azure Media Services allows you to build media distribution solutions that can upload, encode, package, and stream media to multiple devices and platforms.</p>  <p>Traditionally, building the workflow for the creation, management, and distribution of media is problematic. It involves having to integrate multiple technologies and providers, some of which may be incompatible. In addition, it can require a huge investment in infrastructure, which may not always be fully utilized. These issues can result in a non-standardized workflow that is not easily scaled, and that requires coordination at different stages of the workflow.</p>  <p>Azure Media Services allow you to build scalable, cost effective, end-to-end media distribution solutions that can upload, encode, package, and stream media to Windows, iOS, Android, Adobe Flash, and other devices and platforms.</p>  <p>This guide describes how to design and build a video-on-demand application that uses Media Services. It provides an end to end walkthrough of a Windows Store application that communicates with Media Services through a web service, and explains key design and implementation choices.</p>  <p></p>  <h4>How to get it?</h4>  <p>In addition to the Windows Store application, the guide also includes client applications for Windows Phone 8, HTML5, iOS, and Android devices. You can download the Windows client applications from the <a href="https://aka.ms/amsg-code">Microsoft Download Center</a>. You can download the Android and iOS applications from the <a href="https://aka.ms/amsg-cp">community site</a>.</p>  <p>You can view the documentation on <a href="https://aka.ms/amsg-doc">MSDN</a> or you can download it as an <a href="https://aka.ms/amsg-book">eBook</a> from the Microsoft Download Center.</p>  <h4>How to provide feedback?</h4>  <p>If you’d like to provide feedback, please post it via the <a href="https://wamsg.codeplex.com/discussions">CodePlex forum</a>.</p>  <p>&#160;</p>  <p><strong>Happy coding!</strong></p>]]></content:encoded>
    </item>
    <item>
      <title>Just Released – Data Access for Highly Scalable Solutions: Using SQL, NoSQL, and Polyglot Persistence</title>
      <link>https://docs.microsoft.com/archive/blogs/atoakley/just-released-data-access-for-highly-scalable-solutions-using-sql-nosql-and-polyglot-persistence</link>
      <pubDate>Wed, 02 Oct 2013 10:37:29 GMT</pubDate>
      <dc:creator><![CDATA[Drew Oakley]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/atoakley/2013/10/02/just-released-data-access-for-highly-scalable-solutions-using-sql-nosql-and-polyglot-persistence/</guid>
      <description><![CDATA[All applications use data, and most applications also need to store this data somewhere. In the...]]></description>
      <content:encoded><![CDATA[<p>All applications use data, and most applications also need to store this data somewhere. In the world of business solutions, this often meant creating a relational database. However, relational technology is not always the best solution to meet the increasingly complex data-processing requirements of modern business systems, especially when this processing involves storing and retrieving massive amounts of data. </p>  <p>The advent of NoSQL databases has changed the way in which organizations have started to think about the way in which they structure their data. There is no standard definition of what a NoSQL database is other than they are all non-relational. They are less generalized than relational databases, but the driving force behind most NoSQL databases is focused efficiency and high scalability. </p>  <p>The downside of NoSQL is that no single database is likely to be able to support the complete range of business requirements mandated by your applications. How do you select the most appropriate database to use, or should you remain with the relational model? A modern business application is not restricted to using a single data store, and an increasing number of solutions are now based on a polyglot persistent architecture. The key to designing a successful application is to understand which databases best meet the needs of the various parts of the system, and how to combine these databases into a single, seamless solution. </p>  <p>This guide helps you understand these challenges and enables you to apply the principles of NoSQL databases and polyglot persistent solutions in your own environment. </p>  <p>To help illustrate how to build a polyglot persistent solution, this guide presents a case study of a fictitious company faced with building a highly scalable web application capable of supporting many thousands of concurrent users.</p>  <h4>How to get it?</h4>  <p>The source code for the associated reference implementation can be found on the <a href="https://aka.ms/dag-code">Microsoft Download Center</a>.</p>  <p>You can view the documentation on <a href="https://aka.ms/dag-doc">MSDN</a> or you can download a <a href="https://aka.ms/dag-pdf">PDF</a> from the Microsoft Download Center.&#160; The written guidance is also available for purchase on Amazon as a <a href="https://amzn.to/14ZmrbU">printed book</a> or a <a href="https://amzn.to/16bFJvA">Kindle download</a>.</p>  <h4>How to provide feedback?</h4>  <p>If you’d like to provide feedback, please post it via the <a href="https://dataguidance.codeplex.com/discussions">Codeplex forum</a>.</p>  <p>&#160;</p>  <p><strong>Happy coding!</strong></p>]]></content:encoded>
    </item>
    <item>
      <title>p&amp;p Semantic Logging Block CTP Now Available!</title>
      <link>https://docs.microsoft.com/archive/blogs/atoakley/pp-semantic-logging-block-ctp-now-available</link>
      <pubDate>Fri, 15 Feb 2013 09:53:59 GMT</pubDate>
      <dc:creator><![CDATA[Drew Oakley]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/atoakley/2013/02/15/pp-semantic-logging-block-ctp-now-available/</guid>
      <description><![CDATA[The latest addition to the family of application blocks has been released as a CTP.&#160; Read more...]]></description>
      <content:encoded><![CDATA[<p>The latest addition to the family of application blocks has been released as a CTP.&#160; Read more here!</p>  <p><a title="https://blogs.msdn.com/b/agile/archive/2013/02/07/embracing-semantic-logging.aspx" href="https://blogs.msdn.com/b/agile/archive/2013/02/07/embracing-semantic-logging.aspx">https://blogs.msdn.com/b/agile/archive/2013/02/07/embracing-semantic-logging.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>p &amp; p Data Access Guidance Survey is live!</title>
      <link>https://docs.microsoft.com/archive/blogs/atoakley/p-p-data-access-guidance-survey-is-live</link>
      <pubDate>Thu, 10 Jan 2013 14:34:25 GMT</pubDate>
      <dc:creator><![CDATA[Drew Oakley]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/atoakley/2013/01/10/p-p-data-access-guidance-survey-is-live/</guid>
      <description><![CDATA[The Microsoft patterns &amp; practices team has started a new project focusing on databases and data...]]></description>
      <content:encoded><![CDATA[<p>The Microsoft patterns &amp; practices team has started a new project focusing on databases and data access!</p>  <p>This is your opportunity to tell us what topics (SQL, ORMs, NoSQL, etc.) you feel should be covered in the guidance.</p>  <p>We value your opinions, so please take a moment and fill out this very short survey.</p>  <p><a href="https://www.surveymonkey.com/s/dataaccess">https://www.surveymonkey.com/s/dataaccess</a></p>  <p>Thanks!</p>]]></content:encoded>
    </item>
    <item>
      <title>patterns &amp; practices Symposium 2013 in a little over a month!</title>
      <link>https://docs.microsoft.com/archive/blogs/atoakley/patterns-practices-symposium-2013-in-a-little-over-a-month</link>
      <pubDate>Wed, 05 Dec 2012 14:14:25 GMT</pubDate>
      <dc:creator><![CDATA[Drew Oakley]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/atoakley/2012/12/05/patterns-practices-symposium-2013-in-a-little-over-a-month/</guid>
      <description><![CDATA[The patterns &amp; practices Symposium is the event for software developers and architects to have...]]></description>
      <content:encoded><![CDATA[<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/38/15/metablogapi/4645.clip_image002_1834B010.gif" original-url="https://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-38-15-metablogapi/4645.clip_5F00_image002_5F00_1834B010.gif"><img style="max-width: 550px;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/38/15/metablogapi/4645.clip_image002_1834B010.gif" original-url="https://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-38-15-metablogapi/4645.clip_5F00_image002_5F00_1834B010.gif" alt="" border="0" /></a></p>
<p>The <strong><em>patterns &amp; practices Symposium </em></strong>is <strong><span style="text-decoration: underline;">the</span> </strong>event for software developers and architects to have engaging and meaningful discussions with the people creating technologies and guidance at Microsoft.</p>
<p>This year&rsquo;s Symposium topics span the spectrum of technology, architecture, and teamwork.&nbsp; You will learn about practices, patterns, and technologies that will save you time and reduce risk when creating Cloud, Web, and Windows-based solutions. The Symposium is also an opportunity to influence p&amp;p and other product teams face-to-face to address the scenarios most important to you.</p>
<p><strong>Symposium Highlights</strong></p>
<ul>
<li>This year&rsquo;s theme is exploration&mdash;reflecting software development as a journey of discovery.</li>
<li>Keynote Sessions by senior Microsoft executives including <strong>Scott Guthrie</strong> &amp; <strong>Ales Holecek.</strong></li>
<li>Special keynote sessions delivered by <strong>Felicity Aston</strong>, the first woman to ski across Antarctica alone, and <strong>Adam Steltzner</strong>, NASA lead engineer for Curiosity&rsquo;s Entry, Descent and Landing.</li>
<li>18 thought-provoking sessions.</li>
<li>Symposium Party on Wednesday night.</li>
<li>Scott Hanselman&rsquo;s Coding Game show&mdash;back by popular demand!</li>
</ul>
<p>Registration for the three day Symposium is <strong>$498</strong>.</p>
<p>More information about sessions, speakers, and registration is available online:</p>
<p><span style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"><a href="https://aka.ms/symposium">https://aka.ms/symposium</a></span></p>
<p>Register now!</p>]]></content:encoded>
    </item>
    <item>
      <title>Blending Two Images in Real-Time</title>
      <link>https://docs.microsoft.com/archive/blogs/atoakley/blending-two-images-in-real-time</link>
      <pubDate>Thu, 17 Nov 2011 07:01:43 GMT</pubDate>
      <dc:creator><![CDATA[Drew Oakley]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/atoakley/2011/11/17/blending-two-images-in-real-time/</guid>
      <description><![CDATA[Recently, I was asked to whip up a WPF code sample that mimicked how Expression Design uses Alpha...]]></description>
      <content:encoded><![CDATA[<p>Recently, I was asked to whip up a WPF code sample that mimicked how Expression Design uses Alpha Blending to merge two images together (specifically, the Darken and Lighten blend modes).&#160; Instead of pre-processing the image in Expression Design, the developers wanted a programmable, real-time way to blend images in their application.</p>  <p>Since the application was using WPF 4.0, a pixel shader was a natural fit for this problem.&#160; There have a been a number of great blog posts about pixel shaders, HLSL, and WPF, so I won’t go into detail about the inner workings.&#160; The posts below are the main ones I used to get an understanding how to solve this problem.</p>  <ul>   <li><a href="https://blogs.msdn.com/b/greg_schechter/archive/2008/05/09/a-series-on-gpu-based-effects-for-wpf.aspx" target="_blank">A Series on GPU-based Effects for WPF</a></li>    <li><a href="https://heavenmaster.blogspot.com/2009/05/advanced-alpha-blending-with-hlsl.html" target="_blank">Advanced Alpha Blending with HLSL</a></li>    <li><a href="https://heavenmaster.blogspot.com/2009/06/photoshop-like-alpha-blending.html" target="_blank">Photoshop-like Alpha Blending</a></li>    <li><a href="https://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx" target="_blank">Premultiplied alpha</a></li>  </ul>  <p>While the above articles showed everything needed to get a working sample up and running, there was no overarching sample that brought everything together.&#160; Building a working WPF application that shows an image with a pixel shader effect tied to it is relatively straightforward.&#160; Adding a second image parameter to the pixel shader and an opacity factor is also very simple given the level of pixel shader support in WPF.&#160; One thing that you need to keep in mind is the fact that WPF uses pre-multiplied alpha values for optimization purposes.&#160; That affects the math that you need to do in the pixel shader.</p>  <p>My initial attempt worked great when the images were the same size, however when the images were different sizes, the second image was resized to the size of the base image.&#160; This again is an optimization done by WPF, but definitely doesn’t give the results we would want.&#160; Greg Schechter's last blog <a href="https://blogs.msdn.com/b/greg_schechter/archive/2008/09/27/a-more-useful-multi-input-effect.aspx" target="_blank">post</a> in his series on GPU-based effects in WPF explains this in detail.&#160; To make the ViewBox technique work with absolute X, Y positioning coordinates, there is some sizing math that needs to be done.&#160; Since I try to keep as little code behind as possible in my views, I wrote the converter below to do all of this work for me.</p>  <div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:72fd3eda-5b17-4972-a4b7-40bde5c79e59" class="wlWriterEditableSmartContent"><pre style="background-color:#FFFFFF;overflow: auto;"><span style="color: #000000;">    </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">class</span><span style="color: #000000;"> ViewboxRectConverter : IMultiValueConverter
    {
        </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">object</span><span style="color: #000000;"> Convert(</span><span style="color: #0000FF;">object</span><span style="color: #000000;">[] values, Type targetType, </span><span style="color: #0000FF;">object</span><span style="color: #000000;"> parameter, CultureInfo culture)
        {
            </span><span style="color: #0000FF;">if</span><span style="color: #000000;"> ((values </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;">) </span><span style="color: #000000;">||</span><span style="color: #000000;"> (values.Length </span><span style="color: #000000;">&lt;</span><span style="color: #000000;"> </span><span style="color: #800080;">4</span><span style="color: #000000;">))
            {
                </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> InvalidOperationException(
                    </span><span style="color: #0000FF;">string</span><span style="color: #000000;">.Format(
                    CultureInfo.InvariantCulture,
                    </span><span style="color: #800000;">"</span><span style="color: #800000;">Invalid number of parameters.  Found: {0}  Minimum Required: 4</span><span style="color: #800000;">"</span><span style="color: #000000;">,
                    values.Length));
            }

            </span><span style="color: #0000FF;">double</span><span style="color: #000000;"> baseImageWidth </span><span style="color: #000000;">=</span><span style="color: #000000;"> values[</span><span style="color: #800080;">0</span><span style="color: #000000;">] </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;"> </span><span style="color: #000000;">?</span><span style="color: #000000;"> </span><span style="color: #800080;">0.0d</span><span style="color: #000000;"> : (</span><span style="color: #0000FF;">double</span><span style="color: #000000;">)values[</span><span style="color: #800080;">0</span><span style="color: #000000;">];
            </span><span style="color: #0000FF;">double</span><span style="color: #000000;"> baseImageHeight </span><span style="color: #000000;">=</span><span style="color: #000000;"> values[</span><span style="color: #800080;">1</span><span style="color: #000000;">] </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;"> </span><span style="color: #000000;">?</span><span style="color: #000000;"> </span><span style="color: #800080;">0.0d</span><span style="color: #000000;"> : (</span><span style="color: #0000FF;">double</span><span style="color: #000000;">)values[</span><span style="color: #800080;">1</span><span style="color: #000000;">];
            </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> blendImageWidth </span><span style="color: #000000;">=</span><span style="color: #000000;"> (values[</span><span style="color: #800080;">2</span><span style="color: #000000;">] </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;">) </span><span style="color: #000000;">?</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;"> : (</span><span style="color: #0000FF;">int</span><span style="color: #000000;">)values[</span><span style="color: #800080;">2</span><span style="color: #000000;">];
            </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> blendImageHeight </span><span style="color: #000000;">=</span><span style="color: #000000;"> (values[</span><span style="color: #800080;">3</span><span style="color: #000000;">] </span><span style="color: #000000;">==</span><span style="color: #000000;"> </span><span style="color: #0000FF;">null</span><span style="color: #000000;">) </span><span style="color: #000000;">?</span><span style="color: #000000;"> </span><span style="color: #800080;">1</span><span style="color: #000000;"> : (</span><span style="color: #0000FF;">int</span><span style="color: #000000;">)values[</span><span style="color: #800080;">3</span><span style="color: #000000;">];

            </span><span style="color: #008000;">//</span><span style="color: #008000;"> Just a shortcut to save some if statements.</span><span style="color: #008000;">
</span><span style="color: #000000;">            </span><span style="color: #0000FF;">double</span><span style="color: #000000;"> x </span><span style="color: #000000;">=</span><span style="color: #000000;"> (values.Length </span><span style="color: #000000;">&gt;</span><span style="color: #000000;"> </span><span style="color: #800080;">4</span><span style="color: #000000;">) </span><span style="color: #000000;">?</span><span style="color: #000000;"> values[</span><span style="color: #800080;">4</span><span style="color: #000000;">] </span><span style="color: #0000FF;">as</span><span style="color: #000000;"> </span><span style="color: #0000FF;">double</span><span style="color: #000000;">?</span><span style="color: #000000;"> </span><span style="color: #000000;">??</span><span style="color: #000000;"> </span><span style="color: #800080;">0.0d</span><span style="color: #000000;"> : </span><span style="color: #800080;">0.0d</span><span style="color: #000000;">;
            </span><span style="color: #0000FF;">double</span><span style="color: #000000;"> y </span><span style="color: #000000;">=</span><span style="color: #000000;"> (values.Length </span><span style="color: #000000;">&gt;</span><span style="color: #000000;"> </span><span style="color: #800080;">5</span><span style="color: #000000;">) </span><span style="color: #000000;">?</span><span style="color: #000000;"> values[</span><span style="color: #800080;">5</span><span style="color: #000000;">] </span><span style="color: #0000FF;">as</span><span style="color: #000000;"> </span><span style="color: #0000FF;">double</span><span style="color: #000000;">?</span><span style="color: #000000;"> </span><span style="color: #000000;">??</span><span style="color: #000000;"> </span><span style="color: #800080;">0.0d</span><span style="color: #000000;"> : </span><span style="color: #800080;">0.0d</span><span style="color: #000000;">;

            </span><span style="color: #0000FF;">double</span><span style="color: #000000;"> scaleX </span><span style="color: #000000;">=</span><span style="color: #000000;"> baseImageWidth </span><span style="color: #000000;">/</span><span style="color: #000000;"> blendImageWidth;
            </span><span style="color: #0000FF;">double</span><span style="color: #000000;"> scaleY </span><span style="color: #000000;">=</span><span style="color: #000000;"> baseImageHeight </span><span style="color: #000000;">/</span><span style="color: #000000;"> blendImageHeight;

            </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> Rect((x </span><span style="color: #000000;">/</span><span style="color: #000000;"> blendImageWidth) </span><span style="color: #000000;">*</span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #800080;">1</span><span style="color: #000000;">, (y </span><span style="color: #000000;">/</span><span style="color: #000000;"> blendImageHeight) </span><span style="color: #000000;">*</span><span style="color: #000000;"> </span><span style="color: #000000;">-</span><span style="color: #800080;">1</span><span style="color: #000000;">, scaleX, scaleY);
        }

        </span><span style="color: #0000FF;">public</span><span style="color: #000000;"> </span><span style="color: #0000FF;">object</span><span style="color: #000000;">[] ConvertBack(
            </span><span style="color: #0000FF;">object</span><span style="color: #000000;"> value,
            Type[] targetTypes,
            </span><span style="color: #0000FF;">object</span><span style="color: #000000;"> parameter,
            CultureInfo culture)
        {
            </span><span style="color: #0000FF;">throw</span><span style="color: #000000;"> </span><span style="color: #0000FF;">new</span><span style="color: #000000;"> NotImplementedException();
        }
</span></pre><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  https://dunnhq.com --></div>

<p>The XAML usage is as follows.</p>

<div style="margin: 0px; padding: 0px; float: none; display: inline;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:9380ee9c-e427-4dfc-b10c-78e4ac997eeb" class="wlWriterEditableSmartContent"><pre style="background-color:#FFFFFF;overflow: auto;"><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">ImageBrush </span><span style="color: #FF0000;">x:Name</span><span style="color: #0000FF;">="imageBrush"</span><span style="color: #FF0000;"> ImageSource</span><span style="color: #0000FF;">="</span><span style="color: #808000;">{Binding ElementName=blendImageName, Path=SelectedValue}</span><span style="color: #0000FF;">"</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
    </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">ImageBrush.Viewbox</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
        </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">MultiBinding </span><span style="color: #FF0000;">Converter</span><span style="color: #0000FF;">="</span><span style="color: #808000;">{StaticResource rectConverter}</span><span style="color: #0000FF;">"</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
            </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">Binding </span><span style="color: #FF0000;">RelativeSource</span><span style="color: #0000FF;">="</span><span style="color: #808000;">{RelativeSource Mode=FindAncestor, AncestorType=Image}</span><span style="color: #0000FF;">"</span><span style="color: #FF0000;"> Path</span><span style="color: #0000FF;">="ActualWidth"</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
            </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">Binding </span><span style="color: #FF0000;">RelativeSource</span><span style="color: #0000FF;">="</span><span style="color: #808000;">{RelativeSource Mode=FindAncestor, AncestorType=Image}</span><span style="color: #0000FF;">"</span><span style="color: #FF0000;"> Path</span><span style="color: #0000FF;">="ActualHeight"</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
            </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">Binding </span><span style="color: #FF0000;">RelativeSource</span><span style="color: #0000FF;">="</span><span style="color: #808000;">{RelativeSource Mode=Self}</span><span style="color: #0000FF;">"</span><span style="color: #FF0000;"> Path</span><span style="color: #0000FF;">="(ImageBrush.ImageSource).(BitmapSource.PixelWidth)"</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
            </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">Binding </span><span style="color: #FF0000;">RelativeSource</span><span style="color: #0000FF;">="</span><span style="color: #808000;">{RelativeSource Mode=Self}</span><span style="color: #0000FF;">"</span><span style="color: #FF0000;"> Path</span><span style="color: #0000FF;">="(ImageBrush.ImageSource).(BitmapSource.PixelHeight)"</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
            </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">Binding </span><span style="color: #FF0000;">ElementName</span><span style="color: #0000FF;">="xSlider"</span><span style="color: #FF0000;"> Path</span><span style="color: #0000FF;">="Value"</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
            </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">Binding </span><span style="color: #FF0000;">ElementName</span><span style="color: #0000FF;">="ySlider"</span><span style="color: #FF0000;"> Path</span><span style="color: #0000FF;">="Value"</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
        </span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">MultiBinding</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
    </span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">ImageBrush.Viewbox</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
</span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">ImageBrush</span><span style="color: #0000FF;">&gt;</span></pre><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  https://dunnhq.com --></div>

<p>You might notice that I am binding to the actual width and height of the Image and ImageBrush respectively.&#160; This is to allow our converter to update appropriately when either image changes in our view.&#160; Binding to the ImageSource property doesn’t quite work the same as other bindings, so I took the path of least resistance.</p>

<p>You can download the sample application <a href="https://skydrive.live.com/?cid=7e466f88f26644d7&amp;sc=documents&amp;move=7E466F88F26644D7!1125&amp;sid=7E466F88F26644D7!106&amp;iscopy=0&amp;id=7E466F88F26644D7%211126#" target="_blank">here</a>.&#160; It contains free sample images from various sources on the web.&#160; I have resized all of the base images to 1024 x 768 and 96 ppi.&#160; If you want to add your own, just make sure that it is 96 ppi, or WPF will resize it automatically.</p>

<p>To make this sample application build, you will need to install the Microsoft DirectX SDK.&#160; I used the June 2010 DirectX SDK which is available <a href="https://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=6812" target="_blank">here</a>, but as long as you have a version that can compile Pixel Shader 2.0 FX files, it should be fine.&#160; Also, to make my sample easier for me to test, there are two pre-build events that compile the pixel shaders every time you build.&#160; My install path may be different than yours, so if you get errors during a build, check the path to the fxc.exe and make sure it is pointing to your install of the DirectX SDK.</p>

<p>There are many cool things that can be done with pixel shaders and this basic setup should allow you to add your own to try out.&#160; For a great set of shaders, check out the <a href="https://wpffx.codeplex.com/" target="_blank">WPF Pixel Shader Effects Library</a> on CodePlex.</p>]]></content:encoded>
    </item>
    <item>
      <title>Unity Lifetime Managers and WCF</title>
      <link>https://docs.microsoft.com/archive/blogs/atoakley/unity-lifetime-managers-and-wcf</link>
      <pubDate>Wed, 29 Dec 2010 11:43:41 GMT</pubDate>
      <dc:creator><![CDATA[Drew Oakley]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/atoakley/2010/12/29/unity-lifetime-managers-and-wcf/</guid>
      <description><![CDATA[This is a rehash/update of a post I had made on my personal blog.&#160; I have made a couple of...]]></description>
      <content:encoded><![CDATA[<p>This is a rehash/update of a post I had made on my personal blog.&#160; I have made a couple of important updates to the code to fix the incorrect handling of Dispose() for a couple of the extensions.&#160; I have also updated the project to VS2010 and Unity 2.0.</p>  <p>While the original post referenced a non-Microsoft ORM I used in a previous company, the concept/problem still applies to many problems, including the Entity Framework and it’s associated ObjectContext.</p>  <p>In a nutshell, the problem with the application surfaced because I was naively using the the per-thread lifetime manager included with Unity within my WCF service.&#160; In the course of testing, I found that the objects using this lifetime manager seemed to occasionally persist across service calls.&#160; After spending a couple of minutes looking at stack traces and general debugging, it finally dawned on me what was happening.&#160; WCF's threading model, which was designed to make my services speedy, was actually causing the problem.</p>  <p>What was happening was that the same thread that was obtained in my first service call was being used to service my second service call.&#160; Because I was using the per-thread lifetime manager in Unity, the object was not going to be removed from the container until the associated thread went away.&#160; Well, in WCF, the threads don't ever really go away.&#160; Uh oh!</p>  <p>After talking with <a href="https://scottdensmore.typepad.com/blog/" target="_blank">Scott</a> (who luckily used to work on Unity), we came up with the idea to build a Unity lifetime manager tied to WCF's OperationContext.&#160; That way, our container objects would live only for the lifetime of the request, rather than the actual thread.</p>  <p>Starting with IExtension&lt;OperationContext&gt; and an implementation of IDispatchMessageInspector, I soon had an implementation of a UnityOperationContextLifetimeManager.&#160; Once we used this lifetime manager instead of the per-thread lifetime manager, the problem disappeared.</p>  <p>Once that was done, I figured that since I did one of the extensible objects in WCF, I might as well do the rest.&#160; The attached zip has lifetime managers to support all of the IExtensibleObject&lt;T&gt; implementations within WCF.</p>  <p>All of the lifetime managers are fairly straightforward, except for the UnityInstanceContextLifetimeManager.&#160; This depends on the InstanceContext of a given service on which it is enabled.&#160; PerSession is the default instancing mode for InstanceContext, but only when the transport supports sessions.&#160; If the transport does not support sessions, the instancing mode is essentially PerCall.</p>  <p>I have included the Unity assemblies in the zip file for ease of compilation, but if you plan on using any of this code, I would point the references to wherever you have your Unity assemblies.</p>  <p>I’m working on getting these added to <a href="https://unitycontributions.codeplex.com/">Unity Contrib</a>, but for now, just download the code..</p>  <p>Please note that the testing application is not necessarily a best practice for self-hosting a service, but I wanted you to see how to use the lifetime managers without having to worry about IIS (since IIS 6 doesn't have WAS and doesn't support the net.tcp binding).&#160; Make sure if you are on Windows 7/Vista, you run this sample application as admin.</p>  <p><a href="https://cid-7e466f88f26644d7.skydrive.live.com/self.aspx/.Public/UnityWcfExtensions.zip">Download - UnityWcfExtensions.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Introduction</title>
      <link>https://docs.microsoft.com/archive/blogs/atoakley/introduction</link>
      <pubDate>Mon, 18 Oct 2010 19:58:13 GMT</pubDate>
      <dc:creator><![CDATA[Drew Oakley]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/atoakley/2010/10/18/introduction/</guid>
      <description><![CDATA[Hello, all.&#160; My name is Andrew Oakley.&#160; I am a Developer Evangelist for Microsoft working...]]></description>
      <content:encoded><![CDATA[<p>Hello, all.&#160; My name is Andrew Oakley.&#160; I am a Developer Evangelist for Microsoft working in the Communications Sector.&#160; I will be posting on C#, Visual Studio, TFS, BizTalk, WCF, Silverlight, Azure, SharePoint, and almost any other .NET-related technologies.</p>  <p>It has been quite awhile since I have blogged about .NET, so it will take a bit of time to get some posts together.&#160; However, hopefully you will all eventually find something useful on this blog.&#160; My first post will be around some custom lifetime managers for Unity that allow you take advantage of the various contexts within WCF.&#160; This will be an update of a post from my personal blog with some minor updates suggested by the community (i.e. I fixed a couple of “bugs”). <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/41/43/metablogapi/8420.wlEmoticon-openmouthedsmile_09B37888.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-41-43-metablogapi/8420.wlEmoticon_2D00_openmouthedsmile_5F00_09B37888.png" /></p>  <p>Until then, happy coding!</p>]]></content:encoded>
    </item>
  </channel>
</rss>