<?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>ps1.soapyfrog.com &#187; Grrr</title>
	<atom:link href="http://ps1.soapyfrog.com/category/grrr/feed/" rel="self" type="application/rss+xml" />
	<link>http://ps1.soapyfrog.com</link>
	<description>doing inappropriate things with powershell</description>
	<lastBuildDate>Sun, 26 Aug 2007 22:01:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Grrr source code, including Invaders</title>
		<link>http://ps1.soapyfrog.com/2007/08/26/grrr-source-code-including-invaders/</link>
		<comments>http://ps1.soapyfrog.com/2007/08/26/grrr-source-code-including-invaders/#comments</comments>
		<pubDate>Sun, 26 Aug 2007 16:24:46 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Announce]]></category>
		<category><![CDATA[Grrr]]></category>
		<category><![CDATA[Invaders]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://ps1.soapyfrog.com/2007/08/26/grrr-source-code-including-invaders/</guid>
		<description><![CDATA[As you may have noticed, there has been very little activity here from me in recent months. This is partly because my full time work does not use nor need PowerShell and my free time has become more precious. Playing with PS1 has been fun and I&#8217;ve learned a lot, but ultimately, it&#8217;s just a [...]]]></description>
			<content:encoded><![CDATA[<p>As you may have noticed, there has been very little activity here from me in recent months.</p>
<p>This is partly because my full time work does not use nor need PowerShell and my free time has become more precious.</p>
<p>Playing with PS1 has been fun and I&#8217;ve learned a lot, but ultimately, it&#8217;s just a toy to me, and there comes a time when you must put your toys away &#8212; one might argue that, at nearly 40, I should have put my toys away long ago <img src='http://ps1.soapyfrog.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Now, I&#8217;ve been inundated with literally 3 requests for the source code to <a href="http://ps1.soapyfrog.com/category/grrr/">Grrr</a>, the snapin-based framework behind <a href="http://ps1.soapyfrog.com/2007/02/26/grrr-11-and-big-invaders/">Big Invaders</a>, so here it is:</p>
<p><strong><a href='http://ps1.soapyfrog.com/wp-content/uploads/2007/08/grrr-303.zip' title='Grrr source code'>Grrr source code</a><br />
</strong></p>
<p>Like the rest of the stuff here, it&#8217;s released under the creative commons license.</p>
<p>So long, and thanks for all the fish.</p>
]]></content:encoded>
			<wfw:commentRss>http://ps1.soapyfrog.com/2007/08/26/grrr-source-code-including-invaders/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cmdlet clashes</title>
		<link>http://ps1.soapyfrog.com/2007/03/06/cmdlet-clashes/</link>
		<comments>http://ps1.soapyfrog.com/2007/03/06/cmdlet-clashes/#comments</comments>
		<pubDate>Tue, 06 Mar 2007 09:56:22 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Cmdlets]]></category>
		<category><![CDATA[Grrr]]></category>
		<category><![CDATA[Hint]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://ps1.soapyfrog.com/2007/03/06/cmdlet-clashes/</guid>
		<description><![CDATA[One of the things that struck me whilst developing Grrr as a snapin is: what do you do when you have a cmdlet with the same verb-noun pair as an existing cmdlet? If someone else had a cmdlet called, say, out-banner, and that cmdlet was already loaded in a snap-in (perhaps mandated by site policy), [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things that struck me whilst developing <a href="/category/grrr/">Grrr</a> as a snapin is: what do you do when you have a cmdlet with the same verb-noun pair as an existing cmdlet?</p>
<p>If someone else had a cmdlet called, say, <code>out-banner</code>, and that cmdlet was already loaded in a snap-in (perhaps mandated by site policy), would I be able to register and add the Grrr snapin, which also defines it?</p>
<p>I&#8217;ve scanned the available documentation and the language grammar, used introspection in the shell and so on, but could not find anything to deal with this problem.</p>
<p>With projects like <a href="http://www.codeplex.com/PowerShellCX">PowerShell Community Extensions</a> seemingly laying claim to hundreds of common nouns and verbs, I was concerned that the scope for writing unique cmdlets would dry up real fast.</p>
<p><span id="more-62"></span></p>
<p>To determine what would happen, I <a href="/2007/02/26/grrr-11-and-big-invaders/">registered and added</a> <code>Soapyfrog.Grrr</code>, then wrote a new snapin, <code>Soapyfrog.Conflict</code>, with a single cmdlet, <code>out-banner</code>, conflicting with the one in Grrr.</p>
<p>I registered and added this, and was surprised that no warning of a conflict was given. To see if both were added, I tried this:</p>
<pre style='color: #000; background-color: #ccc; '>PS&gt; get-command out-banner

CommandType     Name                        Definition
-----------     ----                        ----------
Cmdlet          Out-Banner                  Out-Banner [-Text] <span>&lt;</span>Str...
Cmdlet          Out-Banner                  Out-Banner [-Text] <span>&lt;</span>Str...
</pre>
<p>Interesting. Both are available, so what happens when I try to invoke it?</p>
<pre style='color: #000; background-color: #ccc; '>PS&gt; out-banner hello
<span style='color: #800; background-color: #ccc'>The term &#39;out-banner&#39; resolved to a cmdlet name that is ambiguous. Pos</span>
<span style='color: #800; background-color: #ccc'>sible matches include: Soapyfrog.Grrr&#x5c;Out-Banner soapyfrog.conflict&#x5c;Ou</span>
<span style='color: #800; background-color: #ccc'>t-Banner.</span>
<span style='color: #800; background-color: #ccc'>At line:1 char:11</span>
<span style='color: #800; background-color: #ccc'>+ out-banner  <span>&lt;</span><span>&lt;</span><span>&lt;</span><span>&lt;</span> hello</span>
</pre>
<p>OK, so at this point, we know it&#8217;s possible to break existing PowerShell scripts by simply registering and adding a new snapin with a same-named cmdlet. Not good. Is there a work-around?</p>
<pre style='color: #000; background-color: #ccc; '>PS&gt; Soapyfrog.Grrr&#x5c;out-banner hello -fg &#39;o&#39;
o   o ooooo o     o      ooo
o   o o     o     o     o   o
ooooo ooo   o     o     o   o
o   o o     o     o     o   o
o   o ooooo ooooo ooooo  ooo
</pre>
<p>Yes! We can fully qualify the cmdlet name with the snapin name and a backslash.</p>
<p>So, it&#8217;s not as bad as I first feared, but as I noted above, you need to be very careful about how you code and run scripts in environments where you can&#8217;t predict what snapins are registered and installed.</p>
<p>I suppose you can create the correct shell environment with Export-Console and run your script with:  </p>
<p><code>powershell -psconsolefile xxx.psc1 -noprofile -command myscript.ps1</code></p>
<p>Or if your script requires a snapin, add the snapin in the script and fully qualify each cmdlet you use.</p>
]]></content:encoded>
			<wfw:commentRss>http://ps1.soapyfrog.com/2007/03/06/cmdlet-clashes/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Grrr 1.1 and Big Invaders</title>
		<link>http://ps1.soapyfrog.com/2007/02/26/grrr-11-and-big-invaders/</link>
		<comments>http://ps1.soapyfrog.com/2007/02/26/grrr-11-and-big-invaders/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 16:29:41 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Announce]]></category>
		<category><![CDATA[Cmdlets]]></category>
		<category><![CDATA[Cool]]></category>
		<category><![CDATA[Grrr]]></category>
		<category><![CDATA[Invaders]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://ps1.soapyfrog.com/2007/02/22/grrr-11-and-big-invaders/</guid>
		<description><![CDATA[So I&#8217;ve been spending a bit of time getting to grips with Cmdlets and resurrecting interest in PSInvaders using Grrr and now have something to post. Grrr 1.1 is now Cmdlet based and comes as a Snap-In. The most obvious benefit from this is performance, as I can now present a playable version of PowerShell [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been spending a bit of time getting to grips with Cmdlets and resurrecting interest in <a href="http://ps1.soapyfrog.com/2007/01/02/space-invaders/">PSInvaders</a> using <strong>Grrr</strong> and now have something to post.</p>
<p><strong>Grrr 1.1</strong> is now Cmdlet based and comes as a Snap-In. The most obvious benefit from this is performance, as I can now present a playable version of <strong>PowerShell Big Invaders</strong>.</p>
<p><a href='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/biginvaders-11-inplay.gif' title='BigInvaders 1.1 in play'><img src='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/biginvaders-11-inplay-smooth.jpg' alt='BigInvaders 1.1 in play' /></a></p>
<p>BigInvaders is one of the demo PowerShell scripts that makes use of the Grrr.</p>
<p><strong><a href="http://ps1.soapyfrog.com/downloads/grrr-release-1.1.zip">Download this prerelease version 1.1 of the Grrr snap-in.</a></strong></p>
<p><em>Update: this should now install on Vista &#8211; thanks to Chris Warwick for pointing out some issues</em></p>
<p>There&#8217;s no installer (yet) so to get going, follow this instructions:</p>
<p>Unzip the archive where you want to use it and CD to the top level director where the README file is.</p>
<p>Type: <code>./installgrrr.ps1 -r</code></p>
<p>The <code>-r</code> switch forces it to re-register the snap-in if a (possibly) older version exists. It then adds the snap-in to the current shell.</p>
<p>From here you can CD into the <code>demos</code> directory and run any of the scripts. Each one shows a feature of Grrr, but perhaps the most interesting is in the <code>biginvaders</code> directory.</p>
<p>To run BigInvaders, you need to have a very large console. To achieve this you probably need to set the font size of your console window to 6&#215;8.</p>
<p>If you want sound, you need to install <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=2DA43D38-DB71-4C1B-BC6A-9B6652CD92A3&#038;displaylang=en">DirectX DirectSound</a>. More on why later.</p>
<p>It should work without, silently, but this hasn&#8217;t had much testing as all my XP boxes have it installed <img src='http://ps1.soapyfrog.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  If there are exceptions, start it with the <code>-nosound</code> switch.</p>
<p>Assuming all is well, type <code>./biginvaders.ps1</code> and you should see this title screen:</p>
<p><a href='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/biginvaders-11-intro.gif' title='BigInvaders 1.1 intro screen'><img src='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/biginvaders-11-intro.thumbnail.gif' alt='BigInvaders 1.1 intro screen' /></a></p>
<p>Hit ESC to quit or Space to play. In play, Space fires a missile and arrow keys move left and right. Hit F to toggle FPS display in the top-righthand corner. </p>
<p>The target FPS is 33. I achieve this easily on my MacPro, and my wife&#8217;s Dell (a core 1 duo, 1.66ghz) also just manages.</p>
<p>There are still a few snags to iron out here and I want to add proper PowerShell help and an installer, but it is functional.</p>
<p>I&#8217;ve learned a lot about C#, PowerShell SDK and .NET these last weeks and will write about my findings over the next days. It&#8217;s not all been rosy.</p>
<p>I&#8217;ll also be writing about the features of <strong>Grrr</strong>, and where I want to go with it.</p>
<p>That&#8217;s it for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://ps1.soapyfrog.com/2007/02/26/grrr-11-and-big-invaders/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Grrr, Cmdlets and PSInvaders revival</title>
		<link>http://ps1.soapyfrog.com/2007/02/15/grrr-cmdlets-and-psinvaders-revival/</link>
		<comments>http://ps1.soapyfrog.com/2007/02/15/grrr-cmdlets-and-psinvaders-revival/#comments</comments>
		<pubDate>Thu, 15 Feb 2007 16:09:53 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Announce]]></category>
		<category><![CDATA[Grrr]]></category>
		<category><![CDATA[Invaders]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://ps1.soapyfrog.com/2007/02/15/grrr-cmdlets-and-psinvaders-revival/</guid>
		<description><![CDATA[Still not much happening here, again partly due to being busy with other things, and also the final arrival of my Wii. Anyways, I&#8217;ve almost completed the transition of Grrr to Cmdlets and it&#8217;s looking very promising as this screen shot shows (I get 50fps with only 20% cpu load doing this): I intend to [...]]]></description>
			<content:encoded><![CDATA[<p>Still not much happening here, again partly due to being busy with other things, and also the final arrival of my <a href="http://blog.soapyfrog.com/category/wii/">Wii</a>.</p>
<p>Anyways, I&#8217;ve almost completed the transition of <a href="http://ps1.soapyfrog.com/2007/01/03/grrr/">Grrr</a> to Cmdlets and it&#8217;s looking very promising as this screen shot shows (I get 50fps with only 20% cpu load doing this):</p>
<p><a href='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/grrr-invaders-wip.gif' title='Big Invaders'><img src='http://ps1.soapyfrog.com/wp-content/uploads/2007/02/grrr-invaders-wip.thumbnail.gif' alt='Big Invaders' /></a></p>
<p>I intend to redo the original <a href="http://ps1.soapyfrog.com/2007/01/02/space-invaders/">PSInvaders</a> using Grrr, with more authentic gameplay and original graphics. </p>
<p>The scrolling tilemap support is looking good, so games like Gauntlet, Scramble and Super Mario Brothers should be possible&#8230; all scripted in PowerShell.</p>
<p>So apologies for the low post volume recently and please do watch this space.</p>
]]></content:encoded>
			<wfw:commentRss>http://ps1.soapyfrog.com/2007/02/15/grrr-cmdlets-and-psinvaders-revival/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slow week</title>
		<link>http://ps1.soapyfrog.com/2007/02/09/slow-week/</link>
		<comments>http://ps1.soapyfrog.com/2007/02/09/slow-week/#comments</comments>
		<pubDate>Fri, 09 Feb 2007 09:45:27 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Announce]]></category>
		<category><![CDATA[Grrr]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://ps1.soapyfrog.com/2007/02/09/slow-week/</guid>
		<description><![CDATA[Not much happening here on the blog this week as I&#8217;ve been a bit busy with other things and also on some non-trivial PowerShell projects: A snap-in version of Grrr &#8211; I realised that PowerShell alone is just too slow for it to be useful, so thought I&#8217;d have a go at doing it all [...]]]></description>
			<content:encoded><![CDATA[<p>Not much happening here on the blog this week as I&#8217;ve been a bit busy with other things and also on some non-trivial PowerShell projects:</p>
<ul>
<li>A snap-in version of <a href="http://ps1.soapyfrog.com/category/grrr/">Grrr</a> &#8211; I realised that PowerShell alone is just too slow for it to be useful, so thought I&#8217;d have a go at doing it all as cmdlets in a snap-in. It&#8217;s fairly easy, but I&#8217;m not there yet.</li>
<li>In trying to understand the grammar of PowerShell better (the <a href="http://blogs.msdn.com/powershell/archive/2006/05/10/594535.aspx">documentation</a> is not so great, and Bruce hasn&#8217;t printed his <a href="http://www.manning.com/payette/">book</a> yet), I&#8217;ve started to write an interpreter in Java. I&#8217;ve got a more or less complete AST, and a prototype interpreter, but it&#8217;s slow going (well, I only started 4 days ago, and it&#8217;s in my spare time).</li>
</ul>
<p>Watch this space.</p>
]]></content:encoded>
			<wfw:commentRss>http://ps1.soapyfrog.com/2007/02/09/slow-week/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Grrr&#x21;</title>
		<link>http://ps1.soapyfrog.com/2007/01/03/grrr/</link>
		<comments>http://ps1.soapyfrog.com/2007/01/03/grrr/#comments</comments>
		<pubDate>Wed, 03 Jan 2007 11:30:58 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Cool]]></category>
		<category><![CDATA[Grrr]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://ps1.soapyfrog.com/2007/01/03/grrr/</guid>
		<description><![CDATA[Despite the title, this is not a rant Grrr is a pet project of mine that came after the exploratory work with psinvaders. I was somewhat dissatisfied with myself for doing so much without seeing how else it could be done, especially with respect to drawing of images, animation, etc. So what is Grrr? Grrr [...]]]></description>
			<content:encoded><![CDATA[<p>Despite the title, this is not a rant <img src='http://ps1.soapyfrog.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>  <strong>Grrr</strong> is a pet project of mine that came after the exploratory work with <a href="/2007/01/02/space-invaders/" rel="self" title="Space Invaders">psinvaders</a>. I was somewhat dissatisfied with myself for doing so much without seeing how else it could be done, especially with respect to drawing of images, animation, etc.</p>
<p>  So what is <strong>Grrr</strong>? <strong>Grrr</strong> is a set of functions written in pure PowerShell that let you create playfields with scrolling viewports, draw lines and images, animate and move sprites, and generally be an inappropriate use of the technology.</p>
<p>  The version of <strong>Grrr</strong> discussed in this article can be <a href="/assets/grrr-r84.zip" rel="self">downloaded from here</a>. Updated versions will appear on the <a href="/downloads/" rel="self" title="Downloads">downloads page</a>.<br />
  To use, you write a script of your own and <em>source</em> it with a dot/period, like this:</p>
<p>  <code>. ./grrr.ps1</code></p>
<p>  I suppose you could do this in your <code>$profile</code>, but I prefer to keep things self contained as PowerShell&#8217;s global scope can get very cluttered very fast.</p>
<div style="float:right">
    <a href="/assets/grrr-test.jpg" rel="external"><img alt="grrr-test_thumb" src="http://ps1.soapyfrog.com/wp-content/uploads/2007/01/grrr-test_thumb.jpg" /></a>
  </div>
<p><strong>Testing</strong></p>
<p>In the Grrr distribution, there is a very mini unit test framework called <code>psunit.ps1</code>.</p>
<p>  The script grrr-test.ps1 uses this to unit test grrr.ps1. Hurrah for test-driven development! The picture shows it in action. Click on it to see the full thing.</p>
<p>  To run the test your self, type <code>./grrr-test.ps1</code> in the directory where this is unzipped.</p>
<p>  <strong>Example scripts<br /></strong><br />
  There are three example scripts. Run them like he unit test script.</p>
<div style="float:right">
    <a href="/assets/grrr-demo-scramble.jpg" rel="external"><img alt="grrr-demo-scramble_thumb" src="http://ps1.soapyfrog.com/wp-content/uploads/2007/01/grrr-demo-scramble_thumb.jpg"/></a>
  </div>
<p>
  They are:<br />
  ⁃ <a href="/assets/grrr-demo-clock.jpg" rel="external">grrr-test-clock.ps1</a> &#8211; a simple script that shows back buffering and drawing lines<br />
  ⁃ <a href="/assets/grrr-demo-sprite.jpg" rel="external">grrr-test-sprite.ps1</a> &#8211; shows animation of sprites&#8230; some controlled semi-manually, and one by a motion path<br />
  ⁃ <a href="/assets/grrr-demo-scramble.jpg" rel="external">grrr-test-scramble.ps1</a> &#8211; show the use of tilemaps to produce the effect of paralax scrolling.</p>
<p>  The latter is very slow and really shows up how poor PowerShell by itself performs.</p>
<p>  Have a look at the code, play around with it, tell me it&#8217;s rubbish if you like <img src='http://ps1.soapyfrog.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>  The next steps for this project are adding a proper game loop controller, with key event handling, fps throttling and a few more motion handlers and behaviours &#8211; I&#8217;d like for sprites to be able to look after themselves, eg respond to proximity of others, shoot things, detect walls, etc.</p>
<p>  I also want to make it faster. Maybe with C# inlining, maybe by making these things cmdlets, maybe by doing it all in C# in a custom host application. Who knows.</p>
]]></content:encoded>
			<wfw:commentRss>http://ps1.soapyfrog.com/2007/01/03/grrr/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

