<?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>Source Allies Blog &#187; Scripting</title>
	<atom:link href="http://blogs.sourceallies.com/category/scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.sourceallies.com</link>
	<description>Technical and process thinking from Source Allies employees</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:40:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Greasemonkey</title>
		<link>http://blogs.sourceallies.com/2011/02/greasemonkey/</link>
		<comments>http://blogs.sourceallies.com/2011/02/greasemonkey/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 19:07:11 +0000</pubDate>
		<dc:creator>David Kessler</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=1730</guid>
		<description><![CDATA[Greasemonkey is an extension for Firefox that leverages javascript to modify the look and functionality of a page.  At first glance this tool looks like a neat toy.  However, this tool came in quite handy at one of our clients recently.
Our client was tracking their daily status on a whiteboard in a conference [...]]]></description>
			<content:encoded><![CDATA[<p>Greasemonkey is an extension for Firefox that leverages javascript to modify the look and functionality of a page.  At first glance this tool looks like a neat toy.  However, this tool came in quite handy at one of our clients recently.</p>
<p>Our client was tracking their daily status on a whiteboard in a conference room.  A corporate memo was sent out banning the exclusive use of whiteboards for teams.  As a result we turned to our web-based tracking tool.  Unfortunately their whiteboard equivalent was clunky and inadequate.  I spent a few hours putting together a Greasemonkey script that altered the look of this page to mimic our old whiteboard.  These changes helped ease this transition.<br />
<span id="more-1730"></span><br />
Let&#8217;s walk through a simple example to change the behavior of the base Google search page.</p>
<ol>
<li> Download and install Greasemonkey from <a href="https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/">https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/</a></li>
<li> Navigate to <a href="http://www.google.com">www.google.com</a> </li>
<li> Tools &#8211; &gt; Greasemonkey -&gt; New User Script&#8230;</li>
<li> Enter a name</li>
<li> Enter a namespace (This is provided so your scripts do not clash with others)</li>
<li> Verify that the Includes contain &#8216;http://www.google.com/&#8217;</li>
<li> A new js file will open in your default text editor.</li>
<li> The script will contain a comment that reflects the values that you entered</li>
<li> Add the following code</li>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">GM_addStyle<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\</span>
    body{<span style="color: #000099; font-weight: bold;">\</span>
        background-image:url('http://upload.wikimedia.org/wikipedia/en/d/d3/Gm_icon.png');<span style="color: #000099; font-weight: bold;">\</span>
    }<span style="color: #000099; font-weight: bold;">\</span>
&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<li> GM_addStyle is method provided by the Greasemonkey API. (<a href='http://wiki.greasespot.net/Greasemonkey_Manual:API' target="_blank">http://wiki.greasespot.net/Greasemonkey_Manual:API</a>)</li>
<li> Save the script and refresh &#8216;www.google.com&#8217;</li>
<li> You should see grease monkeys all over the page.</li>
<li> Now add the following code</li>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;I have been modified by Greasemonkey.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<li> Save the script and refresh &#8216;www.google.com&#8217;</li>
<li> You should see an alert box with the text above.</li>
</ol>
<p>While this is a trivial example you can begin to imagine the possibilities.  One of my colleagues used greasemonkey to modify a monitoring page.  Before his modification it took three clicks to get the detailed information.  We used this page every day all day to monitor our tests.  After we installed his greasemonkey script we could just click on a new link that was generated.  This seems like a trivial example, but we found that a number of these modifications helped us be more efficient and improved our quality of life.  As a developer I hate repetitive tasks.  I have a deep desire to automate everything.  Greasemonkey empowers us to make the World Wide Web our own.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2011/02/greasemonkey/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>First Glance at PowerShell</title>
		<link>http://blogs.sourceallies.com/2010/07/first-glance-at-powershell/</link>
		<comments>http://blogs.sourceallies.com/2010/07/first-glance-at-powershell/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 20:15:50 +0000</pubDate>
		<dc:creator>Max  Kuipers</dc:creator>
				<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=1524</guid>
		<description><![CDATA[A couple days ago I had the surprisingly excellent opportunity to learn and use Windows PowerShell&#8230; What? Don&#8217;t look at me like that. I disapprove of Microsoft just as much as the next Linux fanboy, but seriously, this was cool. Just give me a chance to explain. I swear, I was forced into the situation [...]]]></description>
			<content:encoded><![CDATA[<p>A couple days ago I had the surprisingly excellent opportunity to learn and use <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx">Windows PowerShell</a>&#8230; What? Don&#8217;t look at me like that. I disapprove of Microsoft just as much as the next Linux fanboy, but seriously, this was cool. Just give me a chance to explain. I swear, I was forced into the situation &#8211;  one of the projects I was working on required a simple script be written to rename files on a Windows server, but for various reasons, I couldn&#8217;t use <a href="http://en.wikipedia.org/wiki/Cygwin">Cygwin</a>. After a brief panic attack caused by the realization that I would have to be separated from my beloved Bash, I looked into which scripting language would be best. After an exhaustive, comprehensive, and fully extensive 30-second Google search I found myself with a choice between Powershell and classic Batch&#8230; Naturally, I chose Powershell.</p>
<p><span id="more-1524"></span></p>
<p>Most Windows 7 computers come with PowerShell and all the necessary dependencies already installed, so I never actually had to install it, but from what I&#8217;ve read the setup is fairly simple &#8211; you just sort of install it.  You also get a little IDE called Powershell ISE which is basically just your standard, 3-pane scripting IDE (with a command-line interpreter in one pane, the output in another, and a third pane for writing and saving scripts.)</p>
<p>I tried my standard approach of consulting forums and the <a href="http://msdn.microsoft.com/en-us/library/default.aspx">MSDN library</a> for a little while but it seemed most of the documentation I could find was either circular and self-referencing or written by some rabid Microsoft fanatic who was so hopelessly drunk on the M$ Kool-Aid that every other word they wrote was some special Microsoft technology or practice. After about a half hour of reading online documentation, all that I really learned was that commands in PowerShell are called &#8220;cmdlets.&#8221; It&#8217;s not clear what the distinction is between a cmdlet and your standard Bash command in Linux, but I guess I&#8217;ve seen more pathetic cries for attention in the Windows world than this.</p>
<p>Slightly dismayed at my lack of progress in learning much from my usual way, I considered the much suggested <code>get-help</code> cmdlet&#8230;</p>
<p><strong>UGH</strong> Ok, I&#8217;m just going to stop right here, I can&#8217;t make it any further calling these things &#8220;cmdlets.&#8221; Call me stubborn, or close-minded, but this is just ridiculous.  I&#8217;m calling them &#8220;commands.&#8221;</p>
<p>&#8230;Anyways, silly nomenclature aside, this <code>get-help</code> command is kind of like a &#8220;man&#8221; page to a Linux user, it displays the syntax, description, and examples for any command in PowerShell. The get-help command is in some ways even a little more clever than man pages. For instance, I needed to know how to create a new directory so first thing I tried was <code>get-help mkdir</code>. While <code>mkdir</code> is not a command in PowerShell, nor does it even have a directly analogous single-command counterpart in PowerShell, it recognized what I was asking for and brought me to the page for the <code>New-Item</code> command which has a <code>-type directory</code> flag you can use to make a new directory.  With this command, I was able to learn anything I needed to learn to make my script happen.</p>
<p>There were, of course, a few more bumps in the road, but nothing too serious; string manipulation is distinctly different from most other languages, and there was some difficulty in getting the permissions (or execution-policy) just right so that I could actually run the script.  All-in-all, it took me about four hours to get the environment set up, learn enough of the language to be productive, and finally write and test the script I needed.  Despite the handicap that it is a Microsoft-specific product, Powershell sincerely surprised me by being a fairly easy-to-learn and useful scripting language.  I really only got to use a very small part of the language, but nonetheless, I would recommend Powershell to anyone who needs to write a script in Windows but cannot use Cygwin.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/07/first-glance-at-powershell/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

