<?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>Lab49 Blog &#187; Tools</title>
	<atom:link href="http://blog.lab49.com/archives/category/tools/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.lab49.com</link>
	<description>Technology and industry insights from Lab49.</description>
	<lastBuildDate>Wed, 08 Feb 2012 09:02:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Sublime Text and CoffeeScript</title>
		<link>http://www.feanorian.net/site/sublime_text_and_coffeescript</link>
		<comments>http://www.feanorian.net/site/sublime_text_and_coffeescript#comments</comments>
		<pubDate>Tue, 20 Dec 2011 23:52:16 +0000</pubDate>
		<dc:creator>Manung Han</dc:creator>
				<category><![CDATA[Languages]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[
        I admit it. I have Text Editor compulsion. I have played around with many text editors on my Mac including vim, emacs, BBEdit and TextMate. So its no surprise I encountered Sublime Text 2 .&#160; Its a neat little editor in its infancy.

But a...]]></description>
			<content:encoded><![CDATA[<p>I admit it. I have Text Editor compulsion. I have played around with many text editors on my Mac including vim, emacs, BBEdit and TextMate. So its no surprise I encountered <a href="http://www.sublimetext.com/2">Sublime Text 2</a> .&nbsp; Its a neat little editor in its infancy.</p>
<p>But as all neat little editors in its infancy go, it is a little premature.&nbsp; For example there is no out of the box <a href="http://jashkenas.github.com/coffee-script/">CoffeeScript</a> support.&nbsp; Since I have been hacking some CoffeeScript, I needed to correct this.&nbsp; So with some googling and the fact that Sublime Text supports <a href="http://macromates.com/">TextMate</a> bundles, I discovered how to start CoffeeScript development with Sublime Text.&nbsp; The following are my findings.</p>
<h2 id="syntaxhighlighting">Syntax Highlighting</h2>
<p>We will make use of <a href="https://github.com/jashkenas">Jeremy Ashkenas</a> <a href="https://github.com/jashkenas/coffee-script-tmbundle">CoffeeScript TextMate Bundle</a> to add syntax highlighting support.</p>
<ul>
<li>Create ~/Library/Application Support/Sublime Text 2/Packages/CoffeeScript/</li>
<li>Copy <a href="https://github.com/jashkenas/coffee-script-tmbundle/blob/master/Syntaxes/CoffeeScript.tmLanguage">CoffeeScript.tmLanguage</a> and <a href="https://github.com/jashkenas/coffee-script-tmbundle/blob/master/Preferences/CoffeeScript.tmPreferences">CoffeeScript.tmPreferences</a> to ~/Library/Application Support/Sublime Text 2/Packages/CoffeeScript/</li>
</ul>
<h2 id="buildsystem">Build System</h2>
<p>To setup the Sublime Text <a href="http://sublimetext.info/docs/en/reference/build_systems.html">Build System</a> to work with CoffeeScript you just need to create a file (CoffeeScript.sublime-build) with the following contents and place in ~/Library/Application Support/Sublime Text 2/Packages/User/</p>
<pre><code>{
    "cmd": ["coffee", "$file"],
    "selector" : "source.coffee",
    "path" : "/usr/local/bin"
}</code></pre>
<p>Note that I have CoffeeScript installed in /usr/local/bin on my Mac.&nbsp; Edit the above path appropriately to match your system.</p>
<h2 id="script">Script</h2>
<p>Obviously the above is aching to be automated so I hacked up a quick bash script and associated sublime build file.&nbsp; They can be found <a href="https://github.com/manung/sandbox/tree/master/scripts/sublimetext-coffeescript">here</a> in my git sandbox repo.</p>
<h2 id="credit">Credit</h2>
<p>Credit where credit is due.&nbsp; Much of the info from this post was garnered from the following sources:</p>
<p><a href="http://soenkerohde.com/2011/11/coffeescript-with-sublime-text/">http://soenkerohde.com/2011/11/coffeescript-with-sublime-text/</a><br />
<a href="http://www.sublimetext.com/forum/viewtopic.php?f=4&amp;t=2022">http://www.sublimetext.com/forum/viewtopic.php?f=4&amp;t=2022</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.feanorian.net/site/sublime_text_and_coffeescript/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I Use Powershell</title>
		<link>http://northhorizon.net/2011/why-i-use-powershell/</link>
		<comments>http://northhorizon.net/2011/why-i-use-powershell/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 03:36:11 +0000</pubDate>
		<dc:creator>Daniel Moore</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Lab49]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://northhorizon.net/?p=457</guid>
		<description><![CDATA[I&#8217;ve been using Powershell for just over a year now, and its effect on my development workflow has been steadily increasing. Looking back, I have no doubt that it is the most important tool in my belt &#8211; to be perfectly honest, I&#8217;d rather have Powershell than Visual Studio now. Of course, that&#8217;s not to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Powershell for just over a year now, and its effect on my development workflow has been steadily increasing. Looking back, I have no doubt that it is the most important tool in my belt &#8211; to be perfectly honest, I&#8217;d rather have Powershell than Visual Studio now. Of course, that&#8217;s not to say Visual Studio isn&#8217;t useful &#8211; it is &#8211; but rather more that Poweshell fills an important role in the development process that isn&#8217;t even approached by other tools on the platform. Visual Studio may be the best IDE on the market, but at the end of the day, there are other tools that can replace it, albeit imperfectly.</p>
<p>To take some shavings off of the top top of the iceberg that is why I use Powershell, I&#8217;d like to share a recent experience of Powershell delivering for me. <span id="more-457"></span></p>
<h2>Setup for Failure</h2>
<p>As a co-orgranizer for the <a href="http://www.meetup.com/NY-Dotnet/">New York .NET Meetup</a> I was tasked with getting the list of attendees off of meetup.com and over to the lovely people at Microsoft who kindly give us space to meet. Now, you might think there&#8217;d be some nifty &#8220;export attendee list to CSV&#8221; function the meetup.com website, but like a lot of software, it doesn&#8217;t do half the things you think it should and this is one of those things. Usually my colleague David assembles the list, but this particular month he was out on vacation. He did, however, point me over to a GitHub repository of a tool that would do the extraction.</p>
<p>Following his advice, I grabbed the repository and brought up the C#/WinForms solution in Visual Studio. Looking at the project structure, I was a bit stunned at the scale of it all. The author had divided his concerns very well into UI, data access, the core infrastructure, and, of course, unit testing. I thought that was pretty peculiar considering all I wanted to do was get a CSV of names and such off of a website. Far be it for me to criticize another developer&#8217;s fastidiousness. Maybe it also launched space shuttles; you never know.</p>
<p>In what I can only now describe as naivety, I hit F5 and expected something to happen. </p>
<p>I was rewarded with 76 errors.</p>
<p>Right off the bat, I realized that the author had botched a commit and forgot a bunch of libraries. I was able to find NHibernate fairly easily with Nuget, but had no luck with &#8220;Rhino.Commons.NHibernate&#8221;. I tried to remove the dependency problem, but didn&#8217;t have much luck. And the whole time I was wondering why the hell you needed all these libraries <b>to extract a damn CSV from the internet</b>.</p>
<h2>The Problem</h2>
<p>Rather than throw more time after the problem, I decided to forge out on my own. Really, how hard could it be to</p>
<ol>
<li>Get an XML doc from the internet</li>
<li>Extract the useful data</li>
<li>Perform some heuristics on the names</li>
<li>Dump a CSV file</li>
</ol>
<p>Being a long-time C# programmer, my knee-jerk reaction was to build a solution in that technology. Forgoing a GUI to spend as little time as possible in building this, I&#8217;d probably build a single file design that ostensibly could consist of a single method. And if that were the case, why not script it?</p>
<p>So if I was going to write a script, what to use? I could write a JavaScript and run it on node.js, but it&#8217;s lacking proper CSV utilities and I&#8217;d have to run it on something other than my main Windows box. Not to mention I don&#8217;t particularly writing in JavaScript, so I&#8217;d probably write it in CoffeeScript and have to compile it, etc, etc. </p>
<p>I briefly considered writing an F# script, but I suspect only about ten people would know what on earth it was, and, at the end of the day, I would like to share my script to others.</p>
<h2>The Solution</h2>
<p>In the end, I concluded what I had known already: Powershell was the tool to use. It had excellent support for dealing with XML (via accelerators) and, as a real scripting language, had no pomp and circumstance.</p>
<p>Here&#8217;s the script I ended up writing:</p>
<pre class="brush:powershell">function Get-MeetupRsvps([string]$eventId, [string]$apiKey) {$nameWord = "[\w-']{2,}" $regex = "^(?'first'$nameWord) ((\w\.?|($nameWord )+) )?(?'last'$nameWord)|(?'last'$nameWord), ?(?'first'$nameWord)( \w\.|( $nameWord)+)?$" function Get-AttendeeInfo {process {$matches = $null $answer = $_.answers.answers_item if(-not ($_.name -match $regex)) { $answer -match $regex | Out-Null }return New-Object PSObject -Property @{ 'FirstName' = $matches.first 'LastName' = $matches.last 'RSVPName' = $_.name 'RSVPAnswer' = $answer 'RSVPGuests' = $_.guests }} }$xml = [Xml](New-Object Net.WebClient).DownloadString("https://api.meetup.com/rsvps.xml?event_id=$eventId`&#038;key=$apiKey") $xml.SelectNodes('/results/items/item[response="yes"]') `| Get-AttendeeInfo `| select FirstName, LastName, RSVPName, RSVPAnswer, RSVPGuests }</pre>
<p>To dump this to a CSV file is then really easy:</p>
<pre class="brush: powershell; gutter: false">Get-MeetupRsvps -EventId 1234 -ApiKey 'MyApiKey' | Export-Csv -Path rsvps.csv -NoTypeInformation</pre>
<p>And because of this design, it&#8217;s really extensible. Potentially, instead of exporting to a CSV, you could pipe the information into another processor that would remove anyone named &#8220;Thorsten.&#8221; Actually, that would look like this:</p>
<pre class="brush: powershell; gutter: false">Get-MeetupRsvps -EventId 1234 -ApiKey 'MyApiKey' `| ? { %_.FirstName -ne 'Thorsten' } ` | Export-Csv -Path rsvps.csv -NoTypeInformation</pre>
<p>It&#8217;d be pretty difficult to do that if I&#8217;d written a C# executable &#8211; you&#8217;d have to go into Excel to do that. Or write a Powershell script. Just saying.</p>
<p>Here&#8217;s the real kicker: I spent all of five minutes writing my Powershell script and then spent minutes tweaking my regex to identify as many names as possible. I didn&#8217;t need to recompile, just F5 again in Poweshell ISE, which you have installed already if you&#8217;re on Windows 7. Since I left the <code>Export-Csv</code> part off during debugging, I could just read the console output and see what I got.</p>
<p>When I was happy with my output, it was dead simple to distribute: throw it in <a href="https://gist.github.com/1091011">a GitHub Gist</a> and move on with my life. If you decide to use it, all you need is Powershell installed (again, are you on Windows 7?) and the ability to copy and paste. No libraries. No worries. If you don&#8217;t like my regex, it couldn&#8217;t be easier to figure out how to replace it. If you want more fields, it&#8217;s easy to see where they should be added.</p>
<p>It&#8217;s really just that easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://northhorizon.net/2011/why-i-use-powershell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending PowerShell to the GUI with ShowUI</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/YMR7kB2suQg/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/YMR7kB2suQg/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 20:30:38 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/24/extending-powershell-to-the-gui-with-showui/</guid>
		<description><![CDATA[Sean Kearny wrote Extending PowerShell to the GUI with Sapien Tools up on Hey, Scripting Guy! Blog. SAPIEN has a product, PrimalForms, which lets you create WinForm applications using PowerShell. One of the advantages using this approach; WinForms is ready out of the box on an end users Windows machine. In this post I’ll use [...]]]></description>
			<content:encoded><![CDATA[<p>Sean Kearny wrote <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/24/create-a-simple-graphical-interface-for-a-powershell-script.aspx">Extending PowerShell to the GUI with Sapien Tools</a> up on <a href="http://blogs.technet.com/b/heyscriptingguy/">Hey, Scripting Guy! Blog</a>. SAPIEN has a product, <a href="http://www.sapien.com/software/primalforms">PrimalForms</a>, which lets you create WinForm applications using PowerShell. One of the advantages using this approach; WinForms is ready out of the box on an end users Windows machine.</p>
<p>In this post I’ll use <a href="http://showui.codeplex.com/">ShowUI</a> and port Sean’s example. The challenge, <a href="http://showui.codeplex.com/">ShowUI</a> is a <a href="http://msdn.microsoft.com/en-us/library/dd901839(v=vs.85).aspx">PowerShell Module</a> that needs to be xCopy deployed to the users machine so I can create these WPF GUI applications. </p>
<h3>ShowUI</h3>
<p><a href="http://showui.codeplex.com/">ShowUI</a> is a PowerShell module to help build WPF user interfaces in script. ShowUI makes the complicated world of WPF easy to use in PowerShell.</p>
<p>Sean steps through creating a simple GUI for capturing a user’s first and last name so it can be used with <a href="http://powergui.org/index.jspa">PowerGUI’s</a> <a href="http://wiki.powergui.org/index.php/Get-QADUser">Get-QADUser</a> cmdlet. First up, is a simple form with an ‘UNLOCK Account’ button.</p>
<pre class="PowerShellColorizedScript"><span style="color: #0000ff">Button</span> <span style="color: #8b0000">&quot;Unlock Account&quot;</span> <span style="color: #000080">-Show</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">10</span> <span style="color: #000080">-On_Loaded</span> <span style="color: #000000">{</span>
    <span style="color: #ff4500">$Window</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Title</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;Our Help Desk&quot;</span>
<span style="color: #000000">}</span></pre>
<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image7.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image_thumb7.png" width="343" height="100" /></a></p>
<h3>Now, Capture the User Information</h3>
<p>I’ll wrap the <a href="http://showui.codeplex.com/">ShowUI</a> code in a function <em>Get-UserInfo.</em> I like this practice because it makes the GUI widget reusable. In an upcoming post I’ll drill down on how to create custom controls. For now I will reproduce Sean’s user info screen.</p>
<p>I use a WPF Grid which lets me lay out controls in Rows and Columns. I use 3 rows, one row for the labels, one for the text boxes and the last for the button. Every control in <a href="http://showui.codeplex.com/">ShowUI</a> supports a Row and Column parameter, so they can all be laid out this way.</p>
<p>I write fewer lines of code using a WPF grid container. For example, when I resize the window all the controls resize automatically. Give it a try.</p>
<p>Next up, I show the magic to returning the data entered on the form as PowerShell Hashtable.</p>
<pre class="PowerShellColorizedScript"><span style="color: #00008b">function</span> <span style="color: #8a2be2">Get-UserInfo</span> <span style="color: #000000">{</span>
    <span style="color: #0000ff">Grid</span> <span style="color: #000080">-Rows</span> <span style="color: #800080">3</span> <span style="color: #000080">-Columns</span> <span style="color: #800080">2</span> <span style="color: #000080">-Show</span> <span style="color: #000080">-On_Loaded</span> <span style="color: #000000">{</span>
        <span style="color: #ff4500">$Window</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Title</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;Our Help Desk&quot;</span>
    <span style="color: #000000">}</span> <span style="color: #000000">{</span>            

        <span style="color: #0000ff">Label</span> <span style="color: #8b0000">&quot;First Name&quot;</span> <span style="color: #000080">-Row</span> <span style="color: #800080">0</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span> <span style="color: #000080">-FontWeight</span> <span style="color: #8a2be2">Bold</span>
        <span style="color: #0000ff">Label</span> <span style="color: #8b0000">&quot;Last Name&quot;</span> <span style="color: #000080">-Row</span> <span style="color: #800080">0</span> <span style="color: #000080">-Column</span> <span style="color: #800080">1</span> <span style="color: #000080">-FontWeight</span> <span style="color: #8a2be2">Bold</span>              

        <span style="color: #0000ff">TextBox</span> <span style="color: #000080">-Row</span> <span style="color: #800080">1</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">FirstName</span>
        <span style="color: #0000ff">TextBox</span> <span style="color: #000080">-Row</span> <span style="color: #800080">1</span> <span style="color: #000080">-Column</span> <span style="color: #800080">1</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">LastName</span>            

        <span style="color: #0000ff">Button</span> <span style="color: #8b0000">&quot;Unlock Account&quot;</span> <span style="color: #000080">-On_Click</span> <span style="color: #000000">{</span>
            <span style="color: #ff4500">$Window</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Set-UIValue</span> <span style="color: #000080">-passThru</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Close-Control</span>
        <span style="color: #000000">}</span> <span style="color: #000080">-IsDefault</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #000080">-Row</span> <span style="color: #800080">2</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span> <span style="color: #000080">-ColumnSpan</span> <span style="color: #800080">2</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span>            

<span style="color: #0000ff">Get-UserInfo</span>            

<span style="color: #006400"># Returns and Prints the hashtable</span>
<span style="color: #8b0000">@&quot;
Name      Value
----      -----
FirstName Mister
LastName  Trouble
&quot;@</span>            </pre>
<p align="center"><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image8.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image_thumb8.png" width="321" height="171" /></a></p>
<h3 align="left">Pressing the button returns a Hash Table</h3>
<p align="left">Here is I how I set this up to work. I named the <em>TextBox</em> controls <em>FirstName</em> and <em>LastName</em>. Then in the Button <em>–On_Click</em> event, I pipe the <em>$Window</em> automatic variable to the <a href="http://showui.codeplex.com/">ShowUI</a> <em>Set-UIValue</em> cmdlet. Set-UIValue takes the content of the TextBox and copies it to the Tag properties. Then, when the form is closed, via <em>Close-Control</em>, the Tag properties are scanned and the name and tag of that control are added to the&#160; hash table as a key value pair.</p>
<h3 align="left">Variable Splatting</h3>
<p>Hashtables (aka associative arrays) are great data structures. Plus, in PowerShell you can use them to do <em>variable splatting</em>.</p>
<blockquote>
<p>This is a term taken from the <a href="http://www.ruby-lang.org/en/">Ruby scripting language</a> and affects how argument variables are passed to commands. – <a href="http://www.linkedin.com/profile/view?id=4968842&amp;authType=name&amp;authToken=_zkt&amp;trk=tyah">Bruce Payette</a> <em><a href="http://www.manning.com/payette2/">Windows PowerShell In Action 2nd Edition</a></em></p>
</blockquote>
<p>To do this is, when referencing the variable that you want to pass to the command, you use @ instead of $ as the prefix to the variable.</p>
<h3>Conclusion</h3>
<p>So, I can squirrel away my Get-UserInfo function and reuse it. Then, calling the <em>Get-QADUser</em> cmdlet becomes even simpler. </p>
<pre style="width: 265px; height: 40px" class="PowerShellColorizedScript"><span style="color: #ff4500">$userInfo</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">Get-UserInfo</span>
<span style="color: #0000ff">Get-QADUser</span> <span style="color: #ff4500">@userInfo</span></pre>
<p>This approach has another benefit. I can add another TextBox to my GUI, name it the same name as a parameter on Get-QADUser and it will seamlessly work.</p>
<p>These are some of the high order abstractions I and my fellow ShowUI authors, <a href="http://www.start-automating.com/">James Brundage</a> and <a href="http://huddledmasses.org/">Joel Bennett</a>, are building into <a href="http://showui.codeplex.com/">ShowUI</a>.</p>
<p>Give it a try and drop us line on <a href="http://showui.codeplex.com/">CodePlex</a> or our blogs if you have questions or suggestions.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F24%2Fextending-powershell-to-the-gui-with-showui%2F&amp;title=Extending%20PowerShell%20to%20the%20GUI%20with%20ShowUI"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/YMR7kB2suQg" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/YMR7kB2suQg/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell ‘Net User’ ShowUI GUI</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/QlYhz3oJdRE/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/QlYhz3oJdRE/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 14:00:00 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/18/powershell-net-user-showui-gui/</guid>
		<description><![CDATA[Denniver Reining posted GUI Creation with PowerShell: The Basics using PowerShell and WinForms to create an application where you type a user id, click go and it executes a Net User under the covers. Highlights I ported his code to ShowUI and focused on the elements he did: Control resizing (Using the Grid) Adding controls [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bytecookie.wordpress.com/">Denniver Reining</a> posted <a href="http://bytecookie.wordpress.com/2011/07/17/gui-creation-with-powershell-the-basics/">GUI Creation with PowerShell: The Basics</a> using PowerShell and WinForms to create an application where you type a user id, click go and it executes a <em>Net User</em> under the covers.</p>
<h3>Highlights</h3>
<p>I ported his code to <a href="http://showui.codeplex.com/">ShowUI</a> and focused on the elements he did:</p>
<ul>
<li>Control resizing (Using the Grid) </li>
<li>Adding controls to a Window </li>
<li>Attaching events (On_Click parameter for the button) </li>
<li>Changing control fonts (FontFamily parameter for the text box) </li>
</ul>
<p>Using WinForms and PowerShell are a great approach to building GUIs. One advantage WinForms has over ShowUI is it is available on any machine you deliver your PowerShell script to.</p>
<p><a href="http://showui.codeplex.com/">ShowUI</a> leverages WPF and while it requires investment and a module, the value per line of code is compelling.</p>
<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image6.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image_thumb6.png" width="523" height="431" /></a></p>
<h3>PowerShell Code</h3>
<pre style="width: 561px; height: 478px" class="PowerShellColorizedScript"><span style="color: #0000ff">Import-Module</span> <span style="color: #8a2be2">ShowUI</span>            

<span style="color: #ff4500">$windowAttributes</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
    <span style="color: #000000">Title</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;ShowUI Form&quot;</span>
    <span style="color: #000000">WindowStartupLocation</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;CenterScreen&quot;</span>
    <span style="color: #000000">SizeToContent</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;WidthAndHeight&quot;</span>
<span style="color: #000000">}</span>            

<span style="color: #0000ff">New-Window</span> <span style="color: #ff4500">@windowAttributes</span> <span style="color: #000080">-Show</span> <span style="color: #000000">{</span>            

    <span style="color: #0000ff">Grid</span> <span style="color: #000080">-Columns</span> <span style="color: #8a2be2">75*</span><span style="color: #a9a9a9">,</span> <span style="color: #800080">75</span> <span style="color: #000080">-Rows</span> <span style="color: #800080">40</span><span style="color: #a9a9a9">,</span> <span style="color: #8a2be2">10*</span> <span style="color: #000000">{</span>
        <span style="color: #0000ff">TextBox</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">UserId</span> <span style="color: #000080">-Row</span> <span style="color: #800080">0</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #000080">-Text</span> <span style="color: #8a2be2">finked</span>            

        <span style="color: #0000ff">Button</span> <span style="color: #8a2be2">_Go</span> <span style="color: #000080">-Row</span> <span style="color: #800080">0</span> <span style="color: #000080">-Column</span> <span style="color: #800080">1</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #000080">-On_Click</span> <span style="color: #000000">{</span>            

            <span style="color: #00008b">foreach</span><span style="color: #000000">(</span> <span style="color: #ff4500">$record</span> <span style="color: #00008b">in</span> <span style="color: #000000">(</span><span style="color: #0000ff">net</span> <span style="color: #8a2be2">user</span> <span style="color: #ff4500">$UserId</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Text</span><span style="color: #000000">)</span> <span style="color: #000000">)</span> <span style="color: #000000">{</span>
                <span style="color: #ff4500">$result</span><span style="color: #a9a9a9">.</span><span style="color: #000000">appendText</span><span style="color: #000000">(</span><span style="color: #8b0000">&quot;$record `r`n&quot;</span><span style="color: #000000">)</span>
            <span style="color: #000000">}</span>
        <span style="color: #000000">}</span>            

        <span style="color: #0000ff">TextBox</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">Result</span> <span style="color: #000000">`
</span>            <span style="color: #000080">-Row</span> <span style="color: #800080">1</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span> <span style="color: #000080">-ColumnSpan</span> <span style="color: #800080">2</span> <span style="color: #000000">`
</span>            <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #000080">-IsReadOnly</span> <span style="color: #000000">`
</span>            <span style="color: #000080">-FontFamily</span> <span style="color: #8b0000">&quot;Courier New&quot;</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span></pre>
<h3>Related</h3>
<ul>
<li>My&#160; MSDN article: <a href="http://msdn.microsoft.com/en-us/magazine/hh288074.aspx">Secrets to Building a WPF Application in Windows PowerShell</a> </li>
<li>Post: <a href="http://www.dougfinke.com/blog/index.php/2011/06/26/powershell-showui-and-the-twitter-api/">PowerShell, ShowUI and the Twitter API</a> and video tutorial </li>
</ul>
<p align="center"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="245" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=25626751&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed type="application/x-shockwave-flash" width="400" height="245" src="http://vimeo.com/moogaloop.swf?clip_id=25626751&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<ul>
<li>More videos on the <a href="http://showui.codeplex.com/documentation">ShowUI CodePlex page</a> </li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F18%2Fpowershell-net-user-showui-gui%2F&amp;title=PowerShell%20%26lsquo%3BNet%20User%26rsquo%3B%20ShowUI%20GUI"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/QlYhz3oJdRE" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/QlYhz3oJdRE/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Value Per Line of Code is Amazing</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/4SMkGFjmqXY/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/4SMkGFjmqXY/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 13:27:58 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/17/the-value-per-line-of-code-is-amazing/</guid>
		<description><![CDATA[Learn how Wednesday July 20th I’ll be joining fellow ShowUI authors James Brundage and Joel “Jaykul” Bennett on the PowerScripting Podcast. ShowUI is a PowerShell module to help build WPF user interfaces in script. ShowUI makes the complicated world of WPF easy to use in PowerShell. You can use ShowUI to write simple WPF gadgets, [...]]]></description>
			<content:encoded><![CDATA[<h3>Learn how</h3>
<p>Wednesday July 20th I’ll be joining fellow <a href="http://showui.codeplex.com/">ShowUI</a> authors <a href="http://start-automating.com/">James Brundage</a> and <a href="http://huddledmasses.org/">Joel “Jaykul” Bennett</a> on the <a href="http://powerscripting.wordpress.com/">PowerScripting Podcast</a>.</p>
<p>ShowUI is a PowerShell module to help build WPF user interfaces in script. ShowUI makes the complicated world of WPF easy to use in PowerShell. You can use ShowUI to write simple WPF gadgets, quick front ends for your scripts, components, and full applications.</p>
<h3>Related </h3>
<ul>
<li>
<p>My&#160; MSDN article: <a href="http://msdn.microsoft.com/en-us/magazine/hh288074.aspx">Secrets to Building a WPF Application in Windows PowerShell</a></p>
</li>
<li>
<p>Post: <a href="http://www.dougfinke.com/blog/index.php/2011/06/26/powershell-showui-and-the-twitter-api/">PowerShell, ShowUI and the Twitter API</a> and video tutorial</p>
</li>
</ul>
<p> <object width="400" height="245"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=25626751&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=25626751&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="245"></embed></object></p>
<p>&#160;</p>
<ul>
<li>More videos on the <a href="http://showui.codeplex.com/documentation">ShowUI CodePlex page</a> </li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F17%2Fthe-value-per-line-of-code-is-amazing%2F&amp;title=The%20Value%20Per%20Line%20of%20Code%20is%20Amazing"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/4SMkGFjmqXY" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/4SMkGFjmqXY/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Launch a Node.js Web Server from PowerShell in Windows</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/qV1UftzYDEc/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/qV1UftzYDEc/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 00:27:52 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/15/launch-a-node-js-web-server-from-powershell-in-windows/</guid>
		<description><![CDATA[Node.js V0.5.1 released a Windows binary. Download the Windows Build. PowerShell Here is an example of a web server written in Node which responds with &#034;Hello World&#034; for every request. This is a single PowerShell script that saves the JavaScript to a file, launches node and then uses the .NET framework Net.WebClient to make a [...]]]></description>
			<content:encoded><![CDATA[<p>Node.js V0.5.1 released a Windows binary. Download the <a href="http://blog.nodejs.org/2011/07/14/node-v0-5-1/">Windows Build</a>.</p>
<h3>PowerShell</h3>
<p>Here is an example of a web server written in Node which responds with &quot;Hello World&quot; for every request. </p>
<p>This is a single PowerShell script that saves the JavaScript to a file, launches node and then uses the .NET framework Net.WebClient to make a request.</p>
<pre style="width: 583px; height: 350px" class="PowerShellColorizedScript"><span style="color: #ff4500">$ip</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;127.0.0.1&quot;</span>
<span style="color: #ff4500">$port</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">337</span>
<span style="color: #ff4500">$url</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;http://{0}:{1}/&quot;</span> <span style="color: #a9a9a9">-f</span> <span style="color: #ff4500">$ip</span><span style="color: #a9a9a9">,</span> <span style="color: #ff4500">$port</span>            

<span style="color: #8b0000">@&quot;
var http = require('http');
http.createServer(function (req, res) {
	res.writeHead(200, {'Content-Type': 'text/plain'});
	res.end('Hello World\n');
}).listen($port, &quot;$ip&quot;);

console.log('Server running at ${url}');
&quot;@</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Set-Content</span> <span style="color: #000080">-Encoding</span> <span style="color: #8a2be2">ascii</span> <span style="color: #8a2be2">c:\example.js</span>            

<span style="color: #0000ff">Start-Process</span> <span style="color: #8a2be2">powershell</span> <span style="color: #000080">-ArgumentList</span> <span style="color: #8b0000">&quot;C:\node\node.exe c:\example.js&quot;</span>            

<span style="color: #0000ff">sleep</span> <span style="color: #800080">1</span>
<span style="color: #000000">(</span><span style="color: #0000ff">New-Object</span> <span style="color: #8a2be2">net.webclient</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">DownloadString</span><span style="color: #000000">(</span><span style="color: #ff4500">$url</span><span style="color: #000000">)</span></pre>
<h3>Result</h3>
<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image5.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image_thumb5.png" width="607" height="439" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F15%2Flaunch-a-node-js-web-server-from-powershell-in-windows%2F&amp;title=Launch%20a%20Node.js%20Web%20Server%20from%20PowerShell%20in%20Windows"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/qV1UftzYDEc" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/qV1UftzYDEc/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Out-GridView–A cmdlet with benefits</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/khjFfYvvVfI/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/khjFfYvvVfI/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 14:00:00 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Reactive Framework]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/15/powershell-out-gridviewa-cmdlet-with-benefits/</guid>
		<description><![CDATA[A question I often get about PowerShell from ex-UNIX developers is whether or not PowerShell can “tail” files. Unfortunately, there is no direct analogy to the tail command in PowerShell. It’s typically used to watch the contents of a log file live as it is added to, and that is certainly something that PowerShell can [...]]]></description>
			<content:encoded><![CDATA[<p>A question I often get about PowerShell from ex-UNIX developers is whether or not PowerShell can “tail” files. Unfortunately, there is no direct analogy to the tail command in PowerShell. It’s typically used to watch the contents of a log file live as it is added to, and <i>that</i> is certainly something that PowerShell can do.</p>
<p>This question comes from a developer who is using NLog to log messages from his app involving <a href="http://msdn.microsoft.com/en-us/data/gg577609">Reactive Framework</a> code.</p>
<h3>Get-Content –Wait C:\Test.txt</h3>
<p>Get-Content is a PowerShell cmdlet (aliased to <em>type </em>(for DOS people) and <em>cat</em> (for Unix people)). It gets the content of the item at the location specified by the path, such as the text in a file. <a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image3.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 16px 0px 0px 13px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image_thumb3.png" width="240" height="112" /></a>It reads the content one line at a time and returns a collection of objects, each of which represents a line of content.</p>
<p>The –<em>Wait </em>parameter waits for content to be appended to the file. If content is appended, it returns the appended content.</p>
<h3>Out-GridView</h3>
<p>You can pipe the results of PowerShell to a grid view window where the output is displayed in an interactive table. Out-GridView is available out of the box.</p>
<h4>Features of Out-GridView</h4>
<ul>
<li>Hide, Show, and Reorder Columns</li>
<li>Sort</li>
<li>Quick Filter</li>
<li>Criteria Filter</li>
<li>Copy and paste</li>
</ul>
<h3>How To</h3>
<p><em>Get-Content –Wait c:\test.txt | Out-GridView</em>. As the data is updated from the background task (see code below), another line is added to the table. You can even do a quick filter and as the lines are appended to the file, Out-GridView adds them applies the filter to the new information.</p>
<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image_thumb4.png" width="396" height="349" /></a></p>
<h3>Try It Out</h3>
<pre style="width: 509px; height: 273px" class="PowerShellColorizedScript"><span style="color: #0000ff">del</span> <span style="color: #8a2be2">C:\test.txt</span>            

<span style="color: #0000ff">Start-Job</span> <span style="color: #000080">-ScriptBlock</span> <span style="color: #000000">{</span>
    <span style="color: #8b0000">&quot;Time,Message&quot;</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Add-Content</span> <span style="color: #8a2be2">c:\test.txt</span>
    <span style="color: #00008b">while</span><span style="color: #000000">(</span><span style="color: #ff4500">$true</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
        <span style="color: #8b0000">&quot;Testa&quot;</span><span style="color: #a9a9a9">,</span> <span style="color: #8b0000">&quot;Testb&quot;</span><span style="color: #a9a9a9">,</span><span style="color: #8b0000">&quot;Testc&quot;</span><span style="color: #a9a9a9">,</span><span style="color: #8b0000">&quot;Testd&quot;</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Get-Random</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">%</span> <span style="color: #000000">{</span>
            <span style="color: #8b0000">&quot;{0},{1}&quot;</span> <span style="color: #a9a9a9">-f</span> <span style="color: #000000">(</span><span style="color: #0000ff">Get-Date</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ToString</span><span style="color: #000000">(</span><span style="color: #000000">)</span><span style="color: #a9a9a9">,</span> <span style="color: #ff4500">$_</span>
        <span style="color: #000000">}</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Add-Content</span> <span style="color: #8a2be2">c:\test.txt</span>
        <span style="color: #0000ff">Start-Sleep</span> <span style="color: #000080">-Milliseconds</span> <span style="color: #800080">1500</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span>            

<span style="color: #0000ff">sleep</span> <span style="color: #800080">2</span>
<span style="color: #0000ff">Get-Content</span> <span style="color: #8a2be2">c:\test.txt</span> <span style="color: #000080">-wait</span> <span style="color: #a9a9a9">|</span>  <span style="color: #0000ff">ConvertFrom-Csv</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Out-GridView</span></pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F15%2Fpowershell-out-gridviewa-cmdlet-with-benefits%2F&amp;title=PowerShell%20Out-GridView%26ndash%3BA%20cmdlet%20with%20benefits"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/khjFfYvvVfI" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/khjFfYvvVfI/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better PowerShell Splatting</title>
		<link>http://pelebyte.net/blog/2011/07/14/better-powershell-splatting/</link>
		<comments>http://pelebyte.net/blog/2011/07/14/better-powershell-splatting/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 18:19:26 +0000</pubDate>
		<dc:creator>Davin Tanabe</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://pelebyte.net/blog/?p=240</guid>
		<description><![CDATA[One of PowerShell&#8217;s more useful and differentiating features is its ability to splat command-line arguments. Normally, to invoke a command in PowerShell with arguments, you could do something like this: Get-Process -Name *Tomcat* -ComputerName somebox.around.here It may be useful to capture the arguments first, then invoke the command later: $myArgs = @&#123; Name = &#034;*Tomcat*&#034;; [...]]]></description>
			<content:encoded><![CDATA[<p>One of PowerShell&#8217;s more useful and differentiating features is its ability to <strong>splat</strong> command-line arguments. Normally, to invoke a command in PowerShell with arguments, you could do something like this:</p>
<div class="wp_syntax">
<div class="code">
<pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">Get-Process</span> <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: pink;">*</span>Tomcat<span style="color: pink;">*</span> <span style="color: #008080; font-style: italic;">-ComputerName</span> somebox.around.here</pre>
</div>
</div>
<p>It may be useful to capture the arguments first, then invoke the command later:</p>
<div class="wp_syntax">
<div class="code">
<pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$myArgs</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#123;</span> Name <span style="color: pink;">=</span> <span style="color: #800000;">&quot;*Tomcat*&quot;</span>; ComputerName <span style="color: pink;">=</span> <span style="color: #800000;">&quot;somebox.around.here&quot;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #008080; font-weight: bold;">Get-Process</span> <span style="color: pink;">@</span>myArgs</pre>
</div>
</div>
<p>It can also be incredibly useful if you&#8217;re writing wrapper functions:</p>
<div class="wp_syntax">
<div class="code">
<pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">Function</span> Import<span style="color: pink;">-</span>ModuleForce <span style="color: #000000;">&#123;</span>
    <span style="color: #0000FF;">param</span><span style="color: #000000;">&#40;</span>
        <span style="color: #000000;">&#91;</span>Parameter<span style="color: #000000;">&#40;</span>Mandatory <span style="color: pink;">=</span> <span style="color: #800080;">$true</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #800080;">$Name</span>
    <span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #800080;">$PSBoundParameters</span>.Force <span style="color: pink;">=</span> <span style="color: #800080;">$true</span>
    Import<span style="color: pink;">-</span>Module <span style="color: pink;">@</span>PSBoundParameters
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;"># unfortunately, aliases can't be set up to script blocks;</span>
<span style="color: #008000;"># only functions and cmdlets get that honor</span>
<span style="color: #008080; font-weight: bold;">Set-Alias</span> imf Import<span style="color: pink;">-</span>ModuleForce</pre>
</div>
</div>
<p>It can also be useful when you&#8217;re passing in the same arguments to multiple functions consecutively:</p>
<div class="wp_syntax">
<div class="code">
<pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$myArgs</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#123;</span>
    Name <span style="color: pink;">=</span> <span style="color: #800000;">&quot;*Tomcat*&quot;</span>
    ComputerName <span style="color: pink;">=</span> <span style="color: #800000;">&quot;somebox.around.here&quot;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008080; font-weight: bold;">Get-Service</span> <span style="color: pink;">@</span>myArgs
<span style="color: #008080; font-weight: bold;">Get-Process</span> <span style="color: pink;">@</span>myArgs</pre>
</div>
</div>
<p>But sometimes splatting doesn&#8217;t work, notably when you have extra values in the hashtable that the function isn&#8217;t expecting:</p>
<div class="wp_syntax">
<div class="code">
<pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$myArgs</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#123;</span>
    Name <span style="color: pink;">=</span> <span style="color: #800000;">&quot;*Tomcat*&quot;</span>
    ComputerName <span style="color: pink;">=</span> <span style="color: #800000;">&quot;somebox.around.here&quot;</span>
    DependentServices <span style="color: pink;">=</span> <span style="color: #800080;">$true</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008080; font-weight: bold;">Get-Service</span> <span style="color: pink;">@</span>myArgs
<span style="color: #008080; font-weight: bold;">Get-Process</span> <span style="color: pink;">@</span>myArgs</pre>
</div>
</div>
<p>A nasty little error is PowerShell&#8217;s response:</p>
<div class="wp_syntax">
<div class="code">
<pre class="text" style="font-family:monospace;">Get-Process : A parameter cannot be found that matches parameter name 'DependentServices'.
+ Get-Process &lt;&lt;&lt;&lt;  @myArgs
    + CategoryInfo          : InvalidArgument: (:) [Get-Process], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand</pre>
</div>
</div>
<p>The <span class="monospace">Get-Service</span> cmdlet has a DependentServices argument, but <span class="monospace">Get-Process</span> does not. Although this can <em>sometimes</em> be a helpful error message, in this case, it would be nice if the command just ignored the arguments it couldn&#8217;t understand.</p>
<p>So that&#8217;s why I wrote <span class="monospace">Invoke-Splat</span>:</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre>
</td>
<td class="code">
<pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">Function</span> Invoke<span style="color: pink;">-</span>Splat <span style="color: #000000;">&#123;</span>
    <span style="color: #008000;">&lt;#
    .Synopsis
        Splats a hashtable on a function in a safer way than the built-in
        mechanism.
    .Example
        Invoke-Splat Get-XYZ $PSBoundParameters
    #&gt;</span>
    <span style="color: #0000FF;">param</span><span style="color: #000000;">&#40;</span>
        <span style="color: #000000;">&#91;</span>Parameter<span style="color: #000000;">&#40;</span>ValueFromPipeline<span style="color: pink;">=</span><span style="color: #800080;">$true</span><span style="color: pink;">,</span> Mandatory<span style="color: pink;">=</span><span style="color: #800080;">$true</span><span style="color: pink;">,</span> Position<span style="color: pink;">=</span><span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span>
        <span style="color: #800080;">$FunctionName</span><span style="color: pink;">,</span>
        <span style="color: #000000;">&#91;</span>Parameter<span style="color: #000000;">&#40;</span>ValueFromPipeline<span style="color: pink;">=</span><span style="color: #800080;">$true</span><span style="color: pink;">,</span> Mandatory<span style="color: pink;">=</span><span style="color: #800080;">$true</span><span style="color: pink;">,</span> Position<span style="color: pink;">=</span><span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #000000;">&#91;</span>System.Collections.Hashtable<span style="color: #000000;">&#93;</span>
        <span style="color: #800080;">$Parameters</span>
    <span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #800080;">$h</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span>
    <span style="color: #0000FF;">ForEach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$key</span> <span style="color: #0000FF;">in</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">gcm</span> <span style="color: #800080;">$FunctionName</span><span style="color: #000000;">&#41;</span>.Parameters.Keys<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$Parameters</span>.<span style="color: #800080;">$key</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #800080;">$h</span>.<span style="color: #800080;">$key</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Parameters</span>.<span style="color: #800080;">$key</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$h</span>.Count <span style="color: #FF0000;">-eq</span> <span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #800080;">$FunctionName</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Invoke-Expression</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #0000FF;">else</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #800000;">&quot;$FunctionName @h&quot;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Invoke-Expression</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
</td>
</tr>
</table>
</div>
<p>Rewriting the example from above:</p>
<div class="wp_syntax">
<div class="code">
<pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$myArgs</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#123;</span>
    Name <span style="color: pink;">=</span> <span style="color: #800000;">&quot;*Tomcat*&quot;</span>
    ComputerName <span style="color: pink;">=</span> <span style="color: #800000;">&quot;somebox.around.here&quot;</span>
    DependentServices <span style="color: pink;">=</span> <span style="color: #800080;">$true</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
Invoke<span style="color: pink;">-</span>Splat <span style="color: #008080; font-weight: bold;">Get-Service</span> <span style="color: #800080;">$myArgs</span>
Invoke<span style="color: pink;">-</span>Splat <span style="color: #008080; font-weight: bold;">Get-Process</span> $myArgs</pre>
</div>
</div>
<p>And mixing Invoke-Splat with the @ operator:</p>
<div class="wp_syntax">
<div class="code">
<pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">Function</span> Import<span style="color: pink;">-</span>ModuleForce <span style="color: #000000;">&#123;</span>
    <span style="color: #0000FF;">param</span><span style="color: #000000;">&#40;</span>
        <span style="color: #000000;">&#91;</span>Parameter<span style="color: #000000;">&#40;</span>Mandatory <span style="color: pink;">=</span> <span style="color: #800080;">$true</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #800080;">$Name</span><span style="color: pink;">,</span>
&nbsp;
        <span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span>
        <span style="color: #800080;">$SomethingElse</span>
    <span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #800080;">$PSBoundParameters</span>.Force <span style="color: pink;">=</span> <span style="color: #800080;">$true</span>
    Invoke<span style="color: pink;">-</span>Splat Import<span style="color: pink;">-</span>Module <span style="color: #800080;">$PSBoundParameters</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #800080;">$myArgs</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#123;</span>
    Name <span style="color: pink;">=</span> <span style="color: #800000;">&quot;MyModule&quot;</span>
    SomethingElse <span style="color: pink;">=</span> <span style="color: #800000;">&quot;AnotherString&quot;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
Import<span style="color: pink;">-</span>ModuleForce <span style="color: pink;">@</span>myArgs</pre>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://pelebyte.net/blog/2011/07/14/better-powershell-splatting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated, Hippy Dippy PowerShell Clock with ShowUI</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/3RsZltGpf4U/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/3RsZltGpf4U/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 01:02:56 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/13/updated-hippy-dippy-powershell-clock-with-showui/</guid>
		<description><![CDATA[I posted PowerShell Clock with ShowUI. Ravi, another PowerShell MVP, tried the sample using the AsJob parameter. The AsJob will run the PowerShell WPF GUI in the background. Unfortunately, the FontSize and other parameters would not set correctly and the clocked was not readable. After emailing James Brundage, a fellow ShowUI author , he blogged [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image_thumb2.png" width="442" height="95" /></a></p>
<p>I posted <a href="http://www.dougfinke.com/blog/index.php/2011/07/07/powershell-clock-with-showui/">PowerShell Clock with ShowUI</a>. <a href="http://www.ravichaganti.com/blog/">Ravi</a>, another PowerShell MVP, tried the sample using the AsJob parameter. The AsJob will run the PowerShell WPF GUI in the background. Unfortunately, the FontSize and other parameters would not set correctly and the clocked was not readable.</p>
<p>After emailing <a href="http://www.start-automating.com/">James Brundage</a>, a fellow <a href="http://showui.codeplex.com/">ShowUI</a> author , he blogged <a href="http://blog.start-automating.com/post/2011/07/12/Six-Steps-for-Writing-ShowUI-Controls.aspx">Six Steps for Writing ShowUI Controls</a> and a video tutorial based on this clock example. </p>
<p>Definitely check it out, he kicks it up a notch with data context’s, PowerShell DataSources. splatting, adding event handlers and more.</p>
<h3>Here is my updated clock code</h3>
<p>Run it with either –Show or –AsJob</p>
<pre style="width: 304px; height: 47px" class="PowerShellColorizedScript"><span style="color: #0000ff">HippyDippy-Clock</span> <span style="color: #000080">-Show</span>
<span style="color: #0000ff">HippyDippy-Clock</span> <span style="color: #000080">-AsJob</span></pre>
<pre style="width: 579px; height: 1404px" class="PowerShellColorizedScript"><span style="color: #00008b">function</span> <span style="color: #8a2be2">HippyDippy-Clock</span> <span style="color: #000000">{</span>
    <span style="color: #00008b">param</span> <span style="color: #000000">(</span>
        <span style="color: #008080">[string]</span><span style="color: #ff4500">$Name</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Int]</span><span style="color: #ff4500">$Row</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Int]</span><span style="color: #ff4500">$Column</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Int]</span><span style="color: #ff4500">$RowSpan</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Int]</span><span style="color: #ff4500">$ColumnSpan</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Int]</span><span style="color: #ff4500">$Width</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Int]</span><span style="color: #ff4500">$Height</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Double]</span><span style="color: #ff4500">$Top</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Double]</span><span style="color: #ff4500">$Left</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Windows.Controls.Dock]</span><span style="color: #ff4500">$Dock</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Switch]</span><span style="color: #ff4500">$Show</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Switch]</span><span style="color: #ff4500">$AsJob</span>
    <span style="color: #000000">)</span>            

    <span style="color: #00008b">begin</span> <span style="color: #000000">{</span><span style="color: #0000ff">ipmo</span> <span style="color: #8a2be2">showui</span><span style="color: #000000">}</span>
    <span style="color: #00008b">process</span> <span style="color: #000000">{</span>
        <span style="color: #00008b">if</span> <span style="color: #000000">(</span><span style="color: #a9a9a9">-not</span> <span style="color: #ff4500">$psBoundParameters</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Background</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
            <span style="color: #ff4500">$psBoundParameters</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Background</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">'Transparent'</span>
        <span style="color: #000000">}</span>                        

        <span style="color: #ff4500">$uiParameters</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span><span style="color: #000000">}</span> <span style="color: #a9a9a9">+</span> <span style="color: #ff4500">$psBoundParameters</span>            

        <span style="color: #0000ff">Border</span> <span style="color: #ff4500">@uiParameters</span> <span style="color: #000080">-On_Loaded</span> <span style="color: #000000">{</span>
            <span style="color: #ff4500">$this</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Child</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">Grid</span> <span style="color: #000080">-Columns</span> <span style="color: #800080">150</span><span style="color: #a9a9a9">,</span> <span style="color: #8a2be2">300*</span> <span style="color: #000000">{</span>
                <span style="color: #0000ff">Image</span> <span style="color: #000080">-Source</span> <span style="color: #8b0000">&quot;http://weaselzippers.us/wp-content/uploads/2011/05/hippie.jpg&quot;</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span>
                <span style="color: #0000ff">Label</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">Target</span> <span style="color: #000080">-FontSize</span> <span style="color: #800080">90</span> <span style="color: #000080">-Column</span> <span style="color: #800080">1</span> <span style="color: #000000">`
</span>                    <span style="color: #000080">-FontFamily</span> <span style="color: #8b0000">&quot;Impact, Arial&quot;</span> <span style="color: #000080">-FontWeight</span> <span style="color: #800080">800</span> <span style="color: #000080">-Foreground</span> <span style="color: #000000">(</span>
                    <span style="color: #0000ff">LinearGradientBrush</span> <span style="color: #000000">$(</span>
                        <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Red</span>    <span style="color: #000080">-Offset</span> <span style="color: #800080">1</span>
                        <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Orange</span> <span style="color: #000080">-Offset</span> <span style="color: #800080">0.85</span>
                        <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Yellow</span> <span style="color: #000080">-Offset</span> <span style="color: #800080">0.7</span>
                        <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Green</span>  <span style="color: #000080">-Offset</span> <span style="color: #800080">0.55</span>
                        <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Blue</span>   <span style="color: #000080">-Offset</span> <span style="color: #800080">0.4</span>
                        <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Indigo</span> <span style="color: #000080">-Offset</span> <span style="color: #800080">0.2</span>
                        <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Violet</span> <span style="color: #000080">-Offset</span> <span style="color: #800080">0</span>
                    <span style="color: #000000">)</span>
                <span style="color: #000000">)</span>
            <span style="color: #000000">}</span>            

            <span style="color: #ff4500">$this</span><span style="color: #a9a9a9">.</span><span style="color: #000000">DataContext</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">Get-PowerShellDataSource</span> <span style="color: #000080">-On_OutputChanged</span> <span style="color: #000000">{</span>
                <span style="color: #ff4500">$output</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">Get-PowerShellOutput</span> <span style="color: #000080">-Last</span> <span style="color: #000080">-OutputOnly</span>
                <span style="color: #ff4500">$Target</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Content</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$output</span>
            <span style="color: #000000">}</span> <span style="color: #000080">-Script</span> <span style="color: #000000">{</span>
                <span style="color: #00008b">while</span> <span style="color: #000000">(</span><span style="color: #ff4500">$true</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
                    <span style="color: #000000">(</span><span style="color: #0000ff">Get-Date</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ToString</span><span style="color: #000000">(</span><span style="color: #8b0000">'T'</span><span style="color: #000000">)</span><span style="color: #000000">;</span> <span style="color: #0000ff">Start-Sleep</span> <span style="color: #000080">-Seconds</span> <span style="color: #800080">1</span>
    <span style="color: #000000">}</span>
            <span style="color: #000000">}</span>                

        <span style="color: #000000">}</span> <span style="color: #000080">-On_Initialized</span> <span style="color: #000000">{</span>
            <span style="color: #ff4500">$window</span><span style="color: #a9a9a9">.</span><span style="color: #000000">SizeToContent</span>         <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">'WidthAndHeight'</span>
            <span style="color: #ff4500">$window</span><span style="color: #a9a9a9">.</span><span style="color: #000000">WindowStyle</span>           <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">'None'</span>
            <span style="color: #ff4500">$window</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Background</span>            <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">'Transparent'</span>
            <span style="color: #ff4500">$window</span><span style="color: #a9a9a9">.</span><span style="color: #000000">AllowsTransparency</span>    <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$true</span>
            <span style="color: #ff4500">$window</span><span style="color: #a9a9a9">.</span><span style="color: #000000">WindowStartupLocation</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">'CenterScreen'</span>            

            <span style="color: #0000ff">Add-EventHandler</span> <span style="color: #000080">-EventName</span> <span style="color: #8b0000">&quot;On_Closing&quot;</span> <span style="color: #000080">-Handler</span> <span style="color: #000000">{</span>
                <span style="color: #00008b">if</span> <span style="color: #000000">(</span><span style="color: #ff4500">$this</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Content</span><span style="color: #a9a9a9">.</span><span style="color: #000000">DataContext</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Command</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Stop</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
                        <span style="color: #ff4500">$this</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Content</span><span style="color: #a9a9a9">.</span><span style="color: #000000">DataContext</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Command</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Stop</span><span style="color: #000000">(</span><span style="color: #000000">)</span>
                    <span style="color: #000000">}</span>
                <span style="color: #000000">}</span> <span style="color: #000080">-Object</span> <span style="color: #ff4500">$window</span>                                    

                <span style="color: #006400"># When the right mouse button is down, close the control            </span>
                <span style="color: #0000ff">Add-EventHandler</span> <span style="color: #000080">-EventName</span> <span style="color: #8b0000">&quot;On_PreviewMouseRightButtonDown&quot;</span> <span style="color: #000080">-Handler</span> <span style="color: #000000">{</span>
                    <span style="color: #ff4500">$_</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Handled</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$true</span>
                    <span style="color: #0000ff">Close-Control</span>
                <span style="color: #000000">}</span> <span style="color: #000080">-Object</span> <span style="color: #ff4500">$window</span>            

                <span style="color: #0000ff">Add-EventHandler</span> <span style="color: #000080">-EventName</span> <span style="color: #8b0000">&quot;On_PreviewMouseLeftButtonDown&quot;</span> <span style="color: #000080">-Handler</span> <span style="color: #000000">{</span>
                    <span style="color: #ff4500">$_</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Handled</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$true</span>
                    <span style="color: #ff4500">$this</span><span style="color: #a9a9a9">.</span><span style="color: #000000">DragMove</span><span style="color: #000000">(</span><span style="color: #000000">)</span>
                <span style="color: #000000">}</span> <span style="color: #000080">-Object</span> <span style="color: #ff4500">$window</span>
        <span style="color: #000000">}</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span></pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F13%2Fupdated-hippy-dippy-powershell-clock-with-showui%2F&amp;title=Updated%2C%20Hippy%20Dippy%20PowerShell%20Clock%20with%20ShowUI"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/3RsZltGpf4U" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/3RsZltGpf4U/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell, ShowUI and the Twitter API–Part 2</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/3zQyemirSh0/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/3zQyemirSh0/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 15:24:39 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/09/powershell-showui-and-the-twitter-apipart-2/</guid>
		<description><![CDATA[Part 2 builds on the first 30 lines from PowerShell, ShowUI and the Twitter API–Part 1 (Check out the video tutorial for building it) and positions the script for the next set of steps. More updates coming soon. Updates This version lets you view multiple Twitter search feeds. Type in a search and press enter [...]]]></description>
			<content:encoded><![CDATA[<p>Part 2 builds on the first 30 lines from <a href="http://www.dougfinke.com/blog/index.php/2011/06/26/powershell-showui-and-the-twitter-api/">PowerShell, ShowUI and the Twitter API–Part 1</a> (Check out the <a href="http://vimeo.com/25626751">video tutorial</a> for building it) and positions the script for the next set of steps. </p>
<p>More updates coming soon. </p>
<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image_thumb1.png" width="614" height="309" /></a></p>
<h3>Updates</h3>
<p>This version lets you view multiple Twitter search feeds. Type in a search and press enter and another column is displayed. You can delete a column too.</p>
<h3>PowerShell Code</h3>
<p>Download it <a href="https://github.com/dfinke/powershell/blob/master/SearchTwitter/SearchTwitter.ps1">HERE</a> from my repository. Download <a href="http://showui.codeplex.com/">ShowUI</a>.</p>
<pre style="width: 585px; height: 1991px" class="PowerShellColorizedScript"><span style="color: #0000ff">Import-Module</span> <span style="color: #8a2be2">showui</span>            

<span style="color: #00008b">function</span> <span style="color: #8a2be2">Search-Twitter</span> <span style="color: #000000">{</span>
    <span style="color: #00008b">param</span> <span style="color: #000000">(</span>
        <span style="color: #a9a9a9">[</span><span style="color: #add8e6">Parameter</span><span style="color: #000000">(</span><span style="color: #000000">ValueFromPipeline</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #000000">)</span><span style="color: #a9a9a9">]</span>
        <span style="color: #ff4500">$query</span>
    <span style="color: #000000">)</span>            

    <span style="color: #00008b">Begin</span> <span style="color: #000000">{</span> <span style="color: #ff4500">$wc</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">New-Object</span> <span style="color: #8a2be2">Net.Webclient</span> <span style="color: #000000">}</span>            

    <span style="color: #00008b">Process</span> <span style="color: #000000">{</span>
        <span style="color: #ff4500">$url</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;http://search.twitter.com/search.rss?q=$query&quot;</span>
        <span style="color: #000000">(</span><span style="color: #008080">[xml]</span><span style="color: #ff4500">$wc</span><span style="color: #a9a9a9">.</span><span style="color: #000000">downloadstring</span><span style="color: #000000">(</span><span style="color: #ff4500">$url</span><span style="color: #000000">)</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">rss</span><span style="color: #a9a9a9">.</span><span style="color: #000000">channel</span><span style="color: #a9a9a9">.</span><span style="color: #000000">item</span> <span style="color: #a9a9a9">|</span>
            <span style="color: #0000ff">Select</span> <span style="color: #8a2be2">*</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span>            

<span style="color: #00008b">function</span> <span style="color: #8a2be2">New-TwitterFeed</span> <span style="color: #000000">(</span><span style="color: #ff4500">$search</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>            

    <span style="color: #ff4500">$guid</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;g&quot;</span> <span style="color: #a9a9a9">+</span> <span style="color: #008080">[guid]</span><span style="color: #a9a9a9">::</span><span style="color: #000000">NewGuid</span><span style="color: #000000">(</span><span style="color: #000000">)</span> <span style="color: #a9a9a9">-replace</span> <span style="color: #8b0000">&quot;-&quot;</span><span style="color: #a9a9a9">,</span><span style="color: #8b0000">&quot;&quot;</span>            

    <span style="color: #ff4500">$buttonAttributes</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
        <span style="color: #000000">Margin</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">5</span>
        <span style="color: #000000">HorizontalAlignment</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;Right&quot;</span>
        <span style="color: #000000">Height</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">25</span>
        <span style="color: #000000">Tag</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$guid</span>
    <span style="color: #000000">}</span>            

    <span style="color: #ff4500">$labelAttributes</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
        <span style="color: #000000">FontSize</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">20</span>
        <span style="color: #000000">Margin</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">5</span>
        <span style="color: #000000">Foreground</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;White&quot;</span>
    <span style="color: #000000">}</span>            

    <span style="color: #0000ff">Grid</span> <span style="color: #000080">-Name</span> <span style="color: #ff4500">$guid</span> <span style="color: #000080">-Rows</span> <span style="color: #800080">45</span><span style="color: #a9a9a9">,</span> <span style="color: #8a2be2">100*</span> <span style="color: #000080">-Tag</span> <span style="color: #ff4500">$search</span> <span style="color: #000000">{</span>
        <span style="color: #0000ff">Grid</span> <span style="color: #000080">-Row</span> <span style="color: #800080">0</span> <span style="color: #000080">-Columns</span> <span style="color: #800080">2</span> <span style="color: #000000">{</span>
            <span style="color: #0000ff">Label</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span> <span style="color: #ff4500">$Search</span> <span style="color: #ff4500">@labelAttributes</span>
            <span style="color: #0000ff">Button</span> <span style="color: #8b0000">&quot; X &quot;</span> <span style="color: #000080">-Column</span> <span style="color: #800080">1</span> <span style="color: #ff4500">@buttonAttributes</span> <span style="color: #000080">-On_Click</span> <span style="color: #000000">{</span>
                <span style="color: #ff4500">$name</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;`$$($this.tag)&quot;</span>
                <span style="color: #ff4500">$targetLayout</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Children</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Remove</span><span style="color: #000000">(</span><span style="color: #000000">(</span><span style="color: #ff4500">$name</span><span style="color: #a9a9a9">|</span><span style="color: #0000ff">iex</span><span style="color: #000000">)</span><span style="color: #000000">)</span>
            <span style="color: #000000">}</span>
        <span style="color: #000000">}</span>            

        <span style="color: #0000ff">ListBox</span> <span style="color: #000080">-Background</span> <span style="color: #8a2be2">Black</span> <span style="color: #000080">-Row</span> <span style="color: #800080">1</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #000080">-DataContext</span> <span style="color: #000000">{</span>
            <span style="color: #0000ff">Search-Twitter</span> <span style="color: #ff4500">$search</span>
        <span style="color: #000000">}</span> <span style="color: #000080">-DataBinding</span> <span style="color: #000000">@{</span>
            <span style="color: #000000">ItemsSource</span><span style="color: #a9a9a9">=</span><span style="color: #8b0000">&quot;.&quot;</span>
        <span style="color: #000000">}</span> <span style="color: #000080">-ItemTemplate</span> <span style="color: #000000">{</span>
            <span style="color: #ff4500">$tweetTbAttributes</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
                <span style="color: #000000">FontSize</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">12</span>
                <span style="color: #000000">Margin</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">5</span>
                <span style="color: #000000">TextWrapping</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;wrap&quot;</span>
                <span style="color: #000000">Foreground</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;White&quot;</span>
            <span style="color: #000000">}</span>            

            <span style="color: #0000ff">Grid</span> <span style="color: #000080">-Columns</span> <span style="color: #800080">55</span><span style="color: #a9a9a9">,</span> <span style="color: #800080">300</span> <span style="color: #000000">{</span>
                <span style="color: #0000ff">Image</span>     <span style="color: #000080">-Name</span> <span style="color: #8a2be2">Image</span>  <span style="color: #000080">-Column</span> <span style="color: #800080">0</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">6</span>
                <span style="color: #0000ff">TextBlock</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">Title</span> <span style="color: #ff4500">@tweetTbAttributes</span> <span style="color: #000080">-Column</span> <span style="color: #800080">1</span>
            <span style="color: #000000">}</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">ConvertTo-DataTemplate</span> <span style="color: #000080">-binding</span> <span style="color: #000000">@{</span>
                <span style="color: #8b0000">&quot;Image.Source&quot;</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;image_link&quot;</span>
                <span style="color: #8b0000">&quot;Title.Text&quot;</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;title&quot;</span>
            <span style="color: #000000">}</span>
        <span style="color: #000000">}</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span>            

<span style="color: #00008b">function</span> <span style="color: #8a2be2">ql</span> <span style="color: #000000">{</span><span style="color: #ff4500">$args</span><span style="color: #000000">}</span>            

<span style="color: #ff4500">$windowAttributes</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
    <span style="color: #000000">WindowStartupLocation</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;CenterScreen&quot;</span>
    <span style="color: #000000">Width</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">1200</span>
    <span style="color: #000000">Height</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">600</span>
    <span style="color: #000000">Background</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;Black&quot;</span>
    <span style="color: #000000">Title</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;PowerShell, ShowUI and the Twitter API&quot;</span>
<span style="color: #000000">}</span>            

<span style="color: #ff4500">$scrollViewerAttributes</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
    <span style="color: #000000">VerticalScrollBarVisibility</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;Disabled&quot;</span>
    <span style="color: #000000">HorizontalScrollBarVisibility</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;Auto&quot;</span>
<span style="color: #000000">}</span>            

<span style="color: #ff4500">$textBboxAttributes</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
    <span style="color: #000000">Margin</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">5</span>
    <span style="color: #000000">Background</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;DarkGray &quot;</span>
    <span style="color: #000000">Foreground</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;#FFFFFF&quot;</span>
    <span style="color: #000000">FontSize</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">14</span>
<span style="color: #000000">}</span>            

<span style="color: #0000ff">New-Window</span> <span style="color: #ff4500">@windowAttributes</span> <span style="color: #000080">-Show</span> <span style="color: #000080">-On_Loaded</span> <span style="color: #000000">{</span>
    <span style="color: #ff4500">$search</span><span style="color: #a9a9a9">.</span><span style="color: #000000">focus</span><span style="color: #000000">(</span><span style="color: #000000">)</span>
    <span style="color: #0000ff">ql</span> <span style="color: #8a2be2">PowerShell</span> <span style="color: #8a2be2">ShowUI</span> <span style="color: #8a2be2">dfinke</span> <span style="color: #8a2be2">jamesbru</span>  <span style="color: #8a2be2">jaykul</span> <span style="color: #a9a9a9">|</span>
        <span style="color: #0000ff">ForEach</span> <span style="color: #000000">{</span>
            <span style="color: #ff4500">$targetLayout</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Children</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Add</span><span style="color: #000000">(</span> <span style="color: #000000">(</span><span style="color: #0000ff">New-TwitterFeed</span> <span style="color: #ff4500">$_</span> <span style="color: #ff4500">$tabcontrol</span><span style="color: #000000">)</span> <span style="color: #000000">)</span>
        <span style="color: #000000">}</span>
<span style="color: #000000">}</span> <span style="color: #000000">{</span>
    <span style="color: #0000ff">Grid</span> <span style="color: #000080">-Columns</span> <span style="color: #8a2be2">35*</span><span style="color: #a9a9a9">,</span> <span style="color: #800080">75</span> <span style="color: #000080">-Rows</span> <span style="color: #800080">35</span><span style="color: #a9a9a9">,</span> <span style="color: #8a2be2">100*</span> <span style="color: #000000">{</span>            

        <span style="color: #0000ff">TextBox</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">Search</span> <span style="color: #000080">-Row</span> <span style="color: #800080">0</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span> <span style="color: #ff4500">@textBboxAttributes</span>            

        <span style="color: #0000ff">Button</span> <span style="color: #000080">-IsDefault</span> <span style="color: #000080">-Row</span> <span style="color: #800080">0</span> <span style="color: #000080">-Column</span> <span style="color: #800080">1</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #8b0000">&quot;_Search&quot;</span> <span style="color: #000080">-On_Click</span> <span style="color: #000000">{</span>
            <span style="color: #ff4500">$targetLayout</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Children</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Add</span><span style="color: #000000">(</span> <span style="color: #000000">(</span><span style="color: #0000ff">New-TwitterFeed</span> <span style="color: #ff4500">$Search</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Text</span><span style="color: #000000">)</span> <span style="color: #000000">)</span>
            <span style="color: #ff4500">$Search</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Text</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;&quot;</span>
        <span style="color: #000000">}</span>            

        <span style="color: #0000ff">ScrollViewer</span> <span style="color: #000080">-Row</span> <span style="color: #800080">1</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span> <span style="color: #000080">-ColumnSpan</span> <span style="color: #800080">2</span> <span style="color: #ff4500">@scrollViewerAttributes</span> <span style="color: #000000">{</span>
            <span style="color: #0000ff">UniformGrid</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">targetLayout</span> <span style="color: #000080">-Rows</span> <span style="color: #800080">1</span>
        <span style="color: #000000">}</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span></pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F09%2Fpowershell-showui-and-the-twitter-apipart-2%2F&amp;title=PowerShell%2C%20ShowUI%20and%20the%20Twitter%20API%26ndash%3BPart%202"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/3zQyemirSh0" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/3zQyemirSh0/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Clock with ShowUI</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/x6D5mugjxWo/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/x6D5mugjxWo/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 01:26:42 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/07/powershell-clock-with-showui/</guid>
		<description><![CDATA[Richard Siddaway posted A PowerShell Clock using WPF and demonstrated some nice features. A windowless window Ticking digital clock Moving the window by clicking and dragging even though it doesn’t have a border The ShowUI Code Here is the ShowUI code. Note the On_* keys in the hash table. They handle the mouse button events [...]]]></description>
			<content:encoded><![CDATA[<p>Richard Siddaway posted <a href="http://msmvps.com/blogs/richardsiddaway/archive/2011/07/07/a-powershell-clock.aspx">A PowerShell Clock</a> using WPF and demonstrated some nice features.</p>
<ul>
<li>A windowless window</li>
<li>Ticking digital clock</li>
<li>Moving the window by clicking and dragging even though it doesn’t have a border</li>
</ul>
<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/07/image_thumb.png" width="240" height="67" /></a></p>
<h3>The ShowUI Code</h3>
<p>Here is the <a href="http://showui.codeplex.com/">ShowUI</a> code. Note the On_* keys in the hash table. They handle the mouse button events and the windows load event where I register a PowerShell script block that executes every half a second. This updates the time and enables the ticking digital clock.</p>
<p>Richard’s solution has the advantage that he can deploy it and it should work on any windows system that has the latest .NET runtime. </p>
<p>My solution requires the ShowUI module to be installed on the target machine.</p>
<p>The advantages to my solution, IMHO, are no XAML, increased value per line of code and it’s all PowerShell.</p>
<p>Check out both solutions and <a href="http://showui.codeplex.com/">ShowUI</a>.</p>
<pre style="width: 583px; height: 674px" class="PowerShellColorizedScript"><span style="color: #0000ff">Import-Module</span> <span style="color: #8a2be2">ShowUI</span>            

<span style="color: #ff4500">$windowAttributes</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
    <span style="color: #000000">WindowStartupLocation</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;CenterScreen&quot;</span>
    <span style="color: #000000">SizeToContent</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;WidthAndHeight&quot;</span>
    <span style="color: #000000">WindowStyle</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;None&quot;</span>
    <span style="color: #000000">Background</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;Transparent &quot;</span>            

    <span style="color: #000000">On_MouseRightButtonDown</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">{</span> <span style="color: #0000ff">Close-Control</span><span style="color: #000000">}</span>
    <span style="color: #000000">On_MouseLeftButtonDown</span>  <span style="color: #a9a9a9">=</span> <span style="color: #000000">{</span> <span style="color: #ff4500">$_</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Handled</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$true</span><span style="color: #000000">;</span><span style="color: #ff4500">$window</span><span style="color: #a9a9a9">.</span><span style="color: #000000">DragMove</span><span style="color: #000000">(</span><span style="color: #000000">)</span> <span style="color: #000000">}</span>
    <span style="color: #000000">On_Loaded</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">{</span>
        <span style="color: #0000ff">Register-PowerShellCommand</span> <span style="color: #000080">-ScriptBlock</span> <span style="color: #000000">{</span>
            <span style="color: #ff4500">$window</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Content</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Content</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">(</span><span style="color: #0000ff">Get-Date</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ToString</span><span style="color: #000000">(</span><span style="color: #8b0000">&quot;T&quot;</span><span style="color: #000000">)</span>
        <span style="color: #000000">}</span> <span style="color: #000080">-Run</span> <span style="color: #000080">-In</span> <span style="color: #8b0000">&quot;0:0:0.5&quot;</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span>            

<span style="color: #ff4500">$labelAttributes</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
    <span style="color: #000000">Content</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">(</span><span style="color: #0000ff">Get-Date</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ToString</span><span style="color: #000000">(</span><span style="color: #8b0000">&quot;T&quot;</span><span style="color: #000000">)</span>
    <span style="color: #000000">FontFamily</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;Impact, Arial&quot;</span>
    <span style="color: #000000">FontWeight</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">800</span>
    <span style="color: #000000">FontSize</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">90</span>
<span style="color: #000000">}</span>            

<span style="color: #0000ff">New-Window</span> <span style="color: #ff4500">@windowAttributes</span> <span style="color: #000080">-AllowsTransparency</span> <span style="color: #000080">-Show</span>  <span style="color: #000000">{</span>
    <span style="color: #0000ff">Label</span> <span style="color: #ff4500">@labelAttributes</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">Clock</span> <span style="color: #000080">-Foreground</span> <span style="color: #000000">(</span>
        <span style="color: #0000ff">LinearGradientBrush</span> <span style="color: #000000">$(</span>
            <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Red</span>    <span style="color: #000080">-Offset</span> <span style="color: #800080">1</span>
            <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Orange</span> <span style="color: #000080">-Offset</span> <span style="color: #800080">0.85</span>
            <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Yellow</span> <span style="color: #000080">-Offset</span> <span style="color: #800080">0.7</span>
            <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Green</span>  <span style="color: #000080">-Offset</span> <span style="color: #800080">0.55</span>
            <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Blue</span>   <span style="color: #000080">-Offset</span> <span style="color: #800080">0.4</span>
            <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Indigo</span> <span style="color: #000080">-Offset</span> <span style="color: #800080">0.2</span>
            <span style="color: #0000ff">GradientStop</span> <span style="color: #000080">-Color</span> <span style="color: #8a2be2">Violet</span> <span style="color: #000080">-Offset</span> <span style="color: #800080">0</span>
        <span style="color: #000000">)</span>
    <span style="color: #000000">)</span>
<span style="color: #000000">}</span></pre>
<h3>Related Topics</h3>
<ul>
<li>My “Hello World” <a href="http://www.dougfinke.com/blog/index.php/2011/06/14/powershell-showui-video-tutorialhello-world/">video tutorial</a> of ShowUI</li>
<li><a href="http://www.dougfinke.com/blog/index.php/2011/06/26/powershell-showui-and-the-twitter-api/">PowerShell, ShowUI and the Twitter API</a></li>
<li>Other ShowUI <a href="http://www.youtube.com/user/StartAutomating">video tutorials</a> from James Brundage, one of the authors of ShowUI</li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F07%2Fpowershell-clock-with-showui%2F&amp;title=PowerShell%20Clock%20with%20ShowUI"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/x6D5mugjxWo" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/x6D5mugjxWo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secrets to Building a WPF Application in Windows PowerShell</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/w_KofF7iHtw/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/w_KofF7iHtw/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 10:57:25 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/05/secrets-to-building-a-wpf-application-in-windows-powershell/</guid>
		<description><![CDATA[Check out my MSDN Article on PowerShell and WPF: Secrets to Building a WPF Application in Windows PowerShell Special bonus Windows PowerShell creator Jeffrey Snover weighs in on the Ad Hoc development model and origin of the language. Related Topics ShowUI: Write-UI –in PowerShell – A PowerShell module to help build WPF user interfaces in [...]]]></description>
			<content:encoded><![CDATA[<p>Check out my MSDN Article on PowerShell and WPF:</p>
<h3><a href="http://msdn.microsoft.com/en-us/magazine/hh288074.aspx">Secrets to Building a WPF Application in Windows PowerShell</a></h3>
<h3>Special bonus</h3>
<p>Windows PowerShell creator Jeffrey Snover weighs in on the Ad Hoc development model and origin of the language.</p>
<h3>Related Topics</h3>
<ul>
<li><a href="http://showui.codeplex.com/">ShowUI: Write-UI –in PowerShell</a> – A PowerShell module to help build WPF user interfaces in script</li>
<li>My “Hello World” video tutorial of <a href="http://showui.codeplex.com/">ShowUI</a></li>
<li><a href="http://www.dougfinke.com/blog/index.php/2011/06/26/powershell-showui-and-the-twitter-api/">PowerShell, ShowUI and the Twitter API</a></li>
<li>Other ShowUI <a href="http://www.youtube.com/user/StartAutomating">video tutorials</a> from James Brundage, one of the authors of ShowUI</li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F05%2Fsecrets-to-building-a-wpf-application-in-windows-powershell%2F&amp;title=Secrets%20to%20Building%20a%20WPF%20Application%20in%20Windows%20PowerShell"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/w_KofF7iHtw" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/w_KofF7iHtw/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My MSDN Magazine article is out–PowerShell &amp; WPF</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/sl9uPW0Qa58/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/sl9uPW0Qa58/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 22:32:49 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/07/01/my-msdn-magazine-article-is-outpowershell-wpf-2/</guid>
		<description><![CDATA[Secrets to Building a WPF Application in Windows PowerShell Thank You I want to thank Jeffrey Snover, Distinguished Engineer, Lead Architect for Windows Server and father of PowerShell. He eagerly and graciously agreed to write the sidebar for the article and offered great feedback. Also, thank you to James Brundage, founder and lead developer of [...]]]></description>
			<content:encoded><![CDATA[<h3><a href="http://msdn.microsoft.com/en-us/magazine/hh288074.aspx">Secrets to Building a WPF Application in Windows PowerShell</a></h3>
<h3>Thank You</h3>
<p>I want to thank Jeffrey Snover, Distinguished Engineer, Lead Architect for Windows Server and father of PowerShell. He eagerly and graciously agreed to write the sidebar for the article and offered great feedback.</p>
<p>Also, thank you to James Brundage, founder and lead developer of <a href="http://start-automating.com/">Start-Automating</a>, creator of the <a href="http://archive.msdn.microsoft.com/PowerShellPack">PowerShell Pack and WPK</a>. He provided excellent insight on my drafts. Hat tip to Joel Bennet, author of PowerBoots.</p>
<p>Finally, thank you to my colleagues who took the time to read and offer suggestions.</p>
<h3><a href="http://showui.codeplex.com/">ShowUI: Write-UI –in PowerShell</a></h3>
<p>While the article was going through technical and copy editing, the authors of WPK and PowerBoots merged the two frameworks, <a href="http://www.dougfinke.com/blog/index.php/2011/06/06/wpk-powerboots-powershell-showui/">WPK + PowerBoots =&gt; PowerShell ShowUI</a>. </p>
<h3>Video Tutorials</h3>
<p>I put together a “Hello World” demo of <a href="http://showui.codeplex.com/">ShowUI</a>. Plus this post <a href="http://www.dougfinke.com/blog/index.php/2011/06/26/powershell-showui-and-the-twitter-api/">PowerShell, ShowUI and the Twitter API</a>.</p>
<p align="center"><object width="400" height="245"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=24989541&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=24989541&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="245"></embed></object></p>
<p align="center">
<p>Definitely check out these other ShowUI <a href="http://www.youtube.com/user/StartAutomating">video tutorials</a>.</p>
<h3>Updated PowerShell Script for the Article </h3>
<p>Here is the <a href="http://showui.codeplex.com/">ShowUI</a> version of the PowerShell script I did in the MSDN article.</p>
<p> <iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="https://skydrive.live.com/embedicon.aspx/PresentValueCalculator?cid=5dec3b62d9308943&amp;sc=documents" frameborder="0" marginwidth="0" scrolling="no"></iframe></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F07%2F01%2Fmy-msdn-magazine-article-is-outpowershell-wpf-2%2F&amp;title=My%20MSDN%20Magazine%20article%20is%20out%26ndash%3BPowerShell%20%26amp%3B%20WPF"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/sl9uPW0Qa58" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/sl9uPW0Qa58/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell, ShowUI and the Twitter API</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/LfPLk8Luarc/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/LfPLk8Luarc/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 18:00:53 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/06/26/powershell-showui-and-the-twitter-api/</guid>
		<description><![CDATA[Checkout the video tutorial and the less than 30 lines of code. The Result I built this WPF application using PowerShell and ShowUI. I used a single Url to get the data back from the Twitter API, sliced and diced the XML in PowerShell, used WPF Databinding, Templates, a Grid and ListBox (and a little [...]]]></description>
			<content:encoded><![CDATA[<p>Checkout the video tutorial and the less than 30 lines of code.</p>
<h3>The Result</h3>
<p>I built this WPF application using PowerShell and <a href="http://showui.codeplex.com/">ShowUI</a>. I used a single Url to get the data back from the <a href="http://dev.twitter.com/doc">Twitter API</a>, sliced and diced the XML in PowerShell, used WPF Databinding, Templates, a Grid and ListBox (and a little more) to get this visual.</p>
<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/06/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/06/image_thumb1.png" width="335" height="467" /></a></p>
<h3>The Video</h3>
<p align="center"><object width="400" height="245"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=25626751&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=25626751&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="245"></embed></object></p>
<p>&#160;</p>
<h3>The Code</h3>
<pre style="width: 533px; height: 538px" class="PowerShellColorizedScript"><span style="color: #0000ff">Import-Module</span> <span style="color: #8a2be2">ShowUI</span>            

<span style="color: #00008b">function</span> <span style="color: #8a2be2">Search-Twitter</span> <span style="color: #000000">(</span><span style="color: #ff4500">$q</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;PowerShell&quot;</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
    <span style="color: #ff4500">$wc</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">New-Object</span> <span style="color: #8a2be2">Net.Webclient</span>
    <span style="color: #ff4500">$url</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;http://search.twitter.com/search.rss?q=$q&quot;</span>
    <span style="color: #000000">(</span><span style="color: #008080">[xml]</span><span style="color: #ff4500">$wc</span><span style="color: #a9a9a9">.</span><span style="color: #000000">downloadstring</span><span style="color: #000000">(</span><span style="color: #ff4500">$url</span><span style="color: #000000">)</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">rss</span><span style="color: #a9a9a9">.</span><span style="color: #000000">channel</span><span style="color: #a9a9a9">.</span><span style="color: #000000">item</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">select</span> <span style="color: #8a2be2">*</span>
<span style="color: #000000">}</span>            

<span style="color: #ff4500">$ws</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
    <span style="color: #000000">WindowStartupLocation</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;CenterScreen&quot;</span>
    <span style="color: #000000">SizeToContent</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;Width&quot;</span>
    <span style="color: #000000">Height</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">550</span>
    <span style="color: #000000">Title</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;PowerShell, ShowUI and the Twitter API&quot;</span>
<span style="color: #000000">}</span>            

<span style="color: #0000ff">New-Window</span> <span style="color: #ff4500">@ws</span> <span style="color: #000080">-Show</span> <span style="color: #000000">{</span>
    <span style="color: #0000ff">ListBox</span> <span style="color: #000080">-Background</span> <span style="color: #8a2be2">Black</span> <span style="color: #000080">-ItemTemplate</span> <span style="color: #000000">{</span>
        <span style="color: #0000ff">Grid</span> <span style="color: #000080">-Columns</span> <span style="color: #800080">55</span><span style="color: #a9a9a9">,</span> <span style="color: #800080">300</span> <span style="color: #000000">{</span>
            <span style="color: #0000ff">Image</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">Image</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #000080">-Column</span> <span style="color: #800080">0</span>
            <span style="color: #0000ff">TextBlock</span> <span style="color: #000080">-Name</span> <span style="color: #8a2be2">Title</span> <span style="color: #000080">-Margin</span> <span style="color: #800080">5</span> <span style="color: #000000">`
</span>            <span style="color: #000080">-Column</span> <span style="color: #800080">1</span> <span style="color: #000080">-TextWrapping</span> <span style="color: #8a2be2">Wrap</span> <span style="color: #000080">-Foreground</span> <span style="color: #8a2be2">White</span>
        <span style="color: #000000">}</span> <span style="color: #a9a9a9">|</span>
            <span style="color: #0000ff">ConvertTo-DataTemplate</span> <span style="color: #000080">-binding</span> <span style="color: #000000">@{</span>
                <span style="color: #8b0000">&quot;Image.Source&quot;</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;image_link&quot;</span>
                <span style="color: #8b0000">&quot;Title.Text&quot;</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;title&quot;</span>
            <span style="color: #000000">}</span>
    <span style="color: #000000">}</span> <span style="color: #000080">-DataContext</span> <span style="color: #000000">{</span><span style="color: #0000ff">Search-Twitter</span> <span style="color: #8a2be2">PowerShell</span><span style="color: #000000">}</span> <span style="color: #000000">`
</span>      <span style="color: #000080">-DataBinding</span> <span style="color: #000000">@{</span><span style="color: #000000">ItemsSource</span><span style="color: #a9a9a9">=</span><span style="color: #8b0000">&quot;.&quot;</span><span style="color: #000000">}</span>
<span style="color: #000000">}</span></pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F06%2F26%2Fpowershell-showui-and-the-twitter-api%2F&amp;title=PowerShell%2C%20ShowUI%20and%20the%20Twitter%20API"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/LfPLk8Luarc" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/LfPLk8Luarc/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I Presented PowerShell for .NET Developers</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/CHkLUni3ouo/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/CHkLUni3ouo/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 23:51:05 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/06/18/i-presented-powershell-for-net-developers/</guid>
		<description><![CDATA[At the Hartford Code Camp. It was a full room and while fewer developers have used PowerShell, when I asked what brought them to my talk, the response was they are hearing PowerShell will be fundamental when interacting with Windows going forward. My demo covers Cmdlets Piping Working with XML Compiling C# on the fly [...]]]></description>
			<content:encoded><![CDATA[<p>At the <a href="http://ctdotnet.org/default.aspx">Hartford Code Camp</a>. It was a full room and while fewer developers have used PowerShell, when I asked what brought them to my talk, the response was they are hearing PowerShell will be fundamental when interacting with Windows going forward.</p>
<p>My demo covers </p>
<ul>
<li>Cmdlets</li>
<li>Piping</li>
<li>Working with XML</li>
<li>Compiling C# on the fly in a script </li>
<ul>
<li>Using the object just created in the same PowerShell</li>
</ul>
<li>Configuring the Debug tab in VS 2010 for launching ISE (Integrated Script Environment)</li>
<ul>
<li>Setting a break point in that C# file, run a script and step through both the C# and PowerShell</li>
</ul>
<li>I conclude with <a href="http://showui.codeplex.com/">ShowUI</a>, a PowerShell module to help build WPF user interfaces in script. ShowUI makes the complicated world of WPF easy to use in PowerShell</li>
</ul>
<p>The talk ran over by more then 30 minutes with questions and scenarios. I done this talk several times and this time round the questions were deeper and broader than usual.</p>
<p>Two new questions I got, “How can you embed PowerShell in C#?”, “Can I use PowerShell in a web page like JavaScript?”</p>
<p>It was a great time.</p>
<h3>More ShowUI Resources</h3>
<ul>
<li>Download it <a href="http://showui.codeplex.com/">HERE</a></li>
<li><a href="http://www.dougfinke.com/blog/index.php/2011/06/14/powershell-showui-video-tutorialhello-world/">PowerShell ShowUI Video Tutorial–Hello World</a></li>
<li><a href="http://showui.codeplex.com/documentation">More Videos</a></li>
<li><a href="http://huddledmasses.org/showui-tutorial-walkthrough/">ShowUI: the tutorial walkthrough</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F06%2F18%2Fi-presented-powershell-for-net-developers%2F&amp;title=I%20Presented%20PowerShell%20for%20.NET%20Developers"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/CHkLUni3ouo" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/CHkLUni3ouo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell ShowUI Video Tutorial–Hello World</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/24IFbesd_70/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/24IFbesd_70/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 23:20:19 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/06/14/powershell-showui-video-tutorialhello-world/</guid>
		<description><![CDATA[I put together this short tutorial using ShowUI (download ShowUI HERE). ShowUI is a PowerShell module to help build WPF user interfaces in script. You can use ShowUI to write simple WPF gadgets, quick front ends for your scripts, components, and full applications. Basic Building Blocks In the video I demo the basic building blocks [...]]]></description>
			<content:encoded><![CDATA[<p align="left">I put together this short tutorial using ShowUI (download ShowUI <a href="http://showui.codeplex.com/">HERE</a>). ShowUI is a PowerShell module to help build WPF user interfaces in script. You can use ShowUI to write simple WPF gadgets, quick front ends for your scripts, components, and full applications.</p>
<h3 align="left">Basic Building Blocks</h3>
<p align="left">In the video I demo the basic building blocks you’ll reuse over and over. New-Window, New-StackPanel, New-Label, New-Button and more.</p>
<p align="left">Take a look and let me know what questions you’d liked answered. I’ll include them in the next set of video tutorials.</p>
<p align="center"><object width="400" height="245"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=24989541&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=24989541&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="245"></embed></object></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F06%2F14%2Fpowershell-showui-video-tutorialhello-world%2F&amp;title=PowerShell%20ShowUI%20Video%20Tutorial%26ndash%3BHello%20World"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/24IFbesd_70" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/24IFbesd_70/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cisco announces a PowerShell Tool kit for their Unified Computing System</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/ZJE1tM4uZTQ/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/ZJE1tM4uZTQ/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 00:21:02 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/06/10/cisco-announces-a-powershell-tool-kit-for-their-unified-computing-system/</guid>
		<description><![CDATA[As these type of offerings increase, it will become more and more important for developers to PowerShell enable the applications they deliver. This will greatly improve their cycle time by streamlining their software delivery process. The Cisco Unified Computing System is the&#160; next-generation data center platform accelerates the delivery of new services simply, reliably, and [...]]]></description>
			<content:encoded><![CDATA[<p>As these type of offerings increase, it will become more and more important for developers to PowerShell enable the applications they deliver. This will greatly improve their <a href="http://en.wikipedia.org/wiki/Cycle_time_variation">cycle time</a> by streamlining their software delivery process.</p>
<blockquote><p>The Cisco Unified Computing System is the&#160; next-generation data center platform accelerates the delivery of new services simply, reliably, and securely through end-to-end provisioning and migration support.</p>
</blockquote>
<h4><a href="http://developer.cisco.com/web/unifiedcomputing/pshell-download">UCS PowerShell Toolkit (PowerTool) and .NET SDK for UCSM</a></h4>
<blockquote><p>UCS PowerShell PowerTool helps customers integrate, automate, and orchestrate all aspects of UCS management including network, storage and hypervisor management with their existing IT management processes.&#160;&#160; <strong><em>Microsoft PowerShell is fast becoming a defacto standard for automating</em></strong> and integrating many functions of systems management within the datacenter.</p>
</blockquote>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F06%2F10%2Fcisco-announces-a-powershell-tool-kit-for-their-unified-computing-system%2F&amp;title=Cisco%20announces%20a%20PowerShell%20Tool%20kit%20for%20their%20Unified%20Computing%20System"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/ZJE1tM4uZTQ" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/ZJE1tM4uZTQ/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPK + PowerBoots =&gt; PowerShell ShowUI</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/MBSn4vx20IM/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/MBSn4vx20IM/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 00:17:27 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Advanced Visualization]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/06/06/wpk-powerboots-powershell-showui/</guid>
		<description><![CDATA[Version 1.0 is up on CodePlex HERE. ShowUI is a PowerShell module to help build WPF user interfaces in script. ShowUI makes the complicated world of WPF easy to use in PowerShell. You can use ShowUI to write simple WPF gadgets, quick front ends for your scripts, components, and full applications. History Back in 2008 [...]]]></description>
			<content:encoded><![CDATA[<p>Version 1.0 is up on CodePlex <a href="http://showui.codeplex.com/">HERE</a>.</p>
<blockquote><p><a href="http://showui.codeplex.com/">ShowUI</a> is a PowerShell module to help build WPF user interfaces in script. <a href="http://showui.codeplex.com/">ShowUI</a> makes the complicated world of WPF easy to use in PowerShell. You can use <a href="http://showui.codeplex.com/">ShowUI</a> to write simple WPF gadgets, quick front ends for your scripts, components, and full applications.</p>
</blockquote>
<h3>History</h3>
<p>Back in 2008 I blogged about <a href="http://www.dougfinke.com/blog/index.php/2008/03/25/ruby-shoes-and-the-start-of-a-powershell-version/">Ruby Shoes and the start of a PowerShell version</a>. Shoes is a GUI framework for Ruby. I figured why not a WinForms GUI framework for PowerShell. </p>
<p>Here is the Ruby Shoes example in <a href="http://showui.codeplex.com/">ShowUI</a> today:</p>
<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/06/image.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://www.dougfinke.com/blog/wp-content/uploads/2011/06/image_thumb.png" width="505" height="261" /></a></p>
<p><a href="http://huddledmasses.org/">Joel ‘Jaykul’ Bennett</a> figured the same, but using WPF,&#160; leaving a comment on my post about working on something he called PowerBoots.</p>
<p>Meanwhile James Brundage, founder of <a href="http://www.start-automating.com/">Start-Automating</a> and former member of the Microsoft PowerShell Team, was working on WPK, that was released as the part of the <a href="http://archive.msdn.microsoft.com/PowerShellPack">PowerShell Pack</a>.</p>
<p>I was lucky enough to get an early look at both of these excellent frameworks. These two powerhouse PowerShell guys decided to merge them, taking the best of both and kicking it up a notch. Once again, I am lucky enough to be involved, hear the discussions and contribute to the project.</p>
<h3>CodePlex Projects</h3>
<p>Here are two other WPF/PowerBoots projects I have. I’ll be doing more blogs and updating these projects to <a href="http://showui.codeplex.com/">ShowUI</a> soon.</p>
<ul>
<li><a href="http://trypowershell.codeplex.com/">Try PowerShell</a> </li>
<li><a href="http://psodata.codeplex.com/">OData PowerShell Explorer</a> </li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F06%2F06%2Fwpk-powerboots-powershell-showui%2F&amp;title=WPK%20%2B%20PowerBoots%20%3D%26gt%3B%20PowerShell%20ShowUI"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/MBSn4vx20IM" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/MBSn4vx20IM/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One clear advantage of OData is its commonality</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/FwtEWF7LGdc/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/FwtEWF7LGdc/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 02:01:06 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/06/02/one-clear-advantage-of-odata-is-its-commonality/</guid>
		<description><![CDATA[If you care at all about how data is accessed&#8211;and you should&#8211;understanding the basics of OData is probably worth your time. Dave Chappell’s post, Introducing OData, does a great job walking through what OData is. Covering REST, Atom/AtomPub, JSON, OData filter query syntax, mobile devices, the Cloud and more. Our world is awash in data. [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>If you care at all about how data is accessed&#8211;and you should&#8211;understanding the basics of OData is probably worth your time.</p>
</blockquote>
<p>Dave Chappell’s post, <a href="http://davidchappellopinari.blogspot.com/2011/05/introducing-odata.html">Introducing OData</a>, does a great job walking through what OData is. Covering REST, Atom/AtomPub, JSON, OData filter query syntax, mobile devices, the Cloud and more.</p>
<blockquote><p>Our world is awash in data. Vast amounts exist today, and more is created every year. Yet data has value only if it can be used, and it can be used only if it can be accessed by applications and the people who use them.      <br />Allowing this kind of broad access to data is the goal of the <a href="http://www.odata.org/">Open Data Protocol</a>, commonly called just OData. <a href="http://davidchappellopinari.blogspot.com/2011/05/introducing-odata.html">This paper provides an introduction to OData</a>, describing what it is and how it can be applied.</p>
</blockquote>
<h3>OData PowerShell Explorer</h3>
<p>I open sourced an <a href="http://psodata.codeplex.com/">OData PowerShell Explorer</a> complete with a WPF GUI using <a href="http://archive.msdn.microsoft.com/PowerShellPack">WPK</a>. The PowerShell module allows you to discover and drill down through OData services using either the command line or the GUI interface.</p>
<h3>Other Resources</h3>
<ul>
<li><a href="http://odataprimer.com/">OData Primer</a> </li>
<li><a href="http://www.runasradio.com/default.aspx?showNum=173">RunAs Radio podcast on the OData PowerShell Explorer</a> </li>
<li><a href="http://www.odata.org/">Open Data Protocol</a> </li>
<li><a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/06/02/download-teched-sessions-automatically-by-using-powershell.aspx">Download TechEd Sessions Automatically by Using PowerShell</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F06%2F02%2Fone-clear-advantage-of-odata-is-its-commonality%2F&amp;title=One%20clear%20advantage%20of%20OData%20is%20its%20commonality"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/FwtEWF7LGdc" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/FwtEWF7LGdc/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating Downloads from an OData Feed with PowerShell</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/x-1279OEGfg/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/x-1279OEGfg/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 12:35:36 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/?p=1269</guid>
		<description><![CDATA[Marco Shaw, another Microsoft Most Valuable Professional for PowerShell, wanted to download videos from the over 450 sessions from the Microsoft TechEd 2011 conference. Microsoft made the sessions available using the Open Data Protocol (OData). Marco points out in his Hey, Scripting Guy! post PowerShell 2.o does not support OData out of the box. He used my [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://marcoshaw.blogspot.com/">Marco Shaw</a>, another Microsoft Most Valuable Professional for PowerShell, wanted to download videos from the over 450 sessions from the Microsoft TechEd 2011 conference. Microsoft made the sessions available using the <a href="http://www.odata.org/">Open Data Protocol</a> (OData).</p>
<p>Marco points out in his <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/06/02/download-teched-sessions-automatically-by-using-powershell.aspx">Hey, Scripting Guy! post</a> PowerShell 2.o does not support OData out of the box. He used my PowerShell OData implementation <a href="http://psodata.codeplex.com/">HERE</a> on CodePlex to automate the downloading of sessions in a flexible way.</p>
<p>Thanks for the great write up Marco and demonstrating how PowerShell can save you time by automating key tasks.</p>
<h3>Other Resources</h3>
<ul>
<li><a href="http://odataprimer.com/">OData Primer</a></li>
<li><a href="http://www.dougfinke.com/blog/?s=odata">OData PowerShell</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F06%2F02%2Fautomating-downloads-from-an-odata-feed-with-powershell%2F&amp;title=Automating%20Downloads%20from%20an%20OData%20Feed%20with%20PowerShell"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/x-1279OEGfg" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/x-1279OEGfg/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spell Checking strings in your PowerShell scripts</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/XFlmL1NdY70/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/XFlmL1NdY70/#comments</comments>
		<pubDate>Mon, 30 May 2011 13:55:06 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/05/30/spell-checking-strings-in-your-powershell-scripts/</guid>
		<description><![CDATA[Spelling misteaks irritate readers. And for most, checking spelling is a boring and error-prone job. This is Jon Bentley’s opening line to his chapter “A Spelling Checker” in his book “Programming Pearls”. The PowerShell Invoke-SpellCheck script loads a custom dictionary and only checks the spelling of strings in a PowerShell script. This PowerShell script is [...]]]></description>
			<content:encoded><![CDATA[<p>Spelling misteaks irritate readers. And for most, checking spelling is a boring and error-prone job. </p>
<p>This is Jon Bentley’s opening line to his chapter “A Spelling Checker” in his book “Programming Pearls”.</p>
<p>The PowerShell Invoke-SpellCheck script loads a custom dictionary and only checks the spelling of strings in a PowerShell script.</p>
<p>This PowerShell script is an extension of <a href="http://www.dougfinke.com/blog/index.php/2007/04/24/spelling-corrector-in-vanilla-powershell/">my port</a> of Peter Norvig’s “<a href="http://norvig.com/spell-correct.html">How to Write a Spelling Corrector</a>”, he is Director of Research at Google. He wrote the post to examine statistical language problems, like spelling correction, used in search engines at Google, Yahoo and Microsoft.</p>
<p>Download the PowerShell script&#160; <a href="http://cid-5dec3b62d9308943.office.live.com/self.aspx/InvokeSpellCheck/InvokeSpellCheck.zip">HERE</a>.</p>
<h3>Script Highlights</h3>
<ul>
<li>The script parses a PowerShell file using the <a href="http://www.dougfinke.com/blog/?s=tokenizer">built-in PowerShell Tokenizer</a>. It finds strings in the script, such as Write-Host “The quick brown fox” or $result = “Jumps over the lazy dog” and spell checks them</li>
<li>You can spell check a single file
<ul>
<li><font color="#111111" face="Courier New"><strong>Invoke-SpellCheck .\spell.ps1</strong></font> </li>
</ul>
<p>&#160;</p>
<pre class="PowerShellColorizedScript"><span style="color: #8b0000">Misspelled Corrections              StartLine StartColumn FullName
---------- -----------              --------- ----------- --------
thex       {the, them, then, they}          1          10 .\spell.ps1
plansx     {plans}                          1          10 .\spell.ps1
fox        {box, fix, fog, for}             2          12 .\spell.ps1
muse       {use, ruse, must, amuse}         3          12 .\spell.ps1</span></pre>
</li>
<li>You can spell check an entire directory of scripts
<ul>
<li><font face="Courier New"><strong>dir . –Recurse *.ps1 |</strong></font> <font color="#111111" face="Courier New"><strong>Invoke-SpellCheck</strong></font> </li>
</ul>
</li>
<li>This script loads/parses/indexes over 100K words, then parses the two PowerShell scripts, extracts the strings, parses them, looks up each word and proposes corrections to words not found, in under a half second </li>
<li>You can add words to the dictionary using Notepad </li>
<li>You can pass in your own dictionary of words </li>
<li>If you want to learn more about implementing a probabilistic, statistical spelling correction algorithm, visit Mr. Norvig’s post and site. Plus his latest post “<a href="http://norvig.com/chomsky.html">On Chomsky and the Two Cultures of Statistical Learning</a>” is an interesting read</li>
</ul>
<h3>Invoke-SpellCheck</h3>
<pre style="width: 590px; height: 1049px" class="PowerShellColorizedScript"><span style="color: #00008b">function</span> <span style="color: #8a2be2">Invoke-SpellCheck</span> <span style="color: #000000">{</span>
    <span style="color: #006400">&lt;#
        .Synopsis
            Invoke-SpellCheck reads a single or multiple
            PowerShell script files, extracts the strings in it,
            then checks each word against a dictionary
        .Description
            A Detailed Description of what the command does
        .Example
            Invoke-SpellCheck .\spell.ps1

        .Example
            dir *.ps1 | Invoke-SpellCheck
    #&gt;</span>
    <span style="color: #00008b">param</span> <span style="color: #000000">(</span>
        <span style="color: #a9a9a9">[</span><span style="color: #add8e6">Parameter</span><span style="color: #000000">(</span><span style="color: #000000">ValueFromPipelineByPropertyName</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #000000">)</span><span style="color: #a9a9a9">]</span>
        <span style="color: #008080">[string]</span><span style="color: #ff4500">$FullName</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;C:\spell.ps1&quot;</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[string]</span><span style="color: #ff4500">$Dictionary</span><span style="color: #a9a9a9">=</span><span style="color: #8b0000">&quot;$pwd\holmes.txt&quot;</span>
    <span style="color: #000000">)</span>            

 <span style="color: #00008b">Begin</span> <span style="color: #000000">{</span>
        <span style="color: #ff4500">$nwords</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">train</span> <span style="color: #000000">(</span><span style="color: #008080">[IO.File]</span><span style="color: #a9a9a9">::</span><span style="color: #000000">ReadAllText</span><span style="color: #000000">(</span><span style="color: #ff4500">$dictionary</span><span style="color: #000000">)</span><span style="color: #000000">)</span>
 <span style="color: #000000">}</span>            

 <span style="color: #00008b">Process</span> <span style="color: #000000">{</span>
  <span style="color: #00008b">ForEach</span><span style="color: #000000">(</span><span style="color: #ff4500">$token</span> <span style="color: #00008b">in</span> <span style="color: #000000">(</span><span style="color: #0000ff">Get-StringTokens</span> <span style="color: #ff4500">$FullName</span><span style="color: #000000">)</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
   <span style="color: #00008b">ForEach</span> <span style="color: #000000">(</span><span style="color: #ff4500">$word</span> <span style="color: #00008b">in</span> <span style="color: #008080">[regex]</span><span style="color: #a9a9a9">::</span><span style="color: #000000">split</span><span style="color: #000000">(</span><span style="color: #ff4500">$token</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Content</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ToLower</span><span style="color: #000000">(</span><span style="color: #000000">)</span><span style="color: #a9a9a9">,</span> <span style="color: #8b0000">‘\W+’</span><span style="color: #000000">)</span> <span style="color: #000000">)</span> <span style="color: #000000">{</span>
    <span style="color: #00008b">if</span><span style="color: #000000">(</span><span style="color: #a9a9a9">!</span><span style="color: #ff4500">$nwords</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ContainsKey</span><span style="color: #000000">(</span><span style="color: #ff4500">$word</span><span style="color: #000000">)</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>            

                    <span style="color: #ff4500">$theSet</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">(</span><span style="color: #0000ff">deletion</span><span style="color: #000000">)</span> <span style="color: #a9a9a9">+</span>
                              <span style="color: #000000">(</span><span style="color: #0000ff">transposition</span><span style="color: #000000">)</span> <span style="color: #a9a9a9">+</span>
                              <span style="color: #000000">(</span><span style="color: #0000ff">alteration</span><span style="color: #000000">)</span> <span style="color: #a9a9a9">+</span>
                              <span style="color: #000000">(</span><span style="color: #0000ff">insertion</span><span style="color: #000000">)</span>            

                    <span style="color: #ff4500">$corrections</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@(</span><span style="color: #000000">)</span>
                    <span style="color: #00008b">foreach</span><span style="color: #000000">(</span><span style="color: #ff4500">$item</span> <span style="color: #00008b">in</span> <span style="color: #ff4500">$theSet</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
                        <span style="color: #00008b">if</span><span style="color: #000000">(</span><span style="color: #ff4500">$nwords</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ContainsKey</span><span style="color: #000000">(</span><span style="color: #ff4500">$item</span><span style="color: #000000">)</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
                            <span style="color: #ff4500">$corrections</span> <span style="color: #a9a9a9">+=</span> <span style="color: #ff4500">$item</span>
                        <span style="color: #000000">}</span>
                    <span style="color: #000000">}</span>            

                    <span style="color: #0000ff">New-Object</span> <span style="color: #8a2be2">PSObject</span> <span style="color: #000080">-Property</span> <span style="color: #000000">@{</span>
                        <span style="color: #000000">Misspelled</span>  <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$word</span>
                        <span style="color: #000000">StartLine</span>   <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$token</span><span style="color: #a9a9a9">.</span><span style="color: #000000">StartLine</span>
                        <span style="color: #000000">StartColumn</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$token</span><span style="color: #a9a9a9">.</span><span style="color: #000000">StartColumn</span>
                        <span style="color: #000000">Corrections</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$corrections</span>
                        <span style="color: #000000">FullName</span>    <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$FullName</span>
                    <span style="color: #000000">}</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Select</span> <span style="color: #8a2be2">Misspelled</span><span style="color: #a9a9a9">,</span> <span style="color: #000000">`
</span>                        <span style="color: #8a2be2">Corrections</span><span style="color: #a9a9a9">,</span> <span style="color: #000000">`
</span>                        <span style="color: #8a2be2">StartLine</span><span style="color: #a9a9a9">,</span> <span style="color: #000000">`
</span>                        <span style="color: #8a2be2">StartColumn</span><span style="color: #a9a9a9">,</span> <span style="color: #000000">`
</span>                        <span style="color: #8a2be2">FullName</span>
                <span style="color: #000000">}</span>
            <span style="color: #000000">}</span>
        <span style="color: #000000">}</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span></pre>
<h3>Download</h3>
<p><iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="http://cid-5dec3b62d9308943.office.live.com/embedicon.aspx/InvokeSpellCheck/InvokeSpellCheck.zip" frameborder="0" marginwidth="0" scrolling="no"></iframe></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F05%2F30%2Fspell-checking-strings-in-your-powershell-scripts%2F&amp;title=Spell%20Checking%20strings%20in%20your%20PowerShell%20scripts"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/XFlmL1NdY70" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/XFlmL1NdY70/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Opscode Chef Ships a Cookbook for PowerShell 2.0</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/7-Tr3Q7yyOA/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/7-Tr3Q7yyOA/#comments</comments>
		<pubDate>Tue, 24 May 2011 23:40:42 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/05/24/opscode-chef-ships-a-cookbook-for-powershell-2-0/</guid>
		<description><![CDATA[Plus they have delivered some killer features like support for remoting using WinRM, that’s PowerShell Remoting. Check out the post Chef ?’s Windows. HERE is the link to the PowerShell cookbook that has been shipped. I had the opportunity to dive into the Chef cookbooks/recipes and it’s programmatic process. It is written in Ruby which [...]]]></description>
			<content:encoded><![CDATA[<p>Plus they have delivered some killer features like support for remoting using WinRM, that’s PowerShell Remoting. Check out the post <a href="http://www.opscode.com/blog/2011/05/24/chef-hearts-windows/">Chef ?’s Windows</a>.</p>
<p><a href="http://community.opscode.com/cookbooks/powershell">HERE</a> is the link to the PowerShell cookbook that has been shipped.</p>
<p>I had the opportunity to dive into the Chef cookbooks/recipes and it’s programmatic process. It is written in Ruby which made it an excellent system to study for porting parts to PowerShell. Chef leverages Ruby in interesting ways and makes it well engineered and very flexible. This played well into PowerShell’s strengths.</p>
<p>It would be great if they continue with deeper PowerShell support, for example authoring cookbooks in pure PowerShell.</p>
<p>It will be interesting to see if <a href="http://www.puppetlabs.com/">Puppet Labs</a> responds with PowerShell capabilities. I know about a year and half ago they were tweeting about it.</p>
<h3>Chef</h3>
<h5>Infrastructure Automation for the Masses</h5>
<dl></dl>
<p>Chef is an open source systems integration framework built to bring the benefits of configuration management to your entire infrastructure. You write source code to describe how you want each part of your infrastructure to be built, then apply those descriptions to your servers.</p>
<p><a href="http://www.opscode.com/team/">Jesse Robbins</a> is co-founder and CEO of Opscode. Prior to co-founding Opscode, he worked at Amazon.com with a title of “Master of Disaster” where he was responsible for website availability for every property bearing the Amazon brand.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F05%2F24%2Fopscode-chef-ships-a-cookbook-for-powershell-2-0%2F&amp;title=Opscode%20Chef%20Ships%20a%20Cookbook%20for%20PowerShell%202.0"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/7-Tr3Q7yyOA" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/7-Tr3Q7yyOA/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handle Formatted Output in PowerShell</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/tFTA6DUyZr4/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/tFTA6DUyZr4/#comments</comments>
		<pubDate>Thu, 12 May 2011 02:08:51 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/?p=1258</guid>
		<description><![CDATA[My article is up on the Microsoft Hey, Scripting Guy site, HERE. It is based on the scripts we were judging that were submitted for the 2011 Scripting Games. I talk about the four PowerShell cmdlets that handle formatting and when you don’t want to use them. I show how to use the cmdlet New-Module [...]]]></description>
			<content:encoded><![CDATA[<p>My article is up on the Microsoft Hey, Scripting Guy site, <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/13/handle-formatted-output-in-powershell.aspx">HERE</a>. It is based on the scripts we were judging that were submitted for the <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/02/19/2011-scripting-games-all-links-on-one-page.aspx">2011 Scripting Games</a>.</p>
<p>I talk about the four PowerShell cmdlets that handle formatting and when you don’t want to use them. I show how to use the cmdlet New-Module to solve the problem.</p>
<p>Check it out. <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/13/handle-formatted-output-in-powershell.aspx">Handle Formatted Output in PowerShell</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F05%2F11%2Fhandle-formatted-output-in-powershell%2F&amp;title=Handle%20Formatted%20Output%20in%20PowerShell"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/tFTA6DUyZr4" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/tFTA6DUyZr4/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating CodePlex’s OData Service with PowerShell</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/2hclAcY0Plg/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/2hclAcY0Plg/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 00:41:57 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/04/19/automating-codeplexs-and-odata-service-with-powershell/</guid>
		<description><![CDATA[The Visual Studio team just recently released the OData Service for Team Foundation Server 2010. So I whipped up some PowerShell to retrieve the ChangeSets for my CodePlex projects. OData and PowerShell go well together, check out my OData PowerShell Explorer. Using the .NET framework, I can download a string from an OData service using [...]]]></description>
			<content:encoded><![CDATA[<p>The Visual Studio team just recently released the <a href="https://codeplexodata.cloudapp.net/">OData Service for Team Foundation Server 2010</a>. So I whipped up some PowerShell to retrieve the ChangeSets for my CodePlex projects.</p>
<p>OData and PowerShell go well together, check out my <a href="http://www.dougfinke.com/blog/index.php/2010/08/04/odata-powershell-explorer/">OData PowerShell Explorer</a>.</p>
<p>Using the .NET framework, I can download a string from an OData service using Net.WebClient. OData returns XML, this is a sweet spot for PowerShell. Using the <em>[xml] </em>accelerator and dot notation over the XML nodes ($result.feed.entry) makes quick work of the OData output.</p>
<h3>Interacting with OData feeds can be automated with PowerShell</h3>
<p>Here I am getting the change set comments for my PSCodeGen CodePlex project.</p>
<pre style="width: 466px; height: 34px" class="PowerShellColorizedScript"><span style="color: #0000ff">Get-CodeplexChangeSets</span> <span style="color: #8b0000">'TFS01'</span> <span style="color: #8b0000">&quot;PSCodeGen&quot;</span></pre>
<p><u><em>Get-CodePlexChangeSets</em></u> creates the correct Url, queries the CodePlex OData service and returns the results as PowerShell objects ready for use and display.</p>
<h3>Results</h3>
<p>I grab the Date and Comment from the ChangeSet result set, there are other fields to be mined. Be sure to check out the other details returned by CodePlex including the Builds, Changes, Builds, Branches, Work Items, Attachments, Projects, Queries and Area Paths.</p>
<p>From here I can easily generate release notes or filter on dates using PowerShell or analyze a range of scenarios with this data.</p>
<pre style="width: 559px; height: 301px" class="PowerShellColorizedScript"><span style="color: #006400"># Results</span>
<span style="color: #8b0000">TFSCollectionName Date                  ProjectName Comment
----------------- ----                  ----------- -------
TFS01             8/3/2010 3:44:57 PM   PSCodeGen   Checked in by server upgrade
TFS01             6/12/2010 12:13:50 PM PSCodeGen   Cleaned up comments
TFS01             6/12/2010 12:02:26 PM PSCodeGen   Install-PSCodeGenerator.ps1 handles install/uninstall of vs 2010 templates
TFS01             6/12/2010 9:59:40 AM  PSCodeGen   Moved the templates around
TFS01             6/12/2010 9:58:10 AM  PSCodeGen   Moved the directory
TFS01             6/12/2010 9:47:28 AM  PSCodeGen   Renamed Register-PSCodeGenerator.ps1 Install-PSCodeGenerator.ps1
TFS01             6/12/2010 9:40:27 AM  PSCodeGen   Removed VB registration. Need to look into why it is correctly in the registry but does not work with VB...
TFS01             6/11/2010 2:08:49 PM  PSCodeGen
TFS01             6/8/2010 9:28:26 PM   PSCodeGen
TFS01             6/8/2010 9:28:13 PM   PSCodeGen
TFS01             6/8/2010 9:27:22 PM   PSCodeGen   Initial import
TFS01             6/8/2010 8:08:20 PM   PSCodeGen   Created team project folder $/PSCodeGen via the Team Project Creation Wizard</span></pre>
<h3>Query Multiple CodePlex Projects in One Go</h3>
<p>Here I setup a script to report on all my existing CodePlex projects.</p>
<pre style="width: 562px; height: 597px" class="PowerShellColorizedScript"><span style="color: #000000">$(</span>
    <span style="color: #0000ff">New-CodeplexProject</span> <span style="color: #8b0000">'TFS01'</span> <span style="color: #8b0000">&quot;PSCodeGen&quot;</span>
    <span style="color: #0000ff">New-CodeplexProject</span> <span style="color: #8b0000">'TFS02'</span> <span style="color: #8b0000">&quot;psodata&quot;</span>
    <span style="color: #0000ff">New-CodeplexProject</span> <span style="color: #8b0000">'TFS03'</span> <span style="color: #8b0000">&quot;PowerShellJSON&quot;</span>
    <span style="color: #0000ff">New-CodeplexProject</span> <span style="color: #8b0000">'TFS05'</span> <span style="color: #8b0000">&quot;PoSHDebugVisualizer&quot;</span>
    <span style="color: #0000ff">New-CodeplexProject</span> <span style="color: #8b0000">'TFS07'</span> <span style="color: #8b0000">&quot;pslog&quot;</span>
    <span style="color: #0000ff">New-CodeplexProject</span> <span style="color: #8b0000">'TFS08'</span> <span style="color: #8b0000">&quot;trypowershell&quot;</span>
    <span style="color: #0000ff">New-CodeplexProject</span> <span style="color: #8b0000">'TFS09'</span> <span style="color: #8b0000">&quot;psisecream&quot;</span>
    <span style="color: #0000ff">New-CodeplexProject</span> <span style="color: #8b0000">'TFS07'</span> <span style="color: #8b0000">&quot;PowerTools&quot;</span>
<span style="color: #000000">)</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Get-CodeplexChangeSets</span>            

<span style="color: #006400"># Results</span>
<span style="color: #8b0000">TFSCollectionName Date                   ProjectName         Comment
----------------- ----                   -----------         -------
TFS01             6/12/2010 12:13:50 PM  PSCodeGen           Cleaned up comments
TFS01             6/12/2010 12:02:26 PM  PSCodeGen           Install-PSCodeGenerator.ps1 handles install/uninstall of vs 2010 templates
TFS02             8/15/2010 9:29:13 PM   psodata             Creates functions on the fly for OData Entity Types
TFS02             8/15/2010 8:31:07 PM   psodata             Start spike testing reading OData metadata
TFS02             8/15/2010 8:27:42 PM   psodata             Added Chris Sells' OData service
TFS03             4/9/2011 9:32:09 PM    PowerShellJSON      Fixed - ConvertFrom doesn't handle email addresses in the data workitem:20473 -- DCF
TFS03             7/26/2009 11:06:54 AM  PowerShellJSON      Quick test of ConvertFrom-JSON
TFS05             12/7/2007 8:24:53 PM   PoSHDebugVisualizer added to example program
TFS05             12/4/2007 7:51:56 PM   PoSHDebugVisualizer change build location
TFS07             4/20/2009 10:13:14 AM  PowerTools          Minor updates to project.
TFS07             4/20/2009 2:15:25 AM   PowerTools          Added code to avoid image duplication. Improved Keep Sections behavior. Check for no items when...
TFS07             5/30/2010 7:39:34 PM   pslog               Added logfileName and loggerName as parameters
TFS07             5/29/2010 3:27:00 PM   pslog               Added console coloring NLog example and support
TFS08             5/1/2010 4:30:38 PM    trypowershell       Added vertical and horizontal GridSplitter, and hyperlinks are represented through hyperlinks.
TFS08             4/26/2010 5:19:16 AM   trypowershell       KeyGesture W+Control for close added
TFS09             4/4/2010 8:54:05 AM    psisecream          This modules ISERemote requires elevated rights. Does't look nice, but the addon menu will only...
TFS09             4/3/2010 10:18:03 AM   psisecream          This is a compact module to play with PowerShell remoting.                                        </span></pre>
<h3>PowerShell Code</h3>
<p>These 4 PowerShell functions make it happen.</p>
<pre style="width: 557px; height: 1045px" class="PowerShellColorizedScript"><span style="color: #006400"># https://codeplexodata.cloudapp.net/</span>            

<span style="color: #00008b">function</span> <span style="color: #8a2be2">Get-CodePlexODataUri</span> <span style="color: #000000">{</span> <span style="color: #8b0000">&quot;https://codeplexodata.cloudapp.net/&quot;</span> <span style="color: #000000">}</span>            

<span style="color: #00008b">function</span> <span style="color: #8a2be2">New-CodeplexProject</span> <span style="color: #000000">{</span>
    <span style="color: #00008b">param</span> <span style="color: #000000">(</span>
        <span style="color: #a9a9a9">[</span><span style="color: #add8e6">Parameter</span><span style="color: #000000">(</span><span style="color: #000000">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #000000">)</span><span style="color: #a9a9a9">]</span>
        <span style="color: #ff4500">$TFSCollectionName</span><span style="color: #a9a9a9">,</span>
        <span style="color: #a9a9a9">[</span><span style="color: #add8e6">Parameter</span><span style="color: #000000">(</span><span style="color: #000000">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #000000">)</span><span style="color: #a9a9a9">]</span>
        <span style="color: #ff4500">$ProjectName</span>
    <span style="color: #000000">)</span>            

    <span style="color: #0000ff">New-Object</span> <span style="color: #8a2be2">PSObject</span> <span style="color: #000080">-Property</span> <span style="color: #000000">@{</span>
        <span style="color: #000000">TFSCollectionName</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$TFSCollectionName</span>
        <span style="color: #000000">ProjectName</span>       <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$ProjectName</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span>            

<span style="color: #00008b">function</span> <span style="color: #8a2be2">Invoke-WebClient</span> <span style="color: #000000">(</span><span style="color: #ff4500">$url</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
    <span style="color: #00008b">if</span><span style="color: #000000">(</span><span style="color: #a9a9a9">!</span><span style="color: #ff4500">$global:Credential</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
        <span style="color: #ff4500">$global:Credential</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">Get-Credential</span> <span style="color: #8b0000">snd\'&lt;your codeplex id here&gt;'</span>
    <span style="color: #000000">}</span>            

    <span style="color: #ff4500">$wc</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">New-Object</span> <span style="color: #8a2be2">net.webclient</span>
    <span style="color: #ff4500">$wc</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Credentials</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$global:Credential</span>             

    <span style="color: #ff4500">$wc</span><span style="color: #a9a9a9">.</span><span style="color: #000000">DownloadString</span><span style="color: #000000">(</span><span style="color: #ff4500">$url</span><span style="color: #000000">)</span>
<span style="color: #000000">}</span>            

<span style="color: #00008b">function</span> <span style="color: #8a2be2">Get-CodeplexChangeSets</span>  <span style="color: #000000">{</span>
    <span style="color: #00008b">param</span> <span style="color: #000000">(</span>
        <span style="color: #a9a9a9">[</span><span style="color: #add8e6">Parameter</span><span style="color: #000000">(</span><span style="color: #000000">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #a9a9a9">,</span> <span style="color: #000000">ValueFromPipelineByPropertyName</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #000000">)</span><span style="color: #a9a9a9">]</span>
        <span style="color: #ff4500">$TFSCollectionName</span><span style="color: #a9a9a9">,</span>
        <span style="color: #a9a9a9">[</span><span style="color: #add8e6">Parameter</span><span style="color: #000000">(</span><span style="color: #000000">Mandatory</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #a9a9a9">,</span> <span style="color: #000000">ValueFromPipelineByPropertyName</span><span style="color: #a9a9a9">=</span><span style="color: #ff4500">$true</span><span style="color: #000000">)</span><span style="color: #a9a9a9">]</span>
        <span style="color: #ff4500">$ProjectName</span><span style="color: #a9a9a9">,</span>
        <span style="color: #008080">[Switch]</span><span style="color: #ff4500">$Raw</span>
    <span style="color: #000000">)</span>            

    <span style="color: #00008b">Process</span> <span style="color: #000000">{</span>
        <span style="color: #ff4500">$url</span>    <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">Get-CodePlexODataUri</span>
        <span style="color: #ff4500">$url</span>   <span style="color: #a9a9a9">+=</span> <span style="color: #8b0000">&quot;$TFSCollectionName/Projects('$ProjectName')/Changesets&quot;</span>
        <span style="color: #ff4500">$result</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">Invoke-WebClient</span> <span style="color: #ff4500">$url</span>            

        <span style="color: #00008b">if</span><span style="color: #000000">(</span><span style="color: #ff4500">$Raw</span><span style="color: #000000">)</span> <span style="color: #000000">{</span> <span style="color: #00008b">return</span> <span style="color: #ff4500">$result</span><span style="color: #000000">}</span>            

        <span style="color: #000000">(</span><span style="color: #008080">[xml]</span><span style="color: #ff4500">$result</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">feed</span><span style="color: #a9a9a9">.</span><span style="color: #000000">entry</span> <span style="color: #a9a9a9">|</span>
            <span style="color: #0000ff">ForEach</span> <span style="color: #000000">{</span>
                <span style="color: #0000ff">New-Object</span> <span style="color: #8a2be2">PSObject</span> <span style="color: #000080">-Property</span> <span style="color: #000000">@{</span>
                    <span style="color: #000000">TFSCollectionName</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$TFSCollectionName</span>
                    <span style="color: #000000">ProjectName</span>       <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$ProjectName</span>
                    <span style="color: #000000">Comment</span>           <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$_</span><span style="color: #a9a9a9">.</span><span style="color: #000000">summary</span><span style="color: #a9a9a9">.</span><span style="color: #8b0000">'#text'</span>
                <span style="color: #000000">}</span>
            <span style="color: #000000">}</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span></pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F04%2F19%2Fautomating-codeplexs-and-odata-service-with-powershell%2F&amp;title=Automating%20CodePlex%26rsquo%3Bs%20OData%20Service%20with%20PowerShell"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/2hclAcY0Plg" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/2hclAcY0Plg/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Anyone can implement PowerShell on any platform</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/IvOaDqxETBM/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/IvOaDqxETBM/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 18:00:39 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/?p=1248</guid>
		<description><![CDATA[Microsoft announces they are licensing the language specification for Windows PowerShell 2.0. In the past I&#8217;ve seen Pash, an open source implementation of PowerShell for the Max, Linux etc. That project has been quite for a long time. This is interesting news. I am looking forward to see who runs with this. At any rate, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.msdn.com/b/powershell/archive/2011/04/16/powershell-language-now-licensed-under-the-community-promise.aspx">Microsoft announces </a>they are licensing the language specification for Windows PowerShell 2.0.</p>
<p>In the past I&#8217;ve seen <a href="http://pash.sourceforge.net/">Pash</a>, an open source implementation of PowerShell for the Max, Linux etc. That project has been quite for a long time.</p>
<p>This is interesting news. I am looking forward to see who runs with this.</p>
<p>At any rate, it will be fun to geek out on the spec and documentation of the language.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F04%2F18%2Fanyone-can-implement-powershell-on-any-platform%2F&amp;title=Anyone%20can%20implement%20PowerShell%20on%20any%20platform"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/IvOaDqxETBM" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/IvOaDqxETBM/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MIX11 Videos Are Ready</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/4rjuG_Uiu1I/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/4rjuG_Uiu1I/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 21:13:58 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/04/16/mix11-videos-are-ready/</guid>
		<description><![CDATA[HERE. Thanks to colleague Eugene Prystupa for the heads up. Here are the initial ones that I find interesting: Building Data-centric N-tier Applications with jQuery Data in an HTML5 World Deep Dive Into HTML5 &#060;canvas&#062; JavaScript: The Language Reactive Extensions for JavaScript (RxJS) Script#: Compiling C# to JavaScript using Visual Studio Good JavaScript Habits for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://channel9.msdn.com/events/mix/mix11">HERE</a>. </p>
<p>Thanks to colleague <a href="http://eprystupa.wordpress.com/">Eugene Prystupa</a> for the heads up.</p>
<p>Here are the initial ones that I find interesting:</p>
<ul>
<li><a href="http://channel9.msdn.com/Events/MIX/MIX11/FRM05">Building Data-centric N-tier Applications with jQuery</a> </li>
<li><a href="http://channel9.msdn.com/Events/MIX/MIX11/HTM02">Data in an HTML5 World</a> </li>
<li><a href="http://channel9.msdn.com/Events/MIX/MIX11/HTM03">Deep Dive Into HTML5 &lt;canvas&gt;</a> </li>
<li><a href="http://channel9.msdn.com/Events/MIX/MIX11/HTM06">JavaScript: The Language</a> </li>
<li><a href="http://channel9.msdn.com/Events/MIX/MIX11/HTM07">Reactive Extensions for JavaScript (RxJS)</a> </li>
<li><a href="http://channel9.msdn.com/Events/MIX/MIX11/HTM16">Script#: Compiling C# to JavaScript using Visual Studio</a> </li>
<li><a href="http://channel9.msdn.com/Events/MIX/MIX11/OPN08">Good JavaScript Habits for C# Developers</a> </li>
</ul>
<p>Plus</p>
<ul>
<li><a href="http://blogs.msdn.com/b/lukeh/">Luke Hoban</a> delivers the JavaScript: The Language, formerly of the F# team.</li>
<li>Nikhil Kothari, of Microsoft, has been steadily delivering on <a href="http://projects.nikhilk.net/ScriptSharp">Script#</a>, a way to compile C# to JavaScript</li>
<li>Let’s see if Data in an HTML5 World covers <a href="http://www.odata.org/">OData</a> and <a href="http://datajs.codeplex.com/">data.js</a> (checkout <a href="http://www.odataprimer.com/">OData Primer</a>). Here are my <a href="http://www.odataprimer.com/AllPages.aspx?Cat=PowerShell">OData PowerShell resources</a>.</li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F04%2F16%2Fmix11-videos-are-ready%2F&amp;title=MIX11%20Videos%20Are%20Ready"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/4rjuG_Uiu1I" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/4rjuG_Uiu1I/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two New Functions for Visual Studio’s NuGet PowerShell Console</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/ds5A5CkxbnY/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/ds5A5CkxbnY/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 02:05:38 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/04/13/two-new-functions-for-visual-studios-nuget-powershell-console/</guid>
		<description><![CDATA[I am trying out two new PowerShell functions I’ve written for Visual Studio NuGet’s Package Management Console. One is Goto-InCurrentWindow and the other Select-StringCurrentFile. The Select-StringCurrentFile (aliased: sscf) lets me search the entire Visual Studio active document for strings (see Example Usage), returning the line and the line number it is found on. Using the [...]]]></description>
			<content:encoded><![CDATA[<p>I am trying out two new PowerShell functions I’ve written for Visual Studio NuGet’s Package Management Console. One is <em>Goto-InCurrentWindow </em>and the other <em>Select-StringCurrentFile.</em> </p>
<p>The Select-StringCurrentFile (aliased: <strong>sscf</strong>) lets me search the entire Visual Studio active document for strings (<em><strong>see Example Usage</strong></em>), returning the line and the line number it is found on. Using the Goto-InCurrentWindow function (aliased: <strong>gicw</strong>), passing the line number; it jumps to that line in that document.</p>
<h3>The Console</h3>
<p>The NuGet console, is a PowerShell console which is hooked up to the Visual Studio environment through the DTE. It is accessed via the PowerShell variable <strong><em>$dte</em></strong>.</p>
<p>From the $dte variable, I use properties such as, ActiveDocument, ExcecuteCommand and Windows. There are other properties and methods on the $dte object, I reviewed them in the NuGet console with this: </p>
<p><font size="2" face="Courier New">$dte | Get-Member</font></p>
<h3>The PowerShell Functions</h3>
<p>The Select-StringCurrentFile function gets the active document’s full name and passes it to PowerShell’s built in cmdlet Select-String (aka grep, like in Unix). This returns the matches it finds. I extract and emit the Line and LinNumber in a new object. Note, the $pattern can be any valid <em>regular expression</em>.</p>
<p>The Goto-InCurrentWindow function takes a line number as a parameter, Activates the current window and then uses ExecuteCommand. I pass two parameters to ExecuteCommand. “Edit.Goto” and the line number. Edit.Goto is a built in Visual Studio command. I discovered the other Visual Studio commands with this: </p>
<p><font size="2" face="Courier New">$dte.Commands | ForEach {$_.Name}</font></p>
<p>In the <em>Example Usage</em> I use the aliases I created for the function, <em>sscf</em> and <em>gicw</em>. This lets me type fewer characters than the full function names.</p>
<pre style="width: 492px; height: 394px" class="PowerShellColorizedScript"><span style="color: #00008b">function</span> <span style="color: #8a2be2">Goto-InCurrentWindow</span> <span style="color: #000000">(</span><span style="color: #ff4500">$lineNumber</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>
    <span style="color: #ff4500">$dte</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Windows</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Item</span><span style="color: #000000">(</span><span style="color: #ff4500">$dte</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ActiveDocument</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Name</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Activate</span><span style="color: #000000">(</span><span style="color: #000000">)</span>
    <span style="color: #ff4500">$dte</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ExecuteCommand</span><span style="color: #000000">(</span><span style="color: #8b0000">&quot;Edit.GoTo&quot;</span><span style="color: #a9a9a9">,</span> <span style="color: #ff4500">$lineNumber</span><span style="color: #000000">)</span>
<span style="color: #000000">}</span>            

<span style="color: #00008b">function</span> <span style="color: #8a2be2">Select-StringCurrentFile</span> <span style="color: #000000">{</span>
    <span style="color: #00008b">param</span><span style="color: #000000">(</span><span style="color: #ff4500">$pattern</span><span style="color: #000000">)</span>            

    <span style="color: #0000ff">Select-String</span> <span style="color: #ff4500">$pattern</span> <span style="color: #ff4500">$dte</span><span style="color: #a9a9a9">.</span><span style="color: #000000">ActiveDocument</span><span style="color: #a9a9a9">.</span><span style="color: #000000">FullName</span> <span style="color: #a9a9a9">|</span>
        <span style="color: #0000ff">ForEach</span> <span style="color: #000000">{</span>
            <span style="color: #ff4500">$line</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$_</span><span style="color: #a9a9a9">.</span><span style="color: #000000">line</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Trim</span><span style="color: #000000">(</span><span style="color: #000000">)</span>            

            <span style="color: #0000ff">New-Object</span> <span style="color: #8a2be2">PSObject</span> <span style="color: #000080">-Property</span> <span style="color: #000000">@{</span>
                <span style="color: #000000">Line</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$line</span>
                <span style="color: #000000">LineNumber</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$_</span><span style="color: #a9a9a9">.</span><span style="color: #000000">LineNumber</span>
            <span style="color: #000000">}</span>
        <span style="color: #000000">}</span>
<span style="color: #000000">}</span>            

<span style="color: #0000ff">Set-Alias</span> <span style="color: #8a2be2">gicw</span> <span style="color: #8a2be2">Goto-InCurrentWindow</span>
<span style="color: #0000ff">Set-Alias</span> <span style="color: #8a2be2">sscf</span> <span style="color: #8a2be2">Select-StringCurrentFile</span></pre>
<h3>&#160;</h3>
<h3>Example Usage</h3>
<p><a href="http://dougfinke.com/uploadPictures/6def1ab0a472_12259/image.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dougfinke.com/uploadPictures/6def1ab0a472_12259/image_thumb.png" width="505" height="691" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F04%2F13%2Ftwo-new-functions-for-visual-studios-nuget-powershell-console%2F&amp;title=Two%20New%20Functions%20for%20Visual%20Studio%26rsquo%3Bs%20NuGet%20PowerShell%20Console"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/ds5A5CkxbnY" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/ds5A5CkxbnY/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create A PowerShell Hash Table From A PowerShell Object</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/CbObtqZO7K8/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/CbObtqZO7K8/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 01:09:09 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/04/11/create-a-powershell-hash-table-from-a-powershell-object/</guid>
		<description><![CDATA[Matt Biehl asks: How would you create a hash table from a PowerShell objects properties? Matt takes a hash table (associative array) and creates a .Net object (PSObject) with properties and values by passing it to the Property parameter on the New-Object. $peeps = @{ 'Lead'='asmith'; 'Enterprise'='bjones'; 'Edge'='chumperdink'; 'Backend'='dwilford'; 'SED'='fhanns' } $obj = New-Object -Type [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://get-command.blogspot.com/2011/04/create-hashtable-using-objects.html">Matt Biehl asks</a>: How would you create a hash table from a PowerShell objects properties?</p>
<p>Matt takes a hash table (associative array) and creates a .Net object (PSObject) with properties and values by passing it to the <em>Property</em> parameter on the <em>New-Object</em>.</p>
<pre style="width: 479px; height: 194px" class="PowerShellColorizedScript"><span style="color: #ff4500">$peeps</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@{</span>
  <span style="color: #8b0000">'Lead'</span><span style="color: #a9a9a9">=</span><span style="color: #8b0000">'asmith'</span><span style="color: #000000">;</span>
  <span style="color: #8b0000">'Enterprise'</span><span style="color: #a9a9a9">=</span><span style="color: #8b0000">'bjones'</span><span style="color: #000000">;</span>
  <span style="color: #8b0000">'Edge'</span><span style="color: #a9a9a9">=</span><span style="color: #8b0000">'chumperdink'</span><span style="color: #000000">;</span>
  <span style="color: #8b0000">'Backend'</span><span style="color: #a9a9a9">=</span><span style="color: #8b0000">'dwilford'</span><span style="color: #000000">;</span>
  <span style="color: #8b0000">'SED'</span><span style="color: #a9a9a9">=</span><span style="color: #8b0000">'fhanns'</span>
<span style="color: #000000">}</span>            

<span style="color: #ff4500">$obj</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">New-Object</span> <span style="color: #000080">-Type</span> <span style="color: #8a2be2">PSObject</span> <span style="color: #000080">-Property</span> <span style="color: #ff4500">$peeps</span></pre>
<h3>Turn A PowerShell Object Into a Hash Table</h3>
<p>I pipe the newly created object to <em>Get-Member </em>filtering out only the properties using the <em>MemberType</em> parameter (see Results of the Get-Member). I then use the Begin/Process/End block of the ForEach. </p>
<p>In the Begin Block I create the $hash and in the End Block I “return” the $hash. Which in this case prints it out.</p>
<p>In Process Block, I grab the $_.Name from the Get-Member results. In the 3rd line, on the left hand side of the equals I create the hash key using dot notation and then set the value on the right hand side using the same $_.Name and dot notation but using the $obj which contains the value.</p>
<pre style="width: 474px; height: 250px" class="PowerShellColorizedScript"><span style="color: #ff4500">$obj</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Get-Member</span> <span style="color: #000080">-MemberType</span> <span style="color: #8a2be2">Properties</span> <span style="color: #a9a9a9">|</span>
    <span style="color: #0000ff">ForEach</span> <span style="color: #000000">{</span><span style="color: #ff4500">$hash</span><span style="color: #a9a9a9">=</span><span style="color: #000000">@{</span><span style="color: #000000">}</span><span style="color: #000000">}</span> <span style="color: #000000">{</span>
        <span style="color: #ff4500">$hash</span><span style="color: #a9a9a9">.</span><span style="color: #000000">(</span><span style="color: #ff4500">$_</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Name</span><span style="color: #000000">)</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$obj</span><span style="color: #a9a9a9">.</span><span style="color: #000000">(</span><span style="color: #ff4500">$_</span><span style="color: #a9a9a9">.</span><span style="color: #000000">Name</span><span style="color: #000000">)</span>
    <span style="color: #000000">}</span> <span style="color: #000000">{</span><span style="color: #ff4500">$hash</span><span style="color: #000000">}</span>            

<span style="color: #006400"># Results</span>
<span style="color: #8b0000">Name                           Value
----                           -----
Backend                        dwilford
SED                            fhanns
Edge                           chumperdink
Lead                           asmith
Enterprise                     bjones</span></pre>
<h3>Results of the Get-Member</h3>
<pre style="width: 474px; height: 266px" class="PowerShellColorizedScript"><span style="color: #ff4500">$obj</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Get-Member</span> <span style="color: #000080">-MemberType</span> <span style="color: #8a2be2">Properties</span>            

<span style="color: #006400"># Results of Get-Member</span>
<span style="color: #8b0000">
  TypeName: System.Management.Automation.PSCustomObject

Name       MemberType   Definition
----       ----------   ----------
Backend    NoteProperty System.String Backend=dwilford
Edge       NoteProperty System.String Edge=chumperdink
Enterprise NoteProperty System.String Enterprise=bjones
Lead       NoteProperty System.String Lead=asmith
SED        NoteProperty System.String SED=fhanns</span></pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F04%2F11%2Fcreate-a-powershell-hash-table-from-a-powershell-object%2F&amp;title=Create%20A%20PowerShell%20Hash%20Table%20From%20A%20PowerShell%20Object"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/CbObtqZO7K8" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/CbObtqZO7K8/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calling Excel Math Functions From PowerShell</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/-1Em1PVhAeE/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/-1Em1PVhAeE/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 01:19:04 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/04/05/calling-excel-math-functions-from-powershell/</guid>
		<description><![CDATA[I came across this post Calling Excel Math Functions From F# FSI and figured it would be very useful to do from PowerShell. This can also be done a line at a time in the PowerShell command line REPL (Read Eval Print Loop). Meaning, you can create different arrays and multidimensional arrays at the command [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this post <a href="http://blogs.msdn.com/b/jackhu/archive/2011/04/05/using-excel-math-functions-from-f-fsi.aspx">Calling Excel Math Functions From F# FSI</a> and figured it would be very useful to do from PowerShell.</p>
<p>This can also be done a line at a time in the PowerShell command line REPL (Read Eval Print Loop). Meaning, you can create different arrays and multidimensional arrays at the command line and then type and call the Excel functions.</p>
<p>Plus, these are only 4 of the many Excel functions available.</p>
<p>If you want to find out the other Excel math functions available, type this line at the command line (run the first three lines of code up to the WorksheetFunction first):</p>
<p><em>$wf | Get-Member -MemberType method | Out-GridView</em></p>
<pre class="PowerShellColorizedScript" style="width: 454px; height: 430px;"><span style="color: #006400;"># Calling Excel Math Functions From PowerShell</span>            

<span style="color: #ff4500;">$xl</span>        <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">New-Object</span> <span style="color: #000080;">-ComObject</span> <span style="color: #8a2be2;">Excel.Application</span>
<span style="color: #ff4500;">$xlprocess</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">Get-Process</span> <span style="color: #8a2be2;">excel</span>            

<span style="color: #ff4500;">$wf</span>   <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$xl</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">WorksheetFunction</span>
<span style="color: #ff4500;">$data</span> <span style="color: #a9a9a9;">=</span> <span style="color: #800080;">1</span><span style="color: #a9a9a9;">,</span><span style="color: #800080;">2</span><span style="color: #a9a9a9;">,</span><span style="color: #800080;">3</span><span style="color: #a9a9a9;">,</span><span style="color: #800080;">4</span>
<span style="color: #ff4500;">$m</span>    <span style="color: #a9a9a9;">=</span> <span style="color: #000000;">(</span><span style="color: #000000;">(</span><span style="color: #800080;">1</span><span style="color: #a9a9a9;">,</span><span style="color: #800080;">2</span><span style="color: #a9a9a9;">,</span><span style="color: #800080;">3</span><span style="color: #000000;">)</span><span style="color: #a9a9a9;">,</span><span style="color: #000000;">(</span><span style="color: #800080;">4</span><span style="color: #a9a9a9;">,</span><span style="color: #800080;">5</span><span style="color: #a9a9a9;">,</span><span style="color: #800080;">6</span><span style="color: #000000;">)</span><span style="color: #a9a9a9;">,</span><span style="color: #000000;">(</span><span style="color: #800080;">7</span><span style="color: #a9a9a9;">,</span><span style="color: #800080;">8</span><span style="color: #a9a9a9;">,</span><span style="color: #800080;">9</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>            

<span style="color: #0000ff;">Write-Host</span> <span style="color: #000080;">-ForegroundColor</span> <span style="color: #8a2be2;">green</span> <span style="color: #8a2be2;">Median</span>
<span style="color: #ff4500;">$wf</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Median</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$data</span><span style="color: #000000;">)</span>            

<span style="color: #0000ff;">Write-Host</span> <span style="color: #000080;">-ForegroundColor</span> <span style="color: #8a2be2;">green</span> <span style="color: #8a2be2;">StDev</span>
<span style="color: #ff4500;">$wf</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">StDev</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$data</span><span style="color: #000000;">)</span>            

<span style="color: #0000ff;">Write-Host</span> <span style="color: #000080;">-ForegroundColor</span> <span style="color: #8a2be2;">green</span> <span style="color: #8a2be2;">Var</span>
<span style="color: #ff4500;">$wf</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Var</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$data</span><span style="color: #000000;">)</span>            

<span style="color: #0000ff;">Write-Host</span> <span style="color: #000080;">-ForegroundColor</span> <span style="color: #8a2be2;">green</span> <span style="color: #8a2be2;">MInverse</span>
<span style="color: #ff4500;">$wf</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">MInverse</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$m</span><span style="color: #000000;">)</span>            

<span style="color: #ff4500;">$xl</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">quit</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>
<span style="color: #ff4500;">$xlprocess</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">kill</span></pre>
<pre class="PowerShellColorizedScript" style="width: 237px; height: 327px;"><span style="color: #006400;"># Results</span>
<span style="color: #8b0000;"><span style="color: #80ff00;"><span style="color: #008000;">Median</span>
</span>2.5
<span style="color: #008000;">StDev</span>
1.29099444873581
<span style="color: #008000;">Var</span>
1.66666666666667
<span style="color: #008000;">MInverse</span>
-4.5035996273705E+15
9.00719925474099E+15
-4.5035996273705E+15
9.007199254741E+15
-1.8014398509482E+16
9.00719925474099E+15
-4.5035996273705E+15
9.00719925474099E+15
-4.5035996273705E+15</span></pre>
<h3>Grab the Code</h3>
<p>I put the code up on my <a href="https://github.com/dfinke/powershell/blob/master/Calling%20Excel%20Functions%20From%20PowerShell/Invoke-ExcelFunction.ps1">GitHub PowerShell Repository</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F04%2F05%2Fcalling-excel-math-functions-from-powershell%2F&amp;title=Calling%20Excel%20Math%20Functions%20From%20PowerShell"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/-1Em1PVhAeE" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/-1Em1PVhAeE/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft restates their emphasis on Silverlight</title>
		<link>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/oGN8LBD36Rw/</link>
		<comments>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/oGN8LBD36Rw/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 01:53:30 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/04/04/microsoft-restates-their-emphasis-on-silverlight/</guid>
		<description><![CDATA[Two significant industry dynamics have taken shape since [Silverlight was introduced] that cause us to emphasize the role of Silverlight differently as a key tool in the developer toolbox. MIX 11 kicks off next Tuesday, April 12 and the Silverlight Team posted this announcement on Standards-based web, plug-ins, and Silverlight. Here are some interesting snippets: [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Two significant industry dynamics have taken shape since [Silverlight was introduced] that cause us to emphasize the role of Silverlight differently as a key tool in the developer toolbox.</p>
</blockquote>
<p>MIX 11 kicks off next Tuesday, April 12 and the Silverlight Team posted this announcement on <a href="http://team.silverlight.net/announcement/standards-based-web-plug-ins-and-silverlight/">Standards-based web, plug-ins, and Silverlight</a>.</p>
<p>Here are some interesting snippets:</p>
<ul>
<li>[Microsoft] has shown an unprecedented commitment to being leaders in HTML5 browsers</li>
<li>[Microsoft] has probably not emphasized enough the tooling for HTML5. We&#8217;re going to emphasize that much more going forward [...]</li>
<li>Over the coming months we’ll be particularly demonstrative of our emphasis on HTML5</li>
</ul>
<p>I blogged recently:</p>
<ul>
<li><a href="http://www.dougfinke.com/blog/index.php/2011/03/28/analyze-microsoft-mix11-session-data-with-powershell/">Analyze Microsoft MIX11 Session Data With PowerShell</a> of note, there are as many HTML5 sessions as there are Silverlight at MIX11</li>
<li><a href="http://www.dougfinke.com/blog/index.php/2011/03/01/is-microsoft-hedging-their-bet/">Is Microsoft hedging their bet?</a> Where Microsoft sponsors an HTML5 contest. Stating HTML5 and related technologies can provide what you expect from native applications</li>
<li><a href="http://www.dougfinke.com/blog/index.php/2010/10/30/html-is-the-only-true-cross-platform-solution-for-everything/">HTML is the only true cross platform solution for everything</a> Bob Muglia responded about Silverlight questions. Back then he was the leader of the Microsoft Server and Tools Business.</li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.dougfinke.com%2Fblog%2Findex.php%2F2011%2F04%2F04%2Fmicrosoft-restates-their-emphasis-on-silverlight%2F&amp;title=Microsoft%20restates%20their%20emphasis%20on%20Silverlight"><img src="http://www.dougfinke.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>
<p><img src="http://feeds.feedburner.com/~r/DevelopmentInABlink/~4/oGN8LBD36Rw" height="1" width="1"/></p>
]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/DevelopmentInABlink/~3/oGN8LBD36Rw/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

