<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Huddled Masses &#187; .Net</title>
	<atom:link href="http://huddledmasses.org/tag/dot-net-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://huddledmasses.org</link>
	<description>You can do more than breathe for free...</description>
	<lastBuildDate>Fri, 27 Apr 2012 05:42:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<cloud domain='huddledmasses.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>XamlReader and Resource Library fonts in WPF</title>
		<link>http://huddledmasses.org/xamlreader-and-resource-library-fonts-in-wpf/</link>
		<comments>http://huddledmasses.org/xamlreader-and-resource-library-fonts-in-wpf/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 05:15:16 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[My Software]]></category>
		<category><![CDATA[PoshConsole]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/jaykul/xamlreader-and-resource-library-fonts-in-wpf/</guid>
		<description><![CDATA[Microsoft has provided some very good documentation on how to package fonts with WPF applications, and I&#8217;ve been following it in several different ways in different apps I&#8217;ve written. Recently I provided a feature in Posh Console which allows you to load the startup banner from an external file: StartupBanner.xaml. Loading the banner from an [...]]]></description>
			<content:encoded><![CDATA[	<p>Microsoft has provided some <a href="http://msdn2.microsoft.com/en-us/library/ms753303.aspx">very good documentation</a> on how to package fonts with <span class="caps">WPF</span> applications, and I&#8217;ve been following it in several different ways in different apps I&#8217;ve written.  Recently I provided a feature in <a href="http://CodePlex.com/PoshConsole">Posh Console</a> which allows you to  load the startup banner from an external file: StartupBanner.xaml.  </p>

	<p>Loading the banner from an external <span class="caps">XAML</span> file means that users can configure their own startup banner and make it look however they like, but it broke our default banner.  The startup banner we&#8217;ve been using has a logo and some text which are all defined in pure <span class="caps">XAML</span> and uses several fonts which we had embedded in a FontLibrary.dll resource assembly. It worked great as long as the <span class="caps">XAML</span> was defined in the application, but as soon as we removed it to an external file and loaded it in using the <a href="http://msdn2.microsoft.com/en-us/library/ms590398.aspx" title=" XmlReader ">XamlReader.Load</a> method, the fonts all went to the fallback default fonts instead of our embedded ones. </p>

	<p>Normally this might not be a big deal, but since our logo is based on the &#8220;Q&#8221; in a Quake-like font &#8230; it looks really lame without fonts.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':D' class='wp-smiley' />  Apparently, when you load external <span class="caps">XAML</span>, it can&#8217;t use the <a href="http://msdn2.microsoft.com/en-us/library/ms753303.aspx#creating_a_font_resource_library">Font Resource Library</a> resources.  At this point, I can&#8217;t seem to find anything to indicate why this is the case, but I suspect it has to do with the fact that the external, loaded <span class="caps">XAML</span> <a href="http://msdn2.microsoft.com/en-us/library/aa970910.aspx">only has partial trust</a>, and since the font is in an external assembly instead of embedded in the partial trust content, it can&#8217;t get to it.  However, it might be simpler than that: it might just be that the base <span class="caps">URI</span> for the externally loaded <span class="caps">XAML</span> is an actual file location rather than one of the <code>pack://,,,application/</code> type URIs, so the slightly odd font path doesn&#8217;t resolve.</p>

	<p>In any case, I found a way around it, which is of course, why I&#8217;m writing all of this down.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':)' class='wp-smiley' />  <span id="more-428"></span> If you declare <span class="caps">WPF</span> <em>resources</em> in your project, you can inject them into the <span class="caps">WPF</span> objects loaded from the <span class="caps">XAML</span> to make them available to them. So for instance, I have a font called &#8220;Quake&#8221; in the FontLibrary assembly.  I can declare it as a resource in my application&#8217;s <span class="caps">XAML</span> (at the app level, window level, or wherever).</p>

	<div class="xml code xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Style</span> <span style="color: #000066;">x:Key</span>=<span style="color: #ff0000;">&quot;POSHFont&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Setter</span> <span style="color: #000066;">Property</span>=<span style="color: #ff0000;">&quot;TextElement.FontFamily&quot;</span> <span style="color: #000066;">Value</span>=<span style="color: #ff0000;">&quot;/FontLibrary;Component/#QUAKE&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>

	<p>The font in that style gets resolved in full trust with the <em>pack</em> <span class="caps">URI</span>, and it works fine when used from my application. Having created that, I can do the same thing in the external <span class="caps">XAML</span> files, and apply the style to the text as a <a href="http://msdn2.microsoft.com/en-us/library/ms748942.aspx">DynamicResource</a> &#8230;
 and even feel free to override parts of the style if I want to.  For instance, even though the style might specify a FontSize, if I refer to the style on this text block and specify my own FontSize, the one that&#8217;s on the TextBlock (or Paragraph, or Run, or whatever) will be used.  Now, we&#8217;re not quite done yet, because although they look the same in source, the fonts won&#8217;t resolve properly in the externally loaded <span class="caps">XAML</span>.</p>

	<div class="xml code xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextBlock</span> <span style="color: #000066;">TextAlignment</span>=<span style="color: #ff0000;">&quot;Center&quot;</span> <span style="color: #000066;">Width</span>=<span style="color: #ff0000;">&quot;180&quot;</span> <span style="color: #000066;">Style</span>=<span style="color: #ff0000;">&quot;{DynamicResource POSHFont}&quot;</span> <span style="color: #000066;">FontSize</span>=<span style="color: #ff0000;">&quot;145&quot;</span> <span style="color: #000066;">Foreground</span>=<span style="color: #ff0000;">&quot;#FF3275B9&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextBlock.BitmapEffect<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;BevelBitmapEffect</span> <span style="color: #000066;">BevelWidth</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">EdgeProfile</span>=<span style="color: #ff0000;">&quot;CurvedOut&quot;</span> <span style="color: #000066;">LightAngle</span>=<span style="color: #ff0000;">&quot;258&quot;</span> <span style="color: #000066;">Relief</span>=<span style="color: #ff0000;">&quot;0.03&quot;</span> <span style="color: #000066;">Smoothness</span>=<span style="color: #ff0000;">&quot;0.565&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/TextBlock.BitmapEffect<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Q<br />
&nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/TextBlock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div>

	<p>However, because the style is specified as a dynamic resource rather than a static one, I don&#8217;t have to define that resource at all in that <span class="caps">XAML</span> file, but even if I do, when I load the <span class="caps">XAML</span> into my application, I can simply set it&#8217;s resources from the resources that I&#8217;ve loaded in full trust and with the <em>pack://</em> base <span class="caps">URI</span>...  In my case, I have actually defined several fonts as resources on a Document element, so I just copy them all into the element I read in from the <span class="caps">XAML</span> file:</p>

	<div class="csharp code csharp" style="font-family:monospace;">Paragraph banner <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>Paragraph<span style="color: #000000;">&#41;</span>XamlReader.<span style="color: #0000FF;">Load</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">System.<span style="color: #0000FF;">Xml</span></span>.<span style="color: #0000FF;">XmlReader</span>.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;StartupBanner.xaml&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>banner <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #008080; font-style: italic;">// Copy over resources from my DOCUMENT to the BANNER</span><br />
&nbsp; <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> key <span style="color: #0600FF;">in</span> Document.<span style="color: #0000FF;">Resources</span>.<span style="color: #0000FF;">Keys</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; banner.<span style="color: #0000FF;">Resources</span><span style="color: #000000;">&#91;</span>key<span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> Document.<span style="color: #0000FF;">Resources</span><span style="color: #000000;">&#91;</span>key<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span> <br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; Document.<span style="color: #0000FF;">Blocks</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>_currentParagraph<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #000000;">&#125;</span></div>

	<p>And that&#8217;s it: <a href="/images/PoshConsole/StartupBanner.png"><img src="/images/PoshConsole/StartupBannerLogo.png" width="182" height="182" alt="PoshConsole Banner" style="padding: 4px; text-align:center; vertical-align:top" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/xamlreader-and-resource-library-fonts-in-wpf/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PowerShell Host and Custom Formatting</title>
		<link>http://huddledmasses.org/powershell-host-and-custom-formatting/</link>
		<comments>http://huddledmasses.org/powershell-host-and-custom-formatting/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 00:01:09 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[My Software]]></category>
		<category><![CDATA[PoshConsole]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/jaykul/powershell-host-and-custom-formatting/</guid>
		<description><![CDATA[So, I&#8217;ve been working on PoshConsole for awhile now, and with the help of some of the guys in #PowerShell@irc.freenode.net have been playing with trying to find ways to enhance output, like using ANSI escape sequences, and even creating an Out-WPF cmdlet which can output objects as databound WPF controls which look really good. We [...]]]></description>
			<content:encoded><![CDATA[	<p>So, I&#8217;ve been working on PoshConsole for awhile now, and with the help of some of the guys in #PowerShell@irc.freenode.net have been playing with trying to find ways to enhance output, like using <a href="http://poshconsole.org/images/PoshConsole/AnsiEscapeSequences.jpg"><span class="caps">ANSI</span> escape sequences</a>, and even creating an <a href="http://poshconsole.org/images/PoshConsole/Out-WPF2.png">Out-<span class="caps">WPF</span> cmdlet</a> which can output objects as databound <span class="caps">WPF</span> controls which look really good.</p>

	<p>We have been trying to find a way to incorporate the colored and even bold/italic formatting in a way that would be compatible with the existing format-* cmdlets, and we&#8217;ve even looked at replacing out-default with a cmdlet that would be compatible with the default PowerShell host.  But today I finally locked in on <a href="http://blogs.msdn.com/powershell/archive/2006/04/25/583269.aspx">the import of this post on the PowerShell blog.</a>  It&#8217;s just not possible.</p>

	<p>The format cmdlets (Format-List, Format-Custom, Format-Table, Format-Wide) output data in the form of undocumented .Net objects which are &#8220;subject to change without notice,&#8221; and are therefore basically useless.  Of course, that means that if you want to replace Out-Default you have to not only replace the output, but you have to replace the formatting cmdlets, and of course the Update-FormatData cmdlet too &#8212; in fact, you have to <strong>either</strong> parse the largely undocumented format data files, or create some replacement for them to allow users to specify formatting for types you haven&#8217;t thought of&#8230; </p>

	<p>All of this amounts to what many of you probably already knew: it&#8217;s a lot of work to create a complete PowerShell host, but it&#8217;s at least as much work to create a replacement PowerShell formatter.</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/powershell-host-and-custom-formatting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A quick progress update on PoshConsole</title>
		<link>http://huddledmasses.org/a-quick-progress-update-on-poshconsole/</link>
		<comments>http://huddledmasses.org/a-quick-progress-update-on-poshconsole/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 05:10:43 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[DeskOps]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PoshConsole]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[UserInterface]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/jaykul/a-quick-progress-update-on-poshconsole/</guid>
		<description><![CDATA[Click for a teaser screenshot This is actually a bit scary, because you can load sort-of &#8230; anything To prove it (you&#8217;re gonna love this &#8230; I should take a video, really, but it&#8217;s time for bed, so this will have to do): check this out Beat that! So yeah, I have this control written [...]]]></description>
			<content:encoded><![CDATA[	<p><a href="http://poshconsole.org/images/PoshConsole/Out-WPF.png">Click for a teaser screenshot</a></p>

	<p>This is actually a bit scary, because you can load sort-of &#8230; anything  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';-)' class='wp-smiley' />  To prove it (you&#8217;re gonna love this &#8230; I should take a video, really, but it&#8217;s time for bed, so this will have to do): <a href="http://poshconsole.org/images/PoshConsole/Out-WPF2.png">check this out</a> Beat that!  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' /> </p>

	<p>So yeah, I have this control written from an earlier project which creates a task list with live preview images. When I say &#8220;live previews&#8221; I mean actually live, like on the Vista Alt+Tab: if there&#8217;s a video playing, you can watch it in there (of course, it dies a horrible death on XP, but I have other code for that).  </p>

	<p>As a side note  the TaskBar2.panel stuff is from the <span class="caps">TINS</span> release I made months ago, there&#8217;s several fun .panel files in there &#8230; but you have to load a bunch of the <span class="caps">TINS</span> assemblies first, I didn’t distinguish which ones, I just did:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #660033;">cd</span> C:\Users\Joel\Projects\TechDemos\TINS\bin\Release<br />
<span style="color: #660033;">ls</span> <span style="color: #66cc66;">*</span>.<span style="color: #003366;">dll</span>,<span style="color: #66cc66;">*</span>.<span style="color: #003366;">exe</span> <span style="color: #66cc66;">|</span> <span style="color: #66cc66;">%</span> <span style="color: #333;">&#123;</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>System.<span style="color: #003366;">Reflection</span>.<span style="color: #003366;">Assembly</span><span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">LoadFrom</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$_</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#125;</span><br />
<span style="color: #660033; font-weight: bold;">$Host</span>.<span style="color: #003366;">PrivateData</span>.<span style="color: #003366;">XamlUI</span>.<span style="color: #003366;">LoadXaml</span><span style="color: #333;">&#40;</span><span style="color: #009900;">&quot;C:\Users\Joel\Projects\TechDemos\TINS\bin\Release\Panels\TaskBar2.panel&quot;</span><span style="color: #333;">&#41;</span>;<br />
&nbsp;</div>

	<p>Of course, in .Net 3.5 the RichTextBox has the ability to go <code>ContentEnabled=&#34;true&#34;</code> which should allow those things to be actual controls you can click to switch active task, right-click to get a task menu, etc (although I haven&#8217;t tried that yet).  We might just have to upgrade  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';-)' class='wp-smiley' /> </p>

	<p>Anyway, it&#8217;s past time for bed, so I&#8217;ll preempt complaints about how this isn&#8217;t ready for release yet with this quote: </p>

	<blockquote>
		<p>I don’t have to take this abuse from you; I’ve got hundreds of people waiting to abuse me. &#8212;  Bill Murray, “Ghostbusters”</p>
	</blockquote>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/a-quick-progress-update-on-poshconsole/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending strings, and secure strings, in PowerShell.</title>
		<link>http://huddledmasses.org/extending-strings-and-secure-strings-in-powershell/</link>
		<comments>http://huddledmasses.org/extending-strings-and-secure-strings-in-powershell/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 03:40:07 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[SecureString]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/jaykul/extending-strings-and-secure-strings-in-powershell/</guid>
		<description><![CDATA[One of the coolest things about scripting in PowerShell is that they&#8217;ve enabled the addition of extension methods to any class (object). Essentially, this means that you can add whatever methods This enables all sorts of utility functions that would normally end up in a library to instead be added to the base objects. Just [...]]]></description>
			<content:encoded><![CDATA[	<p>One of the coolest things about scripting in PowerShell is that they&#8217;ve enabled the addition of extension methods to any class (object).  Essentially, this means that you can add whatever methods This enables all sorts of utility functions that would normally end up in a library to instead be added to the base objects. Just for example, this week I was working on a script that needed to do <span class="caps">HTTP</span> basic authentication, which requires Base64 encoding a string.  Now, that&#8217;s not very hard to do, really:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #660033; font-weight: bold;">$name</span> <span style="color: #66cc66;">=</span> <span style="color: #009900;">&quot;Joel Bennett&quot;</span><br />
<span style="color: #660033; font-weight: bold;">$encoded</span> <span style="color: #66cc66;">=</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>System.<span style="color: #003366;">Convert</span><span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">ToBase64String</span><span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>System.<span style="color: #003366;">Text</span>.<span style="color: #003366;">Encoding</span><span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">UTF8</span>.<span style="color: #003366;">GetBytes</span><span style="color: #333;">&#40;</span> <span style="color: #660033; font-weight: bold;">$name</span> <span style="color: #333;">&#41;</span><span style="color: #333;">&#41;</span><br />
&nbsp;</div>

	<p>But really, that&#8217;s kind of a pain to remember, nevermind type each time. I mean, tab-completion helps, but what with all the square brackets and double-colons &#8230; So, instead, wouldn&#8217;t it be cool if I could just take my original string and call <code>$name.AsBase64</code>?  Well, I can, with a pretty simple custom type.  </p>

	<div class="xml code xml" style="font-family:monospace;"><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Types<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>System.String<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Members<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ScriptProperty<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AsBase64<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;GetScriptBlock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($this))<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/GetScriptBlock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ScriptProperty<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ScriptProperty<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>FromBase64<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;GetScriptBlock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($this))<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/GetScriptBlock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ScriptProperty<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Members<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Types<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp;</div>

	<p>We take this <span class="caps">XML</span>, put it in a file with the .ps1xml extension, and then call <code>Update-TypeData MyTypes.ps1xml</code> &#8230; Now we can call .AsBase64 or .FromBase64 on any string.</p>

	<p>So then I ran into this simple problem.  I wanted (in my script) to have the user type a password in&#8230; but not have it show up in their console. It turns out there&#8217;s a very over-engineered, and extremely elegant solution for this in PowerShell: <code>Read-Host -AsSecureString &#34;Prompt&#34;</code>.  It&#8217;s exactly what I wanted, in that it results in the console showing ***** as you type your password in.  The only problem is, what you get out is a <code>System.Security.SecureString</code> which is essentially &#8230; well, useless.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' /> </p>

	<p><span id="more-418"></span> Honestly, I know that there are times when you need to store a string in such a way that it&#8217;s encrypted even in memory &#8230; but the fact is that it&#8217;s complicated to get the text value back out, so it really isn&#8217;t very useful.  Anyway, you <strong>could</strong> add this to your custom types file:</p>

	<div class="xml code xml" style="font-family:monospace;"><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>System.Security.SecureString<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Members<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ScriptProperty<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>AsInsecureString<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;GetScriptBlock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $BSTR = [System.Runtime.InteropServices.marshal]::SecureStringToBSTR($this)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [System.Runtime.InteropServices.marshal]::PtrToStringAuto($BSTR)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/GetScriptBlock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ScriptProperty<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Members<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp;</div>

	<p>But then, of course &#8230; it wouldn&#8217;t be very secure anymore. The point of extending types instead of writing script libraries is that you want things to be discoverable, and a property that exposes a secure string as a regular string probably isn&#8217;t really something you wanted to make discoverable  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' /> .</p>

	<p>For my purposes, I decided that was a bad idea, and settled on adding this function to my regular library of functions:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #666699; font-weight: bold;">function</span> <span style="color: #0066cc; font-style: italic;">Read-<span style="font-style: normal;">HostMasked</span></span><span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">string</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$prompt</span><span style="color: #66cc66;">=</span><span style="color: #009900;">&quot;Password&quot;</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; <span style="color: #660033; font-weight: bold;">$password</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">Read-<span style="font-style: normal;">Host</span></span> <span style="color: #000066;">-AsSecureString</span> <span style="color: #660033; font-weight: bold;">$prompt</span>; &nbsp;<br />
&nbsp; <span style="color: #660033; font-weight: bold;">$BSTR</span> <span style="color: #66cc66;">=</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>System.<span style="color: #003366;">Runtime</span>.<span style="color: #003366;">InteropServices</span>.<span style="color: #003366;">marshal</span><span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">SecureStringToBSTR</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$password</span><span style="color: #333;">&#41;</span>;<br />
&nbsp; <span style="color: #660033; font-weight: bold;">$password</span> <span style="color: #66cc66;">=</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>System.<span style="color: #003366;">Runtime</span>.<span style="color: #003366;">InteropServices</span>.<span style="color: #003366;">marshal</span><span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">PtrToStringAuto</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$BSTR</span><span style="color: #333;">&#41;</span>;<br />
&nbsp; <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>System.<span style="color: #003366;">Runtime</span>.<span style="color: #003366;">InteropServices</span>.<span style="color: #003366;">Marshal</span><span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">ZeroFreeBSTR</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$BSTR</span><span style="color: #333;">&#41;</span>;<br />
&nbsp; <span style="color: #666699; font-weight: bold;">return</span> <span style="color: #660033; font-weight: bold;">$password</span>;<br />
<span style="color: #333;">&#125;</span><br />
&nbsp;</div>

	<p>That lets you take advantage of the in-console masking, but returns a plain old string into your script so you can use it easily.  (In my case, I wanted to handle <span class="caps">HTTP</span> Basic Authorization using <code>System.Net.WebClient</code> so I did something like: <code>$webclient.Headers.Add(&#34;Authorization&#34;, &#34;Basic &#34;+((Read-Host Username)+&#39;:&#39;+(Read-HostMasked Password)).AsBase64)</code>. Hopefully that makes it obvious how that Read-HostMasked function works and why it&#8217;s useful.</p>

	<p>So. If anyone knows a better way to get a password from the user interactively without showing it on the console, I&#8217;m all ears! I&#8217;m not worried about having it in memory, in this case &#8212; in fact, I&#8217;m not even storing it, just passing it to the Base64 encoding &#8230; and I can&#8217;t avoid that.</p>

	<p>Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/PowerShell" rel="tag">PowerShell</a>, <a class="performancingtags" href="http://technorati.com/tag/Scripting" rel="tag">Scripting</a>, <a class="performancingtags" href="http://technorati.com/tag/.Net" rel="tag">.Net</a>, <a class="performancingtags" href="http://technorati.com/tag/SecureString" rel="tag">SecureString</a></p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/extending-strings-and-secure-strings-in-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell speaks</title>
		<link>http://huddledmasses.org/powershell-speaks/</link>
		<comments>http://huddledmasses.org/powershell-speaks/#comments</comments>
		<pubDate>Thu, 03 May 2007 03:34:00 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[My Software]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/jaykul/powershell-speaks/</guid>
		<description><![CDATA[So, a buddy was showing off the &#8220;say&#8221; command in the Mac OS X terminal the other day (my 3 year old daughter was vastly entertained) and I wondered what it would take to do the same thing in Windows PowerShell &#8230; it turns out the answer is, not much. You just type this into [...]]]></description>
			<content:encoded><![CDATA[	<p>So, a buddy was showing off the &#8220;say&#8221; command in the Mac OS X terminal the other day (my 3 year old daughter was vastly entertained) and I wondered what it would take to do the same thing in Windows PowerShell &#8230; it turns out the answer is, not much.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':)' class='wp-smiley' />  You just type this into the console:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #660033; font-weight: bold;">$Voice</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">new-<span style="font-style: normal;">object</span></span> <span style="color: #000066;">-com</span> SAPI.<span style="color: #003366;">SpVoice</span><br />
<span style="color: #660033; font-weight: bold;">$Voice</span>.<span style="color: #003366;">Speak</span><span style="color: #333;">&#40;</span> <span style="color: #009900;">&quot;Hello World!&quot;</span>, <span style="color: #cc66cc;">1</span> <span style="color: #333;">&#41;</span><br />
&nbsp;</div>

	<p>The cool thing about this is that it&#8217;s async, unlike the Mac &#8220;say&#8221; command, so you can go on typing the next command while it&#8217;s speaking. On top of that, you can have it read a text file by just changing that 1 to a 5:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #660033; font-weight: bold;">$Voice</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">new-<span style="font-style: normal;">object</span></span> <span style="color: #000066;">-com</span> SAPI.<span style="color: #003366;">SpVoice</span><br />
<span style="color: #660033; font-weight: bold;">$Voice</span>.<span style="color: #003366;">Speak</span><span style="color: #333;">&#40;</span> <span style="color: #009900;">&quot;C:\Text\HolyGrail.txt&quot;</span>, <span style="color: #cc66cc;">5</span> <span style="color: #333;">&#41;</span><br />
&nbsp;</div>

	<p>Now, being who I am, and what I am, I wasn&#8217;t content with that, so I wrote myself up a script, <code>Out-Speech</code>, that will speak whatever it&#8217;s given (an array of objects as an argument, or the pipeline objects &#8230; ) and exposes most of the options of the underlying Speech <span class="caps">API</span>.</p>

	<p><span id="more-413"></span></p>

	<p>I&#8217;ll post the code here, but I thought I&#8217;d just mention &#8230; I&#8217;m not really using this in very many places, but it&#8217;s really fun with the <a href="http://huddledmasses.org/jaykul/what-i-learned-today-about-powershell/">Select-Random script</a> I posted earlier. I alias that to &#8220;rand&#8221; and this to &#8220;say&#8221; ... so I can do: <code>cat quotes.txt | rand | say</code> How fun is that?  Yeah, well, or you could use it to report on the progress of long-running scripts, or something else more useful. :-|</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #666666; font-style: italic;"># Out-Speech</span><br />
<span style="color: #666699; font-weight: bold;">param</span><span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">array</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$Collection</span>, <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #666699; font-weight: bold;">switch</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$wait</span>, <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #666699; font-weight: bold;">switch</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$purge</span>, <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #666699; font-weight: bold;">switch</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$readfiles</span>, <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #666699; font-weight: bold;">switch</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$readxml</span>, <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #666699; font-weight: bold;">switch</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$notxml</span><span style="color: #333;">&#41;</span><br />
<br />
<span style="color: #666699; font-weight: bold;">begin</span><br />
<span style="color: #333;">&#123;</span> &nbsp;<br />
&nbsp; <span style="color: #666699; font-weight: bold;">if</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$args</span> <span style="color: #000066;">-eq</span> <span style="color: #009900;">'-?'</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
<span style="color: #009900;">''</span><br />
<span style="color: #009900;">'Usage: Out-Speech [[-Collection] &lt;array&gt;]'</span><br />
<span style="color: #009900;">''</span><br />
<span style="color: #009900;">'Parameters:'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;-Collection : A collection of items to speak.'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;-? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Display this usage information'</span><br />
<span style="color: #009900;">' &nbsp;Switches:'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;-wait &nbsp; &nbsp; &nbsp; : Wait for the machine to read each item (NOT asynchronous).'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;-purge &nbsp; &nbsp; &nbsp;: Purge all other speech requests before making this call.'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;-readfiles &nbsp;: Read the contents of the text files indicated.'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;-readxml &nbsp; &nbsp;: Treat input as speech XML markup.'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;-notxml &nbsp; &nbsp; : Do NOT parse XML (if text starts with &quot;&lt;&quot; but is not XML).'</span><br />
<span style="color: #009900;">''</span><br />
<span style="color: #009900;">'Examples:'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;PS&gt; Out-Speech &quot;Hello World&quot;'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;PS&gt; Select-RandomLine quotes.txt | Out-Speech -wait'</span><br />
<span style="color: #009900;">' &nbsp; &nbsp;PS&gt; Out-Speech -readfiles &quot;Hitchhiker'</span><span style="color: #009900;">'s Guide To The Galaxy.txt&quot;'</span><br />
<span style="color: #009900;">''</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">exit</span><br />
&nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; <span style="color: #666666; font-style: italic;"># To override this default, use the other flag values given below.</span><br />
&nbsp; <span style="color: #660033; font-weight: bold;">$SPF_DEFAULT</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># Specifies that the default settings should be used. &nbsp;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">## The defaults are:</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#~ * Speak the given text string synchronously</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#~ * Not purge pending speak requests</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#~ * Parse the text as XML only if the first character is a left-angle-bracket (&lt;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#~ * Not persist global XML state changes across speak calls</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#~ * Not expand punctuation characters into words.</span><br />
&nbsp; <span style="color: #660033; font-weight: bold;">$SPF_ASYNC</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># Specifies that the Speak call should be asynchronous.</span><br />
&nbsp; <span style="color: #660033; font-weight: bold;">$SPF_PURGEBEFORESPEAK</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">2</span> <span style="color: #666666; font-style: italic;"># Purges all pending speak requests prior to this speak call.</span><br />
&nbsp; <span style="color: #660033; font-weight: bold;">$SPF_IS_FILENAME</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">4</span> &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># The string passed is a file name, and the file text should be spoken.</span><br />
&nbsp; <span style="color: #660033; font-weight: bold;">$SPF_IS_XML</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">8</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># The input text will be parsed for XML markup. </span><br />
&nbsp; <span style="color: #660033; font-weight: bold;">$SPF_IS_NOT_XML</span><span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">16</span> &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># The input text will not be parsed for XML markup.</span><br />
&nbsp; <br />
&nbsp; <br />
&nbsp; <span style="color: #660033; font-weight: bold;">$SPF</span> <span style="color: #66cc66;">=</span> <span style="color: #660033; font-weight: bold;">$SPF_DEFAULT</span><br />
&nbsp; <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #66cc66;">!</span><span style="color: #660033; font-weight: bold;">$wait</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$SPF</span> <span style="color: #66cc66;">+=</span> <span style="color: #660033; font-weight: bold;">$SPF_ASYNC</span> <span style="color: #333;">&#125;</span><br />
&nbsp; <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$purge</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$SPF</span> <span style="color: #66cc66;">+=</span> <span style="color: #660033; font-weight: bold;">$SPF_PURGEBEFORESPEAK</span> <span style="color: #333;">&#125;</span><br />
&nbsp; <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$readfiles</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$SPF</span> <span style="color: #66cc66;">+=</span> <span style="color: #660033; font-weight: bold;">$SPF_IS_FILENAME</span> <span style="color: #333;">&#125;</span><br />
&nbsp; <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$readxml</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$SPF</span> <span style="color: #66cc66;">+=</span> <span style="color: #660033; font-weight: bold;">$SPF_IS_XML</span> <span style="color: #333;">&#125;</span><br />
&nbsp; <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$notxml</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$SPF</span> <span style="color: #66cc66;">+=</span> <span style="color: #660033; font-weight: bold;">$SPF_IS_NOT_XML</span> <span style="color: #333;">&#125;</span><br />
&nbsp; <br />
&nbsp; <span style="color: #660033; font-weight: bold;">$Voice</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">new-<span style="font-style: normal;">object</span></span> <span style="color: #000066;">-com</span> SAPI.<span style="color: #003366;">SpVoice</span><br />
&nbsp; <br />
&nbsp; <span style="color: #666699; font-weight: bold;">if</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$collection</span>.<span style="color: #003366;">count</span> <span style="color: #000066;">-gt</span> <span style="color: #cc66cc;">0</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">foreach</span><span style="color: #333;">&#40;</span> <span style="color: #660033; font-weight: bold;">$item</span> <span style="color: #666699; font-weight: bold;">in</span> <span style="color: #660033; font-weight: bold;">$collection</span> <span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$exit</span> <span style="color: #66cc66;">=</span> <span style="color: #660033; font-weight: bold;">$Voice</span>.<span style="color: #003366;">Speak</span><span style="color: #333;">&#40;</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$item</span> <span style="color: #66cc66;">|</span> <span style="color: #0066cc; font-style: italic;">out-<span style="font-style: normal;">string</span></span><span style="color: #333;">&#41;</span>, <span style="color: #660033; font-weight: bold;">$SPF</span> <span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; <span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span><br />
<br />
<span style="color: #666699; font-weight: bold;">process</span><br />
<span style="color: #333;">&#123;</span><br />
&nbsp; <span style="color: #666699; font-weight: bold;">if</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$_</span><span style="color: #333;">&#41;</span><br />
&nbsp; <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$exit</span> <span style="color: #66cc66;">=</span> <span style="color: #660033; font-weight: bold;">$Voice</span>.<span style="color: #003366;">Speak</span><span style="color: #333;">&#40;</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$_</span> <span style="color: #66cc66;">|</span> <span style="color: #0066cc; font-style: italic;">out-<span style="font-style: normal;">string</span></span><span style="color: #333;">&#41;</span>, <span style="color: #660033; font-weight: bold;">$SPF</span> <span style="color: #333;">&#41;</span><br />
&nbsp; <span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span><br />
<br />
&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/powershell-speaks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight Streaming, Silverlight CLR, Data Services, Ozzie, and IE 8</title>
		<link>http://huddledmasses.org/silverlight-streaming-silverlight-clr-data-services-ozzie-and-ie-8/</link>
		<comments>http://huddledmasses.org/silverlight-streaming-silverlight-clr-data-services-ozzie-and-ie-8/#comments</comments>
		<pubDate>Tue, 01 May 2007 21:40:36 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/jaykul/silverlight-streaming-silverlight-clr-data-services-ozzie-and-ie-8/</guid>
		<description><![CDATA[Microsoft made several big announcements today at MIX07&#8230; CLR in Silverlight The most exciting announcement I&#8217;ve today is that Silverlight will include the Common Language Runtime (CLR) on both Windows and Mac &#8230; which means that it will allow development using any .NET-supported languages. They&#8217;re even including the open source Dynamic Language Runtime and thus [...]]]></description>
			<content:encoded><![CDATA[	<p>Microsoft made several big announcements today at MIX07&#8230;</p>

	<h4><a href="http://redmondmag.com/news/article.asp?editorialsid=8508"><span class="caps">CLR</span> in Silverlight</a></h4>

	<p>The most exciting announcement I&#8217;ve today is that <a href="http://redmondmag.com/news/article.asp?editorialsid=8508">Silverlight will include the Common Language Runtime</a> (<span class="caps">CLR</span>) on both Windows and Mac &#8230; which means that it will allow development using any .NET-supported languages. They&#8217;re even including the open source <a href="http://blogs.zdnet.com/microsoft/?p=404">Dynamic Language Runtime</a> and thus IronRuby (which like IronPython is also open source).</p>

	<p>On top of that, these features, plus support for Language Integrated Query language (<span class="caps">LINQ</span>) and cross-platform debugging capabilities, are available now in the <a href="http://www.silverlight.net/">Silverlight</a> 1.1 Alpha (and will be released more publicly <strong>after</strong> Silverlight 1.0 comes out this summer?).</p>

	<h4><a href="http://redmondmag.com/news/article.asp?editorialsid=8507">Silverlight Streaming</a></h4>

	<p>They also <a href="http://redmondmag.com/news/article.asp?editorialsid=8507">announced today</a> that they will offer a media-hosting service <strong>for free</strong> called <a href="http://silverlight.live.com/">Silverlight Streaming</a>! In a move that targets both Adobe&#8217;s flash and other media-hosting sites like YouTube and Revver &#8230; they will allow developers to stream high -quality video (up to <span class="caps">DVD</span> quality) into their Silverlight apps from Microsoft&#8217;s servers without any restrictions on branding or embedding (including use in &#8220;rich internet applications&#8221; &#8212; i.e.: outside the browser).</p>

	<p>The <a href="http://silverlight.live.com/">current package</a> in pre-release offers only 4GB of storage and unlimited bandwidth delivery of up to <span class="caps">DVD</span> quality video (700 Kbps), but their plan calls for Microsoft to provide hosting for unlimited Silverlight content and up to a million minutes of free video streaming at 700 Kpbs per site per month &#8230; that&#8217;s over <a href="http://www.google.com/search?q=((1+million+minutes">5,000 Gigabytes of bandwidth</a>)+*+700+Kbps)+in+gigabytes of streaming per month, for free! They&#8217;ll also offer unlimited streaming for a fee, or free, but supported by advertising&#8230;</p>

	<h4><a href="http://blogs.msdn.com/adonet">Jasper</a> and <a href="http://astoria.mslivelabs.com/">Astoria</a> CTPs</h4>

	<p><a href="http://astoria.mslivelabs.com/">Astoria</a> builds on <span class="caps">ADO</span>.<span class="caps">NET</span> and <span class="caps">WCF</span> to allows you to expose a <a href="http://blogs.msdn.com/pablo/archive/2007/04/30/codename-astoria-data-services-for-the-web.aspx">data service for the web</a>  which can be consumed via <span class="caps">HTTP</span> and since it uses standard <span class="caps">HTTP</span> verbs (<span class="caps">GET</span>, <span class="caps">POST</span>, <span class="caps">DELETE</span>, etc) you can even make it accessible as a REST-style resource collection with unique URIs &#8230; and simple formats like <span class="caps">JSON</span> or plain <span class="caps">XML</span> ... </p>

	<p><a href="http://blogs.msdn.com/adonet/archive/2007/04/30/project-codename-jasper-announced-at-mix-07.aspx">Jasper</a> is another <a href="http://msdn2.microsoft.com/en-us/data/bb419139.aspx"><span class="caps">ADO</span>.<span class="caps">NET</span> incubation project</a> &#8230; aimed at dynamically typed .Net languages like VB.Net or IronPython &#8230; it dynamically generates data classes (instead of requiring manual, static configuration &#8230; or even code generation which must be kept up to date).  It&#8217;s built on the Entity Framework (which was <a href="http://redmondmag.com/news/article.asp?editorialsid=8509">postponed until some time in 2008</a> &#8230; after Orcas ships), so it supports rich queries and object-relational mapping and automatic databinding.</p>

	<h4>Ozzie speaks on Services and Clients&#8230;</h4>

	<p>The <a href="http://blogs.zdnet.com/BTL/?p=4959">orchestration of announcements</a> has many people <a href="http://seattletimes.nwsource.com/html/businesstechnology/2003687807_mix01.html">buzzing</a> about strong leadership and strategy &#8230; and the keynote by Ray Ozzie left <a href="http://www.pcworld.com/article/id,131412-c,companynews/article.html">no doubt about who&#8217;s behind that</a>, highlighting the work Microsoft is doing to integrate all the various aspects of their strategy.  Ozzie pitched Software-as-a-Service (SaaS) 2.0: web and hosted services which have &#8220;grown to embrace the uniquely valuable role of the client.&#8221;</p>

	<h4><a href="http://blogs.zdnet.com/microsoft/?p=416">IE 8 will require Standards Mode</a></h4>

	<p>In a move that only the undisputed king of browsers could hope to pull off, Microsoft has announced that they&#8217;ll be <strong>requiring</strong> web developers to opt in to standards-compliant web design &#8230; feel free to take a moment to check for flying pigs.</p>

	<p>They&#8217;re also planning on making the IE object model more interoperable with other browsers and provide more client-side APIs &#8212; including local storage for <span class="caps">AJAX</span> apps and more extensibility in the form of a plugin <span class="caps">API</span>.  Look for it in 2008.</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/silverlight-streaming-silverlight-clr-data-services-ozzie-and-ie-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I learned today [17-Apr-2007] about [PowerShell]</title>
		<link>http://huddledmasses.org/what-i-learned-today-about-powershell/</link>
		<comments>http://huddledmasses.org/what-i-learned-today-about-powershell/#comments</comments>
		<pubDate>Tue, 17 Apr 2007 18:42:53 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/jaykul/what-i-learned-today-about-powershell/</guid>
		<description><![CDATA[I&#8217;ve been playing more with PowerShell lately, and there&#8217;s some really cool stuff in there! I though I&#8217;d post a few of my favorite discoveries. Generally speaking these are PowerShell user tips and tricks, because I&#8217;ve already been using PowerShell for a while, but since this is a &#8220;what I learned today&#8221; post, I&#8217;m not [...]]]></description>
			<content:encoded><![CDATA[	<p>I&#8217;ve been playing more with PowerShell lately, and there&#8217;s some really cool stuff in there!  I though I&#8217;d post a few of my favorite discoveries.  Generally speaking these are PowerShell user tips and tricks, because I&#8217;ve already been using PowerShell for a while, but since this is a &#8220;what I learned today&#8221; post, I&#8217;m not going to go back and write about the basics (besides, lots of other people are doing that already).</p>

	<p>When you&#8217;re writing a PowerShell function, there is a method <code>param</code> which you can use to specify the parameters that the function accepts, including specifying their type, and their default value(s).</p>

	<p>When you&#8217;re specifying types, you do so in square brackets like <code>[System.Int32]</code> but there are <a href="http://blogs.msdn.com/powershell/archive/2006/07/12/663540.aspx">Type Shortcuts</a> defined for the most common types, and even better, if you&#8217;re typing in PowerShell, you get tab-completion for them (even for the .Net types).</p>

	<p>PowerShell includes a special type: <code>[switch]</code> which is for functions and scripts to take a command line parameter that is false by default (ie: it defaults to <code>$false</code>) and which doesn&#8217;t require any value on the command line (if you specify it, then it&#8217;s true).  So for instance, if you had a script named &#8220;RandomLine&#8221; that looked like this:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #666699; font-weight: bold;">param</span><span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #666699; font-weight: bold;">switch</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$Quiet</span>, <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">string</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$fileName</span><span style="color: #66cc66;">=</span><span style="color: #009900;">'C:\Users\Joel\Documents\Quotes\attributed quotes.txt'</span><span style="color: #333;">&#41;</span><br />
<br />
<span style="color: #660033; font-weight: bold;">$line</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Content</span></span> <span style="color: #333;">&#40;</span> <span style="color: #660033; font-weight: bold;">$fileName</span> <span style="color: #333;">&#41;</span> <span style="color: #66cc66;">|</span> <span style="color: #0066cc; font-style: italic;">Select-<span style="font-style: normal;">Random</span></span><br />
<span style="color: #0066cc; font-style: italic;">Set-<span style="font-style: normal;">Clipboard</span></span> <span style="color: #000066;">-Text</span> <span style="color: #660033; font-weight: bold;">$line</span><br />
<span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #66cc66;">!</span><span style="color: #660033; font-weight: bold;">$Quiet</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span> <span style="color: #009900;">&quot;Clipboard set to:<span style="color: #000099; font-weight: bold;">`n</span>$line&quot;</span> <span style="color: #333;">&#125;</span><br />
&nbsp;</div>

	<p>You could call it by just writing <code>RandomLine</code> or you could suppress the message at the end (a plain string in PowerShell is equivalent to C# <code>Console.WriteLine</code> or a bash <code>echo</code>) by just specifying <code>RandomLine -Quiet</code> without needing to specify the value as <code>$false</code>.</p>

	<p>Parameter names are not case sensitive, and don&#8217;t have to be fully typed out (as long as you type enough that the system can tell which one you mean), so you can actually call that script earlier as: <code>RandomLine -q</code>  or <code>RandomLine -q:$true -f:&#34;C:\Users\Joel\Documents\Quotes\children&#39;s wisdom.txt&#34;</code></p>

	<p>Oh, and that script &#8230; depends on this other script:</p>

	<p><span id="more-408"></span><br />
<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #666699; font-weight: bold;">param</span><span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">array</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$Collection</span><span style="color: #333;">&#41;</span><br />
&nbsp;<br />
<span style="color: #666699; font-weight: bold;">begin</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$result</span> <span style="color: #66cc66;">=</span> <span style="color: #660033; font-weight: bold;">$Seed</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">if</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$args</span> <span style="color: #000066;">-eq</span> <span style="color: #009900;">'-?'</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">''</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">'Usage: Select-Random [[-Collection] &lt;array&gt;]'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">''</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">'Parameters:'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">' &nbsp; &nbsp;-Collection : The collection from which to select a random entry.'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">' &nbsp; &nbsp;-? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: Display this usage information'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">''</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">'Examples:'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">' &nbsp; &nbsp;PS&gt; $arr = 1..5; Select-Random $arr'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">' &nbsp; &nbsp;PS&gt; 1..5 | Select-Random'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">''</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">exit</span><br />
&nbsp; &nbsp; <span style="color: #333;">&#125;</span> <br />
&nbsp;<br />
&nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$coll</span> <span style="color: #66cc66;">=</span> @<span style="color: #333;">&#40;</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">if</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$collection</span>.<span style="color: #003366;">count</span> <span style="color: #000066;">-gt</span> <span style="color: #cc66cc;">0</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$coll</span> <span style="color: #66cc66;">+=</span> <span style="color: #660033; font-weight: bold;">$collection</span><br />
&nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span><br />
&nbsp;<br />
<span style="color: #666699; font-weight: bold;">process</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">if</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$_</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$coll</span> <span style="color: #66cc66;">+=</span> <span style="color: #660033; font-weight: bold;">$_</span>;<br />
&nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span><br />
&nbsp;<br />
<span style="color: #666699; font-weight: bold;">end</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">if</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$coll</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$randomIndex</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Random</span></span> <span style="color: #000066;">-Min</span> <span style="color: #cc66cc;">0</span> <span style="color: #000066;">-Max</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$coll</span>.<span style="color: #003366;">Count</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$coll</span><span style="color: #333;">&#91;</span><span style="color: #660033; font-weight: bold;">$randomIndex</span><span style="color: #333;">&#93;</span><br />
&nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span><br />
&nbsp;</div>

	<p>Which actually depends on Get-Random, which is one of the <a href="http://www.CodePlex.com/PowerShellCX/">PowerShell Community Extensions</a> available on CodePlex.</p>

	<p>Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/PowerShell" rel="tag">PowerShell</a>, <a class="performancingtags" href="http://technorati.com/tag/Scripting" rel="tag">Scripting</a>, <a class="performancingtags" href="http://technorati.com/tag/Windows" rel="tag">Windows</a>, <a class="performancingtags" href="http://technorati.com/tag/Automation" rel="tag">Automation</a>, <a class="performancingtags" href="http://technorati.com/tag/Command Line" rel="tag">Command Line</a></p>

]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/what-i-learned-today-about-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Downloads for Visual Studio</title>
		<link>http://huddledmasses.org/downloads-for-visual-studio/</link>
		<comments>http://huddledmasses.org/downloads-for-visual-studio/#comments</comments>
		<pubDate>Mon, 18 Dec 2006 21:04:03 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/jaykul/downloads-for-visual-studio/</guid>
		<description><![CDATA[Well, the latest news is that Visual Studio 2005 SP1 is available, which finally includes official support for running Visual Studio on Windows Vista [o.o], as well as for &#8220;Web Application&#8221; projects in VS2005 &#8212; which means you have to uninstall the previous web application project add-in. While I&#8217;m writing about Visual Studio, and since [...]]]></description>
			<content:encoded><![CDATA[	<p>Well, the latest news is that <a href="http://msdn.microsoft.com/vstudio/support/vs2005sp1/default.aspx">Visual Studio 2005 SP1</a> is available, which <em>finally</em> includes official support for running Visual Studio on Windows Vista [o.o], as well as for &#8220;Web Application&#8221; projects in VS2005 &#8212; which means you have to uninstall the previous web application project add-in. </p>

	<p>While I&#8217;m writing about Visual Studio, and since I just had to reinstall Visual Studio and all my other tools on my new computer (yes, in Windows Vista), I figured I would point out some of the other add-ins that I depend on, as well as a few cool new downloads.</p>

	<p>The <a href="http://msdn2.microsoft.com/en-us/vstudio/aa718340.aspx">Visual Studio Power Toys</a> are a collection of addins and developer tools including ILMerge, VS Command Shell, the <span class="caps">XML</span> Notepad and more.  In fact, <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=MSBee">MSBee</a> &#8212; which I use regularly at work &#8212; is a one of the power toys. It allows you to develop applications that target the .<span class="caps">NET</span> Framework 1.1 in Visual Studio 2005. <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=VSWindowManager">VS Window Manager</a> is also a power toy, it allows you to save named layout presets which remember your window positions and auto-hide status&#8230; and even change automatically between layouts.  There&#8217;s also a new power toy which sounds really nice, but that I haven&#8217;t had a chance to try yet: the <a href="http://www.codeplex.com/ResourceRefactoring">Resource Refactoring</a> tool which lets you extract hard-coded strings from code into resource files in C#, VB.<span class="caps">NET</span> and even web projects. </p>

	<p>Anyway, the reason I started to mention the power toys is that they now have a <a href="http://www.codeplex.com/PackInstaller">Power Toys Pack Installer</a> which aims to let you install some or all of these from a single installer interface.  I just wish other people could publish their add-ins so they could be included in this thing &#8212; it sure would make this new setup process easier, especially if they could check for updates&#8230;</p>

	<p>Another add-in I depend on is <a href="http://www.roland-weigelt.de/ghostdoc/">Roland Weigelt&#8217;s GhostDoc</a> which makes keeping my documentation up-to-date much easier, especially because of his support for interfaces and inheritance. One pointer: if you install GhostDoc on Vista, (actually, this applies to 90% of these developer tools) make sure you run the installer as administrator or from a console with administrator access, because otherwise the installers sometimes fail, or worse, they appear to work but result in non-functioning installs.</p>

	<p>I also use:
	<ul>
		<li><a href="http://www.testdriven.net/">TestDriven.NET</a> which is an nUnit unit testing addin which I use at home, and actually still use at work, because we haven&#8217;t upgraded to the full Team Studio versions and testing.</li>
		<li><a href="http://weblogs.asp.net/alex_papadimoulis/archive/tags/Smart%20Paster%20Add-In/default.aspx">SmartPaster</a> is for pasting string literals into code, and I find it particularly useful for pasting in <span class="caps">SQL</span> queries.</li>
		<li><a href="http://www.jtleigh.com/CopySourceAsHtml">CopySourceAsHTML</a> does what it says &#8230; with lots and lots of options. Although it&#8217;s invaluable when you need it &#8230; I don&#8217;t use it as much as the others, so I tend to forget to install it until weeks later when I suddenly try to use it and it&#8217;s not there.c</li>
		<li><a href="http://www.codeproject.com/csharp/ImageVisualizer.asp">ImageVisualizer</a> lets you see the image contained in a bitmap during debugging.</li>
	</ul>
	<ul>
		<li><a href="http://tools.osherove.com/Default.aspx?tabid=187">RegexVisualizer</a> lets you visualize and edit &#8220;Regex&#8221;, &#8220;Match&#8221; and &#8220;MatchCollection&#8221; objects at debug-time. <strong>Very</strong> nice.</li>
	</ul></p>

	<p>Oh, and while I&#8217;m at it &#8230; there&#8217;s a short stack of other add-ins that I still need to try out (in rough order of how excited I am about them).
	<ul>
		<li><a href="http://donxml.com/allthingstechie/archive/2006/07/07/2792.aspx">XPathMania</a> adds proper XPath query support to Visual Studio so you can test your XPath statements against the current document in the <span class="caps">XML</span> editor, this is something I&#8217;ve been needing for a while.</li>
		<li><a href="http://www.devx.com/vstudioextensibility/Link/32736">SiteMap Editor</a> provides a structured UI for editing sitemap <span class="caps">XML</span>.</li>
		<li><a href="http://submain.com/?nav=products.smartoutline">SmartOutline</a> enhances the &#8220;region&#8221; capability of Visual Studio to allow regions that weren&#8217;t possible before, even creating regions from if statements, and it also persists the collapsed state.</li>
		<li><a href="http://www.codekeep.net/">CodeKeep</a> is the ultimate collection of source-code snippets, with a corresponding add-in for Visual Studio 2005 so you can drag-and-drop snippets into the editor</li>
		<li>The <a href="http://odetocode.com/Blogs/scott/archive/2006/01/12/2726.aspx">ControlTree Visualizer</a> lets you see the control hierarchy on a web page during debugging, which should prove invaluable with some of my <span class="caps">ASP</span>.<span class="caps">NET</span> <span class="caps">AJAX</span> bugs&#8230; </li>
		<li><a href="http://blog.bretts.net/?p=9">Control Visualizer</a> is another <span class="caps">ASP</span>.<span class="caps">NET</span> debugging visualizer from the same guy that wrote the by-now-famous <a href="http://blog.bretts.net/?p=11">Cache Visualizer</a></li>
	</ul>
	<ul>
		<li><a href="http://www.pinvoke.net">PInvoke.net</a> is actually a website &#8212; which I find very valuable (especially when I&#8217;m working on shell-related stuff in .<span class="caps">NET</span>) &#8212; I generally look up <span class="caps">API</span> calls on the website, but they also have an add-in for looking things up from within Visual Studio.  I may just have to install this when I start coding for fun (instead of for school) again.</li>
	</ul></p>

	<p>Oh, and a random little link to <a href="http://tools.osherove.com/Default.aspx?tabid=182">Regulazy</a> a regular expression tool for the rest of you (who can&#8217;t tell a <code>\d{2}</code> from a <code>\w+</code>). This isn&#8217;t an add in, but it <strong>is</strong> a really clever way to build regular expressions from a sample string that you want to match.</p>

	<p>Technorati Tags: <a class="performancingtags" href="http://technorati.com/tag/Develop" rel="tag">Develop</a>, <a class="performancingtags" href="http://technorati.com/tag/VisualStudio" rel="tag">VisualStudio</a>, <a class="performancingtags" href="http://technorati.com/tag/.NET" rel="tag">.NET</a>, <a class="performancingtags" href="http://technorati.com/tag/VSAddins" rel="tag">VSAddins</a>, <a class="performancingtags" href="http://technorati.com/tag/Debugging" rel="tag">Debugging</a>, <a class="performancingtags" href="http://technorati.com/tag/Visualizers" rel="tag">Visualizers</a></p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/downloads-for-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSDN Wiki to expand</title>
		<link>http://huddledmasses.org/msdn-wiki-to-expand/</link>
		<comments>http://huddledmasses.org/msdn-wiki-to-expand/#comments</comments>
		<pubDate>Fri, 08 Sep 2006 23:44:18 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.huddledmasses.org/jaykul/msdn-wiki-to-expand/</guid>
		<description><![CDATA[MSDN is working to migrate the community content feature of the msdnwiki.microsoft.com site into their main site so that it can be expanded to the entire documentation library, including other localized versions of the Whidbey documentation in MSDN2 by the end of this calendar year.
]]></description>
			<content:encoded><![CDATA[	<p>According to the <a href="https://blogs.msdn.com/sandcastle/archive/2006/09/06/742352.aspx">SandCastle blog</a>, the response to the beta of <a href="http://msdnwiki.microsoft.com">msdnwiki.microsoft.com</a> has been very positive, with the main request being that they import more documentation (I know several of my developer friends have commented that none of the platform <span class="caps">SDK</span> is available there, which is where community sample code would be <em>most</em> appreciated). The good news is that:</p>

	<blockquote>
		<p>Based on this feedback, <span class="caps">MSDN</span> is working to migrate the community content feature to their main site so that it can be expanded to the entire library, including other localized versions of the Whidbey documentation in MSDN2 by the end of this calendar year.</p>
	</blockquote>

	<p>At that point, the only stuff that will remain on the MSDNWiki site is the <a href="http://blogs.msdn.com/somasegar/archive/2006/09/05/736039.aspx">machine-translated content</a> &#8212; they offer machine translated documentation in Wiki format so that native speakers can improve the translations in languages where the market isn&#8217;t big enough for <span class="caps">MSDN</span> to offer an official translation of the documentation.</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/msdn-wiki-to-expand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LINQ and Blinq</title>
		<link>http://huddledmasses.org/linq-and-blinq/</link>
		<comments>http://huddledmasses.org/linq-and-blinq/#comments</comments>
		<pubDate>Tue, 11 Jul 2006 14:39:59 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.huddledmasses.org/jaykul/linq-and-blinq/</guid>
		<description><![CDATA[Microsoft&#8217;s ASP.NET team has created a tool based on the May CTP of LINQ (see the very cool what&#8217;s new video) for generating websites that display, create, and manipulate data. All you do is point Blinq at a database, and it creates a website that displays the data, allows sorting and paging and updating, deleting [...]]]></description>
			<content:encoded><![CDATA[	<p>Microsoft&#8217;s <span class="caps">ASP</span>.<span class="caps">NET</span> team has created a tool based on the May <span class="caps">CTP</span> of <span class="caps">LINQ</span> (see the very cool <a href="http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20060622LINQLB/manifest.xml">what&#8217;s new video</a>) for generating websites that display, create, and manipulate data. All you do is point Blinq at a database, and it creates a website that displays the data, allows sorting and paging and updating, deleting and creating new records, including following the relationships between tables.</p>

	<p>The reason that&#8217;s impressive is because there&#8217;s no <span class="caps">SQL</span> queries to write, <span class="caps">LINQ</span> generates optimized queries and Blinq generates web forms and pages from the database schema.  Of course, this is all in beta, and for developers only (you can&#8217;t use it in production yet).</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/linq-and-blinq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

