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

<channel>
	<title>Huddled Masses &#187; Scripts</title>
	<atom:link href="http://huddledmasses.org/tag/scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://huddledmasses.org</link>
	<description>You can do more than breathe for free...</description>
	<lastBuildDate>Fri, 27 Apr 2012 05:42:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<cloud domain='huddledmasses.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Searching the PoshCode Repository</title>
		<link>http://huddledmasses.org/searching-the-poshcode-repository/</link>
		<comments>http://huddledmasses.org/searching-the-poshcode-repository/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 12:48:01 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PoshCode]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Searching]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/?p=565</guid>
		<description><![CDATA[I&#8217;ve been having problems with the search functionality on the PoshCOde repository, and I just thought I&#8217;d throw this up here because I just now solved the biggest problem: ranking. Up until now, the results have not been returned in order of relevance &#8212; this is because the search works using MySQL&#8217;s FULLTEXT BOOLEAN search, [...]]]></description>
			<content:encoded><![CDATA[	<p>I&#8217;ve been having problems with the search functionality on the PoshCOde repository, and I just thought I&#8217;d throw this up here because I just now solved the <strong>biggest</strong> problem: ranking. Up until now, the results have not been returned in order of relevance &#8212; this is because the search works using MySQL&#8217;s <a href="http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html"><span class="caps">FULLTEXT</span> BOOLEAN</a> search, which doesn&#8217;t return in relevance order, nor does it return an extra &#8216;score&#8217; column.</p>

	<p>I&#8217;ve fixed that, and weighted the search so that words in the title count more than words in the code by creating a relevance column by hand:</p>

	<div class="sql code sql" style="font-family:monospace;"><br />
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*,</span><br />
<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.3</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span>MATCH<span style="color: #66cc66;">&#40;</span>posttitle<span style="color: #66cc66;">&#41;</span> AGAINST <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'keywords'</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">BOOLEAN</span> MODE<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.8</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span>MATCH<span style="color: #66cc66;">&#40;</span>description<span style="color: #66cc66;">&#41;</span> AGAINST <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'keywords'</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">BOOLEAN</span> MODE<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">+</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1.0</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span>MATCH<span style="color: #66cc66;">&#40;</span>code<span style="color: #66cc66;">&#41;</span> AGAINST <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'keywords'</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">BOOLEAN</span> MODE<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> relevance <br />
<span style="color: #993333; font-weight: bold;">FROM</span> pastebin <span style="color: #993333; font-weight: bold;">WHERE</span> MATCH <span style="color: #66cc66;">&#40;</span>posttitle<span style="color: #66cc66;">,</span>description<span style="color: #66cc66;">,</span>code<span style="color: #66cc66;">&#41;</span> AGAINST <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'keywords'</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">BOOLEAN</span> MODE<span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> relevance <span style="color: #993333; font-weight: bold;">DESC</span> <span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">25</span><br />
&nbsp;</div>

	<p>Incidentally, the <span class="caps">FULLTEXT</span> index means that words shorter than 4 characters don&#8217;t count (I&#8217;m going to try to get this changed, but it&#8217;s an option for MySQL, so it has to be changed in the config file) in the meantime you can search for words using the wildcard character, like: SQL* and it sort-of works.  The PoshCode cmdlet actually was adding *&#8216;s to the query (although I&#8217;ve just decided that&#8217;s not a good idea, because it means that queries from the cmdlet appear to have different results than queries on the website.</p>

	<p>MySQL&#8217;s <a href="http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html"><span class="caps">FULLTEXT</span> BOOLEAN</a> search has all sorts of features (and limitations): there is a stopword list, maximum and minimum word lengths, and all sorts of operators for setting word precedence or negating words, or weighting them negatively &#8230; to <span class="caps">REQUIRE</span> that a word be present, it must have a + in front, and in order to mark a word as more important, you have to put > in front, not just put it first&#8230; I&#8217;ve been thinking about trying to apply a few of those tricks myself (eg: put * on words under four characters, and put > on the first 30% of words and < on the last 30% to try to simulate weighting them &#8230;) but my original feeling was that the search is more powerful if you just know that it&#8217;s a fulltext boolean search and can write your queries accordingly.</p>

	<p>If anyone has any ideas for how to improve search in MySQL &#8230; or opinions on whether I should try to apply boolean operators to queries which don&#8217;t already have them &#8230; please let me know.</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/searching-the-poshcode-repository/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RSS Feed for PowerShell Script Repository</title>
		<link>http://huddledmasses.org/rss-feed-for-powershell-script-repository/</link>
		<comments>http://huddledmasses.org/rss-feed-for-powershell-script-repository/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 04:31:52 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[Feed]]></category>
		<category><![CDATA[Pastebin]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Recent]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/?p=549</guid>
		<description><![CDATA[There are two requests that I get with overwhelming regularity for the PowerShell script repository: first, that I would add some sort of &#8220;browsing&#8221; functionality, and second, that it should have an RSS feed. Well, browsing may have to wait until a future iteration of the repository, but feeds are easy, because they&#8217;re basically just [...]]]></description>
			<content:encoded><![CDATA[	<p>There are two requests that I get with overwhelming regularity for the PowerShell script repository: first, that I would add some sort of &#8220;browsing&#8221; functionality, and second, that it should have an <span class="caps">RSS</span> feed. Well, browsing may have to wait until a future iteration of the repository, but feeds are easy, because they&#8217;re basically just a hack-up of the &#8220;recent&#8221; items that are in the repository sidebar already, so I did it this evening.</p>

	<h2>Presenting &#8230;</h2>

	<p><a href="http://PowerShellCentral.com/scripts/feed">PowerShellCentral.com/scripts/feed</a></p>

	<p>Right now the number of items is limited to <em>about</em> ten, but if traffic picks up I can increase that easily &#8212; you can limit the count by passing the number of items you want to list like this: <a href="http://powershellcentral.com/scripts/feed.php?list=2">?list=2</a>.</p>

	<p>You can also create a feed for specific search results (the feed will show items in relevance order, but the date is in the <span class="caps">RSS</span> so if you want to sort by that, you can).  For instance, if you wanted to keep up to date on scripts that used SecureStrings, you would append your search terms like this: <a href="http://powershellcentral.com/scripts/feed?q=*securestring*">?q=*securestring*</a>.   <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':)' class='wp-smiley' /> </p>

	<p>As usual, my modifications to the PasteBin.com site are available <a href="http://PowerShellCentral.com/scripts/pastebin.7z">on the repository site</a>, and without much in the way of documentation.  I will say this: in addition to creating the feed.php file, I moved some of the common translation functions into a <em>translate.php</em> file, and modified the dates that were being returned from <em>db.mysql.class.php</em> &#8212; it&#8217;s all under the <a href="http://www.affero.org/oagpl.html">Affero General Public License</a> that <a href="http://blog.dixo.net/category/pastebin/">Paul Dixon</a> wrote <a href="http://PasteBin.com">PasteBin</a> under in the first place.</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/rss-feed-for-powershell-script-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating the PowerShell Script Repository</title>
		<link>http://huddledmasses.org/automating-the-powershell-script-repository/</link>
		<comments>http://huddledmasses.org/automating-the-powershell-script-repository/#comments</comments>
		<pubDate>Fri, 30 May 2008 04:16:39 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[wGet]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/?p=547</guid>
		<description><![CDATA[So, people keep talking about a better PowerShell script repository, and there&#8217;s at least 3 or 4 different people working on improvements, but for now, the one we have is working ok, and already has hundreds of scripts in it &#8212; but there hasn&#8217;t been a way to add or retrieve scripts from within PowerShell. [...]]]></description>
			<content:encoded><![CDATA[	<p>So, people keep talking about a better PowerShell script repository, and there&#8217;s at least 3 or 4 different people working on improvements, but for now, the one we have is working ok, and already has hundreds of scripts in it &#8212; but there hasn&#8217;t been a way to add or retrieve scripts from within PowerShell.</p>

	<p>So while I was taking a break from working on my own replacement script repository  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=';)' class='wp-smiley' />  I whipped up some scripts to <code>Send-Paste</code>, <code>Get-Paste</code> and <code>Find-Paste</code>.  These scripts still need some work, but I think you&#8217;ll find them useful, so I&#8217;ve posted a version that is compatible with PowerShell v1 (and works fine on the 2.0 <span class="caps">CTP</span>) and doesn&#8217;t need any additional scripts (it <em>includes</em> the latest <a href="http://powershellcentral.com/scripts/417">Get-WebFile</a> script for downloading the files).</p>

	<p>The <code>Find-Paste</code> function takes a search string, and adds wildcards &#8212; but otherwise performs the same search as you can already do on the web page. It returns the results in a PowerShell friendly PSObject which by default is just displayed in the host.  </p>

	<p>In order to download a script using <code>Get-Paste</code>, you must know the ID of the script &#8212; which you can get from the output of Find-Paste.  Note that because Find-Paste does a full-text search, you may get results that are not the script you&#8217;re looking for (if they call that script, for instance), and you may get many versions of the script (and newer versions are not necessarily at the top of the search results).</p>

	<p>The <code>Send-Paste</code> script is most useful for sending things to the <a href="http://posh.Jaykul.com/p/">temporary PowerShell pastebin on my site</a> but can be used successfully to send scripts to the permanent <a href="http://PowerShellCentral.com/scripts/">PowerShell Script Repository</a> &#8230; in fact, that&#8217;s how I uploaded the <a href='http://HuddledMasses.org/automating-the-powershell-script-repository/pastebin/' rel='attachment wp-att-550'>PowerShell Pastebin Functions</a> <a href="http://powershellcentral.com/scripts/421">to the repository</a> &#8230; you just have to be careful to specify the title and description when you do that. <strong>Edit</strong>: I attached the script <a href="http://huddledmasses.org/wordpress/wp-content/uploads/2008/06/pastebin.ps1">here on my site</a> also because I made a mistake and deleted the original copy from the repository.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt='[new]' class='wp-smiley' /> </p>

	<p>So, you now have something a little bit more like a proper script repository.  Hopefully the <em>Usage</em> comments in the script will be enough to help you figure out how to use the various commands, (and I did blog about the <a href="http://huddledmasses.org/powershell-send-paste-script/">Send-Paste</a> script about a month ago) but just in case you need help, let me give you a simple example.</p>

	<p>Suppose I need to find a script to encrypt text so I can store some SecureString objects (like the passwords in a PSCredential object) in a file&#8230;</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">100</span><span style="color: #333;">&#93;</span>: <span style="color: #0066cc; font-style: italic;">Find-<span style="font-style: normal;">Paste</span></span> encrypt<br />
<br />
Id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">116</span><br />
Title &nbsp; &nbsp; &nbsp; : <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span><br />
Description : Functions to encrypt <span style="color: #333399; font-weight: bold; font-style: italic;">and</span> decrypt strings <span style="color: #666699; font-weight: bold;">using</span> the Rijndael symmetric key algorithm<br />
Author &nbsp; &nbsp; &nbsp;: Joel Bennett<br />
Date &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">133</span> days ago<br />
Link &nbsp; &nbsp; &nbsp; &nbsp;: http:<span style="color: #66cc66;">//</span>powershellcentral.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>scripts<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">116</span><br />
<br />
Id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">416</span><br />
Title &nbsp; &nbsp; &nbsp; : Pastebin Functions<br />
Description : <span style="color: #0066cc; font-style: italic;">Send-<span style="font-style: normal;">Paste</span></span>, <span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Paste</span></span>, <span style="color: #333399; font-weight: bold; font-style: italic;">and</span> <span style="color: #0066cc; font-style: italic;">Find-<span style="font-style: normal;">Paste</span></span> ... <span style="color: #003366;">to</span> let you use PowerShellCentral.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>Scripts a little bit <span style="color: #660033;">more</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #333399; font-weight: bold; font-style: italic;">like</span> CPAN <span style="color: #666699; font-weight: bold;">while</span> you wait <span style="color: #666699; font-weight: bold;">for</span> us to get our act together <span style="color: #333399; font-weight: bold; font-style: italic;">and</span> give you something better. :<span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IMPORTANT NOTE: the <span style="color: #0066cc; font-style: italic;">Send-<span style="font-style: normal;">Paste</span></span> script defaults to our <span style="color: #66cc66;">*</span>temporary<span style="color: #66cc66;">*</span> pastebin site because we <span style="color: #666699; font-weight: bold;">do</span> <span style="color: #333399; font-weight: bold; font-style: italic;">not</span> want <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; you to fill up the central pastebin site with snippets ... <span style="color: #003366;">but</span> the other two default to the main long<span style="color: #66cc66;">-</span>term <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; script repository.<br />
<span style="color: #003366;">Author</span> &nbsp; &nbsp; &nbsp;: Joel Bennett<br />
Date &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">1</span> hour ago<br />
Link &nbsp; &nbsp; &nbsp; &nbsp;: http:<span style="color: #66cc66;">//</span>powershellcentral.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>scripts<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">416</span></div>

	<p>It looks like I found two, but clearly the second one is not the right one (I mentioned this in one of my examples in the pastebin scripts, and amusingly enough, that screwed up my example). So to download the script I want, I just do:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">101</span><span style="color: #333;">&#93;</span>: <span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Paste</span></span> <span style="color: #cc66cc;">116</span> <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span>.<span style="color: #003366;">ps1</span><br />
<br />
&nbsp; &nbsp; Directory: Microsoft.<span style="color: #003366; font-weight: bold;">PowerShell</span>.<span style="color: #003366;">Core</span>\FileSystem::<span style="color: #003366;">C</span>:\Users\Joel\Documents\WindowsPowerShell\Scripts<br />
<br />
Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LastWriteTime &nbsp; &nbsp; &nbsp; Length Name<br />
<span style="color: #66cc66;">----</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">-------------</span> &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">------</span> <span style="color: #66cc66;">----</span><br />
<span style="color: #66cc66;">-</span>a<span style="color: #66cc66;">---</span> &nbsp; &nbsp; <span style="color: #cc66cc;">5</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">30</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2008</span> <span style="color: #cc66cc;">12</span>:<span style="color: #cc66cc;">23</span> AM &nbsp; &nbsp; <span style="color: #cc66cc;">2.378</span> KB <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span>.<span style="color: #003366;">ps1</span></div>

	<p>Simple enough, right? I could have used the -Passthru option to <em>see</em> the script in the console, but since I was pretty sure it was the only one that might be useful (and since using -Passthrough just to display it on the console would mean downloading it a second time, if I actually wanted it).  Another option would be to use the Tee-Object cmdlet, which would let us download it, show it in the host, and also save it in the file, all at once!  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':)' class='wp-smiley' /> </p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Paste</span></span> <span style="color: #cc66cc;">116</span> <span style="color: #000066;">-Passthru</span> <span style="color: #66cc66;">|</span> <span style="color: #660033;">tee</span> <span style="color: #000066;">-file</span> <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span>.<span style="color: #003366;">ps1</span></div>

	<p>Incidentally, I have a version of this which uses my <a href="http://huddledmasses.org/get-web-another-round-of-wget-for-powershell/">PoshHttp snapin and Get-Web cmdlet</a>, but it&#8217;s also written as a module and therefore requires PowerShell 2.0 CTP2 &#8212; for various reasons, I&#8217;m choosing to release that one separately later.  If you <strong>are</strong> using the <span class="caps">CTP</span>, you could take advantage of the <span class="caps">WPF</span> UI abilities and try piping <code>Find-Script ... | &#34;Select-Grid&#34;:http://huddledmasses.org/wpf-from-powershell-select-grid/ | Get-Script</code> to pick the script you want visually.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':-D' class='wp-smiley' /> </p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/automating-the-powershell-script-repository/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

