<?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>Development in a Blink &#187; Python</title>
	<atom:link href="http://www.dougfinke.com/blog/index.php/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dougfinke.com/blog</link>
	<description>Researching the optimal; implementing the practical</description>
	<lastBuildDate>Fri, 03 May 2013 19:47:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Creating a PowerShell Translate Function</title>
		<link>http://www.dougfinke.com/blog/index.php/2013/03/31/creating-a-powershell-translate-function/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2013/03/31/creating-a-powershell-translate-function/#comments</comments>
		<pubDate>Sun, 31 Mar 2013 17:40:14 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/?p=1528</guid>
		<description><![CDATA[The Python language has a translate and maketrans function that are typically used in substitution ciphers. translate The method translate() returns a copy of the string in which all characters have been translated using table (constructed with the maketrans() function in the string module), optionally deleting all characters found in the string deletechars. maketrans The [...]]]></description>
				<content:encoded><![CDATA[<p>The Python language has a <strong><em><a href="http://www.tutorialspoint.com/python/string_translate.htm">translate</a></em></strong> and <strong><em><a href="http://www.tutorialspoint.com/python/string_maketrans.htm">maketrans</a></em></strong> function that are typically used in <a href="http://en.wikipedia.org/wiki/Substitution_cipher">substitution ciphers</a><em><strong></strong></em>.</p>
<table cellspacing="0" cellpadding="2" width="551" border="0">
<tbody>
<tr>
<td valign="top" width="200"><a href="http://www.tutorialspoint.com/python/string_translate.htm">translate</a></td>
<td valign="top" width="349">The method <b><a href="http://www.tutorialspoint.com/python/string_translate.htm">translate</a>()</b> returns a copy of the string in which all characters have been translated using <i>table</i> (constructed with the <a href="http://www.tutorialspoint.com/python/string_maketrans.htm">maketrans</a>() function in the string module), optionally deleting all characters found in the string <i>deletechars</i>.           </td>
</tr>
<tr>
<td valign="top" width="200"><a href="http://www.tutorialspoint.com/python/string_maketrans.htm">maketrans</a></td>
<td valign="top" width="349">The method <b><a href="http://www.tutorialspoint.com/python/string_maketrans.htm">maketrans</a>()</b> returns a translation table that maps each character in the <i>intab</i> string into the character at the same position in the <i>outtab</i> string. Then this table is passed to the <a href="http://www.tutorialspoint.com/python/string_translate.htm">translate</a>() function.</td>
</tr>
</tbody>
</table>
<h3>Using it in PowerShell</h3>
<p>I created two PowerShell functions to mirror the Python ones <strong><em>Invoke-Translate</em></strong>&#160; and <em><strong>New-TranslationTable</strong></em>.</p>
<p>The following example shows the usage of&#160; <strong><em>Invoke-Translate</em></strong>. Here, every vowel in a string is replaced by its vowel position.</p>
<pre class="PowerShellColorizedScript" style="height: 178px; width: 542px"><span style="color: #ff4500">$InputTable</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;aeiou&quot;</span>            
<span style="color: #ff4500">$OutputTable</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;12345&quot;</span>            
<span style="color: #ff4500">$TranslationTable</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">New-TranslationTable</span> <span style="color: #ff4500">$InputTable</span> <span style="color: #ff4500">$OutputTable</span>            
            
<span style="color: #ff4500">$string</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;this is string example....wow!!!&quot;</span><span style="color: #000000">;</span>            
            
<span style="color: #0000ff">Invoke-Translate</span> <span style="color: #ff4500">$string</span> <span style="color: #ff4500">$TranslationTable</span>             
                      
<span style="color: #006400">th3s 3s str3ng 2x1mpl2....w4w!!!</span>            </pre>
<p>This example deletes all &#8216;x&#8217; and &#8216;m&#8217; characters from the string before doing the translate.</p>
<pre class="PowerShellColorizedScript" style="height: 167px; width: 551px"><span style="color: #ff4500">$InputTable</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;aeiou&quot;</span>            
<span style="color: #ff4500">$OutputTable</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;12345&quot;</span>            
<span style="color: #ff4500">$TranslationTable</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">New-TranslationTable</span> <span style="color: #ff4500">$InputTable</span> <span style="color: #ff4500">$OutputTable</span>            
            
<span style="color: #ff4500">$string</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;this is string example....wow!!!&quot;</span><span style="color: #000000">;</span>            
            
<span style="color: #0000ff">Invoke-Translate</span> <span style="color: #ff4500">$string</span> <span style="color: #ff4500">$TranslationTable</span> <span style="color: #8b0000">'xm'</span>             
            
<span style="color: #006400">th3s 3s str3ng 21pl2....w4w!!!</span></pre>
<h3>Grab the PowerShell Script</h3>
<p><a href="http://goo.gl/TX7vp"><img title="Octocat" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: left; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="Octocat" align="left" src="http://www.dougfinke.com/blog/wp-content/uploads/2013/03/Octocat.jpg" width="86" height="72" /></a></p>
<p>The PowerShell script is <a href="http://goo.gl/TX7vp">here on GitHub</a>.</p>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2013/03/31/creating-a-powershell-translate-function/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to find the second to last Friday in December&#8211;Using PowerShell</title>
		<link>http://www.dougfinke.com/blog/index.php/2011/12/17/how-to-find-the-second-to-last-friday-in-decemberusing-powershell/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2011/12/17/how-to-find-the-second-to-last-friday-in-decemberusing-powershell/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 14:19:04 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[NumPy]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/12/17/how-to-find-the-second-to-last-friday-in-decemberusing-powershell/</guid>
		<description><![CDATA[&#160; &#160; I am reading and reviewing NumPy 1.5 Beginner’s Guide. I like the examples the author presents and I figured I’d reproduce some using PowerShell. &#160; &#160; PowerShell Code Here is one: From a date range, display the second to last Friday. I foreach over a range of numbers, starting with an initial date [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.packtpub.com/numpy-1-5-using-real-world-examples-beginners-guide/book"><img style="margin: 5px 0px 0px; display: inline; float: left" align="left" src="https://www.packtpub.com/sites/default/files/imagecache/productview/5306OS_NumPy%201.5_FrontCover.jpg" width="185" height="223" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>I am reading and reviewing <a href="http://www.dougfinke.com/blog/index.php/2011/11/22/numpy-1-5-beginners-guide/">NumPy 1.5 Beginner’s Guide</a>. I like the examples the author presents and I figured I’d reproduce some using PowerShell. </p>
<p>&#160;</p>
<h3>&#160;</h3>
<h3>PowerShell Code</h3>
<p>Here is one: From a date range, display the second to last Friday.</p>
<p>I <em>foreach</em> over a range of numbers, starting with an initial date (in the <em>Begin Block</em> of the ForEach), adding a day each time through the loop (in the <em>Process Block</em> of the ForEach), picking out only the Friday dates with the <em>Where </em>cmdlet. This returns an array of dates, so I use array slicing to display the second to last element using [-2]. </p>
<pre style="width: 424px; height: 160px" class="PowerShellColorizedScript"><span style="color: #000000">(</span><span style="color: #800080">1</span><span style="color: #a9a9a9">..</span><span style="color: #800080">31</span> <span style="color: #a9a9a9">|</span>             
    <span style="color: #0000ff">ForEach</span> <span style="color: #000000">{</span><span style="color: #ff4500">$date</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">Get-Date</span><span style="color: #000000">(</span><span style="color: #8b0000">&quot;11/30/11&quot;</span><span style="color: #000000">)</span><span style="color: #000000">}</span> <span style="color: #000000">{</span>            
        <span style="color: #ff4500">$date</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$date</span><span style="color: #a9a9a9">.</span><span style="color: #000000">AddDays</span><span style="color: #000000">(</span><span style="color: #800080">1</span><span style="color: #000000">)</span>            
        <span style="color: #ff4500">$date</span>            
    <span style="color: #000000">}</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Where</span> <span style="color: #000000">{</span><span style="color: #ff4500">$_</span><span style="color: #a9a9a9">.</span><span style="color: #000000">DayOfWeek</span> <span style="color: #a9a9a9">-eq</span> <span style="color: #8b0000">&quot;Friday&quot;</span><span style="color: #000000">}</span><span style="color: #000000">)</span><span style="color: #a9a9a9">[</span><span style="color: #800080">-2</span><span style="color: #a9a9a9">]</span>            
            
<span style="color: #006400"># Prints</span>            
<span style="color: #8b0000">Friday, December 23, 2011 12:00:00 AM</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2011/12/17/how-to-find-the-second-to-last-friday-in-decemberusing-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>NumPy 1.5 Beginner&#8217;s Guide</title>
		<link>http://www.dougfinke.com/blog/index.php/2011/11/22/numpy-1-5-beginners-guide/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2011/11/22/numpy-1-5-beginners-guide/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 23:39:49 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[IronPython]]></category>
		<category><![CDATA[NumPy]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SciPy]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/11/22/numpy-1-5-beginners-guide/</guid>
		<description><![CDATA[I’ve been invited to review the new NumPy book. NumPy (from Numerical Python) is an open source Python library for scientific computing. NumPy lets you work with arrays and matrices in a natural way. I blogged about NumPy and SciPy for IronPython / #.Net. These libraries have be been optimized and provided custom .Net interfaces. [...]]]></description>
				<content:encoded><![CDATA[<p>I’ve been invited to review the new <a href="http://www.packtpub.com/sites/default/files/5306OS-Chapter-3-Get-into-Terms-with-Commonly-Used-Functions.pdf?utm_source=packtpub&amp;utm_medium=free&amp;utm_campaign=pdf">NumPy book</a>. </p>
<blockquote><p>NumPy (from Numerical Python) is an open source Python library for scientific      <br />computing. NumPy lets you work with arrays and matrices in a natural way.</p>
</blockquote>
<p>I blogged about <a href="http://www.dougfinke.com/blog/index.php/2011/03/10/numpy-and-scipy-for-ironpython-net/">NumPy and SciPy for IronPython / #.Net</a>. These libraries have be been optimized and provided custom .Net interfaces. This means that the full functionality is available to all .Net languages.</p>
<p>That means PowerShell, so I’m interested.</p>
<p>NumPy contains a long list of useful mathematical functions including some for linear algebra,    <br />Fourier transformation, and random number generation routines. NumPy allows rapid interactive prototyping.</p>
<p><a href="http://www.packtpub.com/sites/default/files/5306OS-Chapter-3-Get-into-Terms-with-Commonly-Used-Functions.pdf?utm_source=packtpub&amp;utm_medium=free&amp;utm_campaign=pdf"><a href="http://www.packtpub.com/numpy-1-5-using-real-world-examples-beginners-guide/book"><img style="display: inline; float: right" align="right" src="https://www.packtpub.com/sites/default/files/imagecache/productview/5306OS_NumPy%201.5_FrontCover.jpg" width="209" height="252" /></a>Here is a sample chapter</a> from the book. Python has been around since the early 90’s and their open source libraries are very mature and can shortcut plenty of work.&#160; That coupled with IronPython for .Net means a potentially seamless integration with PowerShell. NymPy is used by scientists, engineers, quantitative data analysts and more.</p>
<p>I am looking forward to learning more about how to use it and where it is applied.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2011/11/22/numpy-1-5-beginners-guide/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Design Patterns in Dynamic Languages&#8211;PowerShell</title>
		<link>http://www.dougfinke.com/blog/index.php/2011/11/09/design-patterns-in-dynamic-languagespowershell/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2011/11/09/design-patterns-in-dynamic-languagespowershell/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 01:06:47 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Dynamic Languages]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Neal Ford]]></category>
		<category><![CDATA[Peter Norvig]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2011/11/09/design-patterns-in-dynamic-languagespowershell/</guid>
		<description><![CDATA[I was Googling for the Strategy Pattern and implementations done in dynamic languages and came across Neal Ford’s slides where he implements it in Groovy. Here are Peter Norvig’s slides, Design Patterns in Dynamic Languages, in it he states that 16 of the 23 GoF patterns have qualitatively simpler implementations in dynamic languages. Mr. Norvig [...]]]></description>
				<content:encoded><![CDATA[<p>I was Googling for the <a href="http://en.wikipedia.org/wiki/Strategy_pattern">Strategy Pattern</a> and implementations done in dynamic languages and came across <a href="http://www.hjug.org/present/Neal_Ford-Design_Patterns_in_Dynamic_Languages-slides.pdf">Neal Ford’s slides</a> where he implements it in <a href="http://groovy.codehaus.org/">Groovy</a>. Here are <a href="http://norvig.com/design-patterns/">Peter Norvig’s slides</a>, Design Patterns in Dynamic Languages, in it he states that 16 of the 23 <a href="http://en.wikipedia.org/wiki/Design_Patterns">GoF patterns</a> have qualitatively simpler implementations in dynamic languages. Mr. Norvig is Director of Research at Google.</p>
<p>One of Neal Ford’s slides captures the idea.</p>
<p><a href="http://www.dougfinke.com/blog/wp-content/uploads/2011/11/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/11/image_thumb.png" width="440" height="306" /></a></p>
<h3>The Strategy Pattern</h3>
<p>Formally speaking, the strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.</p>
<pre class="PowerShellColorizedScript"><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: #00008b">function</span> <span style="color: #8a2be2">CalcByMult</span> <span style="color: #000000">{</span>            
    <span style="color: #00008b">param</span><span style="color: #000000">(</span><span style="color: #ff4500">$n</span><span style="color: #a9a9a9">,</span><span style="color: #ff4500">$m</span><span style="color: #000000">)</span>             
            
    <span style="color: #ff4500">$n</span><span style="color: #a9a9a9">*</span><span style="color: #ff4500">$m</span>            
<span style="color: #000000">}</span>            
            
<span style="color: #00008b">function</span> <span style="color: #8a2be2">CalcByManyAdds</span> <span style="color: #000000">{</span>            
    <span style="color: #00008b">param</span><span style="color: #000000">(</span><span style="color: #ff4500">$n</span><span style="color: #a9a9a9">,</span><span style="color: #ff4500">$m</span><span style="color: #000000">)</span>            
                
    <span style="color: #800080">1</span><span style="color: #a9a9a9">..</span><span style="color: #ff4500">$n</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">%</span> <span style="color: #000000">{</span><span style="color: #ff4500">$result</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">0</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: #ff4500">$m</span> <span style="color: #000000">}</span> <span style="color: #000000">{</span><span style="color: #ff4500">$result</span><span style="color: #000000">}</span>            
<span style="color: #000000">}</span>            
            
            
<span style="color: #ff4500">$sampleData</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@(</span>            
    <span style="color: #a9a9a9">,</span><span style="color: #000000">(</span><span style="color: #800080">3</span><span style="color: #a9a9a9">,</span><span style="color: #800080">4</span><span style="color: #a9a9a9">,</span><span style="color: #800080">12</span><span style="color: #000000">)</span>            
    <span style="color: #a9a9a9">,</span><span style="color: #000000">(</span><span style="color: #800080">5</span><span style="color: #a9a9a9">,</span><span style="color: #800080">-5</span><span style="color: #a9a9a9">,</span><span style="color: #800080">-25</span><span style="color: #000000">)</span>            
<span style="color: #000000">)</span>            
             
<span style="color: #ff4500">$strategies</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">ql</span> <span style="color: #8a2be2">CalcByMult</span> <span style="color: #8a2be2">CalcByManyAdds</span>            
             
<span style="color: #00008b">foreach</span><span style="color: #000000">(</span><span style="color: #ff4500">$Dataset</span> <span style="color: #00008b">in</span> <span style="color: #ff4500">$sampleData</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">$strategy</span> <span style="color: #00008b">in</span> <span style="color: #ff4500">$strategies</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>            
        <span style="color: #ff4500">$Dataset</span><span style="color: #a9a9a9">[</span><span style="color: #800080">2</span><span style="color: #a9a9a9">]</span> <span style="color: #a9a9a9">-eq</span> <span style="color: #000000">(</span><span style="color: #a9a9a9">&amp;</span> <span style="color: #ff4500">$strategy</span> <span style="color: #ff4500">$Dataset</span><span style="color: #a9a9a9">[</span><span style="color: #800080">0</span><span style="color: #a9a9a9">]</span> <span style="color: #ff4500">$Dataset</span><span style="color: #a9a9a9">[</span><span style="color: #800080">1</span><span style="color: #a9a9a9">]</span><span style="color: #000000">)</span>            
    <span style="color: #000000">}</span>            
<span style="color: #000000">}</span></pre>
<h3>Why Bother with Extra Structure?</h3>
<p>Here I am creating an array of PowerShell script blocks for the strategies, eliminating the ceremony of naming them.</p>
<pre class="PowerShellColorizedScript"><span style="color: #ff4500">$sampleData</span> <span style="color: #a9a9a9">=</span> <span style="color: #000000">@(</span>            
    <span style="color: #a9a9a9">,</span><span style="color: #000000">(</span><span style="color: #800080">3</span><span style="color: #a9a9a9">,</span><span style="color: #800080">4</span><span style="color: #a9a9a9">,</span><span style="color: #800080">12</span><span style="color: #000000">)</span>            
    <span style="color: #a9a9a9">,</span><span style="color: #000000">(</span><span style="color: #800080">5</span><span style="color: #a9a9a9">,</span><span style="color: #800080">-5</span><span style="color: #a9a9a9">,</span><span style="color: #800080">-25</span><span style="color: #000000">)</span>            
<span style="color: #000000">)</span>            
             
<span style="color: #ff4500">$strategies</span> <span style="color: #a9a9a9">=</span>             
<span style="color: #000000">{</span><span style="color: #00008b">param</span><span style="color: #000000">(</span><span style="color: #ff4500">$n</span><span style="color: #a9a9a9">,</span><span style="color: #ff4500">$m</span><span style="color: #000000">)</span> <span style="color: #ff4500">$n</span><span style="color: #a9a9a9">*</span><span style="color: #ff4500">$m</span><span style="color: #000000">}</span><span style="color: #a9a9a9">,</span>            
<span style="color: #000000">{</span>            
    <span style="color: #00008b">param</span><span style="color: #000000">(</span><span style="color: #ff4500">$n</span><span style="color: #a9a9a9">,</span><span style="color: #ff4500">$m</span><span style="color: #000000">)</span>            
    <span style="color: #800080">1</span><span style="color: #a9a9a9">..</span><span style="color: #ff4500">$n</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">%</span> <span style="color: #000000">{</span><span style="color: #ff4500">$result</span> <span style="color: #a9a9a9">=</span> <span style="color: #800080">0</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: #ff4500">$m</span> <span style="color: #000000">}</span> <span style="color: #000000">{</span><span style="color: #ff4500">$result</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">$Dataset</span> <span style="color: #00008b">in</span> <span style="color: #ff4500">$sampleData</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">$strategy</span> <span style="color: #00008b">in</span> <span style="color: #ff4500">$strategies</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>            
        <span style="color: #ff4500">$Dataset</span><span style="color: #a9a9a9">[</span><span style="color: #800080">2</span><span style="color: #a9a9a9">]</span> <span style="color: #a9a9a9">-eq</span> <span style="color: #000000">(</span><span style="color: #a9a9a9">&amp;</span> <span style="color: #ff4500">$strategy</span> <span style="color: #ff4500">$Dataset</span><span style="color: #a9a9a9">[</span><span style="color: #800080">0</span><span style="color: #a9a9a9">]</span> <span style="color: #ff4500">$Dataset</span><span style="color: #a9a9a9">[</span><span style="color: #800080">1</span><span style="color: #a9a9a9">]</span><span style="color: #000000">)</span>            
    <span style="color: #000000">}</span>            
<span style="color: #000000">}</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2011/11/09/design-patterns-in-dynamic-languagespowershell/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>PowerShell Hacker #11</title>
		<link>http://www.dougfinke.com/blog/index.php/2010/08/06/powershell-hacker-11/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2010/08/06/powershell-hacker-11/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 00:07:13 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Blackhat]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[Defcon]]></category>
		<category><![CDATA[Opalis]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PowerShell Hacker]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Splunk]]></category>
		<category><![CDATA[Xml]]></category>

		<guid isPermaLink="false">http://www.dougfinke.com/blog/index.php/2010/08/06/powershell-hacker-11/</guid>
		<description><![CDATA[Test that CouchDB is running in PowerShell &#8211; Apache CouchDB is a document-oriented database PowerShell lets me leverage .Net to do heavy lifting from the command-line 8 Minute Demo &#8211; .NET Scripting Object &#8211; PowerShell! &#8211; Opalis Software, a Toronto-based private company that is a leader in IT process automation software David Kennedy is a [...]]]></description>
				<content:encoded><![CDATA[<ul>
<li><a href="http://codeimpossible.com/2010/08/04/test-that-couchdb-is-running-in-powershell/">Test that CouchDB is running in PowerShell</a> &#8211; Apache <a href="http://couchdb.apache.org/">CouchDB</a> is a document-oriented database </li>
</ul>
<blockquote><p>PowerShell lets me leverage .Net to do heavy lifting from the command-line</p>
</blockquote>
<ul>
<li><a href="http://blogs.technet.com/b/charlesjoy/archive/2010/08/03/8-minute-demo-net-scripting-object-powershell.aspx?utm_source=twitterfeed&amp;utm_medium=twitter">8 Minute Demo &#8211; .NET Scripting Object &#8211; PowerShell!</a> &#8211; Opalis Software, a Toronto-based private company that is a leader in IT process automation software </li>
<li>David Kennedy is a security ninja. He gave his PowerShell talk at Blackhat and Defcon. <a href="http://www.secmaniac.com/july-2010/blackhat-and-defcon-poc-code-released/">Here are the presentation and samples</a> </li>
</ul>
<blockquote><p>This talk was about the powerful ability to perform advanced tasks through PowerShell and how you can utilize PowerShell on penetration tests.</p>
</blockquote>
<ul>
<li><a href="http://www.splunk.com/">Splunk</a> enables you to search, report, monitor and analyze streaming and historical data from any source across your entire IT infrastructure. Plus, a <a href="http://code.google.com/p/splunk-powershell/">Splunk PowerShell snap-in</a>. </li>
<li><a href="http://mechatechzilla.blogspot.com/2010/07/reading-xml-1-powershell-python-and.html">Reading XML in PowerShell, Python and Ruby, oh my!</a> – interesting to see how to work with XML side by side in these languages </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2010/08/06/powershell-hacker-11/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>10 PowerShell Posts I Did in 2009</title>
		<link>http://www.dougfinke.com/blog/index.php/2010/01/01/10-powershell-posts-i-did-in-2009/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2010/01/01/10-powershell-posts-i-did-in-2009/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 20:05:15 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integrated Scripting Environment]]></category>
		<category><![CDATA[Intellipad]]></category>
		<category><![CDATA[ISE]]></category>
		<category><![CDATA[MGrammar]]></category>
		<category><![CDATA[Oslo]]></category>
		<category><![CDATA[Pivot Tables]]></category>
		<category><![CDATA[PowerBoots]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQL Server Modeling]]></category>
		<category><![CDATA[trigrams]]></category>
		<category><![CDATA[Try Python]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[yUML]]></category>

		<guid isPermaLink="false">http://dougfinke.com/blog/index.php/2010/01/01/10-powershell-posts-i-did-in-2009/</guid>
		<description><![CDATA[I had fun doing these PowerShell posts. &#160; Try PowerShell &#8211; An Interactive Tutorial Michael Foord inspired this with his Try Python Silverlight application How to Host PowerShell in a WPF Application A How To video PowerShell Out-ExcelPivotTable &#8211; Quickly Create Pivot Tables in Microsoft Excel Automating Excel Pivot tables with PowerShell PowerShell, An Exercise [...]]]></description>
				<content:encoded><![CDATA[<p>I had fun doing these PowerShell posts.</p>
<p><a href="http://dougfinke.com/blog/index.php/2009/01/10/11th-grade-activities-for-career-success-powershell/"><img style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://dougfinke.com/uploadPictures/MyTop5PowerShellPosts_85B8/image.png" width="454" height="284" /></a>&#160;</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/09/28/try-powershell-an-interactive-tutorial/">Try PowerShell &ndash; An Interactive Tutorial</a></p>
</td>
<td valign="top" width="278">
<p><a href="http://www.voidspace.org.uk/python/weblog/index.shtml">Michael Foord</a> inspired this with his <a href="http://www.trypython.org/">Try Python</a> Silverlight application</p>
</td>
</tr>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/09/02/how-to-host-powershell-in-a-wpf-application/">How to Host PowerShell in a WPF Application</a></p>
</td>
<td valign="top" width="278">
<p>A How To video</p>
</td>
</tr>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/06/24/powershell-out-excelpivottable-quickly-create-pivot-tables-in-microsoft-excel/">PowerShell Out-ExcelPivotTable &ndash; Quickly Create Pivot Tables in Microsoft Excel</a></p>
</td>
<td valign="top" width="278">
<p>Automating Excel Pivot tables with PowerShell</p>
</td>
</tr>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/02/17/powershell-an-exercise-in-species-barcoding/">PowerShell, An Exercise in Species Barcoding</a></p>
</td>
<td valign="top" width="278">
<p>Inspired by Peter Norvig&rsquo;s (Director of research at Google) python version</p>
</td>
</tr>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/02/07/powershell-find-the-k-most-common-words-in-a-file/">PowerShell &ndash; Find the K most common words in a file</a></p>
</td>
<td valign="top" width="278">
<p>Based on Jon Bentley&rsquo;s approach in &ldquo;Little Languages&rdquo;</p>
</td>
</tr>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/02/06/powershell-ise-cream-alias-expansion/">PowerShell ISE-Cream &ndash; Alias Expansion</a></p>
</td>
<td valign="top" width="278">
<p>Uses PowerShell&rsquo;s tokenizer to expand aliases like %, ? etc. into ForEach and Where</p>
</td>
</tr>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/08/29/update-dynamic-guis-and-the-powershell-pipeline/">Update: Dynamic GUIs and the PowerShell Pipeline</a></p>
</td>
<td valign="top" width="278">
<p>How to inject GUIs into a PowerShell Pipeline</p>
</td>
</tr>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/08/20/powershell-yuml-workbench/">PowerShell yUML Workbench</a></p>
</td>
<td valign="top" width="278">
<p>yUML is a web service.&#160; A How To using PowerShell to generate UML diagrams</p>
</td>
</tr>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/07/01/powershell-powerboots-and-an-oslo-dsl-grammar/">PowerShell, PowerBoots and an Oslo DSL Grammar</a></p>
</td>
<td valign="top" width="278">
<p>Blending MGrammar and PowerShell</p>
</td>
</tr>
<tr>
<td valign="top" width="276">
<p><a href="http://dougfinke.com/blog/index.php/2009/05/20/creating-and-displaying-trigrams-with-powershell/">Creating and Displaying Trigrams with PowerShell</a></p>
</td>
<td valign="top" width="278">
<p>Based on Wolfram|Alphas Trigram visuals. Combines PowerShell and yUML</p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2010/01/01/10-powershell-posts-i-did-in-2009/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Programming Windows Azure</title>
		<link>http://www.dougfinke.com/blog/index.php/2009/12/30/programming-windows-azure/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2009/12/30/programming-windows-azure/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 02:38:30 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">http://dougfinke.com/blog/index.php/2009/12/30/programming-windows-azure/</guid>
		<description><![CDATA[Available for pre-order. The author, Sriram Krishnan, has a blog. Plus he has posted Erlang and Python bindings for the Windows Azure storage API. It&#8217;s not often that you get to spearhead the creation of a major new Microsoft API and it feels great to have seen this through from beginning to end]]></description>
				<content:encoded><![CDATA[<p>Available for <a href="http://www.amazon.com/Programming-Windows-Azure-Krishnan-Sriram/dp/0596801971">pre-order</a>. The author, Sriram Krishnan, <a href="http://www.sriramkrishnan.com/blog/">has a blog</a>. Plus he has posted <a href="http://github.com/sriramk/winazureerl/tree/master">Erlang</a> and <a href="http://github.com/sriramk/winazurestorage/tree/master">Python</a> bindings for the Windows Azure storage API.</p>
<blockquote><p>It&rsquo;s not often that you get to spearhead the creation of a major new Microsoft API and it feels great to have seen this through from beginning to end</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2009/12/30/programming-windows-azure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Go Programming Language</title>
		<link>http://www.dougfinke.com/blog/index.php/2009/11/10/the-go-programming-language/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2009/11/10/the-go-programming-language/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 00:24:22 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Go]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://dougfinke.com/blog/index.php/2009/11/10/the-go-programming-language/</guid>
		<description><![CDATA[Presented by Rob Pike, Principal Engineer at Google. He works on distributed systems, data mining, programming languages, and software development tools. Before Google, Rob was a member of the Computing Sciences Research Center at Bell Labs, the lab that developed Unix. While there, he worked on computer graphics, user interfaces, languages, concurrent programming, and distributed [...]]]></description>
				<content:encoded><![CDATA[<p>Presented by Rob Pike, Principal Engineer at Google. </p>
<p>He works on distributed systems, data mining, programming languages, and software development tools. Before Google, Rob was a member of the Computing Sciences Research Center at Bell Labs, the lab that developed Unix. While there, he worked on computer graphics, user interfaces, languages, concurrent programming, and distributed systems. He was an architect of the Plan 9 and Inferno operating systems and is the co-author with Brian Kernighan of <i>The Unix Programming Environment</i> and <i>The Practice of Programming</i>.</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:1443a39d-40fd-4a99-9110-76c65885c7fb" class="wlWriterEditableSmartContent">
<div><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/rKnDgT73v8s&amp;hl=en"></param><embed src="http://www.youtube.com/v/rKnDgT73v8s&amp;hl=en" type="application/x-shockwave-flash" width="425" height="355"></embed></object></div>
</div>
<ul>
<li><a href="http://www.techcrunch.com/2009/11/10/google-go-language/">Google&rsquo;s Go: A New Programming Language That&rsquo;s Python Meets C++</a> </li>
<li><a href="http://news.cnet.com/8301-30685_3-10393210-264.html">Google hopes to remake programming with Go</a> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2009/11/10/the-go-programming-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Function Factory</title>
		<link>http://www.dougfinke.com/blog/index.php/2009/09/12/powershell-function-factory/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2009/09/12/powershell-function-factory/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 15:14:00 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[Code Generation]]></category>
		<category><![CDATA[Function Factory]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://dougfinke.com/blog/index.php/2009/09/12/powershell-function-factory/</guid>
		<description><![CDATA[Reading Managing Records in Python&#160; For many years there was no record type in the Python language [&#8230;] Guido never considered that request [&#8230;] &#34;in real life you always need to add methods to your data, so just use a custom class&#34; In PowerShell you can create property bags two ways, Add-Member and Select-Object. Often [...]]]></description>
				<content:encoded><![CDATA[<p>Reading <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=236637">Managing Records in Python</a>&#160;</p>
<blockquote><p>For many years there was no record type in the Python language [&hellip;] Guido never considered that request [&hellip;] &quot;in real life you always need to add methods to your data, so just use a custom class&quot;</p>
</blockquote>
<p>In PowerShell you can <a href="http://blogs.msdn.com/mediaandmicrocode/archive/2008/11/26/microcode-powershell-scripting-tricks-select-object-note-properties-vs-add-member-script-properties.aspx">create property bags two ways</a>, Add-Member and Select-Object. Often you need a function that takes parameters and returns an object to hold some data.&#160; Typing this out takes time, tweaking and testing.</p>
<p>Below, <em>New-Function </em>generates your function. This example creates a function named <em>New-Pair</em> that takes two parameters, <em>item1</em> and <em>item2</em>.</p>
<p>Notice the next line uses the newly created function.</p>
<pre class="PowerShellColorizedScript"><span style="color: #0000ff">New-Function</span> <span style="color: #8b0000">'New-Pair'</span> <span style="color: #8b0000">'item1 item2'</span>            
            
<span style="color: #0000ff">New-Pair</span> <span style="color: #800080">1</span> <span style="color: #800080">2</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Format-Table</span> <span style="color: #000080">-AutoSize</span></pre>
<p><a href="http://dougfinke.com/uploadPictures/PowerShellFunctionFactory_930C/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://dougfinke.com/uploadPictures/PowerShellFunctionFactory_930C/image_thumb.png" width="109" height="67" /></a>&#160; </p>
<h3>Another Example</h3>
<p><em>New-Function</em> creates a PowerShell function so parameter binding works too.</p>
<pre class="PowerShellColorizedScript"><span style="color: #0000ff">New-Function</span> <span style="color: #000000">`
</span>  <span style="color: #8b0000">'New-Person'</span> <span style="color: #8b0000">'FirstName LastName Address City State Zip'</span>            
            
<span style="color: #0000ff">New-Person</span> <span style="color: #8a2be2">John</span> <span style="color: #8a2be2">Doe</span> <span style="color: #000080">-Zip</span> <span style="color: #800080">10001</span></pre>
</p>
<h3><a href="http://dougfinke.com/uploadPictures/PowerShellFunctionFactory_930C/image_3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://dougfinke.com/uploadPictures/PowerShellFunctionFactory_930C/image_thumb_3.png" width="166" height="122" /></a> </h3>
<h3>The Factory </h3>
<pre class="PowerShellColorizedScript"><span style="color: #00008b">Function</span> <span style="color: #8a2be2">New-Function</span> <span style="color: #000000">(</span><span style="color: #ff4500">$name</span><span style="color: #a9a9a9">,</span> <span style="color: #ff4500">$properties</span><span style="color: #000000">)</span> <span style="color: #000000">{</span>            
    <span style="color: #ff4500">$parts</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$properties</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: #a9a9a9">.</span><span style="color: #000000">split</span><span style="color: #000000">(</span><span style="color: #8b0000">' '</span><span style="color: #000000">)</span>            
    <span style="color: #ff4500">$parts</span> <span style="color: #a9a9a9">|</span>            
        <span style="color: #0000ff">%</span><span style="color: #000000">{</span>            
            <span style="color: #ff4500">$selectProperties</span> <span style="color: #a9a9a9">+=</span> <span style="color: #8b0000">@&quot; 
 @{
            Name = '$_'
            Expression = {`$$_}
        },
&quot;@</span>            
        <span style="color: #000000">}</span>            
            
<span style="color: #006400"># simple way to remove the trailing comma        </span>            
<span style="color: #ff4500">$selectProperties</span> <span style="color: #a9a9a9">=</span> <span style="color: #ff4500">$selectProperties</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: #0000ff">Invoke-Expression</span> <span style="color: #8b0000">@&quot;
Function Global:$name {
param(`$$($parts -join ',$'))
    
New-Object PSObject | 
    select $selectProperties
}        
&quot;@</span>            
<span style="color: #000000">}</span></pre>
<h3>Grab The Code</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.skydrive.live.com/embedicon.aspx/New-Function/New-Function.zip" frameborder="0" marginwidth="0" scrolling="no"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2009/09/12/powershell-function-factory/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PowerShell, Tanimoto Coefficient and Programming Collective Intelligence</title>
		<link>http://www.dougfinke.com/blog/index.php/2008/02/10/powershell-tanimoto-coefficient-and-programming-collective-intelligence/</link>
		<comments>http://www.dougfinke.com/blog/index.php/2008/02/10/powershell-tanimoto-coefficient-and-programming-collective-intelligence/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 20:53:52 +0000</pubDate>
		<dc:creator>Doug Finke</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Collective Intelligence]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Similarity Measures]]></category>

		<guid isPermaLink="false">http://dougfinke.com/blog/?p=339</guid>
		<description><![CDATA[Programming Collective Intelligence is a great read and very approachable.&#160; Toby Segaran&#8217;s new book takes you into the world of machine learning and statistics and explains how to draw conclusions about user experience, marketing, personal tastes and human behavior. Toby presents how to use these algorithms to mine sites like Facebook, MovieLens, Delicious, Blogs and [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.oreilly.com/catalog/9780596529321/">Programming Collective Intelligence</a> is a great read and <a href="http://www.oreilly.com/catalog/9780596529321/"><img style="margin: 20px 30px 0px 0px" alt="Programming Collective Intelligence" src="http://www.oreilly.com/catalog/covers/9780596529321_cat.gif" align="left" border="0"></a>very approachable.&nbsp; </p>
<p><a href="http://kiwitobes.com/">Toby Segaran&#8217;s</a> new book takes you into the world of machine learning and statistics and explains how to draw conclusions about user experience, marketing, personal tastes and human behavior. </p>
<p>Toby presents how to use these algorithms to mine sites like Facebook, MovieLens, Delicious, Blogs and more. </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Also covered:</p>
<ul>
<li>Support-vector machines
<li>Evolving intelligence algorithms
<li>Optimization algorithms</li>
</ul>
<p>The book is a great way to dive deeper into PowerShell (or any language), Python and data mining.</p>
<h3>C# 3.5 version </h3>
<p><a href="http://dougfinke.com/blog/?p=338">HERE</a></p>
<h3>PowerShell Tanimoto</h3>
<pre>param(
  <span style="color: #35687d">$q</span>=(<span style="color: maroon">"shirts"</span>,<span style="color: maroon">"socks"</span>,<span style="color: maroon">"pants"</span>,<span style="color: maroon">"shoes"</span>),
  <span style="color: #35687d">$t</span>=(<span style="color: maroon">"skirts"</span>,<span style="color: maroon">"socks"</span>,<span style="color: maroon">"shoes"</span>)
)

<span style="color: #35687d">$c</span> = <span style="color: #35687d">$q</span> | <span style="color: blue">where</span> {<span style="color: #35687d">$t</span> -eq <span style="color: #35687d">$_</span>}
<span style="color: #35687d">$c</span>.count / (<span style="color: #35687d">$q</span>.count + <span style="color: #35687d">$t</span>.count - <span style="color: #35687d">$c</span>.count)</pre>
<h3>Python Tanimoto</h3>
<pre>def tanimoto(a,b):
  c=[v <span style="color: blue">for</span> v <span style="color: blue">in</span> a <span style="color: blue">if</span> v <span style="color: blue">in</span> b]
  <span style="color: blue">return</span> <span style="color: blue">float</span>(len(c))/(len(a)+len(b)-len(c))</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.dougfinke.com/blog/index.php/2008/02/10/powershell-tanimoto-coefficient-and-programming-collective-intelligence/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
