<?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>Null Reference Exception</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/brchris/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/brchris/feed.xml</link>
    <description>Let&amp;#039;s see if this works...</description>
    <lastBuildDate>Tue, 16 Apr 2019 04:49:13 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Oracle Connections with DataDirect Part 2: Reauthentication</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/oracle-connections-with-datadirect-part-2-reauthentication</link>
      <pubDate>Mon, 07 Jun 2010 05:56:12 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2010/06/07/oracle-connections-with-datadirect-part-2-reauthentication/</guid>
      <description><![CDATA[In Part 1, we looked at fixing a problem with the memory usage of connection pools by accelerating...]]></description>
      <content:encoded><![CDATA[<p>In Part 1, we looked at fixing a problem with the memory usage of connection pools by accelerating the timeout, but that didn’t address some of the root problems.&#160; For one, why does every user have his own connection pool?&#160; </p>  <p>DataDirect pools connections based on unique connection strings (as do most DB providers), but shouldn’t there be a way to use the same connection string for multiple users?&#160; As it turns out, DataDirect and Oracle provide just that mechanism.&#160; DataDirect calls it <a href="https://media.datadirect.com/download/docs/dotnet/alldotnet/userguide/wwhelp/wwhimpl/js/html/wwhelp.htm?href=usedotnet_adv2.html">reauthentication</a>.&#160; This lets you open a DB connection using a common proxy user, set the CurrentUser and CurrentPassword properties on the connection, and then open the connection.&#160; Key here is that all users need the Oracle CONNECT THROUGH permission set.</p>  <p>With this setup, there is only one connection pool for the application, allowing much more efficient reuse of connections across users instead of needing a new connection every time a user logs in.</p>  <p>There is a small performance penalty to be paid with this configuration, however.&#160; Each context switch of a connection from one user to another incurs a small hit, but the overall performance of the application in our case was vastly improved.</p>]]></content:encoded>
    </item>
    <item>
      <title>Web Security Practice</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/web-security-practice</link>
      <pubDate>Mon, 07 Jun 2010 05:31:24 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2010/06/07/web-security-practice/</guid>
      <description><![CDATA[I recently started checking out Google Code University’s Jarlsberg Project, which is a really cool...]]></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/01/28/93/metablogapi/3704.jarlsberg-78_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-28-93-metablogapi/3704.jarlsberg_2D00_78_5F00_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="jarlsberg-78" border="0" alt="jarlsberg-78" align="right" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/93/metablogapi/2627.jarlsberg-78_thumb.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-28-93-metablogapi/2627.jarlsberg_2D00_78_5F00_thumb.png" width="105" height="105" /></a> I recently started checking out Google Code University’s <a href="https://jarlsberg.appspot.com/">Jarlsberg Project</a>, which is a really cool idea to provide a sandboxed website with multiple security vulnerabilities.&#160; It then gives the user challenges to hack the site in various different ways and provides explanations and walkthroughs of how to fix the vulnerabilities that were just exploited.</p>  <p>I haven’t seen a more effective way of learning about secure coding practices for the web.&#160; It’s certainly not as interesting to read about Cross-Site Scripting than it is to try and get an alert(1) window to pop up on another website.</p>  <p>I definitely recommend going through at least the first few exercises if you have any responsibility for a public-facing website or just an interest in web security.</p>]]></content:encoded>
    </item>
    <item>
      <title>Oracle Connections with DataDirect Part 1: Timeout</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/oracle-connections-with-datadirect-part-1-timeout</link>
      <pubDate>Mon, 07 Jun 2010 05:16:16 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2010/06/07/oracle-connections-with-datadirect-part-1-timeout/</guid>
      <description><![CDATA[Recently, a customer had issues with an ASP.Net application connecting to an Oracle database using...]]></description>
      <content:encoded><![CDATA[<p>Recently, a customer had issues with an ASP.Net application connecting to an Oracle database using the DataDirect provider.&#160; The customer was seeing runaway memory usage and was using a 40 minute App Pool recycle schedule to combat it.&#160; This worked for a while, but during App Pool recycles, they were seeing connection timeouts to the database.&#160; </p>  <p>It turned out that the timeouts were directly caused by a patch addressing mutex issues that needed to be applied to Oracle.&#160; However, many connection settings in the application contributed to the problem, and in the process of debugging the issue I learned a lot about connections that I’ll try to share here.</p>  <p>In this system, all application users are also database users.&#160; Many consider this to be a security best practice in Oracle, but I’ll leave discussion of that for a later date.&#160; The problem arises because DataDirect does connection pooling based on unique connection strings (every unique connection string gets its own pool).&#160; In this setup, ever user was getting his own pool to each database in the application, which led to rapidly increased memory usage under load.&#160; </p>  <p>One issue we identified that was contributing to the high memory usage was that the <a href="https://media.datadirect.com/download/docs/dotnet/alldotnet/userguide/wwhelp/wwhimpl/js/html/wwhelp.htm?href=usedotnet_adv2.html">Load Balance Timeout</a> connection string parameter was set to 1 hour.&#160; This meant that, combined with the 40 minute App Pool recycle, that user connections were never being gracefully expired from the pool.&#160; Every user had their own connection pool that lived until the App Pool recycled and killed every pool at once.&#160; </p>  <p>Changing this timeout parameter to 10 minutes allowed us to change the App Pool recycle to a daily event.&#160; Users did not see any impact, because their connections only expired after 10 minutes of inactivity, and the penalty for re-establishing a connection was rare and comparatively minor.</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows Server 2008 R2 Native Boot</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/windows-server-2008-r2-native-boot</link>
      <pubDate>Thu, 06 May 2010 10:30:32 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2010/05/06/windows-server-2008-r2-native-boot/</guid>
      <description><![CDATA[After reading Scott Hanselman’s description of how awesome Boot from VHD is, I had to try it.&#160;...]]></description>
      <content:encoded><![CDATA[<p>After reading Scott Hanselman’s description of how awesome <a href="https://www.hanselman.com/blog/LessVirtualMoreMachineWindows7AndTheMagicOfBootToVHD.aspx">Boot from VHD</a> is, I had to try it.&#160; Since I already obviously use Windows 7 as my primary OS, I figured I’d try to create a VHD with Windows Server 2008 R2, then boot directly to it.</p>  <p>Unfortunately, the instructions in the Hanselman post didn’t work for me.&#160; I got a Hyper-V VHD of Server 2K8R2, followed the bcdedit instructions, and rebooted.</p>  <p>After rebooting, I got a Boot Configuration Data error saying “<em>The configuration for an element within the object is invalid in the boot configuration data store.</em>”&#160; I’ve seen this error crop up in the comments of every blog post (and on <a href="https://blogs.msdn.com/jimoneil/archive/2010/01/08/mypain-your-gain-bitlocker-and-bootable-vhds.aspx">Jim O’Neil’s blog</a>) about Boot to VHD, but no one seems to ever provide a solution.&#160; </p>  <p>The thing that finally helped me find the error of my ways was a <a href="https://www.michaelflanakin.com/Weblog/tabid/142/articleType/ArticleView/articleId/1098/Boot-to-VHD-Create-VHD-from-Command-Line.aspx">post by Michael Flanakin</a>, where he offhandedly says “<em><strong>NOTE: </strong>You'll need to be sure you can boot using the necessary device in BIOS settings (obviously).”</em>&#160; He’s talking about the install media, but I realized that I had my VHD on a second spindle (as Scott Hanselman <a href="https://www.hanselman.com/blog/Windows7WithBitLockerAndStillBootingToVHD.aspx">recommends for BitLocker systems</a>), and the second hard drive was not enabled for booting in the BIOS.&#160; A quick trip through the BIOS to add the secondary HDD and I could finally boot to my VHD image!</p>]]></content:encoded>
    </item>
    <item>
      <title>Cost Savings vs. Cost Avoidance</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/cost-savings-vs-cost-avoidance</link>
      <pubDate>Tue, 04 May 2010 05:20:47 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2010/05/04/cost-savings-vs-cost-avoidance/</guid>
      <description><![CDATA[We presented an informal proposal to a customer that included some cost savings estimates.&#160; The...]]></description>
      <content:encoded><![CDATA[<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/CostSavingsvs.CostAvoidance_7559/fistfullofcash_2.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/CostSavingsvs.CostAvoidance_7559/fistfullofcash_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="fistfullofcash" border="0" alt="fistfullofcash" align="right" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/CostSavingsvs.CostAvoidance_7559/fistfullofcash_thumb.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/CostSavingsvs.CostAvoidance_7559/fistfullofcash_thumb.png" width="227" height="244" /></a>We presented an informal proposal to a customer that included some cost savings estimates.&#160; The customer asked us whether they were true cost savings, or just cost avoidance.&#160; I had never heard the distinction before, so I did some research.&#160; Here are the results.</p>  <p>Cost savings in general refers to benefits of a project that the customer can add back into his budget and spend.&#160; These are costs that have already been planned, but are now unnecessary.</p>  <p>Cost avoidance refers to everything else, typically more “soft savings.”&#160; Often cost avoidance involves slowing the rate of cost increases or obtaining “value-added” services.</p>  <p>The best resource I found detailing the differences between the two concepts was from the <a href="https://www.esourcingwiki.com/index.php/Cost_Reduction_and_Avoidance">eSourcingWiki</a>. </p>]]></content:encoded>
    </item>
    <item>
      <title>File Download in IE6</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/file-download-in-ie6</link>
      <pubDate>Mon, 08 Feb 2010 10:02:41 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2010/02/08/file-download-in-ie6/</guid>
      <description><![CDATA[Setup     We moved the file download portion of our ASP.NET 3.5 WebForms application to MVC...]]></description>
      <content:encoded><![CDATA[<h2>Setup</h2>  <ul>   <li>We moved the file download portion of our ASP.NET 3.5 WebForms application to MVC</li> </ul>  <h2></h2>  <h2>Symptoms</h2>  <ul>   <li>When IE6 users tried to open a file (text, Word doc, PDF, etc) through the new MVC controller action, the appropriate application would launch and fail with a “file not found” error</li>    <li>If the users clicked “Save” instead of “Open” in the file download dialog, they were able to open the downloaded file without issue</li>    <li>IE7, IE8, and Firefox users were unaffected</li> </ul>  <h2>Solution</h2>  <ul>   <li>The issue lies in the way IE6 handles the <a href="https://msdn.microsoft.com/en-us/library/system.web.mvc.outputcacheattribute.nostore%28VS.100%29.aspx">NoStore</a> caching instruction on the <a href="https://msdn.microsoft.com/en-us/library/dd410202.aspx">OutputCache attribute</a>.&#160; </li>    <li>Removing the no-store instruction from the file download controller action solved the problem.</li>    <li>What I think happens here is that IE7 and IE8 ignore the no-store instruction when downloading a file (as opposed to loading html content, for example).&#160; IE6 takes the no-store instruction literally and will not store the document in the cache at all.&#160; The problem is that when you click open on the file download dialog, the browser needs to store the file in temporary storage (the cache) before loading it.&#160; </li> </ul>]]></content:encoded>
    </item>
    <item>
      <title>Learning PowerShell: Random Album</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/learning-powershell-random-album</link>
      <pubDate>Mon, 18 Jan 2010 05:27:19 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2010/01/18/learning-powershell-random-album/</guid>
      <description><![CDATA[With the inclusion of PowerShell in Windows 7, it has become much more accessible and widely...]]></description>
      <content:encoded><![CDATA[<p>With the inclusion of PowerShell in Windows 7, it has become much more accessible and widely used.&#160; PowerShell has been on my list of technologies to learn for a few months now.&#160; I’ve just been waiting for the right project to use as an excuse to try out PowerShell.</p>  <p>I found that project due to the lack of plug-in support in the Zune desktop application.&#160; I listen to a lot of music at work, and I like to listen to entire albums.&#160; What I wanted was a way to randomly select an album that I should listen to next.&#160; I don’t want an album where I only have one or two songs, I want to select an entire album.</p>  <p>Enter PowerShell. </p>  <h4>Step 1: The Integrated Scripting Environment</h4>  <p>To get started, open up the PowerShell ISE by typing “ise” in the Windows 7 Start menu.&#160; Right click the PowerShell ISE and select run as Administrator (this will save some headaches later).</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_2.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb.png" width="387" height="422" /></a> </p>  <p>We’ll see a three-paned window, so let’s step through the three panes one-by-one.</p>  <h5>Top: Editor</h5>  <p>The top pane is the script editor.&#160; This is where we can enter a multi-line PowerShell script and save is as a .ps1 file.&#160; It has syntax highlighting, as you would expect from an editor.</p>  <h5>Middle: Output</h5>  <p>This is where the output of your script will be displayed.&#160; If you ran your script in a PowerShell console, the text that appears in this box would appear just below the line you entered.</p>  <h5>Bottom: Prompt</h5>  <p>The bottom pane is a PowerShell prompt, just like you would see in a PowerShell console.&#160; You can execute single PowerShell commands here without including them in your script.</p>  <h4>Step 2: Directory listing</h4>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_4.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb_1.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb_1.png" width="480" height="111" /></a> </p>  <p>Let’s start with a simple script to list out the subdirectories of a directory.&#160; We’ve wrapped that in a function, because we’ll be using recursion later.</p>  <p>The second line calls two built-in PowerShell cmdlets, get-childitem and where-object.&#160; Get-childitem, when called on a path, lists the contents of that directory.&#160; The output is then piped into where-object, with a constraint saying we only want directories, not files.&#160; The $_ variable is used similar to the way it is in Perl to refer to the output of the last line.&#160; The end result of this line is an array of subdirectories of D:\Music.&#160; </p>  <p>For me, this is a list of artist names and a Zune directory that contains all the music I’ve downloaded from Zune.&#160; What I want is the albums (subdirectories of the artists) and the albums within the Zune directory (contained with artist directories).</p>  <h4>Step 3: Getting Albums</h4>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_6.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb_2.png" width="498" height="181" /></a> </p>  <p>These changes now pull subdirectories of the artist directories (which are albums) and limit those albums to ones that have at least 8 files in them.&#160; Note that the last call to where-object looks for files, not directories (it negates the psiscontainer call).</p>  <p>One thing that always trips me up in PowerShell is the operators.&#160; Sometimes it looks very similar to C#, but the operators are totally different – see the –gt for greater than.</p>  <h4>Step 4: Handling the Zune Directory</h4>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_12.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_12.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb_5.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb_5.png" width="499" height="348" /></a> </p>  <p></p>  <p></p>  <p>Now we’re using recursion to handle the Zune directory.&#160; We also need to ignore some of the Zune special directories that aren’t artist directories (note the –or operator, that tripped me up).&#160; We also start using array variables and adding albums to the array using the += operator.</p>  <h4></h4>  <h4>Step 5: Random Album</h4>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_14.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_14.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb_6.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningPowerShellRandomAlbum_6B82/image_thumb_6.png" width="503" height="432" /></a> </p>  <p>The last thing left to do is select a random album from the results.&#160; We’ll do this by wrapping the Get-Album function with a new function that uses the Get-Random cmdlet to select an album from our master list.</p>  <h4></h4>  <h4>Step 6: Running the Script</h4>  <p>You can execute the script at any point by pressing F5, but after you save the script, you’ll need to change the permissions to allow execution of the script.&#160; By default, PowerShell is fairly locked down in terms of permissions.&#160; To allow execution of your own saved scripts, you’ll need to type this in the PowerShell prompt once:</p>  <pre>set-executionpolicy remotesigned</pre>

<p>Here’s a listing of the entire script:</p>

<pre>function Get-Album ($topDir)
{
    $directories = get-childitem $topDir | 
                    where-object {($_.psiscontainer)}
    $returnvalues = @()
    foreach ($dir in $directories)
    {
        if($dir.Name -match &quot;Channels&quot; -or 
            $dir.Name -match &quot;Books&quot; -or
            $dir.Name -match &quot;Playlists&quot; -or
            $dir.Name -match &quot;Podcasts&quot; -or
            $dir.Name -match &quot;Received Pictures&quot; -or
            $dir.Name -match &quot;Zune Temporary Music&quot;) 
            {
                continue
            }
        if($dir.Name -match &quot;Zune&quot; -or
            $dir.Name -match &quot;Subscription&quot;)
            {
                $returnvalues += @(Get-Album $dir.FullName)
            }
        else
            {
                $subdirs = Get-Childitem $dir.FullName | 
                            where-object {($_.psiscontainer)}
                foreach ($subdir in $subdirs)
                {
                    $files = Get-Childitem $subdir.FullName | 
                                where-object {!($_.psiscontainer)}
                    if($files.count -gt 7)
                    {
                        $returnvalues += 
                            @($dir.Name + ' - ' + $subdir.Name)
                    }
                }
            }
    }
    return $returnvalues
}

function Get-RandomAlbum ($topDir)
{
    $albums = Get-Album $topDir
    $index = Get-Random -min 0 -max ($albums.count - 1)
    return $albums[$index]
}

Get-RandomAlbum D:\Music</pre>

<p>The next step is to wrap this all into a Windows Gadget so it’s on my desktop all the time and I don’t need to launch PowerShell to get a random album suggestion.</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server 2005 Full Text Search Timeout</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/sql-server-2005-full-text-search-timeout</link>
      <pubDate>Tue, 29 Dec 2009 04:23:41 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2009/12/29/sql-server-2005-full-text-search-timeout/</guid>
      <description><![CDATA[Setup     ASP.Net 3.5 application with a SQL Server 2005 backend     Full Text Search index (to...]]></description>
      <content:encoded><![CDATA[<h2>Setup</h2>  <ul>   <li>ASP.Net 3.5 application with a SQL Server 2005 backend </li>    <li>Full Text Search index (to search a document library stored in the database) </li>    <li>Web frontend to the document search </li>    <li>Search is handled by a stored procedure </li> </ul>  <h2>Symptoms</h2>  <ul>   <li>Running a query first thing in the morning results in a SQL timeout </li>    <li>Subsequent queries are very fast </li>    <li>Any query run after a delay times out </li>    <li>Re-compiling the stored proc every few minutes prevents the timeouts </li> </ul>  <h2>Solution</h2>  <p>We initially suspected that the timeout was due to the changing index somehow invalidating the execution plan for the stored proc.&#160; As it turned out, the real reason was something much stranger.&#160; Apparently the Internet connection for our DB server didn’t allow SQL Server to check the certificate revocation of the full text word breaker (as described in this <a href="https://support.microsoft.com/kb/915850">KB Article</a>).&#160; Unlike the scenario described in the article, the DB server <em>does</em> have an Internet connection, but it needs to go through a firewall.</p>  <p>Even so, the solution in the KB worked for us, we just added this line to our SQL scripts:</p>  <pre>sp_fulltext_service 'verify_signature', 0;</pre>]]></content:encoded>
    </item>
    <item>
      <title>File Associations in ClickOnce Applications</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/file-associations-in-clickonce-applications</link>
      <pubDate>Fri, 04 Dec 2009 05:33:06 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2009/12/04/file-associations-in-clickonce-applications/</guid>
      <description><![CDATA[One of the really cool features of ClickOnce applications is the ability to set file...]]></description>
      <content:encoded><![CDATA[<p>One of the really cool features of ClickOnce applications is the ability to <a href="https://msdn.microsoft.com/en-us/library/bb892924.aspx">set file associations</a>.&#160; </p>  <p><em>Note: File associations can only be set for Full Trust ClickOnce applications</em></p>  <p>The MSDN article walks you through creating a file association using XML in the application manifest, but most developers will find it easier to use the Project Properties screen:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_2.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_thumb.png" width="499" height="308" /></a> </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_6.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_thumb_2.png" width="490" height="103" /></a> </p>  <p></p>  <p>Unfortunately, this is where the MSDN documentation leaves off, which tells you nothing about how your application knows the location of the file it is supposed to open.&#160; With a ClickOnce application, the file location is <a href="https://blogs.msdn.com/mwade/archive/2008/01/30/how-to-add-file-associations-to-a-clickonce-application.aspx">not passed in as a command line argument</a>, it is actually in </p>  <p>AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[0]</p>  <p>One other interesting point is that the file location in ActivationData is in a uri form such as file://c:/temp/Test%20File.testApp.&#160; In order to use this as a path to IO functions like File.Exists, you’ll need to create a Uri from it, get the absolute path of the Uri, and Unescape the string (to convert %20 to a space):</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_10.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_thumb_4.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/FileAssociationsinClickOnceApplications_781D/image_thumb_4.png" width="495" height="94" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Learning Expression as a Developer</title>
      <link>https://docs.microsoft.com/archive/blogs/brchris/learning-expression-as-a-developer</link>
      <pubDate>Tue, 06 Oct 2009 10:16:19 GMT</pubDate>
      <dc:creator><![CDATA[brien]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brchris/2009/10/06/learning-expression-as-a-developer/</guid>
      <description><![CDATA[As a developer, working on Silverlight and WPF can be a bit confusing.&#160; There’s a lot of...]]></description>
      <content:encoded><![CDATA[<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningExpressionasaDeveloper_9079/image_2.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningExpressionasaDeveloper_9079/image_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/brchris/WindowsLiveWriter/LearningExpressionasaDeveloper_9079/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/brchris/WindowsLiveWriter/LearningExpressionasaDeveloper_9079/image_thumb.png" width="323" height="182" /></a> As a developer, working on Silverlight and WPF can be a bit confusing.&#160; There’s a lot of overlap between Visual Studio and Expression, and it’s not always clear when to use each tool.&#160; </p>  <p>For me, Expression was just familiar enough to start using without any training, but new enough that I didn’t feel that I was using all the features I needed.</p>  <p>Thanks to my co-worker Marcos, who pointed me to a great <a href="https://expression.microsoft.com/en-us/cc197139.aspx">series of Expression videos</a> on the Microsoft Expression website.&#160; The videos are titled “Getting Started with Silverlight – For Designers,” but I found the content was very valuable as a developer unfamiliar with design processes.</p>  <p>The videos provide a great introduction to taking full advantage of the design and animation tools inside the Expression Studio.&#160; I’m hoping to use what I learned on my project and also as material for a future blog post!</p>]]></content:encoded>
    </item>
  </channel>
</rss>