<?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; Extended</title>
	<atom:link href="http://huddledmasses.org/tag/extended/feed/" rel="self" type="application/rss+xml" />
	<link>http://huddledmasses.org</link>
	<description>You can do more than breathe for free...</description>
	<lastBuildDate>Sat, 28 Jan 2012 21:37:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<cloud domain='huddledmasses.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Google Charts from PowerShell &#8211; Part 1</title>
		<link>http://huddledmasses.org/google-charts-from-powershell-1/</link>
		<comments>http://huddledmasses.org/google-charts-from-powershell-1/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 18:45:51 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[Charting]]></category>
		<category><![CDATA[Extended]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/?p=647</guid>
		<description><![CDATA[Several people have blogged about using the Google charts api from PowerShell, but everyone seems to be using the &#8220;simple&#8221; numerical encoding, so I figured that as the first step of my own google chart api wrapper module I would start out by writing up a simple encoder. I&#8217;m not posting this to the script [...]]]></description>
			<content:encoded><![CDATA[	<p>Several people have blogged about using the Google charts api from PowerShell, but everyone seems to be using the &#8220;simple&#8221; numerical encoding, so I figured that as the first step of my own google chart api wrapper module I would start out by writing up a simple encoder.  I&#8217;m not posting this to the script repository until I&#8217;m done with it &#8212; this is just the number encoding function.  </p>

	<p>But I figured I&#8217;d blog it here in case it will help anyone else write the full wrapper module &#8220;for&#8221; me before I get around to it  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':)' class='wp-smiley' />   In any case, remember this doesn&#8217;t encode numbers higher than 4095, so if you have a bunch of numbers and some of them might be larger than that, you&#8217;ll still need to normalize them so they are within that range.  I&#8217;ll post the function to normalize a series of numbers later this evening, because for some reason I can&#8217;t find it right now, but I&#8217;m sure I already wrote it  <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: #666666; font-style: italic;">## Google Chart API extended value encoding function</span><br />
<span style="color: #666666; font-style: italic;">#########################################################################</span><br />
<span style="color: #666699; font-weight: bold;">function</span> GoogleEncode <span style="color: #333;">&#123;</span><br />
<span style="color: #666699; font-weight: bold;">BEGIN</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">## Google's odydecody is a 64 character array</span><br />
&nbsp; &nbsp;<span style="color: #660033; font-weight: bold;">$ody</span> <span style="color: #66cc66;">=</span> <span style="color: #009900;">&quot;A&quot;</span>,<span style="color: #009900;">&quot;B&quot;</span>,<span style="color: #009900;">&quot;C&quot;</span>,<span style="color: #009900;">&quot;D&quot;</span>,<span style="color: #009900;">&quot;E&quot;</span>,<span style="color: #009900;">&quot;F&quot;</span>,<span style="color: #009900;">&quot;G&quot;</span>,<span style="color: #009900;">&quot;H&quot;</span>,<span style="color: #009900;">&quot;I&quot;</span>,<span style="color: #009900;">&quot;J&quot;</span>,<span style="color: #009900;">&quot;K&quot;</span>,<span style="color: #009900;">&quot;L&quot;</span>,<span style="color: #009900;">&quot;M&quot;</span>,<span style="color: #009900;">&quot;N&quot;</span>,<span style="color: #009900;">&quot;O&quot;</span>,<span style="color: #009900;">&quot;P&quot;</span>,<span style="color: #009900;">&quot;Q&quot;</span>,<br />
&nbsp; &nbsp;<span style="color: #009900;">&quot;R&quot;</span>,<span style="color: #009900;">&quot;S&quot;</span>,<span style="color: #009900;">&quot;T&quot;</span>,<span style="color: #009900;">&quot;U&quot;</span>,<span style="color: #009900;">&quot;V&quot;</span>,<span style="color: #009900;">&quot;W&quot;</span>,<span style="color: #009900;">&quot;X&quot;</span>,<span style="color: #009900;">&quot;Y&quot;</span>,<span style="color: #009900;">&quot;Z&quot;</span>,<span style="color: #009900;">&quot;a&quot;</span>,<span style="color: #009900;">&quot;b&quot;</span>,<span style="color: #009900;">&quot;c&quot;</span>,<span style="color: #009900;">&quot;d&quot;</span>,<span style="color: #009900;">&quot;e&quot;</span>,<span style="color: #009900;">&quot;f&quot;</span>,<span style="color: #009900;">&quot;g&quot;</span>,<span style="color: #009900;">&quot;h&quot;</span>,<span style="color: #009900;">&quot;i&quot;</span>,<span style="color: #009900;">&quot;j&quot;</span>,<br />
&nbsp; &nbsp;<span style="color: #009900;">&quot;k&quot;</span>,<span style="color: #009900;">&quot;l&quot;</span>,<span style="color: #009900;">&quot;m&quot;</span>,<span style="color: #009900;">&quot;n&quot;</span>,<span style="color: #009900;">&quot;o&quot;</span>,<span style="color: #009900;">&quot;p&quot;</span>,<span style="color: #009900;">&quot;q&quot;</span>,<span style="color: #009900;">&quot;r&quot;</span>,<span style="color: #009900;">&quot;s&quot;</span>,<span style="color: #009900;">&quot;t&quot;</span>,<span style="color: #009900;">&quot;u&quot;</span>,<span style="color: #009900;">&quot;v&quot;</span>,<span style="color: #009900;">&quot;w&quot;</span>,<span style="color: #009900;">&quot;x&quot;</span>,<span style="color: #009900;">&quot;y&quot;</span>,<span style="color: #009900;">&quot;z&quot;</span>,<span style="color: #009900;">&quot;0&quot;</span>,<span style="color: #009900;">&quot;1&quot;</span>,<span style="color: #009900;">&quot;2&quot;</span>,<br />
&nbsp; &nbsp;<span style="color: #009900;">&quot;3&quot;</span>,<span style="color: #009900;">&quot;4&quot;</span>,<span style="color: #009900;">&quot;5&quot;</span>,<span style="color: #009900;">&quot;6&quot;</span>,<span style="color: #009900;">&quot;7&quot;</span>,<span style="color: #009900;">&quot;8&quot;</span>,<span style="color: #009900;">&quot;9&quot;</span>,<span style="color: #009900;">&quot;-&quot;</span>,<span style="color: #009900;">&quot;.&quot;</span><br />
<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">## The actual filter function</span><br />
&nbsp; &nbsp;<span style="color: #666699; font-weight: bold;">filter</span> encode <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># we have a hard-coded &quot;overflow&quot; value </span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$_</span> <span style="color: #000066;">-ge</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$ody</span>.<span style="color: #003366;">Count</span> <span style="color: #66cc66;">*</span> <span style="color: #660033; font-weight: bold;">$ody</span>.<span style="color: #003366;">Count</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span> <span style="color: #666699; font-weight: bold;">return</span> <span style="color: #009900;">&quot;__&quot;</span> <span style="color: #333;">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$y</span> <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span> &nbsp;<span style="color: #666666; font-style: italic;"># $y is a ref variable, so it has to be defined</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$x</span> <span style="color: #66cc66;">=</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>Math<span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">DivRem</span><span style="color: #333;">&#40;</span> <span style="color: #660033; font-weight: bold;">$_</span>, <span style="color: #660033; font-weight: bold;">$ody</span>.<span style="color: #003366;">Count</span>, <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">ref</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$y</span> <span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">return</span> <span style="color: #009900;">&quot;$($ody[$x])$($ody[$y])&quot;</span><br />
&nbsp; &nbsp;<span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">## Handle numbers as parameters</span><br />
&nbsp; &nbsp;<span style="color: #666699; font-weight: bold;">foreach</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$i</span> <span style="color: #666699; font-weight: bold;">in</span> <span style="color: #660033; font-weight: bold;">$args</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$i</span> <span style="color: #66cc66;">|</span> encode<br />
&nbsp; &nbsp;<span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span><br />
<span style="color: #666666; font-style: italic;">## Or handle numbers from the pipeline. We don't care :-)</span><br />
<span style="color: #666699; font-weight: bold;">PROCESS</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$_</span> <span style="color: #000066;">-ne</span> <span style="color: #660033; font-weight: bold;">$null</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span> <span style="color: #660033; font-weight: bold;">$_</span> <span style="color: #66cc66;">|</span> encode <span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span></div>

	<p>That&#8217;s the whole thing &#8230; it&#8217;s really only about three lines of code (including the definition of <code>$ody</code>), but the rest is necessary to make it handle parameters or pipeline values.  <img src='http://huddledmasses.org/wordpress/wp-includes/' alt=':D' class='wp-smiley' /> </p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/google-charts-from-powershell-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

